Procházet zdrojové kódy

订单结束模版消息调试

skyline před 7 měsíci
rodič
revize
52adabcfd2

+ 7 - 5
car-wash-service/src/main/java/com/kym/service/awoara/event/handle/OrderCloseEventHandler.java

@@ -25,8 +25,7 @@ import java.util.UUID;
 @Slf4j
 @Slf4j
 @Component
 @Component
 public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObject> {
 public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObject> {
-    @Value("${kym.domain}")
-    private String domain;
+    private String DOMAIN;
     private final WashOrderService washOrderService;
     private final WashOrderService washOrderService;
     private final WalletDetailService walletDetailService;
     private final WalletDetailService walletDetailService;
     private final AccountService accountService;
     private final AccountService accountService;
@@ -40,7 +39,9 @@ public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObjec
     public OrderCloseEventHandler(WashOrderService washOrderService, WalletDetailService walletDetailService,
     public OrderCloseEventHandler(WashOrderService washOrderService, WalletDetailService walletDetailService,
                                   AccountService accountService, StationAccountService stationAccountService,
                                   AccountService accountService, StationAccountService stationAccountService,
                                   SplitRecordService splitRecordService,
                                   SplitRecordService splitRecordService,
-                                  StationAccountRecordService stationAccountRecordService, MpMsgTemplateService mpMsgTemplateService) {
+                                  StationAccountRecordService stationAccountRecordService, MpMsgTemplateService mpMsgTemplateService,
+                                    String domain) {
+        DOMAIN = domain;
         this.washOrderService = washOrderService;
         this.washOrderService = washOrderService;
         this.walletDetailService = walletDetailService;
         this.walletDetailService = walletDetailService;
         this.accountService = accountService;
         this.accountService = accountService;
@@ -141,12 +142,13 @@ public class OrderCloseEventHandler implements AwoaraEventHandler<OrderInfoObjec
         deductions(washOrder, account);
         deductions(washOrder, account);
 
 
         // 判断消费金额是否达标,达标发送领取停车优惠券消息
         // 判断消费金额是否达标,达标发送领取停车优惠券消息
-        if (orderInfo.getAmount() >= WashOrder.PARKING_COUPON_MIN_AMOUNT) {
+//        if (orderInfo.getAmount() >= WashOrder.PARKING_COUPON_MIN_AMOUNT) {
+        if (orderInfo.getAmount() >= 0) {
             var parkingCouponUrl = KymCache.INSTANCE.getParkingQrCodeUrlByStationId(washOrder.getStationId());
             var parkingCouponUrl = KymCache.INSTANCE.getParkingQrCodeUrlByStationId(washOrder.getStationId());
             // 维码链接做转换防止重复使用,有效期2小时
             // 维码链接做转换防止重复使用,有效期2小时
             var code = UUID.randomUUID().toString();
             var code = UUID.randomUUID().toString();
             KymCache.INSTANCE.setParkingCouponCode(code, parkingCouponUrl, LocalDateTime.now().plusHours(2));
             KymCache.INSTANCE.setParkingCouponCode(code, parkingCouponUrl, LocalDateTime.now().plusHours(2));
-            var url = domain + "/parking-coupon?code=" + code;
+            var url = DOMAIN + "/parking-coupon?code=" + code;
             mpMsgTemplateService.sendParkingCouponMsg(washOrder, url);
             mpMsgTemplateService.sendParkingCouponMsg(washOrder, url);
         } else {
         } else {
             // 发送公众号消息(订单完成)
             // 发送公众号消息(订单完成)

+ 8 - 2
car-wash-service/src/main/java/com/kym/service/awoara/factory/AwoaraEventHandlerFactory.java

@@ -4,6 +4,7 @@ import com.kym.common.exception.BusinessException;
 import com.kym.entity.awoara.Event;
 import com.kym.entity.awoara.Event;
 import com.kym.service.*;
 import com.kym.service.*;
 import com.kym.service.awoara.event.handle.*;
 import com.kym.service.awoara.event.handle.*;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 /**
 /**
@@ -13,6 +14,9 @@ import org.springframework.stereotype.Component;
  */
  */
 @Component
 @Component
 public class AwoaraEventHandlerFactory {
 public class AwoaraEventHandlerFactory {
+
+    private static String DOMAIN;
+
     private static WashDeviceService washDeviceService;
     private static WashDeviceService washDeviceService;
     private static WashOrderService washOrderService;
     private static WashOrderService washOrderService;
     private static WalletDetailService walletDetailService;
     private static WalletDetailService walletDetailService;
@@ -27,7 +31,9 @@ public class AwoaraEventHandlerFactory {
 
 
     public AwoaraEventHandlerFactory(WashDeviceService washDeviceService, WashOrderService washOrderService, WalletDetailService walletDetailService,
     public AwoaraEventHandlerFactory(WashDeviceService washDeviceService, WashOrderService washOrderService, WalletDetailService walletDetailService,
                                      AccountService accountService, StationAccountService stationAccountService, SplitRecordService splitRecordService,
                                      AccountService accountService, StationAccountService stationAccountService, SplitRecordService splitRecordService,
-                                     StationAccountRecordService stationAccountRecordService, MpMsgTemplateService mpMsgTemplateService) {
+                                     StationAccountRecordService stationAccountRecordService, MpMsgTemplateService mpMsgTemplateService,
+    @Value("${kym.domain}") String domain) {
+        DOMAIN = domain;
         AwoaraEventHandlerFactory.washDeviceService = washDeviceService;
         AwoaraEventHandlerFactory.washDeviceService = washDeviceService;
         AwoaraEventHandlerFactory.washOrderService = washOrderService;
         AwoaraEventHandlerFactory.washOrderService = washOrderService;
         AwoaraEventHandlerFactory.walletDetailService = walletDetailService;
         AwoaraEventHandlerFactory.walletDetailService = walletDetailService;
@@ -47,7 +53,7 @@ public class AwoaraEventHandlerFactory {
                 case order_create -> new OrderCreateEventHandler(washOrderService);
                 case order_create -> new OrderCreateEventHandler(washOrderService);
                 case order_update -> new OrderUpdateEventHandler(washOrderService);
                 case order_update -> new OrderUpdateEventHandler(washOrderService);
                 case order_close ->
                 case order_close ->
-                        new OrderCloseEventHandler(washOrderService, walletDetailService, accountService, stationAccountService, splitRecordService, stationAccountRecordService, mpMsgTemplateService);
+                        new OrderCloseEventHandler(washOrderService, walletDetailService, accountService, stationAccountService, splitRecordService, stationAccountRecordService, mpMsgTemplateService,DOMAIN);
                 case user_login -> new UserLoginEventHandler();
                 case user_login -> new UserLoginEventHandler();
                 case card_event -> new CardEventHandler();
                 case card_event -> new CardEventHandler();
             };
             };