移除UUID阴影同步中的应付相关表与同步逻辑

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuweihua
2026-11-15 00:15:58 +08:00
parent 358e5a46b9
commit 4de755ca60
6 changed files with 8 additions and 244 deletions
@@ -10,7 +10,6 @@ public class UuidToNewIdHolder
private String oldId;
private Long newId;
private Long newIncomeId;
private Long newPayId;
private String orderNo;
private String status;
private String failReason;
@@ -31,8 +30,6 @@ public class UuidToNewIdHolder
public void setNewId(Long newId) { this.newId = newId; }
public Long getNewIncomeId() { return newIncomeId; }
public void setNewIncomeId(Long newIncomeId) { this.newIncomeId = newIncomeId; }
public Long getNewPayId() { return newPayId; }
public void setNewPayId(Long newPayId) { this.newPayId = newPayId; }
public String getOrderNo() { return orderNo; }
public void setOrderNo(String orderNo) { this.orderNo = orderNo; }
public String getStatus() { return status; }
@@ -39,27 +39,12 @@ public interface UuidToNewSyncMapper
int insertIncomeFeeNew(UuidToNewIdHolder holder);
List<String> selectPayIds(@Param("oldBillId") String oldBillId);
int insertPayBillNew(UuidToNewIdHolder holder);
List<UuidToNewFeeRow> selectPayFees(@Param("oldBillId") String oldBillId);
int insertPayFeeNew(UuidToNewIdHolder holder);
int updatePayFeeIdEqualsId(@Param("id") Long id);
int insertArDetailNew(@Param("oldBillId") String oldBillId, @Param("newBillId") Long newBillId);
List<UuidToNewFeeRow> selectArDetailFees(@Param("oldBillId") String oldBillId);
int insertArDetailFeeNew(@Param("detailFeeId") Long detailFeeId, @Param("newFeeId") Long newFeeId);
List<UuidToNewFeeRow> selectPayBillLines(@Param("oldBillId") String oldBillId);
int insertPayBillLineNew(@Param("lineId") Long lineId, @Param("newBillId") Long newBillId,
@Param("newFeeId") Long newFeeId);
int insertBillingTaskNew(@Param("oldBillId") String oldBillId, @Param("newBillId") Long newBillId);
int insertJobLogStart(UuidToNewIdHolder holder);
@@ -27,7 +27,7 @@ import com.bms.price.migration.mapper.UuidToNewSyncMapper;
import com.bms.price.migration.service.IUuidToNewSyncService;
/**
* UUID -> bigint 阴影同步:占坑独立提交;业务拷贝一单一事务;批内可多线程
* UUID -> bigint 阴影同步:占坑独立提交;一单一事务;批内可多线程。
*/
@Service
public class UuidToNewSyncServiceImpl implements IUuidToNewSyncService
@@ -295,8 +295,6 @@ public class UuidToNewSyncServiceImpl implements IUuidToNewSyncService
Map<String, Long> incomeMap = new HashMap<String, Long>();
Map<String, Long> feeMap = new HashMap<String, Long>();
Map<String, Long> payMap = new HashMap<String, Long>();
Map<String, Long> payFeeMap = new HashMap<String, Long>();
UuidToNewIdHolder order = new UuidToNewIdHolder();
order.setOldBillId(oldBillId);
@@ -352,44 +350,6 @@ public class UuidToNewSyncServiceImpl implements IUuidToNewSyncService
feeMap.put(row.getFeeId(), h.getNewId());
}
for (String oldPayId : syncMapper.selectPayIds(oldBillId))
{
UuidToNewIdHolder h = new UuidToNewIdHolder();
h.setOldId(oldPayId);
h.setNewBillId(newBillId);
syncMapper.insertPayBillNew(h);
if (h.getNewId() == null)
{
throw new IllegalStateException("insert pay_new no id for " + oldPayId);
}
payMap.put(oldPayId, h.getNewId());
}
for (UuidToNewFeeRow row : syncMapper.selectPayFees(oldBillId))
{
Long newPayId = null;
if (row.getParentId() != null && !row.getParentId().isEmpty())
{
newPayId = payMap.get(row.getParentId());
if (newPayId == null)
{
throw new IllegalStateException("payMap miss " + row.getParentId());
}
}
UuidToNewIdHolder h = new UuidToNewIdHolder();
h.setOldId(row.getFeeId());
h.setNewBillId(newBillId);
h.setNewPayId(newPayId);
syncMapper.insertPayFeeNew(h);
Long rowId = h.getNewId();
if (rowId == null)
{
throw new IllegalStateException("insert pay_fee_new no id for " + row.getFeeId());
}
syncMapper.updatePayFeeIdEqualsId(rowId);
payFeeMap.put(row.getFeeId(), rowId);
}
syncMapper.insertArDetailNew(oldBillId, newBillId);
for (UuidToNewFeeRow row : syncMapper.selectArDetailFees(oldBillId))
@@ -403,21 +363,6 @@ public class UuidToNewSyncServiceImpl implements IUuidToNewSyncService
syncMapper.insertArDetailFeeNew(detailFeeId, newFeeId);
}
for (UuidToNewFeeRow row : syncMapper.selectPayBillLines(oldBillId))
{
Long lineId = Long.valueOf(row.getParentId());
Long newFeeId = null;
if (row.getFeeId() != null && !row.getFeeId().isEmpty())
{
newFeeId = payFeeMap.get(row.getFeeId());
if (newFeeId == null)
{
throw new IllegalStateException("payFeeMap miss for line fee " + row.getFeeId());
}
}
syncMapper.insertPayBillLineNew(lineId, newBillId, newFeeId);
}
syncMapper.insertBillingTaskNew(oldBillId, newBillId);
return SUCCESS;
}
@@ -234,57 +234,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where f.fee_id = #{oldId}
</insert>
<select id="selectPayIds" resultType="String">
select pay_bill_id from prc_pay_bill where bill_id = #{oldBillId}
</select>
<insert id="insertPayBillNew" useGeneratedKeys="true" keyProperty="newId" keyColumn="pay_bill_id">
insert into prc_pay_bill_new (
bill_id, currency, product_amount, redline_amount,
cost_amount, pay_total, amount_a, amount_b,
amount_c, amount_d, belong_saler, belong_saler_code,
settlement_man, settlement_man_code, create_by, create_time,
update_by, update_time
)
select
#{newBillId}, p.currency, p.product_amount, p.redline_amount,
p.cost_amount, p.pay_total, p.amount_a, p.amount_b,
p.amount_c, p.amount_d, p.belong_saler, p.belong_saler_code,
p.settlement_man, p.settlement_man_code, p.create_by, p.create_time,
p.update_by, p.update_time
from prc_pay_bill p
where p.pay_bill_id = #{oldId}
</insert>
<select id="selectPayFees" resultType="com.bms.price.migration.domain.UuidToNewFeeRow">
select fee_id as feeId, pay_bill_id as parentId
from prc_pay_bill_fee
where bill_id = #{oldBillId}
order by fee_id
</select>
<insert id="insertPayFeeNew" useGeneratedKeys="true" keyProperty="newId" keyColumn="id">
insert into prc_pay_bill_fee_new (
fee_id, bill_id, pay_bill_id, fee_type,
sc_id, fee_level, amount, currency,
round_mode, remark, fee_source, source_id,
is_deleted, statement_line_id, settle_supplier_id, settle_supplier_name,
create_time
)
select
0, #{newBillId}, #{newPayId}, f.fee_type,
f.sc_id, f.fee_level, f.amount, f.currency,
f.round_mode, f.remark, f.fee_source, f.source_id,
f.is_deleted, f.statement_line_id, f.settle_supplier_id, f.settle_supplier_name,
f.create_time
from prc_pay_bill_fee f
where f.fee_id = #{oldId}
</insert>
<update id="updatePayFeeIdEqualsId">
update prc_pay_bill_fee_new set fee_id = id where id = #{id}
</update>
<insert id="insertArDetailNew">
insert into ar_bill_detail_new (
detail_id, ar_bill_id, prc_order_bill_id, detail_no,
@@ -335,33 +284,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where f.detail_fee_id = #{detailFeeId}
</insert>
<select id="selectPayBillLines" resultType="com.bms.price.migration.domain.UuidToNewFeeRow">
select cast(line_id as char) as parentId, fee_id as feeId
from pay_bill_line
where order_bill_id = #{oldBillId}
order by line_id
</select>
<insert id="insertPayBillLineNew">
insert into pay_bill_line_new (
line_id, bill_id, fee_id, order_bill_id,
order_no, lading_no, lading_fee_id, fee_name,
fee_source, fee_level, amount, supplier_amount,
diff_amount, diff_status, tax_rate, amount_net,
tax_amount, base_amount, currency, price_date,
version_no, remote_flag, density_level, line_source
)
select
l.line_id, l.bill_id, #{newFeeId}, #{newBillId},
l.order_no, l.lading_no, l.lading_fee_id, l.fee_name,
l.fee_source, l.fee_level, l.amount, l.supplier_amount,
l.diff_amount, l.diff_status, l.tax_rate, l.amount_net,
l.tax_amount, l.base_amount, l.currency, l.price_date,
l.version_no, l.remote_flag, l.density_level, l.line_source
from pay_bill_line l
where l.line_id = #{lineId}
</insert>
<insert id="insertBillingTaskNew">
insert into prc_billing_task_new (
task_id, transfer_no, tracking_no, order_no,