This commit is contained in:
linfso 2024-08-13 15:27:41 +08:00
parent 8037769dc3
commit dabe275d9d

View File

@ -22,6 +22,7 @@ import com.xdadan.erp.emis.mapper.EmisSettleBillMapper;
import com.xdadan.erp.emis.mapper.EmisSettleSubBillMapper;
import com.xdadan.erp.emis.service.EmisBaseService;
import com.xdadan.erp.emis.utils.WaybillHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -35,6 +36,7 @@ import com.xdadan.erp.emis.service.IEmisSettlePayRecordService;
* @author linfso
* @date 2024-07-21 13:31:24
*/
@Slf4j
@Service
public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements IEmisSettlePayRecordService
{
@ -148,20 +150,27 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
/* other_money */
BigDecimal otherMoney = BigDecimal.ZERO;
log.debug("收款状态更新===>应收:{}",oldBill.getRecMoney());
for(EmisSettlePayRecord item:payRecordList){
totalPayMoney=totalPayMoney.add(item.getPayMoney());
satisfyMoney=satisfyMoney.add(item.getSatisfyMoney()==null?BigDecimal.ZERO:item.getSatisfyMoney());
allowanceMoney=allowanceMoney.add(item.getAllowanceMoney()==null?BigDecimal.ZERO:item.getAllowanceMoney());
deductionMoney=deductionMoney.add(item.getDeductionMoney()==null?BigDecimal.ZERO:item.getDeductionMoney());
otherMoney=otherMoney.add(item.getOtherMoney()==null?BigDecimal.ZERO:item.getOtherMoney());
totalAllPayMoney=totalAllPayMoney.add(totalPayMoney);
totalAllPayMoney=totalAllPayMoney.add(satisfyMoney);
totalAllPayMoney=totalAllPayMoney.add(allowanceMoney);
totalAllPayMoney=totalAllPayMoney.add(deductionMoney);
totalAllPayMoney=totalAllPayMoney.add(otherMoney);
}
// 总应收金额
log.debug("收款状态更新===>totalPayMoney:{},satisfyMoney:{},allowanceMoney:{},deductionMoney:{},otherMoney:{}"
,totalPayMoney,satisfyMoney,allowanceMoney,allowanceMoney,deductionMoney,otherMoney);
totalAllPayMoney=totalAllPayMoney
.add(totalPayMoney)
.add(satisfyMoney)
.add(allowanceMoney)
.add(deductionMoney)
.add(otherMoney);
EmisSettleBill newBill = new EmisSettleBill();
newBill.setId(oldBill.getId());
newBill.setRecedMoney(totalPayMoney);
@ -171,6 +180,7 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
// 判断收款状态 收款金额
int rstDif=totalAllPayMoney.compareTo(oldBill.getRecMoney());
log.debug("收款状态更新===>收款总金额:{},应收:{},rsDif:{}",totalAllPayMoney,oldBill.getRecMoney(),rstDif);
if( rstDif >= 0 ){
// 已收款
newBill.setPaymentStatus("1");