新增定时任务

This commit is contained in:
zhangchenbiao
2024-05-06 17:47:59 +08:00
parent 8f648cc4b3
commit 73fdc3f1d7
6 changed files with 54 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package com.cool.store.controller.webb;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.MessageEnum;
@@ -24,6 +25,8 @@ public class PCTestController {
private LineInfoDAO lineInfoDAO;
@Resource
private ShopService shopService;
@Resource
private LineInterviewDAO lineInterviewDAO;
@GetMapping("/sendMessage")
@@ -34,11 +37,11 @@ public class PCTestController {
@GetMapping("/sendSms")
public ResponseResult<Boolean> sendSms(){
List<LineInterviewDO> interviewList = lineInterviewDAO.getInterviewRemindList(CommonConstants.FIVE);
Map<String, String> templateParam = new HashMap<>();
templateParam.put("shopName", "杭州门店");
templateParam.put("experienceTime", "2024年10月7日 13:00");
templateParam.put("pointName", "杭州门店A");
List<SMSMsgEnum> smsMsgList = new ArrayList<>();
smsMsgList.add(SMSMsgEnum.SHOP_EXPERIENCE);
smsMsgList.add(SMSMsgEnum.SELECT_SUCCESS);
for (SMSMsgEnum value : smsMsgList) {
commonService.sendSms("17681878615", value, templateParam);
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.job;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
@@ -19,6 +20,8 @@ import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.DecorationService;
import com.cool.store.service.PreparationService;
import com.cool.store.service.impl.CommonService;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.github.pagehelper.Page;
@@ -68,6 +71,8 @@ public class XxlJobHandler {
private AcceptanceInfoDAO acceptanceInfoDAO;
@Resource
private DecorationService decorationService;
@Resource
private CommonService commonService;
/**
* 每天都将待体验门店信息变更到体验中
@@ -223,4 +228,26 @@ public class XxlJobHandler {
}
}
@XxlJob("interviewRemind")
public void interviewRemind() {
log.info("------面试提醒------");
List<LineInterviewDO> interviewList = lineInterviewDAO.getInterviewRemindList(CommonConstants.FIVE);
if (CollectionUtils.isEmpty(interviewList)) {
log.info("------今日没有待更新数据------");
return;
}
for (LineInterviewDO interview : interviewList) {
Map<String, String> templateParamMap = new HashMap<>();
templateParamMap.put("interviewTime", DateUtil.format(interview.getStartTime(), "HH:mm"));
if(InterviewTypeEnum.INTERVIEW.getCode().equals(interview.getInterviewType())){
commonService.sendSms(interview.getInterviewerUserId(), SMSMsgEnum.FIRST_INTERVIEW_REMIND, templateParamMap);
}
if(InterviewTypeEnum.SECOND_INTERVIEW.getCode().equals(interview.getInterviewType())){
commonService.sendSms(interview.getInterviewerUserId(), SMSMsgEnum.SECOND_INTERVIEW_REMIND, templateParamMap);
}
}
XxlJobHelper.handleSuccess();
}
}