Procházet zdrojové kódy

feat:vip课双11活动

Joburgess před 4 roky
rodič
revize
f2507370ee
17 změnil soubory, kde provedl 467 přidání a 49 odebrání
  1. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  2. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  3. 4 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SporadicChargeInfoDao.java
  4. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java
  5. 71 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseRepeatCheckDto.java
  6. 54 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentVipDouble11Dto.java
  7. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  8. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentManageService.java
  9. 51 19
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  10. 65 29
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  11. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  12. 27 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  13. 22 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  14. 24 0
      mec-biz/src/main/resources/config/mybatis/SporadicChargeInfo.xml
  15. 55 0
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  16. 38 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipGroupController.java
  17. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1575,4 +1575,12 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @return
      */
     List<Map<Integer, Integer>> queryHasReatClass(@Param("classGroupIds") Set<String> classGroupIds, @Param("teacherId") String teacherId);
+
+    /**
+     * @describe 获取检测课程冲突需要的数据
+     * @author qnc99
+     * @date 2020/11/25 0025
+     * @return java.util.List<com.ym.mec.biz.dal.dto.CourseRepeatCheckDto>
+     */
+    List<CourseRepeatCheckDto> getCourseRepeatCheckInfos();
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -338,4 +338,15 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     List<CourseScheduleStudentPayment> queryAll(Map<String, Object> params);
     int countAll(Map<String, Object> params);
+
+    /**
+     * @describe 统计学员通过双十一活动排课的数量
+     * @author qnc99
+     * @date 2020/11/25 0025
+     * @param userIds:
+     * @param activityIds:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentVipDouble11Dto>
+     */
+    List<StudentVipDouble11Dto> countStudentDouble11CourseTime(@Param("userIds") List<Integer> userIds,
+                                                               @Param("specialActivityIds") List<Integer> specialActivityIds);
 }

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SporadicChargeInfoDao.java

@@ -7,6 +7,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface SporadicChargeInfoDao extends BaseDAO<Integer, SporadicChargeInfo> {
     SporadicChargeInfo findInfoById(@Param("id") Integer id);
@@ -22,6 +23,8 @@ public interface SporadicChargeInfoDao extends BaseDAO<Integer, SporadicChargeIn
      */
     List<SporadicChargeInfo> getOrganActiveInfo(@Param("organId") Integer organId, @Param("chargeType") Integer chargeType);
 
+    List<SporadicChargeInfo> findSporadicChargeInfos(Map<String, Object> params);
+
     /**
      * 获取所有的活动分部
      *
@@ -36,4 +39,4 @@ public interface SporadicChargeInfoDao extends BaseDAO<Integer, SporadicChargeIn
      * @return
      */
     List<OrganMaxAmountDto> getActiveOrgansMaxAmount(@Param("type") Integer type);
-}
+}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -352,4 +352,14 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @return
      */
     List<StudentPaymentOrder> getUserOrderByType(@Param("userId") Integer userId, @Param("type") OrderTypeEnum type, @Param("status") DealStatusEnum status);
+
+    /**
+     * @describe 获取参与双十一的学员
+     * @author qnc99
+     * @date 2020/11/25 0025
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentVipDouble11Dto>
+     */
+    List<StudentVipDouble11Dto> queryDouble11Students(Map<String, Object> params);
+    int countDouble11Students(Map<String, Object> params);
 }

+ 71 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseRepeatCheckDto.java

