Browse Source

Merge branch 'online1' into music_score

Joburgess 3 years ago
parent
commit
24d80cbbfb

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -618,7 +618,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             dataList.forEach(e -> {
                 param.put("musicGroupId", e.getMusicGroupId());
                 e.setAttendanceNum(teacherPersonalAttendancesCount);
-                e.setHasRestClass(hasRestClassMap.get(Integer.parseInt(e.getClassGroupIds())).intValue());
+                Long aLong = hasRestClassMap.get(Integer.parseInt(e.getClassGroupIds()));
+                if(aLong != null){
+                    e.setHasRestClass(aLong.intValue());
+                }
             });
         }
         if (count == 0) {

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -533,6 +533,8 @@ public class ExportServiceImpl implements ExportService {
                     row.setSubjectName(practiceGroup.getSubjectName());
                     row.setEduTeacher(practiceGroup.getEduTeacherName());
                 }
+            } else if (row.getGroupType().equals(GroupType.MEMBER)) {
+                row.setCloudTeacherFee(row.getActualAmount());
             } else if (row.getGroupType().equals(GroupType.REPLACEMENT)) {
                 row.setMusicalFee(row.getActualAmount());
                 ReplacementInstrumentActivityStatDto info = replacementInstrumentActivityDao.getInfo(Integer.parseInt(row.getMusicGroupId()));

+ 38 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -137,6 +137,7 @@ import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.dal.enums.PeriodEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
@@ -1007,10 +1008,20 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         Integer userId = studentRegistration.getUserId();
 
-        StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
-        if (ApplyOrder == null) {
+        StudentPaymentOrder applyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        if (applyOrder == null) {
             throw new BizException("没有支付中订单,请在我的订单中查看订单状态");
         }
+        
+        // 查询订单状态
+        PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
+        if(payStatus != PayStatus.FAILED){
+        	if(payStatus == PayStatus.SUCCESSED){
+        		throw new BizException("订单已支付成功,请勿重复支付");
+        	}else if(payStatus == PayStatus.PAYING){
+        		throw new BizException("订单还在交易中,请稍后重试");
+        	}
+        }
 
     	MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
         if(musicGroupRegCalender == null){
@@ -1018,9 +1029,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
         
         //手动关闭订单
-        ApplyOrder.setStatus(DealStatusEnum.FAILED);
-        ApplyOrder.setMemo("用户手动关闭");
-        studentPaymentOrderService.callOrderCallBack(ApplyOrder);
+        applyOrder.setStatus(DealStatusEnum.FAILED);
+        applyOrder.setMemo("用户手动关闭");
+        studentPaymentOrderService.callOrderCallBack(applyOrder);
 
         BigDecimal amount = registerPayDto.getAmount(); //前端获取的价格
         BigDecimal orderAmount = new BigDecimal("0");
@@ -1792,7 +1803,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("乐团找不到");
         }
 
-        if (!(musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
+        if (!(musicGroup.getStatus() == MusicGroupStatusEnum.APPLY ||
+        		musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
                 musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
                 musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS)) {
             throw new BizException("乐团当前状态是[{}],不能延长缴费", musicGroup.getStatus().getMsg());
@@ -2554,15 +2566,22 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //关闭之前的订单
         if (calenderDetail.getPaymentOrderId() != null) {
             StudentPaymentOrder oldStudentPaymentOrder = studentPaymentOrderDao.get(calenderDetail.getPaymentOrderId());
-            if (oldStudentPaymentOrder != null) {
-                if (oldStudentPaymentOrder.getStatus() == SUCCESS) {
-                    throw new BizException("您已支付请勿重复提交");
-                } else if (oldStudentPaymentOrder.getStatus() == ING) {
-                    oldStudentPaymentOrder.setStatus(CLOSE);
-                    studentPaymentOrderService.update(oldStudentPaymentOrder);
-                    if (oldStudentPaymentOrder.getBalancePaymentAmount() != null && oldStudentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
-                        sysUserCashAccountService.updateBalance(oldStudentPaymentOrder.getUserId(), oldStudentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
-                    }
+            if (oldStudentPaymentOrder != null && oldStudentPaymentOrder.getStatus() == ING) {
+                
+                // 查询订单状态
+                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(oldStudentPaymentOrder.getPaymentChannel(), oldStudentPaymentOrder.getOrderNo(), oldStudentPaymentOrder.getTransNo());
+                if(payStatus != PayStatus.FAILED){
+                	if(payStatus == PayStatus.SUCCESSED){
+                		throw new BizException("订单已支付成功,请勿重复支付");
+                	}else if(payStatus == PayStatus.PAYING){
+                		throw new BizException("订单还在交易中,请稍后重试");
+                	}
+                }
+                
+                oldStudentPaymentOrder.setStatus(CLOSE);
+                studentPaymentOrderService.update(oldStudentPaymentOrder);
+                if (oldStudentPaymentOrder.getBalancePaymentAmount() != null && oldStudentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
+                    sysUserCashAccountService.updateBalance(oldStudentPaymentOrder.getUserId(), oldStudentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
                 }
             }
         }
@@ -3728,6 +3747,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 		//查询当前乐团报名订单中购买了乐保的订单
 		List<StudentApplyInstrumentDto> maintenanceList = studentPaymentOrderDetailDao.queryByType(musicGroupId, OrderDetailTypeEnum.MAINTENANCE);
 		
+		if(maintenanceList == null || maintenanceList.size() == 0){
+			return true;
+		}
+		
 		List<Long> instrumentIdList = maintenanceList.stream().map(t -> t.getStudentInstrumentId()).collect(Collectors.toList());
 		
 		List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList);

+ 13 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import ch.qos.logback.core.util.StringCollectionUtil;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
@@ -22,8 +23,8 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
-
 import com.ym.mec.util.http.HttpUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -276,6 +277,17 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         if (replacementInstrumentActivity.getPayStatus().equals(1) && replacementPayDto.getRePay()) {
             StudentPaymentOrder oldOrder = studentPaymentOrderService.getUserReplacementIngOrder(userId, replacementInstrumentActivity.getId());
             if (oldOrder != null) {
+                
+                // 查询订单状态
+                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(oldOrder.getPaymentChannel(), oldOrder.getOrderNo(), oldOrder.getTransNo());
+                if(payStatus != PayStatus.FAILED){
+                	if(payStatus == PayStatus.SUCCESSED){
+                		throw new BizException("订单已支付成功,请勿重复支付");
+                	}else if(payStatus == PayStatus.PAYING){
+                		throw new BizException("订单还在交易中,请稍后重试");
+                	}
+                }
+                
                 oldOrder.setStatus(DealStatusEnum.FAILED);
                 oldOrder.setMemo("用户手动关闭");
                 studentPaymentOrderService.callOrderCallBack(oldOrder);

+ 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) {

+ 18 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -117,10 +117,24 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         SubjectChange subjectChange = subjectChangeDao.get(id);
         if (isRepay) {
             StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.get(subjectChange.getOrderId().longValue());
-            studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
-            studentPaymentOrder.setUpdateTime(date);
-            studentPaymentOrderService.update(studentPaymentOrder);
-            subjectChange.setStatus(SubjectChangeStatusEnum.WAIT_PAY);
+            
+            if(studentPaymentOrder != null && studentPaymentOrder.getStatus() == DealStatusEnum.ING){
+                
+                // 查询订单状态
+                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);
+                subjectChange.setStatus(SubjectChangeStatusEnum.WAIT_PAY);
+            }
         }
 
         if (subjectChange.getStatus().equals(SubjectChangeStatusEnum.CANCELED)) {

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicCompareRecordServiceImpl.java

@@ -70,7 +70,7 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 		if(Objects.nonNull(soundCompareInfo.getFile())){
 			sysMusicCompareRecord.setPlayTime(soundCompareInfo.getFile().length()/(SoundCompareHandler.soundCompareConfig.audioFormat.getFrameSize()*SoundCompareHandler.soundCompareConfig.audioFormat.getFrameRate()));
 		}
-		sysMusicCompareRecord.setMonday(LocalDate.now().with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()).toString());
+		sysMusicCompareRecord.setFeature(FeatureType.CLOUD_STUDY_EVALUATION);
 		sysMusicCompareRecordDao.insert(sysMusicCompareRecord);
 		studentDao.addStudentCloudStudySequenceDays(user.getId());
 	}

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -39,6 +39,7 @@
         <result column="trans_status_" property="studentPaymentOrder.status"/>
         <result column="expect_amount_" property="studentPaymentOrder.expectAmount"/>
         <result column="pay_time_" property="studentPaymentOrder.payTime"/>
+        <result column="order_create_time_" property="studentPaymentOrder.createTime"/>
         <result column="name_" property="memberRankSetting.name"/>
         <result column="icon_" property="memberRankSetting.icon"/>
         <result column="music_group_id_" property="studentPaymentOrder.musicGroupId"/>
@@ -121,7 +122,7 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="CloudTeacherOrderDto" parameterType="map">
-        SELECT cto.*,spo.status_ trans_status_,spo.expect_amount_,spo.pay_time_,mrs.name_,mrs.icon_ FROM cloud_teacher_order cto
+        SELECT cto.*,spo.status_ trans_status_,spo.expect_amount_,spo.pay_time_,spo.create_time_ order_create_time_,mrs.name_,mrs.icon_ FROM cloud_teacher_order cto
         left join student_payment_order spo on cto.order_id_ = spo.id_
         left join member_rank_setting mrs on mrs.id_ = cto.level_
         where spo.type_ = 'MEMBER'

+ 19 - 2
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -45,6 +45,7 @@ import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
@@ -252,6 +253,14 @@ public class MusicGroupController extends BaseController {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.MUSIC, calender.getMusicGroupId(), userId, DealStatusEnum.ING,
                     OrderTypeEnum.RENEW);
             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, "您有待支付的订单");
             }
         }
@@ -336,8 +345,16 @@ public class MusicGroupController extends BaseController {
             return failed("您已支付成功,请勿重复支付");
         }*/
         //判断用户是否已存在订单
-        StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
-        if (ApplyOrder != null) {
+        StudentPaymentOrder applyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        
+        if (applyOrder != null) {
+        	// 查询订单状态
+            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 = musicGroupService.pay(registerPayDto);

+ 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, "您有待支付的订单");
             }
         }

+ 16 - 0
mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java

@@ -7,15 +7,20 @@ import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
 import com.ym.mec.biz.dal.dto.ReplacementPayDto;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
 import com.ym.mec.biz.service.ReplacementInstrumentCooperationService;
+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.*;
@@ -33,6 +38,8 @@ public class ReplacementInstrumentActivityController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private ReplacementInstrumentCooperationService replacementInstrumentCooperationService;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
 
     @ApiOperation(value = "新增调查问卷")
     @PostMapping("/insert")
@@ -162,6 +169,15 @@ public class ReplacementInstrumentActivityController extends BaseController {
         }
         //判断用户是否已存在订单
         if (replacementInstrumentActivity.getPayStatus().equals(1) && !replacementPayDto.getRePay()) {
+        	
+        	StudentPaymentOrder applyOrder = studentPaymentOrderService.getUserReplacementIngOrder(replacementInstrumentActivity.getUserId(), replacementInstrumentActivity.getId());
+        	// 查询订单状态
+            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 = replacementInstrumentActivityService.pay(replacementPayDto);

+ 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(studentPaymentOrderList.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, "您有待支付的订单");
             }
         }

+ 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(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, "您有待支付的订单");
             }
         }

+ 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);