Commit afada94c authored by wujipeng's avatar wujipeng
Browse files

月初-短信通知

parent b85b09c8
package com.ruzhoukj.sms.task;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruzhoukj.sms.entity.EmailRecordEntity;
import com.ruzhoukj.sms.entity.ScheduleEntity;
import com.ruzhoukj.sms.entity.SmsInformEntity;
......@@ -9,12 +10,15 @@ import com.ruzhoukj.sms.service.ScheduleService;
import com.ruzhoukj.sms.service.SmsInformService;
import com.ruzhoukj.sms.util.DateUtils;
import com.ruzhoukj.sms.util.EmailUtil;
import com.ruzhoukj.sms.util.SmsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author : wujipeng
......@@ -50,15 +54,27 @@ public class InTheEarlyTask {
.info("月初通知")
.createTime(new Date())
.build());
//保存短信信息
}
}
//短信通知
// @Scheduled(cron = "0/10 * * * * ?")
@Scheduled(cron = "0 0 9 1 * ?")
public void inTheEarlySms() {
Date[] dates = DateUtils.getStartAndEndDateOfCurrentMonth();
//查询本月维护人的信息
ScheduleEntity scheduleEntity = scheduleService.getUser(dates[0], dates[1]);
Map<String, String> map = new HashMap<>();
map.put("name", scheduleEntity.getName());
SmsUtil.sendMsg(scheduleEntity.getPhone(), "SMS_490030330", map);
//保存短信发送历史记录
smsInformService.save(SmsInformEntity.builder()
.date(new Date())
.name(scheduleEntity.getName())
.num(1)
.phone(scheduleEntity.getPhone())
.createTime(new Date())
.serviceName("月初通知")
.isDelete(1)
.build());
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment