新增定时任务

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

@@ -21,7 +21,7 @@ public enum SMSMsgEnum {
SECOND_INTERVIEW_SUCCESS("二审面审成功", "", "SMS_465980397"),
SELECT_SUCCESS("选铺成功", "", "SMS_465950846"),
RENT_CONTRACT_AUDIT_FAIL("租赁合同上传未通过", "", "SMS_465955429"),
SHOP_EXPERIENCE("门店体验安排", "", "SMS_465900449"),
SHOP_EXPERIENCE("门店体验安排", "", "SMS_465905828"),
;
private String title;

View File

@@ -94,4 +94,13 @@ public class LineInterviewDAO {
}
return lineInterviewMapper.batchUpdateInterviewStatus(interviewIds, interviewStatus.getCode());
}
/**
* 获取面试提醒列表
* @param intervalMinutes
* @return
*/
public List<LineInterviewDO> getInterviewRemindList(Integer intervalMinutes) {
return lineInterviewMapper.getInterviewRemindList(intervalMinutes);
}
}

View File

@@ -68,4 +68,11 @@ public interface LineInterviewMapper extends Mapper<LineInterviewDO> {
* @return
*/
Integer batchUpdateInterviewStatus(@Param("interviewIds") List<Long> interviewIds, @Param("interviewStatus") Integer interviewStatus);
/**
* 获取面试提醒列表
* @param intervalMinutes
* @return
*/
List<LineInterviewDO> getInterviewRemindList(@Param("intervalMinutes") Integer intervalMinutes);
}

View File

@@ -126,4 +126,8 @@
</foreach>
</update>
<select id="getInterviewRemindList" resultMap="BaseResultMap">
select * from xfsg_line_interview where deleted = '0' and interview_type in (1, 2) and start_time between date_sub(now(), interval #{intervalMinutes} minute) and date_add(now(), interval #{intervalMinutes} minute)
</select>
</mapper>

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();
}
}