| @@ -215,7 +215,7 @@ public class WxAllBill extends TenantEntity { | |||||
| if (StringUtils.isBlank(returnPay)) { | if (StringUtils.isBlank(returnPay)) { | ||||
| returnPay = "0"; | returnPay = "0"; | ||||
| } | } | ||||
| return new BigDecimal(getOwe()).subtract(new BigDecimal(returnPay)).toPlainString(); | |||||
| return new BigDecimal(pay).subtract(new BigDecimal(returnPay)).toPlainString(); | |||||
| } | } | ||||
| @Excel(name = "备注", width = 20, orderNum = "9") | @Excel(name = "备注", width = 20, orderNum = "9") | ||||
| @@ -405,25 +405,6 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill | |||||
| wxBillRent.updateTenantInfo(dto); | wxBillRent.updateTenantInfo(dto); | ||||
| wxBillRent.setUpdatetime(new Date()); | wxBillRent.setUpdatetime(new Date()); | ||||
| wxBillRent.setReturnPay(oldpay.add(new BigDecimal(dto.getPayToMerchant())).toPlainString()); | wxBillRent.setReturnPay(oldpay.add(new BigDecimal(dto.getPayToMerchant())).toPlainString()); | ||||
| //如果屎押金 | |||||
| boolean isDeposit = false; | |||||
| for (EnumBillAllType dep : EnumBillAllType.getDepositTypes()) { | |||||
| if (dbBill.getBillType().intValue() == dep.getCode().intValue()) { | |||||
| isDeposit = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if (isDeposit) { | |||||
| String setoff = dbBill.getSetOff(); | |||||
| if (StringUtils.isBlank(setoff)) { | |||||
| setoff = "0"; | |||||
| } | |||||
| String pay = dbBill.getPay(); | |||||
| if (StringUtils.isBlank(pay)) { | |||||
| pay = "0"; | |||||
| } | |||||
| } | |||||
| wxAllBillMapper.updateById(wxBillRent); | wxAllBillMapper.updateById(wxBillRent); | ||||
| this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), | this.addBillAction(EnumBillAction.RETURN, dto.getBillTypeValue(),dto.getId(), | ||||
| dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWay(),dto.getPayWayName(), | dto.getAddpay(), dto.getAddpay(),null,wxBillRent.getPayDate(),dto.getPayWay(),dto.getPayWayName(), | ||||
| @@ -922,16 +922,17 @@ public class WxFinanceServiceImpl implements WxFinanceService { | |||||
| //有收款,就要更新账单的收款 | //有收款,就要更新账单的收款 | ||||
| //更新账单收款信息 | //更新账单收款信息 | ||||
| String money = ""; | String money = ""; | ||||
| BigDecimal oweDecimal = new BigDecimal(bill.getOwe()); | |||||
| BigDecimal oweDecimal = new BigDecimal(bill.getRemainReturnPrice()); | |||||
| //只有没有有欠款才会支付 | //只有没有有欠款才会支付 | ||||
| if (oweDecimal.compareTo(b0) > 0 ) { | if (oweDecimal.compareTo(b0) > 0 ) { | ||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"账单有欠缴,不能付款."); | throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"账单有欠缴,不能付款."); | ||||
| //noNeedCreate = true; | //noNeedCreate = true; | ||||
| //return noNeedCreate; | //return noNeedCreate; | ||||
| } | } | ||||
| if (calcuteDto.getTotalRemainPay().add(oweDecimal).compareTo(b0) > 0 ) { | |||||
| money = oweDecimal.multiply(new BigDecimal(-1)).toPlainString(); | |||||
| calcuteDto.setTotalRemainPay(calcuteDto.getTotalRemainPay().add(oweDecimal)); | |||||
| //如果金额能覆盖应付 | |||||
| if (calcuteDto.getTotalRemainPay().compareTo(oweDecimal) > 0 ) { | |||||
| money = oweDecimal.toPlainString(); | |||||
| calcuteDto.setTotalRemainPay(calcuteDto.getTotalRemainPay().subtract(oweDecimal)); | |||||
| }else { | }else { | ||||
| money = calcuteDto.getTotalRemainPay().toPlainString(); | money = calcuteDto.getTotalRemainPay().toPlainString(); | ||||
| calcuteDto.setTotalRemainPay(new BigDecimal(0)); | calcuteDto.setTotalRemainPay(new BigDecimal(0)); | ||||
| @@ -111,7 +111,7 @@ | |||||
| and ( | and ( | ||||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 and bill_type not in (13,21,5)) | ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') < 0 and bill_type not in (13,21,5)) | ||||
| or | or | ||||
| ( `pay` > 0 and bill_type in (13,21,5)) | |||||
| ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') < 0 and bill_type in (13,21,5)) | |||||
| ) | ) | ||||
| </if> | </if> | ||||
| <if test=" 1 == notifyed "> | <if test=" 1 == notifyed "> | ||||