@@ -0,0 +1,71 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author qnc99
+ * @Date 2020/11/25 0025
+ */
+public class CourseRepeatCheckDto {
+
+    private Long courseId;
+
+    private Date classDate;
+
+    private Date startClassTime;
+
+    private java.util.Date endClassTime;
+
+    private List<Integer> teacherIds;
+
+    private List<Integer> studentIds;
+
+    public Long getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Long courseId) {
+        this.courseId = courseId;
+    }
+
+    public Date getClassDate() {
+        return classDate;
+    }
+
+    public void setClassDate(Date classDate) {
+        this.classDate = classDate;
+    }
+
+    public Date getStartClassTime() {
+        return startClassTime;
+    }
+
+    public void setStartClassTime(Date startClassTime) {
+        this.startClassTime = startClassTime;
+    }
+
+    public Date getEndClassTime() {
+        return endClassTime;
+    }
+
+    public void setEndClassTime(Date endClassTime) {
+        this.endClassTime = endClassTime;
+    }
+
+    public List<Integer> getTeacherIds() {
+        return teacherIds;
+    }
+
+    public void setTeacherIds(List<Integer> teacherIds) {
+        this.teacherIds = teacherIds;
+    }
+
+    public List<Integer> getStudentIds() {
+        return studentIds;
+    }
+
+    public void setStudentIds(List<Integer> studentIds) {
+        this.studentIds = studentIds;
+    }
+}

+ 54 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentVipDouble11Dto.java

@@ -0,0 +1,54 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author qnc99
+ * @Date 2020/11/25 0025
+ */
+public class StudentVipDouble11Dto extends SimpleUserDto{
+
+    @ApiModelProperty(value = "双十一活动1V1支付次数")
+    private Integer paymentOneToOneTime;
+
+    @ApiModelProperty(value = "双十一活动1V2支付次数")
+    private Integer paymentOneToTwoTime;
+
+    @ApiModelProperty(value = "1V1可排课次数")
+    private Integer courseOneToOneTime;
+
+    @ApiModelProperty(value = "1V2可排课次数")
+    private Integer courseOneToTwoTime;
+
+    public Integer getPaymentOneToOneTime() {
+        return paymentOneToOneTime;
+    }
+
+    public void setPaymentOneToOneTime(Integer paymentOneToOneTime) {
+        this.paymentOneToOneTime = paymentOneToOneTime;
+    }
+
+    public Integer getPaymentOneToTwoTime() {
+        return paymentOneToTwoTime;
+    }
+
+    public void setPaymentOneToTwoTime(Integer paymentOneToTwoTime) {
+        this.paymentOneToTwoTime = paymentOneToTwoTime;
+    }
+
+    public Integer getCourseOneToOneTime() {
+        return courseOneToOneTime;
+    }
+
+    public void setCourseOneToOneTime(Integer courseOneToOneTime) {
+        this.courseOneToOneTime = courseOneToOneTime;
+    }
+
+    public Integer getCourseOneToTwoTime() {
+        return courseOneToTwoTime;
+    }
+
+    public void setCourseOneToTwoTime(Integer courseOneToTwoTime) {
+        this.courseOneToTwoTime = courseOneToTwoTime;
+    }
+}

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

@@ -601,4 +601,12 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 * @param educationalTeacherId
 	 */
 	void batchPracticeGroupTeacherAdjust(String practiceGroupId, Integer teacherId, Integer subjectId, Integer educationalTeacherId,Integer oldTeacherId);
+
+	/**
+	 * @describe 重叠课程查找
+	 * @author qnc99
+	 * @date 2020/11/25 0025
+	 * @return void
+	 */
+	void courseRepeatCheck();
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentManageService.java

