|
@@ -4,6 +4,7 @@ package com.template.controller;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -45,6 +46,7 @@ import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpMethod;
|
|
import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
@@ -1511,7 +1513,6 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
public CommonResult pay(WxPayDto wpd, BindingResult bindingResult, HttpServletRequest request) throws Exception {
|
|
public CommonResult pay(WxPayDto wpd, BindingResult bindingResult, HttpServletRequest request) throws Exception {
|
|
|
- System.out.println(TimeExchange.getTime() + "进入微信支付====");
|
|
|
|
|
System.out.println(TimeExchange.getTime() + "微信支付参数====:" + JSON.toJSON(wpd));
|
|
System.out.println(TimeExchange.getTime() + "微信支付参数====:" + JSON.toJSON(wpd));
|
|
|
String wxCode= request.getHeader("code");
|
|
String wxCode= request.getHeader("code");
|
|
|
if(wxCode==null||wxCode==""){
|
|
if(wxCode==null||wxCode==""){
|
|
@@ -1584,112 +1585,42 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
if (!updateHouseOrder) {
|
|
if (!updateHouseOrder) {
|
|
|
throw new Exception("支付失败!");
|
|
throw new Exception("支付失败!");
|
|
|
}
|
|
}
|
|
|
|
|
+ return CommonResult.ok("支付金额为0,不用走微信支付");
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
throw new Exception("支付失败!");
|
|
throw new Exception("支付失败!");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
//微信支付以分为单位
|
|
//微信支付以分为单位
|
|
|
int totalfee = (wpd.getTotalPrice().multiply(new BigDecimal(100))).intValue();
|
|
int totalfee = (wpd.getTotalPrice().multiply(new BigDecimal(100))).intValue();
|
|
|
|
|
+ //查询是否有未支付订单,有则调用关闭更新支付订单号重新生成支付订单
|
|
|
|
|
+ List<PayRecord> houseOrderId = payRecordService.list(new QueryWrapper<PayRecord>().eq("house_order_id", ho.getId()));
|
|
|
|
|
+ log.info("支付订单houseOrderId=="+houseOrderId.toString());
|
|
|
|
|
+ PayRecord payRecord=houseOrderId.size()>0?houseOrderId.get(0):new PayRecord();
|
|
|
|
|
+ if (StringUtils.hasText(payRecord.getPayNo())){
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.closeOrderById(payRecord.getPayNo());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ return CommonResult.fail("关闭已生成支付订单失败返回:"+e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ payRecord.setPayNo(CommonUtil.generateUUID());
|
|
|
|
|
+ payRecord.setRemark("更新订单");
|
|
|
|
|
+ boolean a =payRecordService.updateById(payRecord);
|
|
|
|
|
+ if (!a){
|
|
|
|
|
+ return CommonResult.fail("生成支付订单失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ payRecord.setPayNo(CommonUtil.generateUUID());
|
|
|
|
|
+ payRecord.setHouseOrderId(ho.getId());
|
|
|
|
|
+ payRecord.setUserId(Integer.valueOf(ho.getPayUserId()));
|
|
|
|
|
+ payRecord.setPayPrice(BigDecimal.valueOf(totalfee));
|
|
|
|
|
+ payRecord.setIsSuccess(1);
|
|
|
|
|
+ payRecord.setRemark("新订单");
|
|
|
|
|
+ boolean a=payRecordService.save(payRecord);
|
|
|
|
|
+ if (!a){
|
|
|
|
|
+ return CommonResult.fail("创建支付订单失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
|
- //设置请求参数;
|
|
|
|
|
- jsonObject.put("appid", wxPayV3Config.getAppId());
|
|
|
|
|
- //设置请求参数(商户号)
|
|
|
|
|
- jsonObject.put("mchid", wxPayV3Config.getMchId());
|
|
|
|
|
- jsonObject.put("description", "公寓");
|
|
|
|
|
-
|
|
|
|
|
- //设置商户订单号
|
|
|
|
|
- jsonObject.put("out_trade_no", ho.getOrderNumber());
|
|
|
|
|
- jsonObject.put("attach", "公寓系统");
|
|
|
|
|
-// 回调地址
|
|
|
|
|
- jsonObject.put("notify_url", wxPayV3Config.getDomain()+"");
|
|
|
|
|
- jsonObject.put("time_expire", DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis() + 1000 * 60 * 3));
|
|
|
|
|
- JSONObject amount = new JSONObject();
|
|
|
|
|
- amount.put("total", totalfee);
|
|
|
|
|
- amount.put("currency", "CNY");
|
|
|
|
|
- jsonObject.put("amount", amount);
|
|
|
|
|
-
|
|
|
|
|
-// jsapi支付需要openid
|
|
|
|
|
- JSONObject payer = new JSONObject();
|
|
|
|
|
- payer.put("openid","o-_-itxuXeGW3O1cxJ7FXNmq8Wf8");
|
|
|
|
|
- jsonObject.put("payer",payer);
|
|
|
|
|
-
|
|
|
|
|
-//h5
|
|
|
|
|
-// JSONObject scene_info = new JSONObject();
|
|
|
|
|
-//// 用户终端ip
|
|
|
|
|
-// scene_info.put("payer_client_ip", "192.168.161.224");
|
|
|
|
|
-// JSONObject h5_info = new JSONObject();
|
|
|
|
|
-// String s = request.getHeader("user-agent");
|
|
|
|
|
-// String type;
|
|
|
|
|
-// if (s.contains("Android")) {
|
|
|
|
|
-// type = "android";
|
|
|
|
|
-// } else if (s.contains("iPhone")) {
|
|
|
|
|
-// type = "ios";
|
|
|
|
|
-// } else {
|
|
|
|
|
-// type = "Wap";
|
|
|
|
|
-// }
|
|
|
|
|
-// h5_info.put("type", type);
|
|
|
|
|
-// scene_info.put("h5_info", h5_info);
|
|
|
|
|
-// jsonObject.put("scene_info", scene_info);
|
|
|
|
|
-
|
|
|
|
|
- // 构建支付订单
|
|
|
|
|
-// UnifiedOrderVO unifiedOrderVO = new UnifiedOrderVO()
|
|
|
|
|
-// .setAppid(wxPayV3Config.getAppId())
|
|
|
|
|
-// .setMchid(wxPayV3Config.getMchId())
|
|
|
|
|
-// .setDescription("智慧公寓")
|
|
|
|
|
-// .setOut_trade_no(ho.getOrderNumber())
|
|
|
|
|
-// .setTime_expire(DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis() + 1000 * 60 * 3)) // 支付订单截至时间
|
|
|
|
|
-// .setNotify_url(wxPayV3Config.getDomain() + "/wechat/pay/resultNoticeForV3")
|
|
|
|
|
-// .setAmount(new UnifiedOrderVO.Amount().setTotal(totalfee))
|
|
|
|
|
-// .setPayer(new UnifiedOrderVO.Payer().setOpenid("o-_-itxuXeGW3O1cxJ7FXNmq8Wf8"));
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // 支付参数转Json字符串
|
|
|
|
|
-// ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
-// mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
|
|
|
-// String body = mapper.writeValueAsString(jsonObject);
|
|
|
|
|
-// String body = mapper.writeValueAsString(unifiedOrderVO);
|
|
|
|
|
-
|
|
|
|
|
- HttpMethod httpMethod = HttpMethod.POST;
|
|
|
|
|
- String urlSuffix = "/v3/pay/transactions/jsapi";
|
|
|
|
|
-//// String urlSuffix = "/v3/pay/transactions/h5";
|
|
|
|
|
-// String certPath = wxPayV3Config.getCertPath();
|
|
|
|
|
-// String platformCertPath = wxPayV3Config.getPlatformCertPath();
|
|
|
|
|
-// String seriaNumber = SecurityUtil.getSerialNumber(certPath);
|
|
|
|
|
- // 签名,获取authStr
|
|
|
|
|
-// String authStr = WechatPayV3Util.buildAuthorization(httpMethod,
|
|
|
|
|
-// urlSuffix,
|
|
|
|
|
-// wxPayV3Config.getMchId(),
|
|
|
|
|
-// seriaNumber,
|
|
|
|
|
-// wxPayV3Config.getKeyPath(),
|
|
|
|
|
-// body);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// JsapiServiceExtension service =
|
|
|
|
|
-// new JsapiServiceExtension.Builder()
|
|
|
|
|
-// .config(config)
|
|
|
|
|
-// .signType("RSA") // 不填默认为RSA
|
|
|
|
|
-// .build();
|
|
|
|
|
- // h5支付
|
|
|
|
|
-// H5Service service = new H5Service.Builder().config(config).build();
|
|
|
|
|
-// PrepayRequest requestpay = new PrepayRequest();
|
|
|
|
|
-// requestpay.setAppid(wxPayV3Config.getAppId());
|
|
|
|
|
-// requestpay.setMchid(wxPayV3Config.getMchId());
|
|
|
|
|
-// requestpay.setDescription("智慧公寓");
|
|
|
|
|
-// Amount amount2 = new Amount();
|
|
|
|
|
-// amount2.setTotal(100);
|
|
|
|
|
-// requestpay.setNotifyUrl(wxPayV3Config.getDomain() + "/wechat/pay/resultNoticeForV3");
|
|
|
|
|
-// requestpay.setAmount(amount2);
|
|
|
|
|
-// SceneInfo sceneInfo=new SceneInfo();
|
|
|
|
|
-// sceneInfo.setPayerClientIp("127.0.0.1");
|
|
|
|
|
-// H5Info h5Info=new H5Info();
|
|
|
|
|
-// h5Info.setType("ios");
|
|
|
|
|
-// sceneInfo.setH5Info(h5Info);
|
|
|
|
|
-// requestpay.setSceneInfo(sceneInfo);
|
|
|
|
|
-// requestpay.setOutTradeNo(wxPayV3Config.getMchId());
|
|
|
|
|
-// service.prepay(requestpay);
|
|
|
|
|
// jsapi支付
|
|
// jsapi支付
|
|
|
//获取openid
|
|
//获取openid
|
|
|
String tokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token";
|
|
String tokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token";
|
|
@@ -1715,7 +1646,7 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
payer1.setOpenid(openId);
|
|
payer1.setOpenid(openId);
|
|
|
requestpay.setPayer(payer1);
|
|
requestpay.setPayer(payer1);
|
|
|
// requestpay.setOutTradeNo(TimeExchange.DateToTimestamp(new Date())+"");
|
|
// requestpay.setOutTradeNo(TimeExchange.DateToTimestamp(new Date())+"");
|
|
|
- requestpay.setOutTradeNo(ho.getOrderNumber());
|
|
|
|
|
|
|
+ requestpay.setOutTradeNo(payRecord.getPayNo());
|
|
|
Config config = new RSAAutoCertificateConfig.Builder()
|
|
Config config = new RSAAutoCertificateConfig.Builder()
|
|
|
.merchantId( wxPayV3Config.getMchId())
|
|
.merchantId( wxPayV3Config.getMchId())
|
|
|
.privateKeyFromPath(wxPayV3Config.getKeyPath())
|
|
.privateKeyFromPath(wxPayV3Config.getKeyPath())
|
|
@@ -1748,11 +1679,12 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
public CommonResult queryOrderById(String outTradeNo) throws Exception{
|
|
public CommonResult queryOrderById(String outTradeNo) throws Exception{
|
|
|
-
|
|
|
|
|
|
|
+ HouseOrder one = houseOrderService.getOne(new QueryWrapper<HouseOrder>().eq("order_number",outTradeNo));
|
|
|
|
|
+ PayRecord payRecord=payRecordService.getOne(new QueryWrapper<PayRecord>().eq("house_order_id",one.getId()));
|
|
|
QueryOrderByOutTradeNoRequest queryOrderByIdRequest = new QueryOrderByOutTradeNoRequest();
|
|
QueryOrderByOutTradeNoRequest queryOrderByIdRequest = new QueryOrderByOutTradeNoRequest();
|
|
|
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
|
|
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
|
|
|
queryOrderByIdRequest.setMchid(wxPayV3Config.getMchId());
|
|
queryOrderByIdRequest.setMchid(wxPayV3Config.getMchId());
|
|
|
- queryOrderByIdRequest.setOutTradeNo(outTradeNo);
|
|
|
|
|
|
|
+ queryOrderByIdRequest.setOutTradeNo(payRecord.getPayNo());
|
|
|
// 调用接口
|
|
// 调用接口
|
|
|
// JsapiService service = new JsapiService.Builder().config(config).build();
|
|
// JsapiService service = new JsapiService.Builder().config(config).build();
|
|
|
log.info("微信支付查询订单入参:"+queryOrderByIdRequest.toString());
|
|
log.info("微信支付查询订单入参:"+queryOrderByIdRequest.toString());
|
|
@@ -1767,8 +1699,14 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
.config(config)
|
|
.config(config)
|
|
|
.signType("RSA") // 不填默认为RSA
|
|
.signType("RSA") // 不填默认为RSA
|
|
|
.build();
|
|
.build();
|
|
|
- Transaction transaction=service.queryOrderByOutTradeNo(queryOrderByIdRequest);
|
|
|
|
|
- log.info("微信支付查询订单出参:"+transaction.toString());
|
|
|
|
|
|
|
+ Transaction transaction= null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ transaction = service.queryOrderByOutTradeNo(queryOrderByIdRequest);
|
|
|
|
|
+ log.info("微信支付查询订单出参:"+transaction.toString());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return CommonResult.fail(e.getMessage());
|
|
|
|
|
+ }
|
|
|
return CommonResult.ok(transaction);
|
|
return CommonResult.ok(transaction);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1781,7 +1719,22 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
- public void closeOrder(String outTradeNo) throws Exception{
|
|
|
|
|
|
|
+ public CommonResult closeOrder(String outTradeNo) {
|
|
|
|
|
+ HouseOrder one = houseOrderService.getOne(new QueryWrapper<HouseOrder>().eq("order_number",outTradeNo));
|
|
|
|
|
+ PayRecord payRecord=payRecordService.getOne(new QueryWrapper<PayRecord>().eq("house_order_id",one.getId()));
|
|
|
|
|
+ if(payRecord==null){
|
|
|
|
|
+ return CommonResult.ok("没有可关闭支付订单,无需关闭");
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.closeOrderById(payRecord.getPayNo());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return CommonResult.fail("关闭订单失败"+e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return CommonResult.ok("关闭成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void closeOrderById(String outTradeNo) throws Exception{
|
|
|
|
|
|
|
|
CloseOrderRequest closeOrderRequest = new CloseOrderRequest();
|
|
CloseOrderRequest closeOrderRequest = new CloseOrderRequest();
|
|
|
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
|
|
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
|
|
@@ -2209,10 +2162,11 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
}else {
|
|
}else {
|
|
|
// 当有金额需要退款时,状态不变,等收到回调后在改变
|
|
// 当有金额需要退款时,状态不变,等收到回调后在改变
|
|
|
houseOrder.setOrderStatus(houseOrder.getOrderStatus());
|
|
houseOrder.setOrderStatus(houseOrder.getOrderStatus());
|
|
|
|
|
+ PayRecord payRecord= payRecordService.getOne(new QueryWrapper<PayRecord>().eq("house_order_id", houseOrder.getId()));
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
//商户订单号;
|
|
//商户订单号;
|
|
|
- jsonObject.put("out_trade_no", orderNumber);
|
|
|
|
|
|
|
+ jsonObject.put("out_trade_no", payRecord.getPayNo()==null?orderNumber:payRecord.getPayNo());
|
|
|
//商户退款单号
|
|
//商户退款单号
|
|
|
jsonObject.put("out_refund_no", refund_no);
|
|
jsonObject.put("out_refund_no", refund_no);
|
|
|
//退款原因
|
|
//退款原因
|
|
@@ -2264,10 +2218,8 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
|
+ return CommonResult.fail(e.getMessage());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return CommonResult.fail();
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -2420,6 +2372,35 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
LambdaQueryWrapper<HouseOrder> wrapper=new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<HouseOrder> wrapper=new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(HouseOrder::getOrderNumber,orderNumber);
|
|
wrapper.eq(HouseOrder::getOrderNumber,orderNumber);
|
|
|
HouseOrder one = houseOrderService.getOne(wrapper);
|
|
HouseOrder one = houseOrderService.getOne(wrapper);
|
|
|
|
|
+ one.setPayPrice(BigDecimal.valueOf(price));
|
|
|
|
|
+ boolean oneFlag=houseOrderService.updateById(one);
|
|
|
|
|
+ if(!oneFlag){
|
|
|
|
|
+ return CommonResult.fail("订单价格修改失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!"1".equals(one.getOrderStatus())){
|
|
|
|
|
+ return CommonResult.fail("订单状态不为待支付");
|
|
|
|
|
+ }
|
|
|
|
|
+ //查询是否有未支付订单,有则调用关闭更新支付订单号重新生成支付订单
|
|
|
|
|
+ List<PayRecord> houseOrderId = payRecordService.list(new QueryWrapper<PayRecord>().eq("house_order_id", one.getId()));
|
|
|
|
|
+ PayRecord payRecord=houseOrderId.size()>0?houseOrderId.get(0):new PayRecord();
|
|
|
|
|
+ if (StringUtils.hasText(payRecord.getPayNo())){
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.closeOrderById(payRecord.getPayNo());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ return CommonResult.fail("关闭已生成支付订单失败返回:"+e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ payRecord.setPayNo(CommonUtil.generateUUID());
|
|
|
|
|
+ payRecord.setRemark("更新订单");
|
|
|
|
|
+ payRecordService.updateById(payRecord);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ payRecord.setPayNo(CommonUtil.generateUUID());
|
|
|
|
|
+ payRecord.setHouseOrderId(one.getId());
|
|
|
|
|
+ payRecord.setUserId(StringUtils.hasText(one.getPayUserId())?Integer.valueOf(one.getPayUserId()):0);
|
|
|
|
|
+ payRecord.setPayPrice(BigDecimal.valueOf(price));
|
|
|
|
|
+ payRecord.setIsSuccess(1);
|
|
|
|
|
+ payRecord.setRemark("新订单");
|
|
|
|
|
+ payRecordService.save(payRecord);
|
|
|
|
|
+ }
|
|
|
Config config =
|
|
Config config =
|
|
|
new RSAAutoCertificateConfig.Builder()
|
|
new RSAAutoCertificateConfig.Builder()
|
|
|
.merchantId(wxPayV3Config.getMchId())
|
|
.merchantId(wxPayV3Config.getMchId())
|
|
@@ -2437,12 +2418,17 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
request.setDescription("测试商品标题");
|
|
request.setDescription("测试商品标题");
|
|
|
amount.setTotal((int) (price*100));
|
|
amount.setTotal((int) (price*100));
|
|
|
request.setAmount(amount);
|
|
request.setAmount(amount);
|
|
|
- request.setOutTradeNo(orderNumber);
|
|
|
|
|
|
|
+ request.setOutTradeNo(payRecord.getPayNo());
|
|
|
request.setNotifyUrl(wxPayV3Config.getDomain()+"/auto/house-order/returnPay");
|
|
request.setNotifyUrl(wxPayV3Config.getDomain()+"/auto/house-order/returnPay");
|
|
|
// 调用下单方法,得到应答
|
|
// 调用下单方法,得到应答
|
|
|
- com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse response = service.prepay(request);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse response = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ response = service.prepay(request);
|
|
|
|
|
+ log.info("CodeUrl()========"+response.getCodeUrl());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return CommonResult.fail(e.getMessage());
|
|
|
|
|
+ }
|
|
|
return CommonResult.ok(response);
|
|
return CommonResult.ok(response);
|
|
|
}
|
|
}
|
|
|
|
|
|