Commit 0415c4b3 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into dev

parents f49c021d a0de74b0
...@@ -35,8 +35,9 @@ public class CompanyPerformanceBo { ...@@ -35,8 +35,9 @@ public class CompanyPerformanceBo {
private BigDecimal extralAmount; private BigDecimal extralAmount;
private Integer departureNum; private Integer departureNum;
private Integer arrivalNum; private Integer arrivalNum;
private Date startDate; private String startDate;
private Date endDate; private String endDate;
private String dateStr;
public BigDecimal getMemberAmount() { public BigDecimal getMemberAmount() {
return memberAmount==null?BigDecimal.ZERO:memberAmount; return memberAmount==null?BigDecimal.ZERO:memberAmount;
......
...@@ -32,4 +32,15 @@ public class CompanyPerformanceFindDTO extends PageParam { ...@@ -32,4 +32,15 @@ public class CompanyPerformanceFindDTO extends PageParam {
private String companyName; private String companyName;
private Integer companyId; private Integer companyId;
private long startIndex;
private long endInex;
public long getStartIndex() {
return getPage()==null?0:getPage()==0?0:(getPage()-1)*getLimit();
}
public long getEndInex() {
return getLimit()==null?20:getLimit()==0?20:(getStartIndex()+getLimit());
}
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.bo.CompanyPerformanceBo; import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import com.xxfc.platform.order.contant.enumerate.ReceivedStatisticsEnum; import com.xxfc.platform.order.contant.enumerate.ReceivedStatisticsEnum;
import com.xxfc.platform.order.entity.OrderReceivedStatistics;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO; import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -43,8 +44,7 @@ public class CompanyPerformanceBiz { ...@@ -43,8 +44,7 @@ public class CompanyPerformanceBiz {
*/ */
public void exportOrderReceivedStatisticsData(CompanyPerformanceFindDTO companyPerformanceFindDTO, ServletOutputStream outputStream) throws IOException { public void exportOrderReceivedStatisticsData(CompanyPerformanceFindDTO companyPerformanceFindDTO, ServletOutputStream outputStream) throws IOException {
//1.查询数据 //1.查询数据
PageDataVO<CompanyPerformanceBo> pageDataVO = selectCompanyPerformancePage(companyPerformanceFindDTO); List<CompanyPerformanceBo> companyPerformanceBos = selectCompanyPerformances(companyPerformanceFindDTO);
List<CompanyPerformanceBo> data = pageDataVO.getData();
//excel相关 //excel相关
XSSFWorkbook hssfWorkbook = new XSSFWorkbook(); XSSFWorkbook hssfWorkbook = new XSSFWorkbook();
...@@ -58,7 +58,7 @@ public class CompanyPerformanceBiz { ...@@ -58,7 +58,7 @@ public class CompanyPerformanceBiz {
} }
//设置数据 //设置数据
CellStyle generalCellStyle = createGeneralCellStyle(hssfWorkbook); CellStyle generalCellStyle = createGeneralCellStyle(hssfWorkbook);
List<String[]> companyStatisticsData = getCompanyStatisticsData(data, companyPerformanceFindDTO.getStatisticalWay()); List<String[]> companyStatisticsData = getCompanyStatisticsData(companyPerformanceBos, companyPerformanceFindDTO.getStatisticalWay());
createCompnayStatisticsCellData(sheet, 1, generalCellStyle, companyStatisticsData); createCompnayStatisticsCellData(sheet, 1, generalCellStyle, companyStatisticsData);
hssfWorkbook.write(outputStream); hssfWorkbook.write(outputStream);
hssfWorkbook.close(); hssfWorkbook.close();
...@@ -93,15 +93,13 @@ public class CompanyPerformanceBiz { ...@@ -93,15 +93,13 @@ public class CompanyPerformanceBiz {
private String[] getData(CompanyPerformanceBo companyPerformanceBo, Integer statisticalWay) { private String[] getData(CompanyPerformanceBo companyPerformanceBo, Integer statisticalWay) {
String dateStr = ""; String dateStr = "";
if (statisticalWay == ReceivedStatisticsEnum.DAY.getWayCode()) { if (statisticalWay == ReceivedStatisticsEnum.DAY.getWayCode()) {
dateStr = DateUtil.format(companyPerformanceBo.getDate(),"yyyy.MM.dd"); dateStr = companyPerformanceBo.getDateStr();
} }
if (statisticalWay == ReceivedStatisticsEnum.WEEK.getWayCode()) { if (statisticalWay == ReceivedStatisticsEnum.WEEK.getWayCode()) {
String startDateStr = DateUtil.format(companyPerformanceBo.getStartDate(), "yyyy.MM.dd"); dateStr=String.format("%s~%s",companyPerformanceBo.getStartDate(),companyPerformanceBo.getEndDate());
String endDateStr = DateUtil.format(companyPerformanceBo.getEndDate(), "yyyy.MM.dd");
dateStr=String.format("%s~%s",startDateStr,endDateStr);
} }
if (statisticalWay == ReceivedStatisticsEnum.MONTH.getWayCode()) { if (statisticalWay == ReceivedStatisticsEnum.MONTH.getWayCode()) {
dateStr = String.format("%d.%s",companyPerformanceBo.getYear(),companyPerformanceBo.getMonth().replace(companyPerformanceBo.getYear()+"","")); dateStr = companyPerformanceBo.getMonth();
} }
return new String[]{ return new String[]{
dateStr, dateStr,
...@@ -151,6 +149,32 @@ public class CompanyPerformanceBiz { ...@@ -151,6 +149,32 @@ public class CompanyPerformanceBiz {
return font; return font;
} }
public List<CompanyPerformanceBo> selectCompanyPerformances(CompanyPerformanceFindDTO companyPerformanceFindDTO){
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
List<CompanyPerformanceBo> companyPerformanceBos = new ArrayList<>();
//日统计
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.DAY.getWayCode()) {
companyPerformanceBos = orderReceivedStatisticsBiz.selectCompanyPerformanceWithDay(companyPerformanceFindDTO);
}
//按周
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.WEEK.getWayCode()) {
companyPerformanceBos = orderReceivedStatisticsBiz.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO);
}
//按月
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.MONTH.getWayCode()) {
companyPerformanceBos = orderReceivedStatisticsBiz.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO);
}
if (CollectionUtils.isEmpty(companyPerformanceBos)) {
return companyPerformanceBos;
}
companyPerformanceBos = wrapCompanyPermanceBo(companyPerformanceBos, companyMap, companyPerformanceFindDTO.getStatisticalWay());
return companyPerformanceBos;
}
/** /**
* 分页查询公司业绩 * 分页查询公司业绩
* *
...@@ -179,10 +203,28 @@ public class CompanyPerformanceBiz { ...@@ -179,10 +203,28 @@ public class CompanyPerformanceBiz {
if (CollectionUtils.isEmpty(data)) { if (CollectionUtils.isEmpty(data)) {
return pageDataVO; return pageDataVO;
} }
for (CompanyPerformanceBo companyPerformanceBo : data) { List<CompanyPerformanceBo> companyPerformanceBos = wrapCompanyPermanceBo(data, companyMap, companyPerformanceFindDTO.getStatisticalWay());
pageDataVO.setData(companyPerformanceBos);
if (companyPerformanceFindDTO.getPage() == 1) {
OrderReceivedStatistics orderReceivedStatistics = new OrderReceivedStatistics();
if (Objects.nonNull(companyPerformanceFindDTO.getCompanyId())) {
orderReceivedStatistics.setCompanyId(companyPerformanceFindDTO.getCompanyId());
}
Long totlCount = orderReceivedStatisticsBiz.selectCount(orderReceivedStatistics);
long isZero = totlCount % companyPerformanceFindDTO.getLimit();
long totalPage = isZero == 0 ? totlCount / companyPerformanceFindDTO.getLimit() : totlCount / companyPerformanceFindDTO.getLimit() + 1;
pageDataVO.setTotalCount(totlCount);
pageDataVO.setTotalPage(Integer.valueOf(String.valueOf(totalPage)));
}
return pageDataVO;
}
public List<CompanyPerformanceBo> wrapCompanyPermanceBo(List<CompanyPerformanceBo> companyPerformanceBos,Map<Integer,String> companyMap,Integer statisticsWay){
for (CompanyPerformanceBo companyPerformanceBo : companyPerformanceBos) {
String companyName = companyMap == null ? "" : companyMap.get(companyPerformanceBo.getCompanyId()); String companyName = companyMap == null ? "" : companyMap.get(companyPerformanceBo.getCompanyId());
companyPerformanceBo.setCompanyName(companyName); companyPerformanceBo.setCompanyName(companyName);
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.WEEK.getWayCode()) { if (statisticsWay == ReceivedStatisticsEnum.WEEK.getWayCode()) {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setFirstDayOfWeek(Calendar.MONDAY);
cal.set(Calendar.YEAR, companyPerformanceBo.getYear()); cal.set(Calendar.YEAR, companyPerformanceBo.getYear());
...@@ -191,11 +233,19 @@ public class CompanyPerformanceBiz { ...@@ -191,11 +233,19 @@ public class CompanyPerformanceBiz {
Date startDate = cal.getTime(); Date startDate = cal.getTime();
cal.add(Calendar.DAY_OF_WEEK, 6); cal.add(Calendar.DAY_OF_WEEK, 6);
Date endDate = cal.getTime(); Date endDate = cal.getTime();
companyPerformanceBo.setStartDate(DateUtil.beginOfDay(startDate)); companyPerformanceBo.setStartDate(DateUtil.format(startDate,"yyyy.MM.dd"));
companyPerformanceBo.setEndDate(DateUtil.beginOfDay(endDate)); companyPerformanceBo.setEndDate(DateUtil.format(endDate,"yyyy.MM.dd"));
companyPerformanceBo.setWeekOfYear(String.format("%s.%s",companyPerformanceBo.getYear()+"",companyPerformanceBo.getWeekOfYear().replace(companyPerformanceBo.getYear()+"","")));
} }
if(statisticsWay == ReceivedStatisticsEnum.DAY.getWayCode()) {
companyPerformanceBo.setDateStr(DateUtil.format(companyPerformanceBo.getDate(),"yyyy.MM.dd"));
} }
return pageDataVO;
if (statisticsWay == ReceivedStatisticsEnum.MONTH.getWayCode()){
companyPerformanceBo.setMonth(String.format("%s.%s",companyPerformanceBo.getYear()+"",companyPerformanceBo.getMonth().replace(companyPerformanceBo.getYear()+"","")));
} }
}
return companyPerformanceBos;
}
} }
...@@ -60,8 +60,17 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -60,8 +60,17 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
* @return * @return
*/ */
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithDayPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) { public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithDayPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(), List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO);
() -> mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO)); PageDataVO<CompanyPerformanceBo> pageDataVO = new PageDataVO<>();
pageDataVO.setData(companyPerformanceBos);
return pageDataVO;
/* return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO));*/
}
public List<CompanyPerformanceBo> selectCompanyPerformanceWithDay(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO);
return CollectionUtils.isEmpty(companyPerformanceBos)?Collections.EMPTY_LIST:companyPerformanceBos;
} }
/** /**
...@@ -71,10 +80,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -71,10 +80,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
* @return * @return
*/ */
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithMonthPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) { public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithMonthPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(), /* return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO)); () -> mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO));*/
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO);
PageDataVO<CompanyPerformanceBo> pageDataVO = new PageDataVO<>();
pageDataVO.setData(companyPerformanceBos);
return pageDataVO;
} }
public List<CompanyPerformanceBo> selectCompanyPerformanceWithMonth(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO);
return CollectionUtils.isEmpty(companyPerformanceBos)?Collections.EMPTY_LIST:companyPerformanceBos;
}
/** /**
* 公司业绩(按周统计) * 公司业绩(按周统计)
* *
...@@ -82,11 +99,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -82,11 +99,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
* @return * @return
*/ */
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithWeekPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) { public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithWeekPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(), /*return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO)); () -> mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO));*/
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO);
PageDataVO<CompanyPerformanceBo> pageDataVO = new PageDataVO<>();
pageDataVO.setData(companyPerformanceBos);
return pageDataVO;
} }
public List<CompanyPerformanceBo> selectCompanyPerformanceWithWeek(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO);
return CollectionUtils.isEmpty(companyPerformanceBos)?Collections.EMPTY_LIST:companyPerformanceBos;
}
/** /**
* 订单统计数据导出 * 订单统计数据导出
* *
......
...@@ -101,7 +101,7 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat ...@@ -101,7 +101,7 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
String filePath = ovUpload + realFileRelPath; String filePath = ovUpload + realFileRelPath;
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath)); FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return ObjectRestResponse.succ(filePath); return ObjectRestResponse.succ(filePath);
} }
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
`company_id` , `company_id` ,
`year`, `year`,
`date` `date`
limit #{startIndex},#{endInex}
) AS `ors` ) AS `ors`
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -134,8 +135,10 @@ ...@@ -134,8 +135,10 @@
`company_id`, `company_id`,
`count_year`, `count_year`,
`count_date` `count_date`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId ) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_date = ors.date AND ovss.count_date = ors.date
<!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
</select> </select>
<!--按月统计--> <!--按月统计-->
...@@ -184,6 +187,7 @@ ...@@ -184,6 +187,7 @@
company_id, company_id,
`year`, `year`,
`month` `month`
limit #{startIndex},#{endInex}
) AS `ors` ) AS `ors`
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -215,8 +219,10 @@ ...@@ -215,8 +219,10 @@
`company_id`, `company_id`,
`count_year`, `count_year`,
`count_month` `count_month`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId ) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_month = ors.month AND ovss.count_month = ors.month
<!--order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
</select> </select>
<!--按周统计--> <!--按周统计-->
...@@ -264,6 +270,7 @@ ...@@ -264,6 +270,7 @@
company_id, company_id,
`year`, `year`,
`week_of_year` `week_of_year`
limit #{startIndex},#{endInex}
) AS `ors` ) AS `ors`
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -296,8 +303,10 @@ ...@@ -296,8 +303,10 @@
`company_id`, `company_id`,
`count_year`, `count_year`,
`count_week` `count_week`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId ) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_week = ors.weekOfYear AND ovss.count_week = ors.weekOfYear
<!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
</select> </select>
</mapper> </mapper>
\ No newline at end of file
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.xxfc.platform.order.OrderApplication; import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.*; import com.xxfc.platform.order.biz.*;
...@@ -15,6 +16,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...@@ -15,6 +16,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
...@@ -123,6 +126,17 @@ public class ServiceTest { ...@@ -123,6 +126,17 @@ public class ServiceTest {
@Test @Test
@SneakyThrows @SneakyThrows
public void testOrderReceivedStatisticsJobHandler(){ public void testOrderReceivedStatisticsJobHandler(){
orderReceivedStatisticsJobHandler.execute(""); cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-10-01", "yyyy-MM-dd");
cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1);
LocalDate startLocalDate = LocalDate.of(2019, 10, 1);
LocalDate endLocalDate = LocalDate.of(2019,11,29);
while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1);
orderReceivedStatisticsJobHandler.execute(dateStr);
}
} }
} }
...@@ -101,4 +101,6 @@ public class VehicleDepartureLog { ...@@ -101,4 +101,6 @@ public class VehicleDepartureLog {
String departureRemark; String departureRemark;
String arrivalRemark; String arrivalRemark;
} }
...@@ -32,4 +32,32 @@ public class DepartureLogVo extends VehicleDepartureLog { ...@@ -32,4 +32,32 @@ public class DepartureLogVo extends VehicleDepartureLog {
*/ */
private String numberPlate; private String numberPlate;
/**
* 接受公司
*/
private String arrivalName;
/**
* 出车公司
*/
private String departureName;
/**
* 公里数统计
*/
private Integer mileage;
/**
* 时间天数统计
*/
private String departureDay;
/**
* 内部用途备注
*/
private String remark;
} }
...@@ -86,17 +86,23 @@ ...@@ -86,17 +86,23 @@
</select> </select>
<select id="selectVoAll" resultMap="searchBookRecord"> <select id="selectVoAll" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date, select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,bc2.remark,
/* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/ IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0),
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天', CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time) unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
- unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时') IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName, as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0)
as mileage
from vehicle_departure_log from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id
LEFT JOIN vehicle_book_record bc2 ON vehicle_departure_log.book_record_id = bc2.id
<trim prefix="where"> <trim prefix="where">
1=1 1=1
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
...@@ -118,21 +124,33 @@ ...@@ -118,21 +124,33 @@
<if test="departureId!=null"> <if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId} and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if> </if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if>
</trim> </trim>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectVoAllNotAllData" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"> <select id="selectVoAllNotAllData" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate, select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,bc2.remark,
/*IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/ IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0),
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天', CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time) unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
- unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时') IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName, as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0)
as mileage
from vehicle_departure_log from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id
LEFT JOIN vehicle_book_record bc2 ON vehicle_departure_log.book_record_id = bc2.id
<trim prefix="where" suffixOverrides="and"> <trim prefix="where" suffixOverrides="and">
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
vehicle.number_plate = #{numberPlate} and vehicle.number_plate = #{numberPlate} and
...@@ -175,6 +193,12 @@ ...@@ -175,6 +193,12 @@
<if test="departureId!=null"> <if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId} and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if> </if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if>
</trim> </trim>
order by create_time desc order by create_time desc
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment