|
|
@@ -119,7 +119,7 @@ public class RecPayService extends BaseService<RecPay> {
|
|
|
List<RecPayItemResponse> recPayItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(id));
|
|
|
result.put("recPayItem", recPayItem);
|
|
|
|
|
|
- // 收款明细
|
|
|
+ // 应收核销明细
|
|
|
List<RecPayHandleItemResponse> recPayHandleItem = recPayHandleItemMapper.selectByCond(new RecPayHandleItemQuery().setRpId(id));
|
|
|
result.put("recPayHandleItem", recPayHandleItem);
|
|
|
|
|
|
@@ -357,7 +357,7 @@ public class RecPayService extends BaseService<RecPay> {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @desc : 新建应收收款(收款+冲应收)
|
|
|
+ * @desc : 新建应收核销(收款+核销应收)
|
|
|
* @author : 付斌
|
|
|
* @date : 2023/1/9 10:49
|
|
|
*/
|
|
|
@@ -434,15 +434,15 @@ public class RecPayService extends BaseService<RecPay> {
|
|
|
// 账款明细的核销金额和优惠金额
|
|
|
AccountItem accountItemForUpdate = accountItemMapper.selectByIdForUpdate(recPayHandleItem.getAccItemId());
|
|
|
AccountItem accountItemUpdate = new AccountItem();
|
|
|
- // 核销金额加优惠金额,超出应收金额
|
|
|
- if (accountItemForUpdate.getAmtResidue().compareTo(recPayHandleItem.getAmtReceivableHandle().add(recPayHandleItem.getAmtWaive())) == -1) {
|
|
|
+ // 核销金额,超出剩余应收金额
|
|
|
+ if (accountItemForUpdate.getAmtResidue().compareTo(recPayHandleItem.getAmtReceivableHandle()) == -1) {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
|
|
|
}
|
|
|
accountItemUpdate.setAmtHandle(accountItemForUpdate.getAmtHandle().add(recPayHandleItem.getAmtReceivableHandle()))
|
|
|
.setAmtWaive(accountItemForUpdate.getAmtWaive().add(recPayHandleItem.getAmtWaive()))
|
|
|
.setItemId(recPayHandleItem.getAccItemId());
|
|
|
- // 剩余金额 = 应收金额-应收收款金额-优惠金额
|
|
|
- accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()).subtract(accountItemUpdate.getAmtWaive()));
|
|
|
+ // 剩余金额 = 应收金额-应收收款金额
|
|
|
+ accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()));
|
|
|
accountItemService.updateByUuid(accountItemUpdate);
|
|
|
}
|
|
|
|
|
|
@@ -460,8 +460,8 @@ public class RecPayService extends BaseService<RecPay> {
|
|
|
accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().add(recPayHandleItemVO.getAmtReceivableHandle()))// 总应收收款金额
|
|
|
.setReceivableWaive(accountForUpdate.getReceivableWaive().add(recPayHandleItemVO.getAmtWaive()))// 总应收优惠金额
|
|
|
.setObjectId(accountForUpdate.getObjectId());
|
|
|
- // 剩余应收 = 总应收账款-总应收收款金额-总应收优惠金额
|
|
|
- accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()).subtract(accountUpdate.getReceivableWaive()));
|
|
|
+ // 剩余应收 = 总应收账款-总应收收款金额
|
|
|
+ accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()));
|
|
|
// 可退金额 = 总收款金额-总应收收款金额+总应收优惠金额
|
|
|
accountUpdate.setReceiptResidue(accountForUpdate.getReceipt().subtract(accountUpdate.getReceivableHandle()).add(accountUpdate.getReceivableWaive()));
|
|
|
|
|
|
@@ -507,14 +507,14 @@ public class RecPayService extends BaseService<RecPay> {
|
|
|
accountItemService.updateByUuid(accountItemUpdate);
|
|
|
}
|
|
|
|
|
|
- // 把总帐上的钱加回来 todo
|
|
|
+ // 把总帐上的钱加回来
|
|
|
Account accountForUpdate = accountMapper.selectByIdForUpdate(recPayForUpdate.getObjectId());
|
|
|
Account accountUpdate = new Account();
|
|
|
accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().subtract(recPayForUpdate.getSumAmtReceivableHandle()))// 总应收收款金额
|
|
|
.setReceivableWaive(accountForUpdate.getReceivableWaive().subtract(recPayForUpdate.getSumWaiveAmt()))// 总应收优惠金额
|
|
|
.setObjectId(accountForUpdate.getObjectId());
|
|
|
- // 剩余应收 = 总应收账款-总应收收款金额-总应收优惠金额
|
|
|
- accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()).subtract(accountUpdate.getReceivableWaive()));
|
|
|
+ // 剩余应收 = 总应收账款-总应收收款金额
|
|
|
+ accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()));
|
|
|
// 可退金额 = 总收款金额-总应收收款金额+总应收优惠金额
|
|
|
accountUpdate.setReceiptResidue(accountForUpdate.getReceipt().subtract(accountUpdate.getReceivableHandle()).add(accountUpdate.getReceivableWaive()));
|
|
|
|