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

# Conflicts:
#	jeecg-module-abnormal-alarm/pom.xml
#	jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmLogController.java
This commit is contained in:
nieziyan 2023-06-16 09:43:22 +08:00
commit 2620315fbd
74 changed files with 910 additions and 455 deletions

View File

@ -8,8 +8,11 @@ import org.apache.commons.net.ftp.FTPReply;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
@ -60,14 +63,15 @@ public class FTPUtil {
return ftp;
}
public InputStream downloadFTPFile(String localPath, String fileName){
public void downloadFTPFile(String localPath, String fileName, HttpServletResponse response) {
InputStream in = null;
ServletOutputStream out = null;
FTPClient ftpClient = this.LoginFTP();
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
}
//传输模式
try {
FTPClient ftpClient = this.LoginFTP();
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
}
List<String> paths = Arrays.asList(localPath.split("/"));
if (CollectionUtils.isNotEmpty(paths)){
for (String workPath:paths) {
@ -88,10 +92,41 @@ public class FTPUtil {
}
}
}
//重置响应信息
response.reset();
//设置响应类型
response.setContentType("application/download");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(fileName,"UTF-8"));
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
//获取输出流
out = response.getOutputStream();
//声明一个长度参数
int len;
//声明字节数组
byte[] bytes = new byte[1024];
//判断如果输入流的字节长度不等于-1进行字节数组内容的读取
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
out.flush();
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (ftpClient != null){
ftpClient.disconnect();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return in;
}
}

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.entity;
package org.jeecg.modules.base.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.entity;
package org.jeecg.modules.base.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@ -10,7 +10,7 @@ import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "gards_sample_data")
@TableName("GARDS_SAMPLE_DATA")
public class GardsSampleData implements Serializable {
@TableField(value = "SITE_DET_CODE")
@ -41,28 +41,28 @@ public class GardsSampleData implements Serializable {
private String spectralQualifie;
@TableField(value = "TRANSMIT_DTG")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date transmitDtg;
@TableField(value = "COLLECT_START")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date collectStart;
@TableField(value = "COLLECT_STOP")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date collectStop;
@TableField(value = "ACQUISITION_START")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date acquisitionStart;
@TableField(value = "ACQUISITION_STOP")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date acquisitionStop;
@TableField(value = "ACQUISITION_REAL_SEC")
@ -78,11 +78,13 @@ public class GardsSampleData implements Serializable {
private String status;
@TableField(value = "MODDATE")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(exist = false)
private String stationName;
@TableField(exist = false)
private String detectorsName;
}

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.entity;
package org.jeecg.modules.base.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.entity;
package org.jeecg.modules.base.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;

View File

@ -1,4 +1,4 @@
package org.jeecg.modules.entity;
package org.jeecg.modules.base.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;

View File

@ -21,12 +21,11 @@
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<!-- <dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>${hutool.version}</version>
</dependency>-->
<!-- feign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.AlarmContactGroup;
@ -15,26 +16,31 @@ public class AlarmContactGroupController {
private IAlarmContactGroupService alarmContactGroupService;
@GetMapping("findPage")
@ApiOperation(value = "分页查询报警联系人组信息", notes = "分页查询报警联系人组信息")
public Result findPage(QueryRequest queryRequest, AlarmContactGroup alarmContactGroup){
return alarmContactGroupService.findPage(queryRequest, alarmContactGroup);
}
@GetMapping("findInfo")
@ApiOperation(value = "查询报警联系人组信息详情", notes = "查询报警联系人组信息详情")
public Result findPage(String id){
return alarmContactGroupService.findInfo(id);
}
@PostMapping("create")
@ApiOperation(value = "新增报警人联系人组", notes = "新增报警联系人组")
public Result findPage(@RequestBody AlarmContactGroup alarmContactGroup){
return alarmContactGroupService.create(alarmContactGroup);
}
@PutMapping("update")
@ApiOperation(value = "修改报警人联系人组", notes = "修改报警联系人组")
public Result update(@RequestBody AlarmContactGroup alarmContactGroup){
return alarmContactGroupService.update(alarmContactGroup);
}
@DeleteMapping("deleteById")
@ApiOperation(value = "删除报警人联系人组", notes = "删除报警联系人组")
public Result deleteById(String id){
return alarmContactGroupService.deleteById(id);
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.AlarmLog;
@ -34,21 +35,25 @@ public class AlarmLogController {
}
@GetMapping("findInfo")
@ApiOperation(value = "查询报警日志信息详情", notes = "查询报警日志信息详情")
public Result findPage(String id){
return alarmLogService.findInfo(id);
}
@PostMapping("create")
@ApiOperation(value = "新增报警日志", notes = "新增报警日志")
public Result findPage(@RequestBody AlarmLog alarmLog){
return alarmLogService.create(alarmLog);
}
@PutMapping("update")
@ApiOperation(value = "修改报警日志", notes = "修改报警日志")
public Result update(@RequestBody AlarmLog alarmLog){
return alarmLogService.update(alarmLog);
}
@DeleteMapping("deleteById")
@ApiOperation(value = "删除报警日志", notes = "删除报警日志")
public Result deleteById(String id){
return alarmLogService.deleteById(id);
}

View File

@ -1,11 +1,13 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.AlarmRule;
import org.jeecg.modules.service.IAlarmRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@RestController
@ -17,26 +19,31 @@ public class AlarmRuleController {
private IAlarmRuleService alarmRuleService;
@GetMapping("findPage")
@ApiOperation(value = "分页查询报警规则信息", notes = "分页查询报警规则信息")
public Result findPage(QueryRequest queryRequest, AlarmRule alarmRule){
return alarmRuleService.findPage(queryRequest, alarmRule);
}
@GetMapping("findInfo")
@ApiOperation(value = "查看规则信息详情", notes = "查看规则信息详情")
public Result findPage(String id){
return alarmRuleService.findInfo(id);
}
@PostMapping("create")
@ApiOperation(value = "新增规则信息", notes = "新增规则信息")
public Result findPage(@RequestBody AlarmRule alarmRule){
return alarmRuleService.create(alarmRule);
}
@PutMapping("update")
@ApiOperation(value = "修改规则信息", notes = "修改规则信息")
public Result update(@RequestBody AlarmRule alarmRule){
return alarmRuleService.update(alarmRule);
}
@DeleteMapping("deleteById")
@ApiOperation(value = "删除规则信息", notes = "删除规则信息")
public Result deleteById(String id){
return alarmRuleService.deleteById(id);
}

View File

@ -1,13 +1,18 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.SysDatabase;
import org.jeecg.modules.service.ISysDatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
@RestController
@RequestMapping("sysDatabase")
@Api(value = "数据库配置管理", tags = "数据库配置管理")
@ -17,28 +22,40 @@ public class SysDatabaseController {
private ISysDatabaseService sysDatabaseService;
@GetMapping("findPage")
@ApiOperation(value = "分页查询数据库配置信息", notes = "分页查询数据库配置信息")
public Result findPage(QueryRequest queryRequest, SysDatabase sysDatabase){
return sysDatabaseService.findPage(queryRequest, sysDatabase);
}
@GetMapping("findInfo")
@ApiOperation(value = "查询数据库配置信息详情", notes = "查询数据库配置信息详情")
public Result findInfo(String id){
return sysDatabaseService.findInfo(id);
}
@PostMapping("create")
@ApiOperation(value = "新增数据库配置信息", notes = "新增数据库配置信息")
public Result create(@RequestBody SysDatabase sysDatabase){
return sysDatabaseService.create(sysDatabase);
}
@PutMapping("update")
@ApiOperation(value = "修改数据库配置信息", notes = "修改数据库配置信息")
public Result update(@RequestBody SysDatabase sysDatabase){
return sysDatabaseService.update(sysDatabase);
}
@DeleteMapping("deleteById")
@ApiOperation(value = "删除数据库配置信息", notes = "删除数据库配置信息")
public Result deleteById(String id){
return sysDatabaseService.deleteById(id);
}
@GetMapping("findAlarmHistory")
@ApiOperation(value = "查询数据库历史报警信息", notes = "查询数据库历史报警信息")
public Result findAlarmHistory(String databaseId,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return sysDatabaseService.findAlarmHistory(databaseId, startTime, endTime);
}
}

View File

@ -4,11 +4,14 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.SysEmail;
import org.jeecg.modules.base.entity.SysEmail;
import org.jeecg.modules.service.ISysEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@RestController
@RequestMapping("sysEmail")
@Api(value = "邮箱配置信息管理", tags = "邮箱配置信息管理")
@ -47,4 +50,11 @@ public class SysEmailController {
return sysEmailService.deleteById(id);
}
@GetMapping("findAlarmHistory")
@ApiOperation(value = "查询邮箱历史报警信息", notes = "查询邮箱历史报警信息")
public Result findAlarmHistory(String emailId,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return sysEmailService.findAlarmHistory(emailId, startTime, endTime);
}
}

View File

@ -51,6 +51,7 @@ public class SysServerController {
}
@GetMapping("findAlarmHistory")
@ApiOperation(value = "查询服务器历史报警信息", notes = "查询服务器历史报警信息")
public Result findAlarmHistory(String serverId,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return sysServerService.findAlarmHistory(serverId, startTime, endTime);

View File

@ -44,6 +44,10 @@ public class AlarmContactGroup implements Serializable {
@TableField(exist = false)
List<String> userIds;
@TableField(exist = false)
List<SysUser> users;
@TableField(exist = false)
Integer personNumber;
}

View File

@ -1,27 +0,0 @@
package org.jeecg.modules.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class AlarmContactGroupVo implements Serializable {
private String id;
private String name;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
List<SysUser> users;
Integer personNumber;
}

View File

@ -1,52 +0,0 @@
package org.jeecg.modules.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 用户角色表
* </p>
*
* @Author scott
* @since 2018-12-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysUserRole implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 用户id
*/
private String userId;
/**
* 角色id
*/
private String roleId;
/**租户ID*/
private Integer tenantId;
public SysUserRole() {
}
public SysUserRole(String userId, String roleId) {
this.userId = userId;
this.roleId = roleId;
}
}

View File

@ -1,7 +0,0 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.AlarmContactGroupVo;
public interface AlarmContactGroupVoMapper extends BaseMapper<AlarmContactGroupVo> {
}

View File

@ -1,7 +1,15 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.entity.AlarmHistory;
import org.jeecg.modules.entity.SysDatabase;
import java.util.Date;
import java.util.List;
public interface SysDatabaseMapper extends BaseMapper<SysDatabase> {
List<AlarmHistory> findAlarmHistory(@Param("databaseId") String databaseId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}

View File

@ -1,7 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysEmailLog;
import org.jeecg.modules.base.entity.SysEmailLog;
public interface SysEmailLogMapper extends BaseMapper<SysEmailLog> {
}

View File

@ -1,7 +1,15 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysEmail;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.entity.AlarmHistory;
import org.jeecg.modules.base.entity.SysEmail;
import java.util.Date;
import java.util.List;
public interface SysEmailMapper extends BaseMapper<SysEmail> {
List<AlarmHistory> findAlarmHistory( @Param("emailId") String emailId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}

View File

@ -1,7 +0,0 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysRole;
public interface SysRoleMapper extends BaseMapper<SysRole> {
}

View File

@ -1,7 +0,0 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysUser;
public interface SysUserMapper extends BaseMapper<SysUser> {
}

View File

@ -1,7 +0,0 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.SysUserRole;
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
}

View File

@ -0,0 +1,23 @@
<?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.SysEmailMapper">
<select id="findAlarmHistory" resultType="org.jeecg.modules.entity.AlarmHistory">
SELECT
se.name,
l.alarm_start_date,
l.alarm_info,
r.operator
FROM
sys_email se
inner join alarm_rule r on r.source_id = se.id
inner join alarm_log l on l.rule_id = r.id
<where>
l.alarm_start_date between #{startDate} and #{endDate}
<if test=" emailId != null and emailId != '' ">
and se.id = #{emailId}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,23 @@
<?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.SysEmailMapper">
<select id="findAlarmHistory" resultType="org.jeecg.modules.entity.AlarmHistory">
SELECT
se.name,
l.alarm_start_date,
l.alarm_info,
r.operator
FROM
sys_database se
inner join alarm_rule r on r.source_id = se.id
inner join alarm_log l on l.rule_id = r.id
<where>
l.alarm_start_date between #{startDate} and #{endDate}
<if test=" databaseId != null and databaseId != '' ">
and se.id = #{databaseId}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.service;
import org.jeecg.modules.entity.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Map;
@Component
@FeignClient(value = "jeecg-system")
public interface IAlarmSysUserService {
@RequestMapping("/alarmSysUser/findUserMap")
Map<String, SysUser> findUserMap();
}

View File

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.SysDatabase;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public interface ISysDatabaseService extends IService<SysDatabase> {
@ -17,4 +20,6 @@ public interface ISysDatabaseService extends IService<SysDatabase> {
Result deleteById(String id);
Result findAlarmHistory(String databaseId, Date startTime, Date endTime);
}

View File

@ -1,7 +1,7 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.entity.SysEmailLog;
import org.jeecg.modules.base.entity.SysEmailLog;
public interface ISysEmailLogService extends IService<SysEmailLog> {
}

View File

@ -3,7 +3,9 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.SysEmail;
import org.jeecg.modules.base.entity.SysEmail;
import java.util.Date;
public interface ISysEmailService extends IService<SysEmail> {
@ -17,4 +19,6 @@ public interface ISysEmailService extends IService<SysEmail> {
Result deleteById(String id);
Result findAlarmHistory(String emailId, Date startTime, Date endTime);
}

View File

@ -1,13 +0,0 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.entity.SysUser;
import java.util.List;
import java.util.Map;
public interface ISysUserService extends IService<SysUser> {
Map<String ,SysUser> findUserList();
}

View File

@ -11,13 +11,11 @@ import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.entity.AlarmContactGroup;
import org.jeecg.modules.entity.AlarmContactGroupMember;
import org.jeecg.modules.entity.AlarmContactGroupVo;
import org.jeecg.modules.entity.SysUser;
import org.jeecg.modules.mapper.AlarmContactGroupMapper;
import org.jeecg.modules.mapper.AlarmContactGroupMemberMapper;
import org.jeecg.modules.mapper.AlarmContactGroupVoMapper;
import org.jeecg.modules.service.IAlarmContactGroupService;
import org.jeecg.modules.service.ISysUserService;
import org.jeecg.modules.service.IAlarmSysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -28,24 +26,22 @@ import java.util.stream.Collectors;
@Service("alarmContactGroupService")
public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupMapper, AlarmContactGroup> implements IAlarmContactGroupService {
@Autowired
private AlarmContactGroupVoMapper alarmContactGroupVoMapper;
@Autowired
private AlarmContactGroupMemberMapper alarmContactGroupMemberMapper;
@Autowired
private ISysUserService sysUserService;
private IAlarmSysUserService alarmSysUserService;
@Override
public Result findPage(QueryRequest queryRequest, AlarmContactGroup alarmContactGroup) {
Result result = new Result();
//获取用户信息
Map<String ,SysUser> userList = sysUserService.findUserList();
Page<AlarmContactGroupVo> page = new Page<>();
LambdaQueryWrapper<AlarmContactGroupVo> queryWrapper = new LambdaQueryWrapper<>();
Page<AlarmContactGroupVo> alarmContactGroupVoPage = alarmContactGroupVoMapper.selectPage(page, queryWrapper);
Map<String ,SysUser> userList = alarmSysUserService.findUserMap();
Page<AlarmContactGroup> page = new Page<>();
LambdaQueryWrapper<AlarmContactGroup> queryWrapper = new LambdaQueryWrapper<>();
Page<AlarmContactGroup> alarmContactGroupPage = this.baseMapper.selectPage(page, queryWrapper);
LambdaQueryWrapper<AlarmContactGroupMember> contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>();
List<AlarmContactGroupMember> alarmContactGroupMembers = alarmContactGroupMemberMapper.selectList(contactGroupMemberQueryWrapper);
alarmContactGroupVoPage.getRecords().forEach(item->{
alarmContactGroupPage.getRecords().forEach(item->{
List<SysUser> sysUsers = new LinkedList<>();
//联系人组对应联系人信息不为空
if (CollectionUtils.isNotEmpty(alarmContactGroupMembers)){
@ -66,7 +62,7 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupM
}
});
result.setSuccess(true);
result.setResult(alarmContactGroupVoPage);
result.setResult(alarmContactGroupPage);
return result;
}

View File

@ -28,6 +28,8 @@ public class AlarmRuleServiceImpl extends ServiceImpl<AlarmRuleMapper, AlarmRule
Result result = new Result();
Page<AlarmRule> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
LambdaQueryWrapper<AlarmRule> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Objects.nonNull(alarmRule.getEnabled()), AlarmRule::getEnabled, alarmRule.getEnabled());
queryWrapper.eq(StringUtils.isNotBlank(alarmRule.getSourceId()), AlarmRule::getSourceId, alarmRule.getSourceId());
Page<AlarmRule> alarmRulePage = this.baseMapper.selectPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(alarmRulePage);

View File

@ -7,7 +7,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.system.util.JwtUtil;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.entity.AlarmHistory;
import org.jeecg.modules.entity.SysDatabase;
import org.jeecg.modules.mapper.SysDatabaseMapper;
import org.jeecg.modules.service.ISysDatabaseService;
@ -15,7 +17,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service("sysDatabaseService")
@ -101,4 +105,27 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
return result;
}
@Override
public Result findAlarmHistory(String databaseId, Date startTime, Date endTime) {
Result result = new Result();
try {
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
return result;
}
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
return result;
}
Date startDate = DateUtils.parseDate(DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
Date endDate = DateUtils.parseDate(DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
List<AlarmHistory> alarmHistory = this.baseMapper.findAlarmHistory(databaseId, startDate, endDate);
result.setSuccess(true);
result.setResult(alarmHistory);
} catch (ParseException e) {
throw new RuntimeException(e);
}
return result;
}
}

View File

@ -1,7 +1,7 @@
package org.jeecg.modules.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.entity.SysEmailLog;
import org.jeecg.modules.base.entity.SysEmailLog;
import org.jeecg.modules.mapper.SysEmailLogMapper;
import org.jeecg.modules.service.ISysEmailLogService;
import org.springframework.stereotype.Service;

View File

@ -7,15 +7,19 @@ 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.system.util.JwtUtil;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.entity.SysEmail;
import org.jeecg.modules.entity.AlarmHistory;
import org.jeecg.modules.base.entity.SysEmail;
import org.jeecg.modules.mapper.SysEmailMapper;
import org.jeecg.modules.service.ISysEmailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service("sysEmailService")
@ -105,4 +109,27 @@ public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> i
return result;
}
@Override
public Result findAlarmHistory(String emailId, Date startTime, Date endTime) {
Result result = new Result();
try {
if (Objects.isNull(startTime)){
result.error500("开始时间不能为空");
return result;
}
if (Objects.isNull(endTime)){
result.error500("结束时间不能为空");
return result;
}
Date startDate = DateUtils.parseDate(DateUtils.formatDate(startTime, "yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
Date endDate = DateUtils.parseDate(DateUtils.formatDate(endTime, "yyyy-MM-dd") + " 23:59:59", "yyyy-MM-dd HH:mm:ss");
List<AlarmHistory> alarmHistory = this.baseMapper.findAlarmHistory(emailId, startDate, endDate);
result.setSuccess(true);
result.setResult(alarmHistory);
} catch (ParseException e) {
throw new RuntimeException(e);
}
return result;
}
}

View File

@ -1,61 +0,0 @@
package org.jeecg.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.entity.SysRole;
import org.jeecg.modules.entity.SysUser;
import org.jeecg.modules.entity.SysUserRole;
import org.jeecg.modules.mapper.SysRoleMapper;
import org.jeecg.modules.mapper.SysUserMapper;
import org.jeecg.modules.mapper.SysUserRoleMapper;
import org.jeecg.modules.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service("sysUserService")
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
@Autowired
private SysUserRoleMapper sysUserRoleMapper;
@Autowired
private SysRoleMapper sysRoleMapper;
@Override
public Map<String ,SysUser> findUserList() {
Map<String ,SysUser> map = new HashMap<>();
LambdaQueryWrapper<SysUser> userQueryWrapper = new LambdaQueryWrapper<>();
List<SysUser> sysUsers = this.baseMapper.selectList(userQueryWrapper);
LambdaQueryWrapper<SysUserRole> userRoleQueryWrapper = new LambdaQueryWrapper<>();
List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectList(userRoleQueryWrapper);
LambdaQueryWrapper<SysRole> roleQueryWrapper = new LambdaQueryWrapper<>();
List<SysRole> sysRoles = sysRoleMapper.selectList(roleQueryWrapper);
List<SysRole> roles = new LinkedList<>();
//遍历所有用户信息
if (CollectionUtils.isNotEmpty(sysUsers)){
for (SysUser sysUser:sysUsers) {
if (CollectionUtils.isNotEmpty(sysUserRoles)){
//获取各用户匹配的权限集合
List<SysUserRole> userRoles = sysUserRoles.stream().filter(item -> item.getUserId().equals(sysUser.getId())).collect(Collectors.toList());
List<String> roleIds = userRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sysRoles)){
for (SysRole role:sysRoles) {
if (roleIds.contains(role.getId())){
roles.add(role);
}
}
}
sysUser.setRoles(roles);
}
map.put(sysUser.getId(), sysUser);
}
}
return map;
}
}

View File

@ -9,6 +9,7 @@ import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.FTPUtil;
import org.jeecg.modules.entity.FileInfo;
import org.jeecg.modules.entity.LogManage;
import org.jeecg.modules.service.ILogManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -28,119 +29,13 @@ public class LogManageController {
@Autowired
private FTPUtil ftpUtil;
@Autowired
private ILogManageService logManageService;
@GetMapping("findFtpFolders")
@ApiOperation(value = "查询日志文件夹树形结构", notes = "查询日志文件夹树形结构")
public List<LogManage> findFtpFolders(String workPath){
List<LogManage> result = new ArrayList<>();
try {
FTPClient ftpClient = ftpUtil.LoginFTP();
if(Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
}
//切换工作文件路径
ftpClient.changeWorkingDirectory(workPath);
ftpClient.enterLocalPassiveMode();
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listDirectories());
if (CollectionUtils.isNotEmpty(ftpFiles)){
int num =1;
for (FTPFile ftpFile:ftpFiles) {
LogManage logManage = new LogManage();
logManage.setName(ftpFile.getName());
logManage.setOrderNum(num);
logManage.setParentNum(0);
logManage.setPath(workPath + "/" + ftpFile.getName());
result.add(logManage);
num++;
}
}
if (CollectionUtils.isNotEmpty(result)){
List<LogManage> list = new LinkedList<>();
for (LogManage logManage:result) {
list = this.findDirectory(ftpClient, list, logManage.getOrderNum(), workPath + "/" + logManage.getName());
ftpClient.changeToParentDirectory();
}
result.addAll(list);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
result = this.LogManageTree(result);
return result;
}
/**
* 遍历查询当前路径下的文件夹信息
* @param ftp
* @param list
* @param filePath "/"开始和结束
* @return
*/
public List<LogManage> findDirectory(FTPClient ftp,List<LogManage> list,Integer parentNum,String filePath){
try {
if (filePath.indexOf("/")>0){
List<String> paths = Arrays.asList(filePath.split("/"));
for (String path:paths) {
ftp.changeWorkingDirectory(path);
}
}
List<FTPFile> ftpFiles = Arrays.asList(ftp.listDirectories());
if (CollectionUtils.isNotEmpty(ftpFiles)){
int num =1;
for (FTPFile file : ftpFiles) {
if (file.isDirectory()) {
LogManage logManage = new LogManage();
logManage.setName(file.getName());
logManage.setOrderNum(num);
logManage.setParentNum(parentNum);
logManage.setPath(filePath +"/"+ file.getName());
list.add(logManage);
num++;
// 需要加此判断否则ftp默认将项目文件所在目录之下的目录./项目文件所在目录向上一级目录下的目录../都纳入递归这样下去就陷入一个死循环了需将其过滤掉
if (!".".equals(file.getName()) && !"..".equals(file.getName())) {
findDirectory(ftp,list,num,filePath +"/"+ file.getName());
ftp.changeToParentDirectory();
}
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return list;
}
/**
* 将当前的文件夹转换成树形结构
* @param logManages
* @return
*/
public List<LogManage> LogManageTree(List<LogManage> logManages){
if (logManages == null) {
return null;
}
List<LogManage> result = new LinkedList<>();
Integer TOP_NODE_ID = 0;
logManages.forEach(logManage -> {
Integer pid = logManage.getParentNum();
if (pid == null || TOP_NODE_ID.equals(pid)) {
result.add(logManage);
return;
}
for (LogManage manage : logManages) {
Integer id = manage.getOrderNum();
if (id != null && id.equals(pid)) {
if (manage.getChildren() == null) {
manage.initChildren();
}
logManage.setHashParent(true);
manage.getChildren().add(logManage);
manage.setHashChild(true);
return;
}
}
});
return result;
return logManageService.findFtpFolders(workPath);
}
/**
@ -151,71 +46,16 @@ public class LogManageController {
@GetMapping("findFiles")
@ApiOperation(value = "查询目录下文件内容", notes = "查询目录下文件内容")
public List<FileInfo> findFiles(String path){
List<FileInfo> result = new ArrayList<>();
try {
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
}
List<String> paths = Arrays.asList(path.split("/"));
if (CollectionUtils.isNotEmpty(paths)){
for (String workPath:paths) {
//切换工作文件路径
ftpClient.changeWorkingDirectory(workPath);
}
}
ftpClient.enterLocalPassiveMode();
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
if (CollectionUtils.isNotEmpty(ftpFiles)){
for (FTPFile ftpFile:ftpFiles) {
if (ftpFile.isFile()){
FileInfo fileInfo = new FileInfo();
fileInfo.setFileName(ftpFile.getName());
fileInfo.setFilePath(path +"/"+ ftpFile.getName());
fileInfo.setFileSize(String.format("%.2f", Double.valueOf(Double.valueOf(ftpFile.getSize())/1024)) + "KB");
fileInfo.setFileDate(DateUtils.formatDate(ftpFile.getTimestamp(),"yyyy-MM-dd"));
result.add(fileInfo);
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return result;
return logManageService.findFiles(path);
}
@PostMapping("downloadFile")
@ApiOperation(value = "ftp文件下载", notes = "ftp文件下载")
public void downloadFile(String localPath, String fileName, HttpServletResponse response) throws IOException {
public void downloadFile(String localPath, String fileName, HttpServletResponse response) {
if (localPath.contains(fileName)){
localPath=localPath.substring(0,localPath.indexOf(fileName)-1);
}
//重置响应信息
response.reset();
//设置响应类型
response.setContentType("application/download");
//解决中文不能生成文件
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(fileName,"UTF-8"));
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
//获取文件的输入流
InputStream in = ftpUtil.downloadFTPFile(localPath, fileName);
//获取输出流
ServletOutputStream out = response.getOutputStream();
//声明一个长度参数
int len;
//声明字节数组
byte[] bytes = new byte[1024];
//判断如果输入流的字节长度不等于-1进行字节数组内容的读取
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
out.flush();
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
ftpUtil.downloadFTPFile(localPath, fileName,response);
}
}

View File

@ -0,0 +1,24 @@
package org.jeecg.modules.service;
import org.jeecg.modules.entity.FileInfo;
import org.jeecg.modules.entity.LogManage;
import java.util.List;
public interface ILogManageService {
/**
* 查询日志文件夹树形结构
* @param workPath
* @return
*/
List<LogManage> findFtpFolders(String workPath);
/**
* 查询目录下文件内容
* @param path
* @return
*/
List<FileInfo> findFiles(String path);
}

View File

@ -0,0 +1,177 @@
package org.jeecg.modules.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.FTPUtil;
import org.jeecg.modules.entity.FileInfo;
import org.jeecg.modules.entity.LogManage;
import org.jeecg.modules.service.ILogManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.*;
@Service("logManageService")
public class LogManageServiceImpl implements ILogManageService {
@Autowired
private FTPUtil ftpUtil;
@Override
public List<LogManage> findFtpFolders(String workPath) {
List<LogManage> result = new ArrayList<>();
try {
FTPClient ftpClient = ftpUtil.LoginFTP();
if(Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
}
//切换工作文件路径
ftpClient.changeWorkingDirectory(workPath);
ftpClient.enterLocalPassiveMode();
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listDirectories());
if (CollectionUtils.isNotEmpty(ftpFiles)){
int num =1;
for (FTPFile ftpFile:ftpFiles) {
LogManage logManage = new LogManage();
logManage.setName(ftpFile.getName());
logManage.setOrderNum(num);
logManage.setParentNum(0);
logManage.setPath(workPath + "/" + ftpFile.getName());
result.add(logManage);
num++;
}
}
if (CollectionUtils.isNotEmpty(result)){
List<LogManage> list = new LinkedList<>();
for (LogManage logManage:result) {
list = this.findDirectory(ftpClient, list, logManage.getOrderNum(), workPath + "/" + logManage.getName());
ftpClient.changeToParentDirectory();
}
result.addAll(list);
}
if (ftpClient != null){
ftpClient.disconnect();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
result = this.LogManageTree(result);
return result;
}
@Override
public List<FileInfo> findFiles(String path) {
List<FileInfo> result = new ArrayList<>();
try {
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
throw new RuntimeException("ftp连接失败!");
}
List<String> paths = Arrays.asList(path.split("/"));
if (CollectionUtils.isNotEmpty(paths)){
for (String workPath:paths) {
//切换工作文件路径
ftpClient.changeWorkingDirectory(workPath);
}
}
ftpClient.enterLocalPassiveMode();
List<FTPFile> ftpFiles = Arrays.asList(ftpClient.listFiles());
if (CollectionUtils.isNotEmpty(ftpFiles)){
for (FTPFile ftpFile:ftpFiles) {
if (ftpFile.isFile()){
FileInfo fileInfo = new FileInfo();
fileInfo.setFileName(ftpFile.getName());
fileInfo.setFilePath(path +"/"+ ftpFile.getName());
fileInfo.setFileSize(String.format("%.2f", Double.valueOf(Double.valueOf(ftpFile.getSize())/1024)) + "KB");
fileInfo.setFileDate(DateUtils.formatDate(ftpFile.getTimestamp(),"yyyy-MM-dd"));
result.add(fileInfo);
}
}
}
if (ftpClient != null){
ftpClient.disconnect();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return result;
}
/**
* 遍历查询当前路径下的文件夹信息
* @param ftp
* @param list
* @param filePath "/"开始和结束
* @return
*/
public List<LogManage> findDirectory(FTPClient ftp,List<LogManage> list,Integer parentNum,String filePath){
try {
if (filePath.indexOf("/")>0){
List<String> paths = Arrays.asList(filePath.split("/"));
for (String path:paths) {
ftp.changeWorkingDirectory(path);
}
}
List<FTPFile> ftpFiles = Arrays.asList(ftp.listDirectories());
if (CollectionUtils.isNotEmpty(ftpFiles)){
int num =1;
for (FTPFile file : ftpFiles) {
if (file.isDirectory()) {
LogManage logManage = new LogManage();
logManage.setName(file.getName());
logManage.setOrderNum(num);
logManage.setParentNum(parentNum);
logManage.setPath(filePath +"/"+ file.getName());
list.add(logManage);
num++;
// 需要加此判断否则ftp默认将项目文件所在目录之下的目录./项目文件所在目录向上一级目录下的目录../都纳入递归这样下去就陷入一个死循环了需将其过滤掉
if (!".".equals(file.getName()) && !"..".equals(file.getName())) {
findDirectory(ftp,list,num,filePath +"/"+ file.getName());
ftp.changeToParentDirectory();
}
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return list;
}
/**
* 将当前的文件夹转换成树形结构
* @param logManages
* @return
*/
public List<LogManage> LogManageTree(List<LogManage> logManages){
if (logManages == null) {
return null;
}
List<LogManage> result = new LinkedList<>();
Integer TOP_NODE_ID = 0;
logManages.forEach(logManage -> {
Integer pid = logManage.getParentNum();
if (pid == null || TOP_NODE_ID.equals(pid)) {
result.add(logManage);
return;
}
for (LogManage manage : logManages) {
Integer id = manage.getOrderNum();
if (id != null && id.equals(pid)) {
if (manage.getChildren() == null) {
manage.initChildren();
}
logManage.setHashParent(true);
manage.getChildren().add(logManage);
manage.setHashChild(true);
return;
}
}
});
return result;
}
}

View File

@ -23,6 +23,11 @@
<artifactId>spatial4j</artifactId>
<version>0.5</version>
</dependency>
<!-- feign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,15 @@
package org.jeecg.common;
import org.springframework.stereotype.Component;
public class CacheName {
public static final String cacheTime = "Cache time";
public static final String scaleInterval = "Scale interval";
public static final String timelineLength = "Timeline length ";
public static final String updateIntervalTime = "Update interval time";
}

View File

@ -25,6 +25,9 @@ public class PointUtil {
}
if (Objects.nonNull(Degrees) || Objects.nonNull(minutes) || Objects.nonNull(seconds)){
Double result = Degrees + minutes/60+seconds/3600;
if (pointValue.indexOf("W")>0 || pointValue.indexOf("S")>0){
result = -1 * result;
}
pointValue = String.valueOf(result);
}
}

View File

@ -13,6 +13,7 @@ import org.jeecg.modules.system.entity.GardsNuclearfacility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@ -38,6 +39,7 @@ public class StationOperationController {
}
@GetMapping("findTree")
@ApiOperation(value = "查询台站树形结构", notes = "查询台站树形结构")
public Result findTree(){
Result result = stationOperationService.findTree();
return result;
@ -50,4 +52,10 @@ public class StationOperationController {
return result;
}
@GetMapping("getDataReceivingStatus")
@ApiOperation(value = "查询台站监测数据信息", notes = "查询台站监测数据信息")
public void getDataReceivingStatus(List<String> stationIds){
stationOperationService.getDataReceivingStatus(stationIds);
}
}

View File

@ -12,6 +12,6 @@ public class StationTree {
private String code;
List<GardsStations> children;
List<Object> children;
}

View File

@ -39,4 +39,10 @@ public class SysUserFocusStation implements Serializable {
@TableField(value = "create_by")
private String createBy;
@TableField(exist = false)
private Double lon;
@TableField(exist = false)
private Double lat;
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,7 @@
<?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.StationMetDataMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?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.StationSampleDataMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?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.StationSohDataMapper">
</mapper>

View File

@ -0,0 +1,21 @@
package org.jeecg.modules.service;
import org.jeecg.modules.system.entity.GardsDetectors;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import java.util.Map;
@Component
@FeignClient(value = "jeecg-system")
public interface ICacheTimeService {
@RequestMapping("/alarmSysUser/findCacheTime")
List<Map<String, String>> findCacheTime();
@RequestMapping("/alarmSysUser/findStationDetectors")
Map<String, List<GardsDetectors>> findStationDetectors(List<String> stationIds);
}

View File

@ -38,4 +38,12 @@ public interface IStationOperationService extends IService<StationOperation> {
* @return
*/
Result getHitEquList(PointVo pointVo);
/**
* 查询台站监测数据
* @param stationIds
* @return
*/
Result getDataReceivingStatus(List<String> stationIds);
}

View File

@ -1,6 +1,7 @@
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.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -8,12 +9,16 @@ import com.spatial4j.core.context.SpatialContext;
import com.spatial4j.core.distance.DistanceUtils;
import com.spatial4j.core.shape.Rectangle;
import io.swagger.models.auth.In;
import org.jeecg.common.CacheName;
import org.jeecg.common.PointUtil;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.Point;
import org.jeecg.modules.entity.PointVo;
import org.jeecg.modules.entity.StationTree;
import org.jeecg.modules.service.ICacheTimeService;
import org.jeecg.modules.system.entity.GardsDetectors;
import org.jeecg.modules.system.entity.GardsNuclearfacility;
import org.jeecg.modules.system.entity.GardsStations;
import org.jeecg.modules.entity.StationOperation;
@ -22,15 +27,20 @@ import org.jeecg.modules.service.IStationOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
@Service("stationOperationService")
@DS("ora")
@DS("ori")
public class StationOperationServiceImpl extends ServiceImpl<StationOperationMapper, StationOperation> implements IStationOperationService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private ICacheTimeService cacheTimeService;
private final SpatialContext spatialContext = SpatialContext.GEO;
@ -49,8 +59,14 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
StationOperation stationOperation = new StationOperation();
stationOperation.setStationId(gardsStation.getStationId());
stationOperation.setStationName(gardsStation.getStationCode());
stationOperation.setStationType("IMS STATION");
stationOperation.setAltitude(Objects.isNull(gardsStation.getElevation())?"":gardsStation.getElevation()+"");
if (gardsStation.getStationId()<=200){
stationOperation.setStationType("IMS STATION(P)");
}else if(gardsStation.getStationId()>200 && gardsStation.getStationId()<=300){
stationOperation.setStationType("IMS STATION(G)");
}else if(gardsStation.getStationId()>300){
stationOperation.setStationType("NRL");
}
stationOperation.setAltitude(Objects.isNull(gardsStation.getElevation())?"":gardsStation.getElevation()+"m");
stationOperation.setLon(String.valueOf(gardsStation.getLon()));
stationOperation.setLat(String.valueOf(gardsStation.getLat()));
stationOperation.setStatus(gardsStation.getStatus());
@ -66,8 +82,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
stationOperation.setStationName(nuclearfacility.getFacilityName());
stationOperation.setStationType("Nuclear Facility");
stationOperation.setAltitude("--");
stationOperation.setLon(PointUtil.calculate(nuclearfacility.getLongitude()));
stationOperation.setLat(PointUtil.calculate(nuclearfacility.getLatitude()));
stationOperation.setLon(PointUtil.calculate(nuclearfacility.getLatitude()));
stationOperation.setLat(PointUtil.calculate(nuclearfacility.getLongitude()));
stationOperation.setStatus(nuclearfacility.getStatus());
result.add(stationOperation);
}
@ -82,7 +98,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
@Override
public Result findInfo(String stationId, String type) {
Result result = new Result();
if (type.equals("IMS STATION")){
if (type.equals("IMS STATION(P)") || type.equals("IMS STATION(G)")){
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
GardsStations stations = stationInfoMap.get(stationId);
if (Objects.nonNull(stations)){
@ -95,8 +111,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
HashMap<String, GardsNuclearfacility> nuclearFacilityMap = (HashMap<String, GardsNuclearfacility>) redisUtil.get("nuclearFacilityMap");
GardsNuclearfacility nuclearfacility = nuclearFacilityMap.get(stationId);
if (Objects.nonNull(nuclearfacility)){
nuclearfacility.setLongitude(PointUtil.calculate(nuclearfacility.getLongitude()));
nuclearfacility.setLatitude(PointUtil.calculate(nuclearfacility.getLatitude()));
nuclearfacility.setLongitude(PointUtil.calculate(nuclearfacility.getLatitude()));
nuclearfacility.setLatitude(PointUtil.calculate(nuclearfacility.getLongitude()));
result.setResult(nuclearfacility);
result.setSuccess(true);
}else {
@ -124,20 +140,45 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
}
if (CollectionUtils.isNotEmpty(gardsStationsList)){
//过滤出所有的台站城市编码
List<String> countryCodes = gardsStationsList.stream().map(GardsStations::getCountryCode).distinct().sorted().collect(Collectors.toList());
for (String countryCode:countryCodes) {
//声明一个数组存储城市编码对应的数组信息
List<GardsStations> stationsList = new LinkedList<>();
StationTree stationTree = new StationTree();
stationTree.setStationId(countryCodes.indexOf(countryCode)+1);
stationTree.setCode(countryCode);
for (GardsStations stations:gardsStationsList) {
if (stations.getCountryCode().equals(countryCode)){
stationsList.add(stations);
List<Object> countryCodes = gardsStationsList.stream().map(GardsStations::getCountryCode).distinct().sorted().collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(countryCodes)){
for (int i=0; i<3; i++){
//树形结构子级 用于存储城市及城市下的台站信息
List<Object> stationChildTreeList = new LinkedList<>();
StationTree stationTree = new StationTree();
stationTree.setStationId(i);
if (i == 0){
stationTree.setCode("Particulate Station");
}else if (i == 1){
stationTree.setCode("Noble Gas Station");
}else if (i == 2){
stationTree.setCode("NRL");
}
for (Object countryCode:countryCodes) {
//用于存储城市下对应的台站信息
List<Object> stations = new LinkedList<>();
String country = String.valueOf(countryCode);
//声明一个数组存储城市编码对应的数组信息
StationTree stationChildTree = new StationTree();
stationChildTree.setStationId(countryCodes.indexOf(countryCode)+1);
stationChildTree.setCode(country);
List<GardsStations> stationsList = gardsStationsList.stream().filter(station-> station.getCountryCode().equals(countryCode)).collect(Collectors.toList());
if (i == 0){
stationsList = stationsList.stream().filter(item-> item.getStationId()<=200).collect(Collectors.toList());
stations.addAll(stationsList);
}else if(i == 1){
stationsList = stationsList.stream().filter(item-> item.getStationId()>200 && item.getStationId()<=300).collect(Collectors.toList());
stations.addAll(stationsList);
}else if(i == 2){
stationsList = stationsList.stream().filter(item-> item.getStationId()>300).collect(Collectors.toList());
stations.addAll(stationsList);
}
stationChildTree.setChildren(stations);
stationChildTreeList.add(stationChildTree);
stationTree.setChildren(stationChildTreeList);
}
stationTreeList.add(stationTree);
}
stationTree.setChildren(stationsList);
stationTreeList.add(stationTree);
}
}
}
@ -177,13 +218,13 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
point.setNuclearFacilityName(facilityInfoValue.getFacilityName());
if (StringUtils.isNotBlank(facilityInfoValue.getLongitude())){
String pointValue = PointUtil.calculate(facilityInfoValue.getLongitude());
facilityInfoValue.setLongitude(pointValue);
point.setLon(pointValue);
facilityInfoValue.setLatitude(pointValue);
point.setLat(pointValue);
}
if (StringUtils.isNotBlank(facilityInfoValue.getLatitude())){
String pointValue = PointUtil.calculate(facilityInfoValue.getLatitude());
facilityInfoValue.setLatitude(pointValue);
point.setLat(pointValue);
facilityInfoValue.setLongitude(pointValue);
point.setLon(pointValue);
}
nuclearPoints.add(point);
}
@ -230,7 +271,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
}
resultList.add(nuclearFacilityPoints);
}
map.put("GIS", stationsList);
map.put("GIS", stationsList.stream().distinct().collect(Collectors.toList()));
map.put("table", resultList);
}
}
@ -239,6 +280,39 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
return result;
}
@Override
public Result getDataReceivingStatus(List<String> stationIds) {
//获取四项缓存数据的对应内容
List<Map<String, String>> cacheList = cacheTimeService.findCacheTime();
String cacheTime = "";
String scaleInterval = "";
String timelineLength = "";
String updateIntervalTime = "";
for (int i=0; i< cacheList.size(); i++){
if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.cacheTime)) ){
cacheTime = cacheList.get(i).get(CacheName.cacheTime);
}else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.scaleInterval)) ){
scaleInterval = cacheList.get(i).get(CacheName.scaleInterval);
}else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.timelineLength)) ){
timelineLength = cacheList.get(i).get(CacheName.timelineLength);
}else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.updateIntervalTime)) ){
updateIntervalTime = cacheList.get(i).get(CacheName.updateIntervalTime);
}
}
//遍历台站id
if (CollectionUtils.isNotEmpty(stationIds)){
//获取当前日期时间 作为结束查询时间
LocalDate endDate = LocalDate.now();
//根据缓存日期 得到开始查询时间
LocalDate startDate = endDate.minusDays(Integer.valueOf(cacheTime));
//根据台站id查询出当前台站下处于运行状态的数据
Map<String, List<GardsDetectors>> stationDetectors = cacheTimeService.findStationDetectors(stationIds);
}
return null;
}
/**
* 获取外接正方形的最大最小经纬度
*

View File

@ -6,32 +6,44 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.entity.SysUser;
import org.jeecg.modules.entity.SysUserFocusStation;
import org.jeecg.modules.mapper.SysUserFocusStationMapper;
import org.jeecg.modules.mapper.SysUserMapper;
import org.jeecg.modules.service.ISysUserFocusStationService;
import org.jeecg.modules.system.entity.GardsStations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
@Service("sysUserFocusStationService")
public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStationMapper, SysUserFocusStation> implements ISysUserFocusStationService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private SysUserMapper sysUserMapper;
@Override
public List<SysUserFocusStation> findList() {
//查询全部台站信息
HashMap<String, Object> stationInfoMap = (HashMap<String, Object>) redisUtil.get("stationInfoMap");
List<SysUserFocusStation> sysUserFocusStations = this.baseMapper.selectList(new LambdaQueryWrapper<>());
if (CollectionUtils.isNotEmpty(sysUserFocusStations)){
sysUserFocusStations.stream().forEach(item->{
if (CollectionUtils.isNotEmpty(stationInfoMap)){
if (Objects.nonNull(stationInfoMap.get(item.getStationId()))){
GardsStations stations = (GardsStations) stationInfoMap.get(item.getStationId());
item.setLon(stations.getLon());
item.setLat(stations.getLat());
}
}
});
return sysUserFocusStations;
}
return Collections.emptyList();

View File

@ -0,0 +1,73 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.jeecg.config.valid.InsertGroup;
import org.jeecg.config.valid.UpdateGroup;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("GARDS_DETECTORS")
public class GardsDetectors implements Serializable {
@TableField(value = "DETECTOR_ID")
private Integer detectorId;
@TableField(value = "DETECTOR_CODE")
private String detectorCode;
@TableField(value = "LON")
private Double lon;
@TableField(value = "LAT")
private Double lat;
@TableField(value = "TYPE")
private String type;
@TableField(value = "CHANNELS")
private Double channels;
@TableField(value = "RATED_EFFICIENCY")
private Double ratedEfficiency;
@TableField(value = "RATED_RESOLUTION")
private Double ratedResolution;
@TableField(value = "ECAL_RANGE_MAX")
private Double ecalRangeMax;
@TableField(value = "DATE_BEGIN")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateBegin;
@TableField(value = "DATE_END")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateEnd;
@TableField(value = "STATUS")
private String status;
@TableField(value = "DESCRIPTION")
private String description;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date moddate;
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(exist = false)
private String stationName;
}

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.service.IAutoService;
@ -22,12 +23,14 @@ public class RadionuclideController {
private IReviewedService reviewedService;
@GetMapping("findAutoPage")
@ApiOperation(value = "分页查询自动处理结果", notes = "分页查询自动处理结果")
public Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds,
@DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return autoService.findAutoPage(queryRequest, stationIds, startTime, endTime);
}
@GetMapping("findReviewedPage")
@ApiOperation(value = "分页查询人工交互结果", notes = "分页查询人工交互结果")
public Result findReviewedPage(QueryRequest queryRequest, Integer[] stationIds,
@DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return reviewedService.findReviewedPage(queryRequest, stationIds, startTime, endTime);

View File

@ -4,9 +4,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsMetData;
import org.jeecg.modules.entity.GardsSampleData;
import org.jeecg.modules.entity.GardsSohData;
import org.jeecg.modules.base.entity.GardsMetData;
import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.base.entity.GardsSohData;
import org.jeecg.modules.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;

View File

@ -1,7 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.GardsMetData;
import org.jeecg.modules.base.entity.GardsMetData;
public interface GardsMetDataMapper extends BaseMapper<GardsMetData> {
}

View File

@ -1,7 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.GardsSampleData;
import org.jeecg.modules.base.entity.GardsSampleData;
public interface GardsSampleDataMapper extends BaseMapper<GardsSampleData> {
}

View File

@ -1,7 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.GardsSohData;
import org.jeecg.modules.base.entity.GardsSohData;
public interface GardsSohDataMapper extends BaseMapper<GardsSohData> {
}

View File

@ -3,7 +3,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsMetData;
import org.jeecg.modules.base.entity.GardsMetData;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;

View File

@ -3,7 +3,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsSampleData;
import org.jeecg.modules.base.entity.GardsSampleData;
import java.util.Date;
import java.util.List;

View File

@ -3,7 +3,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsSohData;
import org.jeecg.modules.base.entity.GardsSohData;
import java.util.Date;
import java.util.List;

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsAnalyses;
import org.jeecg.modules.entity.GardsSampleData;
import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.mapper.GardsAnalysesMapper;
import org.jeecg.modules.service.IAutoService;
import org.jeecg.modules.service.IGardsSampleDataService;

View File

@ -8,7 +8,7 @@ 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.util.DateUtils;
import org.jeecg.modules.entity.GardsMetData;
import org.jeecg.modules.base.entity.GardsMetData;
import org.jeecg.modules.mapper.GardsMetDataMapper;
import org.jeecg.modules.service.IGardsMetDataService;
import org.springframework.format.annotation.DateTimeFormat;

View File

@ -12,7 +12,7 @@ import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.GardsCalibrationPairsOrig;
import org.jeecg.modules.entity.GardsSampleAux;
import org.jeecg.modules.entity.GardsSampleData;
import org.jeecg.modules.base.entity.GardsSampleData;
import org.jeecg.modules.mapper.GardsCalibrationPairsOrigMapper;
import org.jeecg.modules.mapper.GardsSampleAuxMapper;
import org.jeecg.modules.mapper.GardsSampleDataMapper;

View File

@ -10,7 +10,7 @@ import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.GardsSohData;
import org.jeecg.modules.base.entity.GardsSohData;
import org.jeecg.modules.mapper.GardsSohDataMapper;
import org.jeecg.modules.service.IGardsSohDataService;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -17,11 +17,6 @@
<artifactId>jeecg-boot-starter-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-abnormal-alarm</artifactId>

View File

@ -18,11 +18,6 @@
<artifactId>jeecg-boot-starter-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-log-manage</artifactId>

View File

@ -18,11 +18,6 @@
<artifactId>jeecg-boot-starter-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-station-operation</artifactId>

View File

@ -15,4 +15,4 @@ spring:
config:
import:
- optional:nacos:jeecg.yaml
- optional:nacos:jeecg-station-operation-@profile.name@.yaml
- optional:nacos:jeecg-@profile.name@.yaml

View File

@ -0,0 +1,118 @@
package org.jeecg.modules.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.jeecg.modules.system.entity.*;
import org.jeecg.modules.system.mapper.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.apache.commons.collections.CollectionUtils.collect;
@RestController
@RequestMapping("alarmSysUser")
public class AlarmSysUserController {
@Resource
private SysUserMapper sysUserMapper;
@Resource
private SysUserRoleMapper sysUserRoleMapper;
@Resource
private SysRoleMapper sysRoleMapper;
@Resource
private SysDictItemMapper sysDictItemMapper;
@Resource
private GardsDetectorsMapper gardsDetectorsMapper;
@GetMapping("findUserMap")
public Map<String, SysUser> findUserMap(){
Map<String ,SysUser> map = new HashMap<>();
LambdaQueryWrapper<SysUser> userQueryWrapper = new LambdaQueryWrapper<>();
List<SysUser> sysUsers = sysUserMapper.selectList(userQueryWrapper);
LambdaQueryWrapper<SysUserRole> userRoleQueryWrapper = new LambdaQueryWrapper<>();
List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectList(userRoleQueryWrapper);
LambdaQueryWrapper<SysRole> roleQueryWrapper = new LambdaQueryWrapper<>();
List<SysRole> sysRoles = sysRoleMapper.selectList(roleQueryWrapper);
List<SysRole> roles = new LinkedList<>();
//遍历所有用户信息
if (CollectionUtils.isNotEmpty(sysUsers)){
for (SysUser sysUser:sysUsers) {
if (CollectionUtils.isNotEmpty(sysUserRoles)){
//获取各用户匹配的权限集合
List<SysUserRole> userRoles = sysUserRoles.stream().filter(item -> item.getUserId().equals(sysUser.getId())).collect(Collectors.toList());
List<String> roleIds = userRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sysRoles)){
for (SysRole role:sysRoles) {
if (roleIds.contains(role.getId())){
roles.add(role);
}
}
}
sysUser.setRoles(roles);
}
map.put(sysUser.getId(), sysUser);
}
}
return map;
}
@RequestMapping("findCacheTime")
public List<Map<String, String>> findCacheTime(){
LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<>();
List<SysDictItem> sysDictItems = sysDictItemMapper.selectList(queryWrapper);
List<Map<String, String>> result = new LinkedList<>();
//获取缓存时间对应的值
List<SysDictItem> cacheTime = sysDictItems.stream().filter(item -> item.getItemText().equals("Cache time")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(cacheTime)){
Map<String, String> cacheTimeMap = cacheTime.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue));
result.add(cacheTimeMap);
}
//获取实际分度值
List<SysDictItem> scaleInterval = sysDictItems.stream().filter(item -> item.getItemText().equals("Scale interval")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(scaleInterval)){
Map<String, String> scaleIntervalMap = scaleInterval.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue));
result.add(scaleIntervalMap);
}
//获取时间线长度
List<SysDictItem> timelineLength = sysDictItems.stream().filter(item -> item.getItemText().equals("Timeline length")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(timelineLength)){
Map<String, String> timelineLengthMap = timelineLength.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue));
result.add(timelineLengthMap);
}
//获取更新间隔时间
List<SysDictItem> updateIntervalTime = sysDictItems.stream().filter(item -> item.getItemText().equals("Update interval time")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(updateIntervalTime)){
Map<String, String> updateIntervalTimeMap = updateIntervalTime.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue));
result.add(updateIntervalTimeMap);
}
return result;
}
@RequestMapping("findStationDetectors")
@DS("ora")
public Map<String, List<GardsDetectors>> findStationDetectors(List<String> stationIds){
Map<String, List<GardsDetectors>> map = new HashMap<>();
if (CollectionUtils.isNotEmpty(stationIds)){
LambdaQueryWrapper<GardsDetectors> queryWrapper = new LambdaQueryWrapper<>();
List<GardsDetectors> detectorsList = gardsDetectorsMapper.selectList(queryWrapper);
for (String stationId:stationIds) {
List<GardsDetectors> detectors = detectorsList.stream().filter(item -> item.getStationId().equals(stationId) && item.getStatus().equals("Operating")).collect(Collectors.toList());
map.put(stationId, detectors);
}
}
return map;
}
}

View File

@ -18,11 +18,6 @@
<artifactId>jeecg-boot-starter-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-web-statistics</artifactId>