From b9223c2c1472c6153aeea0fae7efd8a41937479f Mon Sep 17 00:00:00 2001 From: Yen Date: Fri, 31 May 2024 10:51:59 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=8B=93=E5=B1=95=E7=A7=91?= =?UTF-8?q?=E7=9B=AE=E9=99=90=E5=88=B6=E7=BD=91=E7=82=B9=E9=80=89=E6=8B=A9?= =?UTF-8?q?=20feat:=20=E6=94=AF=E4=BB=98=E6=B7=BB=E5=8A=A0=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/controller/PayPaymentController.java | 96 ++++++++++++++++--- .../service/impl/TbsActivityServiceImpl.java | 9 +- 2 files changed, 89 insertions(+), 16 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 b104aa7f..d8303465 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 @@ -25,9 +25,13 @@ import com.qs.serve.modules.pay.entity.vo.PaySupplierVo; import com.qs.serve.modules.pay.mapper.PaySupplierMapper; import com.qs.serve.modules.pay.service.PayPaymentItemService; import com.qs.serve.modules.sys.entity.SysConfig; +import com.qs.serve.modules.sys.entity.SysSyncLog; import com.qs.serve.modules.sys.service.SysConfigService; import com.qs.serve.modules.sys.service.SysPostUserService; +import com.qs.serve.modules.sys.service.SysSyncLogService; import com.qs.serve.modules.tbs.mapper.TbsCostApplySumAmountMapper; +import com.qs.serve.modules.third.ThirdTokenUtil; +import com.qs.serve.modules.third.entity.ProcessCreateCostApplyBo; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; @@ -39,6 +43,7 @@ import com.qs.serve.modules.pay.entity.bo.PayPaymentBo; import com.qs.serve.modules.pay.entity.PayPayment; import com.qs.serve.modules.pay.service.PayPaymentService; +import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import java.math.BigDecimal; import java.time.LocalDate; @@ -63,6 +68,7 @@ public class PayPaymentController { private PaySupplierMapper paySupplierMapper; private DateCheckApplyService dateCheckApplyService; private SysConfigService configService; + private SysSyncLogService sysSyncLogService; /** * 客户费用列表 @@ -228,9 +234,27 @@ public class PayPaymentController { @PostMapping("/unPayment") @SysLog(module = SystemModule.Payment, title = "支付", biz = BizType.INSERT) @PreAuthorize("hasRole('pay:payment:pay')") - public R unPayment(@RequestBody @Valid PayPaymentBo param){ - PayPayment payPayment = payPaymentService.unpayment(param); - return R.ok(payPayment); + public R unPayment(@RequestBody @Valid PayPaymentBo param, HttpServletRequest request){ + SysSyncLog syncLog = new SysSyncLog(); + syncLog.setFromPlat("新增不再支付"); + syncLog.setUrl(request.getRequestURI()); + syncLog.setRequestJson(JsonUtil.objectToJson(param)); + syncLog.setEntityClass(ProcessCreateCostApplyBo.class.getName()); + PayPayment payPayment = null; + try { + payPayment = payPaymentService.unpayment(param); + syncLog.setSuccessStatus(1); + } catch (Exception e) { + syncLog.setFailReason(e.getMessage()); + sysSyncLogService.save(syncLog); + return R.error(e.getMessage()); + } + sysSyncLogService.save(syncLog); + if(syncLog.getSuccessStatus()!=null&&syncLog.getSuccessStatus().equals(1)){ + return R.ok(payPayment); + } + return R.error("新增不再支付异常"); + } @@ -242,9 +266,25 @@ public class PayPaymentController { @PostMapping("/cancelUnPayment") @SysLog(module = SystemModule.Payment, title = "支付", biz = BizType.INSERT) @PreAuthorize("hasRole('pay:payment:pay')") - public R cancelUnPayment(@RequestBody String verificationCode){ - payPaymentService.cancelUnPayment(verificationCode); - return R.ok(); + public R cancelUnPayment(@RequestBody String verificationCode, HttpServletRequest request){ + SysSyncLog syncLog = new SysSyncLog(); + syncLog.setFromPlat("取消不再支付"); + syncLog.setUrl(request.getRequestURI()); + syncLog.setRemark(verificationCode); + syncLog.setEntityClass(ProcessCreateCostApplyBo.class.getName()); + try { + payPaymentService.cancelUnPayment(verificationCode); + syncLog.setSuccessStatus(1); + } catch (Exception e) { + syncLog.setFailReason(e.getMessage()); + sysSyncLogService.save(syncLog); + return R.error(e.getMessage()); + } + sysSyncLogService.save(syncLog); + if(syncLog.getSuccessStatus()!=null&&syncLog.getSuccessStatus().equals(1)){ + return R.ok(); + } + return R.error("取消不再支付异常"); } /** @@ -255,9 +295,26 @@ public class PayPaymentController { @PostMapping("/save") @SysLog(module = SystemModule.Payment, title = "支付", biz = BizType.INSERT) @PreAuthorize("hasRole('pay:payment:pay')") - public R save(@RequestBody @Valid PayPaymentBo param){ - PayPayment payPayment = payPaymentService.payment(param); - return R.ok(payPayment); + public R save(@RequestBody @Valid PayPaymentBo param, HttpServletRequest request){ + SysSyncLog syncLog = new SysSyncLog(); + syncLog.setFromPlat("新增支付"); + syncLog.setUrl(request.getRequestURI()); + syncLog.setRequestJson(JsonUtil.objectToJson(param)); + syncLog.setEntityClass(ProcessCreateCostApplyBo.class.getName()); + PayPayment payPayment = null; + try { + payPayment = payPaymentService.payment(param); + syncLog.setSuccessStatus(1); + } catch (Exception e) { + syncLog.setFailReason(e.getMessage()); + sysSyncLogService.save(syncLog); + return R.error(e.getMessage()); + } + sysSyncLogService.save(syncLog); + if(syncLog.getSuccessStatus()!=null&&syncLog.getSuccessStatus().equals(1)){ + return R.ok(payPayment); + } + return R.error("新增支付异常"); } /** @@ -268,9 +325,24 @@ public class PayPaymentController { @RequestMapping(value = "/cancel/{id}",method = {RequestMethod.GET,RequestMethod.DELETE}) @SysLog(module = SystemModule.Payment, title = "取消支付", biz = BizType.DELETE) @PreAuthorize("hasRole('pay:payment:cancel')") - public R cancelById(@PathVariable("id") String erpId){ - payPaymentService.cancel(erpId); - return R.ok(); + public R cancelById(@PathVariable("id") String erpId, HttpServletRequest request){ + SysSyncLog syncLog = new SysSyncLog(); + syncLog.setFromPlat("取消支付"); + syncLog.setUrl(request.getRequestURI()); + syncLog.setEntityClass(ProcessCreateCostApplyBo.class.getName()); + try { + payPaymentService.cancel(erpId); + syncLog.setSuccessStatus(1); + } catch (Exception e) { + syncLog.setFailReason(e.getMessage()); + sysSyncLogService.save(syncLog); + return R.error(e.getMessage()); + } + sysSyncLogService.save(syncLog); + if(syncLog.getSuccessStatus()!=null&&syncLog.getSuccessStatus().equals(1)){ + return R.ok(); + } + return R.error("取消支付异常"); } } diff --git a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java index c2d6409e..a0a247f9 100644 --- a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java @@ -195,10 +195,7 @@ public class TbsActivityServiceImpl extends ServiceImpl0){ activityChannelPointService.saveBatch(activityChannelPointList); } + Long actId = tbsActivityChannelPointMapper.checkSubjectPoint(activity.getId()); + if(actId!=null){ + Assert.throwEx("活动["+activity.getActivityCode() + "]因科目类型,必须选网点"); + } //保存 activityGoodsService.saveBatch(activityGoodsList); activitySubjectService.saveBatch(activitySubjects);