| | |
| | | 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.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | List<String> sgCodeS = getSgCodeByUser(); |
| | | searchDTO.setSgCodeS(sgCodeS); |
| | | setAdCode(searchDTO); |
| | | BladeUser user = AuthUtil.getUser(); |
| | | Long roleId = getRoleId(); |
| | | //setUnit2(searchDTO,user,roleId); |
| | | Boolean isPage = searchDTO.getIsPage(); |
| | | if (isPage==null) isPage = true; |
| | | if (isPage ){ |
| | |
| | | } |
| | | |
| | | } |
| | | private void setUnit2(ProjectSearchDTO searchDTO, BladeUser user, Long roleId) { |
| | | List<String> longList = Arrays.stream(user.getDeptId().split(",")) |
| | | .collect(Collectors.toList()); |
| | | //判断是不是省厅建办 否的话就不设置部门 |
| | | if (!roleId.equals(1800820667082948610L)){ |
| | | //判断是不是县级建办 否的话就是监理单位下人员进行 |
| | | if(roleId.equals(1800820855352672257L)){ |
| | | searchDTO.setUserUnit(longList); |
| | | } |
| | | |
| | | if(roleId.equals(1811657352658042882L)) { |
| | | searchDTO.setCountryUnit(longList); |
| | | } |
| | | |
| | | if(roleId==1800818489547112450L){ |
| | | searchDTO.setSelfUnit(longList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Long getRoleId(){ |
| | | BladeUser user = AuthUtil.getUser(); |
| | | List<String> userRole = Arrays.asList(user.getRoleId().split(",")); |
| | | List<Long> roleList = sgProgressReportMapper.getSgEngineerRole(); |
| | | Long roleId = null; |
| | | for (String s : userRole) { |
| | | long l = Long.parseLong(s); |
| | | if (roleList.contains(l)){ |
| | | roleId = l; |
| | | } |
| | | } |
| | | if (Objects.isNull(roleId)){ |
| | | roleId = Long.parseLong(userRole.get(0)); |
| | | } |
| | | return roleId; |
| | | } |
| | | /** |
| | | * 设置百分号 |
| | | * @param s |
| | |
| | | continue; |
| | | } |
| | | gxList = gxList.stream().sorted(Comparator.comparing(SgProjectInfoVO::getPrice)).collect(Collectors.toList()); |
| | | SgTypeVO typeVO = SgTypeVO.builder().typeName(gxList.get(0).getTypeName()).build(); |
| | | SgTypeVO typeVO = SgTypeVO.builder().typeName(gxList.get(0).getTypeName()).sort(gxList.get(0).getDSort()).build(); |
| | | List<SgDeviceDO> deviceDOS = new ArrayList<>(); |
| | | //设备分组 |
| | | Map<Long, List<SgProjectInfoVO>> dMap = gxList.stream().filter(s->s.getDId()!=null).collect(Collectors.groupingBy(SgProjectInfoVO::getDId)); |
| | |
| | | BigDecimal sgGxOver = BigDecimal.valueOf(sum); |
| | | BigDecimal divideSgGx = sgGxOver.divide(sgGxSize, 2, RoundingMode.HALF_UP); |
| | | ptypeVO.setPTypeProgress(getBigDecimalPercent(divideSgGx)); |
| | | sgGxDOS = sgGxDOS.stream().sorted(Comparator.comparing(SgTypeVO::getSort)).collect(Collectors.toList()); |
| | | ptypeVO.setSgTypeVOS(sgGxDOS); |
| | | pTypes.add(ptypeVO); |
| | | } |
| | |
| | | List<String> sgCodeS = getSgCodeByUser(); |
| | | searchDTO.setSgCodeS(sgCodeS); |
| | | setDeptId(searchDTO); |
| | | BladeUser user = AuthUtil.getUser(); |
| | | Long roleId = getRoleId(); |
| | | setUnit2(searchDTO,user,roleId); |
| | | List<SgProjectInfoDO> list = sgProjectInfoMapper.queryPageList(null, searchDTO); |
| | | return list; |
| | | } |
| | |
| | | public Map<String, Object> projectCount(ProjectSearchDTO searchDTO) { |
| | | List<String> sgCodeS = getSgCodeByUser(); |
| | | searchDTO.setSgCodeS(sgCodeS); |
| | | BladeUser user = AuthUtil.getUser(); |
| | | Long roleId = getRoleId(); |
| | | //setUnit2(searchDTO,user,roleId); |
| | | 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); |
| | |
| | | List<String> sgCodeS = getSgCodeByUser(); |
| | | dto.setSgCodeS(sgCodeS); |
| | | setAdCode(dto); |
| | | BladeUser user = AuthUtil.getUser(); |
| | | Long roleId = getRoleId(); |
| | | //setUnit2(dto,user,roleId); |
| | | List<SgProjectTreeVO> list = sgProjectInfoMapper.projectTree(dto); |
| | | if (CollectionUtils.isNotEmpty(list)){ |
| | | list.forEach(x->{ |