Commit 72fd1c08 authored by yangyang's avatar yangyang

feat(tcm): 实现平台编辑单位信息后的数据同步

- 在 TzBaseEnterpriseInfo 模型中添加 orgCode 字段 - 新增 TzBaseEnterpriseInfoMapper 接口中的 updateSubCompanyOrgCode 方法 - 在 ITzBaseEnterpriseInfoService 接口中添加 refreshCompanyInfo 方法 - 实现 TzBaseEnterpriseInfoServiceImpl 中的 refreshCompanyInfo 方法 - 在 PlatformUserTopicMessage 中调用 refreshCompanyInfo 方法处理公司信息更新
parent e0f4ab54
...@@ -62,8 +62,8 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI ...@@ -62,8 +62,8 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
Map<String, Object> getProblemInfoBySourceId(@Param("sourceId")String sourceId); Map<String, Object> getProblemInfoBySourceId(@Param("sourceId")String sourceId);
@Update ("update tz_base_enterprise_info set SUPERVISE_ORG_CODE = REPLACE(SUPERVISE_ORG_CODE, #{oldSuperviseOrgCode}, #{preSuperviseOrgCode}), ORG_CODE = REPLACE(ORG_CODE, #{oldOrgCode}, #{preOrgCode}) where ORG_CODE LIKE concat(#{oldOrgCode}, '%')") @Update ("update tz_base_enterprise_info set SUPERVISE_ORG_NAME = #{superviseOrgName},SUPERVISE_ORG_CODE = REPLACE(SUPERVISE_ORG_CODE, #{oldSuperviseOrgCode}, #{preSuperviseOrgCode}), ORG_CODE = REPLACE(ORG_CODE, #{oldOrgCode}, #{preOrgCode}) where ORG_CODE LIKE concat(#{oldOrgCode}, '%')")
void updateSubCompanyOrgCode(@Param("oldSuperviseOrgCode") String oldSuperviseOrgCode, @Param("preSuperviseOrgCode") String preSuperviseOrgCode, void updateSubCompanyOrgCode(@Param("superviseOrgName") String superviseOrgName, @Param("oldSuperviseOrgCode") String oldSuperviseOrgCode, @Param("preSuperviseOrgCode") String preSuperviseOrgCode,
@Param("oldOrgCode") String oldOrgCode, @Param("preOrgCode") String preOrgCode); @Param("oldOrgCode") String oldOrgCode, @Param("preOrgCode") String preOrgCode);
} }
...@@ -1385,6 +1385,10 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1385,6 +1385,10 @@ public class TzBaseEnterpriseInfoServiceImpl
public void refreshCompanyInfo(JSONObject dataResult) { public void refreshCompanyInfo(JSONObject dataResult) {
try { try {
CompanyBo companyBo = JSON.parseObject(dataResult.toJSONString(), CompanyBo.class); CompanyBo companyBo = JSON.parseObject(dataResult.toJSONString(), CompanyBo.class);
String preSuperviseOrgCode = companyBo.getOrgCode().replace("*" + companyBo.getCompanyOrgCode(), "");
HashMap<String, Object> parentMessage = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(preSuperviseOrgCode).getResult();
// 目前平台返回key为compnay(存在拼写错误)
CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(parentMessage.get("compnay")), CompanyModel.class);
// 调用平台获取子单位 // 调用平台获取子单位
FeignClientResult<List<CompanyModel>> result = Privilege.companyClient.queryListByOrgCode(companyBo.getOrgCode()); FeignClientResult<List<CompanyModel>> result = Privilege.companyClient.queryListByOrgCode(companyBo.getOrgCode());
if (result == null || result.getResult() == null) { if (result == null || result.getResult() == null) {
...@@ -1403,9 +1407,9 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1403,9 +1407,9 @@ public class TzBaseEnterpriseInfoServiceImpl
String oldOrgCode = tzBaseEnterpriseInfo.getOrgCode(); // 旧的org_code String oldOrgCode = tzBaseEnterpriseInfo.getOrgCode(); // 旧的org_code
String preOrgCode = companyBo.getOrgCode();// 新的org_code String preOrgCode = companyBo.getOrgCode();// 新的org_code
String oldSuperviseOrgCode = tzBaseEnterpriseInfo.getSuperviseOrgCode(); String oldSuperviseOrgCode = tzBaseEnterpriseInfo.getSuperviseOrgCode();
String preSuperviseOrgCode = companyBo.getOrgCode().replace("*" + companyBo.getCompanyOrgCode(), "");
// 更新 tz_base_enterprise_info // 更新 tz_base_enterprise_info
tzBaseEnterpriseInfoMapper.updateSubCompanyOrgCode(oldSuperviseOrgCode, preSuperviseOrgCode, oldOrgCode, preOrgCode); tzBaseEnterpriseInfoMapper.updateSubCompanyOrgCode(parentModel.getCompanyName(), oldSuperviseOrgCode, preSuperviseOrgCode, oldOrgCode, preOrgCode);
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
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