Pārlūkot izejas kodu

[update] 日货损统计中加入区间查询逻辑

miajio 2 nedēļas atpakaļ
vecāks
revīzija
e63f0e3bf1

+ 22 - 2
warehouse-admin-data/src/main/java/com/yr/warehouse/admin/driver/bo/DriverDailyCargoDamagePageBo.java

@@ -26,9 +26,9 @@ public class DriverDailyCargoDamagePageBo extends BasePageBo implements AreaStaf
     private Long operatorId;
 
     /**
-     * 区域员工关系id
+     * 运营商id链
      */
-    private List<Long> areaStaffIds;
+    private String operatorChain;
 
     /**
      * 区域员工名称
@@ -36,8 +36,28 @@ public class DriverDailyCargoDamagePageBo extends BasePageBo implements AreaStaf
     private String areaStaffName;
 
     /**
+     * 区域员工关系id
+     */
+    private List<Long> areaStaffIds;
+
+    /**
+     * 区域员工id
+     */
+    private Long areaStaffId;
+
+    /**
      * 统计日期
      */
     private LocalDate statDate;
 
+    /**
+     * 开始统计日期
+     */
+    private LocalDate beginStatDate;
+
+    /**
+     * 结束统计日期
+     */
+    private LocalDate endStatDate;
+
 }

+ 9 - 0
warehouse-admin-data/src/main/resources/mapper/driver/DriverGoodsLossRecordMapper.xml

@@ -89,6 +89,15 @@
             <if test="bo.statDate != null">
                 and dglr.statDate = #{bo.statDate}
             </if>
+            <if test="bo.areaStaffId != null">
+                and dglr.areaStaffId = #{bo.areaStaffId}
+            </if>
+            <if test="bo.beginStatDate != null">
+                and dglr.statDate >= #{bo.beginStatDate}
+            </if>
+            <if test="bo.endStatDate != null">
+                and #{bo.endStatDate} >= dglr.statDate
+            </if>
         </where>
         order by dglr.operatorId, dglr.areaStaffId desc
     </select>

+ 10 - 0
warehouse-admin-web/src/main/java/com/yr/warehouse/admin/web/driver/controller/DriverDailyCargoDamageController.java

@@ -1,6 +1,7 @@
 package com.yr.warehouse.admin.web.driver.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yr.bluecat.common.entity.exception.MessageException;
 import com.yr.bluecat.common.entity.response.PageResult;
 import com.yr.bluecat.common.entity.response.Result;
 import com.yr.bluecat.common.utils.excel.ExportClient;
@@ -41,12 +42,18 @@ public class DriverDailyCargoDamageController extends BaseController {
 
     /**
      * 分页查询货损记录
+     * -- 参数二选一逻辑
+     * 1、统计日期 查询指定统计日期的日货损记录
+     * 2、开始统计日期 及 结束统计日期 与 区间员工关系id 查询指定员工的区间日货损记录
      * @param request
      * @return
      */
     @PostMapping("/page")
     @ResponseBody
     public PageResult<DriverGoodsLossRecordResponse> page(@Validated @RequestBody DriverDailyCargoDamagePageRequest request, AdminUserInfo adminUserInfo) {
+        if (null == request.getStatDate() || (null == request.getBeginStatDate() || null == request.getEndStatDate() || null == request.getAreaStaffId())) {
+            throw new MessageException("参数错误, 统计日期 或 开始统计日期及结束统计日期与区间员工id不能为空");
+        }
         DriverDailyCargoDamagePageBo bo = DriverDailyCargoDamageMapStruct.MAPSTRUCT.pageRequestToBo(request);
         buildUserInfo(bo, adminUserInfo);
         PageResult<DriverGoodsLossRecordResponse> pageResult = PageResult.newPageResult(request.getPageNum(), request.getPageSize());
@@ -73,6 +80,9 @@ public class DriverDailyCargoDamageController extends BaseController {
     @PostMapping("/export")
     @ResponseBody
     public Result<String> export(@Validated @RequestBody DriverDailyCargoDamageExportRequest request, AdminUserInfo adminUserInfo) {
+        if (null == request.getStatDate() || (null == request.getBeginStatDate() || null == request.getEndStatDate() || null == request.getAreaStaffId())) {
+            throw new MessageException("参数错误, 统计日期 或 开始统计日期及结束统计日期与区间员工id不能为空");
+        }
         DriverDailyCargoDamageExportBo bo = DriverDailyCargoDamageMapStruct.MAPSTRUCT.exportRequestToBo(request);
         buildUserInfo(bo, adminUserInfo);
         if (areaStaffService.extractedAreaStaffSearchParam(bo)) {

+ 19 - 1
warehouse-admin-web/src/main/java/com/yr/warehouse/admin/web/driver/request/DriverDailyCargoDamageExportRequest.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;
 
@@ -27,9 +28,26 @@ public class DriverDailyCargoDamageExportRequest implements Serializable {
     private String areaStaffName;
 
     /**
+     * 区域员工id
+     */
+    private Long areaStaffId;
+
+    /**
      * 统计日期
      */
-    @NotNull(message = "统计日期不能为空")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private LocalDate statDate;
 
+    /**
+     * 开始统计日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate beginStatDate;
+
+    /**
+     * 结束统计日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate endStatDate;
+
 }

+ 14 - 6
warehouse-admin-web/src/main/java/com/yr/warehouse/admin/web/driver/request/DriverDailyCargoDamagePageRequest.java

@@ -1,5 +1,6 @@
 package com.yr.warehouse.admin.web.driver.request;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yr.bluecat.common.entity.request.PageRequest;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
@@ -35,11 +36,6 @@ public class DriverDailyCargoDamagePageRequest extends PageRequest implements Se
     private String areaStaffName;
 
     /**
-     * 区间货损统计id
-     */
-    private Long goodsLossMonthlyMainId;
-
-    /**
      * 区域员工id
      */
     private Long areaStaffId;
@@ -47,7 +43,19 @@ public class DriverDailyCargoDamagePageRequest extends PageRequest implements Se
     /**
      * 统计日期
      */
-    @NotNull(message = "统计日期不能为空")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private LocalDate statDate;
 
+    /**
+     * 开始统计日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate beginStatDate;
+
+    /**
+     * 结束统计日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate endStatDate;
+
 }