增加了套餐包的相关功能, 待测试
This commit is contained in:
parent
8ed2df072b
commit
3307f3c335
@ -101,7 +101,6 @@ public class AccountRechargeController extends DefaultBaseController {
|
|||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "修改账户充值", notes = "修改账户充值接口")
|
@ApiOperation(value = "修改账户充值", notes = "修改账户充值接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "accountRechargeId", value = "账户充值ID", paramType = "path")
|
@ApiImplicitParam(name = "accountRechargeId", value = "账户充值ID", paramType = "path")
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package cn.com.tenlion.operator.controller.app.api.accountrecharge;
|
package cn.com.tenlion.operator.controller.app.api.accountrecharge;
|
||||||
|
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO;
|
||||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.result.ErrorResult;
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
@ -12,6 +15,7 @@ import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeDTO;
|
|||||||
import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeVO;
|
import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeVO;
|
||||||
import cn.com.tenlion.operator.service.accountrecharge.IAccountRechargeService;
|
import cn.com.tenlion.operator.service.accountrecharge.IAccountRechargeService;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -34,6 +38,24 @@ public class AccountRechargeAppController extends DefaultBaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IAccountRechargeService accountRechargeService;
|
private IAccountRechargeService accountRechargeService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "确认付款按钮触发", notes = "确认付款按钮触发接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("recharge-result" + ISystemConstant.RELEASE_SUFFIX + "/{accountRechargeId}")
|
||||||
|
public synchronized AccountRechargePayResultDTO getRecharge(@PathVariable("accountRechargeId") String accountRechargeId, @RequestBody AccountRechargeVO accountRechargeVO) {
|
||||||
|
return accountRechargeService.queryOnlineSuccess(accountRechargeId, accountRechargeVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "保存充值", notes = "保存充值接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("save-account" + ISystemConstant.RELEASE_SUFFIX)
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public AccountRechargePayDTO saveAccount(@RequestBody AccountRechargeVO accountRechargeVO) {
|
||||||
|
if (StringUtils.isBlank(accountRechargeVO.getUserId())) {
|
||||||
|
throw new ParamsException("用户ID不能为空");
|
||||||
|
}
|
||||||
|
return accountRechargeService.saveAccount(accountRechargeVO.getThirdParty(), accountRechargeVO);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "新增账户充值", notes = "新增账户充值接口")
|
@ApiOperation(value = "新增账户充值", notes = "新增账户充值接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||||
|
@ -16,11 +16,35 @@ import java.util.List;
|
|||||||
@RemoteService
|
@RemoteService
|
||||||
public interface IOperatorPluginRemoteService {
|
public interface IOperatorPluginRemoteService {
|
||||||
|
|
||||||
@RemotePostMethod("/resource/packageorder/update")
|
/**
|
||||||
SuccessResult updateOrder(@RemoteServerParams String server,
|
* 关闭套餐包订单
|
||||||
@RemoteJsonBodyParams PackageOrderAppVO appVO,
|
* @param server
|
||||||
|
* @param accessToken
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RemotePostMethod("/resource/packageorder/update-close/{packageNo}")
|
||||||
|
SuccessResult updateClose(@RemoteServerParams String server,
|
||||||
|
@RemotePathParams("packageNo") String packageNo,
|
||||||
|
@RemoteQueryParams("access_token") String accessToken);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改到账状态
|
||||||
|
* @param server
|
||||||
|
* @param accessToken
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RemotePostMethod("/resource/packageorder/update-pay/{packageNo}")
|
||||||
|
SuccessResult updatePay(@RemoteServerParams String server,
|
||||||
|
@RemotePathParams("packageNo") String packageNo,
|
||||||
@RemoteQueryParams("access_token") String accessToken);
|
@RemoteQueryParams("access_token") String accessToken);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建套餐包购买记录
|
||||||
|
* @param server
|
||||||
|
* @param appVO
|
||||||
|
* @param accessToken
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RemotePostMethod("/resource/packageorder/save")
|
@RemotePostMethod("/resource/packageorder/save")
|
||||||
SuccessResult saveOrder(@RemoteServerParams String server,
|
SuccessResult saveOrder(@RemoteServerParams String server,
|
||||||
@RemoteJsonBodyParams PackageOrderAppVO appVO,
|
@RemoteJsonBodyParams PackageOrderAppVO appVO,
|
||||||
|
@ -309,6 +309,13 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
params.put("reconciliationTime", "");
|
params.put("reconciliationTime", "");
|
||||||
params.put("gmtModified", DateUtil.getTime());
|
params.put("gmtModified", DateUtil.getTime());
|
||||||
accountRechargeDao.updateCheck(params);
|
accountRechargeDao.updateCheck(params);
|
||||||
|
AccountRechargeDTO dto = get(accountRechargeId);
|
||||||
|
// 创建套餐包关闭支付
|
||||||
|
if(!StringUtils.isEmpty(dto.getPackageInfoId())) {
|
||||||
|
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
||||||
|
SuccessResult result = operatorPluginRemoteService.updateClose(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accessToken);
|
||||||
|
System.out.println("调用套餐包关闭结果 : " + result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -349,15 +356,16 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
AccountRechargeDTO dto = get(accountRechargeId);
|
AccountRechargeDTO dto = get(accountRechargeId);
|
||||||
// 绑定了套餐包 & 已对账 & 已到账
|
// 绑定了套餐包 & 已对账 & 已到账
|
||||||
if(!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("2")) {
|
if(!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("2")) {
|
||||||
// 远程更改套餐包的到账状态
|
// 远程更改套餐包的付款到账状态
|
||||||
PackageOrderAppVO appVO = new PackageOrderAppVO();
|
|
||||||
appVO.setAccountItemId(dto.getAccountItemId());
|
|
||||||
appVO.setPackageInfoId(dto.getPackageInfoId());
|
|
||||||
appVO.setUserId(dto.getCreator());
|
|
||||||
appVO.setAccountRechargeId(dto.getAccountRechargeId());
|
|
||||||
|
|
||||||
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
||||||
operatorPluginRemoteService.updateOrder(systemApiPathProperties.getOperatorPlugin(), appVO, accessToken);
|
SuccessResult result = operatorPluginRemoteService.updatePay(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accessToken);
|
||||||
|
System.out.println("调用套餐包到账结果 : " + result);
|
||||||
|
}
|
||||||
|
// 绑定了套餐包 & 已对账 & 已关闭
|
||||||
|
if(!StringUtils.isEmpty(dto.getPackageInfoId()) && dto.getReconciliationStatus().equals("1") && dto.getRechargeCheck().equals("-1")) {
|
||||||
|
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
||||||
|
SuccessResult result = operatorPluginRemoteService.updateClose(systemApiPathProperties.getOperatorPlugin(), accountRechargeId, accessToken);
|
||||||
|
System.out.println("调用套餐包关闭结果 : " + result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +430,8 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
appVO.setAccountRechargeId(payDTO.getAccountRechargeId());
|
appVO.setAccountRechargeId(payDTO.getAccountRechargeId());
|
||||||
|
|
||||||
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
||||||
operatorPluginRemoteService.saveOrder(systemApiPathProperties.getOperatorPlugin(), appVO, accessToken);
|
SuccessResult result = operatorPluginRemoteService.saveOrder(systemApiPathProperties.getOperatorPlugin(), appVO, accessToken);
|
||||||
|
System.out.println("调用套餐包创建结果 : " + result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return payDTO;
|
return payDTO;
|
||||||
@ -600,9 +609,6 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
updateCheck(dto.getAccountRechargeId(), RechargeCheckEnum.RECHARGE_SUCCESS, "线上充值", accountItemId, orderId, successTime);
|
updateCheck(dto.getAccountRechargeId(), RechargeCheckEnum.RECHARGE_SUCCESS, "线上充值", accountItemId, orderId, successTime);
|
||||||
// 3. 调用第三方接口, 告知充值到账
|
// 3. 调用第三方接口, 告知充值到账
|
||||||
sysCallbackService.save("项目充值到账", systemApiPathProperties.getCopyright() + "api/pay/recharge-success/user-id/" + dto.getAccountId(), null);
|
sysCallbackService.save("项目充值到账", systemApiPathProperties.getCopyright() + "api/pay/recharge-success/user-id/" + dto.getAccountId(), null);
|
||||||
// 2025年2月28日10:34:10 CBC 新增 套餐包购买
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import cn.com.tenlion.operator.util.pay.PayUtil;
|
|||||||
import cn.com.tenlion.operator.util.pay.WXPay;
|
import cn.com.tenlion.operator.util.pay.WXPay;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.quartz.DisallowConcurrentExecution;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -23,6 +24,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@DisallowConcurrentExecution // 防止定时任务并行执行【防止1个没有执行完,另一个又开始了】
|
||||||
@Component
|
@Component
|
||||||
public class WxPayResultCheckTask {
|
public class WxPayResultCheckTask {
|
||||||
|
|
||||||
@ -37,6 +39,33 @@ public class WxPayResultCheckTask {
|
|||||||
iAccountRechargeStaticService = this.iAccountRechargeService;
|
iAccountRechargeStaticService = this.iAccountRechargeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线上已支付订单的核对(10分钟之内的)
|
||||||
|
*/
|
||||||
|
@Scheduled(fixedDelay = 60 * 1000 * 2)
|
||||||
|
public void updateStatus() {
|
||||||
|
LOG.debug("检查支付宝和微信,已支付未核对的订单");
|
||||||
|
// 未充值的订单
|
||||||
|
List<AccountRechargePO> accountRechargePOS = iAccountRechargeService.listPOByRechargeCheck(RechargeCheckEnum.RECHARGED);
|
||||||
|
accountRechargePOS.forEach(po -> {
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LocalDateTime gmtCreateDateTime = LocalDateTime.parse(po.getGmtCreate(), DateTimeFormatter.ofPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||||
|
if (StringUtils.equals(po.getThirdParty(), ThirdPartyEnum.WX.getValue()) && now.isAfter(gmtCreateDateTime.plusMinutes(10))) {
|
||||||
|
PayResultDTO payResultDTO = WXPay.queryPay(po.getAccountRechargeId());
|
||||||
|
// 成功
|
||||||
|
if (payResultDTO.getOrderStatus().equals("1") && payResultDTO.getMoney().equals(PayUtil.buiderMoney(po.getRechargeMoney())) ) {
|
||||||
|
iAccountRechargeStaticService.saveConfirmOnline(po.getAccountRechargeId(), payResultDTO.getOrderId(), payResultDTO.getOrderSuccessTime());
|
||||||
|
}
|
||||||
|
} else if (StringUtils.equals(po.getThirdParty(), ThirdPartyEnum.ZFB.getValue()) && now.isAfter(gmtCreateDateTime.plusMinutes(10))) {
|
||||||
|
PayResultDTO payResultDTO = ALiPay.queryPay(po.getAccountRechargeId());
|
||||||
|
// 成功
|
||||||
|
if (payResultDTO.getOrderStatus().equals("1") && payResultDTO.getMoney().equals(PayUtil.buiderMoney(po.getRechargeMoney())) ) {
|
||||||
|
iAccountRechargeStaticService.saveConfirmOnline(po.getAccountRechargeId(), payResultDTO.getOrderId(), payResultDTO.getOrderSuccessTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 超过10分钟未支付的关闭
|
* 超过10分钟未支付的关闭
|
||||||
* 充值时间
|
* 充值时间
|
||||||
|
Loading…
Reference in New Issue
Block a user