更改购买套餐包扣款

This commit is contained in:
1215525055@qq.com 2025-03-05 02:18:53 +08:00
parent 04484b389c
commit d8f87d7806
3 changed files with 40 additions and 16 deletions

View File

@ -88,7 +88,7 @@ public class PackageOrderResourceController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("update-pay/{packageNo}/{packageAccountItem}") @PostMapping("update-pay/{packageNo}/{packageAccountItem}")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResultData<String> updatePay(@PathVariable String packageNo, @PathVariable String packageAccountItem) { public synchronized SuccessResultData<String> updatePay(@PathVariable String packageNo, @PathVariable String packageAccountItem) {
try{ try{
PackageOrderAppVO packageOrderVO = new PackageOrderAppVO(); PackageOrderAppVO packageOrderVO = new PackageOrderAppVO();
packageOrderVO.setPackageAccountItem(packageAccountItem); packageOrderVO.setPackageAccountItem(packageAccountItem);

View File

@ -196,15 +196,35 @@ public class PackageOrderServiceImpl extends DefaultBaseService implements IPack
if(orderDTO.getPackagePayStatus().equals("1")) { // 当前状态已经是已支付的不做操作 if(orderDTO.getPackagePayStatus().equals("1")) { // 当前状态已经是已支付的不做操作
return; return;
} }
/** PackageInfoAppDTO infoAppDTO = orderDTO.getPackageInfoAppDTO();
* 1. 更改到账时间 , 状态 // 仅限购买1次的
*/ if(infoAppDTO.equals("single")) {
Map<String, Object> params = super.getHashMap(2); List<PackageOrderDTO> list = list(packageOrderVO.getPackageInfoId(), orderDTO.getCreator());
params.put("packageNo", packageOrderVO.getAccountRechargeId());// 关联支付 Boolean exists = false;
params.put("packageAccountItem", packageOrderVO.getPackageAccountItem()); // 关联扣款流水 for(PackageOrderDTO dto : list) {
params.put("packagePayStatus", "1"); // 已支付 if(dto.getPackagePayStatus().equals("1")) {
params.put("packagePay", DateUtil.getTime()); // 支付时间 exists = true;
packageOrderDao.updatePay(params); }
}
if (!exists) {
Map<String, Object> params = super.getHashMap(2);
params.put("packageNo", packageOrderVO.getAccountRechargeId());// 关联支付
params.put("packageAccountItem", packageOrderVO.getPackageAccountItem()); // 关联扣款流水
params.put("packagePayStatus", "1"); // 已支付
params.put("packagePay", DateUtil.getTime()); // 支付时间
packageOrderDao.updatePay(params);
}
}else{
/**
* 1. 更改到账时间 , 状态
*/
Map<String, Object> params = super.getHashMap(2);
params.put("packageNo", packageOrderVO.getAccountRechargeId());// 关联支付
params.put("packageAccountItem", packageOrderVO.getPackageAccountItem()); // 关联扣款流水
params.put("packagePayStatus", "1"); // 已支付
params.put("packagePay", DateUtil.getTime()); // 支付时间
packageOrderDao.updatePay(params);
}
} }
@Autowired @Autowired
@ -297,14 +317,14 @@ public class PackageOrderServiceImpl extends DefaultBaseService implements IPack
if(!StringUtils.isEmpty(packageInfoDTO.getPackageLimitUsers()) && !packageInfoDTO.getPackageLimitUsers().contains(packageOrderVO.getUserId())) { if(!StringUtils.isEmpty(packageInfoDTO.getPackageLimitUsers()) && !packageInfoDTO.getPackageLimitUsers().contains(packageOrderVO.getUserId())) {
throw new SaveException("你不能购买该套餐包"); throw new SaveException("你不能购买该套餐包");
} }
if(packageInfoDTO.getPackageMode().equals("single")) { /* if(packageInfoDTO.getPackageMode().equals("single")) {
List<PackageOrderDTO> list = list(packageOrderVO.getPackageInfoId(), packageOrderVO.getUserId()); List<PackageOrderDTO> list = list(packageOrderVO.getPackageInfoId(), packageOrderVO.getUserId());
if(list.size() > 0) { if(list.size() > 0) {
throw new SaveException("该套餐包每个用户,只可购买一次"); throw new SaveException("该套餐包每个用户,只可购买一次");
}else { }else {
/** *//**
* 1. 如果是未缴费的 , 且下单时间在 10 分钟之内的 , 禁止下单 , 防止一个用户购买了多个 * 1. 如果是未缴费的 , 且下单时间在 10 分钟之内的 , 禁止下单 , 防止一个用户购买了多个
*/ *//*
if(list.size() > 0) { if(list.size() > 0) {
PackageOrderDTO orderDTO = list.get(0); PackageOrderDTO orderDTO = list.get(0);
if(orderDTO.getPackagePayStatus().equals("0") && isWithinLastTenMinutes(orderDTO.getGmtCreate())) { if(orderDTO.getPackagePayStatus().equals("0") && isWithinLastTenMinutes(orderDTO.getGmtCreate())) {
@ -312,7 +332,7 @@ public class PackageOrderServiceImpl extends DefaultBaseService implements IPack
} }
} }
} }
} }*/
PackageOrderVO vo = new PackageOrderVO(); PackageOrderVO vo = new PackageOrderVO();
vo.setPackageInfoId(packageOrderVO.getPackageInfoId()); vo.setPackageInfoId(packageOrderVO.getPackageInfoId());
@ -343,7 +363,12 @@ public class PackageOrderServiceImpl extends DefaultBaseService implements IPack
public PackageOrderDTO getByPackageNo(String packageNo) { public PackageOrderDTO getByPackageNo(String packageNo) {
Map<String, Object> params = super.getHashMap(2); Map<String, Object> params = super.getHashMap(2);
params.put("packageNo", StringUtils.isEmpty(packageNo) ? "-1" : packageNo); params.put("packageNo", StringUtils.isEmpty(packageNo) ? "-1" : packageNo);
return packageOrderDao.get(params); PackageOrderDTO dto = packageOrderDao.get(params);
if (dto != null ) {
PackageInfoAppDTO packageInfoDTO = iPackageInfoService.getById(dto.getPackageInfoId());
dto.setPackageInfoAppDTO(packageInfoDTO);
}
return dto;
} }
} }

View File

@ -36,7 +36,6 @@ public class NewRechargeNotCheckListTask implements Job {
query.put("rechargeCheck", "1"); query.put("rechargeCheck", "1");
Integer count = iAccountRechargeService.count(query); Integer count = iAccountRechargeService.count(query);
if(count > 0) { if(count > 0) {
/** /**
* 向系统人员发送信息 * 向系统人员发送信息
*/ */