Commit bb892466 authored by tianbo's avatar tianbo

refactor(tcm): 优化企业信息更新接口

- 修改 TzBaseEnterpriseInfoMapper 接口,增加新参数 newOrgName - 更新 SQL 语句,添加 supervise_org_name 和 governing_body 字段的更新
parent 6763ef31
...@@ -96,7 +96,7 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI ...@@ -96,7 +96,7 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
List<String> selectCompanyBySupervisionOrgCode(String oldOrgCode); List<String> selectCompanyBySupervisionOrgCode(String oldOrgCode);
void updateRedundantSupervisionOrgCodeUnit(String newOrgCode, String oldOrgCode); void updateRedundantSupervisionOrgCodeUnit(String newOrgName, String newOrgCode, String oldOrgCode);
void updateRedundantSupervisionOrgCodeStatistics(String newOrgCode, String oldOrgCode); void updateRedundantSupervisionOrgCodeStatistics(String newOrgCode, String oldOrgCode);
} }
...@@ -191,7 +191,8 @@ ...@@ -191,7 +191,8 @@
update tz_base_enterprise_info update tz_base_enterprise_info
set SUPERVISE_ORG_NAME = #{superviseOrgName}, set SUPERVISE_ORG_NAME = #{superviseOrgName},
SUPERVISE_ORG_CODE = REPLACE(SUPERVISE_ORG_CODE, #{oldSuperviseOrgCode}, #{preSuperviseOrgCode}), SUPERVISE_ORG_CODE = REPLACE(SUPERVISE_ORG_CODE, #{oldSuperviseOrgCode}, #{preSuperviseOrgCode}),
ORG_CODE = IFNULL(REPLACE(ORG_CODE, #{oldOrgCode}, #{preOrgCode}), #{preOrgCode}) -- 兼容旧数据,如果为空则使用新值 ORG_CODE = IFNULL(REPLACE(ORG_CODE, #{oldOrgCode}, #{preOrgCode}), #{preOrgCode}), -- 兼容旧数据,如果为空则使用新值
governing_body = #{superviseOrgName}
where sequence_nbr = #{sequenceNbr} where sequence_nbr = #{sequenceNbr}
</update> </update>
...@@ -265,7 +266,7 @@ ...@@ -265,7 +266,7 @@
<update id="updateRedundantSupervisionOrgCodeUnit"> <update id="updateRedundantSupervisionOrgCodeUnit">
update tz_base_enterprise_info update tz_base_enterprise_info
set supervise_org_code = replace(supervise_org_code, #{oldOrgCode}, #{newOrgCode}) set supervise_org_code = replace(supervise_org_code, #{oldOrgCode}, #{newOrgCode}), supervise_org_name = #{newOrgName}, governing_body = #{newOrgName}
where supervise_org_code like concat(#{oldOrgCode}, '%'); where supervise_org_code like concat(#{oldOrgCode}, '%');
update tz_base_enterprise_info update tz_base_enterprise_info
set org_code = replace(org_code, #{oldOrgCode}, #{newOrgCode}) set org_code = replace(org_code, #{oldOrgCode}, #{newOrgCode})
......
...@@ -1449,12 +1449,13 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1449,12 +1449,13 @@ public class TzBaseEnterpriseInfoServiceImpl
public void refreshCompanyOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode) { public void refreshCompanyOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode) {
try { try {
if (!ValidationUtil.isEmpty(newOrgCode) && !ValidationUtil.isEmpty(oldOrgCode) && !newOrgCode.equals(oldOrgCode)) { if (!ValidationUtil.isEmpty(newOrgCode) && !ValidationUtil.isEmpty(oldOrgCode) && !newOrgCode.equals(oldOrgCode)) {
JSONObject newModel = (JSONObject) dataResult.get("newModel");
// 1. 查询旧属地监管部门orgCode对应所有的公司 // 1. 查询旧属地监管部门orgCode对应所有的公司
List<String> companySeqList = tzBaseEnterpriseInfoMapper.selectCompanyBySupervisionOrgCode(oldOrgCode); List<String> companySeqList = tzBaseEnterpriseInfoMapper.selectCompanyBySupervisionOrgCode(oldOrgCode);
// 2. 查询旧属地监管部门orgCode对应的所有设备 // 2. 查询旧属地监管部门orgCode对应的所有设备
List<String> equipmentRecordList = tzBaseEnterpriseInfoMapper.selectEquipmentBySupervisionOrgCode(oldOrgCode); List<String> equipmentRecordList = tzBaseEnterpriseInfoMapper.selectEquipmentBySupervisionOrgCode(oldOrgCode);
// 3. 3.1 更新单位及业务表的监管单位orgCode // 3. 3.1 更新单位及业务表的监管单位orgCode
tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeUnit(newOrgCode, oldOrgCode); tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeUnit(newModel.getString("companyName"), newOrgCode, oldOrgCode);
// 3.2 更新业务表统计表冗余的监管单位orgCode // 3.2 更新业务表统计表冗余的监管单位orgCode
tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeStatistics(newOrgCode, oldOrgCode); tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeStatistics(newOrgCode, oldOrgCode);
// 4. 发送数据刷新事件 - 内存分页处理 // 4. 发送数据刷新事件 - 内存分页处理
......
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