|
|
|
@ -140,8 +140,12 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
throw new RenException("您输入的编码已存在"); |
|
|
|
} |
|
|
|
SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class); |
|
|
|
if (!entity.getAllAreaCode().isEmpty()) { |
|
|
|
String[] areaCodeArray = entity.getAllAreaCode().split(StrConstant.COMMA); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException("新增机构失败"); |
|
|
|
} |
|
|
|
String allAreaCode = entity.getAllAreaCode(); |
|
|
|
if (StringUtils.isNotBlank(allAreaCode)) { |
|
|
|
String[] areaCodeArray = allAreaCode.split(StrConstant.COMMA); |
|
|
|
entity.setParentAreaCode(areaCodeArray[areaCodeArray.length - 2]); |
|
|
|
} |
|
|
|
entity.setPids(getPidList(entity.getPid())); |
|
|
|
@ -163,13 +167,17 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
throw new RenException("您输入的编码已存在"); |
|
|
|
} |
|
|
|
SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException("修改机构失败"); |
|
|
|
} |
|
|
|
|
|
|
|
//上级部门不能为自身
|
|
|
|
if (entity.getId().equals(entity.getPid())) { |
|
|
|
throw new RenException(ErrorCode.SUPERIOR_DEPT_ERROR); |
|
|
|
} |
|
|
|
if (!entity.getAllAreaCode().isEmpty()) { |
|
|
|
String[] areaCodeArray = entity.getAllAreaCode().split(StrConstant.COMMA); |
|
|
|
String allAreaCode = entity.getAllAreaCode(); |
|
|
|
if (StringUtils.isNotBlank(allAreaCode)) { |
|
|
|
String[] areaCodeArray = allAreaCode.split(StrConstant.COMMA); |
|
|
|
entity.setParentAreaCode(areaCodeArray[areaCodeArray.length - 2]); |
|
|
|
} |
|
|
|
entity.setPids(getPidList(entity.getPid())); |
|
|
|
@ -397,11 +405,11 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
for (String id : pids) { |
|
|
|
SysDeptEntity deptEntity = baseDao.getById(Long.valueOf(id)); |
|
|
|
parentNames += deptEntity.getName() + "-"; |
|
|
|
if (("street_party").equals(deptEntity.getTypeKey())) { |
|
|
|
if (OrganizationTypeConstant.ORG_TYPE_STREET_PARTY.equals(deptEntity.getTypeKey())) { |
|
|
|
street = deptEntity.getName(); |
|
|
|
} else if (("community_party").equals(deptEntity.getTypeKey())) { |
|
|
|
} else if (OrganizationTypeConstant.ORG_TYPE_COMMUNITY_PARTY.equals(deptEntity.getTypeKey())) { |
|
|
|
community = deptEntity.getName(); |
|
|
|
} else if (("grid_party").equals(deptEntity.getTypeKey())) { |
|
|
|
} else if (OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(deptEntity.getTypeKey())) { |
|
|
|
grid = deptEntity.getName(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -920,12 +928,12 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
obj = redisUtils.get(deptKey); |
|
|
|
} |
|
|
|
//防止列表为空时 redis一直不更新
|
|
|
|
DeptCodeOption deptCodeOption = (DeptCodeOption)obj; |
|
|
|
if(deptCodeOption.getOptions().size()==0){ |
|
|
|
DeptCodeOption deptCodeOption = (DeptCodeOption) obj; |
|
|
|
if (deptCodeOption.getOptions().size() == 0) { |
|
|
|
this.packageKcDeptCodeOption(); |
|
|
|
obj = redisUtils.get(deptKey); |
|
|
|
} |
|
|
|
return new Result<DeptCodeOption>().ok((DeptCodeOption)obj); |
|
|
|
return new Result<DeptCodeOption>().ok((DeptCodeOption) obj); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -934,7 +942,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
|
deptCodeFormDTO.setRootAreaCode(EpmetConstant.DEPT_CODE_YS); |
|
|
|
deptCodeFormDTO.setRootAreaLevel(EpmetConstant.DEPT_CODE_LEVEL_YS); |
|
|
|
Result<DeptCodeOption> deptCodeResult = analysisFeignClient.getDeptCode(deptCodeFormDTO); |
|
|
|
if(deptCodeResult.getData()!=null){ |
|
|
|
if (deptCodeResult.getData() != null) { |
|
|
|
DeptCodeOption deptCodeOption = deptCodeResult.getData(); |
|
|
|
redisUtils.set(RedisKeys.getAllDeptCodeOptionKey(), deptCodeOption); |
|
|
|
} |
|
|
|
|