From 4011874184d04c088dacc41ec8be41069dfa25dc Mon Sep 17 00:00:00 2001 From: "WIN-IDGBLFHC1K6\\Administrator" <787952492@qq.com> Date: Tue, 28 Jun 2022 15:29:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=9C=E5=9C=BA=20=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E6=A0=B9=E6=8D=AEprojectId=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BB=BB=E5=8A=A1=E6=89=80=E5=9C=A8=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/farm/controller/admin/task/TaskController.java | 4 ++-- .../yudao/module/farm/service/task/TaskService.java | 2 +- .../yudao/module/farm/service/task/TaskServiceImpl.java | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java index f2c85e87..aef21187 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java @@ -148,7 +148,7 @@ public class TaskController { @GetMapping("/whatDayHaveTask") @ApiOperation("有任务的日期") - public R>> whatDayHaveTask(){ - return R.success(taskService.whatDayHaveTask()); + public R>> whatDayHaveTask(@RequestParam(value = "projectId", required = false) Long projectId){ + return R.success(taskService.whatDayHaveTask(projectId)); } } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java index 29bd3136..0b09fc2d 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java @@ -97,6 +97,6 @@ public interface TaskService { /** * 小程序任务 有日期的任务显示 **/ - List> whatDayHaveTask(); + List> whatDayHaveTask(Long projectId); } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java index 0551af78..87d564a2 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java @@ -478,13 +478,17 @@ public class TaskServiceImpl implements TaskService { } - public List> whatDayHaveTask(){ + public List> whatDayHaveTask(Long projectId){ LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); queryWrapperX.ne(TaskDO::getDraft, true); queryWrapperX.ne(TaskDO::getPretendDelete, true); + queryWrapperX.eqIfPresent(TaskDO::getProjectId, projectId); List taskList = taskMapper.selectList(queryWrapperX); - Map> dateMap = taskList.stream().collect(Collectors.groupingBy(item -> DateUtil.format(item.getPlanStartTime(), DatePattern.NORM_DATE_FORMAT))); List> list = new ArrayList<>(); + if (ObjectUtil.isEmpty(taskList)){ + return list; + } + Map> dateMap = taskList.stream().collect(Collectors.groupingBy(item -> DateUtil.format(item.getPlanStartTime(), DatePattern.NORM_DATE_FORMAT))); dateMap.entrySet().stream().forEach(item ->{ Map map = new HashMap() ; map.put("date", item.getKey().toString());