| | |
| | | import cn.gistack.sm.sg.DO.SgProgressReportDO; |
| | | import cn.gistack.sm.sg.DO.SgProjectPersonConfigDO; |
| | | import cn.gistack.sm.sg.DO.SgProjectRolePersonV0; |
| | | import cn.gistack.sm.sg.DO.SgReportUserDO; |
| | | import cn.gistack.sm.sg.DTO.AddSgProjectPersonConfigDTO; |
| | | import cn.gistack.sm.sg.DTO.ProjectSearchDTO; |
| | | import cn.gistack.sm.sg.mapper.SgProgressReportMapper; |
| | | import cn.gistack.sm.sg.mapper.SgProjectPersonConfigMapper; |
| | | import cn.gistack.sm.sg.mapper.SgReportUserMapper; |
| | | import cn.gistack.sm.sg.service.SgProjectPersonConfigService; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | private SgProjectPersonConfigMapper projectPersonConfigMapper; |
| | | @Autowired |
| | | private SgProgressReportMapper sgProgressReportMapper; |
| | | |
| | | @Autowired |
| | | private SgReportUserMapper sgReportUserMapper; |
| | | @Override |
| | | public List<String> getRoleList(ProjectSearchDTO searchDTO) { |
| | | List<String> list = projectPersonConfigMapper.getRoleList(searchDTO); |
| | |
| | | projectPersonConfigMapper.insert(sgProjectPersonConfigDO); |
| | | }else { |
| | | SgProjectPersonConfigDO old = projectPersonConfigMapper.selectById(id); |
| | | boolean isReport = !new LambdaQueryChainWrapper<>(sgProgressReportMapper).eq(SgProgressReportDO::getProframId, old.getProgramId()).list().isEmpty(); |
| | | List<SgReportUserDO> reportUserDOS = sgProgressReportMapper.selectProcessUserByProjectId(old.getProgramId()); |
| | | if (Objects.isNull(userId)){ |
| | | if (isReport){ |
| | | throw new ServiceException("此项目配置存在审批,不允许修改"); |
| | | } |
| | | projectPersonConfigMapper.deleteById(id); |
| | | }else if (!old.getUserId().equals(sgProjectPersonConfigDO.getUserId())){ |
| | | if (isReport){ |
| | | throw new ServiceException("此项目配置存在审批,不允许修改"); |
| | | if (!CollectionUtils.isEmpty(reportUserDOS)){ |
| | | reportUserDOS.forEach(s->{ |
| | | if (Objects.equals(old.getUserId(), s.getUserId())){ |
| | | // sgReportUserMapper.deleteById(s.getId()); |
| | | } |
| | | }); |
| | | } |
| | | }else if (!old.getUserId().equals(sgProjectPersonConfigDO.getUserId())){ |
| | | projectPersonConfigMapper.updateById(sgProjectPersonConfigDO); |
| | | if (!CollectionUtils.isEmpty(reportUserDOS)){ |
| | | reportUserDOS.forEach(s->{ |
| | | if (Objects.equals(old.getUserId(), s.getUserId())){ |
| | | s.setUserId(sgProjectPersonConfigDO.getUserId()); |
| | | sgReportUserMapper.updateById(s); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |