Browse Source

问题调整

Joburgess 5 years ago
parent
commit
bbd1508ba8

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

@@ -5,5 +5,13 @@ import com.ym.mec.common.dal.BaseDAO;
 
 public interface SysConfigDao extends BaseDAO<Long, SysConfig> {
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/9
+     * @params [paramName]
+     * @return com.ym.mec.biz.dal.entity.SysConfig
+     * @describe 根据配置名称获取配置信息
+     */
+    SysConfig findByParamName(String paramName);
 	
 }

+ 0 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseScheduleDto.java

@@ -23,17 +23,6 @@ public class CourseScheduleDto extends CourseSchedule {
     @ApiModelProperty(value = "班级编号,房间号",required = false)
     private String sealClassId;
 
-    @ApiModelProperty(value = "课程结束后课申诉时间限制")
-    private Integer vipAppealDaysRange;
-
-    public Integer getVipAppealDaysRange() {
-        return vipAppealDaysRange;
-    }
-
-    public void setVipAppealDaysRange(Integer vipAppealDaysRange) {
-        this.vipAppealDaysRange = vipAppealDaysRange;
-    }
-
     public String getSealClassId() {
         return sealClassId;
     }

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

@@ -10,6 +10,7 @@ import com.ym.mec.common.service.BaseService;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 public interface CourseScheduleService extends BaseService<Long, CourseSchedule> {
 
@@ -46,7 +47,7 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
      * @Date: 2019/9/17
      * 根据日期获取当日排课信息
      */
-    List<CourseScheduleDto> getStudentCourseSchedulesWithDate(Date classDate);
+    Map getStudentCourseSchedulesWithDate(Date classDate);
 
     /**
      * @Author: Joburgess

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

@@ -4,11 +4,13 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.CourseScheduleComplaintsDao;
 import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
+import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 import com.ym.mec.biz.dal.enums.ParamEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
@@ -40,6 +42,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	private SysUserFeignService sysUserFeignService;
 	@Autowired
 	private CourseScheduleComplaintsDao courseScheduleComplaintsDao;
+	@Autowired
+	private SysConfigDao sysConfigDao;
 
 	@Override
 	public BaseDAO<Long, CourseSchedule> getDAO() {
@@ -91,9 +95,17 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	}
 
 	@Override
-	public List<CourseScheduleDto> getStudentCourseSchedulesWithDate(Date classDate) {
+	public Map getStudentCourseSchedulesWithDate(Date classDate) {
+		if(Objects.isNull(classDate)){
+			throw new BizException("参数错误!");
+		}
+
 		SysUser user = sysUserFeignService.queryUserInfo();
-		return courseScheduleDao.getStudentCourseSchedulesWithDate(classDate,user.getId().longValue());
+		SysConfig vip_appeal_days_range = sysConfigDao.findByParamName("vip_appeal_days_range");
+		Map<String,Object> result=new HashMap<>();
+		result.put("vipAppealDaysRange",vip_appeal_days_range.getParanValue());
+		result.put("list",courseScheduleDao.getStudentCourseSchedulesWithDate(classDate,user.getId().longValue()));
+		return result;
 	}
 
 	@Override
@@ -350,7 +362,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		CourseScheduleDto courseSchedules = courseScheduleDao.getCourseSchedules(courseScheduleComplaints.getCourseScheduleId());
 		Date now=new Date();
 		int i = DateUtil.daysBetween(courseSchedules.getEndClassTime(), now);
-		if(i>courseSchedules.getVipAppealDaysRange()){
+		SysConfig vip_appeal_days_range = sysConfigDao.findByParamName("vip_appeal_days_range");
+		if(i>Integer.parseInt(vip_appeal_days_range.getParanValue())){
 			throw new BizException("该课程已超过可申诉时间范围!");
 		}
 		courseScheduleComplaints.setUserId(user.getId());

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

@@ -240,8 +240,8 @@
 
     <select id="getStudentCourseSchedulesWithDate" resultMap="courseScheduleDto">
         SELECT
-            cg.id_ seal_class_id_,
-            cg.name_,
+            cgsm.class_group_id_ seal_class_id_,
+            cs.name_,
             cs.type_,
             cs.id_,
             cs.class_date_,
@@ -249,15 +249,11 @@
             CONCAT(cs.class_date_,' ',cs.end_class_time_) end_class_time_,
             cs.status_,
 	        su.username_ teacher_name_,
-	        sa.status_ attendance_status_,
-			sc.paran_value_
+	        cgsm.status_ attendance_status_
         FROM
             course_schedule cs
             LEFT JOIN sys_user su ON cs.teacher_id_=su.id_
-            LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
             LEFT JOIN class_group_student_mapper cgsm ON cgsm.class_group_id_ = cs.class_group_id_
-	        LEFT JOIN student_attendance sa ON cs.id_=sa.course_schedule_id_ AND sa.user_id_=#{studentId}
-			LEFT JOIN sys_config sc ON sc.param_name_="vip_appeal_days_range"
         WHERE
             cs.class_date_ = DATE_FORMAT(#{classDate},'%Y%m%d')
             AND cgsm.user_id_ = #{studentId}

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/SysConfigMapper.xml

@@ -75,4 +75,7 @@
 		SELECT COUNT(*) FROM
 		sys_config
 	</select>
+	<select id="findByParamName" resultMap="SysConfig">
+		SELECT * FROM sys_config WHERE param_name_=#{paramName}
+	</select>
 </mapper>

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

@@ -52,61 +52,61 @@
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.VipGroupActivity">
 		UPDATE vip_group_activity <set>
-<if test="salaryReadonlyFlag != null">
-salary_readonly_flag_ = #{salaryReadonlyFlag},
-</if>
-<if test="organId != null">
-organ_id_ = #{organId},
-</if>
-<if test="id != null">
-id_ = #{id},
-</if>
-<if test="giveClassPaySalaryFlag != null">
-give_class_pay_salary_flag_ = #{giveClassPaySalaryFlag},
-</if>
-<if test="coursesEndTime != null">
-courses_end_time_ = #{coursesEndTime},
-</if>
-<if test="attribute1 != null">
-attribute1_ = #{attribute1},
-</if>
-<if test="endTime != null">
-end_time_ = #{endTime},
-</if>
-<if test="attribute2 != null">
-attribute2_ = #{attribute2},
-</if>
-<if test="name != null">
-name_ = #{name},
-</if>
-<if test="startTime != null">
-start_time_ = #{startTime},
-</if>
-<if test="attribute3 != null">
-attribute3_ = #{attribute3},
-</if>
-<if test="createTime != null">
-create_time_ = #{createTime},
-</if>
-<if test="vipGroupCategoryIdList != null">
-vip_group_category_id_list_ = #{vipGroupCategoryIdList},
-</if>
-<if test="updateTime != null">
-update_time_ = #{updateTime},
-</if>
-<if test="description != null">
-description_ = #{description},
-</if>
-<if test="salarySettlementJson != null">
-salary_settlement_json_ = #{salarySettlementJson},
-</if>
-<if test="coursesStartTime != null">
-courses_start_time_ = #{coursesStartTime},
-</if>
-<if test="type != null">
-type_ = #{type},
-</if>
-</set> WHERE id_ = #{id} 
+			<if test="salaryReadonlyFlag != null">
+			salary_readonly_flag_ = #{salaryReadonlyFlag},
+			</if>
+			<if test="organId != null">
+			organ_id_ = #{organId},
+			</if>
+			<if test="id != null">
+			id_ = #{id},
+			</if>
+			<if test="giveClassPaySalaryFlag != null">
+			give_class_pay_salary_flag_ = #{giveClassPaySalaryFlag},
+			</if>
+			<if test="coursesEndTime != null">
+			courses_end_time_ = #{coursesEndTime},
+			</if>
+			<if test="attribute1 != null">
+			attribute1_ = #{attribute1},
+			</if>
+			<if test="endTime != null">
+			end_time_ = #{endTime},
+			</if>
+			<if test="attribute2 != null">
+			attribute2_ = #{attribute2},
+			</if>
+			<if test="name != null">
+			name_ = #{name},
+			</if>
+			<if test="startTime != null">
+			start_time_ = #{startTime},
+			</if>
+			<if test="attribute3 != null">
+			attribute3_ = #{attribute3},
+			</if>
+			<if test="createTime != null">
+			create_time_ = #{createTime},
+			</if>
+			<if test="vipGroupCategoryIdList != null">
+			vip_group_category_id_list_ = #{vipGroupCategoryIdList},
+			</if>
+			<if test="updateTime != null">
+			update_time_ = #{updateTime},
+			</if>
+			<if test="description != null">
+			description_ = #{description},
+			</if>
+			<if test="salarySettlementJson != null">
+			salary_settlement_json_ = #{salarySettlementJson},
+			</if>
+			<if test="coursesStartTime != null">
+			courses_start_time_ = #{coursesStartTime},
+			</if>
+			<if test="type != null">
+			type_ = #{type},
+			</if>
+			</set> WHERE id_ = #{id}
 	</update>
 	
 	<!-- 根据主键删除一条记录 -->

+ 2 - 3
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -8,7 +8,6 @@ import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -60,14 +59,14 @@ public class StudentVipGroupController extends BaseController {
         return succeed(vipGroupService.getVipGroupShowDetail(vipGroupId));
     }
 
-    @ApiModelProperty(value = "vip课购买")
+    @ApiOperation(value = "vip课购买")
     @PostMapping("/buyVipGroup")
     public Object buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams){
         vipGroupService.buyVipGroup(vipGroupBuyParams);
         return succeed();
     }
 
-    @ApiModelProperty(value = "vip课退课")
+    @ApiOperation(value = "vip课退课")
     @PostMapping("/applyRefund")
     public Object applyRefund(Long vipGroupId){
         vipGroupService.applyRefund(vipGroupId,null);

+ 17 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.teacher.controller;
 
+import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.biz.service.StudentAttendanceService;
@@ -8,6 +9,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
@@ -50,4 +52,19 @@ public class TeacherCourseScheduleController extends BaseController {
         return succeed(studentAttendanceService.getCurrentCourseStudents(queryInfo));
     }
 
+
+    @ApiOperation(value = "课时调整")
+    @PostMapping(value = "/classStartDateAdjust",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public Object classStartDateAdjust(ClassDateAdjustDto classDateAdjustDto){
+        scheduleService.classStartDateAdjust(classDateAdjustDto);
+        return succeed();
+    }
+
+    @ApiOperation(value = "课时交换")
+    @GetMapping(value = "/courseSwap",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    public Object courseSwap(Long courseScheduleId1,Long courseScheduleId2){
+        scheduleService.courseSwap(courseScheduleId1,courseScheduleId2);
+        return succeed();
+    }
+
 }