payermax-梳理ChargeController
This commit is contained in:
@@ -53,10 +53,11 @@ public class PayerMaxStrategy extends AbstractPayStrategy {
|
||||
params.setPaymentDetail(paymentDetail);
|
||||
CreateOrderResDTO orderRes = payermaxService.createOrder(params);
|
||||
chargeRecord.setPingxxChargeId(orderRes.getData().getTradeNo());
|
||||
|
||||
Map<String, Object> appMap = new HashMap<>();
|
||||
appMap.put(PayConstant.H5_PAY_URL_FIELD, orderRes.getData().getRequestUrl());
|
||||
appMap.put(PayConstant.H5_PAY_NICK_FIELD, context.getNick());
|
||||
appMap.put(PayConstant.H5_PAY_ERBANNO_FIELD, context.getErbanNo());
|
||||
//appMap.put(PayConstant.H5_PAY_NICK_FIELD, context.getNick());
|
||||
//appMap.put(PayConstant.H5_PAY_ERBANNO_FIELD, context.getErbanNo());
|
||||
return appMap;
|
||||
}
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -67,8 +68,6 @@ public class ChargeService extends BaseService {
|
||||
@Autowired
|
||||
private RocketMQService rocketMQService;
|
||||
@Autowired
|
||||
private SysConfService sysConfService;
|
||||
@Autowired
|
||||
private LuckyTarotRecordService luckyTarotRecordService;
|
||||
@Autowired
|
||||
private LuckyTarotChargeService luckyTarotChargeService;
|
||||
@@ -83,22 +82,6 @@ public class ChargeService extends BaseService {
|
||||
@Autowired
|
||||
private UserVipInfoService userVipInfoService;
|
||||
|
||||
/**
|
||||
* 接入支付寶/微信支付
|
||||
*
|
||||
* @param clientIp
|
||||
* @param app
|
||||
* @param roomUid
|
||||
* @param chargeMoney
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Object applyCharge3(Long uid, String chargeProdId, String channel, String clientIp, String successUrl, String openId, String app, Long roomUid, Integer chargeMoney){
|
||||
DeviceInfo deviceInfo = new DeviceInfo();
|
||||
deviceInfo.setApp(app);
|
||||
return applyChargeV4(uid, chargeProdId, channel, clientIp, successUrl, openId, deviceInfo, roomUid, chargeMoney, null, null);
|
||||
}
|
||||
|
||||
@CancelUidTag(paramName = {"uid"})
|
||||
public Object applyChargeV4(Long uid, String chargeProdId, String channel, String clientIp,
|
||||
String successUrl, String openId, DeviceInfo deviceInfo, Long roomUid, Integer chargeMoney,
|
||||
@@ -112,8 +95,8 @@ public class ChargeService extends BaseService {
|
||||
// 處理自定義充值金額的產品構建
|
||||
if (Constant.ChargeProdChannel.custom_charge.equals(chargeProd.getChannel())) {
|
||||
chargeProd.setMoney((long) chargeMoney);
|
||||
long goldNum = new BigDecimal(chargeMoney).multiply(new BigDecimal(chargeProd.getChangeGoldRate()))
|
||||
.setScale(0, BigDecimal.ROUND_DOWN).longValue();
|
||||
long goldNum = BigDecimal.valueOf(chargeMoney).multiply(BigDecimal.valueOf(chargeProd.getChangeGoldRate()))
|
||||
.setScale(0, RoundingMode.DOWN).longValue();
|
||||
chargeProd.setChargeGoldNum(goldNum);
|
||||
}
|
||||
|
||||
|
@@ -66,10 +66,10 @@ public class ChargeController extends BaseController {
|
||||
* */
|
||||
@PostMapping(value = "apply2New")
|
||||
public BusiResult<Object> applyH5ChargeNew(HttpServletRequest request,
|
||||
@NotBlank(message = "交易产品 id 不可为空") String chargeProdId,
|
||||
@NotBlank(message = "支付渠道不可为空") String payChannel,
|
||||
String successUrl, String openId, String phone, Long erbanNo, Integer chargeMoney,
|
||||
String paymentType, String countryCode) {
|
||||
@NotBlank(message = "交易产品 id 不可为空") String chargeProdId,
|
||||
String openId, String phone, Long erbanNo, Integer chargeMoney,
|
||||
String successUrl, String paymentType, String countryCode) {
|
||||
Users users;
|
||||
if (phone != null ) {
|
||||
users = usersBaseService.getUsersByPhone(phone);
|
||||
@@ -83,27 +83,16 @@ public class ChargeController extends BaseController {
|
||||
if (null == users) {
|
||||
return new BusiResult<>(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
BusiResult<Object> result = applyCharge3(request, users.getUid(), chargeProdId, payChannel, successUrl, openId, null, chargeMoney, paymentType, countryCode);
|
||||
if (result.getCode() == BusiStatus.SUCCESS.value()) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("payInfo", result.getData());
|
||||
data.put("nick", users.getNick());
|
||||
data.put("erbanNo", users.getErbanNo());
|
||||
result.setData(data);
|
||||
}
|
||||
return result;
|
||||
|
||||
String clientIp = IPUtils.getRealIpAddress(request);
|
||||
DeviceInfo deviceInfo = getDeviceInfo(request);
|
||||
Object result = chargeService.applyChargeV4(users.getUid(), chargeProdId, payChannel,
|
||||
clientIp, successUrl, openId, deviceInfo,
|
||||
null, chargeMoney, paymentType, countryCode);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("payInfo", result);
|
||||
return BusiResult.success(data);
|
||||
}
|
||||
|
||||
@PostMapping(value = "pay/apply")
|
||||
public BusiResult<Object> applyCharge3(HttpServletRequest request, Long uid, String chargeProdId,
|
||||
@NotBlank(message = "支付渠道不可为空") String payChannel, String successUrl,
|
||||
@RequestParam(value = "openId", required = false) String openId, Long roomUid, Integer chargeMoney,
|
||||
String paymentType, String countryCode) {
|
||||
log.info("applyCharge3,uid:{},chargeProdId:{},payChannel:{}, roomUid:{}, paymentType:{}, countryCode:{}",
|
||||
uid,chargeProdId,payChannel, roomUid, paymentType, countryCode);
|
||||
DeviceInfo deviceInfo = getDeviceInfo(request);
|
||||
String clientIp = IPUtils.getRealIpAddress(request);
|
||||
Object result = chargeService.applyChargeV4(uid, chargeProdId, payChannel, clientIp, successUrl, openId, deviceInfo, roomUid, chargeMoney, paymentType, countryCode);
|
||||
return new BusiResult<>(result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user