yonge 5 年之前
父节点
当前提交
1fb144b67c

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

@@ -242,4 +242,11 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     List<Map<Integer, Integer>> queryVipGroupTeachereClassTimesByMonth(@Param("monthDate") Date monthDate,@Param("status") CourseStatusEnum status);
 
+    /**
+     * 查询已完成未更新状态的课程列表
+     * @return
+     */
+    List<CourseSchedule> queryFinishedWithNoUpdateStatus();
+    
+    int batchUpdate(List<CourseSchedule> courseScheduleList);
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -14,6 +14,7 @@ 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.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.ParamEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
@@ -25,6 +26,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.BeanUtils;
@@ -511,7 +513,19 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 	@Override
 	public boolean updateCourseScheduleToOverStatus() {
+		List<CourseSchedule> list = courseScheduleDao.queryFinishedWithNoUpdateStatus();
+		
+		List<CourseSchedule> updateList = new ArrayList<CourseSchedule>();
+		Date date = new Date();
+		for(CourseSchedule courseSchedule : list){
+			courseSchedule.setStatus(CourseStatusEnum.OVER);
+			courseSchedule.setUpdateTime(date);
+			updateList.add(courseSchedule);
+		}
 		
+		if(updateList.size()>0){
+			
+		}
 		return true;
 	}
 }

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

@@ -686,4 +686,51 @@
     <select id="queryVipGroupTeachereClassTimesByMonth" resultType="map" parameterType="map">
         SELECT vp.organ_id_ organ_id_,cs.actual_teacher_id_ teacher_id_,count(cs.id_) times FROM course_schedule cs left join vip_group_class_group_mapper vgm on cs.class_group_id_ = vgm.class_group_id_ left join vip_group vp on vgm.vip_group_id_ = vp.id_ where cs.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} and date_format(#{monthDate} , '%Y%m' ) = date_format(cs.class_date_, '%Y%m' ) group by vp.organ_id_,cs.actual_teacher_id_
     </select>
+    
+    <select id="queryFinishedWithNoUpdateStatus" resultMap="CourseSchedule">
+    	select * from course_schedule where CONCAT(class_date_,' ',end_class_time_) &lt;= now() and status_ != 'OVER'
+    </select>
+    
+    <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.CourseSchedule">
+        UPDATE course_schedule
+        <set>
+            <if test="classDate != null">
+                class_date_ = #{classDate},
+            </if>
+            <if test="endClassTime != null">
+                end_class_time_ = #{endClassTime},
+            </if>
+            <if test="status != null">
+                status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="type != null">
+                type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="actualTeacherId != null">
+                actual_teacher_id_ = #{actualTeacherId},
+            </if>
+            <if test="subsidy != null">
+                subsidy_ = #{subsidy},
+            </if>
+            <if test="classGroupId != null">
+                class_group_id_ = #{classGroupId},
+            </if>
+            <if test="startClassTime != null">
+                start_class_time_ = #{startClassTime},
+            </if>
+            <if test="teacherId != null">
+                teacher_id_ = #{teacherId},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = #{updateTime},
+            </if>
+            <if test="studentNum != null">
+                student_num_ = #{studentNum},
+            </if>
+            <if test="leaveStudentNum != null">
+                leave_student_num_ = #{leaveStudentNum},
+            </if>
+        </set>
+        WHERE id_ = #{id}
+    </update>
 </mapper>

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

@@ -63,7 +63,7 @@
 				group_ = #{group},
 			</if>
 		</set>
-		WHERE id = #{id}
+		WHERE id_ = #{id}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->