@@ -33,6 +33,15 @@ public interface StudentManageService {
     PageInfo<SimpleUserDto> queryStudentsWithTeacher(StudentManageQueryInfo queryInfo);
 
     /**
+     * @describe 双11活动学员查询
+     * @author qnc99
+     * @date 2020/11/25 0025
+     * @param queryInfo:
+     * @return com.ym.mec.common.page.PageInfo<com.ym.mec.biz.dal.dto.SimpleUserDto>
+     */
+    PageInfo<StudentVipDouble11Dto> queryDouble11Students(StudentManageQueryInfo queryInfo);
+
+    /**
      * @Author: Joburgess
      * @Date: 2019/9/20
      * 根据学生ID获取学生基本报名信息

+ 51 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -29,6 +29,7 @@ import java.util.TreeSet;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.enums.*;
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -73,25 +74,6 @@ import com.ym.mec.biz.dal.dao.TeacherDefaultMusicGroupSalaryDao;
 import com.ym.mec.biz.dal.dao.TeacherDefaultPracticeGroupSalaryDao;
 import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
 import com.ym.mec.biz.dal.dao.VipGroupDao;
-import com.ym.mec.biz.dal.dto.BatchInsertCoursesDto;
-import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
-import com.ym.mec.biz.dal.dto.CourseAttendanceDetailHeadInfoDto;
-import com.ym.mec.biz.dal.dto.CoursePostponeDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleEndDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleRateDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleStudentDto;
-import com.ym.mec.biz.dal.dto.CourseTimeDto;
-import com.ym.mec.biz.dal.dto.CreateCourseScheduleDto;
-import com.ym.mec.biz.dal.dto.IntegerAndIntegerListDto;
-import com.ym.mec.biz.dal.dto.Mapper;
-import com.ym.mec.biz.dal.dto.StudentNameAndPhoneDto;
-import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
-import com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto;
-import com.ym.mec.biz.dal.dto.TeacherRemarkCommitDto;
-import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
-import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
-import com.ym.mec.biz.dal.dto.VipGroupCourseAdjustInfoDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
@@ -5139,4 +5121,54 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}
 		return courseScheduleRateDtos;
 	}
+
+	@Override
+	public void courseRepeatCheck() {
+		List<CourseRepeatCheckDto> courseRepeatCheckInfos = courseScheduleDao.getCourseRepeatCheckInfos();
+		courseRepeatCheckInfos.sort(Comparator.comparing(CourseRepeatCheckDto::getStartClassTime));
+		Map<Date, List<CourseRepeatCheckDto>> dayCourseMap = courseRepeatCheckInfos.stream().collect(Collectors.groupingBy(CourseRepeatCheckDto::getClassDate));
+		Map<Long, List<Long>> courseRepeatIdMap = new HashMap<>();
+		for (CourseRepeatCheckDto cs1 : courseRepeatCheckInfos) {
+			if(!courseRepeatIdMap.containsKey(cs1.getCourseId())){
+				courseRepeatIdMap.put(cs1.getCourseId(), new ArrayList<>());
+			}else{
+				continue;
+			}
+			List<CourseRepeatCheckDto> dayCourses = dayCourseMap.get(cs1.getClassDate());
+			for (CourseRepeatCheckDto cs2 : dayCourses) {
+				if(cs1.getCourseId().equals(cs2.getCourseId())){
+					continue;
+				}
+				if(cs2.getEndClassTime().compareTo(cs1.getStartClassTime())<=0){
+					continue;
+				}
+				if(cs2.getStartClassTime().compareTo(cs1.getEndClassTime())>=0){
+					if(CollectionUtils.isEmpty(courseRepeatIdMap.get(cs1.getCourseId()))){
+						courseRepeatIdMap.remove(cs1.getCourseId());
+					}
+					break;
+				}
+				if(cs1.getStartClassTime().compareTo(cs2.getEndClassTime())>=0||cs1.getEndClassTime().compareTo(cs2.getStartClassTime())<=0){
+					continue;
+				}
+				long repeatTeacherNums = cs1.getTeacherIds().stream().filter(teacherId -> cs2.getTeacherIds().contains(teacherId)).count();
+				if(repeatTeacherNums>0){
+					System.out.println(cs1.getCourseId() + "," + cs2.getCourseId());
+					courseRepeatIdMap.get(cs1.getCourseId()).add(cs2.getCourseId());
+					continue;
+				}
+//				long repeatStudentNums = cs1.getStudentIds().stream().filter(studentId -> cs2.getStudentIds().contains(studentId)).count();
+//				if(repeatStudentNums>0){
+//					System.out.println(cs1.getCourseId() + "," + cs2.getCourseId());
+//					courseRepeatIdMap.get(cs1.getCourseId()).add(cs2.getCourseId());
+//					continue;
+//				}
+			}
+			if(CollectionUtils.isEmpty(courseRepeatIdMap.get(cs1.getCourseId()))){
+				courseRepeatIdMap.remove(cs1.getCourseId());
+			}
+		}
+		System.out.println("重复课程:" + JSON.toJSONString(courseRepeatIdMap));
+		System.out.println("重复课程数量:" + courseRepeatIdMap.size());
+	}
 }

+ 65 - 29
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -1,16 +1,13 @@
 package com.ym.mec.biz.service.impl;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
+import com.ym.mec.biz.service.SysConfigService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -19,27 +16,6 @@ import org.springframework.util.CollectionUtils;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
-import com.ym.mec.biz.dal.dao.StudentManageDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.SubjectChangeDao;
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dao.VipGroupDao;
-import com.ym.mec.biz.dal.entity.MusicGroupQuit;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.SubjectChange;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
 import com.ym.mec.biz.dal.page.StudentManageAttendanceQueryInfo;
@@ -102,6 +78,10 @@ public class StudentManageServiceImpl implements StudentManageService {
     private MusicGroupQuitDao musicGroupQuitDao;
     @Autowired
     private SubjectChangeDao subjectChangeDao;
+    @Autowired
+    private SysConfigService sysConfigService;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @Override
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
@@ -214,6 +194,62 @@ public class StudentManageServiceImpl implements StudentManageService {
     }
 
     @Override
+    public PageInfo<StudentVipDouble11Dto> queryDouble11Students(StudentManageQueryInfo queryInfo) {
+        PageInfo<StudentVipDouble11Dto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+
+        Teacher teacher = teacherDao.get(queryInfo.getTeacherId());
+        if (Objects.isNull(teacher)) {
+            return null;
+        }
+        List<Integer> organIds = new ArrayList<>();
+        if (Objects.nonNull(teacher.getTeacherOrganId())) {
+            organIds.add(teacher.getTeacherOrganId());
+        }
+        if (StringUtils.isNotBlank(teacher.getFlowOrganRange())) {
+            List<Integer> flowOrganRangeIds = Arrays.stream(teacher.getFlowOrganRange().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+            organIds.addAll(flowOrganRangeIds);
+        }
+
+        if (CollectionUtils.isEmpty(organIds)) {
+            return null;
+        }
+
+        params.put("organIds", organIds);
+
+        List<StudentVipDouble11Dto> dataList = new ArrayList<>();
+        int count = studentPaymentOrderDao.countDouble11Students(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = studentPaymentOrderDao.queryDouble11Students(params);
+            SysConfig vipSpecialActivityConfig = sysConfigService.findByParamName(SysConfigService.VIP_SPECIAL_ACTIVITY_IDS);
+            Map<Integer, StudentVipDouble11Dto> studentCourseTimeMap = new HashMap<>();
+            if(Objects.nonNull(vipSpecialActivityConfig)&&StringUtils.isNotBlank(vipSpecialActivityConfig.getParanValue())){
+                Set<Integer> studentIds = dataList.stream().map(StudentVipDouble11Dto::getUserId).collect(Collectors.toSet());
+                Set<Integer> specialActivityIds = Arrays.stream(vipSpecialActivityConfig.getParanValue().split(",")).map(Integer::valueOf).collect(Collectors.toSet());
+                List<StudentVipDouble11Dto> studentCourseTimeList = courseScheduleStudentPaymentDao.countStudentDouble11CourseTime(new ArrayList<>(studentIds), new ArrayList<>(specialActivityIds));
+                studentCourseTimeMap = studentCourseTimeList.stream().collect(Collectors.toMap(StudentVipDouble11Dto::getUserId, s -> s));
+            }
+            for (StudentVipDouble11Dto studentVipDouble11Dto : dataList) {
+                StudentVipDouble11Dto studentCourseTime = studentCourseTimeMap.get(studentVipDouble11Dto.getUserId());
+                studentVipDouble11Dto.setCourseOneToOneTime(studentVipDouble11Dto.getPaymentOneToOneTime()*20-(Objects.isNull(studentCourseTime)?0:studentCourseTime.getCourseOneToOneTime()));
+                if(studentVipDouble11Dto.getCourseOneToOneTime()<0){
+                    studentVipDouble11Dto.setCourseOneToOneTime(0);
+                }
+                studentVipDouble11Dto.setCourseOneToTwoTime(studentVipDouble11Dto.getPaymentOneToTwoTime()*20-(Objects.isNull(studentCourseTime)?0:studentCourseTime.getCourseOneToTwoTime()));
+                if(studentVipDouble11Dto.getCourseOneToTwoTime()<0){
+                    studentVipDouble11Dto.setCourseOneToTwoTime(0);
+                }
+            }
+        }
+        pageInfo.setRows(dataList);
+
+        return pageInfo;
+    }
+
+    @Override
     public StudentManageListDto findStudentManageBaseInfo(Integer userId) {
         return studentManageDao.findStudentBaseInfoByUserID(userId);
     }

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

@@ -347,6 +347,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		vipGroupDao.insert(vipGroupApplyBaseInfoDto);
 
+        vipGroup.getVipGroupApplyBaseInfo().setId(vipGroupApplyBaseInfoDto.getId());
+
 		//创建班级信息
 		ClassGroup classGroup=new ClassGroup();
 		classGroup.setSubjectIdList(vipGroupApplyBaseInfoDto.getSubjectIdList());

+ 27 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -3309,4 +3309,31 @@
         ORDER BY start_class_time_ DESC LIMIT 1;
     </select>
 
+    <resultMap id="CourseRepeatCheckDto" type="com.ym.mec.biz.dal.dto.CourseRepeatCheckDto">
+        <result column="course_id_" property="courseId"/>
+        <result column="class_date_" property="classDate"/>
+        <result column="class_start_time_" property="startClassTime"/>
+        <result column="class_end_time_" property="endClassTime"/>
+        <collection property="teacherIds" ofType="int" javaType="list">
+            <result column="teacher_id_"/>
+        </collection>
+        <collection property="studentIds" ofType="int" javaType="list">
+            <result column="student_id_"/>
+        </collection>
+    </resultMap>
+
+    <select id="getCourseRepeatCheckInfos" resultMap="CourseRepeatCheckDto">
+        SELECT
+            cs.id_ course_id_,
+            cs.class_date_ class_date_,
+            CONCAT(cs.class_date_, ' ', cs.start_class_time_) class_start_time_,
+            CONCAT(cs.class_date_, ' ', cs.end_class_time_) class_end_time_,
+            cssp.user_id_ teacher_id_,
+            csts.user_id_ student_id_
+        FROM course_schedule cs
+        LEFT JOIN course_schedule_student_payment cssp ON cs.id_=cssp.course_schedule_id_
+        LEFT JOIN course_schedule_teacher_salary csts ON cs.id_=csts.course_schedule_id_
+        WHERE cs.organ_id_!=41 AND cs.del_flag_=0 AND cs.create_time_>'2020-01-01 00:00:00' AND cs.create_time_&lt;'3000-01-01 00:00:00'
+    </select>
+
 </mapper>

+ 22 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -542,4 +542,26 @@
 		SELECT COUNT(*) FROM course_schedule_student_payment
 		<include refid="queryAllCondition" />
 	</select>
+
+    <select id="countStudentDouble11CourseTime" resultMap="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentVipDouble11Dto">
+		SELECT
+			cssp.user_id_ userId,
+			SUM(CASE vgc.student_num_ WHEN 1 THEN 1 ELSE 0 END) course_one_to_one_time_,
+			SUM(CASE vgc.student_num_ WHEN 2 THEN 1 ELSE 0 END) course_one_to_two_time_
+		FROM
+			course_schedule_student_payment cssp
+			LEFT JOIN vip_group vg ON cssp.music_group_id_ = vg.id_
+			LEFT JOIN vip_group_category vgc ON vg.vip_group_category_id_ = vgc.id_
+		WHERE
+			cssp.user_id_ IN
+			<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
+				#{userId}
+			</foreach>
+			AND vg.vip_group_activity_id_ IN
+			<foreach collection="specialActivityIds" item="specialActivityId" open="(" close=")" separator=",">
+				#{specialActivityId}
+			</foreach>
+		GROUP BY
+			cssp.user_id_
+    </select>
 </mapper>

+ 24 - 0
mec-biz/src/main/resources/config/mybatis/SporadicChargeInfo.xml

@@ -194,4 +194,28 @@
         AND sci.del_flag_ = 0
         GROUP BY o.id_
     </select>
+
+    <sql id="findSporadicChargeInfosCondition">
+        <where>
+            del_flag_ = 0
+            <if test="organId!=null">
+                AND organ_id_=#{organId}
+            </if>
+            <if test="organIds!=null">
+                AND organ_id_ IN
+                <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+                    #{organId}
+                </foreach>
+            </if>
+            <if test="chargeType!=null">
+                AND charge_type_ = #{chargeType}
+            </if>
+        </where>
+    </sql>
+
+    <select id="findSporadicChargeInfos" resultMap="SporadicChargeInfo">
+        SELECT *
+        FROM sporadic_charge_info
+        <include refid="findSporadicChargeInfosCondition" />
+    </select>
 </mapper>

+ 55 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -67,6 +67,13 @@
         <result column="complement_goods_id_list_" property="complementGoodsIdList"/>
     </resultMap>
 
+    <resultMap id="StudentVipDouble11Dto" type="com.ym.mec.biz.dal.dto.StudentVipDouble11Dto">
+        <result column="payment_one_to_one_time_" property="paymentOneToOneTime"/>
+        <result column="payment_one_to_two_time_" property="paymentOneToTwoTime"/>
+        <result column="course_one_to_one_time_" property="courseOneToOneTime"/>
+        <result column="course_one_to_two_time_" property="courseOneToTwoTime"/>
+    </resultMap>
+
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentPaymentOrder">
         SELECT *
@@ -752,4 +759,52 @@
     <select id="getUserOrderByType" resultMap="StudentPaymentOrder">
         SELECT * FROM student_payment_order WHERE user_id_=#{userId} AND type_=#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
     </select>
+
+    <select id="queryDouble11Students" resultMap="StudentVipDouble11Dto">
+        SELECT
+            su.id_ userId,
+            su.real_name_ userName,
+            su.phone_ phone,
+            su.avatar_ avatar,
+            SUM(CASE WHEN sci.title_ LIKE '%1V1%' THEN spo.class_group_id_ ELSE 0 END) payment_one_to_one_time_,
+            SUM(CASE WHEN sci.title_ LIKE '%1V2%' THEN spo.class_group_id_ ELSE 0 END) payment_one_to_two_time_
+        FROM
+            student_payment_order spo
+            LEFT JOIN sporadic_charge_info sci ON spo.music_group_id_=sci.id_
+            LEFT JOIN sys_user su ON spo.user_id_ = su.id_
+        WHERE
+            spo.status_ = 'SUCCESS'
+            AND spo.type_ = 'DOUBLE_ELEVEN2020'
+            AND sci.title_ LIKE '双十一%'
+            AND sci.organ_id_ IN
+            <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+                #{organId}
+            </foreach>
+            <if test="search!=null and search!=''">
+                AND (su.phone_=#{search} OR su.username_ LIKE CONCAT('%', #{search}, '%'))
+            </if>
+        GROUP BY
+            spo.user_id_
+        ORDER BY spo.user_id_
+    </select>
+
+    <select id="countDouble11Students" resultType="int">
+        SELECT
+            COUNT(DISTINCT spo.user_id_)
+        FROM
+        student_payment_order spo
+        LEFT JOIN sporadic_charge_info sci ON spo.music_group_id_=sci.id_
+        LEFT JOIN sys_user su ON spo.user_id_ = su.id_
+        WHERE
+        spo.status_ = 'SUCCESS'
+        AND spo.type_ = 'DOUBLE_ELEVEN2020'
+        AND sci.title_ LIKE '双十一%'
+        AND sci.organ_id_ IN
+        <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+            #{organId}
+        </foreach>
+        <if test="search!=null and search!=''">
+            AND (su.phone_=#{search} OR su.username_ LIKE CONCAT('%', #{search}, '%'))
+        </if>;
+    </select>
 </mapper>

+ 38 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipGroupController.java

@@ -10,15 +10,21 @@ import com.ym.mec.biz.dal.page.StudentManageQueryInfo;
 import com.ym.mec.biz.service.StudentManageService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.util.date.DateUtil;
 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.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
+import java.util.Date;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @Author Joburgess
@@ -55,6 +61,27 @@ public class TeacherVipGroupController extends BaseController {
 		return succeed();
 	}
 
+	@ApiOperation("vip课申请-双11")
+	@PostMapping("/vipGroupApplyForDouble11")
+	@Transactional(rollbackFor = Exception.class)
+	public Object vipGroupApplyForDouble11(@RequestBody VipGroupApplyDto vipGroupApplyDto) {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		if (Objects.isNull(user)) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		Integer userId = user.getId();
+		Teacher teacher = teacherDao.get(userId);
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setUserId(userId);
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setTeacherId(Long.valueOf(userId));
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganIdList(teacher.getTeacherOrganId().toString());
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganId(teacher.getTeacherOrganId());
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setRegistrationStartTime(new Date());
+		vipGroupApplyDto.getVipGroupApplyBaseInfo().setPaymentExpireDate(DateUtil.addDays(vipGroupApplyDto.getVipGroupApplyBaseInfo().getRegistrationStartTime(),1));
+		vipGroupService.createVipGroup(vipGroupApplyDto);
+		vipGroupService.addVipGroupStudents(vipGroupApplyDto.getVipGroupApplyBaseInfo().getId(), Arrays.stream(vipGroupApplyDto.getVipGroupApplyBaseInfo().getStudentIdList().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
+		return succeed();
+	}
+
 	@ApiOperation("获取vip课课程和课酬总费用")
 	@PostMapping("/getVipGroupCostCount")
 	public Object getVipGroupCostCount(VipGroupCostCountParamsDto vipGroupCostCountParamsDto) {
@@ -83,4 +110,15 @@ public class TeacherVipGroupController extends BaseController {
 		return succeed(studentManageService.queryStudentsWithTeacher(queryInfo));
 	}
 
+	@ApiOperation(value = "获取参与双十一活动学员列表")
+	@GetMapping("/queryDouble11Students")
+	public HttpResponseResult queryDouble11Students(StudentManageQueryInfo queryInfo){
+		SysUser user = sysUserFeignService.queryUserInfo();
+		if (Objects.isNull(user)) {
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		queryInfo.setTeacherId(user.getId());
+		return succeed(studentManageService.queryDouble11Students(queryInfo));
+	}
+
 }

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -21,6 +21,7 @@ import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.StudentAttendanceService;
 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;
@@ -409,5 +410,12 @@ public class CourseScheduleController extends BaseController {
         courseScheduleService.cleanAttendance(courseScheduleIds);
         return succeed();
     }
+
+    @ApiOperation(value = "清空老师和学生考勤记录")
+    @GetMapping("/courseRepeatCheck")
+    public HttpResponseResult courseRepeatCheck(){
+        courseScheduleService.courseRepeatCheck();
+        return succeed();
+    }
 }