From c23b780525154db543bdc56a03897eb5ed00416a Mon Sep 17 00:00:00 2001 From: Yen Date: Thu, 15 Dec 2022 16:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controller/PayPaymentController.java | 7 ++++--- .../qs/serve/modules/pay/entity/PayPayment.java | 2 ++ .../serve/modules/pay/entity/bo/PayPaymentBo.java | 3 +++ .../pay/service/impl/PayPaymentServiceImpl.java | 14 +++++++++----- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/qs/serve/modules/pay/controller/PayPaymentController.java b/src/main/java/com/qs/serve/modules/pay/controller/PayPaymentController.java index c4e01c3c..48a980c2 100644 --- a/src/main/java/com/qs/serve/modules/pay/controller/PayPaymentController.java +++ b/src/main/java/com/qs/serve/modules/pay/controller/PayPaymentController.java @@ -70,7 +70,8 @@ public class PayPaymentController { * @param supplierId * @return */ - @GetMapping("/getSupplierAmount/{supplierId}") + @GetMapping("/amount/{supplierId}") + @PreAuthorize("hasRole('pay:payment:query')") public R getSupplierAmount(@PathVariable("supplierId") Long supplierId){ PayPaymentAmountDto amountDto = payPaymentService.getSupplierBalance(supplierId); return R.ok(amountDto); @@ -83,7 +84,7 @@ public class PayPaymentController { */ @PostMapping("/payment") @SysLog(module = SystemModule.Payment, title = "支付", biz = BizType.INSERT) - @PreAuthorize("hasRole('pay:payment:insert')") + @PreAuthorize("hasRole('pay:payment:pay')") public R save(@RequestBody @Valid PayPaymentBo param){ PayPayment payPayment = payPaymentService.payment(param); return R.ok(payPayment); @@ -96,7 +97,7 @@ public class PayPaymentController { */ @DeleteMapping("/cancel/{id}") @SysLog(module = SystemModule.Payment, title = "支付", biz = BizType.DELETE) - @PreAuthorize("hasRole('pay:payment:delete')") + @PreAuthorize("hasRole('pay:payment:cancel')") public R cancelById(@PathVariable("id") Long id){ payPaymentService.cancel(id); return R.ok(); diff --git a/src/main/java/com/qs/serve/modules/pay/entity/PayPayment.java b/src/main/java/com/qs/serve/modules/pay/entity/PayPayment.java index 959cf77c..dd38135c 100644 --- a/src/main/java/com/qs/serve/modules/pay/entity/PayPayment.java +++ b/src/main/java/com/qs/serve/modules/pay/entity/PayPayment.java @@ -49,6 +49,8 @@ public class PayPayment implements Serializable { @NotNull(message = "支付金额不能为空") private BigDecimal payAmount; + private String erpCode; + /** 支付人id */ @NotBlank(message = "支付人id不能为空") @Length(max = 32,message = "支付人id长度不能超过32字") diff --git a/src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java b/src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java index 3bf794e6..04ff3237 100644 --- a/src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java +++ b/src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java @@ -33,6 +33,9 @@ public class PayPaymentBo implements Serializable { @NotNull(message = "支付金额不能为空") private BigDecimal payAmount; + /** ERP编码 */ + private String erpCode; + /** 备注 */ @Length(max = 255,message = "备注长度不能超过255字") private String remark; diff --git a/src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java b/src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java index 3f0088b6..2013c17f 100644 --- a/src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java @@ -70,16 +70,20 @@ public class PayPaymentServiceImpl extends ServiceImpl0){ + currentItemPay = shouldPay; currentBalance = currentBalance.subtract(shouldPay); }else { + currentItemPay = currentBalance; currentBalance = BigDecimal.ZERO; } PayPaymentItem paymentItem = new PayPaymentItem(); paymentItem.setSupplierId(paymentBo.getSupplierId()); - paymentItem.setItemPayAmount(shouldPay); + paymentItem.setItemPayAmount(currentItemPay); paymentItem.setVerificationId(verificationSubject.getVerificationId()); paymentItem.setVerificationSubjectId(verificationSubject.getId()); paymentItem.setCostApplyId(verificationSubject.getCostApplyId()); @@ -89,7 +93,7 @@ public class PayPaymentServiceImpl extends ServiceImpl lqw = new LambdaQueryWrapper<>(); lqw.eq(VtbVerificationSubject::getSupplierId,supplierId); lqw.eq(VtbVerificationSubject::getPayFinishedFlag,0); - lqw.orderByAsc(VtbVerificationSubject::getId); + lqw.eq(VtbVerificationSubject::getEffectiveFlag,1); List vtbVerificationSubjectList = verificationSubjectService.list(lqw); BigDecimal totalAmount = BigDecimal.ZERO; BigDecimal payAmount = BigDecimal.ZERO;