Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

zouxuan 4 éve
szülő
commit
4b78757dca
22 módosított fájl, 320 hozzáadás és 40 törlés
  1. 17 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  2. 10 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  3. 3 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupActivityDao.java
  4. 32 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyDetailDto.java
  5. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SubjectApplyDetailDto.java
  6. 23 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java
  7. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/VipGroupActivity.java
  8. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentRegistrationQueryInfo.java
  9. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/VipGroupActivityQueryInfo.java
  10. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupActivityService.java
  11. 8 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  12. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  13. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  14. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java
  15. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java
  16. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupActivityServiceImpl.java
  17. 15 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  18. 30 8
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  19. 12 2
      mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml
  20. 29 9
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupActivityController.java
  21. 7 2
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  22. 29 9
      mec-web/src/main/java/com/ym/mec/web/controller/VipGroupActivityController.java

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -204,4 +204,21 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * @return java.util.List<com.ym.mec.biz.dal.entity.Student>
      */
     List<Student> getNoTeacherOrNoSubjectStudent();
+
+    /**
+     * @describe 从新学员中找出有VIP课的学员编号
+     * @author Joburgess
+     * @date 2021/6/3 0003
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> getHasVipCourseStudentIdsFromNewStudents();
+
+    /**
+     * @describe 将指定学员更新为老学员
+     * @author Joburgess
+     * @date 2021/6/3 0003
+     * @param userIds:
+     * @return int
+     */
+    int updateNewStudentsToOld(@Param("userIds") List<Integer> userIds);
 }

+ 10 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -528,12 +528,20 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
     int quitAllStudent(@Param("musicGroupId") String musicGroupId, @Param("remark") String remark);
 
     /**
+     * @param groupIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentRegistration>
      * @describe 获取指定乐团中的注册学员
      * @author Joburgess
      * @date 2021/5/24 0024
-     * @param groupIds:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentRegistration>
      */
     List<StudentRegistration> findByMusicGroupIds(@Param("groupIds") List<String> groupIds,
                                                   @Param("musicGroupStatus") StudentMusicGroupStatusEnum musicGroupStatus);
+
+    /**
+     * 获取支付中的缴费和审核的人数
+     * @param musicGroupId
+     * @param payingStatus
+     * @return
+     */
+    List<Map<Integer, Integer>> countPayingNum(@Param("musicGroupId") String musicGroupId, @Param("payingStatus") Integer payingStatus);
 }

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupActivityDao.java

@@ -15,7 +15,9 @@ public interface VipGroupActivityDao extends BaseDAO<Integer, VipGroupActivity>
 	 * @Date: 2019/10/2
 	 * 根据课程类型获取vip课 活动方案
 	 */
