diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java index bd96289..8f8eb5d 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java @@ -128,18 +128,89 @@ public class TaskController extends JeecgController { e.setUpperTaskName(taskUpper.getTaskName()); } } - if (e.getTaskFile()!=null&& !e.getTaskFile().equals("")){ + if (e.getTaskFile() != null && !e.getTaskFile().equals("")) { e.setContentType("file"); - }else if(e.getTaskPic()!=null&& !e.getTaskPic().equals("")){ + } else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) { e.setContentType("image"); - }else{ + } else { e.setContentType("text"); } String managerUsers = e.getManagerUsers(); - if (managerUsers!=null&&!managerUsers.equals("")) { - SysUser byId = iSysUserService.getById(managerUsers); - if (byId!=null) - e.setHeadpic(byId.getAvatar()); + if (managerUsers != null && !managerUsers.equals("")) { + String[] managerUsers1 = managerUsers.split(","); + StringBuilder avatars = new StringBuilder(); + for (String managerUser : managerUsers1) { + SysUser byId = iSysUserService.getById(managerUser); + if (byId != null) + + avatars.append(byId.getAvatar()).append(","); + } + avatars = new StringBuilder(avatars.substring(0, avatars.length() - 1)); + e.setHeadpic(avatars.toString()); + } + + }); + return Result.OK(pageList); + } + + @AutoLog(value = "任务管理-分页列表查询") + @ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询") + @GetMapping(value = "/list1") + public Result queryPageList1(Task task, + @RequestParam(name = "userId", defaultValue = "1") String userId, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + queryWrapper.like("manager_users", userId); + queryWrapper.like("work_status", 3); + queryWrapper.orderByDesc("create_time"); + IPage pageList = taskService.page(page, queryWrapper); + pageList.getRecords().stream().forEach(e -> { + String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT)); + String endDate = DateUtils.date2Str(e.getExpectedEndTime(), new SimpleDateFormat(FORMAT)); + String startEndTime = startDate + "-" + endDate; + e.setStartEndTime(startEndTime); + Projectx projectx = iProjectxService.getById(e.getProjectId()); + e.setUnion(projectx.getProjectName()); + if (StringUtils.isNotBlank(e.getModuleId())) { + Modulex modulex = iModulexService.getById(e.getModuleId()); + e.setUnion(e.getUnion() + "-" + modulex.getModuleName()); + } + if (StringUtils.isNotBlank(e.getFunctionId())) { + Functionx functionx = iFunctionxService.getById(e.getFunctionId()); + e.setUnion(e.getUnion() + "-" + functionx.getFunctionName()); + } + if (StringUtils.isNotBlank(e.getRuleId())) { + Rulex rulex = iRulexService.getById(e.getRuleId()); + e.setUnion(e.getUnion() + "-" + rulex.getRuleCode()); + } + if (StringUtils.isNotBlank(e.getUpperId())) { + Task taskUpper = taskService.getById(e.getUpperId()); + if (ObjectUtils.isNotEmpty(taskUpper)) { + e.setUpperTaskName(taskUpper.getTaskName()); + } + } + if (e.getTaskFile() != null && !e.getTaskFile().equals("")) { + e.setContentType("file"); + } else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) { + e.setContentType("image"); + } else { + e.setContentType("text"); + } + String managerUsers = e.getManagerUsers(); + if (managerUsers != null && !managerUsers.equals("")) { + String[] managerUsers1 = managerUsers.split(","); + StringBuilder avatars = new StringBuilder(); + for (String managerUser : managerUsers1) { + SysUser byId = iSysUserService.getById(managerUser); + if (byId != null) + + avatars.append(byId.getAvatar()).append(","); + } + avatars = new StringBuilder(avatars.substring(0, avatars.length() - 1)); + e.setHeadpic(avatars.toString()); } }); @@ -240,18 +311,25 @@ public class TaskController extends JeecgController { task.setUpperTaskName(taskUpper.getTaskName()); } } - if (task.getTaskFile()!=null&& !task.getTaskFile().equals("")){ + if (task.getTaskFile() != null && !task.getTaskFile().equals("")) { task.setContentType("file"); - }else if(task.getTaskPic()!=null&& !task.getTaskPic().equals("")){ + } else if (task.getTaskPic() != null && !task.getTaskPic().equals("")) { task.setContentType("image"); - }else{ + } else { task.setContentType("text"); } String managerUsers = task.getManagerUsers(); - if (managerUsers!=null&&!managerUsers.equals("")) { - SysUser byId = iSysUserService.getById(managerUsers); - if (byId!=null) - task.setHeadpic(byId.getAvatar()); + if (managerUsers != null && !managerUsers.equals("")) { + String[] managerUsers1 = managerUsers.split(","); + String avatars = ""; + for (String managerUser : managerUsers1) { + SysUser byId = iSysUserService.getById(managerUser); + if (byId != null) + + avatars += byId.getAvatar() + ","; + } + avatars = avatars.substring(0, avatars.length() - 1); + task.setHeadpic(avatars); } return Result.OK(task); }