| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -27,10 +27,16 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.dto.form.IdAndNameDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.constant.DataSourceConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.constant.TDuckConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -49,6 +55,9 @@ import com.epmet.dataaggre.service.epmettduck.PrPublishRangeService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.service.epmettduck.PrUserProjectService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.service.epmettduck.PrVistRecordService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.service.govorg.GovOrgService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.CustomerGridDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.CustomerGridFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.GovOrgOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageInfo; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -83,6 +92,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private GovOrgService govOrgService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Resource | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private PrVistRecordService prVistRecordService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private GovOrgOpenFeignClient govOrgOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public PageData<PrUserProjectDTO> page(Map<String, Object> params) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -157,7 +168,39 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public List<TDuckListResultDTO> queryProjectList(TDuckListFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> projectKeys = baseDao.selectProjectKey(formDTO.getOrgIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> orgIds = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (formDTO.getClient().equals(TDuckConstant.CLIENT_GOV)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String pids = staffInfo.getAgencyPIds(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String agencyId = staffInfo.getAgencyId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_DEPT)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<IdAndNameDTO> deptList = staffInfo.getDeptList(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (CollectionUtils.isEmpty(deptList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    return new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                orgIds = joint(pids,agencyId,deptList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_GRID)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<IdAndNameDTO> gridList = staffInfo.getGridList(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (CollectionUtils.isEmpty(gridList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    return new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                orgIds = joint(pids,agencyId,gridList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                String selfOrg = pids + ":" + agencyId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                orgIds.add(selfOrg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            customerGridFormDTO.setGridId(formDTO.getOrgId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!gridResult.success()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException("查询网格信息失败了..."); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerGridDTO data = gridResult.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String oneOrg = data.getPids() + ":" + data.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            orgIds.add(oneOrg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> projectKeys = baseDao.selectProjectKey(orgIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isEmpty(projectKeys)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -174,9 +217,50 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        result.forEach(r -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), r.getCreatedBy()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String orgName = ""; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (null != staffInfo){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_AGENCY)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    orgName = staffInfo.getAgencyName(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_GRID)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    for (IdAndNameDTO g : staffInfo.getGridList()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (g.getId().equals(staffInfo.getFromOrgId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            orgName = g.getName(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_DEPT)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    for (IdAndNameDTO d : staffInfo.getDeptList()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (d.getId().equals(staffInfo.getFromOrgId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            orgName = d.getName(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            r.setOrgName(orgName); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description  orgIds拼接 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Param pids | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Param agencyId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Param list | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2021/9/23 4:48 下午 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public List<String> joint(String pids, String agencyId, List<IdAndNameDTO> list){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> orgIds = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        list.forEach(l -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String oneOrg = pids + ":" + agencyId + ":" + l.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            orgIds.add(oneOrg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return orgIds; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 分析报告 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -385,7 +469,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                int totalCount = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, Integer> resMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                for (PrUserProjectResultEntity res : resultList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    JSONObject originalData = JSON.parseObject(res.getOriginalData()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //级联组件,用processdata特殊处理下
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    JSONObject originalData = JSON.parseObject(res.getProcessData()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if(originalData.containsKey(key)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<CascaderDTO> dtoList = JSON.parseArray(originalData.get(key).toString(), CascaderDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if(CollectionUtils.isEmpty(dtoList)){ | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |