feat:分析结果预警

This commit is contained in:
nieziyan 2023-08-04 16:03:03 +08:00
parent 614e0205d0
commit f4167456b7
38 changed files with 767 additions and 39 deletions

View File

@ -0,0 +1,12 @@
package org.jeecg.common.constant;
public interface DictConstant {
String ANALYSE_CONDITION = "alarm_analyse_rule_condition";
String SPECTRAL_QUALIFIER = "spectral_qualifier";
String ANALYSE_SOURCE = "alarm_analyse_rule_source";
String DATASOURCE_TYPE = "database_type";
}

View File

@ -25,5 +25,9 @@ public interface Prompt {
String FTP_ERR = "FTP Connection Failed!";
String NOT_REPEAT = " Can Not Repeat!";
String NOT_REPEAT = " Can Not Be Repeat!";
String PARAM_REQUIRED = "Param Is Required!";
String PARAM_NOT_EMPTY = "Param Cat Not Be Empty!";
}

View File

@ -0,0 +1,6 @@
package org.jeecg.common.constant;
public interface RedisConstant {
String STATION_CODE_MAP = "stationMap";
}

View File

@ -0,0 +1,29 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class AlarmAnalysisRuleDto implements Serializable {
private String id;
private String name;
private List<String> source;
private List<String> stations;
private List<String> nuclides;
private List<String> spectralQualifier;
private List<String> conditions;
private Integer enabled;
private String groupName;
private String remark;
}

View File

@ -0,0 +1,30 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class AlarmAnalysisRuleInfo implements Serializable {
private String id;
private String name;
private List<String> sourceChecked;
private List<String> stationChecked;
private List<String> nuclidesChecked;
private List<String> qualifierChecked;
private List<String> conditionChecked;
private Integer enabled;
private String contactGroup;
private String remark;
}

View File

@ -0,0 +1,105 @@
package org.jeecg.modules.base.entity.configuration;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("CONFIGURATION.GARDS_NUCL_LIB")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class GardsNuclLib implements Serializable {
private Long nuclideId;
private String name;
private String type;
private Integer halflife;
private Integer halflifeErr;
private Long numLines;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField("parents_1")
private String parents1;
@TableField("parents_2")
private String parents2;
@TableField("parents_3")
private String parents3;
@TableField("parents_4")
private String parents4;
@TableField("parents_5")
private String parents5;
@TableField("parents_6")
private String parents6;
@TableField("daughters_1")
private String daughters1;
@TableField("daughters_2")
private String daughters2;
@TableField("daughters_3")
private String daughters3;
@TableField("daughters_4")
private String daughters4;
@TableField("daughters_5")
private String daughters5;
@TableField("branchingratios_1")
private Integer branchingratios1;
@TableField("branchingratios_2")
private Integer branchingratios2;
@TableField("branchingratios_3")
private Integer branchingratios3;
@TableField("branchingratios_4")
private Integer branchingratios4;
@TableField("branchingratios_5")
private Integer branchingratios5;
@TableField("daughtersstable_1")
private Long daughtersstable1;
@TableField("daughtersstable_2")
private Long daughtersstable2;
@TableField("daughtersstable_3")
private Long daughtersstable3;
@TableField("daughtersstable_4")
private Long daughtersstable4;
@TableField("daughtersstable_5")
private Long daughtersstable5;
@TableField("default")
private Long isDefault;
private java.sql.Clob nucComment;
}

View File

@ -0,0 +1,51 @@
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.jeecg.common.system.base.entity.JeecgEntity;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@TableName("alarm_analysis_rule")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class AlarmAnalysisRule extends JeecgEntity {
/** 规则名称 */
private String name;
/** 是否启用(0,1) */
private Integer enabled;
/** 数据源[ARMD|IDC][ARR|RRR] */
private String source;
/** 关注台站id */
private String stations;
/** 关注核素 */
private String nuclides;
/** 光谱限定符(全谱/半谱) */
private String spectralQualifier;
/** 触发条件 */
private String conditions;
/** 联系人组id */
private String contactGroup;
/** 备注 */
private String remark;
}

View File

@ -0,0 +1,17 @@
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{
private List<String> source;
private List<String> stations;
private List<String> nuclides;
}

View File

