|
|
|
@ -1,16 +1,13 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.schedulejob;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
|
|
|
|
|
import cn.estsh.impp.framework.base.schedule.BaseImppScheduleJob;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.impp.framework.boot.init.ApplicationProperties;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.quartz.JobExecutionContext;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -26,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@ApiOperation("定时任务demo")
|
|
|
|
|
public class DemoJob extends BaseImppScheduleJob {
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(DemoJob.class);
|
|
|
|
|
private static final long serialVersionUID = 2582480740831583839L;
|
|
|
|
|
|
|
|
|
|
public DemoJob() {
|
|
|
|
|
super(DemoJob.class,"定时任务demo");
|
|
|
|
@ -44,19 +42,14 @@ public class DemoJob extends BaseImppScheduleJob {
|
|
|
|
|
.setErrorSolution("请检查异常通知邮件")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
if(getJobParam() != null && StringUtils.isNotBlank(getJobParam())) {
|
|
|
|
|
Thread.sleep(Long.parseLong(getJobParam()));
|
|
|
|
|
}
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
System.out.println("定时任务被执行");
|
|
|
|
|
LOGGER.info("projectName:{},port:{}", applicationProperties.getApplicationName(),applicationProperties.getServerPort());
|
|
|
|
|
|
|
|
|
|
SysMessage sysMessage = new SysMessage();
|
|
|
|
|
sysMessage.setMessageTitle("定时邮件发送");
|
|
|
|
|
sysMessage.setMessageContent("定时任务name:"+context.getJobDetail().getKey().getName() +
|
|
|
|
|
"定时任务groupName:"+context.getJobDetail().getKey().getGroup() +
|
|
|
|
|
"定时邮件内容"+TimeTool.getNowTime(true));
|
|
|
|
|
sysMessage.setMessageType(ImppEnumUtil.MESSAGE_TYPE.MAIL.getValue());
|
|
|
|
|
sysMessage.setMessageContentType(ImppEnumUtil.MESSAGE_TYPE_CONTENT.HTML.getValue());
|
|
|
|
|
sysMessage.setMessageReceiversId(PlatformConstWords.CONTACT_MAIL);
|
|
|
|
|
sysMessage.setMessageReceiversNameRdd(PlatformConstWords.CONTACT_MAIL);
|
|
|
|
|
sysMessage.setMessageReceiverType(ImppEnumUtil.MESSAGE_RECEIVER_TYPE.URGENT.getValue());
|
|
|
|
|
sysMessageService.doSendSysMessage(sysMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|