Commit 31443c7d by guominglei

Merge remote-tracking branch 'origin/developer' into developer

parents b218e6ad 5322244f
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.byit.dto.EmailMappingDto; import com.byit.dto.EmailMappingDto;
import com.byit.enums.EmailEnum; import com.byit.enums.EmailEnum;
import com.byit.enums.ScheduleTypeEnum;
import com.byit.model.EmailAlarm; import com.byit.model.EmailAlarm;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.RunRecording; import com.byit.model.RunRecording;
...@@ -84,7 +85,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -84,7 +85,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
} }
long flowEndTime = runRecording.getEndTime() == null? System.currentTimeMillis():runRecording.getEndTime().getTime(); long flowEndTime = runRecording.getEndTime() == null? System.currentTimeMillis():runRecording.getEndTime().getTime();
long flowStartTime = runRecording.getStartTime() == null? System.currentTimeMillis():runRecording.getStartTime().getTime(); long flowStartTime = runRecording.getStartTime() == null? System.currentTimeMillis():runRecording.getStartTime().getTime();
String senContentHtml = buildHtml(flowName,workspaceName,jobTaskRunLogByFlowIdAndRunId,flowEndTime-flowStartTime); String senContentHtml = buildHtml(flowName,workspaceName,jobTaskRunLogByFlowIdAndRunId,flowEndTime-flowStartTime,runRecording);
EmailAlarm emailAlarm = EmailAlarm.builder() EmailAlarm emailAlarm = EmailAlarm.builder()
.flowId(runRecording.getFlowId()) .flowId(runRecording.getFlowId())
.flowName(flowName) .flowName(flowName)
...@@ -107,17 +108,20 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -107,17 +108,20 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
/** /**
* 根据模板引擎构建html代码 * 根据模板引擎构建html代码
* @param title * @param title 主题
* @param env * @param env 环境名称
* @param jobTaskRunLogs * @param jobTaskRunLogs 日志节点
* @param flowConsumeDate * @param flowConsumeDate 消耗时间
* @return * @param runRecording 对应的运行实例
* @return 构建好的html
*/ */
public String buildHtml(String title,String env, List<JobTaskRunLogWithBLOBs> jobTaskRunLogs,Long flowConsumeDate){ public String buildHtml(String title,String env, List<JobTaskRunLogWithBLOBs> jobTaskRunLogs,Long flowConsumeDate, RunRecording runRecording){
Map<String, Object> data = new HashMap<>(4); Map<String, Object> data = new HashMap<>(4);
data.put("title",title); data.put("title",title);
data.put("env",env); data.put("env",env);
data.put("flowConsumeDate",TimeFormatUtil.timeFormat(flowConsumeDate)); data.put("flowConsumeDate",TimeFormatUtil.timeFormat(flowConsumeDate));
int scheduleType = runRecording.getScheduleType();
data.put("schedulingType",ScheduleTypeEnum.matchScheduleType(scheduleType));
List<EmailMappingDto> emailMappings = new ArrayList<>(8); List<EmailMappingDto> emailMappings = new ArrayList<>(8);
if (CollectionUtil.isNotEmpty(jobTaskRunLogs)) { if (CollectionUtil.isNotEmpty(jobTaskRunLogs)) {
jobTaskRunLogs.forEach(jobTaskRunLog -> { jobTaskRunLogs.forEach(jobTaskRunLog -> {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<table border='1' width='80%' align='center' cellspacing='0' cellpadding='6'> <table border='1' width='80%' align='center' cellspacing='0' cellpadding='6'>
<div style="margin-bottom: 20px;"> <div style="margin-bottom: 20px;">
<h1 style='text-align:center;color:red;'>工作流执行报告</h1> <h1 style='text-align:center;color:red;' th:text="${schedulingType}+'工作流执行报告'"></h1>
<br/> <br/>
<span style="margin-left: 10%;font-size: 16px;color: #646256;" th:text="'工作流名称:'+${title}"></span> <span style="margin-left: 10%;font-size: 16px;color: #646256;" th:text="'工作流名称:'+${title}"></span>
<span style="margin-left: 10%;font-size: 16px;color: #646256;" th:text="'总耗时:'+${flowConsumeDate}"></span> <span style="margin-left: 10%;font-size: 16px;color: #646256;" th:text="'总耗时:'+${flowConsumeDate}"></span>
......
package com.byit.enums; package com.byit.enums;
import java.util.Arrays;
/** /**
* @description: 调度类型枚举 * @description: 调度类型枚举
* @author: gml * @author: gml
...@@ -30,4 +32,14 @@ public enum ScheduleTypeEnum { ...@@ -30,4 +32,14 @@ public enum ScheduleTypeEnum {
return this.msg; return this.msg;
} }
public static String matchScheduleType(int code) {
ScheduleTypeEnum[] scheduleTypeEnums = ScheduleTypeEnum.values();
for (ScheduleTypeEnum scheduleTypeEnum : Arrays.asList(scheduleTypeEnums)) {
if (scheduleTypeEnum.code == code) {
return scheduleTypeEnum.msg;
}
}
return "未知类型$";
}
} }
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