同步代码
This commit is contained in:
parent
85987985a1
commit
01122e6daa
|
@ -13,16 +13,10 @@ public interface RedisConstant {
|
|||
*/
|
||||
String PREFIX_SILENCE = "SilenceCycle:";
|
||||
|
||||
String STREAM_ALARM = "Stream:Alarm";
|
||||
|
||||
String STREAM_ANALYSIS = "Stream:Analysis";
|
||||
|
||||
String GROUP_ALARM = "Group_Alarm";
|
||||
|
||||
String GROUP_ANALYSIS = "Group_Analysis";
|
||||
|
||||
String CONSUMER_ALARM = "Consumer_Alarm";
|
||||
|
||||
String CONSUMER_ANALYSIS = "Consumer_Analysis";
|
||||
|
||||
String NUCLIDE_LINES_LIB = "Nuclide_Lines_Lib:";
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.util.dynamic.db.FreemarkerParseFactory;
|
||||
import org.jeecg.modules.base.entity.postgre.SysMessageTemplate;
|
||||
import org.jeecg.modules.base.service.ISysMessageTemplateService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/*
|
||||
* 模板工具类
|
||||
|
@ -37,6 +44,30 @@ public class TemplateUtil {
|
|||
return messageDTO;
|
||||
}
|
||||
|
||||
public static MessageDTO parse1(String code, Map<String, Object> data){
|
||||
MessageDTO messageDTO = new MessageDTO();
|
||||
SysMessageTemplate template = templateService.getOne(code);
|
||||
// 如果没有消息模板
|
||||
if(ObjectUtil.isNull(template))
|
||||
return messageDTO;
|
||||
String templateName = template.getTemplateName();
|
||||
String templateContent = template.getTemplateContent();
|
||||
messageDTO.setTitle(templateName);
|
||||
if (MapUtil.isEmpty(data))
|
||||
return messageDTO;
|
||||
Set<String> keys = data.keySet();
|
||||
String pattern = "\\<([^<>]*{}[^<>]*)\\>";
|
||||
List<String> contents = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent));
|
||||
}
|
||||
templateContent = CollUtil.join(contents, "#");
|
||||
String content = FreemarkerParseFactory
|
||||
.parseTemplateContent(templateContent, data, true);
|
||||
messageDTO.setContent(content);
|
||||
return messageDTO;
|
||||
}
|
||||
|
||||
public static MessageDTO parse(String title, String code, Map<String, Object> data) {
|
||||
MessageDTO messageDTO = new MessageDTO();
|
||||
SysMessageTemplate template = templateService.getOne(code);
|
||||
|
@ -53,4 +84,28 @@ public class TemplateUtil {
|
|||
messageDTO.setContent(content);
|
||||
return messageDTO;
|
||||
}
|
||||
|
||||
public static MessageDTO parse1(String title, String code, Map<String, Object> data) {
|
||||
MessageDTO messageDTO = new MessageDTO();
|
||||
SysMessageTemplate template = templateService.getOne(code);
|
||||
// 如果没有消息模板
|
||||
if(ObjectUtil.isNull(template))
|
||||
return messageDTO;
|
||||
String templateName = template.getTemplateName();
|
||||
String templateContent = template.getTemplateContent();
|
||||
messageDTO.setTitle(StrUtil.isBlank(title) ? templateName : title);
|
||||
if (MapUtil.isEmpty(data))
|
||||
return messageDTO;
|
||||
Set<String> keys = data.keySet();
|
||||
String pattern = "\\<([^<>]*{}[^<>]*)\\>";
|
||||
List<String> contents = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
contents.add(ReUtil.getGroup1(StrUtil.format(pattern, key), templateContent));
|
||||
}
|
||||
templateContent = CollUtil.join(contents, "#");
|
||||
String content = FreemarkerParseFactory
|
||||
.parseTemplateContent(templateContent, data, true);
|
||||
messageDTO.setContent(content);
|
||||
return messageDTO;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.util.Comparator;
|
|||
|
||||
public class FileComparator implements Comparator<FileDto> {
|
||||
|
||||
private final String field;
|
||||
private final String order;
|
||||
private String field;
|
||||
private String order;
|
||||
|
||||
public FileComparator(String field, String order) {
|
||||
this.field = field;
|
||||
|
|
|
@ -3,8 +3,12 @@ package org.jeecg.modules.base.dto;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.util.NumUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
|
@ -17,4 +21,8 @@ public class NuclideInfo implements Serializable {
|
|||
private String datasource;
|
||||
|
||||
private String value;
|
||||
|
||||
public void keepSix(){
|
||||
this.value = NumUtil.keepStr(this.value, 6);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import lombok.Getter;
|
|||
public enum Condition {
|
||||
FIRST_FOUND("1"), ABOVE_AVERAGE("2"), MEANWHILE("3");
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
public static Condition valueOf1(String value){
|
||||
for (Condition condition : Condition.values()) {
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package org.jeecg.modules.base.enums;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author nieziyan
|
||||
* 数据源类型
|
||||
*/
|
||||
@Getter
|
||||
public enum DSType {
|
||||
/* ARMD自动处理库 */
|
||||
ARMDARR("1"),
|
||||
|
@ -15,13 +19,17 @@ public enum DSType {
|
|||
/* IDC人工交互库 */
|
||||
IDCRRR("4");
|
||||
|
||||
DSType(java.lang.String type) {
|
||||
DSType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private String type;
|
||||
private final String type;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
public static String typeOf(String type){
|
||||
for (DSType dsType : DSType.values()) {
|
||||
if (StrUtil.equals(type, dsType.getType()))
|
||||
return dsType.name();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ public class SpectrumParsingActuator implements Runnable{
|
|||
try {
|
||||
//开始解析
|
||||
spectrumHandler.handler();
|
||||
spectrumServiceQuotes.getRedisUtil().del(key);
|
||||
} catch (Exception e) {
|
||||
//如果是gamma谱的分析异常
|
||||
if (e instanceof AnalySpectrumException) {
|
||||
|
@ -139,7 +140,6 @@ public class SpectrumParsingActuator implements Runnable{
|
|||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
log.warn("This email {} parsing failed and is not listed in the Met, Alert, SOH, Sample, Detbkphd, QC, Gasbkphd spectra.",subject);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class SpectrumParsingActuator implements Runnable{
|
|||
final String finalPath = rootPath+emlErrorPath;
|
||||
FileOperation.moveFile(emlFile,finalPath,true);
|
||||
// 删除 key,防止下次线程执行删除邮件
|
||||
spectrumServiceQuotes.getRedisUtil().del(key);
|
||||
// spectrumServiceQuotes.getRedisUtil().del(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user