Browse Source

更新学生年级计划任务

周箭河 4 năm trước cách đây
mục cha
commit
ac20a327aa

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

@@ -16,7 +16,7 @@ import java.util.Map;
 import java.util.Set;
 
 public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Student> {
-	
+
 	Student getLocked(Integer userId);
 
     int lockUser(@Param("userId") Integer userId);
@@ -185,4 +185,10 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * @return java.util.List<com.ym.mec.biz.dal.entity.Subject>
      */
     List<Subject> getStudentSubjects(@Param("studentIds") Set<Integer> studentIds);
+
+    /**
+     * 更新学生班级
+     * @return
+     */
+    int updateGrade();
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -35,4 +35,9 @@ public interface StudentService extends BaseService<Integer, Student> {
      * @param teacherId
      */
     void batchUpdateAdviser(Integer teacherId,String studentIds);
+
+    /**
+     * 升级学生的年级
+     */
+    Integer updateGrade();
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionItemPlanServiceImpl.java

@@ -50,7 +50,7 @@ public class InspectionItemPlanServiceImpl extends BaseServiceImpl<Long, Inspect
     @Override
     public PageInfo<InspectionItemPlan> getPageList(InspectionItemPlanQueryInfo queryInfo) {
         PageInfo<InspectionItemPlan> pageInfo = this.queryPage(queryInfo);
-        if (pageInfo.getTotal() > 0) {
+        if (pageInfo.getRows().size() > 0) {
             Integer attendanceRange = Integer.valueOf(sysConfigDao.findConfigValue(SysConfigService.ATTENDANCE_RANGE));
             List<Long> planIds = pageInfo.getRows().stream().map(InspectionItemPlan::getId).collect(Collectors.toList());
             List<CheckItemDto> lastCheckItems = inspectionItemPlanConclusionDao.getLastCheckItem(planIds);

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionItemServiceImpl.java

@@ -45,7 +45,7 @@ public class InspectionItemServiceImpl extends BaseServiceImpl<Long, InspectionI
             queryInfo.setEndTime(DateUtil.getLastTimeWithDay(DateUtil.getLastDayOfMonth(queryInfo.getEndTime())));
         }
         PageInfo<InspectionItem> pageInfo = this.queryPage(queryInfo);
-        if (pageInfo.getTotal() <= 0) {
+        if (pageInfo.getRows().size() <= 0) {
             return pageInfo;
         }
         List<InspectionItem> rows = pageInfo.getRows();

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionServiceImpl.java

@@ -41,7 +41,7 @@ public class InspectionServiceImpl extends BaseServiceImpl<Long, Inspection> imp
             queryInfo.setEndTime(DateUtil.getLastTimeWithDay(DateUtil.getLastDayOfMonth(queryInfo.getMonth())));
         }
         PageInfo<Inspection> pageInfo = this.queryPage(queryInfo);
-        if (pageInfo.getTotal() > 0) {
+        if (pageInfo.getRows().size() > 0) {
             List<Inspection> rows = pageInfo.getRows();
             List<Long> inspectionIds = rows.stream().map(Inspection::getId).collect(Collectors.toList());
             List<InspectionItem> itemCountAndTimes = inspectionItemDao.getItemCountAndTimes(inspectionIds);

+ 10 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -9,6 +9,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.common.page.QueryInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
@@ -35,7 +36,7 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 	private StudentDao studentDao;
 	@Autowired
 	private CourseScheduleDao courseScheduleDao;
-	
+
 	@Autowired
 	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
@@ -82,7 +83,7 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 		Map<Integer,StudentCourseTimesDto> map = studentCourseTimesDtoList.stream().collect(Collectors.toMap(StudentCourseTimesDto::getUserId, s -> s));
 		//查询服务指标为0的用户
 		List<Student> unlabeledStudentList = studentDao.queryByOperatingTempTag(0);
-		
+
 		List<Student> updateStudentList = new ArrayList<Student>();
 		StudentCourseTimesDto dto = null;
 		for(Student s : unlabeledStudentList){
@@ -108,11 +109,11 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 				updateStudentList.add(s);
 			}
 		}
-		
+
 		if(updateStudentList.size() > 0){
 			studentDao.batchUpdate(updateStudentList);
 		}
-		
+
 		return true;
 	}
 
@@ -172,4 +173,9 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 		studentDao.batchUpdateAdviser(teacherId,studentIds);
 	}
 
+	@Override
+	public Integer updateGrade() {
+		return studentDao.updateGrade();
+	}
+
 }

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -652,4 +652,12 @@
             AND sub.id_ IS NOT NULL
         ORDER BY sub.id_ DESC
     </select>
+
+    <update id="updateGrade"><![CDATA[
+        UPDATE student SET current_grade_num_=current_grade_num_+1
+        WHERE current_grade_num_>=1
+          AND current_grade_num_<= 11
+        ]]>
+    </update>
+
 </mapper>

+ 6 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -340,4 +340,10 @@ public class TaskController extends BaseController {
 	public void inspectionPlan(){
 		inspectionItemPlanService.pushNotice();
 	}
+
+	//每年9.1升级学员的班级
+	@GetMapping("/updateGrade")
+	public void updateGrade(){
+		studentService.updateGrade();
+	}
 }