feat:分析结果预警

This commit is contained in:
nieziyan 2023-08-11 18:37:07 +08:00
parent ba319f5246
commit 321e0e19bd
78 changed files with 1726 additions and 267 deletions

View File

@ -461,74 +461,53 @@ public interface CommonConstant {
*/
Integer BPM_USER_EVENT_LEVEL = 2;
/**
/**
* 用户租户状态(正常/已通过审核的)
*/
String USER_TENANT_NORMAL = "1";
String USER_TENANT_NORMAL = "1";
/**
* 用户租户状态(离职)
*/
String USER_TENANT_QUIT = "2";
String USER_TENANT_QUIT = "2";
/**
* 用户租户状态(审核中)
*/
String USER_TENANT_UNDER_REVIEW = "3";
/**
* 用户租户状态(拒绝)
*/
String USER_TENANT_REFUSE = "4";
/**
* 用户租户状态(审核中)
*/
String USER_TENANT_UNDER_REVIEW = "3";
/**
* 不是叶子节点
*/
Integer NOT_LEAF = 0;
/**
* 用户租户状态(拒绝)
*/
String USER_TENANT_REFUSE = "4";
/**
* 是叶子节点
*/
Integer IS_LEAF = 1;
/**
* 是叶子节点
*/
Integer NOT_LEAF = 0;
/**
* 是叶子节点
*/
Integer IS_LEAF = 1;
/**
* Redis Stream Key
*/
String STREAM_ALARM = "Stream:alarm";
// 启用
Integer ENABLED = 1;
/*
* Redis Stream 消费组名
*/
String GROUP_WARN_A = "Group_Warn_A";
String GROUP_WARN_B = "Group_Warn_B";
// 禁用
Integer DISENABLED = 0;
/*
* Redis Stream 消费者名
*/
String CONSUMERWARNA1 = "Consumer_Warn_A1";
String CONSUMERWARNA2 = "Consumer_Warn_A2";
String CONSUMERWARNB1 = "Consumer_Warn_B1";
// 用于生成临时token的用户名
String TEMP_TOKEN_USERNAME = "admin";
/**
* 预警规则Key前缀
*/
String PREFIX_RULE = "Rule:";
// 用于生成临时token的密码
String TEMP_TOKEN_SECRET = "cb362cfeefbf3d8d";
/*
预警规则沉默周期Key
*/
String PREFIX_SILENCE = "SilenceCycle:";
String ARMDARR = "1";
String ARMDRRR = "2";
String IDCARR = "3";
String IDCRRR = "4";
// 启用
Integer ENABLED = 1;
// 禁用
Integer DISENABLED = 0;
// 用于生成临时token的用户名
String TEMP_TOKEN_USERNAME = "admin";
// 用于生成临时token的密码
String TEMP_TOKEN_SECRET = "cb362cfeefbf3d8d";
String BETA = "Beta";
String GAMMA = "Gamma";
}

View File

@ -3,4 +3,25 @@ package org.jeecg.common.constant;
public interface RedisConstant {
String STATION_CODE_MAP = "stationMap";
String PREFIX_RULE = "Rule:";
String ANALYSIS_RULE = "Rule:Analysis:All";
/*
预警规则沉默周期Key
*/
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";
}

View File

