diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index a654e96..51ad83b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java @@ -138,8 +138,24 @@ public class EnterpriseController { } //获取标签 - final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); - enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); +// final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); +// enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); + + // 获取标签 + List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); + if (tagLibraryDOS != null) { + enterprise.setTagList(tagLibraryDOS.stream() + .map(TagLibraryDO::getTagName) + .collect(Collectors.toList())); + } else { + // 处理 tagLibraryDOS 为 null 的情况,这里可以设置一个空列表 + enterprise.setTagList(Collections.emptyList()); + } + + + + //通过userID获取专管人 + enterprise.setInviterName(adminUserService.getUser(Long.valueOf(enterprise.getUserId())).getNickname()); //获取资质 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -163,7 +179,7 @@ public class EnterpriseController { enterprise.setQualificationList(enterpriseQualificationList); } - //获取企业标签 + return success(BeanUtils.toBean(enterprise, EnterpriseRespVO.class)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java index 4afca96..c3de4e2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java @@ -64,6 +64,10 @@ public class TaskInfoPageReqVO extends PageParam { @Schema(description = "总共几步") private Integer taskTotal; + private LocalDateTime startTime; + + private LocalDateTime endTime; + @Schema(description = "企业集合", example = "1") private List enterpriseInspectionsIdes; @@ -79,10 +83,10 @@ public class TaskInfoPageReqVO extends PageParam { private Integer selectWeek; @Schema(description = "用户id", example = "1") - private Integer userId; + private Long userId; @Schema(description = "部门id", example = "1") - private Integer deptId; + private Long deptId; @Schema(description = "企业id", example = "1") private Long enterpriseId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java index 4db2c16..8b2273c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.controller.home; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; +import cn.iocoder.yudao.module.system.controller.home.vo.HomeCountResVO; import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; import cn.iocoder.yudao.module.system.service.home.HomeService; import io.swagger.v3.oas.annotations.Operation; @@ -30,7 +31,7 @@ public class HomeController { @GetMapping("/appCount1") @Operation(summary = "app首页统计第一块") // @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") - public CommonResult> signInList(HomeSelectVO homeSelectVO) { + public CommonResult signInList(HomeSelectVO homeSelectVO) { return success(homeService.appCount1(homeSelectVO)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeCountResVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeCountResVO.java new file mode 100644 index 0000000..baf803b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeCountResVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.system.controller.home.vo; + +import lombok.Data; + +@Data +public class HomeCountResVO { + //任务总数 + private Long taskCount; + //执法总数 + private Long inspectionsCount; + private Long enterpriseCount; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java index 24f72a4..551e673 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java @@ -28,7 +28,7 @@ public interface EnterpriseMapper extends BaseMapperX { .eqIfPresent(EnterpriseDO::getRegion, reqVO.getRegion()) .likeIfPresent(EnterpriseDO::getEnterprisesName, reqVO.getEnterprisesName()) .eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress()) - .eqIfPresent(EnterpriseDO::getIsAudit, 1) + .eqIfPresent(EnterpriseDO::getIsAudit, reqVO.getIsAudit()) .eqIfPresent(EnterpriseDO::getEnterprisesStatus, reqVO.getEnterprisesStatus()) .likeIfPresent(EnterpriseDO::getContactName, reqVO.getContactName()) .eqIfPresent(EnterpriseDO::getEnvironmentalContactPhone, reqVO.getEnvironmentalContactPhone()) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java index 47ac243..fd36949 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java @@ -61,7 +61,7 @@ public interface TaskInfoMapper extends BaseMapperX { } //优化任务查询 - PageResult selectMyPage(TaskInfoPageReqVO reqVO); + IPage selectMyPage(Page page, @Param("params") TaskInfoPageReqVO reqVO); //根据企业id查任务 IPage selectPageByEnterpriseId(Page page, @Param("reqVO") TaskInfoPageReqVO reqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java index 136866c..d36f635 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.framework.datapermission.config; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer; import org.springframework.context.annotation.Bean; @@ -22,6 +23,11 @@ public class DataPermissionConfiguration { rule.addDeptColumn(DeptDO.class, "id"); // user rule.addUserColumn(AdminUserDO.class, "id"); + //enterprise + rule.addDeptColumn(EnterpriseDO.class, "department_id"); + rule.addUserColumn(EnterpriseDO.class, "user_id"); + + }; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java index d26d8e2..9e324e3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java @@ -59,6 +59,8 @@ public class EnterpriseServiceImpl implements EnterpriseService { private EnterpriseTagMapper enterpriseTagMapper; @Resource private UserRoleMapper userRoleMapper; + @Resource + private AdminUserService adminUserService; @Override @Transactional @@ -106,8 +108,14 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Override @Transactional public Long pccreateEnterprise(EnterpriseSaveReqVO createReqVO) { + //专管员所属部门 + final AdminUserDO user = adminUserService.getUser(createReqVO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + createReqVO.setDeptId(user.getDeptId()); EnterpriseDO enterprise = BeanUtils.toBean(createReqVO, EnterpriseDO.class); - enterprise.setDepartmentId(1L); + enterprise.setDepartmentId(createReqVO.getDeptId()); enterpriseMapper.insert(enterprise); if (createReqVO.getFileIds() != null && createReqVO.getFileIds().length > 0) { for (Long fileId : createReqVO.getFileIds()) { @@ -181,25 +189,24 @@ public class EnterpriseServiceImpl implements EnterpriseService { return enterpriseMapper.selectList(pageReqVO); } - @Override public PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { //根据不同身份查询企业 //专管员查询 user_id //队长 查询部门 所有的 user_id in - QueryWrapper roleDOQueryWrapper = new QueryWrapper<>(); - roleDOQueryWrapper.eq("user_id", getLoginUserId()); - final List userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper); - final List collect = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); - //判断 collect 里面是否包含 roleId = 11 - if (collect.contains(11L)) { -// //队长 -// pageReqVO.setUserId(null); -// pageReqVO.setDeptId(null); - } else if (collect.contains(155L)) { - //专管员 - pageReqVO.setUserId(getLoginUserId()); - } +// QueryWrapper roleDOQueryWrapper = new QueryWrapper<>(); +// roleDOQueryWrapper.eq("user_id", getLoginUserId()); +// final List userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper); +// final List collect = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); +// //判断 collect 里面是否包含 roleId = 11 +// if (collect.contains(11L)) { +//// //队长 +//// pageReqVO.setUserId(null); +//// pageReqVO.setDeptId(null); +// } else if (collect.contains(155L)) { +// //专管员 +// pageReqVO.setUserId(getLoginUserId()); +// } // pageReqVO.setCreate(getLoginUserId().toString()); final PageResult enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java index 6a56fb6..4596bf9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java @@ -1,10 +1,11 @@ package cn.iocoder.yudao.module.system.service.home; import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; +import cn.iocoder.yudao.module.system.controller.home.vo.HomeCountResVO; import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; import java.util.List; public interface HomeService { - List appCount1(HomeSelectVO homeSelectVO); + HomeCountResVO appCount1(HomeSelectVO homeSelectVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java index 7df28c5..de66709 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java @@ -1,15 +1,83 @@ package cn.iocoder.yudao.module.system.service.home; +import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.EnterprisePageReqVO; import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; +import cn.iocoder.yudao.module.system.controller.home.vo.HomeCountResVO; import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; +import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper; +import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; +import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService; +import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.time.LocalDateTime; import java.util.List; @Service public class HomeServiceImpl implements HomeService{ + + @Resource + private EnterpriseMapper enterpriseMapper; + + @Resource + private TaskInfoService taskInfoService; + + @Resource + private TaskInfoMapper taskInfoMapper; + @Resource + private EnterpriseTagMapper enterpriseTagMapper; + @Resource + private AdminUserService adminUserService; + @Resource + private DeptService deptService; + + @Override - public List appCount1(HomeSelectVO homeSelectVO) { + public HomeCountResVO appCount1(HomeSelectVO homeSelectVO) { + + HomeCountResVO homeCountResVO = new HomeCountResVO(); + + LambdaQueryWrapper enterpriseDOLambdaQueryWrapper = new LambdaQueryWrapper<>(); + + //按时间查询 + if (homeSelectVO.getSelectWeek() != null) { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime[] dateList = new LocalDateTime[2]; + + switch (homeSelectVO.getSelectWeek()) { + case 1: + dateList[0] = now.minusDays(3); // 三天前 + break; + case 2: + dateList[0] = now.minusWeeks(1); // 一周前 + break; + case 3: + dateList[0] = now.minusMonths(1); // 一月前 + break; + case 4: + dateList[0] = now.minusYears(1); // 一年前 + break; + } + dateList[1] = now; + + enterpriseDOLambdaQueryWrapper.between(EnterpriseDO::getCreateTime, dateList[0], dateList[1]); + } + + final Long enterpriseCount = enterpriseMapper.selectCount(enterpriseDOLambdaQueryWrapper); + + homeCountResVO.setEnterpriseCount(enterpriseCount); + + +// taskInfoService.getTaskInfoAppPage() + + //根据不同的身份查询 + return null; // return List.of(); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java index 2905850..dd3f248 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java @@ -240,91 +240,84 @@ public class TaskInfoServiceImpl implements TaskInfoService { @Override public PageResult getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO) { - //按标签查询 - if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(TaskTagDO::getTagId, pageReqVO.getTagList()); - final List taskTagDOS = taskTagMapper.selectList(wrapper); - if (taskTagDOS != null && taskTagDOS.size() > 0) { - pageReqVO.setTagList(taskTagDOS.stream().map(item->item.getTaskId()).collect(Collectors.toList())); - } - } +// //按标签查询 +// if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.in(TaskTagDO::getTagId, pageReqVO.getTagList()); +// final List taskTagDOS = taskTagMapper.selectList(wrapper); +// if (taskTagDOS != null && taskTagDOS.size() > 0) { +// pageReqVO.setTagList(taskTagDOS.stream().map(item->item.getTaskId()).collect(Collectors.toList())); +// } +// } //按时间查询 if (pageReqVO.getSelectWeek() != null) { LocalDateTime now = LocalDateTime.now(); - LocalDateTime[] dateList = new LocalDateTime[2]; + + pageReqVO.setEndTime(now); + + LocalDateTime startTime = null; switch (pageReqVO.getSelectWeek()) { case 1: - dateList[0] = now.minusDays(3); // 三天前 + startTime = now.minusDays(3); // 三天前 break; case 2: - dateList[0] = now.minusWeeks(1); // 一周前 + startTime = now.minusWeeks(1); // 一周前 break; case 3: - dateList[0] = now.minusMonths(1); // 一月前 + startTime = now.minusMonths(1); // 一月前 break; case 4: - dateList[0] = now.minusYears(1); // 一年前 + startTime = now.minusYears(1); // 一年前 break; } - dateList[1] = now; - pageReqVO.setEndDate(dateList); + + pageReqVO.setStartTime(startTime); + } + //根据不同的角色查询 + /* + 管理员,局长,查全部 + 检查员,查自己的 + 队长 查本部门 + */ + Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); + + final AdminUserDO user1 = adminUserService.getUser(loginUserId); + if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) { + //全部 + } else if (user1.getPostIds().contains(4l)) { + //本部门 + pageReqVO.setDeptId(user1.getDeptId()); + + } else if (user1.getPostIds().contains(5l)) { + //自己 + pageReqVO.setUserId(loginUserId); } - final PageResult taskInfoDOPageResult = taskInfoMapper.selectAppPage(pageReqVO); - if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) { - taskInfoDOPageResult.getList().forEach(item->{ - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("task_id", item.getId()); - //根据不同的角色查询 - /* - 管理员,局长,查全部 - 检查员,查自己的 - 队长 查本部门 - */ - Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); - - final AdminUserDO user1 = adminUserService.getUser(loginUserId); - if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) { - //全部 - } else if (user1.getPostIds().contains(4l)) { - //本部门 - final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", user1.getDeptId())); - - if (adminUserDOS != null || adminUserDOS.size() > 0) { - final List collect = adminUserDOS.stream().map(res -> res.getId()).collect(Collectors.toList()); - wrapper.in("user_id", collect); - } - - } else if (user1.getPostIds().contains(5l)) { - //自己 - wrapper.eq("user_id", loginUserId); - } +// final PageResult taskInfoDOPageResult = taskInfoMapper.selectAppPage(pageReqVO); - item.setTaskExecNum(0); + Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + final IPage taskInfoDOIPage = taskInfoMapper.selectMyPage(page, pageReqVO); + final PageResult taskInfoDOPageResult = new PageResult<>(taskInfoDOIPage.getRecords(), taskInfoDOIPage.getTotal()); - List enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper); - log.info("enterpriseInspectionsDOList:{}", enterpriseInspectionsDOList); - if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) { - item.setTaskExecNum(enterpriseInspectionsDOList.size()); - final List collect = enterpriseInspectionsDOList.stream().filter(res -> res.getStatus() == 5).collect(Collectors.toList()); - item.setTaskFinishNum(collect.size()); - } + if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) { + taskInfoDOPageResult.getList().forEach(item->{ +// item.setTaskExecNum(0); +// +// List enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper); +// log.info("enterpriseInspectionsDOList:{}", enterpriseInspectionsDOList); +// if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) { +// item.setTaskExecNum(enterpriseInspectionsDOList.size()); +// final List collect = enterpriseInspectionsDOList.stream().filter(res -> res.getStatus() == 5).collect(Collectors.toList()); +// item.setTaskFinishNum(collect.size()); +// } //获取任务标签 - QueryWrapper wrapper1 = new QueryWrapper<>(); - wrapper1.eq("task_id", item.getId()); - List taskTagDOList = taskTagMapper.selectList(wrapper1); - if (taskTagDOList != null && taskTagDOList.size() > 0) { - final List collect = taskTagDOList.stream().map(TaskTagDO::getTagId).collect(Collectors.toList()); - final List tagLibraryDOS = tagLibraryMapper.selectByIds(collect); - if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) { - item.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); - } + final List tagLibraryDOS1 = tagLibraryService.listByTaskId(item.getId()); + if (tagLibraryDOS1 != null && tagLibraryDOS1.size() > 0) { + item.setTagList(tagLibraryDOS1.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); } - enterpriseInspectionsMapper.selectList(); }); } @@ -350,9 +343,10 @@ public class TaskInfoServiceImpl implements TaskInfoService { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(EnterpriseInspectionsDO::getTaskId, item.getId()); wrapper.eq(EnterpriseInspectionsDO::getEnterpriseId, pageReqVO.getEnterpriseId()); - final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectOne(wrapper); - - item.setInspectionsId(enterpriseInspectionsDO.getId()); + final List enterpriseInspectionsDO = enterpriseInspectionsMapper.selectList(wrapper); + if (enterpriseInspectionsDO != null && enterpriseInspectionsDO.size() > 0) { + item.setInspectionsId(enterpriseInspectionsDO.get(0).getId()); + } //发布部门, final Long userId = Long.valueOf(item.getCreator()); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml index ce67da3..3015678 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml @@ -12,33 +12,48 @@