|
@@ -1,21 +1,26 @@
|
|
|
package com.aoyang.tms.service.impl;
|
|
package com.aoyang.tms.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import com.aoyang.tms.controller.vo.TmsLineCostDetail;
|
|
|
|
|
+import com.aoyang.tms.controller.vo.TmsLineCostListVO;
|
|
|
|
|
+import com.aoyang.tms.controller.vo.TmsOtherFeeListVO;
|
|
|
import com.aoyang.tms.controller.vo.WorkLogTplVO;
|
|
import com.aoyang.tms.controller.vo.WorkLogTplVO;
|
|
|
-import com.aoyang.tms.entity.TmsGasFee;
|
|
|
|
|
-import com.aoyang.tms.service.CommonService;
|
|
|
|
|
-import com.aoyang.tms.service.JxlsExportTestService;
|
|
|
|
|
-import com.aoyang.tms.service.TmsGasFeeService;
|
|
|
|
|
|
|
+import com.aoyang.tms.entity.*;
|
|
|
|
|
+import com.aoyang.tms.service.*;
|
|
|
import com.aoyang.tms.util.FileUtil;
|
|
import com.aoyang.tms.util.FileUtil;
|
|
|
import com.aoyang.tms.util.JxlsUtils;
|
|
import com.aoyang.tms.util.JxlsUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
|
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -25,7 +30,71 @@ import java.util.Map;
|
|
|
public class JxlsExportTestServiceImpl implements JxlsExportTestService {
|
|
public class JxlsExportTestServiceImpl implements JxlsExportTestService {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
|
|
+ private TmsLineCostService tmsLineCostService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private TmsLineCostOtherService tmsLineCostOtherService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private TmsOtherFeeService tmsOtherFeeService;
|
|
|
|
|
+ @Resource
|
|
|
private TmsGasFeeService tmsGasFeeService;
|
|
private TmsGasFeeService tmsGasFeeService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private WorkOrderService workOrderService;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public WorkLogTplVO workLogTplVO(WorkOrder param) {
|
|
|
|
|
+ WorkLogTplVO workLogTplVO = new WorkLogTplVO();
|
|
|
|
|
+ //根据行程周期获取运单列表,按时间正序,第一单为装单,接下来为顺序卸单
|
|
|
|
|
+ QueryWrapper<WorkOrder> workOrderQueryWrapper = new QueryWrapper<WorkOrder>();
|
|
|
|
|
+ if (param.getCycleId() != null) {
|
|
|
|
|
+ workOrderQueryWrapper.eq("cycle_id", param.getCycleId());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<WorkOrder> workOrderList = workOrderService.list(workOrderQueryWrapper.orderByAsc("execute_time"));
|
|
|
|
|
+ //根据每个运单以及行程周期获取各个log日志,拿取且赋值
|
|
|
|
|
+ List<WorkOrder> workOrders = new ArrayList<>();
|
|
|
|
|
+ int listSize = workOrderList.size();
|
|
|
|
|
+ for (int i = 0; i < listSize; i++) {
|
|
|
|
|
+ WorkOrder workOrderParam = workOrderList.get(i);
|
|
|
|
|
+ workOrders.add(workOrderParam);
|
|
|
|
|
+ }
|
|
|
|
|
+ workLogTplVO.setWorkOrderList(workOrders);
|
|
|
|
|
+
|
|
|
|
|
+ //根据行程周期和卡车id获取行程费用、加气费用、其他费用
|
|
|
|
|
+
|
|
|
|
|
+ //行程费用
|
|
|
|
|
+ TmsLineCost tmsLineCost = new TmsLineCost();
|
|
|
|
|
+ tmsLineCost.setTruckId(param.getTruckId());
|
|
|
|
|
+ tmsLineCost.setCycleId(param.getCycleId());
|
|
|
|
|
+ List<TmsLineCostListVO> tmsLineCostList = tmsLineCostService.list(tmsLineCost);
|
|
|
|
|
+ for (TmsLineCostListVO tmsLineCostListVO : tmsLineCostList) {
|
|
|
|
|
+
|
|
|
|
|
+ TmsLineCost tmsLineCostParam = new TmsLineCost();
|
|
|
|
|
+ tmsLineCostParam.setId(tmsLineCostListVO.getId());
|
|
|
|
|
+ List<TmsLineCostOther> tmsLineCostOtherList = tmsLineCostOtherService.list(tmsLineCostParam);
|
|
|
|
|
+ tmsLineCostListVO.setLineOtherCost("其他费用:");
|
|
|
|
|
+ for (TmsLineCostOther tmsLineCostOther : tmsLineCostOtherList) {
|
|
|
|
|
+ tmsLineCostListVO.setLineOtherCost(tmsLineCostListVO.getLineOtherCost()+tmsLineCostOther.getCostName()+tmsLineCostOther.getCostFee()+";");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ workLogTplVO.setTmsLineCostList(tmsLineCostList);
|
|
|
|
|
+
|
|
|
|
|
+ //加气费用
|
|
|
|
|
+ TmsGasFee tmsGasFee = new TmsGasFee();
|
|
|
|
|
+ tmsGasFee.setTruckId(param.getTruckId());
|
|
|
|
|
+ tmsGasFee.setCycleId(param.getCycleId());
|
|
|
|
|
+ List<TmsGasFee> tmsGasFeeList = tmsGasFeeService.list(tmsGasFee);
|
|
|
|
|
+ workLogTplVO.setTmsGasFeeList(tmsGasFeeList);
|
|
|
|
|
+
|
|
|
|
|
+ //其他费用
|
|
|
|
|
+ TmsOtherFee tmsOtherFee = new TmsOtherFee();
|
|
|
|
|
+ tmsOtherFee.setTruckId(param.getTruckId());
|
|
|
|
|
+ tmsOtherFee.setCycleId(param.getCycleId());
|
|
|
|
|
+ List<TmsOtherFeeListVO> tmsOtherFeeListVOList = tmsOtherFeeService.list(tmsOtherFee);
|
|
|
|
|
+ for (TmsOtherFeeListVO tmsOtherFeeListVO : tmsOtherFeeListVOList) {
|
|
|
|
|
+ tmsOtherFee = tmsOtherFeeService.getById(tmsOtherFeeListVO.getOtherFeeId());
|
|
|
|
|
+ workLogTplVO.setTmsOtherFee(tmsOtherFee);
|
|
|
|
|
+ }
|
|
|
|
|
+ return workLogTplVO;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public StreamingResponseBody download(TmsGasFee param, HttpServletResponse response) throws IOException {
|
|
public StreamingResponseBody download(TmsGasFee param, HttpServletResponse response) throws IOException {
|