yonge 4 سال پیش
والد
کامیت
e8601defa9

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -117,6 +117,17 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         SubjectChange subjectChange = subjectChangeDao.get(id);
         if (isRepay) {
             StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.get(subjectChange.getOrderId().longValue());
+            
+            // 查询订单状态
+            PayStatus payStatus = studentPaymentOrderService.queryPayStatus(studentPaymentOrder.getPaymentChannel(), studentPaymentOrder.getOrderNo(), studentPaymentOrder.getTransNo());
+            if(payStatus != PayStatus.FAILED){
+            	if(payStatus == PayStatus.SUCCESSED){
+            		throw new BizException("订单已支付成功,请勿重复支付");
+            	}else if(payStatus == PayStatus.PAYING){
+            		throw new BizException("订单还在交易中,请稍后重试");
+            	}
+            }
+            
             studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
             studentPaymentOrder.setUpdateTime(date);
             studentPaymentOrderService.update(studentPaymentOrder);

+ 32 - 15
mec-student/src/main/java/com/ym/mec/student/controller/SporadicChargeInfoController.java

@@ -1,29 +1,35 @@
 package com.ym.mec.student.controller;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 import com.ym.mec.biz.dal.dto.SporadicPayDto;
 import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.SporadicChargeInfoService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
 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.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.*;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
 
 @RequestMapping("sporadicChargeInfo")
 @Api(tags = "零星收费")
@@ -37,6 +43,8 @@ public class SporadicChargeInfoController extends BaseController {
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
+    private StudentPaymentOrderDao studentPaymentOrderDao;
+    @Autowired
     private MusicGroupService musicGroupService;
 
     @ApiOperation(value = "单查询")
@@ -65,8 +73,17 @@ public class SporadicChargeInfoController extends BaseController {
             sporadicPayDto.setUserId(sysUser.getId());
         }
         if (sporadicPayDto.getIsRepeatPay() == false) {
-            Integer ingOrder = studentPaymentOrderService.findOrderByGroupType(sporadicPayDto.getUserId(), sporadicPayDto.getSporadicId(), "SPORADIC", DealStatusEnum.ING);
-            if (ingOrder != null && ingOrder > 0) {
+        	List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderDao.findPaymentOrderByGroupType(sporadicPayDto.getUserId(), sporadicPayDto.getSporadicId(), "SPORADIC", DealStatusEnum.ING);
+            if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
+            	StudentPaymentOrder applyOrder = studentPaymentOrderList.get(0);
+            	// 查询订单状态
+                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, "您有待支付的订单");
             }
         }

+ 12 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -9,15 +9,19 @@ import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 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.StudentVipGroupQueryInfo;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.VipGroupCategoryService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
 import com.yonge.log.model.AuditLogAnnotation;
+
 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.*;
@@ -110,6 +114,14 @@ public class StudentVipGroupController extends BaseController {
                             DealStatusEnum.ING,
                             OrderTypeEnum.SMALL_CLASS_TO_BUY);
             if (list.size() > 0) {
+            	StudentPaymentOrder applyOrder = list.get(0);
+            	// 查询订单状态
+                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, "您有待支付的订单");
             }
         }

+ 17 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java

@@ -1,15 +1,21 @@
 package com.ym.mec.student.controller;
 
 import com.ym.mec.biz.dal.dao.SubjectChangeDao;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.dal.enums.SubjectChangeStatusEnum;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.SubjectChangeService;
 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.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -30,6 +36,8 @@ public class SubjectChangeController extends BaseController {
     private SubjectChangeService subjectChangeService;
     @Autowired
     private SubjectChangeDao subjectChangeDao;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
 
 
     @ApiOperation(value = "获取更换详情")
@@ -51,6 +59,15 @@ public class SubjectChangeController extends BaseController {
     public HttpResponseResult<Map> payChange(Integer id, BigDecimal amount, Boolean isUseBalancePayment, Boolean isRepay) throws Exception {
         SubjectChange subjectChange = subjectChangeDao.get(id);
         if (!isRepay && subjectChange.getStatus().equals(SubjectChangeStatusEnum.ING)) {
+        	
+            StudentPaymentOrder applyOrder = studentPaymentOrderService.get(subjectChange.getOrderId().longValue());
+        	// 查询订单状态
+            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, "您有待支付的订单");
         }
         Map payMap = subjectChangeService.payChange(id, amount, isUseBalancePayment, isRepay);