فهرست منبع

Merge branch 'musicgroup_0806'

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java
yonge 3 سال پیش
والد
کامیت
80e409f8fd

+ 1 - 1
codegen/src/main/resources/generateConfigration.xml

@@ -8,7 +8,7 @@
 		<catalog>mec_dev</catalog>
 		<schema>mec_dev</schema>
 	</dbConfiguration>
-	<srcBase>/Users/chenxiaoyu/Documents/javabean</srcBase>
+	<srcBase>e:/javabean</srcBase>
 	<pojoPackageName>com.ym.mec.biz.dal.entity</pojoPackageName>
 	<daoPackageName>com.ym.mec.biz.dal.dao</daoPackageName>
 	<servicePackageName>com.ym.mec.biz.service</servicePackageName>

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

@@ -1685,14 +1685,25 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         for (int i = 0; i < 10; i++) {
             MusicGroupSubjectPlan originalSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, originalSubjectId);
             int originalPaidNum = originalSubjectPlan.getPaidStudentNum() == null ? 0 : originalSubjectPlan.getPaidStudentNum();
+            int originalZeroPaidNum = originalSubjectPlan.getPaidZeroNum() == null ? 0 : originalSubjectPlan.getPaidZeroNum();
             int originalPaidCount = 1;
             if (originalPaidNum > 0) {
                 originalSubjectPlan.setPaidStudentNum(originalPaidNum - 1);
+                //是否是0元入团
+                if(studentRegistration.getNoneNeedCloudTeacher() != null && studentRegistration.getNoneNeedCloudTeacher() == 1){
+                	originalSubjectPlan.setPaidZeroNum(originalZeroPaidNum - 1);
+                }
                 originalPaidCount = musicGroupSubjectPlanService.update(originalSubjectPlan);
             }
             MusicGroupSubjectPlan changeSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, changeSubjectId);
             int changelPaidNum = changeSubjectPlan.getPaidStudentNum() == null ? 0 : changeSubjectPlan.getPaidStudentNum();
             changeSubjectPlan.setPaidStudentNum(changelPaidNum + 1);
+            if(studentRegistration.getNoneNeedCloudTeacher() != null && studentRegistration.getNoneNeedCloudTeacher() == 1){
+            	if(changeSubjectPlan.getPaidZeroNum() != null && changeSubjectPlan.getPaidZeroNum() > 0){
+            		throw new BizException("声部更换失败,当前用户是0元入团,且当前声部已有0元入团学生");
+            	}
+            	changeSubjectPlan.setPaidZeroNum(1);
+            }
             int changePaidCount = musicGroupSubjectPlanService.update(changeSubjectPlan);
             if (originalPaidCount > 0 && changePaidCount > 0) {
                 updateFlag = true;

+ 25 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -77,6 +77,8 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
     private MusicGroupPurchaseListDao musicGroupPurchaseListDao;
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -229,13 +231,12 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
     @Override
     @Transactional(rollbackFor = Exception.class)
     public SubjectChange addChange(SubjectChange subjectChange) {
-        SubjectChange studentWaitPay = subjectChangeDao.getStudentWaitPay(subjectChange.getStudentId(), subjectChange.getMusicGroupId());
+    	String musicGroupId = subjectChange.getMusicGroupId();
+        SubjectChange studentWaitPay = subjectChangeDao.getStudentWaitPay(subjectChange.getStudentId(), musicGroupId);
         if (studentWaitPay != null) {
             throw new BizException("已有未支付的声部更改,请勿重复创建");
         }
         
-        String musicGroupId = subjectChange.getMusicGroupId();
-        
         Set<String> musicGroupIds = new HashSet<String>();
         musicGroupIds.add(musicGroupId);
         
@@ -244,6 +245,23 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
             throw new BizException("乐器清单已确认,不能做声部更改");
         }
         
+        //判断新声部人数是否已满
+        MusicGroupSubjectPlan changeSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, subjectChange.getChangeSubjectId());
+		if (changeSubjectPlan.getExpectedStudentNum() >= changeSubjectPlan.getPaidStudentNum()) {
+			throw new BizException("当前声部人数已满");
+		}
+		
+		StudentRegistration studentRegistration = studentRegistrationDao.getStudentRegister(musicGroupId, subjectChange.getStudentId());
+		if(studentRegistration == null){
+			throw new BizException("用户乐团报名信息查询失败");
+		}
+        
+        if(studentRegistration.getNoneNeedCloudTeacher() != null && studentRegistration.getNoneNeedCloudTeacher() == 1){
+        	if(changeSubjectPlan.getPaidZeroNum() != null && changeSubjectPlan.getPaidZeroNum() > 0){
+        		throw new BizException("声部更换失败,当前用户是0元入团,且当前声部已有0元入团学生");
+        	}
+        }
+        
         Date nowDate = new Date();
         SubjectChange studentOriginal = getStudentOriginal(subjectChange.getStudentId(), subjectChange.getMusicGroupId());
         if(studentOriginal != null){
@@ -414,8 +432,10 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         
         List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
 
-        List<StudentPaymentOrderDetail> details = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
-        
+        List<StudentPaymentOrderDetail> details = new ArrayList<StudentPaymentOrderDetail>();
+		if (paymentOrderIdList != null && paymentOrderIdList.size() > 0) {
+			details = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
+		}
 
         //查询乐器订单
         StudentPaymentOrderDetail musicalOrderDetail =null, accessoriesOrderDetail = null;