| | |
| | | import cn.gistack.sm.sg.mapper.SgGxStepMapper; |
| | | import cn.gistack.sm.sg.mapper.SgProgressReportMapper; |
| | | import cn.gistack.sm.sg.mapper.SgProjectInfoMapper; |
| | | import cn.gistack.sm.sg.service.SgProgressReportService; |
| | | import cn.gistack.sm.sg.service.SgProjectInfoService; |
| | | import cn.gistack.sm.sjztmd.entity.AttAdBase; |
| | | import cn.gistack.sm.sjztmd.service.IAttAdBaseService; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private SgGxStepMapper sgGxStepMapper; |
| | | |
| | | @Autowired |
| | | private SgProgressReportServiceImpl sgProgressReportService; |
| | | |
| | | @Override |
| | | public Object queryPageList(IPage<SgProjectInfoDO> page, ProjectSearchDTO searchDTO) { |
| | | List<String> sgCodeS = getSgCodeByUser(); |
| | | searchDTO.setSgCodeS(sgCodeS); |
| | | // setDeptId(searchDTO); |
| | | setAdCode(searchDTO); |
| | | Boolean isPage = searchDTO.getIsPage(); |
| | | if (isPage==null) isPage = true; |
| | | if (isPage ){ |
| | |
| | | |
| | | @Override |
| | | public Map<String, Object> projectCount(ProjectSearchDTO searchDTO) { |
| | | List<String> sgCodeS = getSgCodeByUser(); |
| | | searchDTO.setSgCodeS(sgCodeS); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<SgProjectInfoVO> progressList = progressList(searchDTO); |
| | | BigDecimal reduce = progressList.stream().filter(s->s.getProjectProgressNum()!=null).map(SgProjectInfoDO::getProjectProgressNum).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | |
| | | public List<SgProjectTreeVO> projectTree(ProjectSearchDTO dto) { |
| | | List<String> sgCodeS = getSgCodeByUser(); |
| | | dto.setSgCodeS(sgCodeS); |
| | | setAdCode(dto); |
| | | List<SgProjectTreeVO> list = sgProjectInfoMapper.projectTree(dto); |
| | | if (CollectionUtils.isNotEmpty(list)){ |
| | | list.forEach(x->{ |
| | |
| | | provinceNode.setChildList(provinceChildren); |
| | | tree.add(provinceNode); |
| | | } |
| | | return tree; |
| | | List<SgProjectTreeVO> childList = tree.get(0).getChildList(); |
| | | List<SgProjectTreeVO> collect = childList.stream() |
| | | .sorted(Comparator.comparing(s -> { |
| | | String scode = s.getRegionName(); |
| | | if (scode.equals("第一标段")) { |
| | | return 1; |
| | | } else if (scode.equals("第二标段")) { |
| | | return 2; |
| | | } else if (scode.equals("第三标段")) { |
| | | return 3; |
| | | } else if (scode.equals("第四标段")) { |
| | | return 4; |
| | | } else if (scode.equals("第五标段")) { |
| | | return 5; |
| | | } else { |
| | | return Integer.MAX_VALUE; |
| | | } |
| | | })) |
| | | .collect(Collectors.toList()); |
| | | tree.get(0).setChildList(collect); |
| | | return tree; |
| | | |
| | | } |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | private void setAdCode(ProjectSearchDTO dto) { |
| | | String deptId = AuthUtil.getDeptId(); |
| | | Long roleId = sgProgressReportService.getRoleId(); |
| | | if(roleId.equals(1811657352658042882L)){ |
| | | dto.setAdCode(deptId); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ResVO> resList(IPage<ResVO> page, ProjectSearchDTO dto) { |
| | | List<String> sgCodeByUser = getSgCodeByUser(); |
| | | dto.setSgCodeS(sgCodeByUser); |
| | | return page.setRecords(baseMapper.resList(page,dto)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void delete(String ids) { |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | list.forEach(id->{ |
| | | List<SgProgressReportDO> reportDOS = new LambdaQueryChainWrapper<>(sgProgressReportMapper).eq(SgProgressReportDO::getProframId, id).list(); |
| | | if (CollectionUtils.isNotEmpty(reportDOS)){ |
| | | SgProjectInfoDO sgProjectInfoDO = sgProjectInfoMapper.selectById(id); |
| | | throw new ServiceException(sgProjectInfoDO.getProjectName() + "存在施工审批,无法删除!"); |
| | | } |
| | | sgProjectInfoMapper.deleteById(id); |
| | | }); |
| | | } |
| | | |
| | | } |