微信支付
This commit is contained in:
@@ -67,11 +67,21 @@ public class PaymentTransaction extends BaseModel {
|
|||||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("工会id")
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
private String unionId;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("用户工会")
|
@Comment("用户工会")
|
||||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||||
private String unionName;
|
private String unionName;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("单位id")
|
||||||
|
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||||
|
private String unitId;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("用户单位")
|
@Comment("用户单位")
|
||||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import io.v.nutz.base.payment.wxpay.bean.WxPayV3Bean;
|
|||||||
import io.v.nutz.base.payment.wxpay.service.WxPayCommonService;
|
import io.v.nutz.base.payment.wxpay.service.WxPayCommonService;
|
||||||
import io.v.nutz.base.payment.wxpay.vo.WxPayNeedParamVo;
|
import io.v.nutz.base.payment.wxpay.vo.WxPayNeedParamVo;
|
||||||
import io.v.nutz.base.result.Result;
|
import io.v.nutz.base.result.Result;
|
||||||
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.sys.models.User;
|
import io.v.nutz.sys.models.User;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
@@ -157,6 +158,10 @@ public class WxPayCommonServiceImpl implements WxPayCommonService {
|
|||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public Result jsApiPay(WxPayNeedParamVo paramVo) {
|
public Result jsApiPay(WxPayNeedParamVo paramVo) {
|
||||||
try {
|
try {
|
||||||
|
Sys_user user = dao.fetch(Sys_user.class, ShiroUtil.getUserId());
|
||||||
|
if (StrUtil.isBlank(user.getOpenId())) {
|
||||||
|
return Result.error("未获取到当前用户的openid,请重新登录");
|
||||||
|
}
|
||||||
// 商户订单号,存储当前用户的订单
|
// 商户订单号,存储当前用户的订单
|
||||||
String outTradeNo = PayKit.generateStr();
|
String outTradeNo = PayKit.generateStr();
|
||||||
// 订单关闭时间
|
// 订单关闭时间
|
||||||
@@ -170,7 +175,7 @@ public class WxPayCommonServiceImpl implements WxPayCommonService {
|
|||||||
.setAttach(paramVo.getAttach())
|
.setAttach(paramVo.getAttach())
|
||||||
.setNotify_url(payNotifyUrl)
|
.setNotify_url(payNotifyUrl)
|
||||||
.setAmount(paramVo.getAmount())
|
.setAmount(paramVo.getAmount())
|
||||||
.setPayer(paramVo.getPayer());
|
.setPayer(new Payer().setOpenid(user.getOpenId()));
|
||||||
|
|
||||||
log.info("统一下单参数 {}", JSONUtil.toJsonStr(unifiedOrderModel));
|
log.info("统一下单参数 {}", JSONUtil.toJsonStr(unifiedOrderModel));
|
||||||
IJPayHttpResponse response = WxPayApi.v3(
|
IJPayHttpResponse response = WxPayApi.v3(
|
||||||
@@ -195,7 +200,7 @@ public class WxPayCommonServiceImpl implements WxPayCommonService {
|
|||||||
log.info("唤起支付参数:{}", map);
|
log.info("唤起支付参数:{}", map);
|
||||||
// 唤起支付成功,向数据库插入订单参数
|
// 唤起支付成功,向数据库插入订单参数
|
||||||
insertTradingOrder(paramVo, outTradeNo, body);
|
insertTradingOrder(paramVo, outTradeNo, body);
|
||||||
return Result.success(JSONUtil.toJsonStr(map));
|
return Result.success();
|
||||||
}
|
}
|
||||||
// return JSONUtil.toJsonStr(response);
|
// return JSONUtil.toJsonStr(response);
|
||||||
return null;
|
return null;
|
||||||
@@ -575,7 +580,9 @@ public class WxPayCommonServiceImpl implements WxPayCommonService {
|
|||||||
transaction.setUserId(user.getId());
|
transaction.setUserId(user.getId());
|
||||||
transaction.setLoginName(user.getLoginname());
|
transaction.setLoginName(user.getLoginname());
|
||||||
transaction.setUserName(user.getUsername());
|
transaction.setUserName(user.getUsername());
|
||||||
|
transaction.setUnitId(user.getUnitid());
|
||||||
transaction.setUnitName(user.getUnitname());
|
transaction.setUnitName(user.getUnitname());
|
||||||
|
transaction.setUnionId(user.getUnionid());
|
||||||
transaction.setUnionName(user.getUnionname());
|
transaction.setUnionName(user.getUnionname());
|
||||||
transaction.setTradingState(TradingStateEnum.WAITING_FOR_PAYMENT.name());
|
transaction.setTradingState(TradingStateEnum.WAITING_FOR_PAYMENT.name());
|
||||||
// 获取订单金额
|
// 获取订单金额
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package io.v.nutz.base.payment.wxpay.vo;
|
package io.v.nutz.base.payment.wxpay.vo;
|
||||||
|
|
||||||
import com.ijpay.wxpay.model.v3.Amount;
|
import com.ijpay.wxpay.model.v3.Amount;
|
||||||
import com.ijpay.wxpay.model.v3.Payer;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,13 +29,6 @@ public class WxPayNeedParamVo {
|
|||||||
*/
|
*/
|
||||||
private Amount amount;
|
private Amount amount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付者对象,JsApi支付是必填,其他支付方式忽略;
|
|
||||||
* openid 微信绑定的用户openid和小程序的openid相同,必填;
|
|
||||||
* 其余参数可忽略
|
|
||||||
*/
|
|
||||||
private Payer payer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员支付信息ID,必填
|
* 会员支付信息ID,必填
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<!--#
|
|
||||||
layout("/mobile/platform.html"){
|
|
||||||
#-->
|
|
||||||
<div id="app" v-cloak></div>
|
|
||||||
<script>
|
|
||||||
new Vue({
|
|
||||||
el: "#app",
|
|
||||||
mixins: [mobileMixins],
|
|
||||||
data() {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<!--#
|
|
||||||
}
|
|
||||||
#-->
|
|
||||||
Reference in New Issue
Block a user