Quellcode durchsuchen

[update] 统计货损异常问题修复

miajio vor 3 Wochen
Ursprung
Commit
81e3dcca73

+ 1 - 1
warehouse-admin-data/src/main/java/com/yr/warehouse/admin/driver/mapper/DriverGoodsLossIntervalMainMapper.java

@@ -7,7 +7,6 @@ import com.yr.warehouse.admin.driver.data.DriverGoodsLossIntervalMain;
 import com.yr.warehouse.admin.driver.vo.DriverIntervalCargoDamageVo;
 import org.apache.ibatis.annotations.Param;
 
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -41,4 +40,5 @@ public interface DriverGoodsLossIntervalMainMapper extends BaseMapper<DriverGood
      * @return 司机货损统计记录
      */
     DriverGoodsLossIntervalMain queryLastByOperatorId(@Param("operatorId") Long operatorId);
+
 }

+ 5 - 0
warehouse-admin-data/src/main/java/com/yr/warehouse/admin/driver/vo/DriverGoodsLossRecordVo.java

@@ -17,6 +17,11 @@ public class DriverGoodsLossRecordVo implements OperatorNameFace, AreaStaffIdFac
     private static final long serialVersionUID = 1L;
 
     /**
+     * 货损记录id
+     */
+    private Long id;
+
+    /**
      * 运营商id
      */
     private Long operatorId;

+ 3 - 1
warehouse-admin-data/src/main/resources/mapper/driver/DriverGoodsLossRecordMapper.xml

@@ -53,7 +53,9 @@
         where statDate = #{statDate}
     </select>
     <select id="searchForPage" resultType="com.yr.warehouse.admin.driver.vo.DriverGoodsLossRecordVo">
-        select dglr.operatorId as operatorId,
+        select
+        dglr.id as id,
+        dglr.operatorId as operatorId,
         dglr.operatorChain as operatorChain,
         dglr.areaStaffId as areaStaffId,
         dglr.pickingOrderCreateNum as pickingOrderCreateNum,

+ 2 - 1
warehouse-admin-server/src/main/java/com/yr/warehouse/admin/service/driver/impl/DriverGoodsLossIntervalMainServiceImpl.java

@@ -9,6 +9,7 @@ import com.yr.warehouse.admin.service.driver.DriverGoodsLossIntervalMainService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -28,7 +29,7 @@ public class DriverGoodsLossIntervalMainServiceImpl extends ServiceImpl<DriverGo
 
         // 如果 intervalEndTime 为 null,则返回上月1号 00:00:00
         if (intervalEndTime == null) {
-            intervalEndTime = LocalDateTime.now().minusMonths(1).withDayOfMonth(1);
+            intervalEndTime = LocalDate.now().minusMonths(1).withDayOfMonth(1).atStartOfDay();
         }
         return intervalEndTime;
     }

+ 11 - 1
warehouse-admin-server/src/main/java/com/yr/warehouse/admin/service/driver/impl/DriverGoodsLossIntervalServiceImpl.java

@@ -143,6 +143,11 @@ public class DriverGoodsLossIntervalServiceImpl implements DriverGoodsLossInterv
                 }
                 EquipmentLossIntervalDetail equipmentLossIntervalDetail = driverGoodsLossIntervalVo.getEquipmentLossIntervalDetail();
                 if (null != equipmentLossIntervalDetail) {
+                    if (null == equipmentLossIntervalDetail.getProfitLossNum()) {
+                        equipmentLossIntervalDetail.setProfitLossNum(0L);
+                    }
+
+
                     equipmentLossIntervalDetails.add(equipmentLossIntervalDetail);
                     equipmentProfitLossNum += equipmentLossIntervalDetail.getProfitLossNum();
                 }
@@ -166,13 +171,18 @@ public class DriverGoodsLossIntervalServiceImpl implements DriverGoodsLossInterv
         driverGoodsLossIntervalMain.setDriverProfitLossNum(driverProfitLossNum);
         driverGoodsLossIntervalMain.setEquipmentProfitLossNum(equipmentProfitLossNum);
         driverGoodsLossIntervalMain.setTotalProfitLossNum(totalProfitLossNum);
+        driverGoodsLossIntervalMain.setCreateUid(bo.getUid());
+        driverGoodsLossIntervalMain.setCreateName(bo.getUsername());
 
         transactionTemplate.execute(status -> {
             driverGoodsLossIntervalMainMapper.insert(driverGoodsLossIntervalMain);
 
             driverGoodsLossIntervalDetailMapper.insertBatch(driverGoodsLossIntervalMain.getId(), driverGoodsLossIntervalDetails);
             equipmentLossIntervalDetailMapper.insertBatch(driverGoodsLossIntervalMain.getId(), equipmentLossIntervalDetails);
-            driverOnRouteAccountRecordMainMapper.batchBind(bo, useDriverOnRouteAccountRecordMains, driverGoodsLossIntervalMain.getId());
+
+            if (!useDriverOnRouteAccountRecordMains.isEmpty()) {
+                driverOnRouteAccountRecordMainMapper.batchBind(bo, useDriverOnRouteAccountRecordMains, driverGoodsLossIntervalMain.getId());
+            }
             return null;
         });
     }

+ 1 - 1
warehouse-admin-web/src/main/java/com/yr/warehouse/admin/web/driver/controller/DriverRouteDetailController.java

@@ -57,7 +57,7 @@ public class DriverRouteDetailController extends BaseController {
      * 导出司机在途明细
      * @return
      */
-    @GetMapping("/export/{goodsLossRecordId}")
+    @PostMapping("/export")
     @ResponseBody
     public Result<String> export(@Validated @RequestBody DriverRouteDetailExportRequest request, AdminUserInfo adminUserInfo) {
         DriverRouteDetailPageBo bo = DriverRouteDetailMapStruct.MAPSTRUCT.exportRequestToBo(request);

+ 3 - 0
warehouse-admin-web/src/main/java/com/yr/warehouse/admin/web/driver/request/DriverIntervalCargoDamageGeneratorRequest.java

@@ -1,5 +1,6 @@
 package com.yr.warehouse.admin.web.driver.request;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
@@ -28,12 +29,14 @@ public class DriverIntervalCargoDamageGeneratorRequest implements Serializable {
      * 区间开始时间
      */
     @NotNull(message = "请选择区间开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime intervalStartTime;
 
     /**
      * 区间结束时间
      */
     @NotNull(message = "请选择区间结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime intervalEndTime;
 
     /**

+ 5 - 0
warehouse-admin-web/src/main/java/com/yr/warehouse/admin/web/driver/response/DriverGoodsLossRecordResponse.java

@@ -15,6 +15,11 @@ public class DriverGoodsLossRecordResponse implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
+     * 货损记录id - goodsLossRecordId
+     */
+    private Long id;
+
+    /**
      * 运营商名称
      */
     private String operatorName;