Przeglądaj źródła

Merge branch 'hr_728'

yonge 3 lat temu
rodzic
commit
42d5735ca1

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -21,6 +21,7 @@ import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -127,6 +128,17 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             if (orderByOrderNo.getStatus() == SUCCESS) {
                 throw new BizException("您已支付请勿重复提交");
             }else if(orderByOrderNo.getStatus() == ING){
+            	
+            	// 查询订单状态
+                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(orderByOrderNo.getPaymentChannel(), orderByOrderNo.getOrderNo(), orderByOrderNo.getTransNo());
+                if(payStatus != PayStatus.FAILED){
+                	if(payStatus == PayStatus.SUCCESSED){
+                		throw new BizException("订单已支付成功,请勿重复支付");
+                	}else if(payStatus == PayStatus.PAYING){
+                		throw new BizException("订单还在交易中,请稍后重试");
+                	}
+                }
+                
                 orderByOrderNo.setStatus(CLOSE);
                 studentPaymentOrderService.update(orderByOrderNo);
                 if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {

+ 11 - 0
mec-student/src/main/java/com/ym/mec/student/controller/RepairController.java

@@ -9,6 +9,7 @@ import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
@@ -17,8 +18,10 @@ import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
@@ -58,6 +61,14 @@ public class RepairController extends BaseController {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null, studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.GOODS_SELL);
             if (list.size() > 0) {
+            	StudentPaymentOrder applyOrder = list.get(list.size() - 1);
+            	// 查询订单状态
+                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
+                if(payStatus == PayStatus.SUCCESSED){
+            		throw new BizException("订单已支付成功,请勿重复支付");
+            	}else if(payStatus == PayStatus.PAYING){
+            		throw new BizException("订单还在交易中,请稍后重试");
+            	}
                 return failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
         }