整数金额优化
This commit is contained in:
parent
1a53f0a436
commit
ba156e72ff
|
|
@ -53,6 +53,7 @@ public class ApiWxPayController extends BaseController {
|
||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WxPayService wxService;
|
private WxPayService wxService;
|
||||||
|
|
||||||
@PostMapping("/notify/order")
|
@PostMapping("/notify/order")
|
||||||
public String parseOrderNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
public String parseOrderNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
||||||
|
|
||||||
|
|
@ -84,27 +85,28 @@ public class ApiWxPayController extends BaseController {
|
||||||
// TODO 根据自己业务场景需要构造返回对象
|
// TODO 根据自己业务场景需要构造返回对象
|
||||||
return WxPayNotifyResponse.success( "成功" );
|
return WxPayNotifyResponse.success( "成功" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用统一下单接口,并组装生成支付所需参数对象.
|
* 调用统一下单接口,并组装生成支付所需参数对象.
|
||||||
*
|
*
|
||||||
* @param request 统一下单请求参数
|
* @param request 统一下单请求参数
|
||||||
* @param <T> 请使用{@link com.github.binarywang.wxpay.bean.order}包下的类
|
* @param <T> 请使用{@link com.github.binarywang.wxpay.bean.order}包下的类
|
||||||
* @return 返回 {@link com.github.binarywang.wxpay.bean.order}包下的类对象
|
* @return 返回 {@link com.github.binarywang.wxpay.bean.order}包下的类对象
|
||||||
*
|
* <p>
|
||||||
* 示例参数
|
* 示例参数
|
||||||
* {
|
* {
|
||||||
"body":"测试商品",
|
* "body":"测试商品",
|
||||||
"outTradeNo":"12344324242342342342554",
|
* "outTradeNo":"12344324242342342342554",
|
||||||
"totalFee":1.01,
|
* "totalFee":1.01,
|
||||||
"spbillCreateIp":"1.80.82.241",
|
* "spbillCreateIp":"1.80.82.241",
|
||||||
"notifyUrl":"http://www.baidu.com",
|
* "notifyUrl":"http://www.baidu.com",
|
||||||
"tradeType":"NATIVE",
|
* "tradeType":"NATIVE",
|
||||||
"productId":"13652b4a71df2f49e3647c55c8e31a88"
|
* "productId":"13652b4a71df2f49e3647c55c8e31a88"
|
||||||
}
|
* }
|
||||||
返回
|
* 返回
|
||||||
{
|
* {
|
||||||
"codeUrl": "weixin://wxpay/bizpayurl?pr=pK0R74G"
|
* "codeUrl": "weixin://wxpay/bizpayurl?pr=pK0R74G"
|
||||||
}
|
* }
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "统一下单,并组装所需支付参数")
|
@ApiOperation(value = "统一下单,并组装所需支付参数")
|
||||||
@PostMapping("/createOrder")
|
@PostMapping("/createOrder")
|
||||||
|
|
@ -116,7 +118,7 @@ public class ApiWxPayController extends BaseController {
|
||||||
userOrders.setId( request.getOutTradeNo() );
|
userOrders.setId( request.getOutTradeNo() );
|
||||||
userOrders.setVipUserId( Integer.parseInt( request.getOpenid() ) );
|
userOrders.setVipUserId( Integer.parseInt( request.getOpenid() ) );
|
||||||
userOrders.setTrainCourseId( Integer.parseInt( request.getProductId() ) );
|
userOrders.setTrainCourseId( Integer.parseInt( request.getProductId() ) );
|
||||||
userOrders.setPrice(new BigDecimal(request.getTotalFee().intValue()/100));
|
userOrders.setPrice( new BigDecimal( request.getTotalFee().intValue() ).divide( new BigDecimal( 100 ) ) );
|
||||||
//未支付订单
|
//未支付订单
|
||||||
userOrders.setDelFlag( "0" );
|
userOrders.setDelFlag( "0" );
|
||||||
vipUserOrdersService.insert( userOrders );
|
vipUserOrdersService.insert( userOrders );
|
||||||
|
|
@ -133,19 +135,19 @@ public class ApiWxPayController extends BaseController {
|
||||||
* @param request 请求对象,注意一些参数如appid、mchid等不用设置,方法内会自动从配置对象中获取到(前提是对应配置中已经设置)
|
* @param request 请求对象,注意一些参数如appid、mchid等不用设置,方法内会自动从配置对象中获取到(前提是对应配置中已经设置)
|
||||||
* 示例参数
|
* 示例参数
|
||||||
* {
|
* {
|
||||||
"body":"测试商品",
|
* "body":"测试商品",
|
||||||
"outTradeNo":"12344324242342342342554",
|
* "outTradeNo":"12344324242342342342554",
|
||||||
"totalFee":1.01,
|
* "totalFee":1.01,
|
||||||
"spbillCreateIp":"1.80.82.241",
|
* "spbillCreateIp":"1.80.82.241",
|
||||||
"notifyUrl":"http://www.baidu.com",
|
* "notifyUrl":"http://www.baidu.com",
|
||||||
"tradeType":"JSAPI",
|
* "tradeType":"JSAPI",
|
||||||
"productId":"13652b4a71df2f49e3647c55c8e31a88"
|
* "productId":"13652b4a71df2f49e3647c55c8e31a88"
|
||||||
"openid":''
|
* "openid":''
|
||||||
}
|
* }
|
||||||
返回
|
* 返回
|
||||||
{
|
* {
|
||||||
"codeUrl": "weixin://wxpay/bizpayurl?pr=pK0R74G"
|
* "codeUrl": "weixin://wxpay/bizpayurl?pr=pK0R74G"
|
||||||
}
|
* }
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "原生的统一下单接口")
|
@ApiOperation(value = "原生的统一下单接口")
|
||||||
@PostMapping("/unifiedOrder")
|
@PostMapping("/unifiedOrder")
|
||||||
|
|
@ -158,7 +160,7 @@ public class ApiWxPayController extends BaseController {
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
userOrders.setVipUserId( sysUser.getUserId().intValue() );
|
userOrders.setVipUserId( sysUser.getUserId().intValue() );
|
||||||
userOrders.setTrainCourseId( Integer.parseInt( request.getProductId() ) );
|
userOrders.setTrainCourseId( Integer.parseInt( request.getProductId() ) );
|
||||||
userOrders.setPrice(new BigDecimal(request.getTotalFee().intValue()/100));
|
userOrders.setPrice( new BigDecimal( request.getTotalFee().intValue() ).divide( new BigDecimal( 100 ) ) );
|
||||||
//未支付订单
|
//未支付订单
|
||||||
userOrders.setDelFlag( "0" );
|
userOrders.setDelFlag( "0" );
|
||||||
vipUserOrdersService.insert( userOrders );
|
vipUserOrdersService.insert( userOrders );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue