|
@@ -1,18 +1,23 @@
|
|
|
package com.example.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.example.base.*;
|
|
|
+import com.example.base.BaseController;
|
|
|
+import com.example.base.ResponseBase;
|
|
|
+import com.example.base.ResultVO;
|
|
|
import com.example.entity.OmsOrder;
|
|
|
import com.example.entity.RefundOrder;
|
|
|
import com.example.entity.WxPayFrom;
|
|
|
import com.example.enums.PayStatusEnum;
|
|
|
import com.example.enums.ResultEnum;
|
|
|
-import com.example.util.GeneratorIdUtils;
|
|
|
import com.example.util.RedisUtil;
|
|
|
+import com.example.util.SnowFlake;
|
|
|
import com.example.util.UUIDUtils;
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
|
|
-import com.github.binarywang.wxpay.bean.request.*;
|
|
|
+import com.github.binarywang.wxpay.bean.request.WxPayMicropayRequest;
|
|
|
+import com.github.binarywang.wxpay.bean.request.WxPayOrderQueryRequest;
|
|
|
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
|
|
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
|
import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult;
|
|
|
import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
|
|
|
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
|
@@ -73,7 +78,7 @@ public class WechatH5PayController extends BaseController {
|
|
|
String productName = "测试商品";
|
|
|
orderRequest.setBody(productName);
|
|
|
//商户订单号(支付编号)
|
|
|
-// GeneratorIdUtils generatorIdUtils = new GeneratorIdUtils();
|
|
|
+// SnowFlake generatorIdUtils = new SnowFlake(2,3);
|
|
|
// String orderNum = generatorIdUtils.nextId();
|
|
|
// log.info("orderNum:" + orderNum);
|
|
|
//设置商户订单号
|
|
@@ -243,8 +248,8 @@ public class WechatH5PayController extends BaseController {
|
|
|
public ResponseBase refundOrder(@RequestBody RefundOrder refundOrder) {
|
|
|
WxPayRefundRequest refundRequest = new WxPayRefundRequest();
|
|
|
try {
|
|
|
- GeneratorIdUtils generatorIdUtils = new GeneratorIdUtils();
|
|
|
- String refundNo = generatorIdUtils.nextId();
|
|
|
+ SnowFlake generatorIdUtils = new SnowFlake(2,3);
|
|
|
+ String refundNo = generatorIdUtils.nextId()+"";
|
|
|
refundRequest.setOutTradeNo(refundOrder.getOrderId());
|
|
|
refundRequest.setOutRefundNo(refundNo);
|
|
|
refundRequest.setRefundDesc(refundOrder.getRefundDesc());
|
|
@@ -350,8 +355,8 @@ public class WechatH5PayController extends BaseController {
|
|
|
String productName = "测试商品";
|
|
|
orderRequest.setBody(productName);
|
|
|
//商户订单号(支付编号)
|
|
|
- GeneratorIdUtils generatorIdUtils = new GeneratorIdUtils();
|
|
|
- String orderNum = generatorIdUtils.nextId();
|
|
|
+ SnowFlake generatorIdUtils = new SnowFlake(2,3);
|
|
|
+ String orderNum = generatorIdUtils.nextId()+"";
|
|
|
log.info("OutTradeNo:" + orderNum);
|
|
|
//设置商户订单号
|
|
|
orderRequest.setOutTradeNo(orderNum);
|
|
@@ -405,8 +410,8 @@ public class WechatH5PayController extends BaseController {
|
|
|
//商品描述
|
|
|
orderRequest.setBody("测试商品!");
|
|
|
//商户订单号(支付编号)
|
|
|
- GeneratorIdUtils generatorIdUtils = new GeneratorIdUtils();
|
|
|
- String orderNum = generatorIdUtils.nextId();
|
|
|
+ SnowFlake generatorIdUtils = new SnowFlake(2,3);
|
|
|
+ String orderNum = generatorIdUtils.nextId()+"";
|
|
|
log.info("OutTradeNo:" + orderNum);
|
|
|
//设置商户订单号
|
|
|
orderRequest.setOutTradeNo(orderNum);
|