| | |
| | | package cn.gistack.sm.sg.service.impl; |
| | | |
| | | 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.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.service.SgProjectPersonConfigService; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | public class SgProjectPersonConfigServiceImpl extends ServiceImpl<SgProjectPersonConfigMapper, SgProjectPersonConfigDO> implements SgProjectPersonConfigService { |
| | | @Autowired |
| | | private SgProjectPersonConfigMapper projectPersonConfigMapper; |
| | | @Autowired |
| | | private SgProgressReportMapper sgProgressReportMapper; |
| | | @Override |
| | | public List<String> getRoleList(ProjectSearchDTO searchDTO) { |
| | | List<String> list = projectPersonConfigMapper.getRoleList(searchDTO); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void add(List<SgProjectPersonConfigDO> list) { |
| | | for (SgProjectPersonConfigDO sgProjectPersonConfigDO : list) { |
| | | if (Objects.isNull(sgProjectPersonConfigDO.getId())){ |
| | | public void add(AddSgProjectPersonConfigDTO dto) { |
| | | for (SgProjectPersonConfigDO sgProjectPersonConfigDO : dto.getData()) { |
| | | Long id = sgProjectPersonConfigDO.getId(); |
| | | Long userId = sgProjectPersonConfigDO.getUserId(); |
| | | if (Objects.isNull(id)){ |
| | | projectPersonConfigMapper.insert(sgProjectPersonConfigDO); |
| | | }else { |
| | | projectPersonConfigMapper.updateById(sgProjectPersonConfigDO); |
| | | SgProjectPersonConfigDO old = projectPersonConfigMapper.selectById(id); |
| | | boolean isReport = !new LambdaQueryChainWrapper<>(sgProgressReportMapper).eq(SgProgressReportDO::getProframId, old.getProgramId()).list().isEmpty(); |
| | | if (Objects.isNull(userId)){ |
| | | if (isReport){ |
| | | throw new ServiceException("此项目配置存在审批,不允许修改"); |
| | | } |
| | | projectPersonConfigMapper.deleteById(id); |
| | | }else if (!old.getUserId().equals(sgProjectPersonConfigDO.getUserId())){ |
| | | if (isReport){ |
| | | throw new ServiceException("此项目配置存在审批,不允许修改"); |
| | | } |
| | | projectPersonConfigMapper.updateById(sgProjectPersonConfigDO); |
| | | } |
| | | } |
| | | } |
| | | } |