Commit b36e9019 authored by yangyang's avatar yangyang

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

- 在 TzBaseEnterpriseInfo 模型中添加 orgCode 字段 - 新增 TzBaseEnterpriseInfoMapper 接口中的 updateSubCompanyOrgCode 方法 - 在 ITzBaseEnterpriseInfoService 接口中添加 refreshCompanyInfo 方法 - 实现 TzBaseEnterpriseInfoServiceImpl 中的 refreshCompanyInfo 方法 - 在 PlatformUserTopicMessage 中调用 refreshCompanyInfo 方法处理公司信息更新
parent 72fd1c08
......@@ -62,8 +62,8 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
Map<String, Object> getProblemInfoBySourceId(@Param("sourceId")String sourceId);
@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}, '%')")
@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 sequence_nbr = #{sequenceNbr}")
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, @Param("sequenceNbr") Long sequenceNbr);
}
......@@ -1385,10 +1385,6 @@ public class TzBaseEnterpriseInfoServiceImpl
public void refreshCompanyInfo(JSONObject dataResult) {
try {
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());
if (result == null || result.getResult() == null) {
......@@ -1407,9 +1403,12 @@ public class TzBaseEnterpriseInfoServiceImpl
String oldOrgCode = tzBaseEnterpriseInfo.getOrgCode(); // 旧的org_code
String preOrgCode = companyBo.getOrgCode();// 新的org_code
String oldSuperviseOrgCode = tzBaseEnterpriseInfo.getSuperviseOrgCode();
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);
// 更新 tz_base_enterprise_info
tzBaseEnterpriseInfoMapper.updateSubCompanyOrgCode(parentModel.getCompanyName(), oldSuperviseOrgCode, preSuperviseOrgCode, oldOrgCode, preOrgCode);
tzBaseEnterpriseInfoMapper.updateSubCompanyOrgCode(parentModel.getCompanyName(), oldSuperviseOrgCode, preSuperviseOrgCode, oldOrgCode, preOrgCode, tzBaseEnterpriseInfo.getSequenceNbr());
}
}
} 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