-	List<VipGroupActivity> findByCategory(@Param("categoryId") Long categoryId, @Param("organIds") String organIds);
+	List<VipGroupActivity> findByCategory(@Param("categoryId") Long categoryId,
+										  @Param("organIds") String organIds,
+										  @Param("applyToStudentType") Integer applyToStudentType);
 
 	/**
 	 * 根据活动方案编号列表获取名称

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyDetailDto.java

@@ -81,6 +81,14 @@ public class StudentApplyDetailDto{
     @ApiModelProperty(value = "云教练金额",required = false)
     private BigDecimal cloudTeacherAmount = BigDecimal.ZERO;
 
+    @ApiModelProperty(value = "缴费中状态 0-正常 1-缴费中 2-审核中",required = false)
+    private Integer payingStatus;
+
+    @ApiModelProperty(value = "是否购买云教练",required = false)
+    private Integer hasCloudTeacher;
+
+    private String payingStatusStr;
+
     public KitGroupPurchaseTypeEnum getKitGroupPurchaseTypeEnum() {
         return kitGroupPurchaseTypeEnum;
     }
@@ -248,4 +256,28 @@ public class StudentApplyDetailDto{
     public void setCloudTeacherAmount(BigDecimal cloudTeacherAmount) {
         this.cloudTeacherAmount = cloudTeacherAmount;
     }
+
+    public Integer getHasCloudTeacher() {
+        return hasCloudTeacher;
+    }
+
+    public void setHasCloudTeacher(Integer hasCloudTeacher) {
+        this.hasCloudTeacher = hasCloudTeacher;
+    }
+
+    public Integer getPayingStatus() {
+        return payingStatus;
+    }
+
+    public void setPayingStatus(Integer payingStatus) {
+        this.payingStatus = payingStatus;
+    }
+
+    public String getPayingStatusStr() {
+        return payingStatusStr;
+    }
+
+    public void setPayingStatusStr(String payingStatusStr) {
+        this.payingStatusStr = payingStatusStr;
+    }
 }

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SubjectApplyDetailDto.java

@@ -28,6 +28,12 @@ public class SubjectApplyDetailDto {
     @ApiModelProperty(value = "未分班人数",required = false)
     private Integer notPartClassNum;
 
+    @ApiModelProperty(value = "缴费中人数",required = false)
+    private Integer payingNum=0;
+
+    @ApiModelProperty(value = "审核中人数",required = false)
+    private Integer checkNum=0;
+
     public Integer getMusicGroupSubjectPlanId() {
         return musicGroupSubjectPlanId;
     }
@@ -83,4 +89,20 @@ public class SubjectApplyDetailDto {
     public void setPayNum(Integer payNum) {
         this.payNum = payNum;
     }
+
+    public Integer getPayingNum() {
+        return payingNum;
+    }
+
+    public void setPayingNum(Integer payingNum) {
+        this.payingNum = payingNum;
+    }
+
+    public Integer getCheckNum() {
+        return checkNum;
+    }
+
+    public void setCheckNum(Integer checkNum) {
+        this.checkNum = checkNum;
+    }
 }

+ 23 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java

@@ -121,12 +121,18 @@ public class StudentRegistration {
 
     //乐团
     private OwnershipType ownershipType;
-    
+
     private Integer chargeTypeId;
 
     @ApiModelProperty(value = "是否是合并的学员 0-否 1-是",required = true)
     private Integer isMerge = 0;
 
+    @ApiModelProperty(value = "缴费中状态 0-正常 1-缴费中 2-审核中",required = true)
+    private Integer payingStatus = 0;
+
+    @ApiModelProperty(value = "是否购买云教练 0-没有 1-有",required = true)
+    private Integer hasCloudTeacher = 0;
+
     public String getCertificateType() {
         return certificateType;
     }
@@ -445,4 +451,20 @@ public class StudentRegistration {
     public void setCurrentGradeNum(Integer currentGradeNum) {
         this.currentGradeNum = currentGradeNum;
     }
+
+    public Integer getPayingStatus() {
+        return payingStatus;
+    }
+
+    public void setPayingStatus(Integer payingStatus) {
+        this.payingStatus = payingStatus;
+    }
+
+    public Integer getHasCloudTeacher() {
+        return hasCloudTeacher;
+    }
+
+    public void setHasCloudTeacher(Integer hasCloudTeacher) {
+        this.hasCloudTeacher = hasCloudTeacher;
+    }
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/VipGroupActivity.java

@@ -89,6 +89,17 @@ public class VipGroupActivity {
 	@ApiModelProperty(value = "每位学员最大使用次数")
 	private Integer studentMaxUsedTimes;
 
+	@ApiModelProperty(value = "适用学生类型:-1:所有;0:老用户;1:新用户")
+	private int  applyToStudentType = -1;
+
+	public int getApplyToStudentType() {
+		return applyToStudentType;
+	}
+
+	public void setApplyToStudentType(int applyToStudentType) {
+		this.applyToStudentType = applyToStudentType;
+	}
+
 	public Integer getMinCourseNum() {
 		return minCourseNum;
 	}

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentRegistrationQueryInfo.java

@@ -36,6 +36,12 @@ public class StudentRegistrationQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "是否已回访",required = false)
     private Boolean visited;
 
+    @ApiModelProperty(value = "缴费中状态 0-正常 1-缴费中 2-审核中",required = false)
+    private Integer payingStatus;
+
+    @ApiModelProperty(value = "是否购买云教练 0-没有 1-有",required = false)
+    private Integer hasCloudTeacher;
+
     private boolean isExport = false;
 
     public boolean getIsExport() {
@@ -117,4 +123,20 @@ public class StudentRegistrationQueryInfo extends QueryInfo {
     public void setVisited(Boolean visited) {
         this.visited = visited;
     }
+
+    public Integer getPayingStatus() {
+        return payingStatus;
+    }
+
+    public void setPayingStatus(Integer payingStatus) {
+        this.payingStatus = payingStatus;
+    }
+
+    public Integer getHasCloudTeacher() {
+        return hasCloudTeacher;
+    }
+
+    public void setHasCloudTeacher(Integer hasCloudTeacher) {
+        this.hasCloudTeacher = hasCloudTeacher;
+    }
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/VipGroupActivityQueryInfo.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.page;
 
 import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
 
 /**
  * @Author Joburgess
@@ -12,6 +13,9 @@ public class VipGroupActivityQueryInfo extends QueryInfo {
 
     private Boolean enable;
 
+    @ApiModelProperty(value = "适用学生类型:-1:所有;0:老用户;1:新用户")
+    private Integer  applyToStudentType;
+
     public Boolean getEnable() {
         return enable;
     }
@@ -27,4 +31,12 @@ public class VipGroupActivityQueryInfo extends QueryInfo {
     public void setOrganId(String organId) {
         this.organId = organId;
     }
+
+    public Integer getApplyToStudentType() {
+        return applyToStudentType;
+    }
+
+    public void setApplyToStudentType(Integer applyToStudentType) {
+        this.applyToStudentType = applyToStudentType;
+    }
 }

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

@@ -29,7 +29,7 @@ public interface VipGroupActivityService extends BaseService<Integer, VipGroupAc
      * @Date: 2019/10/2
      * 根据课程类型获取VIP课相关活动方案
      */
