Commit 2242f3f3 authored by 韩桐桐's avatar 韩桐桐

fix(jg):使用登记统一监管部门的orgcode

parent 1c5217e1
...@@ -39,6 +39,8 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum; ...@@ -39,6 +39,8 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*; import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model; import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
...@@ -232,11 +234,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -232,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("_");
List<LinkedHashMap> tree = commonServiceImpl.getCreatTree(); String orgBranchName= data[1];
String orgCode = this.recursiveMatching(tree, data[0]); CompanyModel result = Privilege.companyClient.queryByCompanyName(orgBranchName).getResult();
idxBizJgSupervisionInfo.setOrgBranchCode(orgCode); idxBizJgSupervisionInfo.setOrgBranchCode(result.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(data[1]); idxBizJgSupervisionInfo.setOrgBranchName(result.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(data[0]); idxBizJgSupervisionInfo.setCompanyOrgBranchCode(result.getCompanyCode());
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);
} }
...@@ -267,30 +269,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -267,30 +269,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} }
/** /**
* 递归属地监管部门树匹配监管部门
*
* @param tree 监管树
* @param orgBranchCode 监管部门companyCode
* @return 监管部门orgCode
*/
public String recursiveMatching(List<LinkedHashMap> tree, String orgBranchCode) {
if (tree != null) {
for (LinkedHashMap map : tree) {
if (orgBranchCode.equals(map.get("companyCode"))) {
return (String) map.get("orgCode");
}
if (map.containsKey("children") && map.get("children") instanceof List) {
String result = recursiveMatching((List<LinkedHashMap>) map.get("children"), orgBranchCode);
if (!"".equals(result)) {
return result;
}
}
}
}
return "";
}
/**
* 获取类型为ZC的“已注册”的字典值 * 获取类型为ZC的“已注册”的字典值
* *
* @return code * @return code
...@@ -547,18 +525,18 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -547,18 +525,18 @@ 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 orgCode = this.recursiveMatching(tree, splitReceiveOrgCode[0]); String orgBranchName= splitReceiveOrgCode[1];
useRegistration.setReceiveOrgCode(orgCode); CompanyModel result = Privilege.companyClient.queryByCompanyName(orgBranchName).getResult();
useRegistration.setReceiveCompanyOrgCode(orgCode); useRegistration.setReceiveOrgCode(result.getOrgCode());
useRegistration.setReceiveCompanyCode(splitReceiveOrgCode[0]); useRegistration.setReceiveCompanyOrgCode(result.getOrgCode());
useRegistration.setReceiveOrgName(splitReceiveOrgCode[1]); useRegistration.setReceiveCompanyCode(result.getCompanyCode());
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