From bd78c693c8b00f9c3b09e3317b1fc682aa78d2bd Mon Sep 17 00:00:00 2001 From: "feng.li" Date: Fri, 22 Sep 2023 14:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=A2=E8=AF=95=E5=BC=80=E5=A7=8B=E5=89=8D?= =?UTF-8?q?=E4=B8=80=E5=A4=A9=E5=8F=8A30=E5=88=86=E9=92=9F=E5=89=8D?= =?UTF-8?q?=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cool/store/enums/SMSMsgEnum.java | 6 +++- .../mapper/HyPartnerInterviewPlanMapper.java | 13 ++++++- .../mapper/HyPartnerInterviewPlanMapper.xml | 24 +++++++++++++ .../store/entity/HyInterviewRemindDO.java | 23 +++++++++++++ .../java/com/cool/store/job/JobHandler.java | 27 +++++++++++++++ .../HyPartnerInterviewPlanService.java | 10 ++++++ .../HyPartnerInterviewPlanServiceImpl.java | 34 ++++++++++++++++--- 7 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewRemindDO.java diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/SMSMsgEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/SMSMsgEnum.java index aafb1d09b..a0d839cdb 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/SMSMsgEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/SMSMsgEnum.java @@ -10,7 +10,11 @@ public enum SMSMsgEnum { INTERVIEW_APPOINTMENT_PASS("预约面试通过通知","【沪上阿姨】你已成功预约{$var}进行沪上阿姨加盟资格面试,届时请通过沪姨合伙人小程序进行面试,面试时间约40分钟,请提前仔细阅读面试准备材料以及观看加盟说明视频,做好面试相应准备。请务必提前安排好您的时间。点击转跳沪姨合伙人小程序:{$var}"), - INTERVIEW_PASS("面试通过通知","【沪上阿姨】恭喜您通过了加盟资格面试,接下来我们会为您安排专业的选址开发顾问协助您进行选址,请保持电话畅通,祝您早日选址成功!点击转跳沪姨合伙人小程序:{$var}"); + INTERVIEW_PASS("面试通过通知","【沪上阿姨】恭喜您通过了加盟资格面试,接下来我们会为您安排专业的选址开发顾问协助您进行选址,请保持电话畅通,祝您早日选址成功!点击转跳沪姨合伙人小程序:{$var}"), + + INTERVIEW_BEGIN_IN_DAY("面试开始前一天", "【沪上阿姨】您预约的沪上阿姨加盟资格面试将于明天 {$var}({$var})开始,为保证您能够更加顺利的通过面试,请提前通过沪上阿姨合伙人小程序仔细阅读面试准备材料并做好相应准备。点击转跳小程序:{$var}"), + + INTERVIEW_BEGIN_IN_MINUTES("面试开始前30分钟", "【沪上阿姨】您预约的沪上阿姨加盟资格面试将在30分钟后开始。面试预计持续40分钟,请务必提前安排好您的时间。点击跳转沪上阿姨小程序,快速进入面试房间:{$var}"); private String title; private String content; diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyPartnerInterviewPlanMapper.java b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyPartnerInterviewPlanMapper.java index aa5c8ecb5..6df52fa5a 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyPartnerInterviewPlanMapper.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyPartnerInterviewPlanMapper.java @@ -4,11 +4,11 @@ import com.cool.store.dto.message.RemindInterviewMsgDTO; import com.cool.store.dto.partner.AdvanceLineDTO; import com.cool.store.dto.partner.PartnerInterviewInfoDTO; import com.cool.store.dto.partner.SpecialDateRangeInterviewCountDTO; +import com.cool.store.entity.HyInterviewRemindDO; import com.cool.store.entity.HyPartnerInterviewPlanDO; import com.cool.store.request.GetInterviewListReq; import com.cool.store.vo.EnterpriseUserBaseInfoVO; import com.cool.store.vo.interview.InterviewVO; -import com.github.pagehelper.PageInfo; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -173,5 +173,16 @@ public interface HyPartnerInterviewPlanMapper { int updateLineId(@Param("newPartnerId") String newPartnerId, @Param("newLineId") Long newLineId, @Param("oldLineId") Long oldLineId); + /** + * 获取明天开始面试的面试开始时间和 partnerId(17:00 前确定为明天面试的) + * + * @return + */ + List getTomorrowInterview(); + /** + * 获取 30 分钟后开始的面试(预约30分钟之内的面试不发获取) + * @return + */ + List remindInterviewStartMinutes(); } \ No newline at end of file diff --git a/coolstore-partner-dao/src/main/resources/mapper/HyPartnerInterviewPlanMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/HyPartnerInterviewPlanMapper.xml index 3a0ecab07..55e7cd4bc 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/HyPartnerInterviewPlanMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/HyPartnerInterviewPlanMapper.xml @@ -542,4 +542,28 @@ set partner_line_id = #{newLineId} , partner_id = #{newPartnerId} where partner_line_id = #{oldLineId} + + + + + + + \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewRemindDO.java b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewRemindDO.java new file mode 100644 index 000000000..9c47a712c --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewRemindDO.java @@ -0,0 +1,23 @@ +package com.cool.store.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author Fun Li 2023/9/22 10:52 + * @version 1.0 + * 面试提醒短信所需信息 + */ +@Data +public class HyInterviewRemindDO implements Serializable { + + @ApiModelProperty("面试开始时间") + private Date startTime; + + @ApiModelProperty("加盟商手机号") + private String mobile; + +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/job/JobHandler.java b/coolstore-partner-service/src/main/java/com/cool/store/job/JobHandler.java index 3ad9abfd5..1f1b80e63 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/job/JobHandler.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/job/JobHandler.java @@ -111,4 +111,31 @@ public class JobHandler { } } + @XxlJob("remindInterviewStartTomorrow") + public void remindInterviewStartTomorrow() { + try { + log.info("面试开始前一天20:00提醒开始"); + hyPartnerInterviewPlanService.remindInterviewStartTomorrow(); + log.info("面试开始前一天20:00提醒结束"); + XxlJobHelper.handleSuccess(); + } catch (Exception e) { + log.error("面试开始前一天20:00提醒异常", e); + XxlJobHelper.log("面试开始前一天20:00提醒异常" + e.getMessage()); + } + } + + //每半小时执行一次,查询有无面试时间 x 在当前时间 y < x <= y + 30m 内,有就发短信 + @XxlJob("remindInterviewStartMinutes") + public void remindInterviewStartMinutes() { + try { + log.info("面试开始前一天20:00提醒开始"); + hyPartnerInterviewPlanService.remindInterviewStartMinutes(); + log.info("面试开始前一天20:00提醒结束"); + XxlJobHelper.handleSuccess(); + } catch (Exception e) { + log.error("面试开始前一天20:00提醒异常", e); + XxlJobHelper.log("面试开始前一天20:00提醒异常" + e.getMessage()); + } + } + } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerInterviewPlanService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerInterviewPlanService.java index 6d79a8ca1..4dfd37215 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerInterviewPlanService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/HyPartnerInterviewPlanService.java @@ -63,4 +63,14 @@ public interface HyPartnerInterviewPlanService { */ void updateAbsentInterview() throws ApiException; void approvalReminder() throws ApiException; + + /** + * 面试前一天 20:00 提醒 + */ + void remindInterviewStartTomorrow(); + + /** + * 面试前 30 分钟提醒 + */ + void remindInterviewStartMinutes(); } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerInterviewPlanServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerInterviewPlanServiceImpl.java index 5b6c3e1e5..2054734c6 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerInterviewPlanServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyPartnerInterviewPlanServiceImpl.java @@ -17,10 +17,7 @@ import com.cool.store.mapper.HyPartnerLineInfoMapper; import com.cool.store.mapper.HyPartnerUserChannelMapper; import com.cool.store.request.CloseFollowRequest; import com.cool.store.request.GetInterviewListReq; -import com.cool.store.service.HyPartnerInterviewPlanService; -import com.cool.store.service.HyPartnerLineInfoService; -import com.cool.store.service.InterviewService; -import com.cool.store.service.LabelService; +import com.cool.store.service.*; import com.cool.store.utils.CoolDateUtils; import com.cool.store.vo.InterviewDetailInfoVO; import com.cool.store.vo.PartnerInterviewInfoVO; @@ -36,6 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -91,6 +89,13 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan @Autowired private ISVHttpRequest isvHttpRequest; + + @Autowired + private SmsService smsService; + + @Autowired + private WechatMiniAppService wechatMiniAppService; + @Override public List getInterviewPlanList(String userId,Date dateTime) { String currentDay = DateUtil.format(dateTime, CoolDateUtils.DATE_FORMAT_DAY); @@ -354,4 +359,25 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan return partnerInterviewInfoVO; } + @Override + public void remindInterviewStartTomorrow() { + List tomorrowInterviewInfos = hyPartnerInterviewPlanMapper.getTomorrowInterview(); + SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm"); + SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy年MM月dd日"); + Date startTime; + for (HyInterviewRemindDO tomorrowInterviewInfo : tomorrowInterviewInfos) { + startTime = tomorrowInterviewInfo.getStartTime(); + smsService.sendSmsVariable(tomorrowInterviewInfo.getMobile(), SMSMsgEnum.INTERVIEW_BEGIN_IN_DAY, timeFormatter.format(startTime), dateFormatter.format(startTime), wechatMiniAppService.getMiniAppUrl()); + } + } + + //每半小时执行一次,查询有无面试时间 x 在当前时间 y < x <= y + 30m 内,有就发短信 + @Override + public void remindInterviewStartMinutes() { + List tomorrowInterviewInfos = hyPartnerInterviewPlanMapper.remindInterviewStartMinutes(); + for (HyInterviewRemindDO tomorrowInterviewInfo : tomorrowInterviewInfos) { + smsService.sendSmsVariable(tomorrowInterviewInfo.getMobile(), SMSMsgEnum.INTERVIEW_BEGIN_IN_MINUTES, wechatMiniAppService.getMiniAppUrl()); + } + } + }