|  | @ -30,6 +30,7 @@ import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.utils.ConvertUtils; |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.utils.Result; |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dao.SpecialSubjectDao; |  |  | import com.epmet.dao.SpecialSubjectDao; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import com.epmet.dto.CustomerAgencyDTO; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.SpecialSubjectDTO; |  |  | import com.epmet.dto.SpecialSubjectDTO; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.TagCustomerDTO; |  |  | import com.epmet.dto.TagCustomerDTO; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.form.*; |  |  | import com.epmet.dto.form.*; | 
			
		
	
	
		
		
			
				
					|  | @ -142,11 +143,8 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao | 
			
		
	
		
		
			
				
					|  |  |             throw new RenException(EpmetErrorCode.TAG_NOT_EXIST.getCode(), EpmetErrorCode.TAG_NOT_EXIST.getMsg()); |  |  |             throw new RenException(EpmetErrorCode.TAG_NOT_EXIST.getCode(), EpmetErrorCode.TAG_NOT_EXIST.getMsg()); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         //2、校验当前组织是否添加过此专题
 |  |  |         //2、校验当前组织是否添加过此专题
 | 
			
		
	
		
		
			
				
					
					|  |  |         QuerySpecialSubFormDTO querySpecialSubFormDTO=new QuerySpecialSubFormDTO(); |  |  |         QuerySpecialSubFormDTO querySpecialSubFormDTO=ConvertUtils.sourceToTarget(formDTO,QuerySpecialSubFormDTO.class); | 
			
				
				
			
		
	
		
		
			
				
					|  |  |         querySpecialSubFormDTO.setOrgId(formDTO.getOrgId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         querySpecialSubFormDTO.setPids(formDTO.getPids()); |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  |         querySpecialSubFormDTO.setUserId(formDTO.getAddUserId()); |  |  |         querySpecialSubFormDTO.setUserId(formDTO.getAddUserId()); | 
			
		
	
		
		
			
				
					|  |  |         querySpecialSubFormDTO.setCustomerId(formDTO.getCustomerId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         List<WorkSpecialSubjectResultDTO> havedList=this.queryExistedList(querySpecialSubFormDTO); |  |  |         List<WorkSpecialSubjectResultDTO> havedList=this.queryExistedList(querySpecialSubFormDTO); | 
			
		
	
		
		
			
				
					|  |  |         List<String> haveTagIds=havedList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList()); |  |  |         List<String> haveTagIds=havedList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList()); | 
			
		
	
		
		
			
				
					|  |  |         haveTagIds.forEach(tagId->{ |  |  |         haveTagIds.forEach(tagId->{ | 
			
		
	
	
		
		
			
				
					|  | @ -156,12 +154,9 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao | 
			
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |         // 3、保存
 |  |  |         // 3、保存
 | 
			
		
	
		
		
			
				
					|  |  |         SpecialSubjectEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, SpecialSubjectEntity.class); |  |  |         SpecialSubjectEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, SpecialSubjectEntity.class); | 
			
		
	
		
		
			
				
					
					|  |  |         StaffInfoFromDTO staffInfoFromDTO = new StaffInfoFromDTO(); |  |  |         Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(formDTO.getAddUserId()); | 
			
				
				
			
		
	
		
		
			
				
					|  |  |         staffInfoFromDTO.setStaffId(formDTO.getAddUserId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         staffInfoFromDTO.setCustomerId(formDTO.getCustomerId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         Result<MineResultDTO> result = govOrgOpenFeignClient.queryStaffProfile(staffInfoFromDTO); |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  |         if(result.success()&&null!=result.getData()){ |  |  |         if(result.success()&&null!=result.getData()){ | 
			
		
	
		
		
			
				
					
					|  |  |             insertEntity.setAddUserAgencyId(result.getData().getAgencyId()); |  |  |             insertEntity.setAddUserAgencyId(result.getData().getId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         insertEntity.setAddOrgId(formDTO.getOrgId()); |  |  |         insertEntity.setAddOrgId(formDTO.getOrgId()); | 
			
		
	
		
		
			
				
					|  |  |         insertEntity.setAddOrgPid(formDTO.getPid()); |  |  |         insertEntity.setAddOrgPid(formDTO.getPid()); | 
			
		
	
	
		
		
			
				
					|  | @ -188,7 +183,6 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					|  |  |             baseDao.delSpecialSubject(formDTO.getSpecialSubjectId(), formDTO.getUserId()); |  |  |             baseDao.delSpecialSubject(formDTO.getSpecialSubjectId(), formDTO.getUserId()); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         log.warn(String.format("special_subject is null id=%s", formDTO.getSpecialSubjectId())); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
	
		
		
			
				
					|  | @ -201,10 +195,7 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
		
		
			
				
					|  |  |     public List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO) { |  |  |     public List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO) { | 
			
		
	
		
		
			
				
					
					|  |  |         StaffInfoFromDTO staffInfoFromDTO = new StaffInfoFromDTO(); |  |  |         Result<CustomerAgencyDTO> staffResult = govOrgOpenFeignClient.getAgencyByStaff(formDTO.getUserId()); | 
			
				
				
			
		
	
		
		
			
				
					|  |  |         staffInfoFromDTO.setStaffId(formDTO.getUserId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         staffInfoFromDTO.setCustomerId(formDTO.getCustomerId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         Result<MineResultDTO> staffResult = govOrgOpenFeignClient.queryStaffProfile(staffInfoFromDTO); |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  |         if (!staffResult.success() && null == staffResult.getData()) { |  |  |         if (!staffResult.success() && null == staffResult.getData()) { | 
			
		
	
		
		
			
				
					|  |  |             throw new RenException("查询当前工作人员信息异常"); |  |  |             throw new RenException("查询当前工作人员信息异常"); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
	
		
		
			
				
					|  | @ -214,24 +205,16 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao | 
			
		
	
		
		
			
				
					|  |  |         List<WorkSpecialSubjectResultDTO> currentOrgList = new ArrayList<>(); |  |  |         List<WorkSpecialSubjectResultDTO> currentOrgList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |         List<SpecialSubjectDTO> currentOrgCreatedList = baseDao.queryExistedList(formDTO.getOrgId(), notList); |  |  |         List<SpecialSubjectDTO> currentOrgCreatedList = baseDao.queryExistedList(formDTO.getOrgId(), notList); | 
			
		
	
		
		
			
				
					|  |  |         currentOrgCreatedList.forEach(dto -> { |  |  |         currentOrgCreatedList.forEach(dto -> { | 
			
		
	
		
		
			
				
					
					|  |  |             WorkSpecialSubjectResultDTO result = new WorkSpecialSubjectResultDTO(); |  |  |             WorkSpecialSubjectResultDTO result = ConvertUtils.sourceToTarget(dto,WorkSpecialSubjectResultDTO.class); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             result.setSpecialSubjectId(dto.getId()); |  |  |             result.setSpecialSubjectId(dto.getId()); | 
			
		
	
		
		
			
				
					|  |  |             result.setTagId(dto.getTagId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             result.setTagName(dto.getTagName()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             //1、如果当前专题是给当前所在组织(or网格)添加的;
 |  |  |             //1、如果当前专题是给当前所在组织(or网格)添加的;
 | 
			
		
	
		
		
			
				
					|  |  |             //2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
 |  |  |             //2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
 | 
			
		
	
		
		
			
				
					
					|  |  |             if(dto.getAddUserAgencyId().equals(staffResult.getData().getAgencyId()) |  |  |             if(dto.getAddUserAgencyId().equals(staffResult.getData().getId()) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 && dto.getAddOrgId().equals(formDTO.getOrgId())){ |  |  |                 && dto.getAddOrgId().equals(formDTO.getOrgId())){ | 
			
		
	
		
		
			
				
					|  |  |                 result.setCanDel(true); |  |  |                 result.setCanDel(true); | 
			
		
	
		
		
			
				
					|  |  |             }else{ |  |  |             }else{ | 
			
		
	
		
		
			
				
					|  |  |                 result.setCanDel(false); |  |  |                 result.setCanDel(false); | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					|  |  |             result.setAddOrgId(dto.getAddOrgId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             result.setOrgLevel(dto.getOrgLevel()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             result.setTagColor(dto.getTagColor()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             result.setCreatedTime(dto.getCreatedTime()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             result.setCreatedBy(dto.getCreatedBy()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             result.setAddUserAgencyId(dto.getAddUserAgencyId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             currentOrgList.add(result); |  |  |             currentOrgList.add(result); | 
			
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |         if (CollectionUtils.isNotEmpty(currentOrgList)) { |  |  |         if (CollectionUtils.isNotEmpty(currentOrgList)) { | 
			
		
	
	
		
		
			
				
					|  | @ -247,24 +230,16 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao | 
			
		
	
		
		
			
				
					|  |  |                 //优先展示自己的,所以要排除掉自己的,自上向下查,优先展示上层领导们给我建立的专题
 |  |  |                 //优先展示自己的,所以要排除掉自己的,自上向下查,优先展示上层领导们给我建立的专题
 | 
			
		
	
		
		
			
				
					|  |  |                 List<SpecialSubjectDTO> list = baseDao.queryExistedList(pid, notList); |  |  |                 List<SpecialSubjectDTO> list = baseDao.queryExistedList(pid, notList); | 
			
		
	
		
		
			
				
					|  |  |                 list.forEach(dto -> { |  |  |                 list.forEach(dto -> { | 
			
		
	
		
		
			
				
					
					|  |  |                     WorkSpecialSubjectResultDTO result = new WorkSpecialSubjectResultDTO(); |  |  |                     WorkSpecialSubjectResultDTO result = ConvertUtils.sourceToTarget(dto,WorkSpecialSubjectResultDTO.class); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     result.setSpecialSubjectId(dto.getId()); |  |  |                     result.setSpecialSubjectId(dto.getId()); | 
			
		
	
		
		
			
				
					|  |  |                     result.setTagId(dto.getTagId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     result.setTagName(dto.getTagName()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     //1、如果当前专题是给当前所在组织(or网格)添加的;
 |  |  |                     //1、如果当前专题是给当前所在组织(or网格)添加的;
 | 
			
		
	
		
		
			
				
					|  |  |                     //2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
 |  |  |                     //2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
 | 
			
		
	
		
		
			
				
					
					|  |  |                     if (dto.getAddUserAgencyId().equals(staffResult.getData().getAgencyId()) |  |  |                     if (dto.getAddUserAgencyId().equals(staffResult.getData().getId()) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                             && dto.getAddOrgId().equals(formDTO.getOrgId())) { |  |  |                             && dto.getAddOrgId().equals(formDTO.getOrgId())) { | 
			
		
	
		
		
			
				
					|  |  |                         result.setCanDel(true); |  |  |                         result.setCanDel(true); | 
			
		
	
		
		
			
				
					|  |  |                     } else { |  |  |                     } else { | 
			
		
	
		
		
			
				
					|  |  |                         result.setCanDel(false); |  |  |                         result.setCanDel(false); | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |                     result.setAddOrgId(dto.getAddOrgId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     result.setOrgLevel(dto.getOrgLevel()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     result.setTagColor(dto.getTagColor()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     result.setCreatedTime(dto.getCreatedTime()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     result.setCreatedBy(dto.getCreatedBy()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     result.setAddUserAgencyId(dto.getAddUserAgencyId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     resultDTOList.add(result); |  |  |                     resultDTOList.add(result); | 
			
		
	
		
		
			
				
					|  |  |                 }); |  |  |                 }); | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
	
		
		
			
				
					|  | 
 |