|
|
|
@ -240,6 +240,31 @@ public class OrderController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
//微信支付
|
|
|
|
|
String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8"); |
|
|
|
|
//int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue();
|
|
|
|
|
int total_fee = MathUtils.objectConvertBigDecimal(1).multiply(new BigDecimal("100")).intValue(); |
|
|
|
|
WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo(); |
|
|
|
|
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id
|
|
|
|
|
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号
|
|
|
|
|
weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId()); //商户号
|
|
|
|
|
weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxSubMchId()); //子商户号
|
|
|
|
|
|
|
|
|
|
weChatPayReqInfo.setNonce_str(nonce_str); //随机字符串
|
|
|
|
|
weChatPayReqInfo.setBody("购买商品"); //商品描述
|
|
|
|
|
weChatPayReqInfo.setOut_trade_no(String.valueOf(new Date().getTime())); //商户订单号
|
|
|
|
|
weChatPayReqInfo.setTotal_fee(total_fee); //总金额
|
|
|
|
|
weChatPayReqInfo.setSpbill_create_ip("139.159.177.244"); //终端ip
|
|
|
|
|
weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getNotifyUrl()); //通知url
|
|
|
|
|
weChatPayReqInfo.setTrade_type("MWEB"); //交易类型
|
|
|
|
|
//weChatPayReqInfo.setAttach(map.get("orderScene").toString()); //附加数据,区分订单类型
|
|
|
|
|
Map<String,String> payMap = new HashMap<>(); |
|
|
|
|
payMap.put("app_id",SysConst.getSysConfig().getWxSubAppId()); |
|
|
|
|
payMap.put("api_key",SysConst.getSysConfig().getWxApiKey()); |
|
|
|
|
payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl()); |
|
|
|
|
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap); |
|
|
|
|
return ResponseMsgUtil.success(sortedMap); |
|
|
|
|
/* |
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
param.put("appid", SysConst.getSysConfig().getWxMchAppId()); |
|
|
|
|
param.put("mchid", SysConst.getSysConfig().getWxSubMchId()); |
|
|
|
@ -266,7 +291,7 @@ public class OrderController { |
|
|
|
|
header.put("Authorization", "WECHATPAY2-SHA256-RSA2048 " + post); |
|
|
|
|
|
|
|
|
|
JSONObject object = HttpsUtils.doPost("https://api.mch.weixin.qq.com/v3/pay/transactions/h5", param, header); |
|
|
|
|
return ResponseMsgUtil.success(object); |
|
|
|
|
return ResponseMsgUtil.success(object);*/ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("orderToPay error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|