WarningJob.java
2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.subsidy.jobs;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.vod.VodPlayStateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Component
public class WarningJob {
/**
* 每天定时查看是否有问题数据,有问题的话并发送短信
*/
@Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
@Autowired
private ClassMemberMappingMapper classMemberMappingMapper;
@Autowired
private VodDictMapper vodDictMapper;
@Autowired
private SMSUtils smsUtils;
@Value("${spring.profiles.active}")
private String env;
// /**
// * 11点钟有错误数据 发短信
// */
// @Scheduled(cron = "0 0 23 * * ?")
// public void classBaseInfo(){
// if ("prod".equals(env)) {
//
// List<Long> result = new ArrayList<>();
//
// //查看当天产生视频学习的班级
// List<Long> classIds = vodPlayHistoryMapper.dailyVodRecord();
// for (Long classId : classIds) {
//
// List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
// .lambda()
// .eq(ClassMemberMappingDO::getClassId, classId));
// for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
// List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId));
// for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
// VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
// VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
// if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
// if (!result.contains(vodPlayStateVO1.getClassId())){
// result.add(vodPlayStateVO.getClassId());
// }
// }
// }
// }
// }
//
// if (result.size()>0){
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
// for (String telephone : telephones){
// smsUtils.sendWarning("SMS_460945631", telephone, result.toString());
// }
// }
// }
// }
}