|
|
|
@ -1,13 +1,5 @@
|
|
|
|
|
package cn.jlw.web;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseQuestionSettingDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseQuestionSetting;
|
|
|
|
|
import com.ibeetl.jlw.service.questionSettingQueue.QuestionSettingDelayed;
|
|
|
|
|
import com.ibeetl.jlw.service.questionSettingQueue.QuestionSettingRedisDelayQueueImpl;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseQuestionSettingQuery;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
|
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
|
|
|
@ -20,22 +12,12 @@ import org.springframework.context.annotation.ComponentScan;
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
|
|
import org.springframework.web.WebApplicationInitializer;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.jlw.enums.GlobalPushStatusEnum.PUSH;
|
|
|
|
|
import static com.ibeetl.jlw.service.questionSettingQueue.RedisDelayQueue.QuestionQueueTypeEnum.QUESTION_SETTING;
|
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
|
@EnableCaching
|
|
|
|
|
@EnableAsync
|
|
|
|
|
@ComponentScan(basePackages= {"cn.jlw","com.ibeetl.admin","com.ibeetl.jlw"})
|
|
|
|
|
@ServletComponentScan(basePackages = "cn.jlw.filter")
|
|
|
|
|
public class WebApplication extends SpringBootServletInitializer implements WebApplicationInitializer, CommandLineRunner {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QuestionSettingRedisDelayQueueImpl questionSettingRedisDelayQueue;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseQuestionSettingDao teacherOpenCourseQuestionSettingDao;
|
|
|
|
|
@ServletComponentScan(basePackages = {"cn.jlw.cors", "cn.jlw.filter"})
|
|
|
|
|
public class WebApplication extends SpringBootServletInitializer implements WebApplicationInitializer {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
SpringApplication.run(WebApplication.class, args);
|
|
|
|
@ -48,43 +30,4 @@ public class WebApplication extends SpringBootServletInitializer implements WebA
|
|
|
|
|
return factory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void run(String... args) {
|
|
|
|
|
String keys = "1580386808322236416\n" +
|
|
|
|
|
"1596869091795312640\n" +
|
|
|
|
|
"1596869092516732928\n" +
|
|
|
|
|
"1596869093275901952\n" +
|
|
|
|
|
"1596869093951184896\n" +
|
|
|
|
|
"1596869094697771008\n" +
|
|
|
|
|
"1596869095687626752\n" +
|
|
|
|
|
"1596869139304194048\n" +
|
|
|
|
|
"1596869139954311168\n" +
|
|
|
|
|
"1596869140570873856\n" +
|
|
|
|
|
"1596869141208408064\n" +
|
|
|
|
|
"1596869141871108096\n" +
|
|
|
|
|
"1597296145632239616\n" +
|
|
|
|
|
"1597601262612946944\n" +
|
|
|
|
|
"1597616083567812608\n" +
|
|
|
|
|
"1597616347335008256\n" +
|
|
|
|
|
"1597619304407408640\n" +
|
|
|
|
|
"1597622780457820160";
|
|
|
|
|
final String queueKey = QUESTION_SETTING.name();
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseQuestionSettingQuery questionSettingQuery = new TeacherOpenCourseQuestionSettingQuery();
|
|
|
|
|
questionSettingQuery.setTeacherOpenCourseQuestionSettingId(1580386808322236416L);
|
|
|
|
|
questionSettingQuery.setTeacherOpenCourseQuestionSettingStatus(1);
|
|
|
|
|
questionSettingQuery.setTeacherOpenCourseQuestionSettingPushStatus(PUSH);
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> list = teacherOpenCourseQuestionSettingDao.getValuesByQueryNotWithPermission(questionSettingQuery);
|
|
|
|
|
if (ObjectUtil.isEmpty(list)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
TeacherOpenCourseQuestionSetting info = list.get(0);
|
|
|
|
|
QuestionSettingDelayed msg = new QuestionSettingDelayed();
|
|
|
|
|
Long teacherOpenCourseQuestionSettingId = info.getTeacherOpenCourseQuestionSettingId();
|
|
|
|
|
msg.setQuestionSettingId(teacherOpenCourseQuestionSettingId);
|
|
|
|
|
boolean exists = questionSettingRedisDelayQueue.isExists(queueKey, teacherOpenCourseQuestionSettingId.toString());
|
|
|
|
|
if (!exists) {
|
|
|
|
|
questionSettingRedisDelayQueue.delay(queueKey, msg, info.getTeacherOpenCourseQuestionEndTime().getTime(), 30 * 60 * 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|