@ -0,0 +1,86 @@
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.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")
public class AlarmAnalysisRuleController extends JeecgController<AlarmAnalysisRule, IAlarmAnalysisRuleService> {
@Autowired
private IAlarmAnalysisRuleService alarmAnalysisRuleService;
@ApiOperation(value="分页查询报警规则", notes="分页查询报警规则")
@GetMapping(value = "/findPage")
public Result<?> findPage(AlarmAnalysisRuleVo analysisRuleVo) {
return alarmAnalysisRuleService.page(analysisRuleVo);
}
@ApiOperation(value="添加报警规则", notes="添加报警规则")
@PostMapping("/add")
public Result<?> add(@RequestBody AlarmAnalysisRule alarmAnalysisRule) {
return alarmAnalysisRuleService.add(alarmAnalysisRule);
}
@ApiOperation(value="编辑报警规则", notes="编辑报警规则")
@PutMapping("/edit")
public Result<?> edit(@RequestBody AlarmAnalysisRule alarmAnalysisRule) {
return alarmAnalysisRuleService.edit(alarmAnalysisRule);
}
@ApiOperation(value="报警规则详情", notes="报警规则详情")
@GetMapping("/finInfo")
public Result<?> findInfo(@RequestParam String id) {
return alarmAnalysisRuleService.findInfo(id);
}
@PutMapping("updateStatus")
@ApiOperation(value = "修改规则状态", notes = "修改规则状态")
public Result updateStatus(@RequestParam String id,
@RequestParam Integer enabled){
return alarmAnalysisRuleService.updateStatus(id,enabled);
}
@ApiOperation(value="删除报警规则", notes="删除报警规则")
@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);
}
@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);
}
}

View File

@ -0,0 +1,51 @@
package org.jeecg.modules.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.aspect.annotation.AutoLog;
import java.util.Date;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.service.IGardsNuclLibService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(value = "核素信息库管理",tags = "核素信息库管理")
@RestController
@RequestMapping("gardsNuclLib")
public class GardsNuclLibController extends JeecgController<GardsNuclLib, IGardsNuclLibService> {
@Autowired
private IGardsNuclLibService gardsNuclLibService;
@GetMapping("allName")
@ApiOperation(value = "核素名列表",notes = "核素名列表")
public List<String> allName(){
return null;
}
}

View File

@ -1,11 +1,15 @@
package org.jeecg.modules.feignclient;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.base.entity.postgre.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@Component
@ -15,7 +19,11 @@ public interface SystemClient {
@RequestMapping("/sys/user/findUserMap")
Map<String, SysUser> findUserMap();
/* 数据字典相关 */
@GetMapping("/sys/dict/dataBaseType")
Map<String,String> dataBaseType();
/* SysDictController下相关接口 */
@GetMapping("/sys/dict/getItems")
List<DictModel> getItems(@RequestParam String dictCode);
/* GardsStationsController下相关接口 */
@GetMapping("/gardsStations/getCodes")
List<String> stationCodes(@RequestParam String stationIds);
}

View File

@ -0,0 +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.postgre.AlarmAnalysisRule;
@Mapper
public interface AlarmAnalysisRuleMapper extends BaseMapper<AlarmAnalysisRule> {
}

View File

@ -0,0 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
public interface GardsNuclLibMapper extends BaseMapper<GardsNuclLib> {
}

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.AlarmAnalysisRuleMapper">
</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.GardsNuclLibMapper">
</mapper>

View File

@ -0,0 +1,24 @@
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 java.util.List;
public interface IAlarmAnalysisRuleService extends IService<AlarmAnalysisRule> {
Result page(AlarmAnalysisRuleVo analysisRuleVo);
Result add(AlarmAnalysisRule alarmAnalysisRule);
Result edit(AlarmAnalysisRule alarmAnalysisRule);
Result findInfo(String id);
AlarmAnalysisRule getByName(String name);
Result updateStatus(String id, Integer enabled);
}

View File

@ -0,0 +1,10 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import java.util.List;
public interface IGardsNuclLibService extends IService<GardsNuclLib> {
}

View File

