| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.common.enums.DeleteFlagEnum; |
| | | import com.gkhy.common.exception.ServiceException; |
| | | import com.gkhy.common.utils.DateUtils; |
| | | import com.gkhy.common.utils.SecurityUtils; |
| | |
| | | */ |
| | | @Override |
| | | public List<ProjectManagement> selectProjectManagementList(ProjectManagement projectManagement) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | projectManagement.setDeptId(SecurityUtils.getDeptId()); |
| | | } |
| | | return projectManagementMapper.selectProjectManagementList(projectManagement); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Long insertProjectManagement(ProjectManageSaveReq projectManagement) { |
| | | ProjectManagement projectManagementSave = new ProjectManagement(); |
| | | |
| | | projectManagementSave.setDelFlag(0L); |
| | | if (SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | throw new ServiceException("无权新增"); |
| | | } |
| | | projectManagementSave.setDelFlag(DeleteFlagEnum.UN_DELETE.getCode()); |
| | | BeanUtil.copyProperties(projectManagement, projectManagementSave); |
| | | if (projectManagement.getId() != null){ |
| | | checkDataPer(projectManagement.getId()); |
| | |
| | | if (hasDuplicateExpertId(saveData)){ |
| | | throw new ServiceException("专家重复!"); |
| | | } |
| | | long count = saveData.stream() |
| | | .filter(dto -> dto.getSelectionMode() == 1) |
| | | .count(); |
| | | if (count < 1){ |
| | | throw new ServiceException("固定专家不能为空!"); |
| | | } |
| | | // long count = saveData.stream() |
| | | // .filter(dto -> dto.getSelectionMode() == 1) |
| | | // .count(); |
| | | // if (count < 1){ |
| | | // throw new ServiceException("固定专家不能为空!"); |
| | | // } |
| | | |
| | | if ((projectManagement1.getStep() == 1 || projectManagement1.getStep() == 2) && (projectManagement.getStep() == 2 ) ){ |
| | | projectManagementSave.setStep(2L); |
| | |
| | | .collect(Collectors.groupingBy(ProjectExpertSaveReqDto::getExpertId, Collectors.counting())); |
| | | |
| | | // 检查是否有任何 expertId 的频率大于 1 |
| | | boolean hasDuplicates = frequencyMap.values().stream().anyMatch(count -> count > 1); |
| | | |
| | | if (hasDuplicates) { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | return frequencyMap.values().stream().anyMatch(count -> count > 1); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int deleteProjectManagementByIds(Long[] ids) { |
| | | //todo 校验 |
| | | // 校验 |
| | | for (Long id : ids) { |
| | | checkDataPer(id); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<ProjectExpertStateResp> getProjectExpertSate(ProjectExpertStateReq req) { |
| | | |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | req.setDeptId(SecurityUtils.getDeptId()); |
| | | } |
| | | return projectManagementMapper.getProjectExpertSate(req); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<ProjectExpertResp> projectExpertEvaList(SysProjectExpertReq req) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | req.setDeptId(SecurityUtils.getDeptId()); |
| | | } |
| | | return projectExpertMapper.projectExpertEvaList(req); |
| | | } |
| | | |
| | |
| | | if (!StringUtils.isEmpty(dataNum)){ |
| | | Map<Integer, Long> statusCounts = dataNum.stream() |
| | | .collect(Collectors.groupingBy( |
| | | status -> status, // 分组键 |
| | | Collectors.counting() // 计数 |
| | | status -> status, |
| | | Collectors.counting() |
| | | )); |
| | | projectNumResp.setTotal(dataNum.size()); |
| | | projectNumResp.setApproval(statusCounts.get(3) == null ? 0 : statusCounts.get(3).intValue()); |