无关风月
7 天以前 53d014edd19f57125c355abe71ec5b478500e610
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
@@ -10,6 +10,7 @@
import com.ruoyi.system.mapper.TCleanerMapper;
import com.ruoyi.system.model.*;
import com.ruoyi.system.service.*;
import com.ruoyi.system.utils.TemplateMessageSendUtil;
import com.ruoyi.web.controller.tool.EmailUtils;
import com.ruoyi.web.controller.tool.MsgUtils;
import javafx.concurrent.Task;
@@ -70,14 +71,10 @@
    private TLeaveService leaveService;
    @Resource
    private TNoticeService noticeService;
    // 每一个小时执行一次
//    @Scheduled(cron = "0 0 0 * * ?")
//    @Scheduled(fixedRate = 1500000000)
    // 每天晚上22点执行
    @Scheduled(cron = "0 0 22 * * ?")
    public void dayOfCreateInspection() {
        try {
            // 查询任务模板
            List<TTemplate> list = templateService.list();
            if (CollectionUtils.isEmpty(list)) {
@@ -96,6 +93,8 @@
    private TNoticeSetService noticeSetService;
    @Resource
    private MsgUtils msgUtils;
    @Resource
    private TemplateMessageSendUtil templateMessageSendUtil;
    @Resource
    private TDictDataService dictDataService;
    @Scheduled(cron = "0 0 20 * * ?")
@@ -149,11 +148,19 @@
                                msgUtils.sendMsg2(sysUser.getPhonenumber(),count+"");
                                break;
                            case 2:
                                if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){
                                if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())
                                        &&StringUtils.hasLength(sysUser.getEmail())){
                                    EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"今日剩余"+count+"个任务未完成,请尽快处理");
                                }
                                break;
                            case 3:
                                if (StringUtils.hasLength(sysUser.getOpenId())){
                                    Date date = new Date();
                                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                                    String format = simpleDateFormat.format(date);
                                    templateMessageSendUtil.wxTemplateDayWorkRequest(sysUser.getOpenId(),
                                            count+"",format);
                                }
                                break;
                        }
                    }