@ -116,4 +116,9 @@ public class SymbolConstant {
*/
public static final String SQUARE_BRACKETS_RIGHT = "]";
/**
* 符号-
*/
public static final String BARRE = "-";
}

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.modules.base.dto.RuleDto;
import org.jeecg.modules.base.entity.postgre.AlarmRule;
@ -159,7 +160,7 @@ public class RedisStreamUtil {
* @param ruleDto
*/
public String pushWarn(RuleDto ruleDto){
String warnKey = CommonConstant.STREAM_ALARM;
String warnKey = RedisConstant.STREAM_ALARM;
ObjectRecord<String, RuleDto> record = StreamRecords.newRecord()
.in(warnKey).ofObject(ruleDto);
// 向Redis Stream中推送消息

View File

@ -0,0 +1,24 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
import java.util.List;
@Data
public class AnalysisLogDto extends AlarmAnalysisLog {
private String name;
private String source;
private List<String> sourceList;
private String stations;
private List<String> stationList;
private String nuclides;
private List<NuclideInfo> nuclideList;
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class ConcDto implements Serializable {
private String nuclideName;
private String conc;
private Date analysisBegin;
}

View File

@ -0,0 +1,44 @@
package org.jeecg.modules.base.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class NuclideInfo implements Serializable {
private String nuclide;
private String threshold;
private String armdarr;
private String armdrrr;
private String idcarr;
private String idcrrr;
@JsonProperty("ARMDARR")
public void setArmdarr(String armdarr) {
this.armdarr = armdarr;
}
@JsonProperty("ARMDRRR")
public void setArmdrrr(String armdrrr) {
this.armdrrr = armdrrr;
}
@JsonProperty("IDCARR")
public void setIdcarr(String idcarr) {
this.idcarr = idcarr;
}
@JsonProperty("IDCRRR")
public void setIdcrrr(String idcrrr) {
this.idcrrr = idcrrr;
}
}

View File

@ -6,13 +6,9 @@ import lombok.experimental.Accessors;
import org.jeecg.modules.base.enums.SourceType;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 预警项信息
*
* @author nieziyan
* @date 2023-06-29
*/
@Data
@AllArgsConstructor
@Accessors(chain = true)
@ -25,4 +21,19 @@ public class RuleDto implements Serializable{
// 当前值
private double value;
// 台站id
private String stationId;
// 数据源类型(ARMDARR=1|ARMDRRR=2|IDCARR=3|IDCRRR=4)
private String dataSourceType;
// 谱类型 (FULL|PREL)
private String fullOrPrel;
// 谱类型 (Gamma|Beta)
private String betaOrGamma;
// 核素名称-浓度值
private Map<String,String> nuclides;
}

View File

@ -3,8 +3,10 @@ package org.jeecg.modules.base.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@Data
public class Rule {
public class Rule implements Serializable {
private String name; // 监控项名称

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.base.entity.configuration;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@ -20,7 +21,7 @@ public class GardsStations implements Serializable {
/**
* 台站id
*/
@TableField(value = "STATION_ID")
@TableId("STATION_ID")
@NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class})
private Integer stationId;

View File

@ -0,0 +1,42 @@
package org.jeecg.modules.base.entity.postgre;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@TableName("alarm_analysis_log")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class AlarmAnalysisLog implements Serializable{
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String ruleId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date alarmStartDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "UTC+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date collectionDate;
private String alarmInfo;
private Integer sampleId;
private String nuclideInfo;
}

View File

@ -0,0 +1,36 @@
package org.jeecg.modules.base.entity.postgre;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.jeecg.common.system.base.entity.JeecgEntity;
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("alarm_analysis_nuclide_avg")
public class AlarmAnalysisNuclideAvg extends JeecgEntity {
public AlarmAnalysisNuclideAvg(String nuclide, String val) {
this.nuclide = nuclide;
this.val = val;
}
/** 核素名称 */
private String nuclide;
/** 核素浓度平均值 */
private String val;
/** 统计周期 */
private String cycle;
/** 数据源类型 */
private String dataSourceType;
// 计算时间
private LocalDate caclDate;
}

View File

@ -0,0 +1,31 @@
package org.jeecg.modules.base.entity.postgre;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@TableName("alarm_analysis_nuclide_param")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class AlarmAnalysisNuclideParam extends JeecgEntity {
// 统计天数
private Integer days;
// 计算位置
private BigDecimal index;
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.base.vo;
import lombok.Data;
import org.jeecg.common.api.QueryRequest;
import java.util.List;
@Data
public class AnalysisLogVo extends QueryRequest {
private List<String> source;
private List<String> stations;
private List<String> nuclides;
private String startDate;
private String endDate;
}

View File

@ -3,11 +3,10 @@ package org.jeecg.modules.base.vo;
import lombok.Data;
import org.jeecg.common.api.QueryRequest;
import java.io.Serializable;
import java.util.List;
@Data
public class AlarmAnalysisRuleVo extends QueryRequest{
public class AnalysisRuleVo extends QueryRequest{
private List<String> source;

View File

@ -0,0 +1,49 @@
package org.jeecg.modules.controller;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
import org.jeecg.modules.base.vo.AnalysisLogVo;
import org.jeecg.modules.service.IAlarmAnalysisLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
@Api(value = "数据分析报警日志管理" ,tags="数据分析报警日志管理")
@RestController
@RequestMapping("alarmAnalysisLog")
public class AlarmAnalysisLogController extends JeecgController<AlarmAnalysisLog, IAlarmAnalysisLogService> {
@Autowired
private IAlarmAnalysisLogService alarmAnalysisLogService;
@ApiOperation(value="报警日志分页查询", notes="报警日志分页查询")
@GetMapping(value = "findPage")
public Result<?> findPage(AnalysisLogVo analysisLogVo) {
return alarmAnalysisLogService.findPage(analysisLogVo);
}
@ApiOperation(value="添加报警日志", notes="添加报警日志")
@PostMapping(value = "add")
public Result<?> add(@RequestBody AlarmAnalysisLog alarmAnalysisLog) {
boolean success = alarmAnalysisLogService.save(alarmAnalysisLog);
if (success)
return Result.OK(Prompt.ADD_SUCC);
return Result.error(Prompt.ADD_ERR);
}
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.controller;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
@Api(value = "",tags="")
@RestController
@RequestMapping("alarmAnalysisNuclideAvg")
public class AlarmAnalysisNuclideAvgController extends JeecgController<AlarmAnalysisNuclideAvg, IAlarmAnalysisNuclideAvgService> {
@Autowired
private IAlarmAnalysisNuclideAvgService alarmAnalysisNuclideAvgService;
}

View File

@ -0,0 +1,22 @@
package org.jeecg.modules.controller;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
@Slf4j
@Api(value = "", tags= "")
@RestController
@RequestMapping("alarmAnalysisNuclideParam")
public class AlarmAnalysisNuclideParamController extends JeecgController<AlarmAnalysisNuclideParam, IAlarmAnalysisNuclideParamService> {
@Autowired
private IAlarmAnalysisNuclideParamService alarmAnalysisNuclideParamService;
}

View File

@ -1,58 +1,47 @@
package org.jeecg.modules.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.base.dto.AlarmAnalysisRuleInfo;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
import org.jeecg.modules.base.vo.AlarmAnalysisRuleVo;
import org.jeecg.modules.base.vo.AnalysisRuleVo;
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Api(value = "数据分析报警规则管理",tags="数据分析报警规则管理")
@RestController
@RequestMapping("/alarmAnalysisRule")
@RequestMapping("alarmAnalysisRule")
public class AlarmAnalysisRuleController extends JeecgController<AlarmAnalysisRule, IAlarmAnalysisRuleService> {
@Autowired
private IAlarmAnalysisRuleService alarmAnalysisRuleService;
@ApiOperation(value="分页查询报警规则", notes="分页查询报警规则")
@GetMapping(value = "/findPage")
public Result<?> findPage(AlarmAnalysisRuleVo analysisRuleVo) {
@GetMapping(value = "findPage")
public Result<?> findPage(AnalysisRuleVo analysisRuleVo) {
return alarmAnalysisRuleService.page(analysisRuleVo);
}
@ApiOperation(value="添加报警规则", notes="添加报警规则")
@PostMapping("/add")
@PostMapping("add")
public Result<?> add(@RequestBody AlarmAnalysisRule alarmAnalysisRule) {
return alarmAnalysisRuleService.add(alarmAnalysisRule);
}
@ApiOperation(value="编辑报警规则", notes="编辑报警规则")
@PutMapping("/edit")
@PutMapping("edit")
public Result<?> edit(@RequestBody AlarmAnalysisRule alarmAnalysisRule) {
return alarmAnalysisRuleService.edit(alarmAnalysisRule);
}
@ApiOperation(value="报警规则详情", notes="报警规则详情")
@GetMapping("/finInfo")
@GetMapping("finInfo")
public Result<?> findInfo(@RequestParam String id) {
return alarmAnalysisRuleService.findInfo(id);
}
@ -65,22 +54,20 @@ public class AlarmAnalysisRuleController extends JeecgController<AlarmAnalysisRu
}
@ApiOperation(value="删除报警规则", notes="删除报警规则")
@DeleteMapping(value = "/delete")
@DeleteMapping(value = "delete")
public Result<?> delete(@RequestParam String id) {
boolean success = alarmAnalysisRuleService.removeById(id);
if (success)
return Result.OK(Prompt.DELETE_SUCC);
return Result.error(Prompt.DELETE_ERR);
return alarmAnalysisRuleService.delete(id);
}
@ApiOperation(value="批量删除报警规则", notes="批量删除报警规则")
@DeleteMapping("deleteBatch")
public Result<?> deleteBatch(@RequestParam List<String> ids) {
if (CollUtil.isEmpty(ids))
return Result.error(Prompt.PARAM_NOT_EMPTY);
boolean success = alarmAnalysisRuleService.removeByIds(ids);
if (success)
return Result.OK(Prompt.DELETE_SUCC);
return Result.error(Prompt.DELETE_ERR);
return alarmAnalysisRuleService.deleteBatch(ids);
}
@ApiOperation(value="获取所有报警规则", notes="获取所有报警规则")
@GetMapping("all")
public List<AlarmAnalysisRule> allAnalysisRule() {
return alarmAnalysisRuleService.allAnalysisRule();
}
}

View File

@ -0,0 +1,25 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.modules.service.CalculateConcService;
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.RestController;
@Api(value = "定时计算核素浓度" ,tags="定时计算核素浓度")
@RestController
@RequestMapping("calculateConc")
public class CalculateConcController {
@Autowired
private CalculateConcService calculateConcService;
@GetMapping("caclAndSave")
@ApiOperation(value = "计算并保存核素浓度",notes = "计算并保存核素浓度")
public void caclAndSave(){
calculateConcService.calcAndSave();
}
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.dto.AnalysisLogDto;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
@Mapper
public interface AlarmAnalysisLogMapper extends BaseMapper<AlarmAnalysisLog> {
List<AnalysisLogDto> findPage(String startDate,String endDate);
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface AlarmAnalysisNuclideAvgMapper extends BaseMapper<AlarmAnalysisNuclideAvg> {
}

View File

@ -0,0 +1,8 @@
package org.jeecg.modules.mapper;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface AlarmAnalysisNuclideParamMapper extends BaseMapper<AlarmAnalysisNuclideParam> {
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import java.util.List;
import java.util.Map;
@Mapper
public interface GardsNuclIdedAutoMapper extends BaseMapper<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> param);
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
import java.util.List;
import java.util.Map;
@Mapper
public interface GardsNuclIdedManMapper extends BaseMapper<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> param);
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import java.util.List;
import java.util.Map;
@Mapper
public interface GardsXeResultsAutoMapper extends BaseMapper<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params);
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import java.util.List;
import java.util.Map;
@Mapper
public interface GardsXeResultsManMapper extends BaseMapper<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params);
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.AlarmAnalysisLogMapper">
<select id="findPage" resultType="org.jeecg.modules.base.dto.AnalysisLogDto">
SELECT
l.*,
r.name,
r.source,
r.stations,
r.nuclides
FROM
alarm_analysis_log l
INNER JOIN alarm_analysis_rule r ON l.rule_id = r.id
<where>
<if test="startDate != null and startDate != ''">
l.alarm_start_date &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND l.alarm_start_date &lt;= #{endDate}
</if>
</where>
ORDER BY l.alarm_start_date DESC
</select>
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.AlarmAnalysisNuclideAvgMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.AlarmAnalysisNuclideParamMapper">
</mapper>

View File

@ -12,6 +12,7 @@
r.OPERATOR,
r.source_type,
r.source_id,
r.create_time,
g.NAME AS groupName,
CASE
r.source_type
@ -40,6 +41,7 @@
<if test="pageFlag == null">
LIMIT #{pageSize} OFFSET #{pageStart}
</if>
ORDER BY enabled DESC, create_time DESC
</select>
<select id="findInfo" parameterType="String" resultType="org.jeecg.modules.base.dto.AlarmRuleInfo">

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedAutoMapper">
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
SELECT
xe.NUCLIDE_NAME,
xe.CONC,
ana.ANALYSISBEGIN
FROM
RNAUTO.GARDS_XE_RESULTS xe
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
<where>
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
<if test="nuclideName != null and nuclideName.size() > 0">
AND xe.NUCLIDE_NAME IN
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsNuclIdedManMapper">
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
SELECT
xe.NUCLIDE_NAME,
xe.CONC,
ana.ANALYSISBEGIN
FROM
RNMAN.GARDS_XE_RESULTS xe
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = xe.IDANALYSIS
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = xe.SAMPLE_ID
<where>
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
<if test="nuclideName != null and nuclideName.size() > 0">
AND xe.NUCLIDE_NAME IN
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsAutoMapper">
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
SELECT
nucl.NUCLIDENAME,
nucl.CONCENTRATION AS CONC,
ana.ANALYSISBEGIN
FROM
RNAUTO.GARDS_NUCL_IDED nucl
INNER JOIN RNAUTO.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
<where>
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
<if test="nuclideName != null and nuclideName.size() > 0">
AND nucl.NUCLIDENAME IN
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsXeResultsManMapper">
<select id="getConc" resultType="org.jeecg.modules.base.dto.ConcDto">
SELECT
nucl.NUCLIDENAME,
nucl.CONCENTRATION AS CONC,
ana.ANALYSISBEGIN
FROM
RNMAN.GARDS_NUCL_IDED nucl
INNER JOIN RNMAN.GARDS_ANALYSES ana ON ana.IDANALYSIS = nucl.IDANALYSIS
INNER JOIN ORIGINAL.GARDS_SAMPLE_DATA samp ON samp.SAMPLE_ID = nucl.SAMPLE_ID
<where>
ana.ANALYSISBEGIN BETWEEN to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss')
AND to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')
<if test="nuclideName != null and nuclideName.size() > 0">
AND nucl.NUCLIDENAME IN
<foreach collection="nuclideName" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -7,14 +7,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.base.dto.RuleDto;
import org.jeecg.modules.base.entity.Rule;
import org.jeecg.modules.base.entity.postgre.AlarmRule;
import org.jeecg.modules.message.SendMessage;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.stream.StreamListener;
@ -28,17 +27,15 @@ import static org.jeecg.modules.base.enums.Op.*;
@Slf4j
@Component
@NoArgsConstructor
public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, RuleDto>> {
public class AlarmConsumer implements StreamListener<String, ObjectRecord<String, RuleDto>> {
private String groupName;
private String consumerName;
private SendMessage sendMessage;
private RedisStreamUtil redisStreamUtil;
public ConsumeA1(String groupName, String consumerName) {
public AlarmConsumer(String groupName, String consumerName) {
this.groupName = groupName;
this.consumerName = consumerName;
}
@ -53,8 +50,9 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
* 新消息在未进行ACK之前,状态也为pending,
* 直接消费所有异常未确认的消息和新消息
*/
List<ObjectRecord<String, RuleDto>> pendingList = redisStreamUtil.read(streamKey, groupName, consumerName);
for (ObjectRecord<String, RuleDto> record : pendingList) {
List<ObjectRecord<String, RuleDto>> pendings = redisStreamUtil
.read(streamKey, groupName, consumerName);
for (ObjectRecord<String, RuleDto> record : pendings) {
RecordId recordId = record.getId();
RuleDto ruleDto = record.getValue();
// 消费消息
@ -66,10 +64,9 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
redisStreamUtil.del(streamKey, recordId.getValue());
}
}catch (JsonProcessingException e) {
log.error("消费者[{}]消费异常,报警规则解析失败!",consumerName);
log.error("Alarm Rule Resolution Failed!");
e.printStackTrace();
}catch (RuntimeException e){
log.error("消费者[{}]消费异常,请及时排查原因!",consumerName);
e.printStackTrace();
}
}
@ -84,7 +81,7 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
? "" : ruleDto.getSourceType().getType();
int itemId = ruleDto.getItemId();
String underline = SymbolConstant.UNDERLINE;
String prefix = CommonConstant.PREFIX_RULE;
String prefix = RedisConstant.PREFIX_RULE;
String key = prefix + sourceType + underline + itemId;
Boolean hasKey = redisStreamUtil.hasKey(key);
if (!hasKey) return;
@ -136,7 +133,6 @@ public class ConsumeA1 implements StreamListener<String, ObjectRecord<String, Ru
}
private void init(){
sendMessage = SpringContextUtils.getBean(SendMessage.class);
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
}
}

View File

@ -0,0 +1,215 @@
package org.jeecg.modules.redisStream;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.base.dto.NuclideInfo;
import org.jeecg.modules.base.dto.RuleDto;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
import org.jeecg.modules.service.AnalysisResultService;
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
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.RecordId;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Data
@Slf4j
@Component
@NoArgsConstructor
public class AnalysisConsumer implements StreamListener<String, ObjectRecord<String, RuleDto>> {
private String groupName;
private String consumerName;
private RedisStreamUtil redisStreamUtil;
private IAlarmAnalysisRuleService ruleService;
private AnalysisResultService analysisResultService;
private IAlarmAnalysisNuclideAvgService nuclideAvgService;
private final String comma = SymbolConstant.COMMA;
public AnalysisConsumer(String groupName, String consumerName) {
this.groupName = groupName;
this.consumerName = consumerName;
}
@Override
public void onMessage(ObjectRecord<String, RuleDto> message) {
/* 避免消费抛出异常后,取消此消费者的消费资格 */
try {
String streamKey = message.getStream();
init();
/**
* 新消息在未进行ACK之前,状态也为pending,
* 直接消费所有异常未确认的消息和新消息
*/
List<ObjectRecord<String, RuleDto>> pendings = redisStreamUtil
.read(streamKey, groupName, consumerName);
for (ObjectRecord<String, RuleDto> record : pendings) {
RecordId recordId = record.getId();
RuleDto ruleDto = record.getValue();
// 消费消息
consume(ruleDto);
// 消费完成后,手动确认消费消息[消息消费成功]
// 否则就是消费抛出异常,进入pending_ids[消息消费失败]
redisStreamUtil.ack(streamKey, groupName, recordId.getValue());
// 手动删除已消费消息
redisStreamUtil.del(streamKey, recordId.getValue());
}
}catch (RuntimeException e){
e.printStackTrace();
}
}
private void consume(RuleDto ruleDto){
String stationId = ruleDto.getStationId();
Map<String, String> nuclides = ruleDto.getNuclides();
if (StrUtil.isBlank(stationId)) return;
if (MapUtil.isEmpty(nuclides)) return;
List<AlarmAnalysisRule> rules = ruleService.allAnalysisRule();
for (AlarmAnalysisRule rule : rules) {
String conditionStr = rule.getConditions();
if (StrUtil.isBlank(conditionStr)) continue;
String stations = rule.getStations();
boolean shot = StrUtil.contains(stations, stationId);
if (!shot) continue;
Set<String> names = nuclides.keySet();
String nuclidesStr = rule.getNuclides();
if (StrUtil.isBlank(nuclidesStr)) continue;
List<String> follow = ListUtil.toList(nuclidesStr.split(comma));
// 推送过来的核素集合与所关注核素集合取交集
Collection<String> cross = CollectionUtil.intersection(names, follow);
if (CollUtil.isEmpty(cross)) continue;
Map<String, String> nuclidesCross = nuclides.entrySet().stream()
.filter(entry -> cross.contains(entry.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
// 开始对交集中的核素进行条件判断
List<String> conditions = ListUtil.toList(conditionStr.split(comma));
}
}
private void judge(String betaOrGamma,
String dataSourceType,
List<String> conditions,
Map<String,String> nuclides){
String ONE = "1";String TWO = "2";String THREE = "3";
Set<String> nuclideNames = nuclides.keySet();
List<String> firstDetected;
List<NuclideInfo> moreThanAvg;
List<String> twoOrMore;
for (String con : conditions) {
if (ONE.equals(con)){ // 首次发现该元素
firstDetected = firstDetected(betaOrGamma,dataSourceType,nuclideNames);
if (CollUtil.isNotEmpty(firstDetected)){
String message = "核素:["+StrUtil.join(comma,firstDetected)+"]首次发现";
}
} else if (TWO.equals(con)) { // 元素浓度高于均值
moreThanAvg = moreThanAvg(dataSourceType,nuclides);
if (CollUtil.isNotEmpty(moreThanAvg)){
}
} else if (THREE.equals(con)) { // 发现两种及以上核素
twoOrMore = twoOrMore(betaOrGamma,dataSourceType,nuclideNames);
if (twoOrMore.size() >= 2){
String message = "同时检测到核素:["+StrUtil.join(comma,twoOrMore)+"]";
}
}
}
}
/**
* 首次发现该核素
*/
private List<String> firstDetected(String betaOrGamma,
String dataSourceType,
Set<String> nuclideNames){
Set<String> existNames = analysisResultService
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
// 两个集合元素相减
List<String> differ = CollUtil.subtractToList(nuclideNames, existNames);
return differ;
}
/**
* 核素值大于历史浓度均值
*/
private List<NuclideInfo> moreThanAvg(String dataSourceType,
Map<String,String> nuclides){
List<NuclideInfo> nuclideInfos = new ArrayList<>();
Set<String> nuclideNames = nuclides.keySet();
Map<String, String> nuclideAvgs = nuclideAvgService
.list(nuclideNames, dataSourceType).stream()
.collect(Collectors.toMap(AlarmAnalysisNuclideAvg::getNuclide,
AlarmAnalysisNuclideAvg::getVal));
for (Map.Entry<String, String> nuclide : nuclides.entrySet()) {
String nuclideName = nuclide.getKey();
String concValue = nuclide.getValue();// 浓度值
String avgValue = nuclideAvgs.get(nuclideName);// 浓度均值
if (StrUtil.isBlank(concValue) || StrUtil.isBlank(avgValue))
continue;
if (!NumberUtil.isNumber(concValue) || !NumberUtil.isNumber(avgValue))
continue;
BigDecimal conc = new BigDecimal(concValue);
BigDecimal avg = new BigDecimal(avgValue);
// 如果核素浓度值小于均值,继续判断下一个核素
if (NumberUtil.isLessOrEqual(conc, avg))
continue;
NuclideInfo nuclideInfo = new NuclideInfo();
nuclideInfo.setNuclide(nuclideName);
nuclideInfo.setThreshold(avgValue);
if (CommonConstant.ARMDARR.equals(dataSourceType)){
nuclideInfo.setArmdarr(concValue);
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
nuclideInfo.setArmdrrr(concValue);
}
nuclideInfos.add(nuclideInfo);
}
return nuclideInfos;
}
/**
* 同时检测到两种或以上核素
*/
private List<String> twoOrMore(String betaOrGamma,
String dataSourceType,
Set<String> nuclideNames){
Set<String> existNames = analysisResultService
.nuclideNames(betaOrGamma, dataSourceType, nuclideNames);
return ListUtil.toList(existNames);
}
private void init() {
redisStreamUtil = SpringContextUtils.getBean(RedisStreamUtil.class);
ruleService = SpringContextUtils.getBean(IAlarmAnalysisRuleService.class);
analysisResultService = SpringContextUtils.getBean(AnalysisResultService.class);
nuclideAvgService = SpringContextUtils.getBean(IAlarmAnalysisNuclideAvgService.class);
}
}

View File

@ -2,7 +2,7 @@ package org.jeecg.modules.redisStream;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.exception.StreamErrorHandler;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.modules.base.dto.RuleDto;
@ -32,14 +32,13 @@ public class RedisStreamConfig {
// 每次轮询取几条消息
private final Integer maxMsg = 10;
// Stream Key
private final String warnKey = CommonConstant.STREAM_ALARM;
private final String alarmKey = RedisConstant.STREAM_ALARM;
private final String alarmGroup = RedisConstant.GROUP_ALARM;
private final String alarmConsumer = RedisConstant.CONSUMER_ALARM;
// 消费组名
private final String groupWarnA = CommonConstant.GROUP_WARN_A;
// 消费者名
private final String consumerWarnA1 = CommonConstant.CONSUMERWARNA1;
private final String analysisKey = RedisConstant.STREAM_ANALYSIS;
private final String analysisGroup = RedisConstant.GROUP_ANALYSIS;
private final String analysisConsumer = RedisConstant.CONSUMER_ANALYSIS;
@Resource
private RedisConnectionFactory redisConnectionFactory;
@ -48,9 +47,10 @@ public class RedisStreamConfig {
private RedisStreamUtil redisStreamUtil;
@Bean(initMethod = "start", destroyMethod = "stop")
public StreamMessageListenerContainer<String, ObjectRecord<String, RuleDto>> streamMessageListenerContainer() {
/* 创建Stream和消费组A */
creatGroup(warnKey, groupWarnA);
public StreamMessageListenerContainer<String, ObjectRecord<String, RuleDto>> alarmStream() {
/* 创建Stream和消费组 */
creatGroup(alarmKey, alarmGroup);
creatGroup(analysisKey, analysisGroup);
// 原子整数,多线程环境下对整数的原子性操作
AtomicInteger index = new AtomicInteger(1);
// 返回当前系统可用的处理器数量
@ -70,7 +70,7 @@ public class RedisStreamConfig {
new LinkedBlockingDeque<>(),
r -> {
Thread thread = new Thread(r);
thread.setName("Thread-Stream-Consumer-" + index.getAndIncrement());
thread.setName("Stream-Thread-" + index.getAndIncrement());
thread.setDaemon(true);
return thread;
});
@ -118,18 +118,16 @@ public class RedisStreamConfig {
.build();
ConsumeA1 consumeA1 = new ConsumeA1(groupWarnA, consumerWarnA1);
streamMessageListenerContainer.register(readA1, consumeA1);*/
ConsumeA1 consumeA1 = new ConsumeA1(groupWarnA, consumerWarnA1);
streamMessageListenerContainer.receive(Consumer.from(groupWarnA, consumerWarnA1),
StreamOffset.create(warnKey, ReadOffset.lastConsumed()), consumeA1);
AlarmConsumer alarm = new AlarmConsumer(alarmGroup, alarmConsumer);
streamMessageListenerContainer.receive(Consumer.from(alarmGroup, alarmConsumer),
StreamOffset.create(alarmKey, ReadOffset.lastConsumed()), alarm);
AnalysisConsumer analysis = new AnalysisConsumer(analysisGroup,analysisConsumer);
streamMessageListenerContainer.receive(Consumer.from(analysisGroup, analysisConsumer),
StreamOffset.create(analysisKey, ReadOffset.lastConsumed()), analysis);
// 创建消费组A中的消费者A2,自动ACK
/* ConsumeA2 consumeA2 = new ConsumeA2(consumerWarnA2);
streamMessageListenerContainer.receiveAutoAck(Consumer.from(groupWarnA, consumerWarnA2),
StreamOffset.create(warnKey, ReadOffset.lastConsumed()), consumeA2);*/
// 注册消费组B中的消费者B1,自动ACK
/*streamMessageListenerContainer.receiveAutoAck(Consumer.from(groupWarnB, consumerWarnB1),
StreamOffset.create(warnKey, ReadOffset.lastConsumed()), new ConsumeListenerB());*/
return streamMessageListenerContainer;
}

View File

@ -0,0 +1,10 @@
package org.jeecg.modules.service;
import java.util.Set;
public interface AnalysisResultService {
Set<String> nuclideNames(String betaOrGamma,
String dataSourceType,
Set<String> nuclideNames);
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.service;
import org.jeecg.modules.base.dto.ConcDto;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface CalculateConcService {
void calcAndSave();
Map<String,String> calculate(List<ConcDto> concDtos, BigDecimal index);
}

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
import org.jeecg.modules.base.vo.AnalysisLogVo;
public interface IAlarmAnalysisLogService extends IService<AlarmAnalysisLog> {
Result findPage(AnalysisLogVo analysisLogVo);
}

View File

@ -0,0 +1,12 @@
package org.jeecg.modules.service;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Set;
public interface IAlarmAnalysisNuclideAvgService extends IService<AlarmAnalysisNuclideAvg> {
List<AlarmAnalysisNuclideAvg> list(Set<String> nuclideNames,String dataSourceType);
}

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.service;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
import com.baomidou.mybatisplus.extension.service.IService;
public interface IAlarmAnalysisNuclideParamService extends IService<AlarmAnalysisNuclideParam> {
AlarmAnalysisNuclideParam getLatest();
boolean refresh();
}

View File

@ -2,15 +2,14 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.dto.AlarmAnalysisRuleDto;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
import org.jeecg.modules.base.vo.AlarmAnalysisRuleVo;
import org.jeecg.modules.base.vo.AnalysisRuleVo;
import java.util.List;
public interface IAlarmAnalysisRuleService extends IService<AlarmAnalysisRule> {
Result page(AlarmAnalysisRuleVo analysisRuleVo);
Result page(AnalysisRuleVo analysisRuleVo);
Result add(AlarmAnalysisRule alarmAnalysisRule);
@ -21,4 +20,10 @@ public interface IAlarmAnalysisRuleService extends IService<AlarmAnalysisRule> {
AlarmAnalysisRule getByName(String name);
Result updateStatus(String id, Integer enabled);
Result delete(String id);
Result deleteBatch(List<String> ids);
List<AlarmAnalysisRule> allAnalysisRule();
}

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface IGardsNuclIdedAutoService extends IService<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> params);
Set<String> nuclideNames(Set<String> nuclideNames);
}

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface IGardsNuclIdedManService extends IService<GardsNuclIded> {
List<ConcDto> getConc(Map<String,Object> params);
Set<String> nuclideNames(Set<String> nuclideNames);
}

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface IGardsXeResultsAutoService extends IService<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params);
Set<String> nuclideNames(Set<String> nuclideNames);
}

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface IGardsXeResultsManService extends IService<GardsXeResults> {
List<ConcDto> getConc(Map<String,Object> params);
Set<String> nuclideNames(Set<String> nuclideNames);
}

View File

@ -0,0 +1,127 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.DictConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.base.dto.AlarmAnalysisRuleDto;
import org.jeecg.modules.base.dto.AnalysisLogDto;
import org.jeecg.modules.base.dto.NuclideInfo;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisLog;
import org.jeecg.modules.base.vo.AnalysisLogVo;
import org.jeecg.modules.feignclient.SystemClient;
import org.jeecg.modules.mapper.AlarmAnalysisLogMapper;
import org.jeecg.modules.service.IAlarmAnalysisLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class AlarmAnalysisLogServiceImpl extends ServiceImpl<AlarmAnalysisLogMapper, AlarmAnalysisLog> implements IAlarmAnalysisLogService {
@Autowired
private SystemClient systemClient;
@Override
public Result findPage(AnalysisLogVo analysisLogVo) {
String startDate = analysisLogVo.getStartDate();
String endDate = analysisLogVo.getEndDate();
if (StrUtil.isNotBlank(startDate))
startDate += DateConstant.TIME_START;
if (StrUtil.isNotBlank(endDate))
endDate += DateConstant.TIME_END;
List<AnalysisLogDto> result = baseMapper.findPage(startDate, endDate);
List<String> source = analysisLogVo.getSource();
List<String> stations = analysisLogVo.getStations();
List<String> nuclides = analysisLogVo.getNuclides();
String comma = SymbolConstant.COMMA;
// 条件过滤
if (CollUtil.isNotEmpty(source)){
result = result.stream().filter(item -> {
List<String> sourceIds = ListUtil
.toList(item.getSource().split(comma));
return CollUtil.containsAny(sourceIds,source);
}).collect(Collectors.toList());
}
if (CollUtil.isNotEmpty(stations)){
result = result.stream().filter(item -> {
List<String> stationIds = ListUtil
.toList(item.getStations().split(comma));
return CollUtil.containsAny(stationIds,stations);
}).collect(Collectors.toList());
}
if (CollUtil.isNotEmpty(nuclides)){
result = result.stream().filter(item -> {
List<String> nuclideList = ListUtil
.toList(item.getNuclides().split(comma));
return CollUtil.containsAny(nuclideList,nuclides);
}).collect(Collectors.toList());
}
// 数据字典
List<DictModel> sourceDict = systemClient.getItems(DictConstant.ANALYSE_SOURCE);
// 封装Source和Station
for (AnalysisLogDto logDto : result) {
// 数据源
String sources = logDto.getSource();
List<String> sourceList = getShow(sourceDict, sources);
logDto.setSourceList(sourceList);
// 台站
String stationIds = logDto.getStations();
if (StrUtil.isNotBlank(stationIds)){
List<String> stationList = systemClient.stationCodes(stationIds);
logDto.setStationList(stationList);
}
// 将nuclide的json串转换为对象集合
String nuclideInfo = logDto.getNuclideInfo();
if (StrUtil.isNotBlank(nuclideInfo)){
try {
ObjectMapper mapper = new ObjectMapper();
List<NuclideInfo> nuclideInfos = mapper.readValue(nuclideInfo,
new TypeReference<List<NuclideInfo>>() {
});
logDto.setNuclideList(nuclideInfos);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
}
// 封装分页
Integer pageNo = analysisLogVo.getPageNo();
Integer pageSize = analysisLogVo.getPageSize();
int total = result.size();
int start = (pageNo - 1) * pageSize;
int end = Math.min(start + pageSize, total);
List<AnalysisLogDto> records = result.subList(start,end);
Page<AnalysisLogDto> page = new Page<>(pageNo,pageSize,total);
page.setRecords(records);
return Result.OK(page);
}
private List<String> getShow(List<DictModel> dictModels,String dict){
List<String> show = new ArrayList<>();
if (StrUtil.isBlank(dict))
return null;
List<String> dictList = ListUtil.toList(dict.split(SymbolConstant.COMMA));
Map<String, String> dictMap = dictModels.stream().collect(Collectors
.toMap(DictModel::getValue, DictModel::getText, (oldValue, newValue) -> newValue));
for (String key : dictList) {
show.add(dictMap.get(key));
}
return show;
}
}

View File

@ -0,0 +1,27 @@
package org.jeecg.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
import org.jeecg.modules.mapper.AlarmAnalysisNuclideAvgMapper;
import org.jeecg.modules.service.IAlarmAnalysisNuclideAvgService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
@Service
public class AlarmAnalysisNuclideAvgServiceImpl extends ServiceImpl<AlarmAnalysisNuclideAvgMapper, AlarmAnalysisNuclideAvg> implements IAlarmAnalysisNuclideAvgService {
@Override
public List<AlarmAnalysisNuclideAvg> list(Set<String> nuclideNames,String dataSourceType) {
LocalDate dayAgo = LocalDate.now().minusDays(1);
LambdaQueryWrapper<AlarmAnalysisNuclideAvg> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AlarmAnalysisNuclideAvg::getDataSourceType,dataSourceType);
wrapper.eq(AlarmAnalysisNuclideAvg::getCaclDate,dayAgo);
wrapper.in(AlarmAnalysisNuclideAvg::getNuclide,nuclideNames);
return list(wrapper);
}
}

View File

@ -0,0 +1,31 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
import org.jeecg.modules.mapper.AlarmAnalysisNuclideParamMapper;
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class AlarmAnalysisNuclideParamServiceImpl extends ServiceImpl<AlarmAnalysisNuclideParamMapper, AlarmAnalysisNuclideParam> implements IAlarmAnalysisNuclideParamService {
@Override
public AlarmAnalysisNuclideParam getLatest() {
LambdaQueryWrapper<AlarmAnalysisNuclideParam> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(AlarmAnalysisNuclideParam::getCreateTime).last("LIMIT 1");
return getOne(wrapper);
}
@Override
public boolean refresh() {
AlarmAnalysisNuclideParam nuclideParam = new AlarmAnalysisNuclideParam();
CopyOptions options = CopyOptions.create()
.setIgnoreProperties("id","create_time");
BeanUtil.copyProperties(getLatest(),nuclideParam,options);
return save(nuclideParam);
}
}

View File

@ -9,25 +9,24 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.DictConstant;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.constant.*;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.dto.AlarmAnalysisRuleDto;
import org.jeecg.modules.base.dto.AlarmAnalysisRuleInfo;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
import org.jeecg.modules.base.entity.postgre.AlarmRule;
import org.jeecg.modules.base.vo.AlarmAnalysisRuleVo;
import org.jeecg.modules.base.vo.AnalysisRuleVo;
import org.jeecg.modules.entity.AlarmContactGroupAbnormal;
import org.jeecg.modules.feignclient.SystemClient;
import org.jeecg.modules.mapper.AlarmAnalysisRuleMapper;
import org.jeecg.modules.service.IAlarmAnalysisRuleService;
import org.jeecg.modules.service.IAlarmContactGroupService;
import org.jeecg.modules.service.IGardsNuclLibService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -36,6 +35,9 @@ import java.util.stream.Collectors;
@Service
public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleMapper, AlarmAnalysisRule> implements IAlarmAnalysisRuleService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private SystemClient systemClient;
@ -43,13 +45,17 @@ public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleM
private IAlarmContactGroupService alarmContactGroupService;
@Override
public Result page(AlarmAnalysisRuleVo analysisRuleVo) {
public Result page(AnalysisRuleVo analysisRuleVo) {
Integer pageNo = analysisRuleVo.getPageNo();
Integer pageSize = analysisRuleVo.getPageSize();
List<String> source = analysisRuleVo.getSource();
List<String> stations = analysisRuleVo.getStations();
List<String> nuclide = analysisRuleVo.getNuclides();
List<AlarmAnalysisRule> result = list();
// 根据enabled和create_time进行降序排序
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(AlarmAnalysisRule::getEnabled);
wrapper.orderByDesc(AlarmAnalysisRule::getCreateTime);
List<AlarmAnalysisRule> result = list(wrapper);
String comma = SymbolConstant.COMMA;
// 条件过滤
if (CollUtil.isNotEmpty(source)){
@ -135,8 +141,10 @@ public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleM
if (ObjectUtil.isNotNull(getByName(name)))
return Result.error("Rule Name" + Prompt.NOT_REPEAT);
boolean success = save(alarmAnalysisRule);
if (success)
if (success){
rule2Redis();
return Result.OK(Prompt.ADD_SUCC);
}
return Result.error(Prompt.ADD_ERR);
}
@ -150,8 +158,10 @@ public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleM
return Result.error("Rule Name" + Prompt.NOT_REPEAT);
}
boolean success = updateById(alarmAnalysisRule);
if (success)
if (success){
rule2Redis();
return Result.OK(Prompt.UPDATE_SUCC);
}
return Result.error(Prompt.UPDATE_ERR);
}
@ -192,11 +202,50 @@ public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleM
AlarmAnalysisRule analysisRule = new AlarmAnalysisRule();
analysisRule.setId(id);
analysisRule.setEnabled(enabled);
if (updateById(analysisRule))
if (updateById(analysisRule)){
rule2Redis();
return Result.OK(Prompt.UPDATE_SUCC);
}
return Result.error(Prompt.UPDATE_ERR);
}
@Override
public Result delete(String id) {
boolean success = removeById(id);
if (success){
rule2Redis();
return Result.OK(Prompt.DELETE_SUCC);
}
return Result.error(Prompt.DELETE_ERR);
}
@Override
public Result deleteBatch(List<String> ids) {
if (CollUtil.isEmpty(ids))
return Result.error(Prompt.PARAM_NOT_EMPTY);
boolean success = removeByIds(ids);
if (success){
rule2Redis();
return Result.OK(Prompt.DELETE_SUCC);
}
return Result.error(Prompt.DELETE_ERR);
}
@Override
public List<AlarmAnalysisRule> allAnalysisRule() {
String key = RedisConstant.ANALYSIS_RULE;
List<AlarmAnalysisRule> all;
if (redisUtil.hasKey(key)){
all = (List<AlarmAnalysisRule>)redisUtil.get(key);
}else {
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AlarmAnalysisRule::getEnabled,CommonConstant.ENABLED);
all = list(wrapper);
redisUtil.set(key,all);
}
return all;
}
private List<String> getShow(List<DictModel> dictModels,String dict){
List<String> show = new ArrayList<>();
if (StrUtil.isBlank(dict))
@ -209,4 +258,13 @@ public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleM
}
return show;
}
@PostConstruct
private void rule2Redis(){
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AlarmAnalysisRule::getEnabled,CommonConstant.ENABLED);
List<AlarmAnalysisRule> analysisRules = list(wrapper);
String key = RedisConstant.ANALYSIS_RULE;
redisUtil.set(key,analysisRules);
}
}

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.modules.base.dto.AlarmRuleDto;
@ -140,8 +141,8 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
@PostConstruct
public void rule2Redis(){
String colon = SymbolConstant.COLON;
String prefixRule = CommonConstant.PREFIX_RULE;
String prefixSilence = CommonConstant.PREFIX_SILENCE;
String prefixRule = RedisConstant.PREFIX_RULE;
String prefixSilence = RedisConstant.PREFIX_SILENCE;
LambdaQueryWrapper<AlarmRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AlarmRule::getEnabled,1);
List<AlarmRule> alarmRules = this.list(wrapper);

View File

@ -0,0 +1,48 @@
package org.jeecg.modules.service.impl;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Set;
@Service
public class AnalysisResultServiceImpl implements AnalysisResultService {
@Autowired
private IGardsNuclIdedAutoService nuclIdedAutoService; // Auto Gamma
@Autowired
private IGardsXeResultsAutoService xeResultsAutoService; // Auto Beta
@Autowired
private IGardsNuclIdedManService nuclIdedManService; // Man Gamma
@Autowired
private IGardsXeResultsManService xeResultsManService; // Man Gamma
@Override
public Set<String> nuclideNames(String betaOrGamma, String dataSourceType, Set<String> nuclideNames) {
if (CommonConstant.ARMDARR.equals(dataSourceType)){
if (CommonConstant.BETA.equals(betaOrGamma)){
return xeResultsAutoService.nuclideNames(nuclideNames);
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
return nuclIdedAutoService.nuclideNames(nuclideNames);
}else {
return nuclideNames;
}
} else if (CommonConstant.ARMDRRR.equals(dataSourceType)) {
if (CommonConstant.BETA.equals(betaOrGamma)){
return xeResultsManService.nuclideNames(nuclideNames);
}else if (CommonConstant.GAMMA.equals(betaOrGamma)){
return nuclIdedManService.nuclideNames(nuclideNames);
}else {
return nuclideNames;
}
}else {
return nuclideNames;
}
}
}

View File

@ -0,0 +1,121 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideAvg;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisNuclideParam;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
import org.jeecg.modules.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class CalculateConcServiceImpl implements CalculateConcService {
@Autowired
private IGardsNuclIdedAutoService nuclIdedAutoService;
@Autowired
private IGardsNuclIdedManService nuclIdedManService;
@Autowired
private IGardsXeResultsAutoService xeResultsAutoService;
@Autowired
private IGardsXeResultsManService xeResultsManService;
@Autowired
private IAlarmAnalysisRuleService analysisRuleService;
@Autowired
private IAlarmAnalysisNuclideAvgService nuclideAvgService;
@Autowired
private IAlarmAnalysisNuclideParamService nuclideParamService;
@Override
public void calcAndSave() {
String comma = SymbolConstant.COMMA;
List<AlarmAnalysisRule> analysisRules = analysisRuleService.allAnalysisRule();
Set<String> nuclideNames = analysisRules.stream()
.filter(rule -> StrUtil.isNotBlank(rule.getNuclides()))
.map(AlarmAnalysisRule::getNuclides)
.flatMap(nuclides -> ListUtil.toList(nuclides.split(comma)).stream())
.collect(Collectors.toSet());
Map<String,Object> params = new HashMap<>();
params.put("nuclideName",nuclideNames);
AlarmAnalysisNuclideParam paramLatest = nuclideParamService.getLatest();
BigDecimal index = paramLatest.getIndex();
Integer days = paramLatest.getDays();
LocalDate dayAgo = LocalDate.now().minusDays(1);
LocalDate daysAgo = dayAgo.minusDays(days);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateConstant.DATE);
String startDate = daysAgo.format(formatter);
String endDate = dayAgo.format(formatter);
params.put("startDate",startDate + DateConstant.TIME_START);
params.put("endDate",endDate + DateConstant.TIME_END);
/* Auto自动处理 */
// beta-gamma
List<ConcDto> xeConcAuto = xeResultsAutoService.getConc(params);
// gamma
List<ConcDto> nuclConcAuto = nuclIdedAutoService.getConc(params);
Map<String,String> autoResult = new HashMap<>();
autoResult.putAll(calculate(xeConcAuto,index));
autoResult.putAll(calculate(nuclConcAuto,index));
List<AlarmAnalysisNuclideAvg> autoAvgs = autoResult.entrySet().stream()
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
.collect(Collectors.toList());
autoAvgs.forEach(item -> item.setDataSourceType(CommonConstant.ARMDARR));
/* Man人工交互 */
// beta-gamma
List<ConcDto> xeConcMan = xeResultsManService.getConc(params);
// gamma
List<ConcDto> nuclConcMan = nuclIdedManService.getConc(params);
Map<String,String> manResult = new HashMap<>();
manResult.putAll(calculate(xeConcMan,index));
manResult.putAll(calculate(nuclConcMan,index));
List<AlarmAnalysisNuclideAvg> manAvgs = manResult.entrySet().stream()
.map(entry -> new AlarmAnalysisNuclideAvg(entry.getKey(), entry.getValue()))
.collect(Collectors.toList());
manAvgs.forEach(item -> item.setDataSourceType(CommonConstant.ARMDRRR));
manAvgs.addAll(autoAvgs);
String cycle = startDate + SymbolConstant.WELL_NUMBER + endDate;
manAvgs.forEach(item -> item.setCycle(cycle).setCaclDate(dayAgo));
nuclideAvgService.saveBatch(manAvgs);
}
@Override
public Map<String, String> calculate(List<ConcDto> concDtos, BigDecimal index) {
Map<String,String> result = new HashMap<>();
// 按照核素名进行分组
Map<String, List<ConcDto>> concDtoMap = concDtos.stream()
.collect(Collectors.groupingBy(ConcDto::getNuclideName));
// 对每个核素进行计算
for (Map.Entry<String, List<ConcDto>> entry : concDtoMap.entrySet()) {
String nuclide = entry.getKey();
// 核素的感兴趣浓度值列表,根据分析时间升序排列
List<ConcDto> values = entry.getValue().stream()
.sorted(Comparator.comparing(ConcDto::getAnalysisBegin))
.collect(Collectors.toList());
if (CollUtil.isEmpty(values)) continue;
int baseLine = values.size();
BigDecimal line = new BigDecimal(baseLine);
int i = line.multiply(index).setScale(0, RoundingMode.HALF_UP).intValue();
int j = Math.max(i - 1, 0);
result.put(nuclide,values.get(j).getConc());
}
return result;
}
}

View File

@ -0,0 +1,40 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnauto.GardsNuclIded;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import org.jeecg.modules.mapper.GardsNuclIdedAutoMapper;
import org.jeecg.modules.service.IGardsNuclIdedAutoService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@DS("ora")
public class GardsNuclIdedAutoServiceImpl extends ServiceImpl<GardsNuclIdedAutoMapper, GardsNuclIded> implements IGardsNuclIdedAutoService {
@Override
public List<ConcDto> getConc(Map<String, Object> params) {
return baseMapper.getConc(params);
}
@Override
public Set<String> nuclideNames(Set<String> nuclideNames) {
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
wrapper.in(GardsNuclIded::getNuclideName,nuclideNames);
Set<String> result = list(wrapper).stream()
.map(GardsNuclIded::getNuclideName)
.collect(Collectors.toSet());
return result;
}
}

View File

@ -0,0 +1,39 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import org.jeecg.modules.base.entity.rnman.GardsNuclIded;
import org.jeecg.modules.mapper.GardsNuclIdedManMapper;
import org.jeecg.modules.service.IGardsNuclIdedManService;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@DS("ora")
public class GardsNuclIdedManServiceImpl extends ServiceImpl<GardsNuclIdedManMapper, GardsNuclIded> implements IGardsNuclIdedManService {
@Override
public List<ConcDto> getConc(Map<String, Object> params) {
return baseMapper.getConc(params);
}
@Override
public Set<String> nuclideNames(Set<String> nuclideNames) {
LambdaQueryWrapper<GardsNuclIded> wrapper = new LambdaQueryWrapper<>();
wrapper.in(GardsNuclIded::getNuclideName,nuclideNames);
Set<String> result = list(wrapper).stream()
.map(GardsNuclIded::getNuclideName)
.collect(Collectors.toSet());
return result;
}
}

View File

@ -0,0 +1,39 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnauto.GardsXeResults;
import org.jeecg.modules.mapper.GardsXeResultsAutoMapper;
import org.jeecg.modules.service.IGardsXeResultsAutoService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@DS("ora")
public class GardsXeResultsAutoServiceImpl extends ServiceImpl<GardsXeResultsAutoMapper, GardsXeResults> implements IGardsXeResultsAutoService {
@Override
public List<ConcDto> getConc(Map<String, Object> params) {
return baseMapper.getConc(params);
}
@Override
public Set<String> nuclideNames(Set<String> nuclideNames) {
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
wrapper.in(GardsXeResults::getNuclideName,nuclideNames);
Set<String> result = list(wrapper).stream()
.map(GardsXeResults::getNuclideName)
.collect(Collectors.toSet());
return result;
}
}

View File

@ -0,0 +1,39 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.modules.base.dto.ConcDto;
import org.jeecg.modules.base.entity.rnman.GardsXeResults;
import org.jeecg.modules.mapper.GardsXeResultsManMapper;
import org.jeecg.modules.service.IGardsXeResultsManService;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
@DS("ora")
public class GardsXeResultsManServiceImpl extends ServiceImpl<GardsXeResultsManMapper, GardsXeResults> implements IGardsXeResultsManService {
@Override
public List<ConcDto> getConc(Map<String, Object> params) {
return baseMapper.getConc(params);
}
@Override
public Set<String> nuclideNames(Set<String> nuclideNames) {
LambdaQueryWrapper<GardsXeResults> wrapper = new LambdaQueryWrapper<>();
wrapper.in(GardsXeResults::getNuclideName,nuclideNames);
Set<String> result = list(wrapper).stream()
.map(GardsXeResults::getNuclideName)
.collect(Collectors.toSet());
return result;
}
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.feignclient;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.postgre.AlarmAnalysisRule;
import org.jeecg.modules.base.entity.postgre.AlarmLog;
import org.jeecg.modules.base.entity.postgre.SysEmail;
import org.springframework.cloud.openfeign.FeignClient;
@ -27,4 +28,6 @@ public interface AbnormalAlarmClient {
/* AlarmLogController下相关接口 */
@PostMapping("/alarmLog/create")
Result create(@RequestBody AlarmLog alarmLog);
/* AlarmAnalysisRuleController下相关接口 */
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.config.mqtoken.UserTokenContext;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.modules.base.entity.postgre.SysUser;
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
@ -28,9 +29,10 @@ import static org.jeecg.common.util.TokenUtils.getTempToken;
@Component
public class SendMessage {
private final String System = "Username";
private final String Email = "Email";
private final String Sms = "Phone";
private final String Email = "Email";
private final String System = "Username";
private final String comma = SymbolConstant.COMMA;
@Autowired
private ISysBaseAPI sysBaseAPI;
@ -55,7 +57,7 @@ public class SendMessage {
Map<String, String> contact = getContact(groupId);
if (StrUtil.isBlank(notific))return;
List<String> ways = ListUtil.toList(notific.split(","));
List<String> ways = ListUtil.toList(notific.split(comma));
if (ways.contains(ALL.getValue())){
ways = ListUtil.toList(XT.getValue(), YJ.getValue(),SMS.getValue());
}
@ -100,17 +102,17 @@ public class SendMessage {
String usernameList = sysUsers.stream()
.filter(user -> StrUtil.isNotBlank(user.getUsername()))
.map(SysUser::getUsername)
.collect(Collectors.joining(","));
.collect(Collectors.joining(comma));
// 邮箱
String emailList = sysUsers.stream()
.filter(user -> StrUtil.isNotBlank(user.getEmail()))
.map(SysUser::getEmail)
.collect(Collectors.joining(","));
.collect(Collectors.joining(comma));
// 手机号码
String phoneList = sysUsers.stream()
.filter(user -> StrUtil.isNotBlank(user.getPhone()))
.map(SysUser::getPhone)
.collect(Collectors.joining(","));
.collect(Collectors.joining(comma));
Map<String,String> result = new HashMap<>();
result.put(System,usernameList);
result.put(Email,emailList);

View File

@ -1,35 +0,0 @@
package org.jeecg.modules.quartz.job;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.config.mqtoken.UserTokenContext;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.message.handle.impl.EmailPushMsgHandle;
import org.quartz.*;
import static org.jeecg.common.util.TokenUtils.getTempToken;
/**
* @Description: 同步定时任务测试
*
* 此处的同步是指 当定时任务的执行时间大于任务的时间间隔时
* 会等待第一个任务执行完成才会走第二个任务
*
*
* @author: taoyan
* @date: 2020年06月19日
*/
@DisallowConcurrentExecution
@PersistJobDataAfterExecution
public class AsyncJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
// start:生成临时Token到线程中
UserTokenContext.setToken(getTempToken());
EmailPushMsgHandle emailPushMsgHandle = SpringContextUtils.getBean(EmailPushMsgHandle.class);
emailPushMsgHandle.sendMessage(new MessageDTO("xiao","nzyone@qq.com","测试邮件","这是一封测试邮件"));
}
}

View File

@ -0,0 +1,21 @@
package org.jeecg.modules.quartz.job;
import org.quartz.*;
/**
* 此处的同步是指:当定时任务的执行时间大于任务的时间
* 间隔时会等待第一个任务执行完成才会走第二个任务
*/
@DisallowConcurrentExecution
@PersistJobDataAfterExecution
public class ConcJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
init();
}
private void init(){
}
}

View File

@ -1,12 +0,0 @@
package org.jeecg.modules.quartz.job;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class DatabaseJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
}
}

View File

@ -9,6 +9,8 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.base.entity.Rule;
@ -48,7 +50,7 @@ public class SysInfoJob implements Job {
AbnormalAlarmClient alarmClient = SpringContextUtils.getBean(AbnormalAlarmClient.class);
// 查询所有报警规则,根据报警规则查询监控项数据
String pattern = CommonConstant.PREFIX_RULE;
String pattern = RedisConstant.PREFIX_RULE;
Set<String> keys = redisStreamUtil.keys(pattern);
if (CollUtil.isEmpty(keys)) {
log.error("当前没有需要监控的预警规则!");
@ -61,11 +63,11 @@ public class SysInfoJob implements Job {
.withNano(0);
LocalDateTime beforeMin = now.minusMinutes(1);
DateTimeFormatter formatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd HH:mm:ss");
.ofPattern(DateConstant.DATE_TIME);
String start = beforeMin.format(formatter);
String end = now.format(formatter);
String prefixSilence = CommonConstant.PREFIX_SILENCE;
String prefixSilence = RedisConstant.PREFIX_SILENCE;
for (String ruleKey : keys) {
String operator = "";
try {

View File

@ -1,41 +0,0 @@
package org.jeecg.modules.redisStream;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.dto.RuleDto;
import org.jeecg.modules.base.enums.SourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;
@Data
@Slf4j
@Component
@NoArgsConstructor
public class ConsumeA2 implements StreamListener<String, ObjectRecord<String, RuleDto>> {
private String consumerName;
@Autowired
private RedisUtil redisUtil;
@Override
public void onMessage(ObjectRecord<String, RuleDto> message) {
String streamKey = message.getStream();
RecordId recordId = message.getId();
RuleDto msg = message.getValue();
String prefix = CommonConstant.PREFIX_RULE;
SourceType sourceType = msg.getSourceType();
String key = prefix + sourceType + "_";
log.info("[自动ACK][name:"+consumerName+"][streamKey:{}][id:{}][message:{}]", streamKey, recordId, msg);
// redisStreamUtil.del(streamKey, id.getValue());
}
public ConsumeA2(String consumerName) {
this.consumerName = consumerName;
}
}

View File

@ -15,6 +15,7 @@ import org.jeecg.modules.base.entity.postgre.SysDataSource;
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
import org.jeecg.modules.system.service.ISysDataSourceService;
import org.jeecg.modules.system.service.ISysDefaultNuclideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -22,27 +23,32 @@ import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.List;
@Slf4j
@Api(tags = "核素默认配置")
@Api(value = "核素默认配置管理",tags = "核素默认配置管理")
@RestController
@RequestMapping("sys/defaultNuclide")
@RequestMapping("/sys/defaultNuclide")
public class SysDefaultNuclideController extends JeecgController<SysDefaultNuclide, ISysDefaultNuclideService> {
@Resource
@Autowired
private ISysDefaultNuclideService sysDefaultNuclideService;
@AutoLog(value = "核素默认配置-获取全部数据")
@ApiOperation(value = "核素默认配置-获取全部数据", notes = "核素默认配置-获取全部数据")
@ApiOperation(value = "核素配置信息分页查询", notes = "核素配置信息分页查询")
@GetMapping(value = "/findPage")
public Result<?> findPage(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req, Integer useType) {
@RequestParam Integer useType) {
Result<IPage<SysDefaultNuclide>> iPageResult = sysDefaultNuclideService.queryNuclideByType(pageNo, pageSize, useType);
return Result.ok(iPageResult);
}
@AutoLog(value = "核素默认配置-添加")
@ApiOperation(value = "核素默认配置-添加", notes = "核素默认配置-添加")
@ApiOperation(value = "核素名称列表", notes = "核素名称列表")
@GetMapping(value = "/allName")
public Result<?> allName(@RequestParam Integer useType) {
return sysDefaultNuclideService.allName(useType);
}
@ApiOperation(value = "添加核素配置信息", notes = "核素默认配置-添加添加核素配置信息")
@PostMapping(value = "/add")
public Result<?> add() {
String path = "/Users/later/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/1cbf41e7428fb5b814d0c66ac2155730/Message/MessageTemp/7a75277a2ac9468655241c0718e9804e/OpenData/P_default.nuclide";

View File

@ -1,7 +1,10 @@
package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
@Mapper
public interface SysDefaultNuclideMapper extends BaseMapper<SysDefaultNuclide> {
}

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
import java.util.List;
/**
* 核素默认配置
@ -19,4 +21,5 @@ public interface ISysDefaultNuclideService extends IService<SysDefaultNuclide> {
Result<IPage<SysDefaultNuclide>> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType);
Result<?> allName(Integer useType);
}

View File

@ -189,15 +189,17 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
@Override
public List<String> getCodeByIds(String stationIds) {
List<String> stationCodes = new ArrayList<>();
Map<Integer, String> stationCodeMap;
Map<String, String> stationCodeMap;
List<String> idList = ListUtil.toList(stationIds.split(SymbolConstant.COMMA));
String key = RedisConstant.STATION_CODE_MAP;
if (redisUtil.hasKey(key)){
stationCodeMap = (Map<Integer, String>) redisUtil.get(key);
stationCodeMap = (Map<String, String>) redisUtil.get(key);
}else {
List<GardsStations> gardsStations = baseMapper.selectBatchIds(idList);
stationCodeMap = gardsStations.stream().collect(Collectors.toMap(GardsStations::getStationId,
GardsStations::getStationCode, (oldValue, newValue) -> newValue));
List<GardsStations> gardsStations = list();
stationCodeMap = gardsStations.stream().collect(Collectors.toMap(
station -> String.valueOf(station.getStationId()),
GardsStations::getStationCode));
redisUtil.set(key,stationCodeMap);
}
for (String stationId : idList) {
stationCodes.add(stationCodeMap.get(stationId));

View File

@ -10,6 +10,9 @@ import org.jeecg.modules.system.mapper.SysDefaultNuclideMapper;
import org.jeecg.modules.system.service.ISysDefaultNuclideService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideMapper, SysDefaultNuclide> implements ISysDefaultNuclideService {
@ -25,4 +28,14 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
result.setResult(pageList);
return result;
}
@Override
public Result<?> allName(Integer useType) {
LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper();
wrapper.eq(SysDefaultNuclide::getUseType,useType);
List<String> allName = list(wrapper).stream()
.map(SysDefaultNuclide::getNuclideName)
.collect(Collectors.toList());
return Result.OK(allName);
}
}

View File

@ -1,7 +1,8 @@
#code_generate_project_path
project_path=C:\\Users\\a\\Desktop
#bussi_package[User defined]
bussi_package=org.jeecg.modules.demo
bussi_package=org.jeecg
#bussi_package=org.jeecg.modules
#default code path

View File

@ -11,18 +11,25 @@
#username=original
#password=123456
#database_name=original
diver_name=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@82.157.234.81:1521:orcl
username=configuration
password=123456
database_name=configuration
#diver_name=oracle.jdbc.driver.OracleDriver
#url=jdbc:oracle:thin:@82.157.234.81:1521:orcl
#username=configuration
#password=123456
#database_name=configuration
#diver_name=oracle.jdbc.driver.OracleDriver
#url=jdbc:oracle:thin:@82.157.234.81:1521:orcl
#username=rnauto
#password=123456
#database_name=rnauto
#postgre
#diver_name=org.postgresql.Driver
#url=jdbc:postgresql://182.92.183.230:5432/jeecg-boot
#username=postgres
#password=U6D!TGH3
#database_name=public
diver_name=org.postgresql.Driver
url=jdbc:postgresql://182.92.183.230:5432/jeecg-boot
username=postgres
password=U6D!TGH3
database_name=public
#SQLServer2005\u4ee5\u4e0a
#diver_name=org.hibernate.dialect.SQLServerDialect

View File

@ -88,6 +88,12 @@ public class WebStatisticsController {
return gardsSampleDataWebService.findGeneratedReport(sampleId);
}
@GetMapping("sampleInfo")
@ApiOperation(value = "查看谱的详细信息", notes = "查看谱的详细信息")
public Result sampleInfo(@RequestParam Integer sampleId){
return gardsSampleDataWebService.sampleInfo(sampleId);
}
@GetMapping("radionuclideFile")
@ApiOperation("查看Radionuclide的文件")
public Result radionuclideFile(@RequestParam Integer sampleId,

View File

@ -1,8 +1,10 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsSampleAux;
@Mapper
public interface GardsSampleAuxMapper extends BaseMapper<GardsSampleAux> {
}

View File

@ -31,6 +31,9 @@ public interface IGardsSampleDataWebService extends IService<GardsSampleDataWeb>
*/
Result findGeneratedReport(Integer sampleId);
Result sampleInfo(Integer sampleId);
GardsSampleDataWeb getOneSample(Integer sampleId);
void radionuclideExport(Integer[] stationIds,
@ -42,7 +45,7 @@ public interface IGardsSampleDataWebService extends IService<GardsSampleDataWeb>
HttpServletResponse response);
List<GardsSampleDataWeb> listBySampleIds(Integer[] stationIds,
String startTime,
String endTime,
List<Integer> sampleIds);
String startTime,
String endTime,
List<Integer> sampleIds);
}

View File

@ -160,6 +160,13 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
return result;
}
@Override
public Result sampleInfo(Integer sampleId) {
Report report = new Report();
findInfo(sampleId,report);
return Result.OK(report);
}
private void findInfo(Integer sampleId, Report report) {
//声明多个对象 分别封装独立的信息
GeneralInformation generalInformation = new GeneralInformation();