-    List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId);
+    List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId, Integer applyToStudentType);
 
     /**
      * 导出vip活动

+ 8 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -2765,9 +2765,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                     courseSchedules.get(courseStartDates.size() - 1).setEndClassTime(courseEndTime);
                     if (Objects.nonNull(vipGroupCourseAdjustInfo.getTeachMode())) {
                         if(courseSchedules.get(courseStartDates.size() - 1).getTeachMode().equals(TeachModeEnum.ONLINE)
-                            &&vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)
-							&&Objects.isNull(vipGroupCourseAdjustInfo.getSchoolId())){
-                            throw new BizException("请选择教学点");
+                            &&vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)){
+                            throw new BizException("VIP课不支持从线上调整到线下");
                         }
                         courseSchedules.get(courseStartDates.size() - 1).setTeachMode(vipGroupCourseAdjustInfo.getTeachMode());
                         if (vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)) {
@@ -3380,6 +3379,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				}
 			}
 
+			if (VIP.equals(newCourseSchedule.getGroupType())){
+				if(TeachModeEnum.OFFLINE.equals(newCourseSchedule.getTeachMode())&&TeachModeEnum.ONLINE.equals(oldCourseSchedule.getTeachMode())){
+					throw new BizException("VIP课不支持从线上调整到线下");
+				}
+			}
+
             if(!CollectionUtils.isEmpty(newCourseSchedule.getTeachingTeacherIdList())){
                 if (newCourseSchedule.getTeachingTeacherIdList().contains(newCourseSchedule.getActualTeacherId())){
                     throw new BizException("主教和助教不可重复");

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -685,11 +685,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
         studentRegistration.setOrganId(musicGroup.getOrganId());
+        studentRegistration.setPayingStatus(1);
+
         //云教练/云教练+
         if (registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) {
             OrganizationCloudTeacherFee cloudTeacher = organizationCloudTeacherFeeDao.getByOrganId(studentRegistration.getOrganId());
             BigDecimal cloudTeacherPrice = registerPayDto.getBuyCloudTeacher() ? cloudTeacher.getPrice() : cloudTeacher.getPlusPrice();
             orderAmount = orderAmount.add(cloudTeacherPrice);
+            studentRegistration.setHasCloudTeacher(1);
         }
 
         if (amount.compareTo(orderAmount) != 0) {
@@ -731,10 +734,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
             studentPaymentOrder.setPaymentChannel("ADAPAY");
+            studentRegistration.setPayingStatus(2);
         }
         studentPaymentOrderService.update(studentPaymentOrder);
         studentPaymentOrder.setVersion(studentPaymentOrder.getVersion() + 1);
 
+        //更新注册信息
+        studentRegistrationService.update(studentRegistration);
+
         if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
             Map<String, String> notifyMap = new HashMap<>();
             notifyMap.put("hasPaidZero", "205");
@@ -859,11 +866,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
         studentRegistration.setOrganId(musicGroup.getOrganId());
+        studentRegistration.setPayingStatus(1);
+
         //云教练/云教练+
         if (registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) {
             OrganizationCloudTeacherFee cloudTeacher = organizationCloudTeacherFeeDao.getByOrganId(studentRegistration.getOrganId());
             BigDecimal cloudTeacherPrice = registerPayDto.getBuyCloudTeacher() ? cloudTeacher.getPrice() : cloudTeacher.getPlusPrice();
             orderAmount = orderAmount.add(cloudTeacherPrice);
+            studentRegistration.setHasCloudTeacher(1);
         }
 
         if (amount.compareTo(orderAmount) != 0) {
@@ -906,10 +916,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
             studentPaymentOrder.setPaymentChannel("ADAPAY");
+            studentRegistration.setPayingStatus(2);
         }
         studentPaymentOrderService.update(studentPaymentOrder);
         studentPaymentOrder.setVersion(studentPaymentOrder.getVersion() + 1);
 
+        studentRegistrationService.update(studentRegistration);
+
         if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
             Map<String, String> notifyMap = new HashMap<>();
             notifyMap.put("hasPaidZero", "205");
@@ -1755,6 +1768,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             StudentMusicGroupStatusEnum currentStudentMusicGroupStatus = studentRegistration.getMusicGroupStatus();
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
             studentRegistration.setSurplusCourseFee(BigDecimal.ZERO);
+            studentRegistration.setHasCloudTeacher(0);
             studentRegistration.setUpdateTime(date);
 
             studentRegistrationDao.update(studentRegistration);
@@ -1989,6 +2003,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         // 退团
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
         studentRegistration.setSurplusCourseFee(BigDecimal.ZERO);
+        studentRegistration.setHasCloudTeacher(0);
         studentRegistration.setUpdateTime(date);
 
         studentRegistrationDao.update(studentRegistration);
@@ -2988,6 +3003,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 studentRegistration.setActualSubjectId(subjectId);
                 studentRegistration.setIsMerge(1);
                 studentRegistration.setTemporaryCourseFee(null);
+                studentRegistration.setHasCloudTeacher(0);
             }
             studentRegistrationList.addAll(regs);
         });

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

@@ -1095,6 +1095,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
             studentRegistration.setPaymentStatus(YES);
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+            studentRegistration.setPayingStatus(0);
 
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
 
@@ -1219,6 +1220,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         if (studentPaymentOrder.getStatus().equals(DealStatusEnum.FAILED)) {
             MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
+            studentRegistration.setPayingStatus(0);
+            studentRegistration.setHasCloudTeacher(0);
+            studentRegistrationDao.update(studentRegistration);
+
             //减去缴费人数(器乐收费,0元时不减缴费人数)
             if (musicGroup.getCourseViewType().equals(CourseViewTypeEnum.CLOUD_TEACHER) || musicGroup.getCourseViewType().equals(CourseViewTypeEnum.CLOUD_TEACHER_PLUS)) {
                 if (studentPaymentOrder.getPaymentAccountNo() != null && studentPaymentOrder.getPaymentAccountNo().equals("200")) {

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -205,7 +205,14 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void updateStudentTeacherAndSubject() {
+        //更新新学员状态
+        List<Integer> newStudentIds = studentDao.getHasVipCourseStudentIdsFromNewStudents();
+        if(!CollectionUtils.isEmpty(newStudentIds)){
+            studentDao.updateNewStudentsToOld(newStudentIds);
+        }
+
         List<Student> noTeacherOrNoSubjectStudent = studentDao.getNoTeacherOrNoSubjectStudent();
         if (CollectionUtils.isEmpty(noTeacherOrNoSubjectStudent)) {
             return;
@@ -215,6 +222,7 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         if (CollectionUtils.isEmpty(studentClassInfo)) {
             return;
         }
+        //更新学员指导老师和声部信息
         List<Student> needUpdateStudents = new ArrayList<>();
         Map<Integer, List<StudentClassInfoDto>> scm = studentClassInfo.stream().collect(Collectors.groupingBy(StudentClassInfoDto::getStudentId));
         for (Student student : noTeacherOrNoSubjectStudent) {

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java

@@ -79,11 +79,17 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
 //        //统计当前乐团不同声部的报名人数
         Map<Integer, Integer> applyNum = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countApplyNum(musicGroupId))), HashMap.class);
         Map<Integer, Integer> payNumMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countPayNum(musicGroupId))), HashMap.class);
+        Map<Integer, Integer> payingMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countPayingNum(musicGroupId, 1))), HashMap.class);
+        Map<Integer, Integer> payCheckMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countPayingNum(musicGroupId, 2))), HashMap.class);
         subApplyDetail.forEach(detail -> {
             Integer num = payNumMap.get(detail.getSubjectId());
             detail.setPayNum(num == null ? 0 : num);
             num = applyNum.get(detail.getSubjectId());
             detail.setApplyStudentNum(num == null ? 0 : num);
+            num = payingMap.get(detail.getSubjectId());
+            detail.setPayingNum(num == null ? 0 : num);
+            num = payCheckMap.get(detail.getSubjectId());
+            detail.setCheckNum(num == null ? 0 : num);
         });
         return subApplyDetail;
     }

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

@@ -146,7 +146,7 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 	}
 
 	@Override
-	public List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId) {
+	public List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId, Integer applyToStudentType) {
 		if(Objects.isNull(categoryId)){
 			throw new BizException("请选择课程形态!");
 		}
@@ -163,7 +163,7 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 				organIds += "," + teacher.getFlowOrganRange();
 			}
 		}
-		return vipGroupActivityDao.findByCategory(categoryId,organIds);
+		return vipGroupActivityDao.findByCategory(categoryId,organIds, applyToStudentType);
 	}
 
 	@Override

+ 15 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -688,6 +688,13 @@
         SELECT * FROM student WHERE teacher_id_ IS NULL OR subject_id_list_ IS NULL OR cooperation_organ_id_ IS NULL;
     </select>
 
+    <select id="getHasVipCourseStudentIdsFromNewStudents" resultType="int">
+        SELECT DISTINCT s.user_id_
+        FROM student s
+        LEFT JOIN course_schedule_student_payment cssp ON s.user_id_=cssp.user_id_
+        WHERE s.is_new_user_=1 AND cssp.group_type_='VIP'
+    </select>
+
     <update id="updateGrade"><![CDATA[
         UPDATE student SET current_grade_num_=current_grade_num_+1
         WHERE current_grade_num_>=1
@@ -695,4 +702,12 @@
         ]]>
     </update>
 
+    <update id="updateNewStudentsToOld">
+        UPDATE student SET is_new_user_=0
+        WHERE user_id_ IN
+        <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
+            #{userId}
+        </foreach>
+    </update>
+
 </mapper>

+ 30 - 8
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -42,8 +42,10 @@
         <result column="username_" property="name" />
         <result column="deposit_fee_" property="depositFee" />
         <result column="surplus_course_fee_" property="surplusCourseFee"/>
+        <result column="paying_status_" property="payingStatus"/>
+        <result column="has_cloud_teacher_" property="hasCloudTeacher"/>
     </resultMap>
-    
+
     <resultMap type="com.ym.mec.biz.dal.dto.StudentMusicGroupDto" id="StudentMusicGroupDto" extends="StudentRegistration">
     	<result column="music_group_quit_status_" property="musicGroupQuit.status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="group_status_" property="musicGroup.status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
@@ -240,6 +242,12 @@
             <if test="surplusCourseFee != null">
                 surplus_course_fee_ =#{surplusCourseFee},
             </if>
+            <if test="payingStatus != null">
+                paying_status_ =#{payingStatus},
+            </if>
+            <if test="hasCloudTeacher != null">
+                has_cloud_teacher_ =#{hasCloudTeacher},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>
@@ -306,6 +314,12 @@
             <if test="createYear != null">
                 AND DATE_FORMAT(sr.create_time_,'%Y') =  #{createYear}
             </if>
+            <if test="hasCloudTeacher != null">
+                AND sr.has_cloud_teacher_ =  #{hasCloudTeacher}
+            </if>
+            <if test="payingStatus != null">
+                AND sr.paying_status_ =  #{payingStatus}
+            </if>
         </where>
     </sql>
 
@@ -327,11 +341,13 @@
         <result column="remark_" property="remark"/>
         <result column="create_time_" property="createTime"/>
         <result column="visit_num_" property="visitNum"/>
+        <result column="paying_status_" property="payingStatus"/>
+        <result column="has_cloud_teacher_" property="hasCloudTeacher"/>
     </resultMap>
     <select id="queryStudentDetailPage" resultMap="studentApplyDetail">
         SELECT sr.id_,sr.create_time_, sr.user_id_,su.username_ username_,sr.parents_name_,sr.current_class_,sr.current_grade_,sr.current_grade_date_,
         su.gender_,sr.is_allow_adjust_, s.name_ subject_name_,ss.name_
-        actual_subject_name_,su.phone_ parents_phone_,sr.payment_status_,sr.remark_,sr.actual_subject_id_,IFNULL(sv.num,0) visit_num_
+        actual_subject_name_,su.phone_ parents_phone_,sr.payment_status_,sr.remark_,sr.actual_subject_id_,IFNULL(sv.num,0) visit_num_,sr.has_cloud_teacher_,sr.paying_status_
         FROM student_registration sr
         LEFT JOIN sys_user su ON sr.user_id_ = su.id_
         LEFT JOIN `subject` s ON sr.subject_id_ = s.id_
@@ -786,16 +802,16 @@
         SELECT COUNT(*) FROM student_registration WHERE music_group_id_=#{musicGroupId}
         AND INTE_ARRAY(actual_subject_id_,#{subjectIds}) AND music_group_status_ = 'NORMAL'
     </select>
-    
+
     <select id="queryStudentMusicGroupInfo" resultMap="StudentMusicGroupDto">
-    	select sr.*,s.name_ subject_name_,mg.status_ group_status_,mg.name_ music_group_name_,mgq.status_ music_group_quit_status_ 
+    	select sr.*,s.name_ subject_name_,mg.status_ group_status_,mg.name_ music_group_name_,mgq.status_ music_group_quit_status_
     	from student_registration sr left join subject s on s.id_ = sr.actual_subject_id_
     	left join music_group mg on sr.music_group_id_ = mg.id_
-    	left join (select mgq.* from music_group_quit mgq 
-		 where mgq.id_ in (select max(id_) from music_group_quit group by music_group_id_,user_id_)) mgq  ON mgq.music_group_id_ = sr.music_group_id_ 
+    	left join (select mgq.* from music_group_quit mgq
+		 where mgq.id_ in (select max(id_) from music_group_quit group by music_group_id_,user_id_)) mgq  ON mgq.music_group_id_ = sr.music_group_id_
 		 AND mgq.user_id_ = sr.user_id_ AND mgq.join_date_ = sr.create_time_
-    	where sr.user_id_ = #{userId} 
-    	order by sr.id_ 
+    	where sr.user_id_ = #{userId}
+    	order by sr.id_
     </select>
 
     <select id="querySurplusCourseFeeByClassGroupId" resultType="java.util.Map">
@@ -1006,4 +1022,10 @@
         UPDATE student_registration SET music_group_status_ = 'QUIT',remark_=#{remark} WHERE music_group_id_ = #{musicGroupId}
         AND music_group_status_ IN ('APPLY','NORMAL')
     </update>
+
+    <select id="countPayingNum" resultType="map">
+        SELECT COUNT(DISTINCT user_id_) `value`,actual_subject_id_ `key` FROM student_registration
+        WHERE music_group_id_ = #{musicGroupId} AND paying_status_=#{payingStatus} AND music_group_status_ != 'QUIT' GROUP BY actual_subject_id_
+    </select>
+
 </mapper>

+ 12 - 2
mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml

@@ -34,6 +34,7 @@
 		<result property="minCourseNum" column="min_course_num_"/>
 		<result property="maxCourseNum" column="max_course_num_"/>
 		<result property="studentMaxUsedTimes" column="student_max_used_times_"/>
+		<result property="applyToStudentType" column="apply_to_student_type_"/>
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -56,10 +57,10 @@
 		INSERT INTO vip_group_activity (id_,name_,description_,vip_group_category_id_list_,start_time_,end_time_,organ_id_,courses_start_time_,courses_end_time_,type_,
 		                                attribute1_,attribute2_,attribute3_,salary_readonly_flag_,give_class_pay_salary_flag_,create_time_,update_time_,salary_settlement_json_,del_flag_,
 		                                payment_readonly_flag_,online_class_join_gradient_rewards_,offline_class_join_gradient_rewards_,min_course_num_,max_course_num_,
-										student_max_used_times_)
+										student_max_used_times_, apply_to_student_type_)
 		VALUES(#{id},#{name},#{description},#{vipGroupCategoryIdList},#{startTime},#{endTime},#{organId},#{coursesStartTime},#{coursesEndTime},#{type},#{attribute1},#{attribute2},#{attribute3},
 		       #{salaryReadonlyFlag},#{giveClassPaySalaryFlag},now(),now(),#{salarySettlementJson},#{delFlag},#{paymentReadonlyFlag},#{onlineClassJoinGradientRewards},
-		       #{offlineClassJoinGradientRewards},#{minCourseNum},#{maxCourseNum},#{studentMaxUsedTimes})
+		       #{offlineClassJoinGradientRewards},#{minCourseNum},#{maxCourseNum},#{studentMaxUsedTimes},#{applyToStudentType})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -138,6 +139,9 @@
 			<if test="studentMaxUsedTimes!=null">
 				student_max_used_times_=#{studentMaxUsedTimes},
 			</if>
+			<if test="applyToStudentType!=null">
+				apply_to_student_type_=#{applyToStudentType},
+			</if>
 			update_time_ = NOW(),
 		</set>WHERE id_ = #{id}
 	</update>
@@ -162,6 +166,9 @@
 			<if test="search != null and search != ''">
 				AND (vga.id_=#{search} OR vga.name_ LIKE CONCAT('%', #{search}, '%'))
 			</if>
+			<if test="applyToStudentType!=null">
+				AND apply_to_student_type_=#{applyToStudentType}
+			</if>
 		</where>
 	</sql>
 
@@ -193,6 +200,9 @@
 			AND (end_time_ IS NULL OR NOW() BETWEEN start_time_ AND end_time_)
 			AND del_flag_=0
 			AND INTE_ARRAY(organ_id_,#{organIds})
+			<if test="applyToStudentType!=null">
+				AND (apply_to_student_type_=#{applyToStudentType} OR apply_to_student_type_=-1)
+			</if>
 	</select>
     <select id="queryNamesById" resultType="java.util.Map">
 		SELECT vga.id_ `key`,vga.name_ `value` FROM vip_group_activity vga WHERE FIND_IN_SET(vga.id_,#{activityIds}) AND vga.del_flag_=0

+ 29 - 9
mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupActivityController.java

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.VipGroupActivityAddDto;
+import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.entity.VipGroupActivity;
 import com.ym.mec.biz.dal.page.VipGroupActivityQueryInfo;
@@ -15,6 +16,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
@@ -38,6 +40,8 @@ public class VipGroupActivityController extends BaseController {
     private SysConfigService sysConfigService;
     @Autowired
     private TeacherDao teacherDao;
+    @Autowired
+    private StudentDao studentDao;
 
     @ApiOperation(value = "新增vip课活动方案")
     @PostMapping("/addVipGroupActivity")
@@ -65,20 +69,36 @@ public class VipGroupActivityController extends BaseController {
 
     @ApiOperation(value = "根据课程类型获取对应课程活动方案")
     @GetMapping("/findByVipGroupCategory")
-    public Object findByVipGroupCategory(Long categoryId, Integer firstStudentId, boolean onlySpecialActivity){
+    public Object findByVipGroupCategory(Long categoryId, String studentIds, boolean onlySpecialActivity){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null){
             return failed("用户信息获取失败");
         }
-        String organIds = new String();
-        if(Objects.nonNull(firstStudentId)){
-            SysUser student = teacherDao.getUser(firstStudentId);
-            if(Objects.isNull(student)){
-                return failed("学员信息不存在");
-            }
-            organIds = student.getOrganId().toString();
+
+        if(StringUtils.isBlank(studentIds)){
+            return failed("请选择学员");
         }
-        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, sysUser.getId());
+        List<Integer> userIds = Arrays.stream(studentIds.split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
+        List<Student> students = studentDao.findByStudentIds(userIds);
+        if(CollectionUtils.isEmpty(students)||students.size()!=userIds.size()){
+            return failed("学员信息不存在");
+        }
+        long newStudentNum = students.stream().filter(s -> s.getIsNewUser()).count();
+
+        Integer applyToStudentType = -1;
+        if(newStudentNum==0){
+            applyToStudentType = 0;
+        }else if(newStudentNum==userIds.size()){
+            applyToStudentType = 1;
+        }
+
+        SysUser student = teacherDao.getUser(userIds.get(0));
+        if(Objects.isNull(student)){
+            return failed("学员信息不存在");
+        }
+        String organIds = student.getOrganId().toString();
+
+        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, sysUser.getId(),applyToStudentType);
         SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.VIP_SPECIAL_ACTIVITY_IDS);
         if(onlySpecialActivity){
             if(Objects.isNull(sysConfig)|| StringUtils.isBlank(sysConfig.getParanValue())){

+ 7 - 2
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -1303,11 +1303,16 @@ public class ExportController extends BaseController {
             if (PaymentStatusEnum.YES.equals(studentApplyDetailDto.getPaymentStatus()) && studentApplyDetailDto.getKitGroupPurchaseTypeEnum() == null) {
                 studentApplyDetailDto.setKitGroupPurchaseTypeEnum(KitGroupPurchaseTypeEnum.OWNED);
             }
+            if(studentApplyDetailDto.getPayingStatus().equals(1)){
+                studentApplyDetailDto.setPayingStatusStr("缴费中");
+            }else if(studentApplyDetailDto.getPayingStatus().equals(2)){
+                studentApplyDetailDto.setPayingStatusStr("审核中");
+            }
         }
         OutputStream outputStream = response.getOutputStream();
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学生姓名", "家长姓名", "年级", "班级", "性别", "服从调剂", "报名专业", "实际专业", "联系电话", "学员缴费状态", "乐器购买方式"}, new String[]{
-                    "studentName", "parentsName", "currentGrade", "currentClass", "gender.description", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone", "paymentStatus.desc", "kitGroupPurchaseTypeEnum.msg"}, studentApplyDetail);
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学生姓名", "家长姓名", "年级", "班级", "性别", "服从调剂", "报名专业", "实际专业", "联系电话", "学员缴费状态", "乐器购买方式","缴费中/审核中","是否购买云教练"}, new String[]{
+                    "studentName", "parentsName", "currentGrade", "currentClass", "gender.description", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone", "paymentStatus.desc", "kitGroupPurchaseTypeEnum.msg","payingStatusStr","hasCloudTeacher==1?'有':'没有'"}, studentApplyDetail);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();

+ 29 - 9
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupActivityController.java

@@ -3,9 +3,11 @@ package com.ym.mec.web.controller;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.VipGroupActivityAddDto;
 import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.page.VipGroupActivityQueryInfo;
 import com.ym.mec.biz.service.VipGroupActivityService;
 import com.ym.mec.common.controller.BaseController;
@@ -17,11 +19,13 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @Author Joburgess
@@ -41,6 +45,8 @@ public class VipGroupActivityController extends BaseController {
 	private EmployeeDao employeeDao;
 	@Autowired
     private TeacherDao teacherDao;
+	@Autowired
+    private StudentDao studentDao;
 
     @ApiOperation(value = "新增vip课活动方案")
     @PostMapping("/addVipGroupActivity")
@@ -98,16 +104,30 @@ public class VipGroupActivityController extends BaseController {
     @ApiOperation(value = "根据课程类型获取对应课程活动方案")
     @GetMapping("/findByVipGroupCategory")
     @PreAuthorize("@pcs.hasPermissions('vipGroupActivity/findByVipGroupCategory')")
-    public Object findByVipGroupCategory(Long categoryId, Integer firstStudentId, Integer teacherId){
-        String organIds = new String();
-        if(Objects.nonNull(firstStudentId)){
-            SysUser student = teacherDao.getUser(firstStudentId);
-            if(Objects.isNull(student)){
-                return failed("学员信息不存在");
-            }
-            organIds = student.getOrganId().toString();
+    public Object findByVipGroupCategory(Long categoryId, String studentIds, Integer teacherId){
+        if(StringUtils.isBlank(studentIds)){
+            return failed("请选择学员");
+        }
+        List<Integer> userIds = Arrays.stream(studentIds.split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
+        List<Student> students = studentDao.findByStudentIds(userIds);
+        if(CollectionUtils.isEmpty(students)||students.size()!=userIds.size()){
+            return failed("学员信息不存在");
+        }
+        long newStudentNum = students.stream().filter(s -> s.getIsNewUser()).count();
+
+        Integer applyToStudentType = -1;
+        if(newStudentNum==0){
+            applyToStudentType = 0;
+        }else if(newStudentNum==userIds.size()){
+            applyToStudentType = 1;
+        }
+
+        SysUser student = teacherDao.getUser(userIds.get(0));
+        if(Objects.isNull(student)){
+            return failed("学员信息不存在");
         }
-        return succeed(vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, teacherId));
+        String organIds = student.getOrganId().toString();
+        return succeed(vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, teacherId, applyToStudentType));
     }
 
 }