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