Commit 54f5ebfd799e7929afb9673c4e4d0531bfd60b5f

Authored by shiyang
1 parent 9ca6cbe994
Exists in master and in 1 other branch dev

用yml 配置 控制定时任务是否执行

Showing 6 changed files with 36 additions and 7 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java View file @ 54f5ebf
... ... @@ -57,15 +57,19 @@
57 57 private LymsTcardService lymsTcardService;//问诊卡信息
58 58 @Autowired
59 59 private LymsHisInfoService lymsHisInfoService;//问诊卡信息
  60 + @Value("${getAccessToken.on_off}")
  61 + public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
60 62  
61   -
62 63 /**
63 64 * 获取医院患者信息。添加到问诊平台患者信息
64 65 * 10分钟执行一次
65 66 */
66 67 @Scheduled(cron = "0 */10 * * * ?")
67   -// @Scheduled(cron = "0 */5 * * * ?"up)//测试用
  68 +// @Scheduled(cron = "0 */5 * * * ?")//测试用
68 69 public void getPatientInfo() throws Exception {
  70 + if(!on_off){
  71 + return;
  72 + }
69 73 //每次执行时间范围是上一个小时
70 74 String param = collateTime();
71 75 if (StringUtil.isNotEmpty(param)) {
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java View file @ 54f5ebf
... ... @@ -12,6 +12,7 @@
12 12 import lombok.Data;
13 13 import lombok.extern.log4j.Log4j2;
14 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.beans.factory.annotation.Value;
15 16 import org.springframework.scheduling.annotation.Scheduled;
16 17 import org.springframework.stereotype.Component;
17 18 import org.springframework.transaction.annotation.Transactional;
... ... @@ -27,6 +28,8 @@
27 28 @Component
28 29 @Log4j2
29 30 public class PushArticleTask {
  31 + @Value("${getAccessToken.on_off}")
  32 + public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
30 33  
31 34 @Autowired
32 35 private LymsArticleService lymsArticleService;
... ... @@ -53,6 +56,9 @@
53 56 @Scheduled(cron = "0 0 18 * * ?")
54 57 // @Scheduled(cron = "0 15 17 * * ?")//测试用 下午5点15
55 58 public void pushArtcle(){
  59 + if(!on_off){
  60 + return;
  61 + }
56 62 Map<String,Object> param=new HashMap<>();
57 63 param.put("vtype",999);
58 64 List<LymsDict> dcLst=lymsDictService.listByMap(param);
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTaskData.java View file @ 54f5ebf
... ... @@ -14,6 +14,7 @@
14 14 import org.springframework.beans.BeanUtils;
15 15 import org.springframework.beans.BeansException;
16 16 import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.beans.factory.annotation.Value;
17 18 import org.springframework.scheduling.annotation.Scheduled;
18 19 import org.springframework.stereotype.Component;
19 20 import org.springframework.transaction.annotation.Transactional;
... ... @@ -30,7 +31,8 @@
30 31 @Component
31 32 @Log4j2
32 33 public class PushArticleTaskData {
33   -
  34 + @Value("${getAccessToken.on_off}")
  35 + public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
34 36 @Autowired
35 37 private LymsArticleService lymsArticleService;
36 38 @Autowired
37 39  
... ... @@ -59,8 +61,10 @@
59 61 */
60 62 @Scheduled(cron = "0 0 17 * * ?")
61 63 // @Scheduled(cron = "0 */3 * * * ?")//测试用
62   - @Transactional(rollbackFor = Exception.class)
63 64 public void pushArtcleData(){
  65 + if(!on_off){
  66 + return;
  67 + }
64 68 Map<String,Object> param=new HashMap<>();
65 69 param.put("vtype",999);
66 70 List<LymsDict> dcLst=lymsDictService.listByMap(param);
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushChatInfoTask.java View file @ 54f5ebf
... ... @@ -66,6 +66,8 @@
66 66 private LymsPushVisitRecordService lymsPushVisitRecordService;
67 67 @Autowired
68 68 private PushArticleTask pushArticleTask;
  69 + @Value("${getAccessToken.on_off}")
  70 + public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
69 71  
70 72 /**
71 73 * 每天19点执行自动回访功能
... ... @@ -77,6 +79,9 @@
77 79 */
78 80 @Scheduled(cron = "0 0 19 * * ?")
79 81 public void pushChatInfo() {
  82 + if(!on_off){
  83 + return;
  84 + }
80 85 //用户下的病例信息。每个环信群组代表一个病例,一个病例下有多个疾病种类。
81 86 List<Map<String,Object>> PcInfoList=lymsPatientService.getPcInfoList();
82 87 for (Map<String, Object> map : PcInfoList) {
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushIllnessTypeData.java View file @ 54f5ebf
... ... @@ -12,6 +12,7 @@
12 12 import com.lyms.talkonlineweb.util.StringUtil;
13 13 import lombok.extern.log4j.Log4j2;
14 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.beans.factory.annotation.Value;
15 16 import org.springframework.stereotype.Component;
16 17 import org.springframework.transaction.annotation.Transactional;
17 18 import org.springframework.scheduling.annotation.Scheduled;
18 19  
19 20  
... ... @@ -30,14 +31,18 @@
30 31  
31 32 @Autowired
32 33 private LymsPushIllnessMsgService lymsPushIllnessMsgService;
  34 + @Value("${getAccessToken.on_off}")
  35 + public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
33 36  
34 37  
35   -
36 38 /**
37 39 * 每天00:00点执行-要推送的公众号信息数据整理
38 40 */
39 41 @Scheduled(cron = "0 0 0 * * ?")
40 42 public void PushIllnessTypeData(){
  43 + if(!on_off){
  44 + return;
  45 + }
41 46 Map param=new HashMap<>();
42 47 param.put("push_type", 0);
43 48 final List<LymsPushIllnessMsg> list = lymsPushIllnessMsgService.listByMap(param);
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushIllnessTypeTask.java View file @ 54f5ebf
... ... @@ -12,6 +12,7 @@
12 12 import org.springframework.beans.BeanUtils;
13 13 import org.springframework.beans.BeansException;
14 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.beans.factory.annotation.Value;
15 16 import org.springframework.stereotype.Component;
16 17 import org.springframework.transaction.annotation.Transactional;
17 18 import org.springframework.scheduling.annotation.Scheduled;
18 19  
19 20  
... ... @@ -35,14 +36,18 @@
35 36  
36 37 @Autowired
37 38 private LymsPushIllnessMsgService lymsPushIllnessMsgService;
  39 + @Value("${getAccessToken.on_off}")
  40 + public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
38 41  
39 42  
40   -
41 43 /**
42 44 * 每天下18:30点执行-要推送的公众号信息
43 45 */
44 46 @Scheduled(cron = "0 30 18 * * ?")
45 47 public void PushIllnessTypeTask(){
  48 + if(!on_off){
  49 + return;
  50 + }
46 51 Map param=new HashMap<>();
47 52 param.put("push_type", 0);
48 53 final List<LymsPushIllnessMsg> list = lymsPushIllnessMsgService.listByMap(param);
... ... @@ -60,7 +65,7 @@
60 65 map.put("keyword3",new DataEntity(lymsPushIllnessMsg.getDname(),"#173177"));
61 66 map.put("keyword4",new DataEntity(lymsPushIllnessMsg.getDtname(),"#173177"));
62 67 map.put("keyword5",new DataEntity(lymsPushIllnessMsg.getValue(),"#173177"));
63   - String illnessType="疾病种类";
  68 + String illnessType="";
64 69 if(null!=lymsPushIllnessMsg.getIllnessType()){
65 70 illnessType=(1==lymsPushIllnessMsg.getIllnessType()?"普通疾病":"慢性病");
66 71 }