| | |
| | | |
| | | import cn.gistack.sm.sg.DO.SgGxDO; |
| | | import cn.gistack.sm.sg.DO.SgGxStepDO; |
| | | import cn.gistack.sm.sg.DO.SgReportUserDO; |
| | | import cn.gistack.sm.sg.DTO.ProjectSearchDTO; |
| | | import cn.gistack.sm.sg.VO.SgGxVO; |
| | | import cn.gistack.sm.sg.mapper.SgGxMapper; |
| | | import cn.gistack.sm.sg.mapper.SgProgressReportMapper; |
| | | import cn.gistack.sm.sg.service.SgGxService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | |
| | | public class SgGxServiceImpl extends ServiceImpl<SgGxMapper, SgGxDO> implements SgGxService { |
| | | @Autowired |
| | | private SgGxMapper sgGxMapper; |
| | | |
| | | @Autowired |
| | | private SgProgressReportMapper sgProgressReportMapper; |
| | | @Override |
| | | public IPage<SgGxVO> queryPageList(IPage<SgGxVO> page, ProjectSearchDTO searchDTO) { |
| | | List<SgGxVO> list = sgGxMapper.queryPageList(page,searchDTO); |
| | | if (CollectionUtils.isNotEmpty(list)){ |
| | | List<Long> ids = list.stream().map(SgGxDO::getId).collect(Collectors.toList()); |
| | | List<Long> userIds = list.stream().map(SgGxDO::getCreateUser).collect(Collectors.toList()); |
| | | List<Map<String,Object>> users = sgProgressReportMapper.getUserByIds(userIds); |
| | | List<SgGxStepDO> stepDOS = sgGxMapper.queryStepByIds(ids); |
| | | if (CollectionUtils.isNotEmpty(stepDOS)){ |
| | | Map<Long, List<SgGxStepDO>> map = stepDOS.stream().collect(Collectors.groupingBy(SgGxStepDO::getGxInfoId)); |
| | | for (SgGxVO sgGxDO : list) { |
| | | for (Map<String, Object> user : users) { |
| | | if (user.get("ID").equals(sgGxDO.getCreateUser())){ |
| | | sgGxDO.setCreateUserName(user.get("REAL_NAME").toString()); |
| | | } |
| | | } |
| | | List<SgGxStepDO> sgGxStepDOS = map.get(sgGxDO.getId()); |
| | | if (CollectionUtils.isNotEmpty(sgGxStepDOS)){ |
| | | sgGxDO.setStepDOList(sgGxStepDOS); |