Commit c40d44e9 authored by 韩桐桐's avatar 韩桐桐

fix(jg):安装告知和使用登记的监管部门,接收机构

parent f89662f2
...@@ -1709,6 +1709,29 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1709,6 +1709,29 @@ public class CommonServiceImpl implements ICommonService {
} }
return result; return result;
} }
/**
* 递归属地监管部门树匹配监管部门
*
* @param tree 监管树
* @param orgBranchCode 监管部门orgCode
* @return 监管部门信息
*/
public LinkedHashMap recursiveMatching(List<LinkedHashMap> tree, String orgBranchCode) {
if (tree != null) {
for (LinkedHashMap map : tree) {
if (orgBranchCode.equals(map.get("orgCode"))) {
return map;
}
if (map.containsKey("children") && map.get("children") instanceof List) {
LinkedHashMap result = recursiveMatching((List<LinkedHashMap>) map.get("children"), orgBranchCode);
if (!"".equals(result)) {
return result;
}
}
}
}
return null;
}
/** /**
* 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject * 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
......
...@@ -146,6 +146,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -146,6 +146,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private CommonServiceImpl commonService; private CommonServiceImpl commonService;
@Autowired @Autowired
private RedissonClient redissonClient; private RedissonClient redissonClient;
@Autowired
CommonServiceImpl commonServiceImpl;
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
...@@ -904,16 +906,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -904,16 +906,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} }
tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString()); tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo); tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
List<LinkedHashMap> tree = commonServiceImpl.getCreatTree();
// 更新设备监管部门信息 // 更新设备监管部门信息
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda() LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda()
.eq(IdxBizJgSupervisionInfo::getRecord, jgRelationEquip.getEquId()); .eq(IdxBizJgSupervisionInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(eq); IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(eq);
if (!ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchCode()) && !ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchName())) { if (!ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchCode()) && !ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchName())) {
CompanyModel result = Privilege.companyClient.queryByCompanyName(jgInstallationNotice.getOrgBranchName()).getResult(); // CompanyModel result = Privilege.companyClient.queryByCompanyName(jgInstallationNotice.getOrgBranchName()).getResult();
idxBizJgSupervisionInfo.setOrgBranchCode(result.getOrgCode()); LinkedHashMap linkedHashMap = commonServiceImpl.recursiveMatching(tree, jgInstallationNotice.getOrgBranchCode());
idxBizJgSupervisionInfo.setOrgBranchName(result.getCompanyName()); idxBizJgSupervisionInfo.setOrgBranchCode((String) linkedHashMap.get("orgCode"));
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(result.getCompanyCode()); idxBizJgSupervisionInfo.setOrgBranchName((String) linkedHashMap.get("companyName"));
idxBizJgSupervisionInfo.setCompanyOrgBranchCode((String) linkedHashMap.get("companyCode"));
idxBizJgSupervisionInfoMapper.updateById(idxBizJgSupervisionInfo); idxBizJgSupervisionInfoMapper.updateById(idxBizJgSupervisionInfo);
} }
......
...@@ -234,11 +234,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -234,11 +234,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = new IdxBizJgSupervisionInfo(); IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = new IdxBizJgSupervisionInfo();
if (map.containsKey("orgBranchCode") && !ObjectUtils.isEmpty(map.get("orgBranchCode"))) { if (map.containsKey("orgBranchCode") && !ObjectUtils.isEmpty(map.get("orgBranchCode"))) {
String[] data = String.valueOf(map.getString("orgBranchCode")).split("_"); String[] data = String.valueOf(map.getString("orgBranchCode")).split("_");
String orgBranchName= data[1]; List<LinkedHashMap> tree = commonServiceImpl.getCreatTree();
CompanyModel result = Privilege.companyClient.queryByCompanyName(orgBranchName).getResult(); LinkedHashMap linkedHashMap = commonServiceImpl.recursiveMatching(tree, data[0]);
idxBizJgSupervisionInfo.setOrgBranchCode(result.getOrgCode()); idxBizJgSupervisionInfo.setOrgBranchCode(data[0]);
idxBizJgSupervisionInfo.setOrgBranchName(result.getCompanyName()); idxBizJgSupervisionInfo.setOrgBranchName(data[1]);
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(result.getCompanyCode()); idxBizJgSupervisionInfo.setCompanyOrgBranchCode((String) linkedHashMap.get("companyCode"));
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda().eq(IdxBizJgSupervisionInfo::getRecord, map.get("equipId")); LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda().eq(IdxBizJgSupervisionInfo::getRecord, map.get("equipId"));
idxBizJgSupervisionInfoMapper.update(idxBizJgSupervisionInfo, eq); idxBizJgSupervisionInfoMapper.update(idxBizJgSupervisionInfo, eq);
} }
...@@ -525,18 +525,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -525,18 +525,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 使用单位信息 // 使用单位信息
useRegistration.setUseUnitName(company.getCompanyName()); useRegistration.setUseUnitName(company.getCompanyName());
useRegistration.setUseUnitCreditCode(company.getCompanyCode()); useRegistration.setUseUnitCreditCode(company.getCompanyCode());
List<LinkedHashMap> tree = commonService.getCreatTree();
// 接收单位信息 // 接收单位信息
Optional.ofNullable(useRegistration.getReceiveOrgCode()) Optional.ofNullable(useRegistration.getReceiveOrgCode())
.filter(code -> code.contains("_")) .filter(code -> code.contains("_"))
.map(code -> code.split("_")) .map(code -> code.split("_"))
.ifPresent(splitReceiveOrgCode -> { .ifPresent(splitReceiveOrgCode -> {
String orgBranchName= splitReceiveOrgCode[1]; LinkedHashMap linkedHashMap = commonServiceImpl.recursiveMatching(tree, splitReceiveOrgCode[0]);
CompanyModel result = Privilege.companyClient.queryByCompanyName(orgBranchName).getResult(); useRegistration.setReceiveOrgCode(splitReceiveOrgCode[0]);
useRegistration.setReceiveOrgCode(result.getOrgCode()); useRegistration.setReceiveCompanyOrgCode(splitReceiveOrgCode[0]);
useRegistration.setReceiveCompanyOrgCode(result.getOrgCode()); useRegistration.setReceiveCompanyCode((String) linkedHashMap.get("companyCode"));
useRegistration.setReceiveCompanyCode(result.getCompanyCode()); useRegistration.setReceiveOrgName(splitReceiveOrgCode[1]);
useRegistration.setReceiveOrgName(result.getCompanyName());
}); });
// 安全管理员 // 安全管理员
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment