|
@ -31,6 +31,10 @@ import com.elink.esua.epdc.commons.tools.utils.TreeUtils; |
|
|
import com.elink.esua.epdc.constant.RoleTypeKeyConstant; |
|
|
import com.elink.esua.epdc.constant.RoleTypeKeyConstant; |
|
|
import com.elink.esua.epdc.dao.SysDeptDao; |
|
|
import com.elink.esua.epdc.dao.SysDeptDao; |
|
|
import com.elink.esua.epdc.dto.*; |
|
|
import com.elink.esua.epdc.dto.*; |
|
|
|
|
|
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.epdc.DeptCodeOption; |
|
|
import com.elink.esua.epdc.dto.epdc.GridForLeaderRegisterDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.GridForLeaderRegisterDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.form.UserSysDeptAreaCodeFormDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.form.UserSysDeptAreaCodeFormDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.form.UserSysDeptInfoFormDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.form.UserSysDeptInfoFormDTO; |
|
@ -39,6 +43,7 @@ import com.elink.esua.epdc.dto.epdc.result.AreaCodeParentResultDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptAreaCodeResultDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptAreaCodeResultDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO; |
|
|
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO; |
|
|
import com.elink.esua.epdc.entity.SysDeptEntity; |
|
|
import com.elink.esua.epdc.entity.SysDeptEntity; |
|
|
|
|
|
import com.elink.esua.epdc.feign.AnalysisFeignClient; |
|
|
import com.elink.esua.epdc.feign.GroupFeignClient; |
|
|
import com.elink.esua.epdc.feign.GroupFeignClient; |
|
|
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO; |
|
|
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO; |
|
|
import com.elink.esua.epdc.rocketmq.producer.OrganizationModifyProducer; |
|
|
import com.elink.esua.epdc.rocketmq.producer.OrganizationModifyProducer; |
|
@ -85,6 +90,9 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
@Autowired |
|
|
@Autowired |
|
|
private EpmetUtils epmetUtils; |
|
|
private EpmetUtils epmetUtils; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AnalysisFeignClient analysisFeignClient; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<SysDeptDTO> list(Map<String, Object> params) { |
|
|
public List<SysDeptDTO> list(Map<String, Object> params) { |
|
|
//普通管理员,只能查询所属部门及子部门的数据
|
|
|
//普通管理员,只能查询所属部门及子部门的数据
|
|
@ -902,4 +910,62 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit |
|
|
} |
|
|
} |
|
|
return new Result<DeptOption>().ok((DeptOption) obj); |
|
|
return new Result<DeptOption>().ok((DeptOption) obj); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<DeptCodeOption> getDeptCodeTree() { |
|
|
|
|
|
String deptKey = RedisKeys.getAllDeptCodeOptionKey(); |
|
|
|
|
|
Object obj = redisUtils.get(deptKey); |
|
|
|
|
|
if (null == obj) { |
|
|
|
|
|
this.packageKcDeptCodeOption(); |
|
|
|
|
|
obj = redisUtils.get(deptKey); |
|
|
|
|
|
} |
|
|
|
|
|
//防止列表为空时 redis一直不更新
|
|
|
|
|
|
DeptCodeOption deptCodeOption = (DeptCodeOption)obj; |
|
|
|
|
|
if(deptCodeOption.getOptions().size()==0){ |
|
|
|
|
|
this.packageKcDeptCodeOption(); |
|
|
|
|
|
obj = redisUtils.get(deptKey); |
|
|
|
|
|
} |
|
|
|
|
|
return new Result<DeptCodeOption>().ok((DeptCodeOption)obj); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void packageKcDeptCodeOption() { |
|
|
|
|
|
DeptCodeFormDTO deptCodeFormDTO = new DeptCodeFormDTO(); |
|
|
|
|
|
deptCodeFormDTO.setRootAreaCode(EpmetConstant.DEPT_CODE_YS); |
|
|
|
|
|
deptCodeFormDTO.setRootAreaLevel(EpmetConstant.DEPT_CODE_LEVEL_YS); |
|
|
|
|
|
Result<DeptCodeOption> deptCodeResult = analysisFeignClient.getDeptCode(deptCodeFormDTO); |
|
|
|
|
|
if(deptCodeResult.getData()!=null){ |
|
|
|
|
|
DeptCodeOption deptCodeOption = deptCodeResult.getData(); |
|
|
|
|
|
redisUtils.set(RedisKeys.getAllDeptCodeOptionKey(), deptCodeOption); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<SysDeptDTO> addAreaCode(SysDeptDTO dto) { |
|
|
|
|
|
SysDeptEntity parentDeptInfo = baseDao.getById(dto.getPid()); |
|
|
|
|
|
if (null == parentDeptInfo) { |
|
|
|
|
|
return new Result<SysDeptDTO>().error("请选择上级部门"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isEmpty(parentDeptInfo.getAreaCode())) { |
|
|
|
|
|
return new Result<SysDeptDTO>().error("上级部门未绑定区域编码,请先绑定上级部门区域编码"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DeptAddAreaCodeFormDTO formDto = new DeptAddAreaCodeFormDTO(); |
|
|
|
|
|
formDto.setParentAreaCode(parentDeptInfo.getAreaCode()); |
|
|
|
|
|
formDto.setName(dto.getName()); |
|
|
|
|
|
if (null != dto.getId() && NumConstant.ZERO_L != dto.getId()) { |
|
|
|
|
|
SysDeptEntity deptInfo = baseDao.getById(dto.getId()); |
|
|
|
|
|
formDto.setCode(deptInfo.getAreaCode()); |
|
|
|
|
|
} |
|
|
|
|
|
Result<DeptAddAreaCodeResultDTO> data = analysisFeignClient.addAreaCode(formDto); |
|
|
|
|
|
if (!data.success()) { |
|
|
|
|
|
return new Result<SysDeptDTO>().error(data.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
dto.setAreaCode(data.getData().getCode()); |
|
|
|
|
|
|
|
|
|
|
|
// 更新缓存中的行政区划
|
|
|
|
|
|
this.packageKcDeptCodeOption(); |
|
|
|
|
|
|
|
|
|
|
|
return new Result<SysDeptDTO>().ok(dto); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|