|
@@ -0,0 +1,45 @@
|
|
|
+package com.jpsoft.excellent.modules.timed;
|
|
|
+
|
|
|
+import com.jpsoft.excellent.modules.base.entity.FeedbackStepStatus;
|
|
|
+import com.jpsoft.excellent.modules.base.service.FeedbackStepStatusService;
|
|
|
+import com.jpsoft.excellent.modules.common.utils.SMSUtil;
|
|
|
+import com.jpsoft.excellent.modules.sys.entity.User;
|
|
|
+import com.jpsoft.excellent.modules.sys.service.UserService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Profile;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Profile({"production","dev","test"})
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class stepStatusSMS {
|
|
|
+ @Autowired
|
|
|
+ private FeedbackStepStatusService feedbackStepStatusService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ //每天9点执行一次->同时在unactive方法中执行
|
|
|
+ @Scheduled(cron = "0 0 9 * * ?")
|
|
|
+// @Scheduled(cron = "0 0/1 * * * ?")
|
|
|
+ public void run() {
|
|
|
+ log.warn("定时任务:待办反馈提醒短信开始");
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.add(calendar.DATE,-7);
|
|
|
+ List<String> list = feedbackStepStatusService.findPhoneByRemind(sdf.format(calendar.getTime()) + "%");
|
|
|
+ if(list.size() > 0) {
|
|
|
+ SMSUtil.sendSMS("待办反馈存在未处理的反馈意见,请及时处理。", StringUtils.join(list.toArray(), ","), null);
|
|
|
+ }
|
|
|
+
|
|
|
+ log.warn("定时任务:待办反馈提醒短信结束");
|
|
|
+ }
|
|
|
+}
|