问题:历史补丁明细自动转储(2个月前的明细)BUG导致当前10月份产生了8月份的重复交易明细数据
之前的交易明细转储问题导致产生重复明细数据(PT165277、PT166551、PT166714、PT166858)
1、bug修复:安装银企平台PT167484或以上补丁修复该问题(当前最新PT168320)
补丁下载安装:https://vip.kingdee.com/article/107885147697168896?productLineId=8
2、数据修复:连接银企数据库,手动执行以下脚本
--1、备份相关数据
sql sever数据语法:
select * into T_EBG_DetailInfo_History_bk from T_EBG_DetailInfo_History;
select * into T_EBG_DetailInfo_bk from T_EBG_DetailInfo;
select * into T_EBG_DetailInfo_Record_bk from T_EBG_DetailInfo_Record;
oracle数据库语法:
create table T_EBG_DetailInfo_History_bk as select * from T_EBG_DetailInfo_History;
create table T_EBG_DetailInfo_bk as select * from T_EBG_DetailInfo;
create table T_EBG_DetailInfo_Record_bk as select * from T_EBG_DetailInfo_Record;
--2、将月份改成有重复明细的月份(例如下面的2022-08),其他不用改
-- 转储遗漏的,以及后期同步的新内容
insert into T_EBG_DetailInfo_History select t1.* from T_EBG_DetailInfo t1
left join (select id,balance,trans_time,acc_No,explanation from T_EBG_DetailInfo_History ) t2
on t1.balance = t2.balance
and t1.trans_time =t2.trans_Time
and t1.acc_No=t2.acc_No
and t1.explanation = t2.explanation
where t1.trans_time<'2022-08-31 23:59:59' and t1.trans_time>'2022-08-01 00:00:00'
and t2.id is NULL
--3、 更新record
UPDATE a
SET a.end_Date = c.trans_Time FROM T_EBG_DetailInfo_Record a
INNER JOIN (SELECT MAX(b.trans_Time)trans_Time,b.bank_Version_Id,b.bank_Login_Id,b.acc_No FROM T_EBG_DetailInfo_History b
WHERE b.trans_Time <= '2022-08-31 23:59:59'
AND b.trans_Time >= '2022-08-01 00:00:00'
group BY b.acc_no,b.bank_Version_Id,b.bank_Login_Id) c
ON a.bank_Version_Id=c.bank_Version_Id AND a.bank_Login_Id=c.bank_Login_Id AND a.acc_No=c.acc_No
WHERE a.acc_no IN (
SELECT acc_no FROM T_EBG_DetailInfo_History WHERE
trans_Time <= '2022-08-31 23:59:59'
and trans_Time >= '2022-08-01 00:00:00'
group BY acc_no
);
--4、删除后期同步的重复数据
delete from T_EBG_DetailInfo where trans_Time <= '2022-08-31 23:59:59' and trans_Time >= '2022-08-01 00:00:00';
推荐阅读