Commit cbd47b6d authored by tianbo's avatar tianbo

refactor(amos-boot): 优化单位层级调整后的数据更新逻辑

- 更新了 HistoryDataDealServiceImpl 中的 handleCompanyHisOrgCode 方法,支持批量更新 - 优化了 TzBaseEnterpriseInfoMapper 中的数据更新逻辑,分为单位信息和统计信息分别处理 - 更新了 TzBaseEnterpriseInfoServiceImpl 中的 refreshCompanyOrgCode 方法,使用异步处理
parent 5cd34162
...@@ -18,4 +18,6 @@ public class TZSCommonConstant { ...@@ -18,4 +18,6 @@ public class TZSCommonConstant {
public static final String CITY = "CITY"; public static final String CITY = "CITY";
public static final String REGION = "REGION"; public static final String REGION = "REGION";
public static final String STREET = "STREET"; public static final String STREET = "STREET";
public static final String PLATFORM_FEIGN_RESULT_KEY_COMPANY = "compnay";
} }
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</if> </if>
<if test="type == 'supervision'"> <if test="type == 'supervision'">
AND tjcr.instance_id <![CDATA[<>]]> '' AND tjcr.instance_id <![CDATA[<>]]> ''
AND tjcr.receive_company_code = #{companyCode} AND tjcr.receive_org_code = #{companyCode}
</if> </if>
<if test="type == 'enterprise'"> <if test="type == 'enterprise'">
AND tjcr.use_unit_code = #{dto.useUnitCode} AND tjcr.use_unit_code = #{dto.useUnitCode}
......
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
AND (isn.receive_company_code = #{companyCode} or isn.transfer_to_user_ids like concat('%',#{userId},'%')) AND (isn.receive_company_code = #{companyCode} or isn.transfer_to_user_ids like concat('%',#{userId},'%'))
</if> </if>
<if test="type == 'company'"> <if test="type == 'company'">
AND (isn.install_unit_credit_code = #{param.useUnitCreditCode} or isn.transfer_to_user_ids like AND (isn.install_unit_credit_code = #{companyCode} or isn.transfer_to_user_ids like
concat('%',#{userId},'%')) concat('%',#{userId},'%'))
</if> </if>
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
......
...@@ -97,19 +97,19 @@ ...@@ -97,19 +97,19 @@
</foreach> </foreach>
</if> </if>
<if test="type == 'supervision'"> <if test="type == 'supervision'">
AND (tjtn.receive_company_code = #{orgCode} or tjtn.transfer_to_user_ids like AND (tjtn.receive_company_code = #{companyCode} or tjtn.transfer_to_user_ids like
concat('%',#{param.transferToUserIds},'%')) concat('%',#{param.transferToUserIds},'%'))
AND tjtn.instance_id <![CDATA[<>]]> '' AND tjtn.instance_id <![CDATA[<>]]> ''
</if> </if>
<if test="type == 'company'"> <if test="type == 'company'">
AND (tjtn.install_unit_credit_code = #{orgCode} or tjtn.transfer_to_user_ids like AND (tjtn.install_unit_credit_code = #{companyCode} or tjtn.transfer_to_user_ids like
concat('%',#{param.transferToUserIds},'%')) concat('%',#{param.transferToUserIds},'%'))
</if> </if>
<if test="type == 'testAdmin'"> <if test="type == 'testAdmin'">
((AND tjtn.receive_company_code = #{orgCode} ((AND tjtn.receive_company_code = #{companyCode}
AND tjtn.instance_id <![CDATA[<>]]> '') AND tjtn.instance_id <![CDATA[<>]]> '')
or or
AND tjtn.install_unit_credit_code = #{orgCode}) AND tjtn.install_unit_credit_code = #{companyCode})
</if> </if>
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
AND tjtn.instance_id <![CDATA[<>]]> '' AND tjtn.instance_id <![CDATA[<>]]> ''
......
...@@ -96,5 +96,7 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI ...@@ -96,5 +96,7 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
List<String> selectCompanyBySupervisionOrgCode(String oldOrgCode); List<String> selectCompanyBySupervisionOrgCode(String oldOrgCode);
void updateRedundantSupervisionOrgCode(String newOrgCode, String oldOrgCode); void updateRedundantSupervisionOrgCodeUnit(String newOrgCode, String oldOrgCode);
void updateRedundantSupervisionOrgCodeStatistics(String newOrgCode, String oldOrgCode);
} }
...@@ -263,50 +263,13 @@ ...@@ -263,50 +263,13 @@
where supervise_org_code LIKE CONCAT(#{oldOrgCode}, '%') where supervise_org_code LIKE CONCAT(#{oldOrgCode}, '%')
</select> </select>
<update id="updateRedundantSupervisionOrgCode"> <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})
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})
where org_code like concat(#{oldOrgCode}, '%'); where org_code like concat(#{oldOrgCode}, '%');
--三项制度因为会定时生成统计数据(刚好在层级调整后生成了统计数据,此时再单位层级树再调整会原有,根据该表的唯一约束会提示更新冲突),所以需要特殊处理(如果目标数据存在则不更新,并删除旧的统计数据)
WITH update_data AS (
SELECT
ctid,
REPLACE(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode}) AS new_code,
plan_type,
check_date
FROM tzs_three_systems
WHERE supervisory_unit_org_code LIKE concat(#{oldOrgCode}, '%')
),
conflicts AS (
SELECT u.ctid
FROM update_data u
JOIN tzs_three_systems t ON
t.supervisory_unit_org_code = u.new_code
AND t.plan_type = u.plan_type
AND t.check_date = u.check_date
),
updated AS (
UPDATE tzs_three_systems t
SET supervisory_unit_org_code = REPLACE(t.supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
FROM update_data u
WHERE t.ctid = u.ctid
AND t.ctid NOT IN (SELECT ctid FROM conflicts)
RETURNING t.ctid
)
DELETE FROM tzs_three_systems
WHERE supervisory_unit_org_code LIKE concat(#{oldOrgCode}, '%')
AND ctid NOT IN (SELECT ctid FROM updated);
update tzs_two_staffing
set supervisory_unit_orgcode = replace(supervisory_unit_orgcode, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_orgcode like concat(#{oldOrgCode}, '%');
update biz_jg_equipment_category_data
set org_branch_code = replace(org_branch_code, #{oldOrgCode}, #{newOrgCode})
where org_branch_code like concat(#{oldOrgCode}, '%');
update tzs_jg_vehicle_information update tzs_jg_vehicle_information
set org_branch_code = replace(org_branch_code, #{oldOrgCode}, #{newOrgCode}) set org_branch_code = replace(org_branch_code, #{oldOrgCode}, #{newOrgCode})
...@@ -382,22 +345,6 @@ ...@@ -382,22 +345,6 @@
set org_code = replace(org_code, #{oldOrgCode}, #{newOrgCode}) set org_code = replace(org_code, #{oldOrgCode}, #{newOrgCode})
where org_code like concat(#{oldOrgCode}, '%'); where org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_dispatch_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_maintenance_unit_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_rescue_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_use_unit_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_feedback_suggestions update tzs_feedback_suggestions
set supervise_org_code = replace(supervise_org_code, #{oldOrgCode}, #{newOrgCode}) set supervise_org_code = replace(supervise_org_code, #{oldOrgCode}, #{newOrgCode})
where supervise_org_code like concat(#{oldOrgCode}, '%'); where supervise_org_code like concat(#{oldOrgCode}, '%');
...@@ -409,4 +356,68 @@ ...@@ -409,4 +356,68 @@
set risk_disposal_unit_org_code = replace(risk_disposal_unit_org_code, #{oldOrgCode}, #{newOrgCode}) set risk_disposal_unit_org_code = replace(risk_disposal_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where risk_disposal_unit_org_code like concat(#{oldOrgCode}, '%'); where risk_disposal_unit_org_code like concat(#{oldOrgCode}, '%');
</update> </update>
<update id="updateRedundantSupervisionOrgCodeStatistics">
--三项制度因为会定时生成统计数据(刚好在层级调整后生成了统计数据,此时再单位层级树再调整会原有,根据该表的唯一约束会提示更新冲突),所以需要特殊处理(如果目标数据存在则不更新,并删除旧的统计数据)
WITH potential_updates AS (
SELECT
ctid,
supervisory_unit_org_code AS old_code,
REPLACE(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode}) AS new_code,
plan_type,
check_date
FROM tzs_three_systems
WHERE supervisory_unit_org_code LIKE concat (#{oldOrgCode}, '%' )
),
conflict_check AS (
SELECT
pu.*,
EXISTS (
SELECT 1 FROM tzs_three_systems t
WHERE t.supervisory_unit_org_code = pu.new_code
AND t.plan_type = pu.plan_type
AND t.check_date = pu.check_date
) AS has_conflict
FROM potential_updates pu
),
updated AS (
UPDATE tzs_three_systems t
SET supervisory_unit_org_code = cc.new_code
FROM conflict_check cc
WHERE t.ctid = cc.ctid
AND NOT cc.has_conflict
RETURNING t.ctid, cc.old_code
)
DELETE FROM tzs_three_systems t
WHERE EXISTS (
SELECT 1 FROM conflict_check cc
WHERE cc.ctid = t.ctid
AND cc.has_conflict
AND t.supervisory_unit_org_code = cc.old_code
);
update tzs_two_staffing
set supervisory_unit_orgcode = replace(supervisory_unit_orgcode, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_orgcode like concat(#{oldOrgCode}, '%');
update biz_jg_equipment_category_data
set org_branch_code = replace(org_branch_code, #{oldOrgCode}, #{newOrgCode})
where org_branch_code like concat(#{oldOrgCode}, '%');
update tzs_alert_dispatch_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_maintenance_unit_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_rescue_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
update tzs_alert_use_unit_statistics
set supervisory_unit_org_code = replace(supervisory_unit_org_code, #{oldOrgCode}, #{newOrgCode})
where supervisory_unit_org_code like concat(#{oldOrgCode}, '%');
</update>
</mapper> </mapper>
...@@ -3,15 +3,15 @@ package com.yeejoin.amos.boot.module.tcm.biz.controller; ...@@ -3,15 +3,15 @@ package com.yeejoin.amos.boot.module.tcm.biz.controller;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.HistoryDataDealServiceImpl; import com.yeejoin.amos.boot.module.tcm.biz.service.impl.HistoryDataDealServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/** /**
* @author Administrator * @author Administrator
*/ */
...@@ -47,11 +47,12 @@ public class HistoryDataDealController { ...@@ -47,11 +47,12 @@ public class HistoryDataDealController {
return ResponseHelper.buildResponse(historyDataDealService.unitOrgCodeUpdate(oldOrgCode, newOrgCode)); return ResponseHelper.buildResponse(historyDataDealService.unitOrgCodeUpdate(oldOrgCode, newOrgCode));
} }
@Deprecated
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/handleCompanyHisOrgCode") @PostMapping(value = "/handleCompanyHisOrgCode")
@ApiOperation(httpMethod = "PUT", value = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode", notes = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode") @ApiOperation(httpMethod = "PUT", value = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode,不更新平台表", notes = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode,不更新平台表")
public ResponseModel<String> handleCompanyHisOrgCode(@RequestParam String newOrgCode, @RequestParam String oldOrgCode) { public ResponseModel<String> handleCompanyHisOrgCode(@RequestBody List<Map<String, Object>> orgCodeMap) {
return ResponseHelper.buildResponse(historyDataDealService.handleCompanyHisOrgCode(newOrgCode, oldOrgCode)); return ResponseHelper.buildResponse(historyDataDealService.handleCompanyHisOrgCode(orgCodeMap));
} }
} }
...@@ -14,7 +14,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -14,7 +14,6 @@ import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener; import org.typroject.tyboot.component.emq.EmqxListener;
...@@ -79,7 +78,6 @@ public class PlatformUserTopicMessage extends EmqxListener { ...@@ -79,7 +78,6 @@ public class PlatformUserTopicMessage extends EmqxListener {
log.info("平台推送消息同步完成"); log.info("平台推送消息同步完成");
} }
@Async
protected void processOrgCodeUpdateMessage(MqttMessage message) { protected void processOrgCodeUpdateMessage(MqttMessage message) {
try { try {
if (ValidationUtil.isEmpty(message)) { if (ValidationUtil.isEmpty(message)) {
...@@ -95,7 +93,6 @@ public class PlatformUserTopicMessage extends EmqxListener { ...@@ -95,7 +93,6 @@ public class PlatformUserTopicMessage extends EmqxListener {
} }
} }
@Async
protected void processOpMessage(MqttMessage message) { protected void processOpMessage(MqttMessage message) {
try { try {
if (ValidationUtil.isEmpty(message)) { if (ValidationUtil.isEmpty(message)) {
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission; import com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo; import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo; import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
...@@ -14,11 +15,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -14,11 +15,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/** /**
* @author Administrator * @author Administrator
...@@ -135,8 +134,23 @@ public class HistoryDataDealServiceImpl { ...@@ -135,8 +134,23 @@ public class HistoryDataDealServiceImpl {
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String handleCompanyHisOrgCode(String newOrgCode, String oldOrgCode) { public String handleCompanyHisOrgCode(List<Map<String, Object>> orgCodeMap) {
baseEnterpriseInfoService.refreshCompanyOrgCode(null, newOrgCode, oldOrgCode); log.info("用企业新orgCode替换各个表缓存orgCode开始");
if (ValidationUtil.isEmpty(orgCodeMap)) {
return "error";
}
orgCodeMap.forEach(map -> {
String newOrgCode = map.get("newOrgCode").toString();
String oldOrgCode = map.get("oldOrgCode").toString();
//1. 处理平台旧orgCode本身错误数据
@SuppressWarnings("unchecked")
HashMap<String, Object> platformCompanyInfo = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(oldOrgCode).getResult();
CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(platformCompanyInfo.get(TZSCommonConstant.PLATFORM_FEIGN_RESULT_KEY_COMPANY)), CompanyModel.class);
parentModel.setOrgCode(newOrgCode);
Privilege.companyClient.update(parentModel, parentModel.getSequenceNbr());
//2. 处理业务表旧orgCode错误数据
baseEnterpriseInfoService.refreshCompanyOrgCode(null, newOrgCode, oldOrgCode);
});
return "success"; return "success";
} }
} }
...@@ -53,6 +53,7 @@ import org.springframework.beans.BeanUtils; ...@@ -53,6 +53,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -1393,6 +1394,7 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1393,6 +1394,7 @@ public class TzBaseEnterpriseInfoServiceImpl
* @date 2025/7/3 14:03 * @date 2025/7/3 14:03
*/ */
@Override @Override
@Async
public void refreshCompanyInfo(JSONObject dataResult, String method) { public void refreshCompanyInfo(JSONObject dataResult, String method) {
try { try {
CompanyBo companyBo = JSON.parseObject(dataResult.toJSONString(), CompanyBo.class); CompanyBo companyBo = JSON.parseObject(dataResult.toJSONString(), CompanyBo.class);
...@@ -1443,6 +1445,7 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1443,6 +1445,7 @@ public class TzBaseEnterpriseInfoServiceImpl
*/ */
@Override @Override
@Transactional @Transactional
@Async
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)) {
...@@ -1450,8 +1453,10 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1450,8 +1453,10 @@ public class TzBaseEnterpriseInfoServiceImpl
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. 更新其他业务表冗余的监管单位orgCode // 3. 3.1 更新单位及业务表的监管单位orgCode
tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCode(newOrgCode, oldOrgCode); tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeUnit(newOrgCode, oldOrgCode);
// 3.2 更新业务表统计表冗余的监管单位orgCode
tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeStatistics(newOrgCode, oldOrgCode);
// 4. 发送数据刷新事件 - 内存分页处理 // 4. 发送数据刷新事件 - 内存分页处理
// 处理企业数据 // 处理企业数据
publishDataRefreshEvents(companySeqList, DataRefreshEvent.DataType.enterprise, 1000); publishDataRefreshEvents(companySeqList, DataRefreshEvent.DataType.enterprise, 1000);
......
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