|
@@ -5,6 +5,7 @@ import com.caimei365.order.components.WeChatService;
|
|
|
import com.caimei365.order.mapper.PayOrderMapper;
|
|
|
import com.caimei365.order.model.ResponseJson;
|
|
|
import com.caimei365.order.model.bo.PayParamBo;
|
|
|
+import com.caimei365.order.model.bo.VipRecordBo;
|
|
|
import com.caimei365.order.model.dto.PaySecondDto;
|
|
|
import com.caimei365.order.model.dto.PayVipDto;
|
|
|
import com.caimei365.order.model.po.SplitAccountPo;
|
|
@@ -312,8 +313,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
* 升级超级会员-微信线上支付
|
|
|
*
|
|
|
* @param payVipDto {
|
|
|
- * userId 用户Id
|
|
|
- * vipId 会员套餐Id
|
|
|
+ * vipRecordId 会员购买记录Id
|
|
|
* returnUrl 页面回调地址
|
|
|
* code 微信小程序code
|
|
|
* state 微信公众号state参数
|
|
@@ -330,8 +330,12 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
return ResponseJson.error(jsonParam.getMsg(), null);
|
|
|
}
|
|
|
PayParamBo payParam = jsonParam.getData();
|
|
|
+ // 获取会员套餐记录
|
|
|
+ VipRecordBo record = payOrderMapper.getVipPackageRecord(payParam.getVipRecordId());
|
|
|
+ payParam.setVipId(record.getPackageId());
|
|
|
+ payParam.setUserId(record.getUserId());
|
|
|
// 获取会员套餐价格
|
|
|
- Double price = payOrderMapper.getVipPackagePriceById(payParam.getVipId());
|
|
|
+ Double price = payOrderMapper.getVipPackagePriceById(record.getPackageId());
|
|
|
payParam.setPayAmount(MathUtil.mul(price, 100).intValue());
|
|
|
payParam.setNotifyUrl(superVipUrl);
|
|
|
log.info("【升级超级会员微信支付】>>>>>>>>>>>vipId:" + payParam.getVipId()+",获取openId:" + payParam.getOpenId());
|
|
@@ -342,8 +346,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
* 升级超级会员-支付宝线上支付
|
|
|
*
|
|
|
* @param payVipDto {
|
|
|
- * userId 用户Id
|
|
|
- * vipId 会员套餐Id
|
|
|
+ * vipRecordId 会员购买记录Id
|
|
|
* returnUrl 页面回调地址
|
|
|
* }
|
|
|
* @param headers
|
|
@@ -356,8 +359,12 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
//支付宝支付
|
|
|
payParam.setPayWay("ALIPAY");
|
|
|
payParam.setPayType("ALIPAY_H5");
|
|
|
+ // 获取会员套餐记录
|
|
|
+ VipRecordBo record = payOrderMapper.getVipPackageRecord(payParam.getVipRecordId());
|
|
|
+ payParam.setVipId(record.getPackageId());
|
|
|
+ payParam.setUserId(record.getUserId());
|
|
|
// 获取会员套餐价格
|
|
|
- Double price = payOrderMapper.getVipPackagePriceById(payParam.getVipId());
|
|
|
+ Double price = payOrderMapper.getVipPackagePriceById(record.getPackageId());
|
|
|
payParam.setPayAmount(MathUtil.mul(price, 100).intValue());
|
|
|
payParam.setNotifyUrl(superVipUrl);
|
|
|
log.info("【升级超级会员支付宝支付】>>>>>>>>>>>vipId:" + payParam.getVipId());
|
|
@@ -368,8 +375,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
* 升级超级会员-银联线上支付
|
|
|
*
|
|
|
* @param payVipDto {
|
|
|
- * userId 用户Id
|
|
|
- * vipId 会员套餐Id
|
|
|
+ * vipRecordId 会员购买记录Id
|
|
|
* returnUrl 页面回调地址
|
|
|
* bankCode 银行编码(银联支付使用)
|
|
|
* userType 用户类型(银联支付使用)企业:ENTERPRISE,个人:USER
|
|
@@ -384,8 +390,12 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
// 银联支付
|
|
|
payParam.setPayWay("UNIONPAY");
|
|
|
payParam.setPayType("GATEWAY_UNIONPAY");
|
|
|
+ // 获取会员套餐记录
|
|
|
+ VipRecordBo record = payOrderMapper.getVipPackageRecord(payParam.getVipRecordId());
|
|
|
+ payParam.setVipId(record.getPackageId());
|
|
|
+ payParam.setUserId(record.getUserId());
|
|
|
// 获取会员套餐价格
|
|
|
- Double price = payOrderMapper.getVipPackagePriceById(payParam.getVipId());
|
|
|
+ Double price = payOrderMapper.getVipPackagePriceById(record.getPackageId());
|
|
|
payParam.setPayAmount(MathUtil.mul(price, 100).intValue());
|
|
|
payParam.setNotifyUrl(superVipUrl);
|
|
|
log.info("【升级超级会员银联线上支付】>>>>>>>>>>>vipId:" + payParam.getVipId());
|
|
@@ -412,12 +422,12 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
environment = "BETA";
|
|
|
}
|
|
|
// 商户订单号
|
|
|
- String orderId = payParam.getUserId() + "V" + payParam.getVipId() + "T" + time + environment;
|
|
|
+ String orderId = payParam.getUserId()+ "R" + payParam.getVipRecordId() + "V" + payParam.getVipId() + "T" + time + environment;
|
|
|
json.put("orderId", orderId);
|
|
|
//商品名称
|
|
|
String product = "采美订单" + orderId;
|
|
|
json.put("product", product);
|
|
|
- String attach = payParam.getVipId() + "," + payParam.getPayType()+ "," + payParam.getUserId();
|
|
|
+ String attach = payParam.getVipId() + "," + payParam.getPayType()+ "," + payParam.getUserId() + "," + payParam.getVipRecordId();
|
|
|
json.put("attach", attach);
|
|
|
// 升级超级会员默认公账
|
|
|
List<Map<String, String>> list = new ArrayList<>();
|
|
@@ -505,7 +515,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
return "支付失败";
|
|
|
}
|
|
|
log.info("【升级超级会员异步回调】>>>>>>>>>>>>>>本次支付金额:" + amount);
|
|
|
- // 附加数据,支付时若有传输则原样返回(vipId,payType,userId),下单时为空,则不返回该数据
|
|
|
+ // 附加数据,支付时若有传输则原样返回(vipId,payType,userId,recordId),下单时为空,则不返回该数据
|
|
|
String attach = json.getString("attach");
|
|
|
String[] split = attach.split(",");
|
|
|
// 会员套餐Id
|
|
@@ -514,6 +524,8 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
String payType = split[1];
|
|
|
// 用户Id
|
|
|
Integer userId = Integer.valueOf(split[2]);
|
|
|
+ // 购买历史记录Id
|
|
|
+ Integer recordId = Integer.valueOf(split[3]);
|
|
|
// 金额
|
|
|
double payAmount = amount.doubleValue();
|
|
|
String payFormData = json.toJSONString();
|