From 034ad477ce715d1c5802fa77063a550efa1f1465 Mon Sep 17 00:00:00 2001 From: linfso Date: Fri, 30 May 2025 07:09:38 +0800 Subject: [PATCH] md --- .../impl/EmisSettleBillServiceImpl.java | 3 +-- .../resources/mapper/EmisSettleBillMapper.xml | 24 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisSettleBillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisSettleBillServiceImpl.java index 3830bbddf..fac83d441 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisSettleBillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisSettleBillServiceImpl.java @@ -328,7 +328,6 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS EmisSettleBill updBill = new EmisSettleBill(); updBill.setId(oldEmisSettleBill.getId()); - // 默认30天,从1号开始 BigDecimal creditPeriod = BigDecimal.valueOf(30D); Integer settleDay = 1; @@ -341,11 +340,11 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS settleDay = monthUser.getSettleDay(); } - // 现金账期从寄件开始10天 updBill.setCreditPeriodType("1"); updBill.setCreditPeriod(creditPeriod); updBill.setSettleDay(settleDay); + // 现金账期从寄件开始10天 Date billMonthDate = DateUtils.parseDate(oldEmisSettleBill.getBillMonth() + "-" + settleDay); Date paymentDueDate = DateUtils.addMonths(billMonthDate, 1); paymentDueDate = DateUtils.addDays(paymentDueDate, creditPeriod.intValue()); diff --git a/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml b/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml index f6266980b..0a13945fb 100644 --- a/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml @@ -150,10 +150,10 @@ tbb.allowanceMoney as allowanceMoney, tbb.deductionMoney as deductionMoney, tbb.otherMoney as otherMoney, - if( IFNULL(tbb.totalPayMoney,0) > 0,tbb.totalPayMoney-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney), 0 ) AS totalPayMoney, - if( IFNULL(tbb.recdMoneyIn, 0) > 0,tbb.recdMoneyIn-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) AS recdMoneyIn, - if( IFNULL(tbb.recdPayMoney60D, 0 )> 0,tbb.recdPayMoney60D-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) recdPayMoney60D, - if( IFNULL(tbb.recdPayMoneyGreat60D, 0 )>0,tbb.recdPayMoneyGreat60D-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) recdPayMoneyGreat60D, + if( tbb.totalPayMoney > 0,tbb.totalPayMoney-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney), 0 ) AS totalPayMoney, + if( tbb.recdMoneyIn > 0,tbb.recdMoneyIn-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) AS recdMoneyIn, + if( tbb.recdPayMoney60D > 0,tbb.recdPayMoney60D-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) recdPayMoney60D, + if( tbb.recdPayMoneyGreat60D >0,tbb.recdPayMoneyGreat60D-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) recdPayMoneyGreat60D, ( tba.rec_money - tba.reced_money - (tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney) ) AS noRecMoney FROM ( @@ -237,14 +237,14 @@ LEFT JOIN ( SELECT a.settle_bill_no, - sum( b.satisfy_money) AS satisfyMoney, - sum( b.allowance_money) AS allowanceMoney, - sum( b.deduction_money) AS deductionMoney, - sum( b.other_money) AS otherMoney, - sum( d.pay_money) AS totalPayMoney, - sum( if(b.trade_date a.payment_due_date,d.pay_money,0) ) AS recdMoneyIn, - sum( if(a.settle_type='2' and a.credit_period = ]]> 30 and b.trade_date ]]> a.payment_due_date and b.trade_date ]]> a.payment_due_date and b.trade_date DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ),d.pay_money,0) ) AS recdPayMoney60D, - sum( if( (a.settle_type='2' and a.credit_period = ]]> 30 and b.trade_date ]]> a.payment_due_date and b.trade_date = ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ) ) or ( ( (a.settle_type='2' and a.credit_period 30) or a.settle_type='1' ) and b.trade_date ]]> a.payment_due_date ),d.pay_money,0) ) AS recdPayMoneyGreat60D + sum( ifnull(b.satisfy_money,0) ) AS satisfyMoney, + sum( ifnull(b.allowance_money,0) ) AS allowanceMoney, + sum( ifnull(b.deduction_money,0) ) AS deductionMoney, + sum( ifnull(b.other_money,0) ) AS otherMoney, + sum( ifnull(d.pay_money,0) ) AS totalPayMoney, + sum( if(b.trade_date a.payment_due_date,ifnull(d.pay_money,0) ,0) ) AS recdMoneyIn, + sum( if(a.settle_type='2' and a.credit_period = ]]> 30 and b.trade_date ]]> a.payment_due_date and b.trade_date ]]> a.payment_due_date and b.trade_date DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ),ifnull(d.pay_money,0) ,0) ) AS recdPayMoney60D, + sum( if( (a.settle_type='2' and a.credit_period = ]]> 30 and b.trade_date ]]> a.payment_due_date and b.trade_date = ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ) ) or ( ( (a.settle_type='2' and a.credit_period 30) or a.settle_type='1' ) and b.trade_date ]]> a.payment_due_date ),ifnull(d.pay_money,0) ,0) ) AS recdPayMoneyGreat60D FROM emis_settle_bill a, emis_settle_pay_record b,