浏览代码

Merge remote-tracking branch 'origin/master'

周箭河 5 年之前
父节点
当前提交
d1121c7dc6

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

@@ -825,7 +825,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
                                   @Param("schoolId") Integer schoolId);
 
 
-    int countVipGroupCourses(@Param("vipGroupId") Integer vipGroupId);
+    int countVipGroupCourses(@Param("vipGroupId") Integer vipGroupId,@Param("groupType") String groupType);
 
     /**
      * @param groupType:

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupCourseAdjustInfoDto.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dto;
 
+import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -16,6 +17,9 @@ public class VipGroupCourseAdjustInfoDto {
     @ApiModelProperty(value = "vip课编号")
     private Integer vipGroupId;
 
+    @ApiModelProperty(value = "课程组类型")
+    private GroupType groupType;
+
     @ApiModelProperty(value = "需要调整的vip课排课计划的编号")
     private String courseScheduleIds;
 
@@ -40,6 +44,14 @@ public class VipGroupCourseAdjustInfoDto {
     @ApiModelProperty(value = "教学点")
     private Integer schoolId;
 
+    public GroupType getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(GroupType groupType) {
+        this.groupType = groupType;
+    }
+
     public Integer getSchoolId() {
         return schoolId;
     }

+ 5 - 7
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java

@@ -1,20 +1,18 @@
 package com.ym.mec.biz.dal.entity;
 
-import io.swagger.annotations.ApiModelProperty;
-
-import java.util.Date;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.util.Date;
 
 /**
  * 对应数据库表(music_group):
  */
-public class MusicGroup {
+public class MusicGroup{
 
 	/**  */
 	private String id;

+ 23 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -1226,7 +1226,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             throw new BizException("获取用户信息失败");
         }
         if (Objects.isNull(vipGroupCourseAdjustInfo.getVipGroupId())) {
-            throw new BizException("请指定课");
+            throw new BizException("请指定课");
         }
         if (Objects.isNull(vipGroupCourseAdjustInfo.getCourseCreateStartTime())) {
             throw new BizException("请指定排课起始时间;");
@@ -1235,7 +1235,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             throw new BizException("请指定排课周期");
         }
         if (StringUtils.isBlank(vipGroupCourseAdjustInfo.getCourseScheduleIds())) {
-            throw new BizException("请指定需要调整的小课课程");
+            throw new BizException("请指定需要调整的课程");
         }
         Date courseCreateStartTime = vipGroupCourseAdjustInfo.getCourseCreateStartTime();
         Date now = new Date();
@@ -1250,17 +1250,31 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             throw new BizException("请设置教学点");
         }
 
-        VipGroup vipGroup = vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
-        if (Objects.isNull(vipGroup)) {
-            throw new BizException("指定课程不存在");
+        int singleClassMinutes = 0;
+        int courseNum = 0;
+        GroupType groupType = vipGroupCourseAdjustInfo.getGroupType();
+        switch (vipGroupCourseAdjustInfo.getGroupType()){
+            case PRACTICE:
+                PracticeGroup practiceGroup = practiceGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
+                if (Objects.isNull(practiceGroup)) {
+                    throw new BizException("指定课程不存在");
+                }
+                singleClassMinutes = practiceGroup.getSingleClassMinutes();
+                courseNum = courseScheduleDao.countVipGroupCourses(practiceGroup.getId().intValue(),groupType.getCode());
+                break;
+            default:
+                VipGroup vipGroup = vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
+                if (Objects.isNull(vipGroup)) {
+                    throw new BizException("指定课程不存在");
+                }
+                singleClassMinutes = vipGroup.getSingleClassMinutes();
+                courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(),groupType.getCode());
         }
-
-        int courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue());
         if (courseNum == 0) {
             throw new BizException("未排课的课程不能进行调整");
         }
 
-        ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupCourseAdjustInfo.getVipGroupId().toString(), GroupType.VIP.getCode());
+        ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupCourseAdjustInfo.getVipGroupId().toString(),groupType.getCode());
         if (Objects.isNull(classGroup)) {
             throw new BizException("对应班级不存在");
         }
@@ -1330,7 +1344,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                     String dateYmdStr = DateUtil.dateToString(calendar.getTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT);
                     dateYmdStr = dateYmdStr + " " + courseTime.getStartClassTime();
                     Date courseStartTime = DateUtil.stringToDate(dateYmdStr, "yyyy-MM-dd HH:mm");
-                    Date courseEndTime = DateUtil.addMinutes(courseStartTime, vipGroup.getSingleClassMinutes());
+                    Date courseEndTime = DateUtil.addMinutes(courseStartTime, singleClassMinutes);
                     if(DateUtil.daysBetween(DateUtil.stringToDate(DateUtil.format(courseStartTime,DateUtil.DEFAULT_PATTERN),DateUtil.DEFAULT_PATTERN),
                             DateUtil.stringToDate(DateUtil.format(courseEndTime,DateUtil.DEFAULT_PATTERN),DateUtil.DEFAULT_PATTERN)) > 0){
                         throw new BizException("单节课时不允许跨天");

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

@@ -1028,7 +1028,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			createVipGroupCourseScheInfo(vipGroupId,classGroup);
 		}
 		if(num!=0||updateVipStatus){
-			int i = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue());
+			int i = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue(),"VIP");
 			classGroup.setTotalClassTimes(i);
 			classGroupDao.update(classGroup);
 		}
@@ -1039,7 +1039,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	public void createVipGroupCourseScheInfo(Long vipGroupId,ClassGroup classGroup){
 		VipGroup vipGroupApplyBaseInfoDto = vipGroupDao.get(vipGroupId);
 		List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroupApplyBaseInfoDto.getCourseSchedulesJson(),CourseSchedule.class);
-		int courseNum = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue());
+		int courseNum = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue(),"VIP");
 		if(courseNum==0){
 			courseScheduleService.batchAddCourseSchedule(courseSchedules);
 
@@ -2366,7 +2366,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)||vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
 			List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
-			int courseNum = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue());
+			int courseNum = courseScheduleDao.countVipGroupCourses(vipGroupId.intValue(),"VIP");
 			if(courseNum==0){
 				courseScheduleService.batchAddCourseSchedule(courseSchedules);
 

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

@@ -1867,7 +1867,7 @@
         SELECT count(cs.id_)
         FROM course_schedule cs
         WHERE cs.music_group_id_ = #{vipGroupId}
-          AND cs.group_type_ = 'VIP'
+          AND cs.group_type_ = #{groupType}
     </select>
     <select id="findCourseNoStartNum" resultType="java.lang.Integer">
         SELECT COUNT(cs.id_)

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

@@ -250,7 +250,7 @@ public class CourseScheduleController extends BaseController {
     	return succeed(model);
     }
 
-    @ApiOperation(value = "vip课批量调整")
+    @ApiOperation(value = "vip课批量调整(网管课)")
     @PostMapping("/vipCourseAdjust")
     @PreAuthorize("@pcs.hasPermissions('courseSchedule/vipCourseAdjust')")
     public Object vipCourseAdjust(@RequestBody VipGroupCourseAdjustInfoDto vipGroupCourseAdjustInfo){