|
|
@ -145,6 +145,8 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao |
|
|
|
QuerySpecialSubFormDTO querySpecialSubFormDTO=new QuerySpecialSubFormDTO(); |
|
|
|
querySpecialSubFormDTO.setOrgId(formDTO.getOrgId()); |
|
|
|
querySpecialSubFormDTO.setPids(formDTO.getPids()); |
|
|
|
querySpecialSubFormDTO.setUserId(formDTO.getAddUserId()); |
|
|
|
querySpecialSubFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
List<WorkSpecialSubjectResultDTO> havedList=this.queryExistedList(querySpecialSubFormDTO); |
|
|
|
List<String> haveTagIds=havedList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList()); |
|
|
|
haveTagIds.forEach(tagId->{ |
|
|
@ -156,6 +158,7 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao |
|
|
|
SpecialSubjectEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, SpecialSubjectEntity.class); |
|
|
|
StaffInfoFromDTO staffInfoFromDTO = new StaffInfoFromDTO(); |
|
|
|
staffInfoFromDTO.setStaffId(formDTO.getAddUserId()); |
|
|
|
staffInfoFromDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
Result<MineResultDTO> result = govOrgOpenFeignClient.queryStaffProfile(staffInfoFromDTO); |
|
|
|
if(result.success()&&null!=result.getData()){ |
|
|
|
insertEntity.setAddUserAgencyId(result.getData().getAgencyId()); |
|
|
@ -180,6 +183,7 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao |
|
|
|
SpecialSubjectEntity original = baseDao.selectById(formDTO.getSpecialSubjectId()); |
|
|
|
if (null != original) { |
|
|
|
if (!original.getAddOrgId().equals(formDTO.getOrgId())) { |
|
|
|
log.warn("当前专题id=" + original.getId() + ";是属于orgId=" + original.getAddOrgId() + ";当前用户正处在orgId=" + formDTO.getOrgId()+";所以无权删除"); |
|
|
|
throw new RenException(EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getCode(), EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getMsg()); |
|
|
|
} |
|
|
|
baseDao.delSpecialSubject(formDTO.getSpecialSubjectId(), formDTO.getUserId()); |
|
|
@ -197,6 +201,13 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO) { |
|
|
|
StaffInfoFromDTO staffInfoFromDTO = new StaffInfoFromDTO(); |
|
|
|
staffInfoFromDTO.setStaffId(formDTO.getUserId()); |
|
|
|
staffInfoFromDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
Result<MineResultDTO> staffResult = govOrgOpenFeignClient.queryStaffProfile(staffInfoFromDTO); |
|
|
|
if (!staffResult.success() && null == staffResult.getData()) { |
|
|
|
throw new RenException("查询当前工作人员信息异常"); |
|
|
|
} |
|
|
|
List<WorkSpecialSubjectResultDTO> resultDTOList = new ArrayList<>(); |
|
|
|
List<String> notList = new ArrayList<>(); |
|
|
|
//当前组织或者网格自己建立的
|
|
|
@ -207,11 +218,20 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao |
|
|
|
result.setSpecialSubjectId(dto.getId()); |
|
|
|
result.setTagId(dto.getTagId()); |
|
|
|
result.setTagName(dto.getTagName()); |
|
|
|
result.setCanDel(true); |
|
|
|
//1、如果当前专题是给当前所在组织(or网格)添加的;
|
|
|
|
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
|
|
|
|
if(dto.getAddUserAgencyId().equals(staffResult.getData().getAgencyId()) |
|
|
|
&& dto.getAddOrgId().equals(formDTO.getOrgId())){ |
|
|
|
result.setCanDel(true); |
|
|
|
}else{ |
|
|
|
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); |
|
|
|
}); |
|
|
|
if (CollectionUtils.isNotEmpty(currentOrgList)) { |
|
|
@ -231,11 +251,20 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao |
|
|
|
result.setSpecialSubjectId(dto.getId()); |
|
|
|
result.setTagId(dto.getTagId()); |
|
|
|
result.setTagName(dto.getTagName()); |
|
|
|
result.setCanDel(false); |
|
|
|
//1、如果当前专题是给当前所在组织(or网格)添加的;
|
|
|
|
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
|
|
|
|
if (dto.getAddUserAgencyId().equals(staffResult.getData().getAgencyId()) |
|
|
|
&& dto.getAddOrgId().equals(formDTO.getOrgId())) { |
|
|
|
result.setCanDel(true); |
|
|
|
} else { |
|
|
|
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); |
|
|
|
}); |
|
|
|
} |
|
|
|