Browse Source

feat:拓展科目限制网点选择

feat: 支付添加前置日志
checkBack
Yen 1 year ago
parent
commit
b9223c2c14
  1. 96
      src/main/java/com/qs/serve/modules/pay/controller/PayPaymentController.java
  2. 9
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java

96
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<PayPayment> unPayment(@RequestBody @Valid PayPaymentBo param){
PayPayment payPayment = payPaymentService.unpayment(param);
return R.ok(payPayment);
public R<PayPayment> 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<PayPayment> cancelUnPayment(@RequestBody String verificationCode){
payPaymentService.cancelUnPayment(verificationCode);
return R.ok();
public R<PayPayment> 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<PayPayment> save(@RequestBody @Valid PayPaymentBo param){
PayPayment payPayment = payPaymentService.payment(param);
return R.ok(payPayment);
public R<PayPayment> 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("取消支付异常");
}
}

9
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsActivityServiceImpl.java

@ -195,10 +195,7 @@ public class TbsActivityServiceImpl extends ServiceImpl<TbsActivityMapper,TbsAct
// LocalDate preDay = DateUtils.beSetDate(activity.getActEndDate(),days);
// activity.setPreCheckDate(preDay);
this.saveOrUpdate(activity);
Long actId = tbsActivityChannelPointMapper.checkSubjectPoint(activity.getId());
if(actId!=null){
Assert.throwEx("活动["+activity.getActivityCode() + "]因科目类型,必须选网点");
}
//统计费用信息
this.updateCostTotal(costApply.getId());
if(isUpdate){
@ -257,6 +254,10 @@ public class TbsActivityServiceImpl extends ServiceImpl<TbsActivityMapper,TbsAct
if(activityChannelPointList.size()>0){
activityChannelPointService.saveBatch(activityChannelPointList);
}
Long actId = tbsActivityChannelPointMapper.checkSubjectPoint(activity.getId());
if(actId!=null){
Assert.throwEx("活动["+activity.getActivityCode() + "]因科目类型,必须选网点");
}
//保存
activityGoodsService.saveBatch(activityGoodsList);
activitySubjectService.saveBatch(activitySubjects);

Loading…
Cancel
Save