| | |
| | | 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.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; |
| | | 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; |
| | | |
| | | @Autowired |
| | | private SgReportUserMapper sgReportUserMapper; |
| | | @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); |
| | | List<SgReportUserDO> reportUserDOS = sgProgressReportMapper.selectProcessUserByProjectId(old.getProgramId()); |
| | | if (Objects.isNull(userId)){ |
| | | projectPersonConfigMapper.deleteById(id); |
| | | 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); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |