|
@@ -23,12 +23,18 @@ import com.xjrsoft.module.courseTable.dto.ClassTeacherDto;
|
|
|
import com.xjrsoft.module.courseTable.entity.CourseTable;
|
|
import com.xjrsoft.module.courseTable.entity.CourseTable;
|
|
|
import com.xjrsoft.module.courseTable.service.ICourseTableService;
|
|
import com.xjrsoft.module.courseTable.service.ICourseTableService;
|
|
|
import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
|
|
|
+import com.xjrsoft.module.organization.entity.Department;
|
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
|
|
|
+import com.xjrsoft.module.organization.service.IDepartmentService;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.organization.service.IWeChatService;
|
|
import com.xjrsoft.module.organization.service.IWeChatService;
|
|
|
|
|
+import com.xjrsoft.module.schedule.entity.CourseReceiveMsg;
|
|
|
import com.xjrsoft.module.schedule.entity.CourseTableBak;
|
|
import com.xjrsoft.module.schedule.entity.CourseTableBak;
|
|
|
|
|
+import com.xjrsoft.module.schedule.entity.JianyueData;
|
|
|
import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
|
|
import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
|
|
|
|
|
+import com.xjrsoft.module.schedule.service.ICourseReceiveMsgService;
|
|
|
import com.xjrsoft.module.schedule.service.ICourseTableBakService;
|
|
import com.xjrsoft.module.schedule.service.ICourseTableBakService;
|
|
|
|
|
+import com.xjrsoft.module.schedule.service.IJianyueDataService;
|
|
|
import com.xjrsoft.module.schedule.service.IWfCourseAdjustService;
|
|
import com.xjrsoft.module.schedule.service.IWfCourseAdjustService;
|
|
|
import com.xjrsoft.module.schedule.util.DataUtil;
|
|
import com.xjrsoft.module.schedule.util.DataUtil;
|
|
|
import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
@@ -55,6 +61,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -113,6 +120,7 @@ public class JianyuekbScheduleTask {
|
|
|
private XjrWorkflowOperateRecordMapper xjrWorkflowOperateRecordMapper;
|
|
private XjrWorkflowOperateRecordMapper xjrWorkflowOperateRecordMapper;
|
|
|
|
|
|
|
|
private final static String wechatTemplate = "OO5Ryu9_6Hh5LQW0aKG7qu3g5uV8VxvBusq1i5UFesk";
|
|
private final static String wechatTemplate = "OO5Ryu9_6Hh5LQW0aKG7qu3g5uV8VxvBusq1i5UFesk";
|
|
|
|
|
+ private final static String noticeTeacherTemplate = "sHsmz7LRj7HLd7GSTS3r2jCLvK-4Wp19iGzEvYK8n_I";
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IWeChatService weChatService;
|
|
private IWeChatService weChatService;
|
|
@@ -126,6 +134,15 @@ public class JianyuekbScheduleTask {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IWorkflowExtraService workflowExtraService;
|
|
private IWorkflowExtraService workflowExtraService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IJianyueDataService jianyueDataService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IDepartmentService departmentService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ICourseReceiveMsgService receiveMsgService;
|
|
|
|
|
+
|
|
|
@Scheduled(cron = "0 */10 * * * ?")
|
|
@Scheduled(cron = "0 */10 * * * ?")
|
|
|
public void execute(){
|
|
public void execute(){
|
|
|
doExecute();
|
|
doExecute();
|
|
@@ -267,15 +284,54 @@ public class JianyuekbScheduleTask {
|
|
|
Map<String, String> classroomMap = dataMap.get(tableName);
|
|
Map<String, String> classroomMap = dataMap.get(tableName);
|
|
|
|
|
|
|
|
Set<String> techerIds = dataUtil.insertCourseTableEntiy(scheduleInfo, classroomMap, courseMap, semesterMap, teacherMap, classMap, courseReceiveMsgId);
|
|
Set<String> techerIds = dataUtil.insertCourseTableEntiy(scheduleInfo, classroomMap, courseMap, semesterMap, teacherMap, classMap, courseReceiveMsgId);
|
|
|
- sendMsg(techerIds);
|
|
|
|
|
|
|
+ sendMsg(techerIds, courseReceiveMsgId);
|
|
|
dataUtil.insertClassTime(scheduleInfo);
|
|
dataUtil.insertClassTime(scheduleInfo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void sendMsg(Set<String> techerIds){
|
|
|
|
|
- //通知对应教师
|
|
|
|
|
- List<User> userList = userService.listByIds(new ArrayList<>(techerIds));
|
|
|
|
|
- for (User user : userList) {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ void sendMsg(Set<String> techerIds, Long courseReceiveMsgId){
|
|
|
|
|
+ try {
|
|
|
|
|
+ CourseReceiveMsg receiveMsg = receiveMsgService.getById(courseReceiveMsgId);
|
|
|
|
|
+ JianyueData jianyueData = jianyueDataService.getOne(
|
|
|
|
|
+ new QueryWrapper<JianyueData>().lambda()
|
|
|
|
|
+ .eq(JianyueData::getSourceId, receiveMsg.getEduYearSerialNo())
|
|
|
|
|
+ );
|
|
|
|
|
+ String[] sourceId = jianyueData.getSourceId().split("_");
|
|
|
|
|
+ Department department = departmentService.getById(sourceId[0]);
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ //通知对应教师
|
|
|
|
|
+ List<User> userList = userService.listByIds(new ArrayList<>(techerIds));
|
|
|
|
|
+ for (User user : userList) {
|
|
|
|
|
+ WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
|
|
|
|
|
+ weChatSendMessageDto.setTemplateId(wechatTemplate);
|
|
|
|
|
+ JSONObject paramJson = new JSONObject();
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject thing8 = new JSONObject();
|
|
|
|
|
+ thing8.put("value", "课表更新");
|
|
|
|
|
+ paramJson.put("thing8", thing8);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject thing2 = new JSONObject();
|
|
|
|
|
+ thing2.put("value", department.getName());
|
|
|
|
|
+ paramJson.put("thing2", thing2);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject thing6 = new JSONObject();
|
|
|
|
|
+ thing6.put("value", "教务处");
|
|
|
|
|
+ paramJson.put("thing6", thing6);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject time3 = new JSONObject();
|
|
|
|
|
+ time3.put("value", sdf.format(receiveMsg.getCreateDate()));
|
|
|
|
|
+ paramJson.put("time3", time3);
|
|
|
|
|
+
|
|
|
|
|
+ weChatSendMessageDto.setContent(paramJson);
|
|
|
|
|
+ weChatSendMessageDto.setMsgId(IdUtil.getSnowflakeNextId() + "");
|
|
|
|
|
+
|
|
|
|
|
+ String openId = user.getOpenId();
|
|
|
|
|
+ if(openId != null && !"".equals(openId)){
|
|
|
|
|
+ weChatSendMessageDto.setUserId(openId);
|
|
|
|
|
+ weChatService.sendTemplateMessage(weChatSendMessageDto);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ Log.error(e.getMessage(), e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|