|
|
@@ -4,20 +4,21 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.usoftchina.smartschool.school.po.MeetingDO;
|
|
|
import com.usoftchina.smartschool.school.po.MeetingRecordsDO;
|
|
|
+import com.usoftchina.smartschool.school.po.SchoolDO;
|
|
|
import com.usoftchina.smartschool.school.po.TeacherDO;
|
|
|
+import com.usoftchina.smartschool.school.wxschool.basic.service.WxMeetingService;
|
|
|
import com.usoftchina.smartschool.school.wxschool.mapper.WxMeetingMapper;
|
|
|
import com.usoftchina.smartschool.school.wxschool.mapper.WxMeetingRecordsMapper;
|
|
|
import com.usoftchina.smartschool.school.wxschool.mapper.WxSchoolMapper;
|
|
|
import com.usoftchina.smartschool.school.wxschool.mapper.WxTeacherMapper;
|
|
|
-import com.usoftchina.smartschool.school.wxschool.basic.service.WxMeetingService;
|
|
|
import com.usoftchina.smartschool.school.wxschool.support.RemindTask;
|
|
|
import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
|
|
|
import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
|
|
|
-
|
|
|
import com.usoftchina.smartschool.wechat.api.WxPushApi;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
@@ -83,7 +84,16 @@ public class WxMeetingServiceImpl implements WxMeetingService {
|
|
|
Timer timer = new Timer();
|
|
|
timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,1,meetingDO), startDate);
|
|
|
timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,2,meetingDO), endDate);
|
|
|
- timer.schedule(new RemindTask(teacherMapper,wxSchoolMapper,wxPushApi,meetingMapper,3,meetingDO), reminderDate);
|
|
|
+ if (new Date().getTime()<reminderDate.getTime()) {
|
|
|
+ timer.schedule(new RemindTask(teacherMapper, wxSchoolMapper, wxPushApi, meetingMapper, 3, meetingDO), reminderDate);
|
|
|
+ }else {
|
|
|
+ for (Long l:list) {
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ SchoolDO schoolDO = wxSchoolMapper.get(meetingDO.getSchoolId());
|
|
|
+ String openid = teacherMapper.get(l).getOpenid();
|
|
|
+ wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(),openid , "_hX_lGEG1W1bJmW37VBaPYQoLrRrUAlNCSScezZQQWk", "您好,您有一条新的会议通知", meetingDO.getMeetingName(), simpleDateFormat.format(meetingDO.getStartDate()), meetingDO.getMeetingAddress(), "-", "点击查看详情", "https://school-wechat.ubtob.com/meet-detail/" + meetingDO.getMeetingId()+"?teacherId="+l);
|
|
|
+ }
|
|
|
+ }
|
|
|
return "创建成功";
|
|
|
}else {
|
|
|
throw new Exception("创建失败,请核查");
|