| | |
| | | package com.gkhy.system.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.util.List; |
| | | import com.rchuing.common.utils.DateUtils; |
| | | 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.*; |
| | | import com.gkhy.system.domain.vo.request.*; |
| | | import com.gkhy.system.domain.vo.response.*; |
| | | import com.gkhy.system.mapper.*; |
| | | import com.gkhy.system.service.IProjectFileService; |
| | | import com.gkhy.system.service.IProjectManagementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.gkhy.system.mapper.ProjectManagementMapper; |
| | | import com.gkhy.system.domain.ProjectManagement; |
| | | import com.gkhy.system.service.IProjectManagementService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 项目管理Service业务层处理 |
| | |
| | | public class ProjectManagementServiceImpl extends ServiceImpl<ProjectManagementMapper, ProjectManagement> implements IProjectManagementService { |
| | | @Autowired |
| | | private ProjectManagementMapper projectManagementMapper; |
| | | |
| | | @Autowired |
| | | private ProjectExpertMapper projectExpertMapper; |
| | | |
| | | @Autowired |
| | | private ProjectFileMapper projectFileMapper; |
| | | |
| | | @Autowired |
| | | private ProjectExpertDetailMapper projectExpertDetailMapper; |
| | | |
| | | @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); |
| | | } |
| | | |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertProjectManagement(ProjectManagement projectManagement) { |
| | | projectManagement.setCreateTime(DateUtils.getNowDate()); |
| | | return projectManagementMapper.insertProjectManagement(projectManagement); |
| | | public Long insertProjectManagement(ProjectManageSaveReq projectManagement) { |
| | | ProjectManagement projectManagementSave = new ProjectManagement(); |
| | | 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); |
| | | updateById(projectManagementSave); |
| | | }else { |
| | | projectManagementSave.setStep(1L); |
| | | projectManagementSave.setCreateBy(SecurityUtils.getUsername()); |
| | | projectManagementSave.setCreateTime(DateUtils.getNowDate()); |
| | | save(projectManagementSave); |
| | | // projectManagementMapper.insertProjectManagement(projectManagementSave); |
| | | } |
| | | |
| | | |
| | | return projectManagementSave.getId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateProjectManagement(ProjectManagement projectManagement) { |
| | | projectManagement.setUpdateTime(DateUtils.getNowDate()); |
| | | return projectManagementMapper.updateProjectManagement(projectManagement); |
| | | @Transactional |
| | | public void updateProjectManagement(ProjectExpertSaveBatchReqDto projectManagement) { |
| | | ProjectManagement projectManagement1 = checkDataPer(projectManagement.getId()); |
| | | //专家选取 |
| | | |
| | | ProjectManagement projectManagementSave = new ProjectManagement(); |
| | | projectManagementSave.setUpdateBy(SecurityUtils.getUsername()); |
| | | projectManagementSave.setUpdateTime(DateUtils.getNowDate()); |
| | | projectManagementSave.setId(projectManagement.getId()); |
| | | if (projectManagement1.getState() != 1 && projectManagement1.getState() != 0 ){ |
| | | throw new ServiceException("该步骤不可操作专家数据!"); |
| | | } |
| | | |
| | | List<ProjectExpertSaveReqDto> saveData = projectManagement.getSaveData(); |
| | | if (!StringUtils.isNotEmpty(saveData)){ |
| | | throw new ServiceException("专家不可为空!"); |
| | | } |
| | | if (hasDuplicateExpertId(saveData)){ |
| | | 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); |
| | | projectManagementSave.setState(1L); |
| | | }else if (projectManagement1.getStep() == 2 && projectManagement.getStep() == 3){ |
| | | projectManagementSave.setStep(2L); |
| | | projectManagementSave.setState(2L); |
| | | projectManagementSave.setProjectCheckTime(new Date()); |
| | | List<ProjectExpertSaveReqDto> collect = saveData.stream() |
| | | .filter(dto -> "1".equals(dto.getTeamLeader().toString())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (StringUtils.isEmpty(collect)){ |
| | | throw new ServiceException("缺少组长!"); |
| | | } |
| | | if (collect.size() > 1){ |
| | | throw new ServiceException("组长只能选一人!"); |
| | | } |
| | | projectManagementSave.setExpertName(collect.get(0).getExpertName()); |
| | | projectManagementSave.setExpertId(collect.get(0).getExpertId()); |
| | | } |
| | | |
| | | List<ProjectExpertSaveReqDto> saveList = saveData.stream() |
| | | .filter(dto -> dto.getId() == null) |
| | | .collect(Collectors.toList()); |
| | | if (StringUtils.isNotEmpty(saveList)){ |
| | | List<ProjectExpert> projectExperts = convertToProjectExpertList(saveList, projectManagement.getId()); |
| | | int i = projectExpertMapper.batchInsertProjectExpert(projectExperts); |
| | | if (i < 1){ |
| | | throw new ServiceException("保存专家失败!"); |
| | | } |
| | | } |
| | | List<ProjectExpertSaveReqDto> editList = saveData.stream() |
| | | .filter(dto -> dto.getId() != null) |
| | | .collect(Collectors.toList()); |
| | | if (StringUtils.isNotEmpty(editList)){ |
| | | List<ProjectExpert> projectExperts = convertToProjectExpertList(editList, projectManagement.getId()); |
| | | int i = projectExpertMapper.batchUpdateProjectExpert(projectExperts); |
| | | if (i < 1){ |
| | | throw new ServiceException("保存专家失败!"); |
| | | } |
| | | } |
| | | projectManagementSave.setExpertNum((long) saveData.size()); |
| | | List<Long> delData = projectManagement.getDelData(); |
| | | if (delData != null && delData.size() > 0) { |
| | | int i = projectExpertMapper.deleteProjectExpertByIds(delData.toArray(new Long[delData.size()])); |
| | | if (i < 1){ |
| | | throw new ServiceException("保存专家失败!"); |
| | | } |
| | | } |
| | | int i = projectManagementMapper.updateProjectManagement(projectManagementSave); |
| | | if (i < 1){ |
| | | throw new ServiceException("保存专家失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<ProjectExpert> convertToProjectExpertList(List<ProjectExpertSaveReqDto> reqDtos,Long projectId) { |
| | | List<ProjectExpert> projectExpertList = new ArrayList<>(); |
| | | reqDtos.forEach(reqDto -> { |
| | | ProjectExpert projectExpert = convertToProjectExpert(reqDto,projectId); |
| | | projectExpertList.add(projectExpert); |
| | | }); |
| | | return projectExpertList; |
| | | } |
| | | |
| | | private ProjectExpert convertToProjectExpert(ProjectExpertSaveReqDto reqDto,Long projectId) { |
| | | ProjectExpert projectExpert = new ProjectExpert(); |
| | | projectExpert.setProjectId(projectId); |
| | | projectExpert.setExpertId(reqDto.getExpertId()); |
| | | projectExpert.setSelectionMode(reqDto.getSelectionMode()); |
| | | projectExpert.setTeamLeader(reqDto.getTeamLeader()); |
| | | if (reqDto.getId() == null){ |
| | | projectExpert.setCreateBy(SecurityUtils.getUsername()); |
| | | }else { |
| | | projectExpert.setUpdateBy(SecurityUtils.getUsername()); |
| | | projectExpert.setId(reqDto.getId()); |
| | | } |
| | | return projectExpert; |
| | | } |
| | | |
| | | |
| | | |
| | | public boolean hasDuplicateExpertId(List<ProjectExpertSaveReqDto> saveData) { |
| | | // 使用 Stream API 收集 expertId 的频率 |
| | | Map<Long, Long> frequencyMap = saveData.stream() |
| | | .collect(Collectors.groupingBy(ProjectExpertSaveReqDto::getExpertId, Collectors.counting())); |
| | | |
| | | // 检查是否有任何 expertId 的频率大于 1 |
| | | return frequencyMap.values().stream().anyMatch(count -> count > 1); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int deleteProjectManagementByIds(Long[] ids) { |
| | | // 校验 |
| | | for (Long id : ids) { |
| | | checkDataPer(id); |
| | | } |
| | | return projectManagementMapper.deleteProjectManagementByIds(ids); |
| | | } |
| | | |
| | |
| | | public int deleteProjectManagementById(Long id) { |
| | | return projectManagementMapper.deleteProjectManagementById(id); |
| | | } |
| | | |
| | | @Override |
| | | public ProjectExpertManagementInfoRes projectExpertCheckInfo(Long id) { |
| | | return projectManagementMapper.projectExpertCheckInfo(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void projectCheck(ProjectCheckReq req) { |
| | | ProjectManagement projectManagement = checkDataPer(req.getId()); |
| | | |
| | | if (req.getState() != 3L && req.getState() != 1 ){ |
| | | throw new ServiceException("参数异常!"); |
| | | } |
| | | Long state = projectManagement.getState(); |
| | | if (state != 2){ |
| | | throw new ServiceException("未生成审批单不可审批通过操作!"); |
| | | } |
| | | |
| | | List<ProjectFile> projectFile = req.getProjectFile(); |
| | | ProjectManagement projectManagementUp = new ProjectManagement(); |
| | | projectManagementUp.setId(req.getId()); |
| | | projectManagementUp.setState(req.getState()); |
| | | projectManagementUp.setUpdateBy(SecurityUtils.getUsername()); |
| | | if (req.getState() == 3){ |
| | | projectManagementUp.setStep(3L); |
| | | }else if (req.getState() == 1){ |
| | | projectManagementUp.setStep(2L); |
| | | } |
| | | int i = projectManagementMapper.updateProjectManagement(projectManagementUp); |
| | | //驳回删 |
| | | if (req.getState() == 1){ |
| | | projectFileMapper.deleteProjectFileByIdAndType(req.getId(), "1"); |
| | | } |
| | | if (i > 0 && StringUtils.isNotEmpty(projectFile) && req.getState() == 3){ |
| | | //删除之前的该类型 |
| | | projectFileMapper.deleteProjectFileByIdAndType(req.getId(), "1"); |
| | | String username = SecurityUtils.getUsername(); |
| | | projectFile.forEach(file -> { |
| | | file.setCreateBy(username); |
| | | file.setProjectId(req.getId()); |
| | | }); |
| | | //int i1 = projectFileMapper.insertProjectFiles(projectFile); |
| | | Boolean b = projectFileService.saveBatchProjectFile(projectFile); |
| | | if (!b){ |
| | | throw new ServiceException("保存附件失败!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void projectArchive(ProjectArchiveReq req) { |
| | | ProjectManagement projectManagement = checkDataPer(req.getId()); |
| | | |
| | | Long state = projectManagement.getState(); |
| | | if (state != 3L){ |
| | | throw new ServiceException("此状态不可归档!"); |
| | | } |
| | | List<ProjectFile> projectFile = req.getProjectFile(); |
| | | ProjectManagement projectManagementUp = new ProjectManagement(); |
| | | projectManagementUp.setId(req.getId()); |
| | | projectManagementUp.setState(4L); |
| | | projectManagementUp.setStep(4L); |
| | | projectManagementUp.setDesc(req.getDesc()); |
| | | projectManagementUp.setProjectEndTime(req.getProjectEndTime()); |
| | | projectManagementUp.setUpdateBy(SecurityUtils.getUsername()); |
| | | int i = projectManagementMapper.updateProjectManagement(projectManagementUp); |
| | | if (i > 0 && StringUtils.isNotEmpty(projectFile)){ |
| | | String username = SecurityUtils.getUsername(); |
| | | projectFile.forEach(file -> { |
| | | file.setCreateBy(username); |
| | | file.setProjectId(req.getId()); |
| | | }); |
| | | // int i1 = projectFileMapper.insertProjectFiles(projectFile); |
| | | // if (i1 < 1){ |
| | | // throw new ServiceException("保存附件失败!"); |
| | | // } |
| | | Boolean b = projectFileService.saveBatchProjectFile(projectFile); |
| | | if (!b){ |
| | | throw new ServiceException("保存附件失败!"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectExpertStateResp> getProjectExpertSate(ProjectExpertStateReq req) { |
| | | |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | req.setDeptId(SecurityUtils.getDeptId()); |
| | | } |
| | | return projectManagementMapper.getProjectExpertSate(req); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectExpertEvaluationResp> projectExpertEvaluationList(Long projectId) { |
| | | return projectExpertMapper.projectExpertEvaluationList(projectId); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void projectExpertDetailSave(ProjectExpertScoreSaveReq req) { |
| | | |
| | | List<Long> delData = req.getDelData(); |
| | | if (StringUtils.isNotEmpty(delData)){ |
| | | projectExpertDetailMapper.deleteProjectExpertDetailByIds(delData.toArray(new Long[delData.size()])); |
| | | } |
| | | |
| | | |
| | | ProjectExpert projectExpert1 = projectExpertMapper.selectProjectExpertById(req.getProjectExpertId()); |
| | | if (projectExpert1 == null){ |
| | | throw new ServiceException("项目专家不存在!"); |
| | | } |
| | | ProjectManagement projectManagement1 = checkData(projectExpert1.getProjectId()); |
| | | if (projectManagement1.getState() != 4){ |
| | | throw new ServiceException("项目未完成!"); |
| | | } |
| | | |
| | | //更新项目专家表 |
| | | ProjectExpert projectExpert = new ProjectExpert(); |
| | | BeanUtil.copyProperties(req, projectExpert); |
| | | projectExpert.setId(req.getProjectExpertId()); |
| | | projectExpert.setScore(req.getScore()); |
| | | projectExpert.setEvaluationState(1L); |
| | | int i = projectExpertMapper.updateProjectExpert(projectExpert); |
| | | if (i < 1){ |
| | | throw new ServiceException("保存失败!"); |
| | | } |
| | | |
| | | List<ProjectExpertScoreSaveReq.Score> saveData = req.getSaveData(); |
| | | |
| | | if (StringUtils.isNotEmpty(saveData)){ |
| | | List<ProjectExpertDetail> projectExpertDetails = dealData(saveData, req.getProjectExpertId()); |
| | | List<ProjectExpertDetail> saveList = projectExpertDetails.stream() |
| | | .filter(dto -> dto.getId() == null) |
| | | .collect(Collectors.toList()); |
| | | if (StringUtils.isNotEmpty(saveList)){ |
| | | int i12 = projectExpertDetailMapper.batchInsertProjectExpertDetail(saveList); |
| | | if (i12 < 1){ |
| | | throw new ServiceException("保存失败!"); |
| | | } |
| | | } |
| | | List<ProjectExpertDetail> updateList = projectExpertDetails.stream() |
| | | .filter(dto -> dto.getId() != null) |
| | | .collect(Collectors.toList()); |
| | | if (StringUtils.isNotEmpty(updateList)){ |
| | | int i1 = projectExpertDetailMapper.batchUpdateProjectExpertDetail(updateList); |
| | | if (i1 < 1){ |
| | | throw new ServiceException("保存失败!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //验证是否都已考评 |
| | | int unEva = projectExpertMapper.getUnEva(projectExpert1.getProjectId()); |
| | | if (unEva == 0){ |
| | | ProjectManagement projectManagement = new ProjectManagement(); |
| | | projectManagement.setId(projectExpert1.getProjectId()); |
| | | projectManagement.setEvaluationState(1L); |
| | | projectManagement.setUpdateBy(SecurityUtils.getUsername()); |
| | | int i1 = projectManagementMapper.updateProjectManagement(projectManagement); |
| | | if (i1 < 1){ |
| | | throw new ServiceException("保存失败!"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectExpertResp> projectExpertEvaList(SysProjectExpertReq req) { |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | req.setDeptId(SecurityUtils.getDeptId()); |
| | | } |
| | | return projectExpertMapper.projectExpertEvaList(req); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectExpertDetail> selectProjectExpertDetailList(Long projectExpertId) { |
| | | ProjectExpertDetail projectExpertDetail = new ProjectExpertDetail(); |
| | | projectExpertDetail.setProjectExpertId(projectExpertId); |
| | | return projectExpertDetailMapper.selectProjectExpertDetailList(projectExpertDetail); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectFile> selectProjectFileList(Long projectId,String module ) { |
| | | ProjectFile projectFile = new ProjectFile(); |
| | | projectFile.setProjectId(projectId); |
| | | projectFile.setModule(module); |
| | | List<ProjectFile> projectFiles = projectFileMapper.selectProjectFileList(projectFile); |
| | | if (StringUtils.isNotEmpty(projectFiles)){ |
| | | return projectFiles; |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | @Override |
| | | public ProjectNumResp getProjectNum() { |
| | | ProjectNumResp projectNumResp = new ProjectNumResp(); |
| | | List<Integer> dataNum = projectManagementMapper.getDataNum(SecurityUtils.isAdmin(SecurityUtils.getUserId()) ? null : SecurityUtils.getDeptId()); |
| | | if (!StringUtils.isEmpty(dataNum)){ |
| | | Map<Integer, Long> statusCounts = dataNum.stream() |
| | | .collect(Collectors.groupingBy( |
| | | status -> status, |
| | | Collectors.counting() |
| | | )); |
| | | projectNumResp.setTotal(dataNum.size()); |
| | | projectNumResp.setApproval(statusCounts.get(3) == null ? 0 : statusCounts.get(3).intValue()); |
| | | projectNumResp.setExpert(statusCounts.get(1) == null ? 0 : statusCounts.get(1).intValue()); |
| | | projectNumResp.setStaging(statusCounts.get(0) == null ? 0:statusCounts.get(0).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()); |
| | | 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){ |
| | | List<ProjectExpertDetail> dealData = new ArrayList<>(); |
| | | data.forEach(dto -> { |
| | | ProjectExpertDetail projectExpertDetail = new ProjectExpertDetail(); |
| | | projectExpertDetail.setProjectExpertId(projectExpertId); |
| | | projectExpertDetail.setContent(dto.getContent()); |
| | | projectExpertDetail.setScore(dto.getScore()); |
| | | projectExpertDetail.setScoreType(dto.getScoreType()); |
| | | if (dto.getId() == null){ |
| | | projectExpertDetail.setCreateBy(SecurityUtils.getUsername()); |
| | | }else { |
| | | projectExpertDetail.setId(dto.getId()); |
| | | projectExpertDetail.setUpdateBy(SecurityUtils.getUsername()); |
| | | } |
| | | |
| | | dealData.add(projectExpertDetail); |
| | | }); |
| | | return dealData; |
| | | } |
| | | |
| | | |
| | | public ProjectManagement checkData(Long id){ |
| | | ProjectManagement projectManagement = projectManagementMapper.selectProjectManagementById(id); |
| | | if (ObjectUtil.isNull(projectManagement)){ |
| | | throw new ServiceException("数据不存在!"); |
| | | } |
| | | return projectManagement; |
| | | } |
| | | |
| | | public ProjectManagement checkDataPer(Long id){ |
| | | ProjectManagement projectManagement = checkData(id); |
| | | Long deptId = projectManagement.getDeptId(); |
| | | // 本部门审批? |
| | | if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()){ |
| | | throw new ServiceException("非本部门数据,无权操作!"); |
| | | } |
| | | if (projectManagement.getState() == 4){ |
| | | throw new ServiceException("已结项,无权操作!"); |
| | | } |
| | | return projectManagement; |
| | | } |
| | | } |