2 Commits c77171d48a ... 1654824fd0

Author SHA1 Message Date
  zhanghui 1654824fd0 feat:微信支付 3 months ago
  zhanghui 5eae1db235 feat:微信支付 3 months ago

+ 1 - 1
src/main/java/org/springblade/common/enums/OrderStateEnum.java

@@ -8,7 +8,7 @@ import lombok.Getter;
 @Getter
 public enum OrderStateEnum {
 	WAIT_PAY("待付款", 1),
-	WAIT_DELIVERY("待货", 2),
+	WAIT_DELIVERY("待货", 2),
 	WAIT_RECEIVE("待收货", 3),
 	COMPLETED("已完成", 4),
 	CANCEL("已取消", 5),

+ 2 - 0
src/main/java/org/springblade/modules/api/controller/ApiOrderGoodsController.java

@@ -75,6 +75,8 @@ public class ApiOrderGoodsController {
         OrderGoodsVO orderGoodsVO = OrderGoodsWrapper.build().entityVO(orderGoods);
         orderGoodsVO.setOrderState(order.getOrderState());
         orderGoodsVO.setOrderNo(order.getOrderNo());
+        orderGoodsVO.setPaymentMode(order.getPaymentMode());
+        orderGoodsVO.setIsAfterSales(order.getIsAftersales());
         orderGoodsVO.setPaymentAmount(order.getPaymentAmount());
         orderGoodsVO.setTotalAmount(order.getTotalAmount());
         orderGoodsVO.setDiscountAmount(order.getDiscountAmount());

+ 21 - 21
src/main/java/org/springblade/modules/api/controller/WxPayController.java

@@ -131,29 +131,29 @@ public class WxPayController extends BladeController {
     @ApiOperationSupport(order = 2)
     @ApiOperation(value = "jspai下单API", notes = "jspai下单API")
     public R jsapiPay(@ApiParam(value = "订单号", required = true) @RequestParam String orderNo,
-                      @ApiParam(value = "openid", required = true) @RequestParam String openid) {
+                      @ApiParam(value = "openid", required = true) @RequestParam String openId) {
         try {
-            Order order = orderService.getByOrderNo(orderNo);
-            if (OrderTypeEnum.NORMAL.getValue().equals(order.getOrderType())) {
-                // 判断团购是否结束
-                OrderGroupon orderGroupon = orderGrouponService.lambdaQuery().eq(OrderGroupon::getOrderId, order.getId()).one();
-                Groupon groupon = grouponService.getById(orderGroupon.getGrouponId());
-                if (groupon.getGrouponEndTime().isBefore(LocalDateTime.now())) {
-                    // 团购已结束则取消订单
-                    orderService.orderCancel(order.getId());
-                    return R.fail("团购已结束!");
-                }
-            }
+//            Order order = orderService.getByOrderNo(orderNo);
+//            if (OrderTypeEnum.NORMAL.getValue().equals(order.getOrderType())) {
+//                // 判断团购是否结束
+//                OrderGroupon orderGroupon = orderGrouponService.lambdaQuery().eq(OrderGroupon::getOrderId, order.getId()).one();
+//                Groupon groupon = grouponService.getById(orderGroupon.getGrouponId());
+//                if (groupon.getGrouponEndTime().isBefore(LocalDateTime.now())) {
+//                    // 团购已结束则取消订单
+//                    orderService.orderCancel(order.getId());
+//                    return R.fail("团购已结束!");
+//                }
+//            }
             boolean profitSharing = false;
-            DistributionConfig config = distributionConfigService.lambdaQuery().one();
-            // 是否开启分销
-            if (config != null && config.getIsOpen()) {
-                // 查询用户是否有绑定上级
-                Embers embers = embersService.lambdaQuery().eq(Embers::getBindUserId, order.getUserId())
-                        .eq(Embers::getState,0).one();
-                profitSharing = embers != null;
-            }
-            Map<String, Object> map = this.generalOrder(WxApiType.JS_API_PAY, orderNo, openid, profitSharing);
+//            DistributionConfig config = distributionConfigService.lambdaQuery().one();
+//            // 是否开启分销
+//            if (config != null && config.getIsOpen()) {
+//                // 查询用户是否有绑定上级
+//                Embers embers = embersService.lambdaQuery().eq(Embers::getBindUserId, order.getUserId())
+//                        .eq(Embers::getState,0).one();
+//                profitSharing = embers != null;
+//            }
+            Map<String, Object> map = this.generalOrder(WxApiType.JS_API_PAY, orderNo, openId, profitSharing);
             return R.data(map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);

+ 2 - 1
src/main/java/org/springblade/modules/finance/mapper/OrderGoodsMapper.xml

@@ -81,7 +81,8 @@
             o.order_state,
             o.is_aftersales,
             o.total_amount,
-            o.payment_amount
+            o.payment_amount,
+            o.payment_mode
         FROM
             t_order o
             JOIN t_order_goods og ON o.id = og.order_id

+ 2 - 3
src/main/java/org/springblade/modules/finance/service/impl/OrderGoodsServiceImpl.java

@@ -96,10 +96,9 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
 		order.setUserId(request.getUserId());
 		// 订单总金额
 		order.setTotalAmount(cargoWay.getSalePrice().multiply(BigDecimal.valueOf(request.getGoodsNum())));
+		order.setDiscountAmount(BigDecimal.valueOf(cargoWay.getDiscount()).multiply(BigDecimal.valueOf(request.getGoodsNum())));
 		// 实付金额
-		BigDecimal payAmount = cargoWay.getSalePrice().multiply(BigDecimal.valueOf(cargoWay.getDiscount())).multiply(BigDecimal.valueOf(request.getGoodsNum()));
-		order.setPaymentAmount(payAmount);
-		order.setDiscountAmount(order.getTotalAmount().subtract(order.getPaymentAmount()));
+		order.setPaymentAmount(order.getTotalAmount().subtract(order.getDiscountAmount()));
 		order.setConsignee(user.getName());
 		order.setConsigneePhoneNumber(user.getPhone());
 		iOrderService.save(order);

+ 8 - 8
src/main/resources/application-dev.yml

@@ -58,19 +58,19 @@ oss:
   secret-key: 12345678
   bucket-name: bladex-dev
 wxpay:
-  fileRootPath: D:\workspace\groupon-api\src\main\resources\cert\
+  fileRootPath: D:\vending-machine-api\src\main\resources\cert\
   v3:
-    appId: wxb36cbb868a7d2d68
+    appId:
     appIdxcx: wxb36cbb868a7d2d68
     appSecretxcx: cf59d9b3f9030b9c601d29f2c957f70e
     keyPath: ${wxpay.fileRootPath}apiclient_key.pem
     certPath: ${wxpay.fileRootPath}apiclient_cert.pem
-    certP12Path: ${wxpay.fileRootPath}cert/apiclient_cert.p12
+    certP12Path: ${wxpay.fileRootPath}apiclient_cert.p12
     platformCertPath: ${wxpay.fileRootPath}wx_cert.pem
-    mchId: 1646838858
-    apiKey3: Dg0naaFoDj6vcd47n5DkM6DVkLKDr91B
-    apiKey: 89e3e5afd8623772bf5a56f460af839a
-    domain: http://65i1sxopd9qp.ngrok.xiaomiqiu123.top/
+    mchId: 1682199743
+    apiKey3: eccd49c1e92640f0a127e74518cc5f25
+    apiKey: 30dffa037fe542df90bd71ca66088690
+    domain: http://u2mu3zixu5wm.ngrok.xiaomiqiu123.top/
 
 
 apk:
@@ -79,4 +79,4 @@ apk:
   logPath: /Users/pangqijun/Downloads/store/apklog/
 
 captcha:
-  length: 1
+  length: 1

+ 6 - 6
src/main/resources/application-test.yml

@@ -43,19 +43,19 @@ blade:
 
 
 wxpay:
-  fileRootPath: /data/cert/wx/
+  fileRootPath: /data/vend/cert/wx/
   v3:
     appId: wxb36cbb868a7d2d68
     appIdxcx: wxb36cbb868a7d2d68
     appSecretxcx: cf59d9b3f9030b9c601d29f2c957f70e
     keyPath: ${wxpay.fileRootPath}apiclient_key.pem
     certPath: ${wxpay.fileRootPath}apiclient_cert.pem
-    certP12Path: ${wxpay.fileRootPath}cert/apiclient_cert.p12
+    certP12Path: ${wxpay.fileRootPath}apiclient_cert.p12
     platformCertPath: ${wxpay.fileRootPath}wx_cert.pem
-    mchId: 1646838858
-    apiKey3: Dg0naaFoDj6vcd47n5DkM6DVkLKDr91B
-    apiKey: 89e3e5afd8623772bf5a56f460af839a
-    domain: https://test.changgengkeji.com/api
+    mchId: 1682199743
+    apiKey3: eccd49c1e92640f0a127e74518cc5f25
+    apiKey: 30dffa037fe542df90bd71ca66088690
+    domain: https://sellwine.gzzzyd.com/api/
 
 alipay:
   fileRootPath: /data/cert/alipay/

BIN
src/main/resources/cert/apiclient_cert.p12


+ 25 - 0
src/main/resources/cert/apiclient_cert.pem

@@ -0,0 +1,25 @@
+-----BEGIN CERTIFICATE-----
+MIIEKDCCAxCgAwIBAgIUTo+dwmoVj9jiVcAott/7zxYaxdMwDQYJKoZIhvcNAQEL
+BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
+FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
+Q0EwHhcNMjQwODA2MDIwMDA1WhcNMjkwODA1MDIwMDA1WjCBgTETMBEGA1UEAwwK
+MTY4MjE5OTc0MzE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YsOwvZvHsgA1s5i6URkVyBpBjJYZIsp
+sxyEDXo/8OIjQzZ/gfZxmPHKBnNwO4ZoCoam8EcA+jI71yaDF+6KI6co1matE+w/
+L8dpIelJ5KfqfnUL
+-----END CERTIFICATE-----

+ 28 - 0
src/main/resources/cert/apiclient_key.pem

@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDO98yOFs0piJpc
+IIbIoTuKphIMI2LnlqUrjmduusRvXyC5WekjBkMj5cRgZmM2P6RsEciF0eyR2P8x
+6AUo9DMw9vIQ9sCWgSW0fISzkdci0ncM5ORQRe1PsvmYHIPlEDsy353Lyu2MlLxo
+gxdARUFu9hBEok0JCrSXWsLQIEXHGlzSYj9v4zy0y4J84+I9upqDaoYE1a7ga1xq
+o45szflyH+vi1OxGK5USBDbUA/wocgdnT95+xniliIct2QdifKaE65Wb2NpCsRZt
+qSYbi5Cyxg6kQY7+OT/3DoPpxXnR9pFP1JZdzNitwMN5zFLhZsuAlEASLMdcr06A
+6UYJTlO9AgMBAAECggEARFynLTus0o4zZkC8JGLVNuu5xFaf4Zzpu6RS18lK/vpt
+5askDZSQ8rd/ENRg6tdEqQmKsWDwghAp4sMfiTJ4AjFfLWlDnbLU0HPcpS+D3xWj
+ixfDrhwa0ZttQ+gPTMb6tsgT5++EXU33mZHLSUhW357ZKsJtLZJiqiepd3NheOzN
+IAMry3eHvF85lBhGobfCq+GuRmKLOv9Lt44JqEPl8xox67inDw0TgqnOA9TB4FWw
+8dfFwet6NPEZEYKWD+oy1N57ZKXWZlx0jrW3jlQ0BMJcgfEAzxkigOGpB/7WELC0
+b4im8xZEXnXtY+K8B/hX2QB+OKzLM3WL8lxX//N3AQKBgQDtWlfzCAm6PjoLGUR+
+K83E8dN1ySXL8j2YQR3CMo4wCOTNsDcltrDyEOUEU6FQK8UwRNHR6B1gGVcYcF/5
+3Ca1VJ1okN432z4a57zdmIDCqb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