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 88ac1e6c..62ed18d3 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,11 +68,13 @@ public class HandlingGroupUserAmountController { @GetMapping("/getListByMonth") @Operation(summary = "获得搬运组工资记录 按月搜索") @Parameter(name = "time", description = "日期 格式(yyyy-MM) 默认当前月", required = true, example = "1024") + @Parameter(name = "type", description = "类型 1按本月初到本月底 2按上月26号到本月25号 默认1", required = true, example = "1024") public CommonResult getListByMonth(@RequestParam(value = "id", required = false) Long id, + @RequestParam(value = "type", defaultValue = "1") Integer type, @RequestParam(value = "name", required = false) String name, - @RequestParam(value = "time", required = true) String time, + @RequestParam(value = "time") String time, @RequestParam(value = "factoryId", required = false) Long factoryId) { - HandlingGroupUserAmountMonthVO vo = handlingGroupUserAmountService.getListByMonth(id, factoryId, time, name); + HandlingGroupUserAmountMonthVO vo = handlingGroupUserAmountService.getListByMonth(id, factoryId, type, time, name); return success(vo); } 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 750a2961..9c6b5ecf 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 id, Long factoryId, String time, String name); + HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, Integer type, 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 c0de196b..f1a50f3e 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 @@ -88,14 +88,21 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou } @Override - public HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, String time, String name) { + public HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, Integer type, String time, String name) { HandlingGroupUserAmountMonthVO vo = new HandlingGroupUserAmountMonthVO(); Map headers = new HashMap<>(); // -- 根据yyyy-MM获取到该月第一天时间 - 再获取到最后一天 - 完了后组装表头 String[] times = time.split("-"); - LocalDateTime startTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 1, 0, 0, 0); - LocalDateTime endTime = startTime.plusMonths(1).minusDays(1); - List dateList = DateUtils.betweenDayList(startTime, endTime); + List dateList; + if (type == 1) { + LocalDateTime startTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 1, 0, 0, 0); + LocalDateTime endTime = startTime.plusMonths(1).minusDays(1); + dateList = DateUtils.betweenDayList(startTime, endTime); + } else { + LocalDateTime startTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 26, 0, 0, 0).minusMonths(1); + LocalDateTime endTime = LocalDateTime.of(Integer.parseInt(times[0]), Integer.parseInt(times[1]), 25, 0, 0, 0); + dateList = DateUtils.betweenDayList(startTime, endTime); + } headers.put(1, NAME); int num = 1; for (String date : dateList) { @@ -105,7 +112,6 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou headers.put(num + 1, TOTAL_AMOUNT); // - 插入表头 vo.setHeaders(headers); - List> map = handlingGroupUserAmountMapper.getListByMonth(id, factoryId, dateList, name); List list = new ArrayList<>(); for (Map item : map) { 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 7ec601fb..6e109881 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 @@ -89,7 +89,7 @@ and b.id = #{id} - and a.factory_id = #{factoryId} + and b.factory_id = #{factoryId} and b.nick_name like concat('%', #{name}, '%')