调整修改

This commit is contained in:
秦鸿展
2026-09-10 21:55:02 +08:00
parent db31711ad0
commit 86c4c07708
@@ -506,21 +506,25 @@ public class BusinessDocumentOrderAdjustService {
} }
/** /**
* 是否修改了金额:主表金额列变化 或 明细 amount 变化 * 是否修改了金额:主表金额/费用列变化 或 明细 amount 变化
*/ */
private boolean isAmountChanged(BusinessDocumentOrder dbOrder, BusinessDocumentOrder front, private boolean isAmountChanged(BusinessDocumentOrder dbOrder, BusinessDocumentOrder front,
boolean hasFeeDetail, List<BusinessOrderAccount> dbFeeList, boolean hasFeeDetail, List<BusinessOrderAccount> dbFeeList,
List<BusinessOrderAccount> newFeeList) { List<BusinessOrderAccount> newFeeList) {
// a) 主表金额列比对 // a) 主表金额/费用列比对(金额列用 BigDecimal 比对,字符串列用 equals 比对)
boolean mainChanged = FEE_FIELDS.stream().anyMatch(field -> { boolean mainChanged = FEE_FIELDS.stream().anyMatch(field -> {
Object newVal = BeanUtil.getFieldValue(front, field); Object newVal = BeanUtil.getFieldValue(front, field);
if (newVal == null) { if (newVal == null) {
return false; return false;
} }
Object oldVal = BeanUtil.getFieldValue(dbOrder, field); Object oldVal = BeanUtil.getFieldValue(dbOrder, field);
BigDecimal old = oldVal == null ? BigDecimal.ZERO : (BigDecimal) oldVal; if (newVal instanceof BigDecimal || oldVal instanceof BigDecimal) {
BigDecimal now = (BigDecimal) newVal; BigDecimal old = oldVal == null ? BigDecimal.ZERO : new BigDecimal(oldVal.toString());
return old.compareTo(now) != 0; BigDecimal now = new BigDecimal(newVal.toString());
return old.compareTo(now) != 0;
}
// 字符串字段(结算币种/收款账户等)
return !newVal.toString().equals(oldVal == null ? "" : oldVal.toString());
}); });
if (mainChanged) { if (mainChanged) {
return true; return true;