From 6b2b14c96f6225a9f6289d6b797d11d2acad2c0e Mon Sep 17 00:00:00 2001 From: aikai Date: Mon, 7 Apr 2025 11:33:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(smartfactory):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7ID=E7=AD=9B=E9=80=89=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 HandlingGroupUserAmountMonthItemVO 中将 contentList 的类型从 List 改为 Map- 在 getListByMonth 方法中添加 id 参数,用于筛选特定用户的数据 - 更新相关 mapper 和 service --- .../HandlingGroupUserAmountController.java | 5 +++-- .../vo/HandlingGroupUserAmountMonthItemVO.java | 2 +- .../HandlingGroupUserAmountMapper.java | 2 +- .../HandlingGroupUserAmountService.java | 2 +- .../HandlingGroupUserAmountServiceImpl.java | 13 +++++++------ .../HandlingGroupUserAmountMapper.xml | 3 +++ 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/HandlingGroupUserAmountController.java b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/HandlingGroupUserAmountController.java index 18a4391b..88ac1e6c 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/HandlingGroupUserAmountController.java +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/HandlingGroupUserAmountController.java @@ -68,10 +68,11 @@ public class HandlingGroupUserAmountController { @GetMapping("/getListByMonth") @Operation(summary = "获得搬运组工资记录 按月搜索") @Parameter(name = "time", description = "日期 格式(yyyy-MM) 默认当前月", required = true, example = "1024") - public CommonResult getListByMonth(@RequestParam(value = "name", required = false) String name, + public CommonResult getListByMonth(@RequestParam(value = "id", required = false) Long id, + @RequestParam(value = "name", required = false) String name, @RequestParam(value = "time", required = true) String time, @RequestParam(value = "factoryId", required = false) Long factoryId) { - HandlingGroupUserAmountMonthVO vo = handlingGroupUserAmountService.getListByMonth(factoryId, time, name); + HandlingGroupUserAmountMonthVO vo = handlingGroupUserAmountService.getListByMonth(id, factoryId, time, name); return success(vo); } diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/vo/HandlingGroupUserAmountMonthItemVO.java b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/vo/HandlingGroupUserAmountMonthItemVO.java index b712b1c8..089ee617 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/vo/HandlingGroupUserAmountMonthItemVO.java +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/handlinggroupuseramount/vo/HandlingGroupUserAmountMonthItemVO.java @@ -13,5 +13,5 @@ public class HandlingGroupUserAmountMonthItemVO { private Long userId; @Schema(description = "列表", example = "22544") - private List> contentList; + private Map contentList; } diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/dal/mysql/handlinggroupuseramount/HandlingGroupUserAmountMapper.java b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/dal/mysql/handlinggroupuseramount/HandlingGroupUserAmountMapper.java index 2f6be599..72d163a5 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/dal/mysql/handlinggroupuseramount/HandlingGroupUserAmountMapper.java +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/dal/mysql/handlinggroupuseramount/HandlingGroupUserAmountMapper.java @@ -57,5 +57,5 @@ public interface HandlingGroupUserAmountMapper extends BaseMapperX> getListByMonth(@Param("factoryId") Long factoryId, @Param("dateList") List dateList, @Param("name") String name); + List> getListByMonth(@Param("id") Long id, @Param("factoryId") Long factoryId, @Param("dateList") List dateList, @Param("name") String name); } diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountService.java b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountService.java index c4fbf9b9..750a2961 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountService.java +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountService.java @@ -78,5 +78,5 @@ public interface HandlingGroupUserAmountService { * @param name * @return */ - HandlingGroupUserAmountMonthVO getListByMonth(Long factoryId, String time, String name); + HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, String time, String name); } diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountServiceImpl.java b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountServiceImpl.java index 447cec38..c0de196b 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountServiceImpl.java +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/service/handlinggroupuseramount/HandlingGroupUserAmountServiceImpl.java @@ -17,7 +17,10 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.time.LocalDateTime; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 搬运组每日个人工资记录 Service 实现类 @@ -85,7 +88,7 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou } @Override - public HandlingGroupUserAmountMonthVO getListByMonth(Long factoryId, String time, String name) { + public HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, String time, String name) { HandlingGroupUserAmountMonthVO vo = new HandlingGroupUserAmountMonthVO(); Map headers = new HashMap<>(); // -- 根据yyyy-MM获取到该月第一天时间 - 再获取到最后一天 - 完了后组装表头 @@ -103,9 +106,8 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou // - 插入表头 vo.setHeaders(headers); - List> map = handlingGroupUserAmountMapper.getListByMonth(factoryId, dateList, name); + List> map = handlingGroupUserAmountMapper.getListByMonth(id, factoryId, dateList, name); List list = new ArrayList<>(); - List> contentList = new ArrayList<>(); for (Map item : map) { HandlingGroupUserAmountMonthItemVO itemVO = new HandlingGroupUserAmountMonthItemVO(); itemVO.setUserId((Long) item.get("userId")); @@ -117,8 +119,7 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou itemMap.put(num, item.get(date).toString()); } itemMap.put(num + 1, item.get("totalAmount").toString()); - contentList.add(itemMap); - itemVO.setContentList(contentList); + itemVO.setContentList(itemMap); list.add(itemVO); } vo.setList(list); diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/resources/mapper/handlinggroupuseramount/HandlingGroupUserAmountMapper.xml b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/resources/mapper/handlinggroupuseramount/HandlingGroupUserAmountMapper.xml index b3f35541..7ec601fb 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/resources/mapper/handlinggroupuseramount/HandlingGroupUserAmountMapper.xml +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/resources/mapper/handlinggroupuseramount/HandlingGroupUserAmountMapper.xml @@ -85,6 +85,9 @@ left join sf_staff as b on a.user_id = b.id a.deleted = 0 + + and b.id = #{id} + and a.factory_id = #{factoryId}