MassageNoticeScheduleService.java
2.74 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
82
83
84
85
86
87
88
89
package com.pipihelper.project.scheduled;
import com.alibaba.fastjson.JSONObject;
import com.pipihelper.project.feishu.entity.Pain;
import com.pipihelper.project.feishu.service.FeiShuApiService;
import com.pipihelper.project.feishu.service.PainService;
import com.pipihelper.project.feishu.service.massage.MassageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
/**
* @Description: TODO
* @author: charles
* @date: 2022年10月15日 17:26
*/
@Slf4j
@Component
public class MassageNoticeScheduleService {
@Autowired
private PainService painService;
@Autowired
private MassageService massageService;
@Autowired
private FeiShuApiService feiShuApiService;
/**
* 每周四定时生成要按摩的人员名单,并发送大群和单人消息
*/
@Async
@Scheduled(cron = "0 0 10 * * ?")
public void sendMsgCardToPipiChat(){
}
/**
* 当天时间2:55,给第一波三个人更新卡片,并发送应用内提醒
*/
@Async
@Scheduled(cron = "0 0 10 * * ?")
public void massageStart(){
List<Pain> pains = painService.findListAsc(3);
for(Pain pain:pains){
String messageId = pain.getMessageId();
massageService.updateSingleMassageMsgCardWhenBegin(messageId);
//1代表正在按
pain.setStatus(1);
painService.update(pain);
JSONObject noticeMsg = new JSONObject();
noticeMsg.put("user_id_list", Arrays.asList(pain.getOpenId()));
//发送应用内提醒
log.info("发送应用内容消息提醒");
feiShuApiService.patchUrgentApp(messageId, noticeMsg);
}
}
// /**
// * 当天时间2:55,给第一波三个人更新卡片,并发送应用内提醒
// */
// @Async
// @Scheduled(cron = "0 0 10 * * ?")
// public void massageStart(){
// List<Pain> pains = painService.findListAsc(3);
// for(Pain pain:pains){
// String messageId = pain.getMessageId();
// massageService.updateSingleMassageMsgCardWhenBegin(messageId);
// //1代表正在按
// pain.setStatus(1);
// painService.update(pain);
// JSONObject noticeMsg = new JSONObject();
// noticeMsg.put("user_id_list", Arrays.asList(pain.getOpenId()));
// //发送应用内提醒
// log.info("发送应用内容消息提醒");
// feiShuApiService.patchUrgentApp(messageId, noticeMsg);
// }
//
// }
}