Parcourir la source

jxls导出数据列

chengang il y a 4 ans
Parent
commit
ced198a3d0

+ 22 - 0
src/main/java/com/aoyang/tms/controller/vo/TmsGasFeeVO.java

@@ -0,0 +1,22 @@
+package com.aoyang.tms.controller.vo;
+
+import com.aoyang.tms.entity.TmsGasFee;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class TmsGasFeeVO extends TmsGasFee {
+
+    @ApiModelProperty(value = "加气金额1现金")
+    private BigDecimal tplCash;
+
+    @ApiModelProperty(value = "加气金额2大象加气")
+    private BigDecimal tplGasElephant;
+
+    @ApiModelProperty(value = "加气金额3固定加气站")
+    private BigDecimal tplGasStation;
+
+}

+ 16 - 4
src/main/java/com/aoyang/tms/controller/vo/WorkLogTplVO.java

@@ -1,8 +1,6 @@
 package com.aoyang.tms.controller.vo;
 package com.aoyang.tms.controller.vo;
 
 
-import com.aoyang.tms.entity.TmsGasFee;
-import com.aoyang.tms.entity.TmsOtherFee;
-import com.aoyang.tms.entity.WorkOrder;
+import com.aoyang.tms.entity.*;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
@@ -19,11 +17,25 @@ public class WorkLogTplVO {
     private List<TmsLineCostListVO> tmsLineCostList;
     private List<TmsLineCostListVO> tmsLineCostList;
 
 
     @ApiModelProperty(value = "燃气费用列表")
     @ApiModelProperty(value = "燃气费用列表")
-    private List<TmsGasFee> tmsGasFeeList;
+    private List<TmsGasFeeVO> tmsGasFeeList;
 
 
     @ApiModelProperty(value = "其他费用列表")
     @ApiModelProperty(value = "其他费用列表")
     private TmsOtherFee tmsOtherFee;
     private TmsOtherFee tmsOtherFee;
 
 
+    @ApiModelProperty(value = "行车周期")
+    private WorkCycle workCycle;
+
+    @ApiModelProperty(value = "车辆休息列表")
+    private List<RestInfo> restInfoList;
+
+    @ApiModelProperty(value = "车辆维修列表")
+    private List<TruckRepairInfo> truckRepairInfoList;
+
+    @ApiModelProperty(value = "车辆检查列表")
+    private List<TruckCheckInfo> truckCheckInfoList;
+
+
+
     @ApiModelProperty(value = "车牌号")
     @ApiModelProperty(value = "车牌号")
     private String carNumber;
     private String carNumber;
 
 

+ 12 - 0
src/main/java/com/aoyang/tms/service/RestInfoService.java

@@ -1,8 +1,11 @@
 package com.aoyang.tms.service;
 package com.aoyang.tms.service;
 
 
 import com.aoyang.tms.entity.RestInfo;
 import com.aoyang.tms.entity.RestInfo;
+import com.aoyang.tms.entity.WorkOrder;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 车辆休息详情表 服务类
  * 车辆休息详情表 服务类
@@ -13,4 +16,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface RestInfoService extends IService<RestInfo> {
 public interface RestInfoService extends IService<RestInfo> {
 
 
+    /**
+     * @return
+     * @Author chengang
+     * @Description 根据卡车id和周期id查询车辆休息列表
+     * @Date 2022/4/26
+     * @Param
+     **/
+    List<RestInfo> findRestInfoList(Long truckId, Long workCycleId);
+
 }
 }

+ 15 - 3
src/main/java/com/aoyang/tms/service/TruckCheckInfoService.java

@@ -1,8 +1,11 @@
 package com.aoyang.tms.service;
 package com.aoyang.tms.service;
 
 
 import com.aoyang.tms.entity.TruckCheckInfo;
 import com.aoyang.tms.entity.TruckCheckInfo;
+import com.aoyang.tms.entity.TruckRepairInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 车辆检查详情表 服务类
  * 车辆检查详情表 服务类
@@ -14,11 +17,20 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface TruckCheckInfoService extends IService<TruckCheckInfo> {
 public interface TruckCheckInfoService extends IService<TruckCheckInfo> {
 
 
     /**
     /**
+     * @return
      * @Author guoyong
      * @Author guoyong
      * @Description 根据行程周期获取检查信息
      * @Description 根据行程周期获取检查信息
-     * @Date  2022/4/23
+     * @Date 2022/4/23
      * @Param
      * @Param
+     **/
+    TruckCheckInfo findTruckCheckInfo(Long cycleId, Integer type);
+
+    /**
      * @return
      * @return
-    **/
-    TruckCheckInfo findTruckCheckInfo(Long cycleId,Integer type);
+     * @Author chengang
+     * @Description 根据卡车id和周期id查询车辆检查列表
+     * @Date 2022/4/26
+     * @Param
+     **/
+    List<TruckCheckInfo> findTruckCheckInfoList(Long truckId, Long workCycleId, Integer type);
 }
 }

+ 12 - 0
src/main/java/com/aoyang/tms/service/TruckRepairInfoService.java

@@ -1,8 +1,11 @@
 package com.aoyang.tms.service;
 package com.aoyang.tms.service;
 
 
+import com.aoyang.tms.entity.RestInfo;
 import com.aoyang.tms.entity.TruckRepairInfo;
 import com.aoyang.tms.entity.TruckRepairInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 车辆维修详情表 服务类
  * 车辆维修详情表 服务类
@@ -13,4 +16,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface TruckRepairInfoService extends IService<TruckRepairInfo> {
 public interface TruckRepairInfoService extends IService<TruckRepairInfo> {
 
 
+    /**
+     * @return
+     * @Author chengang
+     * @Description 根据卡车id和周期id查询车辆维修列表
+     * @Date 2022/4/26
+     * @Param
+     **/
+    List<TruckRepairInfo> findTruckRepairInfoList(Long truckId, Long workCycleId);
+
 }
 }

+ 48 - 7
src/main/java/com/aoyang/tms/service/impl/JxlsExportTestServiceImpl.java

@@ -1,10 +1,7 @@
 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.*;
 import com.aoyang.tms.entity.*;
 import com.aoyang.tms.entity.*;
 import com.aoyang.tms.service.*;
 import com.aoyang.tms.service.*;
 import com.aoyang.tms.util.FileUtil;
 import com.aoyang.tms.util.FileUtil;
@@ -39,10 +36,22 @@ public class JxlsExportTestServiceImpl implements JxlsExportTestService {
     private TmsGasFeeService tmsGasFeeService;
     private TmsGasFeeService tmsGasFeeService;
     @Resource
     @Resource
     private WorkOrderService workOrderService;
     private WorkOrderService workOrderService;
+    @Resource
+    private WorkCycleService workCycleService;
+    @Resource
+    private RestInfoService restInfoService;
+    @Resource
+    private TruckRepairInfoService truckRepairInfoService;
+    @Resource
+    private TruckCheckInfoService truckCheckInfoService;
 
 
     @Override
     @Override
     public WorkLogTplVO workLogTplVO(WorkOrder param) {
     public WorkLogTplVO workLogTplVO(WorkOrder param) {
         WorkLogTplVO workLogTplVO = new WorkLogTplVO();
         WorkLogTplVO workLogTplVO = new WorkLogTplVO();
+
+        WorkCycle workCycle = workCycleService.getById(param.getCycleId());
+        workLogTplVO.setWorkCycle(workCycle);
+
         //根据行程周期获取运单列表,按时间正序,第一单为装单,接下来为顺序卸单
         //根据行程周期获取运单列表,按时间正序,第一单为装单,接下来为顺序卸单
         QueryWrapper<WorkOrder> workOrderQueryWrapper = new QueryWrapper<WorkOrder>();
         QueryWrapper<WorkOrder> workOrderQueryWrapper = new QueryWrapper<WorkOrder>();
         if (param.getCycleId() != null) {
         if (param.getCycleId() != null) {
@@ -66,13 +75,12 @@ public class JxlsExportTestServiceImpl implements JxlsExportTestService {
         tmsLineCost.setCycleId(param.getCycleId());
         tmsLineCost.setCycleId(param.getCycleId());
         List<TmsLineCostListVO> tmsLineCostList = tmsLineCostService.list(tmsLineCost);
         List<TmsLineCostListVO> tmsLineCostList = tmsLineCostService.list(tmsLineCost);
         for (TmsLineCostListVO tmsLineCostListVO : tmsLineCostList) {
         for (TmsLineCostListVO tmsLineCostListVO : tmsLineCostList) {
-
             TmsLineCost tmsLineCostParam = new TmsLineCost();
             TmsLineCost tmsLineCostParam = new TmsLineCost();
             tmsLineCostParam.setId(tmsLineCostListVO.getId());
             tmsLineCostParam.setId(tmsLineCostListVO.getId());
             List<TmsLineCostOther> tmsLineCostOtherList = tmsLineCostOtherService.list(tmsLineCostParam);
             List<TmsLineCostOther> tmsLineCostOtherList = tmsLineCostOtherService.list(tmsLineCostParam);
             tmsLineCostListVO.setLineOtherCost("其他费用:");
             tmsLineCostListVO.setLineOtherCost("其他费用:");
             for (TmsLineCostOther tmsLineCostOther : tmsLineCostOtherList) {
             for (TmsLineCostOther tmsLineCostOther : tmsLineCostOtherList) {
-                tmsLineCostListVO.setLineOtherCost(tmsLineCostListVO.getLineOtherCost()+tmsLineCostOther.getCostName()+tmsLineCostOther.getCostFee()+";");
+                tmsLineCostListVO.setLineOtherCost(tmsLineCostListVO.getLineOtherCost() + tmsLineCostOther.getCostName() + tmsLineCostOther.getCostFee() + ";");
             }
             }
         }
         }
         workLogTplVO.setTmsLineCostList(tmsLineCostList);
         workLogTplVO.setTmsLineCostList(tmsLineCostList);
@@ -82,7 +90,23 @@ public class JxlsExportTestServiceImpl implements JxlsExportTestService {
         tmsGasFee.setTruckId(param.getTruckId());
         tmsGasFee.setTruckId(param.getTruckId());
         tmsGasFee.setCycleId(param.getCycleId());
         tmsGasFee.setCycleId(param.getCycleId());
         List<TmsGasFee> tmsGasFeeList = tmsGasFeeService.list(tmsGasFee);
         List<TmsGasFee> tmsGasFeeList = tmsGasFeeService.list(tmsGasFee);
-        workLogTplVO.setTmsGasFeeList(tmsGasFeeList);
+        List<TmsGasFeeVO> tmsGasFeeVOList = new ArrayList<>();
+        for (TmsGasFee tmsGasFee1 : tmsGasFeeList) {
+            TmsGasFeeVO tmsGasFeeVO = new TmsGasFeeVO();
+            BeanUtils.copyProperties(tmsGasFee1, tmsGasFeeVO);
+            //(1现金2大象加气3固定加气站)
+            if (tmsGasFee1.getType() == 1) {
+                tmsGasFeeVO.setTplCash(tmsGasFee1.getGasQtyFee());
+            }
+            if (tmsGasFee1.getType() == 2) {
+                tmsGasFeeVO.setTplGasElephant(tmsGasFee1.getGasQtyFee());
+            }
+            if (tmsGasFee1.getType() == 3) {
+                tmsGasFeeVO.setTplGasStation(tmsGasFee1.getGasQtyFee());
+            }
+            tmsGasFeeVOList.add(tmsGasFeeVO);
+        }
+        workLogTplVO.setTmsGasFeeList(tmsGasFeeVOList);
 
 
         //其他费用
         //其他费用
         TmsOtherFee tmsOtherFee = new TmsOtherFee();
         TmsOtherFee tmsOtherFee = new TmsOtherFee();
@@ -93,6 +117,23 @@ public class JxlsExportTestServiceImpl implements JxlsExportTestService {
             tmsOtherFee = tmsOtherFeeService.getById(tmsOtherFeeListVO.getOtherFeeId());
             tmsOtherFee = tmsOtherFeeService.getById(tmsOtherFeeListVO.getOtherFeeId());
             workLogTplVO.setTmsOtherFee(tmsOtherFee);
             workLogTplVO.setTmsOtherFee(tmsOtherFee);
         }
         }
+
+        //车辆休息
+        List<RestInfo> restInfoList = restInfoService.findRestInfoList(param.getTruckId(), param.getCycleId());
+        if (restInfoList != null && restInfoList.size() > 0) {
+            workLogTplVO.setRestInfoList(restInfoList);
+        }
+        //车辆维修
+        List<TruckRepairInfo> truckRepairInfoList = truckRepairInfoService.findTruckRepairInfoList(param.getTruckId(), param.getCycleId());
+        if (truckRepairInfoList != null && truckRepairInfoList.size() > 0) {
+            workLogTplVO.setTruckRepairInfoList(truckRepairInfoList);
+        }
+        //车辆检查
+        List<TruckCheckInfo> truckCheckInfoList = truckCheckInfoService.findTruckCheckInfoList(param.getTruckId(), param.getCycleId(), 3);
+        if (truckCheckInfoList != null && truckCheckInfoList.size() > 0) {
+            workLogTplVO.setTruckCheckInfoList(truckCheckInfoList);
+        }
+
         return workLogTplVO;
         return workLogTplVO;
     }
     }
 
 

+ 16 - 0
src/main/java/com/aoyang/tms/service/impl/RestInfoServiceImpl.java

@@ -1,11 +1,15 @@
 package com.aoyang.tms.service.impl;
 package com.aoyang.tms.service.impl;
 
 
 import com.aoyang.tms.entity.RestInfo;
 import com.aoyang.tms.entity.RestInfo;
+import com.aoyang.tms.entity.WorkOrder;
 import com.aoyang.tms.mapper.RestInfoMapper;
 import com.aoyang.tms.mapper.RestInfoMapper;
 import com.aoyang.tms.service.RestInfoService;
 import com.aoyang.tms.service.RestInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 车辆休息详情表 服务实现类
  * 车辆休息详情表 服务实现类
@@ -17,4 +21,16 @@ import org.springframework.stereotype.Service;
 @Service
 @Service
 public class RestInfoServiceImpl extends ServiceImpl<RestInfoMapper, RestInfo> implements RestInfoService {
 public class RestInfoServiceImpl extends ServiceImpl<RestInfoMapper, RestInfo> implements RestInfoService {
 
 
+    @Override
+    public List<RestInfo> findRestInfoList(Long truckId, Long workCycleId) {
+        QueryWrapper<RestInfo> queryWrapper = new QueryWrapper<RestInfo>();
+        if (workCycleId != null) {
+            queryWrapper.eq("cycle_id", workCycleId);
+        }
+        if (truckId != null) {
+            queryWrapper.eq("truck_id", truckId);
+        }
+        List<RestInfo> list = list(queryWrapper.orderByAsc("create_date"));
+        return list;
+    }
 }
 }

+ 17 - 0
src/main/java/com/aoyang/tms/service/impl/TruckCheckInfoServiceImpl.java

@@ -2,6 +2,7 @@ package com.aoyang.tms.service.impl;
 
 
 import com.aoyang.tms.entity.TruckCheckInfo;
 import com.aoyang.tms.entity.TruckCheckInfo;
 import com.aoyang.tms.entity.TruckDriver;
 import com.aoyang.tms.entity.TruckDriver;
+import com.aoyang.tms.entity.TruckRepairInfo;
 import com.aoyang.tms.mapper.TruckCheckInfoMapper;
 import com.aoyang.tms.mapper.TruckCheckInfoMapper;
 import com.aoyang.tms.mapper.TruckDriverMapper;
 import com.aoyang.tms.mapper.TruckDriverMapper;
 import com.aoyang.tms.service.TruckCheckInfoService;
 import com.aoyang.tms.service.TruckCheckInfoService;
@@ -35,4 +36,20 @@ public class TruckCheckInfoServiceImpl extends ServiceImpl<TruckCheckInfoMapper,
         TruckCheckInfo truckCheckInfo = truckCheckInfoMapper.selectOne(queryWrapper);
         TruckCheckInfo truckCheckInfo = truckCheckInfoMapper.selectOne(queryWrapper);
         return truckCheckInfo;
         return truckCheckInfo;
     }
     }
+
+    @Override
+    public List<TruckCheckInfo> findTruckCheckInfoList(Long truckId, Long workCycleId, Integer type) {
+        QueryWrapper<TruckCheckInfo> queryWrapper = new QueryWrapper<TruckCheckInfo>();
+        if (workCycleId != null) {
+            queryWrapper.eq("cycle_id", workCycleId);
+        }
+        if (truckId != null) {
+            queryWrapper.eq("truck_id", truckId);
+        }
+        if (type != null) {
+            queryWrapper.eq("type", type);
+        }
+        List<TruckCheckInfo> list = list(queryWrapper.orderByAsc("create_date"));
+        return list;
+    }
 }
 }

+ 16 - 0
src/main/java/com/aoyang/tms/service/impl/TruckRepairInfoServiceImpl.java

@@ -1,11 +1,15 @@
 package com.aoyang.tms.service.impl;
 package com.aoyang.tms.service.impl;
 
 
+import com.aoyang.tms.entity.RestInfo;
 import com.aoyang.tms.entity.TruckRepairInfo;
 import com.aoyang.tms.entity.TruckRepairInfo;
 import com.aoyang.tms.mapper.TruckRepairInfoMapper;
 import com.aoyang.tms.mapper.TruckRepairInfoMapper;
 import com.aoyang.tms.service.TruckRepairInfoService;
 import com.aoyang.tms.service.TruckRepairInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 车辆维修详情表 服务实现类
  * 车辆维修详情表 服务实现类
@@ -17,4 +21,16 @@ import org.springframework.stereotype.Service;
 @Service
 @Service
 public class TruckRepairInfoServiceImpl extends ServiceImpl<TruckRepairInfoMapper, TruckRepairInfo> implements TruckRepairInfoService {
 public class TruckRepairInfoServiceImpl extends ServiceImpl<TruckRepairInfoMapper, TruckRepairInfo> implements TruckRepairInfoService {
 
 
+    @Override
+    public List<TruckRepairInfo> findTruckRepairInfoList(Long truckId, Long workCycleId) {
+        QueryWrapper<TruckRepairInfo> queryWrapper = new QueryWrapper<TruckRepairInfo>();
+        if (workCycleId != null) {
+            queryWrapper.eq("cycle_id", workCycleId);
+        }
+        if (truckId != null) {
+            queryWrapper.eq("truck_id", truckId);
+        }
+        List<TruckRepairInfo> list = list(queryWrapper.orderByAsc("create_date"));
+        return list;
+    }
 }
 }