فهرست منبع

1、陪练课调整
2、付费陪练课

Joburgess 5 سال پیش
والد
کامیت
c18760544e

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PracticeGroupSellPriceDao.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.PracticeGroupSellPrice;
+import com.ym.mec.common.dal.BaseDAO;
+
+/**
+ * @Author Joburgess
+ * @Date 2020/2/18
+ */
+public interface PracticeGroupSellPriceDao extends BaseDAO<Integer, PracticeGroupSellPrice> {
+
+
+
+}

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java

@@ -104,7 +104,18 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
      * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherBasicDto>
      */
     List<ExtendTeacherBasicDto> findTeaTeachersByOrganAndSubject1(@Param("organId") Integer organId,
-                                                                 @Param("subjectId") Integer subjectId);
+                                                                  @Param("subjectId") Integer subjectId);
+
+    /**
+     * @describe 获取指定声部和分部下的全职老师--付费
+     * @author Joburgess
+     * @date 2020/2/2
+     * @param organId: 分部编号
+     * @param subjectId: 声部编号列表
+     * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherBasicDto>
+     */
+    List<ExtendTeacherBasicDto> findTeaTeachersByOrganAndSubject2(@Param("organId") Integer organId,
+                                                                  @Param("subjectId") Integer subjectId);
 
     /**
      * @describe 根据部门和声部获取教师列表

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ExtendTeacherBasicDto.java

@@ -6,8 +6,22 @@ package com.ym.mec.biz.dal.dto;
  */
 public class ExtendTeacherBasicDto extends TeacherBasicDto {
 
+    private String avatar;
+
+    private String subjectNames;
+
+    private String introduction;
+
     int isSupportExtraPracticeLesson = 0;
 
+    public String getIntroduction() {
+        return introduction;
+    }
+
+    public void setIntroduction(String introduction) {
+        this.introduction = introduction;
+    }
+
     public int getIsSupportExtraPracticeLesson() {
         return isSupportExtraPracticeLesson;
     }
@@ -15,4 +29,20 @@ public class ExtendTeacherBasicDto extends TeacherBasicDto {
     public void setIsSupportExtraPracticeLesson(int isSupportExtraPracticeLesson) {
         this.isSupportExtraPracticeLesson = isSupportExtraPracticeLesson;
     }
+
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public String getSubjectNames() {
+        return subjectNames;
+    }
+
+    public void setSubjectNames(String subjectNames) {
+        this.subjectNames = subjectNames;
+    }
 }

+ 0 - 21
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PracticeGroupBuyDto.java

@@ -11,12 +11,6 @@ import java.util.List;
  */
 public class PracticeGroupBuyDto extends PracticeGroup {
 
-    @ApiModelProperty(value = "购买月数",required = true)
-    private Integer buyMonths;
-
-    @ApiModelProperty(value = "单周训练次数",required = true)
-    private Integer drillTimesOnWeek;
-
     @ApiModelProperty(value = "是否使用账户余额支付")
     private boolean useBalancePayment;
 
@@ -38,19 +32,4 @@ public class PracticeGroupBuyDto extends PracticeGroup {
         this.drillTimes = drillTimes;
     }
 
-    public Integer getBuyMonths() {
-        return buyMonths;
-    }
-
-    public void setBuyMonths(Integer buyMonths) {
-        this.buyMonths = buyMonths;
-    }
-
-    public Integer getDrillTimesOnWeek() {
-        return drillTimesOnWeek;
-    }
-
-    public void setDrillTimesOnWeek(Integer drillTimesOnWeek) {
-        this.drillTimesOnWeek = drillTimesOnWeek;
-    }
 }

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SimpleUserDto.java

@@ -10,11 +10,41 @@ public class SimpleUserDto {
 
     private String userName;
 
+    private String avatar;
+
+    private String subjectNames;
+
+    private String introduction;
+
     public SimpleUserDto(Integer userId, String userName) {
         this.userId = userId;
         this.userName = userName;
     }
 
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public String getSubjectNames() {
+        return subjectNames;
+    }
+
+    public void setSubjectNames(String subjectNames) {
+        this.subjectNames = subjectNames;
+    }
+
+    public String getIntroduction() {
+        return introduction;
+    }
+
+    public void setIntroduction(String introduction) {
+        this.introduction = introduction;
+    }
+
     public Integer getUserId() {
         return userId;
     }

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PracticeGroup.java

@@ -48,6 +48,36 @@ public class PracticeGroup {
 	/**  */
 	private String memo;
 
+	private Integer buyMonths;
+
+	private Integer drillTimesOnWeek;
+
+	private String drillTimesJson;
+
+	public Integer getBuyMonths() {
+		return buyMonths;
+	}
+
+	public void setBuyMonths(Integer buyMonths) {
+		this.buyMonths = buyMonths;
+	}
+
+	public Integer getDrillTimesOnWeek() {
+		return drillTimesOnWeek;
+	}
+
+	public void setDrillTimesOnWeek(Integer drillTimesOnWeek) {
+		this.drillTimesOnWeek = drillTimesOnWeek;
+	}
+
+	public String getDrillTimesJson() {
+		return drillTimesJson;
+	}
+
+	public void setDrillTimesJson(String drillTimesJson) {
+		this.drillTimesJson = drillTimesJson;
+	}
+
 	public Integer getStudentId() {
 		return studentId;
 	}

+ 81 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/PracticeGroupSellPrice.java

@@ -0,0 +1,81 @@
+package com.ym.mec.biz.dal.entity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2020/2/18
+ */
+public class PracticeGroupSellPrice {
+
+    private Integer organId;
+
+    private BigDecimal onceOriginalPrice;
+
+    private BigDecimal onceActivityPrice;
+
+    private BigDecimal twiceOriginalPrice;
+
+    private BigDecimal twiceActivityPrice;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public BigDecimal getOnceOriginalPrice() {
+        return onceOriginalPrice;
+    }
+
+    public void setOnceOriginalPrice(BigDecimal onceOriginalPrice) {
+        this.onceOriginalPrice = onceOriginalPrice;
+    }
+
+    public BigDecimal getOnceActivityPrice() {
+        return onceActivityPrice;
+    }
+
+    public void setOnceActivityPrice(BigDecimal onceActivityPrice) {
+        this.onceActivityPrice = onceActivityPrice;
+    }
+
+    public BigDecimal getTwiceOriginalPrice() {
+        return twiceOriginalPrice;
+    }
+
+    public void setTwiceOriginalPrice(BigDecimal twiceOriginalPrice) {
+        this.twiceOriginalPrice = twiceOriginalPrice;
+    }
+
+    public BigDecimal getTwiceActivityPrice() {
+        return twiceActivityPrice;
+    }
+
+    public void setTwiceActivityPrice(BigDecimal twiceActivityPrice) {
+        this.twiceActivityPrice = twiceActivityPrice;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

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

@@ -116,6 +116,15 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
 	 */
 	Object findPracticeGroupCourseSchedules(PracticeGroupQueryInfo queryInfo);
 
+	/**
+	 * @describe 获取学生上一次购买的记录
+	 * @author Joburgess
+	 * @date 2020/2/18
+	 * @param userId:
+	 * @return com.ym.mec.biz.dal.entity.PracticeGroup
+	 */
+	PracticeGroup findUserLatestPracticeGroup(Integer userId);
+
     /**
      * @describe 获取陪练课预约参数——付费
      * @author Joburgess
@@ -123,7 +132,17 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
      * @param userId: 用户编号
      * @return java.util.Map
      */
-    Map getPayPracticeApplyParams(Integer userId);
+    Map getPayPracticeApplyParams(Integer userId, Integer organId);
+
+	/**
+	 * @describe 获取可以预约的教师——付费
+	 * @author Joburgess
+	 * @date 2020/2/9
+	 * @param userId: 用户编号
+	 * @param subjectId: 声部编号
+	 * @return java.util.List<com.ym.mec.biz.dal.dto.SimpleUserDto>
+	 */
+	List<SimpleUserDto> getEnableApplyTeachersWithPay(Integer userId, Integer subjectId);
 
     /**
      * @describe 获取指定教师的空闲时间——付费

+ 126 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -103,6 +103,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     private StudentPaymentOrderDao studentPaymentOrderDao;
     @Autowired
     private GroupService groupService;
+    @Autowired
+    private PracticeGroupSellPriceDao practiceGroupSellPriceDao;
 
     private static Map<Integer, Map<Integer, List<Integer>>> schoolSubjectTeachersMap;
 
@@ -838,6 +840,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         Set<Integer> disableApplyWeekNum = new HashSet<>();
+        Set<Integer> disableApplyWeekDay = new HashSet<>();
 
         TeacherFreeTime teacherFreeTime = teacherFreeTimeDao.findTeacherFreeTime(teacherId);
         JSONObject teacherFreeTimes=new JSONObject();
@@ -852,24 +855,38 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             }
             if(Objects.nonNull(teacherFreeTime.getMonday())){
                 teacherFreeTimes.put(String.valueOf(Calendar.MONDAY), JSON.parseArray(teacherFreeTime.getMonday()));
+            }else{
+                disableApplyWeekDay.add(Calendar.MONDAY);
             }
-            if(Objects.nonNull(teacherFreeTime.getMonday())){
+            if(Objects.nonNull(teacherFreeTime.getTuesday())){
                 teacherFreeTimes.put(String.valueOf(Calendar.TUESDAY), JSON.parseArray(teacherFreeTime.getTuesday()));
+            }else{
+                disableApplyWeekDay.add(Calendar.TUESDAY);
             }
-            if(Objects.nonNull(teacherFreeTime.getMonday())){
+            if(Objects.nonNull(teacherFreeTime.getWednesday())){
                 teacherFreeTimes.put(String.valueOf(Calendar.WEDNESDAY), JSON.parseArray(teacherFreeTime.getWednesday()));
+            }else{
+                disableApplyWeekDay.add(Calendar.WEDNESDAY);
             }
-            if(Objects.nonNull(teacherFreeTime.getMonday())){
+            if(Objects.nonNull(teacherFreeTime.getThursday())){
                 teacherFreeTimes.put(String.valueOf(Calendar.THURSDAY), JSON.parseArray(teacherFreeTime.getThursday()));
+            }else{
+                disableApplyWeekDay.add(Calendar.THURSDAY);
             }
-            if(Objects.nonNull(teacherFreeTime.getMonday())){
+            if(Objects.nonNull(teacherFreeTime.getFriday())){
                 teacherFreeTimes.put(String.valueOf(Calendar.FRIDAY), JSON.parseArray(teacherFreeTime.getFriday()));
+            }else{
+                disableApplyWeekDay.add(Calendar.FRIDAY);
             }
-            if(Objects.nonNull(teacherFreeTime.getMonday())){
+            if(Objects.nonNull(teacherFreeTime.getSaturday())){
                 teacherFreeTimes.put(String.valueOf(Calendar.SATURDAY), JSON.parseArray(teacherFreeTime.getSaturday()));
+            }else{
+                disableApplyWeekDay.add(Calendar.SATURDAY);
             }
-            if(Objects.nonNull(teacherFreeTime.getMonday())){
+            if(Objects.nonNull(teacherFreeTime.getSunday())){
                 teacherFreeTimes.put(String.valueOf(Calendar.SUNDAY), JSON.parseArray(teacherFreeTime.getSunday()));
+            }else{
+                disableApplyWeekDay.add(Calendar.SUNDAY);
             }
         }
 
@@ -990,6 +1007,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 }
                 calendar.setTime(enableApplyDate);
                 int dayOfWeek=calendar.get(Calendar.DAY_OF_WEEK);
+                if(disableApplyWeekDay.contains(dayOfWeek)){
+                    continue;
+                }
                 JSONArray teacherWeekDayFreeTimes = teacherFreeTimes.getJSONArray(String.valueOf(dayOfWeek));
                 if(Objects.nonNull(teacherWeekDayFreeTimes)){
                     LocalTime enableApplyStartTime=LocalDateTime.ofInstant(enableApplyDate.toInstant(),DateUtil.zoneId).toLocalTime();
@@ -1106,6 +1126,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             calendar.setTime(enableApplyDate);
 
             int dayOfWeek=calendar.get(Calendar.DAY_OF_WEEK);
+            if(disableApplyWeekDay.contains(disableApplyWeekDay)){
+                continue;
+            }
             JSONArray teacherWeekDayFreeTimes = teacherFreeTimes.getJSONArray(String.valueOf(dayOfWeek));
             if(Objects.nonNull(teacherWeekDayFreeTimes)){
                 LocalTime enableApplyStartTime=LocalDateTime.ofInstant(enableApplyDate.toInstant(),DateUtil.zoneId).toLocalTime();
@@ -2050,9 +2073,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         return result;
     }
 
+    @Override
+    public PracticeGroup findUserLatestPracticeGroup(Integer userId) {
+        return practiceGroupDao.findUserLatestPracticeGroup(userId);
+    }
 
     @Override
-    public Map getPayPracticeApplyParams(Integer userId) {
+    public Map getPayPracticeApplyParams(Integer userId, Integer organId) {
         Map result = new HashMap();
         SysConfig practiceSubjectIdListConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_SUBJECT_ID_LIST);
         SysConfig practiceApplyStartTimeConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_APPLY_START_TIME);
@@ -2070,7 +2097,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         } else {
             userDefaultSubjectIds = new ArrayList<>();
         }
-
+        PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(organId);
         result.put("subjects", subjects);
         result.put("practiceApplyStartTime", practiceApplyStartTimeConfig.getParanValue());
         result.put("practiceApplyEndTime", practiceApplyEndTimeConfig.getParanValue());
@@ -2079,9 +2106,89 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
         result.put("practicePayMaxMonth", practicePayMaxMonthConfig.getParanValue(Integer.class));
         result.put("practicePayDrillTimesOnOneWeek", practicePayDrillTimesOnOneWeekConfig.getParanValue(Integer.class));
+        result.put("practiceGroupSellPrice", practiceGroupSellPrice);
         return result;
     }
 
+    @Override
+    public List<SimpleUserDto> getEnableApplyTeachersWithPay(Integer userId, Integer subjectId) {
+        if (Objects.isNull(subjectId)) {
+            throw new BizException("请选择声部");
+        }
+        SysUser sysUser = sysUserFeignService.queryUserById(userId);
+        if (Objects.isNull(sysUser)) {
+            throw new BizException("用户不存在");
+        }
+        if (Objects.isNull(sysUser.getOrganId())) {
+            throw new BizException("未找到用户分部属性");
+        }
+
+        if (sysUser.getOrganId().equals(DALIAN_ORGAN_ID)) {
+            sysUser.setOrganId(SHENYANG_ORGAN_ID);
+        }
+
+        List<Integer> includeTeacherIds = new ArrayList<>();
+        List<ExtendTeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject2(sysUser.getOrganId(), subjectId);
+        if (CollectionUtils.isEmpty(organAndSubjectTeachers)) {
+            return new ArrayList<>();
+        }
+
+        List<Integer> allTeacherIds = organAndSubjectTeachers.stream().map(TeacherBasicDto::getId).collect(Collectors.toList());
+
+        List<CourseSchedule> userCourses = courseScheduleDao.findUserCourses(userId, allTeacherIds);
+
+        if (!CollectionUtils.isEmpty(userCourses)) {
+            Map<CourseSchedule.CourseScheduleType, List<CourseSchedule>> courseTypeCourseMap = userCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getType));
+            List<CourseSchedule> vipCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.VIP);
+            if (!CollectionUtils.isEmpty(vipCourses)) {
+                for (CourseSchedule vipCourse : vipCourses) {
+                    if (!includeTeacherIds.contains(vipCourse.getTeacherId())) {
+                        includeTeacherIds.add(vipCourse.getTeacherId());
+                    }
+                }
+            }
+            List<CourseSchedule> singleCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE);
+            if (!CollectionUtils.isEmpty(singleCourses)) {
+                for (CourseSchedule singleCourse : singleCourses) {
+                    if (!includeTeacherIds.contains(singleCourse.getTeacherId())) {
+                        includeTeacherIds.add(singleCourse.getTeacherId());
+                    }
+                }
+            }
+            List<CourseSchedule> highCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.HIGH);
+            if (!CollectionUtils.isEmpty(highCourses)) {
+                for (CourseSchedule highCourse : highCourses) {
+                    if (!includeTeacherIds.contains(highCourse.getTeacherId())) {
+                        includeTeacherIds.add(highCourse.getTeacherId());
+                    }
+                }
+            }
+        }
+
+        for (ExtendTeacherBasicDto organAndSubjectTeacher : organAndSubjectTeachers) {
+            if (!includeTeacherIds.contains(organAndSubjectTeacher.getId())
+                    && 1 == organAndSubjectTeacher.getIsSupportExtraPracticeLesson()) {
+                includeTeacherIds.add(organAndSubjectTeacher.getId());
+            }
+        }
+
+        if (CollectionUtils.isEmpty(new ArrayList<>(includeTeacherIds))) {
+            return new ArrayList<>();
+        }
+
+        List<SimpleUserDto> userInfos = new ArrayList<>();
+        Map<Integer, ExtendTeacherBasicDto> idTeacherMap = organAndSubjectTeachers.stream().collect(Collectors.toMap(ExtendTeacherBasicDto::getId, teacher -> teacher));
+        for (Integer includeTeacherId : includeTeacherIds) {
+            ExtendTeacherBasicDto teacher = idTeacherMap.get(includeTeacherId);
+            SimpleUserDto simpleUserDto=new SimpleUserDto(includeTeacherId, teacher.getRealName());
+            simpleUserDto.setAvatar(teacher.getAvatar());
+            simpleUserDto.setIntroduction(teacher.getIntroduction());
+            simpleUserDto.setSubjectNames(teacher.getSubjectNames());
+            userInfos.add(simpleUserDto);
+        }
+
+        return userInfos;
+    }
 
     @Override
     public Map<Integer, List<String>> getEnableApplyDatesWithWeek() {
@@ -2426,6 +2533,16 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             return BaseController.failed(HttpStatus.FOUND, "课程冲突");
         }
 
+        JSONObject drillTimesObject=new JSONObject();
+        for (PracticeDrillTimeDto drillTime : practiceGroupBuyParams.getDrillTimes()) {
+            drillTimesObject.put(String.valueOf(drillTime.getWeekNum()),drillTime.getTimeStr());
+        }
+
+        PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(sysUser.getOrganId());
+        BigDecimal oneMonthPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceActivityPrice():practiceGroupSellPrice.getTwiceActivityPrice();
+        BigDecimal amount= oneMonthPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
+
+        practiceGroupBuyParams.setDrillTimesJson(drillTimesObject.toJSONString());
         practiceGroupBuyParams.setOrganId(sysUser.getOrganId());
         practiceGroupBuyParams.setSingleClassMinutes(practiceCourseMinutes);
         practiceGroupDao.insert(practiceGroupBuyParams);
@@ -2542,15 +2659,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         studentPaymentOrder.setOrderNo(orderNo);
         studentPaymentOrder.setStatus(DealStatusEnum.ING);
         studentPaymentOrder.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
-        studentPaymentOrder.setExpectAmount(new BigDecimal(practiceCourseSalaryConfig.getParanValue(Integer.class)));
+        studentPaymentOrder.setExpectAmount(amount);
         studentPaymentOrder.setMusicGroupId(practiceGroupBuyParams.getId().toString());
         studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
         studentPaymentOrder.setClassGroupId(classGroup.getId());
         studentPaymentOrder.setVersion(0);
         studentPaymentOrderService.insert(studentPaymentOrder);
 
-        BigDecimal amount=new BigDecimal(0);
-
         if(practiceGroupBuyParams.isUseBalancePayment() || studentPaymentOrder.getExpectAmount().doubleValue() == 0){
             SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(practiceGroupBuyParams.getStudentId());
             if(userCashAccount == null){

+ 6 - 1
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -19,6 +19,9 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="memo_" property="memo" />
+		<result column="buy_months_" property="buyMonths" />
+		<result column="drill_times_on_week_" property="drillTimesOnWeek" />
+		<result column="drill_times_json_" property="drillTimesJson" />
 	</resultMap>
 
 	<resultMap type="com.ym.mec.biz.dal.dto.PracticeGroupDto" id="PracticeGroupDto">
@@ -58,7 +61,9 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO practice_group (id_,name_,subject_id_,user_id_,student_id_,single_class_minutes_,organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,memo_) VALUES(#{id},#{name},#{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},#{coursesExpireDate},NOW(),NOW(),#{memo})
+		INSERT INTO practice_group
+		(id_,name_,subject_id_,user_id_,student_id_,single_class_minutes_,organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,memo_,buy_months_,drill_times_on_week_,drill_times_json_)
+		VALUES(#{id},#{name},#{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},#{coursesExpireDate},NOW(),NOW(),#{memo},#{buyMonths},#{drillTimesOnWeek},#{drillTimesJson})
 	</insert>
 	
 	

+ 74 - 0
mec-biz/src/main/resources/config/mybatis/PracticeGroupSellPriceMapper.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
+<mapper namespace="com.ym.mec.biz.dal.dao.PracticeGroupSellPriceDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.PracticeGroupSellPrice" id="PracticeGroupSellPrice">
+		<result column="organ_id_" property="organId" />
+		<result column="once_original_price" property="onceOriginalPrice" />
+		<result column="once_activity_price" property="onceActivityPrice" />
+		<result column="twice_original_price" property="twiceOriginalPrice" />
+		<result column="twice_activity_price" property="twiceActivityPrice" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="PracticeGroupSellPrice">
+		SELECT * FROM
+		practice_group_sell_price WHERE organ_id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="PracticeGroupSellPrice">
+		SELECT * FROM practice_group_sell_price
+		ORDER BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.PracticeGroupSellPrice"
+		useGeneratedKeys="true" keyColumn="organ_id_" keyProperty="organId">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO practice_group_sell_price
+		(`organ_id_`, `once_original_price`, `once_activity_price`, `twice_original_price`, `twice_activity_price`, `create_time_`, `update_time_`)
+		VALUES(#{organId},#{onceOriginalPrice},#{onceActivityPrice},#{twiceOriginalPrice},#{twiceActivityPrice},#{createTime},#{updateTime})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.PracticeGroupSellPrice">
+		UPDATE practice_group_sell_price
+		<set>
+			<if test="onceOriginalPrice != null">
+				once_original_price = #{onceOriginalPrice},
+			</if>
+			<if test="onceActivityPrice != null">
+				once_activity_price = #{onceActivityPrice},
+			</if>
+			<if test="twiceOriginalPrice != null">
+				twice_original_price = #{twiceOriginalPrice},
+			</if>
+			<if test="twiceActivityPrice != null">
+				twice_activity_price = #{twiceActivityPrice},
+			</if>
+			update_time_=NOW
+		</set>
+		WHERE organ_id_ = #{organId}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM practice_group_sell_price WHERE organ_id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="PracticeGroupSellPrice" parameterType="map">
+		SELECT * FROM practice_group_sell_price ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM practice_group_sell_price
+	</select>
+</mapper>

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

@@ -288,6 +288,9 @@
 
     <resultMap id="ExtendTeacherBasicDto" type="com.ym.mec.biz.dal.dto.ExtendTeacherBasicDto" extends="TeacherBasicDto">
         <result property="isSupportExtraPracticeLesson" column="is_support_extra_practice_lesson_"/>
+        <result property="avatar" column="avatar_"/>
+        <result property="subjectNames" column="subject_names_"/>
+        <result property="introduction" column="introduction_"/>
     </resultMap>
     <select id="findTeachers" resultMap="TeacherBasicDto">
         SELECT su.id_,su.username_,su.real_name_,t.organ_id_ FROM sys_user su
@@ -346,6 +349,30 @@
             AND su.del_flag_=0 AND su.lock_flag_=0
             AND t.organ_id_!=36 AND t.organ_id_!=38
     </select>
+
+    <select id="findTeaTeachersByOrganAndSubject2" resultMap="ExtendTeacherBasicDto">
+        SELECT
+            su.id_,
+            su.username_,
+            su.real_name_,
+            su.avatar_,
+            t.introduction_,
+            t.organ_id_,
+            t.is_support_extra_practice_lesson_,
+            GROUP_CONCAT(s.name_) subject_names_
+        FROM
+            teacher t
+            LEFT JOIN sys_user su ON t.id_ = su.id_
+            LEFT JOIN subject s ON FIND_IN_SET(s.id_,t.subject_id_)
+        WHERE
+            FIND_IN_SET(#{subjectId},t.subject_id_)
+            AND (t.organ_id_=#{organId} OR FIND_IN_SET(#{organId},t.flow_organ_range_))
+            AND t.job_nature_='FULL_TIME'
+            AND su.del_flag_=0 AND su.lock_flag_=0
+            AND t.organ_id_!=36 AND t.organ_id_!=38
+        GROUP BY su.id_
+    </select>
+
     <select id="findTeacherByOrganAndSubject" resultMap="TeacherBasicDto">
         SELECT
             su.id_,

+ 35 - 5
mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java

@@ -2,18 +2,17 @@ package com.ym.mec.student.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dto.PracticeGroupBuyDto;
 import com.ym.mec.biz.dal.entity.PracticeGroup;
 import com.ym.mec.biz.service.PracticeGroupService;
 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.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -65,6 +64,16 @@ public class PracticeGroupController extends BaseController {
         return succeed(practiceGroupService.getEnableApplyTeachers(sysUser.getId(), subjectId));
     }
 
+    @ApiOperation("获取可以预约的教师--付费")
+    @GetMapping(value = "/getEnableApplyTeachersWithPay")
+    public Object getEnableApplyTeachersWithPay(Integer subjectId){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(practiceGroupService.getEnableApplyTeachersWithPay(sysUser.getId(), subjectId));
+    }
+
     @ApiOperation("获取指定学员所在分部下的教师空闲时间")
     @GetMapping(value = "/getTeacherFreeTimes")
     public Object getTeacherFreeTimes(Integer teacherId, Date firstClassTime){
@@ -106,7 +115,7 @@ public class PracticeGroupController extends BaseController {
         if (sysUser == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        return succeed(practiceGroupService.getPayPracticeApplyParams(sysUser.getId()));
+        return succeed(practiceGroupService.getPayPracticeApplyParams(sysUser.getId(), sysUser.getOrganId()));
     }
 
     @ApiOperation("获取指定教师的空闲时间——付费")
@@ -119,4 +128,25 @@ public class PracticeGroupController extends BaseController {
         return succeed(practiceGroupService.getPayPracticeTeacherFreeTimes(sysUser.getId(),teacherId, buyMonths,firstClassTime));
     }
 
+    @ApiOperation("获取学生上一次的购买信息--付费")
+    @GetMapping(value = "/findUserLatestPracticeGroup")
+    public HttpResponseResult findUserLatestPracticeGroup(){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(practiceGroupService.findUserLatestPracticeGroup(sysUser.getId()));
+    }
+
+    @ApiOperation("陪练课购买")
+    @GetMapping(value = "/buyPracticeGroup")
+    public HttpResponseResult buyPracticeGroup(@RequestBody PracticeGroupBuyDto practiceGroupBuyParams){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        practiceGroupBuyParams.setStudentId(sysUser.getId());
+        return succeed(practiceGroupService.findUserLatestPracticeGroup(sysUser.getId()));
+    }
+
 }