@ -0,0 +1,212 @@
package org.jeecg.modules.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
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.system.vo.DictModel;
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.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 java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class AlarmAnalysisRuleServiceImpl extends ServiceImpl<AlarmAnalysisRuleMapper, AlarmAnalysisRule> implements IAlarmAnalysisRuleService {
@Autowired
private SystemClient systemClient;
@Autowired
private IAlarmContactGroupService alarmContactGroupService;
@Override
public Result page(AlarmAnalysisRuleVo 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();
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(nuclide)){
result = result.stream().filter(item -> {
List<String> nuclideList = ListUtil
.toList(item.getNuclides().split(comma));
return CollUtil.containsAny(nuclideList,nuclide);
}).collect(Collectors.toList());
}
// 查询数据字典
List<DictModel> conditionDict = systemClient.getItems(DictConstant.ANALYSE_CONDITION);
List<DictModel> qualifierDict = systemClient.getItems(DictConstant.SPECTRAL_QUALIFIER);
List<DictModel> sourceDict = systemClient.getItems(DictConstant.ANALYSE_SOURCE);
// 封装DTO
List<AlarmAnalysisRuleDto> dtos = new ArrayList<>();
String[] ignore = new String[]{"source","stations","nuclides",
"spectralQualifier","conditions"};
CopyOptions options = CopyOptions.create().setIgnoreProperties(ignore);
for (AlarmAnalysisRule analysisRule : result) {
AlarmAnalysisRuleDto analysisRuleDto = new AlarmAnalysisRuleDto();
BeanUtil.copyProperties(analysisRule,analysisRuleDto,options);
// 数据源
String sources = analysisRule.getSource();
List<String> sourceShow = getShow(sourceDict, sources);
analysisRuleDto.setSource(sourceShow);
// 台站
String stationIds = analysisRule.getStations();
if (StrUtil.isNotBlank(stationIds)){
List<String> stationCodes = systemClient.stationCodes(stationIds);
analysisRuleDto.setStations(stationCodes);
}
// 核素
String nuclides = analysisRule.getNuclides();
if (StrUtil.isNotBlank(nuclides))
analysisRuleDto.setNuclides(ListUtil
.toList(nuclides.split(comma)));
// 谱类型
String spectralQualifier = analysisRule.getSpectralQualifier();
List<String> qualifierShow = getShow(qualifierDict, spectralQualifier);
analysisRuleDto.setSpectralQualifier(qualifierShow);
// 触发条件
String conditions = analysisRule.getConditions();
List<String> conditionShow = getShow(conditionDict, conditions);
analysisRuleDto.setConditions(conditionShow);
// 联系组组名
String groupId = analysisRule.getContactGroup();
if (StrUtil.isNotBlank(groupId)){
AlarmContactGroupAbnormal group = alarmContactGroupService.getById(groupId);
if (ObjectUtil.isNotNull(group))
analysisRuleDto.setGroupName(group.getName());
}
dtos.add(analysisRuleDto);
}
// 封装分页
int total = dtos.size();
int start = (pageNo - 1) * pageSize;
int end = Math.min(start + pageSize, total);
List<AlarmAnalysisRuleDto> records = dtos.subList(start, end);
Page<AlarmAnalysisRuleDto> page = new Page<>(pageNo,pageSize,total);
page.setRecords(records);
return Result.OK(page);
}
@Override
public Result add(AlarmAnalysisRule alarmAnalysisRule) {
String name = alarmAnalysisRule.getName();
if (ObjectUtil.isNotNull(getByName(name)))
return Result.error("Rule Name" + Prompt.NOT_REPEAT);
boolean success = save(alarmAnalysisRule);
if (success)
return Result.OK(Prompt.ADD_SUCC);
return Result.error(Prompt.ADD_ERR);
}
@Override
public Result edit(AlarmAnalysisRule alarmAnalysisRule) {
String id = alarmAnalysisRule.getId();
String name = alarmAnalysisRule.getName();
String original = getById(id).getName();
if (!StrUtil.equalsIgnoreCase(name,original)){
if (ObjectUtil.isNotNull(getByName(name)))
return Result.error("Rule Name" + Prompt.NOT_REPEAT);
}
boolean success = updateById(alarmAnalysisRule);
if (success)
return Result.OK(Prompt.UPDATE_SUCC);
return Result.error(Prompt.UPDATE_ERR);
}
@Override
public Result findInfo(String id) {
AlarmAnalysisRuleInfo analysisRuleInfo = new AlarmAnalysisRuleInfo();
AlarmAnalysisRule analysisRule = getById(id);
BeanUtil.copyProperties(analysisRule,analysisRuleInfo);
String comma = SymbolConstant.COMMA;
List<String> sourceChecked = ListUtil
.toList(analysisRule.getSource().split(comma));
analysisRuleInfo.setSourceChecked(sourceChecked);
List<String> stationChecked = ListUtil
.toList(analysisRule.getStations().split(comma));
analysisRuleInfo.setStationChecked(stationChecked);
List<String> nuclidesChecked = ListUtil
.toList(analysisRule.getNuclides().split(comma));
analysisRuleInfo.setNuclidesChecked(nuclidesChecked);
List<String> qualifierChecked = ListUtil
.toList(analysisRule.getSpectralQualifier().split(comma));
analysisRuleInfo.setQualifierChecked(qualifierChecked);
List<String> conditionChecked = ListUtil
.toList(analysisRule.getConditions().split(comma));
analysisRuleInfo.setConditionChecked(conditionChecked);
return Result.OK(analysisRuleInfo);
}
@Override
public AlarmAnalysisRule getByName(String name) {
LambdaQueryWrapper<AlarmAnalysisRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AlarmAnalysisRule::getName, name);
return getOne(wrapper);
}
@Override
public Result updateStatus(String id, Integer enabled) {
AlarmAnalysisRule analysisRule = new AlarmAnalysisRule();
analysisRule.setId(id);
analysisRule.setEnabled(enabled);
if (updateById(analysisRule))
return Result.OK(Prompt.UPDATE_SUCC);
return Result.error(Prompt.UPDATE_ERR);
}
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,18 @@
package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.mapper.GardsNuclLibMapper;
import org.jeecg.modules.service.IGardsNuclLibService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.stream.Collectors;
@Service
@DS("ora")
public class GardsNuclLibServiceImpl extends ServiceImpl<GardsNuclLibMapper, GardsNuclLib> implements IGardsNuclLibService {
}

