|
@@ -1,34 +1,41 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.biz.dal.dao.CourseHomeworkDao;
|
|
|
+import com.ym.mec.biz.dal.dto.Mapper;
|
|
|
import com.ym.mec.biz.dal.dto.TeacherHomeworkListDto;
|
|
|
import com.ym.mec.biz.dal.entity.CourseHomework;
|
|
|
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
|
|
|
import com.ym.mec.biz.service.CourseHomeworkService;
|
|
|
import com.ym.mec.biz.service.CourseScheduleService;
|
|
|
+import com.ym.mec.biz.service.SysMessageService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
-public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomework> implements CourseHomeworkService {
|
|
|
-
|
|
|
+public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomework> implements CourseHomeworkService {
|
|
|
+
|
|
|
@Autowired
|
|
|
private CourseHomeworkDao courseHomeworkDao;
|
|
|
@Autowired
|
|
|
private CourseScheduleService courseScheduleService;
|
|
|
@Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private SysMessageService sysMessageService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, CourseHomework> getDAO() {
|
|
@@ -36,16 +43,16 @@ public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomew
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> findTeacherCourseHomeworkByClassGroup(CourseHomeworkQueryInfo queryInfo) {
|
|
|
+ public List<Map<String, Object>> findTeacherCourseHomeworkByClassGroup(CourseHomeworkQueryInfo queryInfo) {
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
List<TeacherHomeworkListDto> dataList = null;
|
|
|
- List<Map<String,Object>> result=new ArrayList<>();
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
int count = courseHomeworkDao.countByClassGroupAndTeacher(params);
|
|
|
if (count > 0) {
|
|
|
dataList = courseHomeworkDao.findByClassGroupAndTeacher(params);
|
|
|
List<Integer> courseScheduleIds = dataList.stream().map(TeacherHomeworkListDto::getCourseScheduleId).collect(Collectors.toList());
|
|
|
- if(!CollectionUtils.isEmpty(courseScheduleIds)){
|
|
|
+ if (!CollectionUtils.isEmpty(courseScheduleIds)) {
|
|
|
Map<Integer, Integer> courseScheduleCurrentTimes = courseScheduleService.findCourseScheduleCurrentTimes(courseScheduleIds);
|
|
|
dataList.forEach(teacherHomeworkListDto -> {
|
|
|
teacherHomeworkListDto.setCurrentClassTimes(courseScheduleCurrentTimes.get(teacherHomeworkListDto.getCourseScheduleId()));
|
|
@@ -54,13 +61,26 @@ public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomew
|
|
|
}
|
|
|
if (count != 0) {
|
|
|
Map<String, List<TeacherHomeworkListDto>> collect = dataList.stream().collect(Collectors.groupingBy(TeacherHomeworkListDto::getDay));
|
|
|
- for(String key:collect.keySet()){
|
|
|
- Map<String,Object> r=new HashMap<>();
|
|
|
- r.put("day",key);
|
|
|
- r.put("list",collect.get(key));
|
|
|
+ for (String key : collect.keySet()) {
|
|
|
+ Map<String, Object> r = new HashMap<>();
|
|
|
+ r.put("day", key);
|
|
|
+ r.put("list", collect.get(key));
|
|
|
result.add(r);
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void homeworkNoReplyRemind() {
|
|
|
+ List<Mapper> list = courseHomeworkDao.queryTeacerNoReplyNum();
|
|
|
+
|
|
|
+ for (Mapper mapper : list) {
|
|
|
+ Map<Integer, String> receivers = new HashMap<Integer, String>();
|
|
|
+ Integer userId = (Integer) mapper.getKey();
|
|
|
+ receivers.put(userId, userId + "");
|
|
|
+
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.TEACHER_PUSH_JOB_WAIT_REPLY, receivers, null, 0, "", mapper.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|