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);