View File

@ -10,7 +10,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.DictConstant;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.base.dto.DatabaseDto;
import org.jeecg.modules.base.dto.SourceDto;
import org.jeecg.modules.base.entity.postgre.SysDatabase;
@ -27,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Service("sysDatabaseService")
public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDatabase> implements ISysDatabaseService {
@ -50,10 +53,12 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
params.put("startDate",startDate);
params.put("endDate",endDate);
List<DatabaseDto> databaseDtos = baseMapper.findPage(params);
Map<String, String> dataBaseMap = systemClient.dataBaseType();
List<DictModel> items = systemClient.getItems(DictConstant.DATASOURCE_TYPE);
Map<String, String> dataSourceMap = items.stream().collect(Collectors
.toMap(DictModel::getValue, DictModel::getText, (oldValue, newValue) -> newValue));
for (DatabaseDto databaseDto : databaseDtos) {
String type = databaseDto.getType();
String dataBaseType = dataBaseMap.get(type);
String dataBaseType = dataSourceMap.get(type);
databaseDto.setDataBaseType(dataBaseType)
.setOnline(true).setSlowQuery("328/s")
.setAlarmRed(true).setCpuUutilzation("35.8%")
@ -143,7 +148,7 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
if (StrUtil.isNotBlank(startDate))
sourceVo.setStartDate(startDate + DateConstant.TIME_START);
if (StrUtil.isNotBlank(endDate))
sourceVo.setStartDate(endDate + DateConstant.TIME_END);
sourceVo.setEndDate(endDate + DateConstant.TIME_END);
Integer pageNo = sourceVo.getPageNo();
Integer pageSize = sourceVo.getPageSize();
Integer pageStart = (pageNo - 1) * pageSize;

View File

@ -125,7 +125,7 @@ public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> i
if (StrUtil.isNotBlank(startDate))
sourceVo.setStartDate(startDate + DateConstant.TIME_START);
if (StrUtil.isNotBlank(endDate))
sourceVo.setStartDate(endDate + DateConstant.TIME_END);
sourceVo.setEndDate(endDate + DateConstant.TIME_END);
Integer pageNo = sourceVo.getPageNo();
Integer pageSize = sourceVo.getPageSize();
Integer pageStart = (pageNo - 1) * pageSize;

View File

@ -139,7 +139,7 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
if (StrUtil.isNotBlank(startDate))
sourceVo.setStartDate(startDate + DateConstant.TIME_START);
if (StrUtil.isNotBlank(endDate))
sourceVo.setStartDate(endDate + DateConstant.TIME_END);
sourceVo.setEndDate(endDate + DateConstant.TIME_END);
Integer pageNo = sourceVo.getPageNo();
Integer pageSize = sourceVo.getPageSize();
Integer pageStart = (pageNo - 1) * pageSize;

View File

@ -93,4 +93,9 @@ public class GardsStationsController {
return result;
}
@GetMapping("getCodes")
@ApiOperation(value = "获取台站Code", notes = "获取台站Code")
public List<String> getCodes(@RequestParam String stationIds){
return gardsStationsService.getCodeByIds(stationIds);
}
}

View File

@ -706,14 +706,8 @@ public class SysDictController {
return sysDictService.findStationListByMenuName(menuName);
}
@GetMapping("dataBaseType")
public Map<String,String> dataBaseType(){
List<DatabaseTypeDto> databaseTypeDtos = sysDictService.dataBaseType();
Map<String, String> dataBaseMap = databaseTypeDtos.stream()
.collect(Collectors.toMap(
DatabaseTypeDto::getValue,
DatabaseTypeDto::getText,
(oldValue, newValue) -> newValue));
return dataBaseMap;
@GetMapping("getItems")
public List<DictModel> getItems(@RequestParam String dictCode){
return sysDictService.getItems(dictCode);
}
}

View File

@ -275,5 +275,4 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
@InterceptorIgnore(tenantLine = "true")
List<SysDict> getDictListByLowAppId(@Param("lowAppId") String lowAppId, @Param("tenantId") Integer tenantId);
List<DatabaseTypeDto> dataBaseType();
}

