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());