Browse Source

农场 任务列表 根据projectId显示任务所在日期

zyh
WIN-IDGBLFHC1K6\Administrator 3 years ago
parent
commit
4011874184
  1. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java
  2. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java
  3. 8
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java

4
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") @GetMapping("/whatDayHaveTask")
@ApiOperation("有任务的日期") @ApiOperation("有任务的日期")
public R<List<Map<String, String>>> whatDayHaveTask(){ public R<List<Map<String, String>>> whatDayHaveTask(@RequestParam(value = "projectId", required = false) Long projectId){
return R.success(taskService.whatDayHaveTask()); return R.success(taskService.whatDayHaveTask(projectId));
} }
} }

2
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<Map<String, String>> whatDayHaveTask(); List<Map<String, String>> whatDayHaveTask(Long projectId);
} }

8
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<Map<String, String>> whatDayHaveTask(){ public List<Map<String, String>> whatDayHaveTask(Long projectId){
LambdaQueryWrapperX<TaskDO> queryWrapperX = new LambdaQueryWrapperX<>(); LambdaQueryWrapperX<TaskDO> queryWrapperX = new LambdaQueryWrapperX<>();
queryWrapperX.ne(TaskDO::getDraft, true); queryWrapperX.ne(TaskDO::getDraft, true);
queryWrapperX.ne(TaskDO::getPretendDelete, true); queryWrapperX.ne(TaskDO::getPretendDelete, true);
queryWrapperX.eqIfPresent(TaskDO::getProjectId, projectId);
List<TaskDO> taskList = taskMapper.selectList(queryWrapperX); List<TaskDO> taskList = taskMapper.selectList(queryWrapperX);
Map<Object, List<TaskDO>> dateMap = taskList.stream().collect(Collectors.groupingBy(item -> DateUtil.format(item.getPlanStartTime(), DatePattern.NORM_DATE_FORMAT)));
List<Map<String, String>> list = new ArrayList<>(); List<Map<String, String>> list = new ArrayList<>();
if (ObjectUtil.isEmpty(taskList)){
return list;
}
Map<Object, List<TaskDO>> dateMap = taskList.stream().collect(Collectors.groupingBy(item -> DateUtil.format(item.getPlanStartTime(), DatePattern.NORM_DATE_FORMAT)));
dateMap.entrySet().stream().forEach(item ->{ dateMap.entrySet().stream().forEach(item ->{
Map map = new HashMap<String,String>() ; Map map = new HashMap<String,String>() ;
map.put("date", item.getKey().toString()); map.put("date", item.getKey().toString());

Loading…
Cancel
Save