View File

@ -229,14 +229,4 @@
and low_app_id = #{lowAppId}
and tenant_id = #{tenantId}
</select>
<select id="dataBaseType" resultType="org.jeecg.modules.system.dto.DatabaseTypeDto">
SELECT
item_value AS VALUE,
item_text AS TEXT
FROM
sys_dict_item di
INNER JOIN sys_dict d ON di.dict_id = d.id
WHERE d.dict_code = 'database_type'
</select>
</mapper>

View File

@ -61,4 +61,5 @@ public interface IGardsStationsService extends IService<GardsStations> {
*/
List<GardsStations> getGardsStations();
List<String> getCodeByIds(String stationIds);
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.DictQuery;
import org.jeecg.modules.base.entity.configuration.GardsStations;
@ -279,5 +280,5 @@ public interface ISysDictService extends IService<SysDict> {
List<GardsStations> findStationListByMenuName(String menuName);
List<DatabaseTypeDto> dataBaseType();
List<DictModel> getItems(String dictCode);
}

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -9,6 +11,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.system.mapper.GardsStationsMapper;
@ -180,4 +185,23 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
redisUtil.set("stationInfoMap",stationInfoMap);
return gardsStations;
}
@Override
public List<String> getCodeByIds(String stationIds) {
List<String> stationCodes = new ArrayList<>();
Map<Integer, 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);
}else {
List<GardsStations> gardsStations = baseMapper.selectBatchIds(idList);
stationCodeMap = gardsStations.stream().collect(Collectors.toMap(GardsStations::getStationId,
GardsStations::getStationCode, (oldValue, newValue) -> newValue));
}
for (String stationId : idList) {
stationCodes.add(stationCodeMap.get(stationId));
}
return stationCodes;
}
}

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CacheConstant;
import org.jeecg.common.constant.CommonConstant;
@ -571,8 +572,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
}
@Override
public List<DatabaseTypeDto> dataBaseType() {
return baseMapper.dataBaseType();
public List<DictModel> getItems(String dictCode) {
return baseMapper.queryDictItemsByCode(dictCode);
}
/**

View File

@ -11,13 +11,18 @@
#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
#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

@ -204,7 +204,6 @@ public class ReadLineUtil {
// 获取文件名
String fileName = FileUtil.getName(filePath);
if (!fileName.endsWith(txt.getType()))fileName += txt.getType();
// 在当前工作路径下读取文件
ftpClient.enterLocalPassiveMode();

View File

@ -23,6 +23,8 @@ import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import static org.jeecg.common.constant.enums.FileTypeEnum.txt;
@RestController
@RequestMapping("webStatistics")
@Api(value = "统计分析管理", tags = "统计分析管理")
@ -75,6 +77,7 @@ public class WebStatisticsController {
}
@GetMapping("findAlertSohPage")
@ApiOperation(value = "台站报警数据分页查询", notes = "台站报警数据分页查询")
public Result findAlertSohPage(QueryRequest queryRequest, Integer[] stationIds,@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return gardsSohDataService.findAlertSohPage(queryRequest, stationIds, startTime, endTime);
}
@ -121,6 +124,8 @@ public class WebStatisticsController {
if (StrUtil.isBlank(reportPath))
return Result.error(Prompt.FILE_NOT_EXITS);
// 将FTP上的文件转为文件流返回到前端
if (!reportPath.endsWith(txt.getType()))
reportPath += txt.getType();
return readLineUtil.readFtpFile(reportPath,response);
}

View File

@ -2,11 +2,13 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import java.util.List;
@Mapper
public interface GardsSampleDataWebMapper extends BaseMapper<GardsSampleDataWeb> {
Page<GardsSampleDataWeb> findAutoPage(String startDate, String endDate, List<Integer> stationIdList, Page<GardsSampleDataWeb> page);

View File

@ -39,6 +39,7 @@
</foreach>
</if>
</where>
ORDER BY sam.ACQUISITION_START DESC
</select>
<select id="findReviewedPage" resultType="org.jeecg.modules.entity.GardsSampleDataWeb">
@ -77,8 +78,8 @@
#{stationId}
</foreach>
</if>
</where>
ORDER BY sam.ACQUISITION_START DESC
</select>
</mapper>

View File

@ -54,6 +54,7 @@ public class GardsMetDataServiceImpl extends ServiceImpl<GardsMetDataMapper, Gar
queryWrapper.in(GardsMetDataWeb::getStationId, stationIds);
queryWrapper.ge(GardsMetDataWeb::getStartTime, startDate);
queryWrapper.le(GardsMetDataWeb::getEndTime, endDate);
queryWrapper.orderByDesc(GardsMetDataWeb::getStartTime);
Page<GardsMetDataWeb> metDataPage = this.baseMapper.selectPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(metDataPage);

View File

@ -107,6 +107,7 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
queryWrapper.le(GardsSampleDataWeb::getAcquisitionStop, endDate);
}
queryWrapper.in(GardsSampleDataWeb::getStationId, stationIds);
queryWrapper.orderByDesc(GardsSampleDataWeb::getAcquisitionStart);
//进行分页查询
Page<GardsSampleDataWeb> sampleDataPage = this.baseMapper.selectPage(page, queryWrapper);
sampleDataPage.getRecords().forEach(item->{

View File

@ -63,6 +63,7 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
queryWrapper.in(GardsSohDataWeb::getStationId, stationIds);
queryWrapper.ge(GardsSohDataWeb::getStartTime, startDate);
queryWrapper.le(GardsSohDataWeb::getStartTime, endDate);
queryWrapper.orderByDesc(GardsSohDataWeb::getStartTime);
Page<GardsSohDataWeb> sohDataPage = this.baseMapper.selectPage(page, queryWrapper);
sohDataPage.getRecords().forEach(item->{
if (Objects.nonNull(item.getDetectorId()) && detectorsMap.containsKey(item.getDetectorId().toString())) {
@ -109,6 +110,7 @@ public class GardsSohDataServiceImpl extends ServiceImpl<GardsSohDataMapper, Gar
queryWrapper.in(GardsAlertDataWeb::getStationId, stationIds);
queryWrapper.ge(GardsAlertDataWeb::getTime, startDate);
queryWrapper.le(GardsAlertDataWeb::getTime, endDate);
queryWrapper.orderByDesc(GardsAlertDataWeb::getTime);
Page<GardsAlertDataWeb> alertDataPage = gardsAlertDataMapper.selectPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(alertDataPage);