| | |
| | | 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; |
| | | import com.gkhy.common.utils.StringUtils; |
| | | import com.gkhy.system.domain.ProjectExpert; |
| | | import com.gkhy.system.domain.ProjectExpertDetail; |
| | | import com.gkhy.system.domain.ProjectFile; |
| | | import com.gkhy.system.domain.ProjectManagement; |
| | | import com.gkhy.system.domain.*; |
| | | import com.gkhy.system.domain.vo.request.*; |
| | | import com.gkhy.system.domain.vo.response.*; |
| | | import com.gkhy.system.mapper.ProjectExpertDetailMapper; |
| | | import com.gkhy.system.mapper.ProjectExpertMapper; |
| | | import com.gkhy.system.mapper.ProjectFileMapper; |
| | | import com.gkhy.system.mapper.ProjectManagementMapper; |
| | | import com.gkhy.system.mapper.*; |
| | | import com.gkhy.system.service.IProjectFileService; |
| | | import com.gkhy.system.service.IProjectManagementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private IProjectFileService projectFileService; |
| | | @Autowired |
| | | private SysExpertInfoMapper sysExpertInfoMapper; |
| | | |
| | | /** |
| | | * 查询项目管理 |
| | |
| | | */ |
| | | @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()); |
| | | |
| | | projectManagementSave.setUpdateBy(SecurityUtils.getUsername()); |
| | | projectManagementSave.setUpdateTime(DateUtils.getNowDate()); |
| | | projectManagementMapper.updateProjectManagement(projectManagementSave); |
| | | // projectManagementMapper.updateProjectManagement(projectManagementSave); |
| | | updateById(projectManagementSave); |
| | | }else { |
| | | projectManagementSave.setStep(1L); |
| | | projectManagementSave.setCreateBy(SecurityUtils.getUsername()); |
| | | projectManagementSave.setCreateTime(DateUtils.getNowDate()); |
| | | projectManagementMapper.insertProjectManagement(projectManagementSave); |
| | | save(projectManagementSave); |
| | | // projectManagementMapper.insertProjectManagement(projectManagementSave); |
| | | } |
| | | |
| | | |
| | |
| | | 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); |
| | | // 校验 |
| | | // for (Long id : ids) { |
| | | // checkDataPer(id); |
| | | // } |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) ){ |
| | | throw new ServiceException("无权操作!"); |
| | | } |
| | | return projectManagementMapper.deleteProjectManagementByIds(ids); |
| | | } |
| | |
| | | projectManagementUp.setId(req.getId()); |
| | | projectManagementUp.setState(4L); |
| | | projectManagementUp.setStep(4L); |
| | | projectManagementUp.setDesc(req.getDesc()); |
| | | // projectManagementUp.setDesc(req.getDesc()); |
| | | projectManagementUp.setProjectEndTime(req.getProjectEndTime()); |
| | | projectManagementUp.setUpdateBy(SecurityUtils.getUsername()); |
| | | int i = projectManagementMapper.updateProjectManagement(projectManagementUp); |
| | |
| | | |
| | | @Override |
| | | public List<ProjectExpertStateResp> getProjectExpertSate(ProjectExpertStateReq req) { |
| | | |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | req.setDeptId(SecurityUtils.getDeptId()); |
| | | } |
| | | return projectManagementMapper.getProjectExpertSate(req); |
| | | } |
| | | |
| | |
| | | |
| | | //更新项目专家表 |
| | | ProjectExpert projectExpert = new ProjectExpert(); |
| | | BeanUtil.copyProperties(req, projectExpert); |
| | | projectExpert.setId(req.getProjectExpertId()); |
| | | projectExpert.setScore(req.getScore()); |
| | | projectExpert.setevaluationState(1L); |
| | | projectExpert.setEvaluationState(1L); |
| | | int i = projectExpertMapper.updateProjectExpert(projectExpert); |
| | | if (i < 1){ |
| | | throw new ServiceException("保存失败!"); |
| | |
| | | |
| | | @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()); |
| | |
| | | projectNumResp.setEnd(statusCounts.get(4) == null ? 0:statusCounts.get(4).intValue()); |
| | | } |
| | | return projectNumResp; |
| | | } |
| | | |
| | | @Override |
| | | public ProjectDetailResp selectProjectExpertDetail(Long projectExpertId) { |
| | | ProjectDetailResp projectDetailResp = new ProjectDetailResp(); |
| | | ProjectExpert projectExpert = projectExpertMapper.selectProjectExpertById(projectExpertId); |
| | | BeanUtil.copyProperties(projectExpert, projectDetailResp); |
| | | if (projectDetailResp != null){ |
| | | ProjectExpertDetail projectExpertDetail = new ProjectExpertDetail(); |
| | | projectExpertDetail.setProjectExpertId(projectExpertId); |
| | | List<ProjectExpertDetail> projectExpertDetails = projectExpertDetailMapper.selectProjectExpertDetailList(projectExpertDetail); |
| | | if (StringUtils.isNotEmpty(projectExpertDetails)){ |
| | | projectDetailResp.setExpertDetails(projectExpertDetails); |
| | | } |
| | | Long projectId = projectDetailResp.getProjectId(); |
| | | ProjectManagement projectManagement = projectManagementMapper.selectProjectManagementById(projectId); |
| | | projectDetailResp.setDeptId(projectManagement.getDeptId()); |
| | | projectDetailResp.setDeptName(projectDetailResp.getDeptName()); |
| | | projectDetailResp.setProjectName(projectManagement.getProjectName()); |
| | | projectDetailResp.setProjectDateStart(projectManagement.getProjectDateStart()); |
| | | projectDetailResp.setProjectDateEnd(projectManagement.getProjectDateEnd()); |
| | | if (StringUtils.isNotEmpty(projectManagement.getJobCategory())){ |
| | | projectDetailResp.setJobCategory(projectManagement.getJobCategory()); |
| | | } |
| | | SysExpertInfo sysExpertInfo = sysExpertInfoMapper.selectById(projectDetailResp.getExpertId()); |
| | | if (sysExpertInfo != null){ |
| | | projectDetailResp.setTitle(sysExpertInfo.getTitle()); |
| | | projectDetailResp.setJob(sysExpertInfo.getJob()); |
| | | } |
| | | |
| | | } |
| | | return projectDetailResp; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectExpertExportInfoRes> projectExpertExportList(Long projectId) { |
| | | ProjectManagement projectManagement = checkData(projectId); |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && projectManagement.getDeptId().intValue() != SecurityUtils.getDeptId().intValue()){ |
| | | throw new ServiceException("非本部门数据,无权操作!"); |
| | | } |
| | | if (projectManagement.getState() != 4){ |
| | | throw new ServiceException("项目未完成,无权操作!"); |
| | | } |
| | | if (projectManagement.getEvaluationState() == 0){ |
| | | throw new ServiceException("有专家未完成评定与报销,请完善后再试"); |
| | | } |
| | | |
| | | return projectExpertMapper.projectExpertExportList(projectId); |
| | | |
| | | } |
| | | |
| | | private List<ProjectExpertDetail> dealData(List<ProjectExpertScoreSaveReq.Score> data,Long projectExpertId){ |
| | |
| | | } |
| | | return projectManagement; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |