yubin преди 1 седмица
родител
ревизия
19bf016b25

+ 1 - 2
mall-service/src/main/java/com/txz/mall/controller/appcontroller/AppOrderController.java

@@ -254,8 +254,7 @@ public class AppOrderController {
         
         Long tokenUserId = AuthService.getTokenUserId(null);
         dto.setUserId(tokenUserId);
-        Boolean result = storeOrderService.goPay(dto);
-        return Result.success(result);
+        return storeOrderService.goPay(dto);
     }
     
     //    @ApiOperation("导出发货单")

+ 2 - 0
mall-service/src/main/java/com/txz/mall/core/ServiceException.java

@@ -16,7 +16,9 @@ public class ServiceException extends RuntimeException {
     }
 
     public ServiceException(ResultCode code) {
+        super(code.getMessage());
         this.code = code;
+
     }
 
     public ServiceException(String message) {

+ 2 - 1
mall-service/src/main/java/com/txz/mall/service/StoreOrderService.java

@@ -1,6 +1,7 @@
 package com.txz.mall.service;
 
 import com.github.pagehelper.PageInfo;
+import com.txz.mall.core.Result;
 import com.txz.mall.core.Service;
 import com.txz.mall.model.StoreOrder;
 import dto.*;
@@ -110,7 +111,7 @@ public interface StoreOrderService extends Service<StoreOrder> {
     /**
      * 获取支付结果
      */
-    Boolean goPay(GoPinkDTO dto);
+    Result goPay(GoPinkDTO dto);
 
     /**
      * 订单退款

+ 9 - 3
mall-service/src/main/java/com/txz/mall/service/impl/StoreOrderServiceImpl.java

@@ -1716,7 +1716,10 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED)
-    public Boolean goPay(GoPinkDTO dto) {
+    public com.txz.mall.core.Result goPay(GoPinkDTO dto) {
+        if (ObjectUtils.isEmpty(dto.getType())) {
+            throw new ServiceException(I18nUtil.get("participation.type.is.empty"));
+        }
         StoreOrder storeOrder = findBy("orderId", dto.getOrderId());
         if (ObjectUtils.isEmpty(storeOrder)) {
             throw new ServiceException(I18nUtil.get("order.is.empty.orderid") + dto.getOrderId());
@@ -1738,13 +1741,16 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
         if (result.getCode().equals(ResultCode.SUCCESS.getCode())) {
             AccountDTO accountDTO = JSONObject.parseObject(JSONObject.toJSONString(result.getData()), AccountDTO.class);
             if (accountDTO.getBalance().compareTo(storeOrder.getPayPrice()) < 0) {
-                throw new ServiceException(ResultCode.INSUFFICIENT_BALANCE);
+              //  throw new ServiceException(ResultCode.INSUFFICIENT_BALANCE);
+                return ResultGenerator.genFailResult(ResultCode.INSUFFICIENT_BALANCE);
             }
         } else {
             throw new ServiceException(I18nUtil.get("failed.to.obtain.user.wallet.account"));
         }
 
 
+
+
         if ("open".equals(dto.getType())) {
             OpenParam openParam = new OpenParam();
             openParam.setBizId(storeOrder.getId().toString());
@@ -1785,7 +1791,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
             log.info("storePinkService.pinkSuccess2 :" + storeOrder);
             // goPink(dto);
         }
-        return true;
+        return ResultGenerator.genSuccessResult();
     }
 
     @Resource

+ 1 - 1
mall-service/src/main/java/com/txz/mall/util/OrderStateMachine.java

@@ -62,7 +62,7 @@ public class OrderStateMachine {
             //当前为待支付状态时支付行为产生的操作  如设置支付时间  锁定库存等等
             order.setPayTime(new Date());
 
-            logger.info("订单[{}]支付成功,支付时间: {}", order.getOrderId(), order.getPayTime());
+            logger.info("订单[{}]支付被调用,调用时间: {}", order.getOrderId(), order.getPayTime());
         });
         pendingPaymentActions.put(OrderEventsEnum.GROUP_PURCHASE_CANCEL, (order, param) -> {
             //当前为待支付状态时取消行为产生的操作  如设置取消时间  释放库存等等

+ 2 - 0
mall-service/src/main/resources/i18n/messages_en_US.properties

@@ -156,6 +156,8 @@ you.have.already.checked.in.today=you have already checked in today
 new.add=new.add
 linkage.update.of.activity.inventory.failed.when.modifying.products=linkage update of activity inventory failed when modifying products
 failed.to.increase.virtual.sales.during.payment=failed to increase virtual sales during payment
+participation.type.is.empty=participation type is empty
+
 
 interface=interface
 does.not.exist=does not exist

+ 1 - 1
mall-service/src/main/resources/i18n/messages_zh_CN.properties

@@ -154,7 +154,7 @@ current.status.does.not.support.receipt.confirmation.storeorder=\u5F53\u524D\u72
 automatic.order.receipt.confirmation=\u8BA2\u5355\u81EA\u52A8\u7B7E\u6536
 product.export.template=\u5546\u54C1\u5BFC\u51FA\u6A21\u677F
 you.have.already.checked.in.today=\u4ECA\u5929\u5DF2\u7ECF\u7B7E\u5230\u8FC7\u4E86\uFF01
-
+participation.type.is.empty=\u53C2\u56E2\u7C7B\u578B\u4E3A\u7A7A
 interface=\u63A5\u53E3
 does.not.exist=\u4E0D\u5B58\u5728
 internal.error.please.contact.the.administrator=\u5185\u90E8\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458