Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
eb726a9061
|
@ -30,4 +30,8 @@ public interface Prompt {
|
||||||
String PARAM_REQUIRED = "Param Is Required!";
|
String PARAM_REQUIRED = "Param Is Required!";
|
||||||
|
|
||||||
String PARAM_NOT_EMPTY = "Param Cat Not Be Empty!";
|
String PARAM_NOT_EMPTY = "Param Cat Not Be Empty!";
|
||||||
|
|
||||||
|
String EXEC_SUCC = "Task executed successfully!";
|
||||||
|
|
||||||
|
String EXEC_Faild = "Task executed Faild!";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.base.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jeecg.modules.base.entity.monitor.Item;
|
import org.jeecg.modules.base.entity.monitor.Item;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.AlarmItem;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ -14,9 +15,9 @@ public class ItemDto implements Serializable{
|
||||||
|
|
||||||
private String units;
|
private String units;
|
||||||
|
|
||||||
public ItemDto(Item item) {
|
public ItemDto(AlarmItem alarmItem) {
|
||||||
this.itemId = item.getItemId();
|
this.itemId = alarmItem.getId();
|
||||||
this.name = item.getName();
|
this.name = alarmItem.getName();
|
||||||
this.units = item.getUnits();
|
this.units = alarmItem.getUnits();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ import lombok.experimental.Accessors;
|
||||||
import org.jeecg.modules.base.enums.SourceType;
|
import org.jeecg.modules.base.enums.SourceType;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -30,8 +31,14 @@ public class RuleDto implements Serializable{
|
||||||
// 谱id
|
// 谱id
|
||||||
private String sampleId;
|
private String sampleId;
|
||||||
|
|
||||||
|
// 谱Name
|
||||||
|
private String sampleName;
|
||||||
|
|
||||||
|
// 采样时间
|
||||||
|
private LocalDateTime collectionDate;
|
||||||
|
|
||||||
// 数据源类型(ARMDARR=1|ARMDRRR=2|IDCARR=3|IDCRRR=4)
|
// 数据源类型(ARMDARR=1|ARMDRRR=2|IDCARR=3|IDCRRR=4)
|
||||||
private String dataSourceType;
|
private String datasource;
|
||||||
|
|
||||||
// 谱类型 (FULL|PREL)
|
// 谱类型 (FULL|PREL)
|
||||||
private String fullOrPrel;
|
private String fullOrPrel;
|
||||||
|
@ -41,4 +48,11 @@ public class RuleDto implements Serializable{
|
||||||
|
|
||||||
// 核素名称-浓度值
|
// 核素名称-浓度值
|
||||||
private Map<String,String> nuclides;
|
private Map<String,String> nuclides;
|
||||||
|
|
||||||
|
/* 以下属性不需要传值 */
|
||||||
|
private String ruleId;
|
||||||
|
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
private String conditions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class AlarmAnalysisLog implements Serializable{
|
||||||
|
|
||||||
private String datasource;
|
private String datasource;
|
||||||
|
|
||||||
|
private String sampleName;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<NuclideInfo> nuclideInfoList;
|
private List<NuclideInfo> nuclideInfoList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("alarm_analysis_rule")
|
@TableName("alarm_analysis_rule")
|
||||||
|
|
|
@ -20,8 +20,8 @@ public class AlarmAnalysisNuclideParamController extends JeecgController<AlarmAn
|
||||||
|
|
||||||
@GetMapping("refresh")
|
@GetMapping("refresh")
|
||||||
@ApiOperation(value = "定时刷新核素计算参数信息",notes = "定时刷新核素计算参数信息")
|
@ApiOperation(value = "定时刷新核素计算参数信息",notes = "定时刷新核素计算参数信息")
|
||||||
public void refreshParam(){
|
public boolean refreshParam(){
|
||||||
service.refresh();
|
return service.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("findInfo")
|
@GetMapping("findInfo")
|
||||||
|
|
|
@ -1,20 +1,25 @@
|
||||||
package org.jeecg.modules.controller;
|
package org.jeecg.modules.controller;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.modules.base.entity.postgre.AlarmItem;
|
import org.jeecg.modules.base.entity.postgre.AlarmItem;
|
||||||
import org.jeecg.modules.service.IAlarmItemService;
|
import org.jeecg.modules.service.IAlarmItemService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@Api(value = "监控项管理",tags = "监控项管理")
|
@Api(value = "监控项管理",tags = "监控项管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/alarmitem")
|
@RequestMapping("alarmItem")
|
||||||
public class AlarmItemController extends JeecgController<AlarmItem, IAlarmItemService> {
|
public class AlarmItemController extends JeecgController<AlarmItem, IAlarmItemService> {
|
||||||
|
|
||||||
@Autowired
|
@GetMapping("syncItem")
|
||||||
private IAlarmItemService alarmItemService;
|
@ApiOperation(value = "同步监控项信息",notes = "同步监控项信息")
|
||||||
|
public boolean syncItem(@RequestParam String type,
|
||||||
|
@RequestParam String code){
|
||||||
|
return service.syncItem(type,code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,11 @@ import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.base.dto.ItemDto;
|
import org.jeecg.modules.base.dto.ItemDto;
|
||||||
import org.jeecg.modules.base.entity.monitor.Host;
|
import org.jeecg.modules.base.entity.monitor.Host;
|
||||||
import org.jeecg.modules.base.entity.monitor.Servers;
|
import org.jeecg.modules.base.entity.monitor.Servers;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.AlarmItem;
|
||||||
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
||||||
import org.jeecg.modules.base.vo.AlarmRuleVo;
|
import org.jeecg.modules.base.vo.AlarmRuleVo;
|
||||||
import org.jeecg.modules.feignclient.MonitorAlarm;
|
import org.jeecg.modules.feignclient.MonitorAlarm;
|
||||||
|
import org.jeecg.modules.service.IAlarmItemService;
|
||||||
import org.jeecg.modules.service.IAlarmRuleService;
|
import org.jeecg.modules.service.IAlarmRuleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -28,6 +30,9 @@ public class AlarmRuleController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAlarmRuleService alarmRuleService;
|
private IAlarmRuleService alarmRuleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAlarmItemService alarmItemService;
|
||||||
|
|
||||||
@GetMapping("findPage")
|
@GetMapping("findPage")
|
||||||
@ApiOperation(value = "分页查询报警规则", notes = "分页查询报警规则")
|
@ApiOperation(value = "分页查询报警规则", notes = "分页查询报警规则")
|
||||||
public Result findPage(AlarmRuleVo alarmRuleVo){
|
public Result findPage(AlarmRuleVo alarmRuleVo){
|
||||||
|
@ -66,17 +71,9 @@ public class AlarmRuleController {
|
||||||
|
|
||||||
@GetMapping("getItems")
|
@GetMapping("getItems")
|
||||||
@ApiOperation(value = "根据资源名称获取监控项",notes = "根据资源名称获取监控项")
|
@ApiOperation(value = "根据资源名称获取监控项",notes = "根据资源名称获取监控项")
|
||||||
public Result getItems(@RequestParam String sourceName){
|
public Result getItems(@RequestParam String sourceId){
|
||||||
Result<Servers> result = monitorAlarm.listBack(sourceName);
|
List<AlarmItem> alarmItems = alarmItemService.alarmItems(sourceId);
|
||||||
List<Host> hosts = result.getResult().getRecords();
|
List<ItemDto> itemDtos = alarmItems.stream().map(ItemDto::new).collect(Collectors.toList());
|
||||||
List<ItemDto> itemDtos = new ArrayList<>();
|
|
||||||
for (Host host : hosts) {
|
|
||||||
boolean equals = host.getCode().equals(sourceName);
|
|
||||||
if(!equals)continue;
|
|
||||||
itemDtos = host.getItems().values().stream()
|
|
||||||
.map(ItemDto::new)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
return Result.OK(itemDtos);
|
return Result.OK(itemDtos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class CalculateConcController {
|
||||||
|
|
||||||
@GetMapping("caclAndSave")
|
@GetMapping("caclAndSave")
|
||||||
@ApiOperation(value = "计算并保存核素浓度",notes = "计算并保存核素浓度")
|
@ApiOperation(value = "计算并保存核素浓度",notes = "计算并保存核素浓度")
|
||||||
public void caclAndSave(){
|
public boolean caclAndSave(){
|
||||||
calculateConcService.calcAndSave();
|
return calculateConcService.calcAndSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@FeignClient(name = "monitorAlarm",url = "http://218.249.158.97:7008/mobile/monitor")
|
@FeignClient(name = "monitorAlarm",url = "http://123.124.245.134:7008/mobile/monitor")
|
||||||
public interface MonitorAlarm {
|
public interface MonitorAlarm {
|
||||||
|
|
||||||
// --------------------后端专用-------------------
|
// --------------------后端专用-------------------
|
||||||
|
|
|
@ -38,10 +38,10 @@
|
||||||
AND source_id = #{sourceId}
|
AND source_id = #{sourceId}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY enabled DESC, create_time DESC
|
||||||
<if test="pageFlag == null">
|
<if test="pageFlag == null">
|
||||||
LIMIT #{pageSize} OFFSET #{pageStart}
|
LIMIT #{pageSize} OFFSET #{pageStart}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY enabled DESC, create_time DESC
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findInfo" parameterType="String" resultType="org.jeecg.modules.base.dto.AlarmRuleInfo">
|
<select id="findInfo" parameterType="String" resultType="org.jeecg.modules.base.dto.AlarmRuleInfo">
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
package org.jeecg.modules.redisStream;
|
package org.jeecg.modules.redisStream;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.util.RedisStreamUtil;
|
import org.jeecg.common.util.RedisStreamUtil;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.modules.base.dto.NuclideInfo;
|
import org.jeecg.modules.base.dto.NuclideInfo;
|
||||||
import org.jeecg.modules.base.dto.RuleDto;
|
import org.jeecg.modules.base.dto.RuleDto;
|
||||||
|
@ -29,7 +25,6 @@ import org.jeecg.modules.service.AnalysisResultService;
|
||||||
import org.jeecg.modules.service.IAlarmAnalysisLogService;
|
import org.jeecg.modules.service.IAlarmAnalysisLogService;
|
||||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
|
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
|
||||||
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
|
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.connection.stream.ObjectRecord;
|
import org.springframework.data.redis.connection.stream.ObjectRecord;
|
||||||
import org.springframework.data.redis.connection.stream.RecordId;
|
import org.springframework.data.redis.connection.stream.RecordId;
|
||||||
import org.springframework.data.redis.stream.StreamListener;
|
import org.springframework.data.redis.stream.StreamListener;
|
||||||
|
@ -38,8 +33,6 @@ import static org.jeecg.common.constant.enums.MessageTypeEnum.*;
|
||||||
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -101,8 +94,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
String stationId = ruleDto.getStationId();
|
String stationId = ruleDto.getStationId();
|
||||||
String sampleId = ruleDto.getSampleId();
|
String sampleId = ruleDto.getSampleId();
|
||||||
String fullOrPrel = ruleDto.getFullOrPrel();
|
String fullOrPrel = ruleDto.getFullOrPrel();
|
||||||
String betaOrGamma = ruleDto.getBetaOrGamma();
|
String datasource = ruleDto.getDatasource();
|
||||||
String dataSourceType = ruleDto.getDataSourceType();
|
|
||||||
Map<String, String> nuclides = ruleDto.getNuclides();
|
Map<String, String> nuclides = ruleDto.getNuclides();
|
||||||
if (StrUtil.isBlank(stationId)) return;
|
if (StrUtil.isBlank(stationId)) return;
|
||||||
if (StrUtil.isBlank(sampleId)) return;
|
if (StrUtil.isBlank(sampleId)) return;
|
||||||
|
@ -118,7 +110,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
continue;
|
continue;
|
||||||
// 是否在当前规则关注的数据源内
|
// 是否在当前规则关注的数据源内
|
||||||
String source = rule.getSource();
|
String source = rule.getSource();
|
||||||
if (!StrUtil.contains(source,dataSourceType))
|
if (!StrUtil.contains(source,datasource))
|
||||||
continue;
|
continue;
|
||||||
// 是否在当前规则关注的谱类型内
|
// 是否在当前规则关注的谱类型内
|
||||||
String spectralQualifier = rule.getSpectralQualifier();
|
String spectralQualifier = rule.getSpectralQualifier();
|
||||||
|
@ -136,34 +128,32 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
.filter(entry -> cross.contains(entry.getKey()))
|
.filter(entry -> cross.contains(entry.getKey()))
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
// 开始对交集中的核素进行条件判断
|
// 开始对交集中的核素进行条件判断
|
||||||
List<String> conditions = ListUtil.toList(conditionStr.split(comma));
|
ruleDto.setRuleId(rule.getId());
|
||||||
String ruleId = rule.getId();
|
ruleDto.setGroupId(rule.getContactGroup());
|
||||||
String groupId = rule.getContactGroup();
|
ruleDto.setConditions(rule.getConditions());
|
||||||
judge(ruleId,groupId,sampleId,betaOrGamma,dataSourceType,conditions,nuclidesCross);
|
judge(ruleDto,nuclidesCross);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void judge(String ruleId,
|
private void judge(RuleDto ruleDto, Map<String,String> nuclidesCross){
|
||||||
String groupId,
|
|
||||||
String sampleId,
|
|
||||||
String betaOrGamma,
|
|
||||||
String dataSourceType,
|
|
||||||
List<String> conditions,
|
|
||||||
Map<String,String> nuclidesCross){
|
|
||||||
String ONE = "1";String TWO = "2";String THREE = "3";
|
String ONE = "1";String TWO = "2";String THREE = "3";
|
||||||
Set<String> nuclideNames = nuclidesCross.keySet();
|
Set<String> nuclideNames = nuclidesCross.keySet();
|
||||||
String alarmInfo = "";
|
String alarmInfo = "";
|
||||||
List<String> firstDetected;
|
List<String> firstDetected;
|
||||||
List<NuclideInfo> moreThanAvg = new ArrayList<>();
|
List<NuclideInfo> moreThanAvg = new ArrayList<>();
|
||||||
|
String conditionStr = ruleDto.getConditions();
|
||||||
|
String betaOrGamma = ruleDto.getBetaOrGamma();
|
||||||
|
String datasource = ruleDto.getDatasource();
|
||||||
|
List<String> conditions = ListUtil.toList(conditionStr.split(comma));
|
||||||
for (String con : conditions) {
|
for (String con : conditions) {
|
||||||
if (ONE.equals(con)){ // 首次发现该元素
|
if (ONE.equals(con)){ // 首次发现该元素
|
||||||
firstDetected = firstDetected(betaOrGamma,dataSourceType,nuclideNames);
|
firstDetected = firstDetected(betaOrGamma,datasource,nuclideNames);
|
||||||
if (CollUtil.isNotEmpty(firstDetected)){
|
if (CollUtil.isNotEmpty(firstDetected)){
|
||||||
String message = "核素"+StrUtil.join(comma,firstDetected)+"首次发现";
|
String message = "核素"+StrUtil.join(comma,firstDetected)+"首次发现";
|
||||||
alarmInfo += message;
|
alarmInfo += message;
|
||||||
}
|
}
|
||||||
} else if (TWO.equals(con)) { // 元素浓度高于均值
|
} else if (TWO.equals(con)) { // 元素浓度高于均值
|
||||||
moreThanAvg = moreThanAvg(dataSourceType,nuclidesCross);
|
moreThanAvg = moreThanAvg(datasource,nuclidesCross);
|
||||||
if (CollUtil.isNotEmpty(moreThanAvg)){
|
if (CollUtil.isNotEmpty(moreThanAvg)){
|
||||||
for (NuclideInfo nuclideInfo : moreThanAvg) {
|
for (NuclideInfo nuclideInfo : moreThanAvg) {
|
||||||
String nuclide = nuclideInfo.getNuclide();
|
String nuclide = nuclideInfo.getNuclide();
|
||||||
|
@ -182,8 +172,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
if (StrUtil.isNotBlank(alarmInfo)){
|
if (StrUtil.isNotBlank(alarmInfo)){
|
||||||
// 保存报警日志
|
// 保存报警日志
|
||||||
AlarmAnalysisLog logInfo = new AlarmAnalysisLog();
|
AlarmAnalysisLog logInfo = new AlarmAnalysisLog();
|
||||||
logInfo.setRuleId(ruleId);
|
BeanUtil.copyProperties(ruleDto,logInfo);
|
||||||
logInfo.setSampleId(sampleId);
|
|
||||||
if (alarmInfo.startsWith(comma))
|
if (alarmInfo.startsWith(comma))
|
||||||
alarmInfo = StrUtil.sub(alarmInfo, 1, alarmInfo.length());
|
alarmInfo = StrUtil.sub(alarmInfo, 1, alarmInfo.length());
|
||||||
logInfo.setAlarmInfo(alarmInfo);
|
logInfo.setAlarmInfo(alarmInfo);
|
||||||
|
@ -191,6 +180,7 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
|
||||||
logInfo.setNuclideInfoList(moreThanAvg);
|
logInfo.setNuclideInfoList(moreThanAvg);
|
||||||
logService.saveLog(logInfo);
|
logService.saveLog(logInfo);
|
||||||
// 发送报警信息
|
// 发送报警信息
|
||||||
|
String groupId = ruleDto.getGroupId();
|
||||||
if (StrUtil.isNotBlank(groupId))
|
if (StrUtil.isNotBlank(groupId))
|
||||||
systemClient.sendMessage(alarmInfo,groupId, ALL.getValue());
|
systemClient.sendMessage(alarmInfo,groupId, ALL.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public interface CalculateConcService {
|
public interface CalculateConcService {
|
||||||
|
|
||||||
void calcAndSave();
|
boolean calcAndSave();
|
||||||
|
|
||||||
Map<String,String> calculate(List<ConcDto> concDtos, BigDecimal index);
|
Map<String,String> calculate(List<ConcDto> concDtos, BigDecimal index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.base.entity.postgre.AlarmItem;
|
import org.jeecg.modules.base.entity.postgre.AlarmItem;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface IAlarmItemService extends IService<AlarmItem> {
|
public interface IAlarmItemService extends IService<AlarmItem> {
|
||||||
Result syncItem(String sourceType,String code);
|
boolean syncItem(String sourceType,String code);
|
||||||
|
|
||||||
|
List<AlarmItem> alarmItems(String sourceId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AlarmAnalysisNuclideParamServiceImpl extends ServiceImpl<AlarmAnalysisNuclideParamMapper, AlarmAnalysisNuclideParam> implements IAlarmAnalysisNuclideParamService {
|
public class AlarmAnalysisNuclideParamServiceImpl extends ServiceImpl<AlarmAnalysisNuclideParamMapper, AlarmAnalysisNuclideParam> implements IAlarmAnalysisNuclideParamService {
|
||||||
|
|
||||||
|
@ -22,11 +25,22 @@ public class AlarmAnalysisNuclideParamServiceImpl extends ServiceImpl<AlarmAnaly
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean refresh() {
|
public boolean refresh() {
|
||||||
|
try {
|
||||||
AlarmAnalysisNuclideParam nuclideParam = new AlarmAnalysisNuclideParam();
|
AlarmAnalysisNuclideParam nuclideParam = new AlarmAnalysisNuclideParam();
|
||||||
|
AlarmAnalysisNuclideParam latest = getLatest();
|
||||||
|
LocalDate localDate = latest.getCreateTime().toInstant()
|
||||||
|
.atZone(ZoneId.systemDefault()).toLocalDate();
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
boolean isToday = today.equals(localDate);
|
||||||
|
if (isToday) return true;
|
||||||
CopyOptions options = CopyOptions.create()
|
CopyOptions options = CopyOptions.create()
|
||||||
.setIgnoreProperties("id","createTime");
|
.setIgnoreProperties("id","createTime");
|
||||||
BeanUtil.copyProperties(getLatest(),nuclideParam,options);
|
BeanUtil.copyProperties(latest,nuclideParam,options);
|
||||||
return save(nuclideParam);
|
return save(nuclideParam);
|
||||||
|
}catch (Throwable e){
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package org.jeecg.modules.service.impl;
|
package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.Prompt;
|
import org.jeecg.common.constant.Prompt;
|
||||||
|
@ -17,6 +19,7 @@ import org.jeecg.modules.service.ISysDatabaseService;
|
||||||
import org.jeecg.modules.service.ISysServerService;
|
import org.jeecg.modules.service.ISysServerService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -38,17 +41,18 @@ public class AlarmItemServiceImpl extends ServiceImpl<AlarmItemMapper, AlarmItem
|
||||||
private ISysDatabaseService databaseService;
|
private ISysDatabaseService databaseService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result syncItem(String type,String code) {
|
public boolean syncItem(String type,String code) {
|
||||||
|
try {
|
||||||
String sourceId = null;
|
String sourceId = null;
|
||||||
if (SERVER.getType().equals(type)){
|
if (SERVER.getType().equals(type)){
|
||||||
sourceId = serverService.getByName(code);
|
sourceId = serverService.getByName(code);
|
||||||
} else if (DATABASE.getType().equals(type)) {
|
} else if (DATABASE.getType().equals(type)) {
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
return Result.error("Soucrce Type Not Extis!");
|
return false;
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(sourceId))
|
if (StrUtil.isBlank(sourceId))
|
||||||
return Result.error(Prompt.DATA_NOT_EXITS);
|
return false;
|
||||||
|
|
||||||
Result<Servers> result = monitorAlarm.listBack(code);
|
Result<Servers> result = monitorAlarm.listBack(code);
|
||||||
List<Host> hosts = result.getResult().getRecords();
|
List<Host> hosts = result.getResult().getRecords();
|
||||||
|
@ -59,20 +63,28 @@ public class AlarmItemServiceImpl extends ServiceImpl<AlarmItemMapper, AlarmItem
|
||||||
items = ListUtil.toList(host.getItems().values());
|
items = ListUtil.toList(host.getItems().values());
|
||||||
}
|
}
|
||||||
if (CollUtil.isEmpty(items))
|
if (CollUtil.isEmpty(items))
|
||||||
return Result.error(Prompt.DATA_IS_EMPTY);
|
return false;
|
||||||
|
|
||||||
List<AlarmItem> alarmItems = new ArrayList<>();
|
List<AlarmItem> alarmItems = new ArrayList<>();
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
AlarmItem alarmItem = new AlarmItem();
|
AlarmItem alarmItem = BeanUtil.copyProperties(item, AlarmItem.class);
|
||||||
alarmItem.setId(item.getItemId());
|
alarmItem.setId(item.getItemId());
|
||||||
alarmItem.setName(item.getName());
|
|
||||||
alarmItem.setUnits(item.getUnits());
|
|
||||||
alarmItem.setSourceId(sourceId);
|
alarmItem.setSourceId(sourceId);
|
||||||
alarmItem.setDescription(item.getDescription());
|
|
||||||
alarmItems.add(alarmItem);
|
alarmItems.add(alarmItem);
|
||||||
}
|
}
|
||||||
if(saveOrUpdateBatch(alarmItems))
|
return saveOrUpdateBatch(alarmItems);
|
||||||
return Result.OK(Prompt.UPDATE_SUCC);
|
}catch (Exception e){
|
||||||
return Result.error(Prompt.UPDATE_ERR);
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AlarmItem> alarmItems(String sourceId) {
|
||||||
|
if (StrUtil.isBlank(sourceId))
|
||||||
|
return ListUtil.empty();
|
||||||
|
LambdaQueryWrapper<AlarmItem> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(AlarmItem::getSourceId,sourceId);
|
||||||
|
return list(wrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ public class CalculateConcServiceImpl implements CalculateConcService {
|
||||||
private IAlarmAnalysisNuclideParamService nuclideParamService;
|
private IAlarmAnalysisNuclideParamService nuclideParamService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calcAndSave() {
|
public boolean calcAndSave() {
|
||||||
|
try {
|
||||||
String comma = SymbolConstant.COMMA;
|
String comma = SymbolConstant.COMMA;
|
||||||
List<AlarmAnalysisRule> analysisRules = analysisRuleService.allAnalysisRule();
|
List<AlarmAnalysisRule> analysisRules = analysisRuleService.allAnalysisRule();
|
||||||
Set<String> nuclideNames = analysisRules.stream()
|
Set<String> nuclideNames = analysisRules.stream()
|
||||||
|
@ -93,7 +94,11 @@ public class CalculateConcServiceImpl implements CalculateConcService {
|
||||||
manAvgs.addAll(autoAvgs);
|
manAvgs.addAll(autoAvgs);
|
||||||
String cycle = startDate + SymbolConstant.WELL_NUMBER + endDate;
|
String cycle = startDate + SymbolConstant.WELL_NUMBER + endDate;
|
||||||
manAvgs.forEach(item -> item.setCycle(cycle).setCaclDate(dayAgo));
|
manAvgs.forEach(item -> item.setCycle(cycle).setCaclDate(dayAgo));
|
||||||
nuclideAvgService.saveBatch(manAvgs);
|
return nuclideAvgService.saveBatch(manAvgs);
|
||||||
|
}catch (Throwable e){
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,9 +31,14 @@ public interface AbnormalAlarmClient {
|
||||||
|
|
||||||
/* CalculateConcController下相关接口 */
|
/* CalculateConcController下相关接口 */
|
||||||
@GetMapping("/calculateConc/caclAndSave")
|
@GetMapping("/calculateConc/caclAndSave")
|
||||||
void calculateConc();
|
boolean calculateConc();
|
||||||
|
|
||||||
/* AlarmAnalysisNuclideParamController下相关接口 */
|
/* AlarmAnalysisNuclideParamController下相关接口 */
|
||||||
@GetMapping("/nuclideParam/refresh")
|
@GetMapping("/nuclideParam/refresh")
|
||||||
void refreshParam();
|
boolean refreshParam();
|
||||||
|
|
||||||
|
/* AlarmItemController下相关接口 */
|
||||||
|
@GetMapping("/alarmItem/syncItem")
|
||||||
|
boolean syncItem(@RequestParam String type,
|
||||||
|
@RequestParam String code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
import org.jeecg.common.constant.Prompt;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.system.vo.LoginUser;
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
|
@ -272,19 +273,17 @@ public class QuartzJobController {
|
||||||
//@RequiresRoles("admin")
|
//@RequiresRoles("admin")
|
||||||
//@RequiresPermissions("system:quartzJob:execute")
|
//@RequiresPermissions("system:quartzJob:execute")
|
||||||
@GetMapping("/execute")
|
@GetMapping("/execute")
|
||||||
public Result<?> execute(@RequestParam(name = "id", required = true) String id) {
|
public Result<?> execute(@RequestParam("id") String id) {
|
||||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||||
if (quartzJob == null) {
|
if (quartzJob == null) {
|
||||||
return Result.error("未找到对应实体");
|
return Result.error("The specified task entity class was not found");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
quartzJobService.execute(quartzJob);
|
return quartzJobService.execute(quartzJob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.info("定时任务 立即执行失败>>"+e.getMessage());
|
return Result.error(Prompt.EXEC_Faild);
|
||||||
return Result.error("执行失败!");
|
|
||||||
}
|
}
|
||||||
return Result.ok("执行成功!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.quartz.job;
|
package org.jeecg.modules.quartz.job;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
||||||
|
@ -15,17 +16,27 @@ import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
/**
|
/**
|
||||||
* 定时更新核素浓度计算参数
|
* 定时更新核素浓度计算参数
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@DisallowConcurrentExecution
|
@DisallowConcurrentExecution
|
||||||
@PersistJobDataAfterExecution
|
@PersistJobDataAfterExecution
|
||||||
public class NuclideParamJob implements Job {
|
public class NuclideParamJob implements Job {
|
||||||
|
|
||||||
private AbnormalAlarmClient alarmClient;
|
private AbnormalAlarmClient alarmClient;
|
||||||
|
|
||||||
|
private boolean success = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
try {
|
||||||
init();
|
init();
|
||||||
alarmClient.refreshParam();
|
success = alarmClient.refreshParam();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
success = false;
|
||||||
|
}finally {
|
||||||
destroy();
|
destroy();
|
||||||
|
context.getJobDetail().getJobDataMap().put("success",success);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.quartz.job;
|
package org.jeecg.modules.quartz.job;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
||||||
|
@ -15,23 +16,34 @@ import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
/**
|
/**
|
||||||
* 定时计算核素浓度均值
|
* 定时计算核素浓度均值
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@DisallowConcurrentExecution
|
@DisallowConcurrentExecution
|
||||||
@PersistJobDataAfterExecution
|
@PersistJobDataAfterExecution
|
||||||
public class NucliedAvgJob implements Job {
|
public class NucliedAvgJob implements Job {
|
||||||
|
|
||||||
private AbnormalAlarmClient alarmClient;
|
private AbnormalAlarmClient alarmClient;
|
||||||
|
|
||||||
|
private boolean success = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
try {
|
||||||
init();
|
init();
|
||||||
alarmClient.calculateConc();
|
success = alarmClient.calculateConc();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
success = false;
|
||||||
|
}finally {
|
||||||
destroy();
|
destroy();
|
||||||
|
context.getJobDetail().getJobDataMap().put("success",success);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
// start:生成临时Token到线程中
|
// start:生成临时Token到线程中
|
||||||
UserTokenContext.setToken(getTempToken());
|
UserTokenContext.setToken(getTempToken());
|
||||||
alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
||||||
|
throw new RuntimeException("test");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroy(){
|
private void destroy(){
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package org.jeecg.modules.quartz.job;
|
||||||
|
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.modules.base.enums.SourceType;
|
||||||
|
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
|
||||||
|
import org.quartz.*;
|
||||||
|
|
||||||
|
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此处的同步是指:当定时任务的执行时间大于任务的时间
|
||||||
|
* 间隔时会等待第一个任务执行完成才会走第二个任务
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监控项信息更新保存
|
||||||
|
*/
|
||||||
|
@DisallowConcurrentExecution
|
||||||
|
@PersistJobDataAfterExecution
|
||||||
|
public class SyncItemJob implements Job {
|
||||||
|
|
||||||
|
private AbnormalAlarmClient alarmClient;
|
||||||
|
|
||||||
|
private boolean success = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
try {
|
||||||
|
init();
|
||||||
|
success = alarmClient.syncItem(SourceType.SERVER.getType(), "172.21.60.231");
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
success = false;
|
||||||
|
}finally {
|
||||||
|
destroy();
|
||||||
|
context.getJobDetail().getJobDataMap().put("success",success);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(){
|
||||||
|
// start:生成临时Token到线程中
|
||||||
|
UserTokenContext.setToken(getTempToken());
|
||||||
|
alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void destroy(){
|
||||||
|
// end:删除临时Token
|
||||||
|
UserTokenContext.remove();
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.modules.base.dto.RuleDto;
|
import org.jeecg.modules.base.dto.RuleDto;
|
||||||
import org.quartz.*;
|
import org.quartz.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,11 +23,13 @@ public class Test implements Job {
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
init();
|
init();
|
||||||
RuleDto ruleDto = new RuleDto();
|
RuleDto ruleDto = new RuleDto();
|
||||||
ruleDto.setStationId("101");
|
ruleDto.setStationId("205");
|
||||||
ruleDto.setSampleId("424249");
|
ruleDto.setSampleId("425496");
|
||||||
ruleDto.setBetaOrGamma("Gamma");
|
ruleDto.setBetaOrGamma("Gamma");
|
||||||
ruleDto.setFullOrPrel("FULL");
|
ruleDto.setFullOrPrel("FULL");
|
||||||
ruleDto.setDataSourceType("1");
|
ruleDto.setDatasource("1");
|
||||||
|
ruleDto.setSampleName("CAX05_001-20230624_0220_Q_FULL_299.3.PHD");
|
||||||
|
ruleDto.setCollectionDate(LocalDateTime.now());
|
||||||
Map<String, String> nuclides = MapUtil.newHashMap();
|
Map<String, String> nuclides = MapUtil.newHashMap();
|
||||||
nuclides.put("Be7","1000000");
|
nuclides.put("Be7","1000000");
|
||||||
nuclides.put("sss","1000000");
|
nuclides.put("sss","1000000");
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.jeecg.modules.quartz.service;
|
package org.jeecg.modules.quartz.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public interface IQuartzJobService extends IService<QuartzJob> {
|
||||||
* @param quartzJob
|
* @param quartzJob
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void execute(QuartzJob quartzJob) throws Exception;
|
Result<?> execute(QuartzJob quartzJob) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 暂停任务
|
* 暂停任务
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package org.jeecg.modules.quartz.service.impl;
|
package org.jeecg.modules.quartz.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
import org.jeecg.common.constant.Prompt;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
import org.jeecg.common.exception.JeecgBootException;
|
||||||
import org.jeecg.common.util.DateUtils;
|
import org.jeecg.common.util.DateUtils;
|
||||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||||
|
@ -102,7 +106,7 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(QuartzJob quartzJob) throws Exception {
|
public Result<?> execute(QuartzJob quartzJob) throws Exception {
|
||||||
String jobName = quartzJob.getJobClassName().trim();
|
String jobName = quartzJob.getJobClassName().trim();
|
||||||
Date startDate = new Date();
|
Date startDate = new Date();
|
||||||
String ymd = DateUtils.date2Str(startDate,DateUtils.yyyymmddhhmmss.get());
|
String ymd = DateUtils.date2Str(startDate,DateUtils.yyyymmddhhmmss.get());
|
||||||
|
@ -117,11 +121,21 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
|
||||||
.startAt(startDate)
|
.startAt(startDate)
|
||||||
.build();
|
.build();
|
||||||
// 构建job信息
|
// 构建job信息
|
||||||
JobDetail jobDetail = JobBuilder.newJob(getClass(jobName).getClass()).withIdentity(identity).usingJobData("parameter", quartzJob.getParameter()).build();
|
JobDetail jobDetail = JobBuilder.newJob(getClass(jobName).getClass())
|
||||||
|
.withIdentity(identity)
|
||||||
|
.storeDurably()
|
||||||
|
.usingJobData("parameter", quartzJob.getParameter())
|
||||||
|
.build();
|
||||||
// 将trigger和 jobDetail 加入这个调度
|
// 将trigger和 jobDetail 加入这个调度
|
||||||
scheduler.scheduleJob(jobDetail, trigger);
|
scheduler.scheduleJob(jobDetail, trigger);
|
||||||
// 启动scheduler
|
// 启动scheduler
|
||||||
scheduler.start();
|
scheduler.start();
|
||||||
|
// 获取 JobDetail 对象
|
||||||
|
JobDetail detail = scheduler.getJobDetail(new JobKey(identity));
|
||||||
|
if (ObjectUtil.isNull(detail))
|
||||||
|
return Result.OK(Prompt.EXEC_SUCC);
|
||||||
|
boolean success = detail.getJobDataMap().getBoolean("success");
|
||||||
|
return success ? Result.OK(Prompt.EXEC_SUCC) : Result.error(Prompt.EXEC_Faild);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
|
||||||
item.setDetectorName(detectorName);
|
item.setDetectorName(detectorName);
|
||||||
}
|
}
|
||||||
if (Objects.nonNull(item.getStartTime())) {
|
if (Objects.nonNull(item.getStartTime())) {
|
||||||
long endSecond = (item.getStartTime().getTime() / 1000) + Long.valueOf(item.getTime());
|
long endSecond = (item.getStartTime().getTime() / 1000) + Math.round(item.getTime());
|
||||||
Date endDateTime = new Date();
|
Date endDateTime = new Date();
|
||||||
endDateTime.setTime(endSecond*1000);
|
endDateTime.setTime(endSecond*1000);
|
||||||
item.setEndTime(endDateTime);
|
item.setEndTime(endDateTime);
|
||||||
|
@ -162,7 +162,7 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
|
||||||
Date startT = sohDatum.getStartTime();
|
Date startT = sohDatum.getStartTime();
|
||||||
if (ObjectUtil.isNotNull(startT)) {
|
if (ObjectUtil.isNotNull(startT)) {
|
||||||
long stratSecod = startT.getTime() / 1000;
|
long stratSecod = startT.getTime() / 1000;
|
||||||
long endSecond = stratSecod + Long.valueOf(sohDatum.getTime());
|
long endSecond = stratSecod + Math.round(sohDatum.getTime());
|
||||||
Date endDateTime = new Date(endSecond * 1000);
|
Date endDateTime = new Date(endSecond * 1000);
|
||||||
sohDatum.setEndTime(endDateTime);
|
sohDatum.setEndTime(endDateTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,4 +20,4 @@ spring:
|
||||||
monitor:
|
monitor:
|
||||||
username: wmhr
|
username: wmhr
|
||||||
password: Wmhr.123
|
password: Wmhr.123
|
||||||
url: http://218.249.158.97:7008/mobile/monitor
|
url: http://123.124.245.134:7008/mobile/monitor
|
Loading…
Reference in New Issue
Block a user