ソースを参照

jxls导出数据列

chengang 4 年 前
コミット
3bb00266bc

+ 3 - 0
src/main/java/com/aoyang/tms/controller/vo/TmsLineCostListVO.java

@@ -13,4 +13,7 @@ public class TmsLineCostListVO extends TmsLineCost implements Serializable {
     @ApiModelProperty(value = "线路费用总数")
     private BigDecimal lineCostSum;
 
+    @ApiModelProperty(value = "线路其他费用")
+    private String lineOtherCost;
+
 }

+ 5 - 3
src/main/java/com/aoyang/tms/controller/vo/WorkLogTplVO.java

@@ -2,8 +2,7 @@ package com.aoyang.tms.controller.vo;
 
 import com.aoyang.tms.entity.TmsGasFee;
 import com.aoyang.tms.entity.TmsOtherFee;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
+import com.aoyang.tms.entity.WorkOrder;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -13,8 +12,11 @@ import java.util.List;
 @Data
 public class WorkLogTplVO {
 
+    @ApiModelProperty(value = "燃气费用列表")
+    private List<WorkOrder> workOrderList;
+
     @ApiModelProperty(value = "线路费用列表")
-    private List<TmsLineCostDetail> tmsLineCostList;
+    private List<TmsLineCostListVO> tmsLineCostList;
 
     @ApiModelProperty(value = "燃气费用列表")
     private List<TmsGasFee> tmsGasFeeList;

+ 11 - 0
src/main/java/com/aoyang/tms/service/JxlsExportTestService.java

@@ -1,6 +1,8 @@
 package com.aoyang.tms.service;
 
+import com.aoyang.tms.controller.vo.WorkLogTplVO;
 import com.aoyang.tms.entity.TmsGasFee;
+import com.aoyang.tms.entity.WorkOrder;
 import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
 
 import javax.servlet.http.HttpServletResponse;
@@ -16,5 +18,14 @@ public interface JxlsExportTestService {
      * @Date 2022/4/13
      * @Param
      **/
+    WorkLogTplVO workLogTplVO(WorkOrder param);
+
+    /**
+     * @return
+     * @Author chengang
+     * @Description 下载行车日志,财务导出专用
+     * @Date 2022/4/13
+     * @Param
+     **/
     StreamingResponseBody download(TmsGasFee param, HttpServletResponse response) throws IOException;
 }

+ 73 - 4
src/main/java/com/aoyang/tms/service/impl/JxlsExportTestServiceImpl.java

@@ -1,21 +1,26 @@
 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.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.JxlsUtils;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 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.web.servlet.mvc.method.annotation.StreamingResponseBody;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -25,7 +30,71 @@ import java.util.Map;
 public class JxlsExportTestServiceImpl implements JxlsExportTestService {
 
     @Resource
+    private TmsLineCostService tmsLineCostService;
+    @Resource
+    private TmsLineCostOtherService tmsLineCostOtherService;
+    @Resource
+    private TmsOtherFeeService tmsOtherFeeService;
+    @Resource
     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
     public StreamingResponseBody download(TmsGasFee param, HttpServletResponse response) throws IOException {