From c253b555c7905c5136d47cd615ef545fa50cc6ad Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Sun, 20 Feb 2022 21:24:16 +0800 Subject: [PATCH] Merge branch 'api_score_meger' --- zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java b/zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java new file mode 100644 index 0000000..e12431a --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/job/ServiceOvertimeNoticeJob.java @@ -0,0 +1,59 @@ +package com.matrix.system.job; + +import com.matrix.component.asyncmessage.AsyncMessageManager; +import com.matrix.component.rabbitmq.RabiitMqTemplate; +import com.matrix.core.tools.LogUtil; +import com.matrix.system.hive.bean.SysProjServices; +import com.matrix.system.hive.dao.SysProjServicesDao; +import com.matrix.system.hive.plugin.util.CollectionUtils; +import com.matrix.system.shopXcx.mqTask.AsyncMessageRouting; +import com.matrix.system.wechart.templateMsg.UniformMsgParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 预约服务到时提醒 + * @author 姜友瑶 + */ +@Component +public class ServiceOvertimeNoticeJob { + + @Autowired + private SysProjServicesDao projServicesDao; + + @Value("${evn}") + private String evn; + + + @Autowired + private AsyncMessageManager asyncMessageManager; + /** + * 每分钟执行一次 + */ + @Scheduled(cron = "0/30 * * * * ?") + public void serviceOvertimeNotice() { + + List<SysProjServices> needNoticeService=projServicesDao.selectNeedNoticeService(); + if(CollectionUtils.isNotEmpty(needNoticeService)){ + LogUtil.debug("执行服务单预约到时提醒任务,本次通知对象"+ needNoticeService.stream().map(SysProjServices::getVipName).collect(Collectors.joining(","))); + for(SysProjServices projServices : needNoticeService){ + //发送微信公众号提醒 + UniformMsgParam uniformMsgParam=new UniformMsgParam(projServices.getCompanyId(),UniformMsgParam.GZH_YYDS); + uniformMsgParam.put("serviceId",projServices.getId()); + asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam); + } + List<Long> noticedIds = needNoticeService.stream().map(SysProjServices::getId).collect(Collectors.toList()); + projServicesDao.updateNoticeTimes(noticedIds); + }else{ + LogUtil.debug("暂无需要提醒的服务单"); + } + + } + + +} -- Gitblit v1.9.1