fix: 充值BUG
This commit is contained in:
parent
98df9a09ef
commit
45eed8f2f6
@ -8,8 +8,11 @@ import cn.com.tenlion.operator.pojo.dtos.account.AccountDTO;
|
|||||||
import cn.com.tenlion.operator.pojo.dtos.accountbank.AccountBankDTO;
|
import cn.com.tenlion.operator.pojo.dtos.accountbank.AccountBankDTO;
|
||||||
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO;
|
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayDTO;
|
||||||
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO;
|
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeWxPrepayDTO;
|
||||||
import cn.com.tenlion.operator.pojo.dtos.ic.UsericDTO;
|
import cn.com.tenlion.operator.pojo.dtos.ic.UsericDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO;
|
||||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemVO;
|
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemVO;
|
||||||
|
import cn.com.tenlion.operator.pojo.vos.accountrecharge.AccountRechargeWxPrepayVO;
|
||||||
import cn.com.tenlion.operator.properties.SystemApiPathProperties;
|
import cn.com.tenlion.operator.properties.SystemApiPathProperties;
|
||||||
import cn.com.tenlion.operator.remote.IOperatorPluginRemoteService;
|
import cn.com.tenlion.operator.remote.IOperatorPluginRemoteService;
|
||||||
import cn.com.tenlion.operator.remote.PackageInfoDTO;
|
import cn.com.tenlion.operator.remote.PackageInfoDTO;
|
||||||
@ -20,6 +23,7 @@ import cn.com.tenlion.operator.service.accountbank.IAccountBankService;
|
|||||||
import cn.com.tenlion.operator.service.accountitem.IAccountItemService;
|
import cn.com.tenlion.operator.service.accountitem.IAccountItemService;
|
||||||
import cn.com.tenlion.operator.service.remote.IRemoteWangGengInvoiceService;
|
import cn.com.tenlion.operator.service.remote.IRemoteWangGengInvoiceService;
|
||||||
import cn.com.tenlion.operator.service.sys.callback.SysCallbackService;
|
import cn.com.tenlion.operator.service.sys.callback.SysCallbackService;
|
||||||
|
import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl;
|
||||||
import cn.com.tenlion.operator.util.TenlionSMS;
|
import cn.com.tenlion.operator.util.TenlionSMS;
|
||||||
import cn.com.tenlion.operator.util.UserUtil;
|
import cn.com.tenlion.operator.util.UserUtil;
|
||||||
import cn.com.tenlion.operator.util.pay.ALiPay;
|
import cn.com.tenlion.operator.util.pay.ALiPay;
|
||||||
@ -92,6 +96,8 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
private SystemApiPathProperties systemApiPathProperties;
|
private SystemApiPathProperties systemApiPathProperties;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOperatorPluginRemoteService operatorPluginRemoteService;
|
private IOperatorPluginRemoteService operatorPluginRemoteService;
|
||||||
|
@Autowired
|
||||||
|
private UserExpandServiceImpl userExpandServiceImpl;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(AccountRechargeVO accountRechargeVO) {
|
public void save(AccountRechargeVO accountRechargeVO) {
|
||||||
@ -484,6 +490,72 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
return payDTO;
|
return payDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预支付ID
|
||||||
|
*
|
||||||
|
* @param accountRechargeWxPrepayVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AccountRechargeWxPrepayDTO saveWxMiniappPayPrepayId(AccountRechargeWxPrepayVO accountRechargeWxPrepayVO) {
|
||||||
|
String userId = securityComponent.getCurrentUser().getUserId();
|
||||||
|
UserExpandPO po = userExpandServiceImpl.getPO(userId);
|
||||||
|
if (po == null) {
|
||||||
|
throw new SearchException("用户小程序信息不存在");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(po.getWxMiniappOpenId())) {
|
||||||
|
throw new SearchException("用户未绑定微信小程序");
|
||||||
|
}
|
||||||
|
AccountRechargeVO accountRechargeVO = new AccountRechargeVO();
|
||||||
|
accountRechargeVO.setUserId(userId);
|
||||||
|
accountRechargeVO.setThirdParty("微信");
|
||||||
|
accountRechargeVO.setAccountId(userId);
|
||||||
|
accountRechargeVO.setRechargeCheck(RechargeCheckEnum.UN_RECHARGE.getValue());
|
||||||
|
accountRechargeVO.setReconciliationStatus(ReconciliationStatusEnum.UN_RECONCILIATION.getValue());
|
||||||
|
accountRechargeVO.setRechargeMoney(accountRechargeWxPrepayVO.getRechargeMoney());
|
||||||
|
accountRechargeVO.setPackageInfoId(accountRechargeWxPrepayVO.getPackageInfoId());
|
||||||
|
String accountRechargeId = getUUID("wx");
|
||||||
|
Integer totalMoney = PayUtil.buiderMoney(accountRechargeVO.getRechargeMoney());
|
||||||
|
String currentDate = DateUtil.getTime();
|
||||||
|
|
||||||
|
Map<String, Object> params = HashMapUtil.beanToMap(accountRechargeVO);
|
||||||
|
params.put("userId", userId);
|
||||||
|
params.put("rechargeType", RechargeTypeEnum.ONLINE.getValue());
|
||||||
|
params.put("accountRechargeId", accountRechargeId);
|
||||||
|
params.put("rechargeFinalTime", currentDate);
|
||||||
|
params.put("creator", userId);
|
||||||
|
params.put("gmtCreate", currentDate);
|
||||||
|
params.put("modifier", userId);
|
||||||
|
params.put("gmtModified", currentDate);
|
||||||
|
params.put("isDelete", 0);
|
||||||
|
accountRechargeDao.save(params);
|
||||||
|
savePackageInfo(accountRechargeId, accountRechargeVO);
|
||||||
|
return WXPay.createPrepayId(po.getWxMiniappOpenId(), accountRechargeId, totalMoney, ProjectConfigUtil.getText("RechargePayTitle"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存套餐包记录
|
||||||
|
*
|
||||||
|
* @param accountRechargeId
|
||||||
|
* @param accountRechargeVO
|
||||||
|
*/
|
||||||
|
private void savePackageInfo(String accountRechargeId, AccountRechargeVO accountRechargeVO) {
|
||||||
|
// 创建套餐包购买记录
|
||||||
|
if (!StringUtils.isEmpty(accountRechargeVO.getPackageInfoId())) {
|
||||||
|
PackageOrderAppVO appVO = new PackageOrderAppVO();
|
||||||
|
appVO.setPackageInfoId(accountRechargeVO.getPackageInfoId());
|
||||||
|
appVO.setUserId(accountRechargeVO.getUserId());
|
||||||
|
appVO.setAccountRechargeId(accountRechargeId);
|
||||||
|
|
||||||
|
String accessToken = OAuth2ClientTokenManager.getInstance().getToken().getAccessToken();
|
||||||
|
SuccessResultData<String> result = operatorPluginRemoteService.saveOrder(systemApiPathProperties.getOperatorPlugin(), appVO, accessToken);
|
||||||
|
if (!result.getData().equals("Success")) {
|
||||||
|
System.out.println("调用套餐包创建结果 : " + result);
|
||||||
|
throw new SaveException(result.getData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Integer countByUserIdAndRechargeCheck(String userId, RechargeCheckEnum rechargeCheck) {
|
private Integer countByUserIdAndRechargeCheck(String userId, RechargeCheckEnum rechargeCheck) {
|
||||||
Map<String, Object> params = getHashMap(4);
|
Map<String, Object> params = getHashMap(4);
|
||||||
params.put("userId", userId);
|
params.put("userId", userId);
|
||||||
|
Loading…
Reference in New Issue
Block a user