diff --git a/jeecg-boot-base-core/pom.xml b/jeecg-boot-base-core/pom.xml index dd73b651..1e5181eb 100644 --- a/jeecg-boot-base-core/pom.xml +++ b/jeecg-boot-base-core/pom.xml @@ -252,6 +252,11 @@ commons-fileupload commons-fileupload + + + commons-net + commons-net + 3.3 + - \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/EmailConstant.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/EmailConstant.java new file mode 100644 index 00000000..b547a7ee --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/EmailConstant.java @@ -0,0 +1,9 @@ +package org.jeecg.common.constant; + +/** + * 邮件服务常量 + */ +public class EmailConstant { + + public static final String EMAIL_STATUS_PREFIX = "email_status"; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java new file mode 100644 index 00000000..70feb479 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/email/EmailServiceManager.java @@ -0,0 +1,204 @@ +package org.jeecg.common.email; + +import com.google.common.collect.Lists; +import com.sun.mail.imap.IMAPStore; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.email.emuns.MailContentType; +import org.jeecg.modules.base.entity.SysEmail; +import org.jetbrains.annotations.NotNull; +import javax.mail.*; +import javax.mail.internet.MimeUtility; +import java.io.*; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * 邮件服务管理器 + */ +@Slf4j +public class EmailServiceManager { + + private SysEmail email; + /** 邮件接收数量 */ + private Integer receiveNum; + /** smtp协议的存储对象 */ + private IMAPStore store = null; + /** 邮件附件临时存储路径 */ + private String temporaryStoragePath; + /** 收件箱 */ + private Folder folder = null; + + @NotNull + public static EmailServiceManager getInstance(){ + return new EmailServiceManager(); + } + + /** + * 初始化邮件服务管理器 + * @param email 邮件属性 + */ + public void init(SysEmail email){ + this.email = email; + } + + /** + * 初始化邮件服务管理器 + * @param email 邮件属性 + */ + public void init(SysEmail email,Integer receiveNum,String temporaryStoragePath){ + this.email = email; + this.receiveNum = receiveNum; + this.temporaryStoragePath = temporaryStoragePath; + } + + /** + * 测试邮件服务连通性 + */ + public boolean testConnectEmailServer(){ + Socket socket = new Socket(); + boolean flag = false; + try { + socket.connect(new InetSocketAddress(email.getEmailServerAddress(),email.getPort()),5000); + log.info("{}邮件服务连接测试成功",email.getEmailServerAddress()); + flag = true; + } catch (IOException e) { + log.error("{}邮件服务连接测试失败,请检查邮件服务属性配置是否正确或邮件服务未开启,原因{}",email.getEmailServerAddress(),e.getMessage()); + }finally { + try { + if(null != socket){ + socket.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return flag; + } + + /** + * 接收邮件 + */ + public Message[] receiveMail() throws MessagingException { + //配置邮件服务属性 + Properties props = new Properties(); + props.put("mail.store.protocol","imap"); + props.put("mail.imap.host",email.getEmailServerAddress()); + props.put("mail.imap.port",email.getPort()); + //获取邮件回话 + final Session session = Session.getInstance(props, new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(email.getUsername(), email.getPassword()); + } + }); + Map iam = new HashMap<>(); + iam.put("name", "myname"); + iam.put("version", "1.0.0"); + iam.put("vendor", "myclient"); + iam.put("support-email", "testmail@test.com"); + //获取smtp协议的存储对象 + store = (IMAPStore) session.getStore(); + //连接 + store.connect(); + store.id(iam); + //获取收件箱 + folder = store.getFolder("INBOX"); + folder.open(Folder.READ_WRITE); + //获取邮件数量 + final int messageCount = folder.getMessageCount(); + if(messageCount > 0){ + Integer start = 1; + Integer end = this.receiveNum>messageCount?messageCount:this.receiveNum; + final Message[] messages = folder.getMessages(start,end); + return messages; + } + return null; + } + + /** + * 获取邮件内容 + * @param part + * @return + * @throws MessagingException + * @throws IOException + */ + public void getMailContent(@NotNull Part part, StringBuilder content) throws MessagingException, IOException { + Multipart multipart = (Multipart) part.getContent(); + for(int i=0;i saveAttachment(@NotNull Part part) throws MessagingException, IOException { + List filePathList = Lists.newArrayList(); + Multipart multipart = (Multipart) part.getContent(); + for(int i=0;i paths = Arrays.asList(localPath.split("/")); + if (CollectionUtils.isNotEmpty(paths)){ + for (String workPath:paths) { + //切换工作文件路径 + ftpClient.changeWorkingDirectory(workPath); + } + } + ftpClient.enterLocalPassiveMode(); + ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); + // 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项 + ftpClient.setControlEncoding(encoding); + ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE); + List ftpFiles = Arrays.asList(ftpClient.listFiles()); + if (CollectionUtils.isNotEmpty(ftpFiles)){ + for (FTPFile ftpFile:ftpFiles) { + if (ftpFile.getName().equals(fileName)){ + in = ftpClient.retrieveFileStream(new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_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"); + //获取输出流 + 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); + } + } + } + + /** + * 检查目录是否存在,不存在则创建,支持递归创建 + * @param path 目录路径 + * @return 返回值true/false + */ + public boolean checkDirectory(String path) { + final FTPClient ftpClient = this.LoginFTP(); + try { + final boolean flag = this.checkDirectory(ftpClient, path); + return flag; + }catch (IOException e){ + e.printStackTrace(); + return false; + }finally { + try { + ftpClient.disconnect(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 检查目录是否存在,不存在则创建,支持递归创建 + * @param ftpClient FTP客户端 + * @param path 目录路径 + * @return 返回值true/false + * @throws IOException + */ + private boolean checkDirectory(FTPClient ftpClient,String path) throws IOException { + final String rootPath = ftpClient.printWorkingDirectory(); + final boolean changeFlag = ftpClient.changeWorkingDirectory(rootPath); + if(!changeFlag){ + log.error("{},根目录切换失败",rootPath); + return false; + } + String[] directories = path.split("/"); + for(String directory : directories){ + if(StringUtils.isEmpty(directory)){ + continue; + } + if(!ftpClient.changeWorkingDirectory(directory)){ + if(!ftpClient.makeDirectory(directory)){ + log.error("{},目录创建失败",directory); + return false; + } + if(!ftpClient.changeWorkingDirectory(directory)){ + log.error("{},目录切换失败",directory); + return false; + } + } + } + return true; + } + + /** + * 写入文件,若文件或文件目录不存在则自行创建 + * @param filePath 文件路径 + * @param fileName 文件名称 + * @param inputStream 文件输入流 + * @return 返回值true/false + */ + public boolean saveFile(String filePath,String fileName,InputStream inputStream){ + final FTPClient ftpClient = this.LoginFTP(); + try{ + final boolean flag = this.checkDirectory(ftpClient,filePath); + if(flag){ + ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + String encodedName = new String(fileName.getBytes(StandardCharsets.UTF_8),StandardCharsets.ISO_8859_1); + final boolean result = ftpClient.storeFile(encodedName, inputStream); + return result; + } + }catch (IOException e){ + log.error("{}文件创建失败,原因为:{}",filePath+"/"+fileName,e.getMessage()); + e.printStackTrace(); + return false; + }finally { + try { + ftpClient.disconnect(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return false; + } + + /** + * 删除文件 + * @param filePath 文件路径 + * @param fileName 文件名称 + * @return 返回值true/false + */ + public boolean removeFile(String filePath,String fileName){ + final FTPClient ftpClient = this.LoginFTP(); + try { + final String rootPath = ftpClient.printWorkingDirectory(); + final boolean changeFlag = ftpClient.changeWorkingDirectory(rootPath); + if(!changeFlag){ + log.error("{},根目录切换失败",rootPath); + return false; + } + String[] directories = filePath.split("/"); + for(String directory : directories){ + if(StringUtils.isEmpty(directory)){ + continue; + } + if(!ftpClient.changeWorkingDirectory(directory)){ + log.error("此文件目录不存在:{}",filePath); + return false; + } + } + boolean result = ftpClient.deleteFile(new String(fileName.getBytes(StandardCharsets.UTF_8),StandardCharsets.ISO_8859_1)); + if(!result){ + log.error("此文件不存在:{}",filePath+"/"+fileName); + } + return result; + } catch (IOException e) { + log.error("{}文件删除失败,原因为:{}",filePath,e.getMessage()); + e.printStackTrace(); + return false; + }finally { + try { + ftpClient.disconnect(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/InsertGroup.java similarity index 100% rename from jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/InsertGroup.java rename to jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/InsertGroup.java diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/UpdateGroup.java similarity index 100% rename from jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/config/valid/UpdateGroup.java rename to jeecg-boot-base-core/src/main/java/org/jeecg/config/valid/UpdateGroup.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsMetData.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsMetData.java new file mode 100644 index 00000000..54d65a55 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsMetData.java @@ -0,0 +1,100 @@ +package org.jeecg.modules.base.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "gards_met_data") +public class GardsMetData implements Serializable { + + /** + * 台站id + */ + @TableField(value = "STATION_ID") + private Integer stationId; + + /** + * 台站编码 + */ + @TableField(value = "STATION_CODE") + private String stationCode; + + /** + * 气象数据id + */ + @TableField(value = "MET_ID") + private Integer metId; + + /** + * 开始时间 + */ + @TableField(value = "START_TIME") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + /** + * 结束时间 + */ + @TableField(value = "END_TIME") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + /** + * 平均湿度(%) + */ + @TableField(value = "AVE_HUMIDITY") + private Integer aveHumidity; + + /** + * 平均温度(℃) + */ + @TableField(value = "AVGTEMPERATURE") + private Integer avgtemperature; + + /** + * 平均压力(hPa) + */ + @TableField(value = "AVE_PRESSURE") + private Integer avePressure; + + /** + * 平均风向(偏离正北的度数) + */ + @TableField(value = "AVE_WIND_DIR") + private Integer aveWindDir; + + /** + * 平均风速(m/s) + */ + @TableField(value = "AVE_WIND_SPEED") + private Integer aveWindSpeed; + + /** + * 降雨量(mm) + */ + @TableField(value = "RAINFALL") + private Integer rainfall; + + /** + * 文件路径 + */ + @TableField(value = "INPUT_FILE_NAME") + private String inputFileName; + + /** + * 操作时间 + */ + @TableField(value = "MODDATE") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsSampleData.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsSampleData.java similarity index 66% rename from jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsSampleData.java rename to jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsSampleData.java index b641ac6d..41a7a183 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsSampleData.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsSampleData.java @@ -1,4 +1,4 @@ -package org.jeecg.modules.system.entity; +package org.jeecg.modules.base.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; @@ -13,77 +13,147 @@ import java.util.Date; @TableName("GARDS_SAMPLE_DATA") public class GardsSampleData implements Serializable { + /** + * 探测器编码 + */ @TableField(value = "SITE_DET_CODE") private String siteDetCode; + /** + * 样品id + */ @TableField(value = "SAMPLE_ID") private Integer sampleId; + /** + * 台站id + */ @TableField(value = "STATION_ID") private Integer stationId; + /** + * 探测器id + */ @TableField(value = "DETECTOR_ID") private Integer detectorId; + /** + * 导入文件名称 + */ @TableField(value = "INPUT_FILE_NAME") private String inputFileName; + /** + * 系统类型(P : particulate; B :gas with 3-D β-γ coincidence detection; G :all other gas systems (high-resolution + * γ-spectrometry or 2-D β-γ coincidence + * detection)) + */ @TableField(value = "SAMPLE_TYPE") private String sampleType; + /** + * 数据类型(S:SAMPLEPHD + * B:BLANKPHD + * D:DETBKPHD + * G:GASBKPHD + * C:CALIBPHD + * Q:QCPHD) + */ @TableField(value = "DATA_TYPE") private String dataType; + /** + * 几何尺寸 + */ @TableField(value = "GEOMETRY") private String geometry; + /** + * 能谱限定符: 过程谱(PREL) 和 全谱(FULL) + */ @TableField(value = "SPECTRAL_QUALIFIE") private String spectralQualifie; + /** + * 报文发送日期 + */ @TableField(value = "TRANSMIT_DTG") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date transmitDtg; + /** + * 样品采集开始时间 + */ @TableField(value = "COLLECT_START") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date collectStart; + /** + * 样品采集结束时间 + */ @TableField(value = "COLLECT_STOP") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date collectStop; + /** + * 样品测量开始时间 + */ @TableField(value = "ACQUISITION_START") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date acquisitionStart; + /** + * 样品测量结束时间 + */ @TableField(value = "ACQUISITION_STOP") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date acquisitionStop; + /** + * 能谱获取实时间 + */ @TableField(value = "ACQUISITION_REAL_SEC") private Double acquisitionRealSec; + /** + * 能谱获取活时间 + */ @TableField(value = "ACQUISITION_LIVE_SEC") private Double acquisitionLiveSec; + /** + * 采样量(立方米) + */ @TableField(value = "QUANTITY") private Double quantity; + /** + * 样品处理状态 + */ @TableField(value = "STATUS") private String status; + /** + * 操作时间 + */ @TableField(value = "MODDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date moddate; + /** + * 台站名称 + */ @TableField(exist = false) private String stationName; + /** + * 探测器名称 + */ @TableField(exist = false) private String detectorsName; diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsSohData.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsSohData.java new file mode 100644 index 00000000..d05b83ed --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/GardsSohData.java @@ -0,0 +1,90 @@ +package org.jeecg.modules.base.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "gards_soh_data") +public class GardsSohData implements Serializable { + + /** + * 台站ID号 + */ + @TableField(value = "STATION_ID") + private Integer stationId; + + /** + * 台站代码 + */ + @TableField(value = "STATION_CODE") + private String stationCode; + + /** + * 报警ID号 + */ + @TableField(value = "SOH_ID") + private Integer sohId; + + /** + * 状态数据采集开始时间 + */ + @TableField(value = "START_TIME") + private Date startTime; + + /** + * 时间间隔长度(秒) + */ + @TableField(value = "TIME") + private Integer time; + + /** + * 采样流速均值(scm/h) + */ + @TableField(value = "AVGFLOWRATE") + private Integer avgflowrate; + + /** + * 采样流速偏差(scm/h) + */ + @TableField(value = "FLOWRATEDEV") + private Integer flowratedev; + + /** + * 文件路径 + */ + @TableField(value = "INPUT_FILE_NAME") + private String inputFileName; + + /** + * 探测器id + */ + @TableField(value = "DETECTOR_ID") + private Integer detectorId; + + /** + * 操作时间 + */ + @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 detectorName; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmail.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmail.java new file mode 100644 index 00000000..72a9e2fe --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmail.java @@ -0,0 +1,95 @@ +package org.jeecg.modules.base.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.Date; + +/** + * 邮件管理数据表 + */ +@Data +@TableName(value = "sys_email") +public class SysEmail implements Serializable { + + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * email服务地址 + */ + @TableField(value = "email_server_address") + private String emailServerAddress; + + /** + * 邮箱类型(1-收件地址,2-发件地址) + */ + @TableField(value = "emil_type") + private Integer emilType; + + /** + * 邮箱登录名称 + */ + @TableField(value = "username") + private String username; + + /** + * 邮箱登录密码 + */ + @TableField(value = "password") + private String password; + + /** + * 端口 + */ + @TableField(value = "port") + private Integer port; + + /** + * 是否启用邮箱(0-不启用,1-启用) + */ + @TableField(value = "enabled") + private Integer enabled; + + /** + * 定时获取邮件时间周期(秒) + */ + @TableField(value = "receive_mail_fixed_cycle") + private Integer receiveMailFixedCycle; + + /** + * 创建日期 + */ + @TableField(value = "create_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate createTime; + + /** + * 创建人员 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 修改日期 + */ + @TableField(value = "update_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate updateTime; + + /** + * 修改人员 + */ + @TableField(value = "update_by") + private String updateBy; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java new file mode 100644 index 00000000..d297cda9 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/SysEmailLog.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.base.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 邮件接收日志数据表 + */ +@Data +@TableName(value = "sys_email_log") +public class SysEmailLog implements Serializable { + + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 邮件id + */ + @TableField(value = "email_id") + private String emailId; + + /** + * 邮件主题 + */ + @TableField(value = "subject") + private String subject; + + /** + * 邮件内容 + */ + @TableField(value = "context") + private String context; + + /** + * 接收时间 + */ + @TableField(value = "receive_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date receiveTime; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/struct/EnergySpectrumStruct.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/struct/EnergySpectrumStruct.java new file mode 100644 index 00000000..dfa92128 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/struct/EnergySpectrumStruct.java @@ -0,0 +1,363 @@ +package org.jeecg.modules.base.struct; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 能谱结构体字段信息 + */ +@Data +public class EnergySpectrumStruct implements Serializable { + + /************************* Infomations ******************/ + /** + * 消息类型 + */ + private String msg_type; + /** + * 消息id + */ + private String msg_id; + /** + * 数据类型 + */ + private String data_type; + + /************************* Header Black ******************/ + /** + * designator + */ + private String designator; + /** + * site code + */ + private String site_code; + /** + * detector code + */ + private String detector_code; + /** + * system type: P for particulate; B for gas with 3-D β - γ coincidence detection; and + */ + private String system_type; + /** + * sample geometry + */ + private String sample_geometry; + /** + * spectrum qualifier: preliminary ( PREL )or full ( FULL) + */ + private String spectrum_quantity; + /** + * sample reference identification + */ + private String sample_ref_id; + /** + * measurement identification + */ + private String measurement_id; + /** + * detector background measurement identification + */ + private String detector_bk_measurement_id; + /** + * gas background measurement identification (memory effect) + */ + private String gas_bk_measurement_id; + /** + * transmit date (yyyy / mm / dd) + */ + private String transmit_date; + /** + * transmit time (hh : mm : ss . s) + */ + private String transmit_time; + + /************************* Comment ******************/ + private String comment; + + /************************* Acquisition Block ******************/ + /** + * acquisition start date (yyyy / mm / dd) + */ + private String acquisition_start_date; + /** + * acquisition start time (hh : mm : ss . s) + */ + private String acquisition_start_time; + /** + * acquisition real time (s) + */ + private Double acquisition_real_time; + /** + * acquisition live time (s) + */ + private Double acquisition_live_time; + + /************************* Collection Block ******************/ + + /** + * collection start date (yyyy / mm / dd) + */ + private String collection_start_date; + /** + * collection start time (hh : mm : ss . s) + */ + private String collection_start_time; + /** + * collection stop date (yyyy / mm / dd) + */ + private String collection_stop_date; + /** + * collection stop time (hh : mm : ss . s) + */ + private String collection_stop_time; + /** + * total air volume sampled (standard cubic meters [scm]) + */ + private Double air_volume; + + /************************* Processing Block ******************/ + /** + * sample volume of Xe (cm 3 ) + */ + private Double sample_volume_of_Xe; + /** + * uncertainty (cm 3 ) + */ + private Double uncertainty_1; + /** + * Xe collection yield (Xe gas in sample/total Xe gas sampled) + */ + private Double Xe_collection_yield; + /** + * uncertainty (Xe gas in sample/total Xe gas sampled) + */ + private Double uncertainty_2; + /** + * archive bottle identification + */ + private String archive_bottle_id; + + /************************* Calibration Block ******************/ + /** + * date of last calibration (yyyy / mm / dd) + */ + private String date_calibration; + /** + * time of last calibration (hh : mm : ss) + */ + private String time_calibration; + + /************************* g_Energy Block ******************/ + /** + * γ -energy (keV) + */ + private List g_energy; + /** + * centroid channel + */ + private List g_centroid_channel; + /** + * uncertainty (channels) + */ + private List g_uncertainty; + + private Integer g_record_count; + + /************************* b_Energy Block ******************/ + /** + * electron energy (keV) + */ + private List b_electron_energy; + /** + * decay mode descriptor: B for β-particle, C for conversion electron (CE) + */ + private List b_decay_mode; + /** + * maximum channel of β-particle distribution or centroid channel of CE (channels) + */ + private List b_channel; + /** + * uncertainty (channels) + */ + private List b_uncertainty; + + private Integer b_record_count; + + /************************* g_Resolution Block ******************/ + /** + * γ -energy (keV) + */ + private List g_r_energy; + /** + * FWHM (keV) + */ + private List g_r_FWHM; + /** + * uncertainty (keV) + */ + private List g_r_uncertainty; + + private Integer g_r_record_count; + + /************************* b_Resolution Block ******************/ + /** + * electron energy (keV) + */ + private List b_r_electron_energy; + /** + * FWHM (keV) + */ + private List b_r_FWHM; + /** + * uncertainty (keV) + */ + private List b_r_uncertainty; + + private Integer b_r_record_count; + + /************************* g_Efficiency Block ******************/ + /** + * γ -energy (keV) + */ + private List g_e_energy; + /** + * efficiency (counts in peak/photon emitted) + */ + private List g_e_efficiency; + /** + * uncertainty (counts in peak/photon emitted) + */ + private List g_e_uncertainty; + + private Integer g_e_record_count; + + /************************* ROI_Limits Block ******************/ + /** + * ROI number + */ + private List ROI_number; + /** + * 2-D ROI β-range start, x 1 (keV) + */ + private List POI_B_x1; + /** + * 2-D ROI β-range stop, x 2 (keV) + */ + private List POI_B_x2; + /** + * 2-D ROI γ-range start, y 1 (keV) + */ + private List POI_G_y1; + /** + * 2-D ROI γ-range stop, y 2 (keV) + */ + private List POI_G_y2; + + private Integer roi_record_count; + + /************************* b-gEfficiency Block ******************/ + /** + * nuclide name + */ + private List bg_nuclide_name; + /** + * ROI number + */ + private List bg_ROI_number; + /** + * β-γ coincidence efficiency (counts in ROI/β-γ pair emitted) + */ + private List bg_efficiency; + /** + * uncertainty (counts in ROI/β-γ pair emitted) + */ + private List bg_uncertainty; + + private Integer bg_record_count; + + /************************* Ratios Block ******************/ + /** + * ratio identifier + */ + private List ratio_id; + /** + * ROI number for the higher γ -energy ROI + */ + private List ROI_num_highter_G_energy_ROI; + /** + * ROI number for the lower γ -energy ROI + */ + private List ROI_num_lower_G_energy_ROI; + /** + * Q_DECLARE_METATYPE(RMSSOHData::HeaderBlock)count ratio(counts in higher γ -energy ROI/counts in lower γ -energy ROI) + */ + private List count_ratio; + /** + * count ratio uncertainty (percent) + */ + private List count_ratio_uncertainty; + + private Integer ratio_record_count; + + /************************* g_Spectrum Block ******************/ + /** + * number of γ channels + */ + private Long num_g_channel; + /** + * γ-energy span (keV) + */ + private Long g_energy_span; + /** + * begin of channels + */ + private Long g_begin_channel; + /** + * count at channel + */ + private List g_counts; + + /************************* b_Spectrum Block ******************/ + /** + * number of β -channels + */ + private Long num_b_channel; + /** + * β -energy span (keV) + */ + private Long b_energy_span; + /** + * begin of channels + */ + private Long b_begin_channel; + /** + * counts at channels + */ + private List b_counts; + + /************************* Histogram Block ******************/ + /** + * β-channels + */ + private Long b_channels; + /** + * γ-channels + */ + private Long g_channels; + /** + * β-energy span + */ + private Long b_h_energy_span; + /** + * γ-energy span + */ + private Long g_h_energy_span; + /** + * counts at channels + */ + private List h_counts; +} diff --git a/jeecg-module-abnormal-alarm/pom.xml b/jeecg-module-abnormal-alarm/pom.xml new file mode 100644 index 00000000..738e3429 --- /dev/null +++ b/jeecg-module-abnormal-alarm/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-boot-parent + 3.5.1 + + + jeecg-module-abnormal-alarm + + + 5.8.19 + + + + + + org.jeecgframework.boot + jeecg-system-cloud-api + + + + org.jeecgframework.boot + jeecg-boot-base-core + + + + org.jeecgframework.boot + jeecg-boot-starter-cloud + + + + \ No newline at end of file diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java new file mode 100644 index 00000000..0d2981dc --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java @@ -0,0 +1,48 @@ +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; +import org.jeecg.modules.service.IAlarmContactGroupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("alarmContactGroup") +public class AlarmContactGroupController { + + @Autowired + 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 findInfo(String id){ + return alarmContactGroupService.findInfo(id); + } + + @PostMapping("create") + @ApiOperation(value = "新增报警人联系人组", notes = "新增报警联系人组") + public Result create(@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); + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmLogController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmLogController.java new file mode 100644 index 00000000..bc5d7bee --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmLogController.java @@ -0,0 +1,85 @@ +package org.jeecg.modules.controller; + +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.api.QueryRequest; +import org.jeecg.common.api.dto.message.MessageDTO; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.enums.MessageTypeEnum; +import org.jeecg.common.system.api.ISysBaseAPI; +import org.jeecg.modules.entity.AlarmLog; +import org.jeecg.modules.service.IAlarmLogService; +import org.jeecg.modules.vo.AlarmVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("alarmLog") +public class AlarmLogController { + + @Autowired + private IAlarmLogService alarmLogService; + + @Autowired + private ISysBaseAPI sysBaseAPI; + + @ApiOperation("报警日志量总览-柱状图") + @PostMapping("viewAll") + public Result viewAll(@RequestBody AlarmVo alarmVo){ return alarmLogService.viewAll(alarmVo); } + @ApiOperation("分页查询报警日志信息") + @PostMapping("findPage") + public Result findPage(@RequestBody AlarmVo alarmVo){ + return alarmLogService.findPage(alarmVo); + } + @ApiOperation("各类型报警量统计-饼图") + @PostMapping("typeAlarms") + public Result typeAlarms(@RequestBody AlarmVo alarmVo){ + return alarmLogService.typeAlarms(alarmVo); + } + @ApiOperation("报警规则top5-柱状图") + @PostMapping("ruleTop") + public Result ruleTop5(@RequestBody AlarmVo alarmVo){ + return alarmLogService.ruleTop5(alarmVo); + } + + @GetMapping("findInfo") + @ApiOperation(value = "查询报警日志信息详情", notes = "查询报警日志信息详情") + public Result findInfo(String id){ + return alarmLogService.findInfo(id); + } + + @PostMapping("create") + @ApiOperation(value = "新增报警日志", notes = "新增报警日志") + public Result create(@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); + } + + @GetMapping("test") + public void test(){ + MessageDTO message = new MessageDTO(); + message.setFromUser("admin"); + message.setToUser("nieziyan"); + message.setTitle("测试消息"); + message.setType(MessageTypeEnum.XT.getType()); + message.setTemplateCode("SYS001"); + Map data = new HashMap<>(); + data.put("userName","聂子炎"); + data.put("taskName","请假申请"); + message.setData(data); + sysBaseAPI.sendTemplateMessage(message); + } +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmRuleController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmRuleController.java new file mode 100644 index 00000000..7b49f9a8 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmRuleController.java @@ -0,0 +1,51 @@ +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 +@RequestMapping("alarmRule") +@Api(value = "报警规则管理", tags = "报警规则管理") +public class AlarmRuleController { + + @Autowired + 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 findInfo(String id){ + return alarmRuleService.findInfo(id); + } + + @PostMapping("create") + @ApiOperation(value = "新增规则信息", notes = "新增规则信息") + public Result create(@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); + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysDatabaseController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysDatabaseController.java new file mode 100644 index 00000000..b98a6045 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysDatabaseController.java @@ -0,0 +1,61 @@ +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 = "数据库配置管理") +public class SysDatabaseController { + + @Autowired + 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); + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysEmailController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysEmailController.java new file mode 100644 index 00000000..cc5bc3fa --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysEmailController.java @@ -0,0 +1,60 @@ +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.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 = "邮箱配置信息管理") +public class SysEmailController { + + @Autowired + private ISysEmailService sysEmailService; + + @GetMapping("findPage") + @ApiOperation(value = "分页查询邮箱配置信息", notes = "分页查询邮箱配置信息") + public Result findPage(QueryRequest queryRequest, SysEmail sysEmail){ + return sysEmailService.findPage(queryRequest, sysEmail); + } + + @GetMapping("findInfo") + @ApiOperation(value = "查询邮箱配置信息详情", notes = "查询邮箱配置信息详情") + public Result findInfo(String id){ + return sysEmailService.findInfo(id); + } + + @PostMapping("create") + @ApiOperation(value = "新增邮箱配置信息", notes = "新增邮箱配置信息") + public Result create(@RequestBody SysEmail sysEmail){ + return sysEmailService.create(sysEmail); + } + + @PutMapping("update") + @ApiOperation(value = "修改邮箱配置信息", notes = "修改邮箱配置信息") + public Result update(@RequestBody SysEmail sysEmail){ + return sysEmailService.update(sysEmail); + } + + @DeleteMapping("deleteById") + @ApiOperation(value = "删除邮箱配置信息", notes = "删除邮箱配置信息") + public Result deleteById(String id){ + 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); + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysEmailLogController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysEmailLogController.java new file mode 100644 index 00000000..8809fb5b --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysEmailLogController.java @@ -0,0 +1,200 @@ +package org.jeecg.modules.controller; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.EmailConstant; +import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.base.entity.SysEmailLog; +import org.jeecg.modules.service.ISysEmailLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("sysEmailLog") +@Api(value = "邮箱日志", tags = "邮箱日志") +public class SysEmailLogController { + @Autowired + private ISysEmailLogService sysEmailLogService; + + @Autowired + private RedisUtil redisUtil; + + /** + * 邮箱服务器连接状态 正常/断开 + * + * @param emailId 电子邮件id + */ + @GetMapping("status") + public Result status(@RequestParam("emailId") String emailId){ + String key = EmailConstant.EMAIL_STATUS_PREFIX; + Boolean emailSatus = (Boolean) redisUtil.hget(key, emailId); + return Result.OK(emailSatus == null ? false : emailSatus); + } + + @GetMapping("space") + public Result space(@RequestParam("emailId") String emailId){ + return null; + } + + /** + * 分别获取今天、昨天、过去一周邮件量 + * + * @param emailId 电子邮件id + */ + @GetMapping("total") + public Result totalEmail(@RequestParam("emailId") String emailId){ + // 当日邮件量 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysEmailLog::getEmailId,emailId); + LocalDate today = LocalDate.now(); + String todayStart = today + " 00:00:00"; + String todayEnd = today + " 23:59:59"; + wrapper.between(SysEmailLog::getReceiveTime,todayStart,todayEnd); + Long todayCount = sysEmailLogService.count(wrapper); + // 昨日邮件量 + wrapper.clear(); + wrapper.eq(SysEmailLog::getEmailId,emailId); + LocalDate yesterday = LocalDate.now().minusDays(1); + String yesterdayStart = yesterday + " 00:00:00"; + String yesterdayEnd = yesterday + " 23:59:59"; + wrapper.between(SysEmailLog::getReceiveTime,yesterdayStart,yesterdayEnd); + Long yesterdayCount = sysEmailLogService.count(wrapper); + // 过去一周邮件量 + wrapper.clear(); + wrapper.eq(SysEmailLog::getEmailId,emailId); + LocalDate passWeek = LocalDate.now().minusWeeks(1); + String weekStart = passWeek + " 00:00:00"; + wrapper.between(SysEmailLog::getReceiveTime,weekStart,todayEnd); + Long weekCount = sysEmailLogService.count(wrapper); + + Map result = new HashMap<>(); + result.put("today",todayCount); + result.put("yesterday",yesterdayCount); + result.put("week",weekCount); + return Result.OK(result); + } + + /** + * 今天邮件接收量 按小时划分 + * + * @param emailId 电子邮件id + */ + @GetMapping("today") + public Result today(@RequestParam("emailId") String emailId){ + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysEmailLog::getEmailId,emailId); + LocalDate today = LocalDate.now(); + String todayStart = today + " 00:00:00"; + String todayEnd = today + " 23:59:59"; + wrapper.between(SysEmailLog::getReceiveTime,todayStart,todayEnd); + List emailLogs = sysEmailLogService.list(wrapper); + // 将Date转换为LocalDateTime + List allDate = emailLogs.stream() + .map(SysEmailLog::getReceiveTime) + .collect(Collectors.toList()); + List allTime = allDate.stream() + .map(item -> { + ZoneId zoneId = ZoneId.systemDefault(); + return item.toInstant() + .atZone(zoneId) + .toLocalDateTime(); + }) + .collect(Collectors.toList()); + // 按照小时分组 + Map statistic = new TreeMap<>(); + Map> groupTime = allTime.stream() + .collect(Collectors.groupingBy(LocalDateTime::getHour)); + for (int i = 0; i < 24; i++) { + if(groupTime.containsKey(i)){ + Integer count = groupTime.get(i).size(); + statistic.put(timeStr(i),count); + }else { + statistic.put(timeStr(i),0); + } + } + return Result.OK(statistic); + } + + /** + * 根据日期筛选(折线图) + * + * @param emailId 电子邮件id + */ + @GetMapping("analysis") + public Result analysis(@RequestParam("emailId") String emailId, + @RequestParam("startDate") String startDate, + @RequestParam("endDate") String endDate){ + String startStr = startDate + " 00:00:00"; + String endStr = endDate + " 23:59:59"; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysEmailLog::getEmailId,emailId); + wrapper.between(SysEmailLog::getReceiveTime,startStr,endStr); + Set xData = new HashSet<>(); + Collection yData = new ArrayList<>(); + Map statistic = new TreeMap<>(); + Map result = new HashMap<>(); + List allDate = sysEmailLogService.listObjs(wrapper, + emailLog -> ((SysEmailLog) emailLog).getReceiveTime()); + // 将Date转换为LocalDateTime + List allTime = allDate.stream() + .map(item -> { + ZoneId zoneId = ZoneId.systemDefault(); + return item.toInstant() + .atZone(zoneId) + .toLocalDateTime(); + }) + .collect(Collectors.toList()); + if (CollUtil.isEmpty(allDate)){ + result.put("xData",xData); + result.put("yData",yData); + return Result.OK(result); + } + + /* 支持跨年跨月选择 */ + // 通过年月日进行分组 例:2023-06-06 + DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE; + Map> group = allTime.stream() + .collect(Collectors.groupingBy(datetime -> datetime.format(formatter))); + + // 列举出startDate-endDate中所有日期(包括闰年) + // 没有邮件的日期,对应的值设置为0 + LocalDate start = LocalDate.parse(startDate); + LocalDate end = LocalDate.parse(endDate); + while (!start.isAfter(end)) { + String key = start.format(formatter); + if (group.containsKey(key)){ + Integer count = group.get(key).size(); + statistic.put(key,count); + }else { + statistic.put(key,0); + } + start = start.plusDays(1); + } + // 返回结果 + xData = statistic.keySet(); + yData = statistic.values(); + result.put("xData",xData); + result.put("yData",yData); + return Result.OK(result); + } + + private String timeStr(Integer time){ + if (time < 10){ + return "0" + time + ":00"; + } + return time + ":00"; + } +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysServerController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysServerController.java new file mode 100644 index 00000000..73e45938 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/SysServerController.java @@ -0,0 +1,60 @@ +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.SysServer; +import org.jeecg.modules.service.ISysServerService; +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("sysServer") +@Api(value = "服务器配置信息管理", tags = "服务器配置信息管理") +public class SysServerController { + + @Autowired + private ISysServerService sysServerService; + + @GetMapping("findPage") + @ApiOperation(value = "分页查询服务器数据", notes = "分页查询服务器数据") + public Result findPage(QueryRequest queryRequest, SysServer sysServer){ + return sysServerService.findPage(queryRequest, sysServer); + } + + @GetMapping("findInfo") + @ApiOperation(value = "服务器数据详情信息", notes = "服务器数据详情信息") + public Result findInfo(String id){ + return sysServerService.findInfo(id); + } + + @PostMapping("create") + @ApiOperation(value = "新增服务器数据信息", notes = "新增服务器数据信息") + public Result create(@RequestBody SysServer sysServer){ + return sysServerService.create(sysServer); + } + + @PutMapping("update") + @ApiOperation(value = "修改服务器数据信息", notes = "修改服务器数据信息") + public Result update(@RequestBody SysServer sysServer){ + return sysServerService.update(sysServer); + } + + @DeleteMapping("deleteById") + @ApiOperation(value = "删除服务器数据信息", notes = "删除服务器数据信息") + public Result deleteById(String id){ + return sysServerService.deleteById(id); + } + + @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); + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/dto/TypeDto.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/dto/TypeDto.java new file mode 100644 index 00000000..0705453d --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/dto/TypeDto.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.dto; + +import lombok.Data; + +@Data +public class TypeDto { + // 1.资源类型 Server|Database|Email + // 2.规则名 + private String name; + // 1.报警量 + // 2.规则使用量 + private Integer value; +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmContactGroup.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmContactGroup.java new file mode 100644 index 00000000..f5e6cc38 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmContactGroup.java @@ -0,0 +1,83 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + +@Data +@TableName(value = "alarm_contact_group") +public class AlarmContactGroup implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 联系人组名称 + */ + @TableField(value = "name") + private String name; + + /** + * 联系人组描述 + */ + @TableField(value = "description") + private String description; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate createTime; + + /** + * 创建人 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 修改时间 + */ + @TableField(value = "update_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate updateTime; + + /** + * 修改人 + */ + @TableField(value = "update_by") + private String updateBy; + + /** + * 联系人组关联的用户id + */ + @TableField(exist = false) + List userIds; + + /** + * 联系人组关联的用户集合 + */ + @TableField(exist = false) + List users; + + /** + * 当前联系人组人员数量 + */ + @TableField(exist = false) + Integer personNumber; + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmContactGroupMember.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmContactGroupMember.java new file mode 100644 index 00000000..b236c9c9 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmContactGroupMember.java @@ -0,0 +1,33 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +@Data +@TableName(value = "alarm_contact_group_member") +public class AlarmContactGroupMember implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 联系人组id + */ + @TableField(value = "group_id") + private String groupId; + + /** + * 用户id + */ + @TableField(value = "user_id") + private String userId; + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmHistory.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmHistory.java new file mode 100644 index 00000000..46e3e173 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmHistory.java @@ -0,0 +1,38 @@ +package org.jeecg.modules.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +@Data +public class AlarmHistory { + + /** + * 名称 + */ + private String name; + + /** + * 报警开始时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate alarmStartDate; + + /** + * 报警详情 + */ + private String alarmInfo; + + /** + * 规则信息 + */ + private String operator; + + /** + * 来源类型 + */ + private String sourceType; +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmLog.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmLog.java new file mode 100644 index 00000000..5111fd21 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmLog.java @@ -0,0 +1,44 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName(value = "alarm_log") +public class AlarmLog implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 规则id + */ + @TableField(value = "rule_id") + private String ruleId; + + /** + * 报警开始时间 + */ + @TableField(value = "alarm_start_date") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime alarmStartDate; + + /** + * 报警详情 + */ + @TableField(value = "alarm_info") + private String alarmInfo; + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmRule.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmRule.java new file mode 100644 index 00000000..9c5f8d37 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/AlarmRule.java @@ -0,0 +1,100 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; + +@Data +@TableName(value = "alarm_rule") +public class AlarmRule implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 名称 + */ + @TableField(value = "name") + private String name; + + /** + * 规则信息 + */ + @TableField(value = "operator") + private String operator; + + /** + * 沉默周期,单位为秒 + */ + @TableField(value = "silence_cycle") + private Integer silenceCycle; + + /** + * 报警通知方式,如短信、邮件等 + */ + @TableField(value = "notification") + private String notification; + + /** + * 是否启用该报警规则(0-未启用,1-启用) + */ + @TableField(value = "enabled") + private Integer enabled; + + /** + * 报警联系人组id + */ + @TableField(value = "contact_id") + private String contactId; + + /** + * 资源id + */ + @TableField(value = "source_id") + private String sourceId; + + /** + * 资源类型 + */ + @TableField(value = "source_type") + private String sourceType; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate createTime; + + /** + * 创建人 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 修改时间 + */ + @TableField(value = "update_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate updateTime; + + /** + * 修改人 + */ + @TableField(value = "update_by") + private String updateBy; + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysDatabase.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysDatabase.java new file mode 100644 index 00000000..68fc51fd --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysDatabase.java @@ -0,0 +1,94 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; + +@Data +@TableName(value = "sys_database") +public class SysDatabase implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 名称 + */ + @TableField(value = "name") + private String name; + + /** + * 状态(0-断开连接,1-连接成功) + */ + @TableField(value = "status") + private Integer status; + + /** + * ip地址 + */ + @TableField(value = "ip_address") + private String ipAddress; + + /** + * 端口 + */ + @TableField(value = "port") + private String port; + + /** + * 用户名称 + */ + @TableField(value = "username") + private String username; + + /** + * 密码 + */ + @TableField(value = "password") + private String password; + + /** + * 数据库类型 + */ + @TableField(value = "type") + private String type; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate createTime; + + /** + * 创建人 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 修改时间 + */ + @TableField(value = "update_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate updateTime; + + /** + * 修改人 + */ + @TableField(value = "update_by") + private String updateBy; + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysRole.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysRole.java new file mode 100644 index 00000000..2e78e250 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysRole.java @@ -0,0 +1,80 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +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; + +/** + *

+ * 角色表 + *

+ * + * @Author scott + * @since 2018-12-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class SysRole implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + private String id; + + /** + * 角色名称 + */ + @Excel(name="角色名",width=15) + private String roleName; + + /** + * 角色编码 + */ + @Excel(name="角色编码",width=15) + private String roleCode; + + /** + * 描述 + */ + @Excel(name="描述",width=60) + private String description; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /**租户ID*/ + private Integer tenantId; +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysServer.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysServer.java new file mode 100644 index 00000000..ad4c7267 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysServer.java @@ -0,0 +1,70 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; + +@Data +@TableName(value = "sys_server") +public class SysServer implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 名称 + */ + @TableField(value = "name") + private String name; + + /** + * 状态(0-停机,1-正常,2-故障) + */ + @TableField(value = "status") + private Integer status; + + /** + * ip地址 + */ + @TableField(value = "ip_address") + private String ipAddress; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate createTime; + + /** + * 创建人 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 修改时间 + */ + @TableField(value = "update_time") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate updateTime; + + /** + * 修改人 + */ + @TableField(value = "update_by") + private String updateBy; + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysUser.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysUser.java new file mode 100644 index 00000000..3db925de --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/entity/SysUser.java @@ -0,0 +1,208 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * 用户表 + *

+ * + * @Author scott + * @since 2018-12-20 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class SysUser implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + private String id; + + /** + * 登录账号 + */ + @Excel(name = "登录账号", width = 15) + private String username; + + /** + * 真实姓名 + */ + @Excel(name = "真实姓名", width = 15) + private String realname; + + /** + * 密码 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String password; + + /** + * md5密码盐 + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String salt; + + /** + * 头像 + */ + @Excel(name = "头像", width = 15,type = 2) + private String avatar; + + /** + * 生日 + */ + @Excel(name = "生日", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date birthday; + + /** + * 性别(1:男 2:女) + */ + @Excel(name = "性别", width = 15,dicCode="sex") + @Dict(dicCode = "sex") + private Integer sex; + + /** + * 电子邮件 + */ + @Excel(name = "电子邮件", width = 15) + private String email; + + /** + * 电话 + */ + @Excel(name = "电话", width = 15) + private String phone; + + /** + * 登录选择部门编码 + */ + private String orgCode; + /** + * 登录选择租户ID + */ + private Integer loginTenantId; + + /**部门名称*/ + private transient String orgCodeTxt; + + /** + * 状态(1:正常 2:冻结 ) + */ + @Excel(name = "状态", width = 15,dicCode="user_status") + @Dict(dicCode = "user_status") + private Integer status; + + /** + * 删除状态(0,正常,1已删除) + */ + @Excel(name = "删除状态", width = 15,dicCode="del_flag") + @TableLogic + private Integer delFlag; + + /** + * 工号,唯一键 + */ + @Excel(name = "工号", width = 15) + private String workNo; + + /** + * 职务,关联职务表 + */ + @Excel(name = "职务", width = 15) + @Dict(dictTable ="sys_position",dicText = "name",dicCode = "code") + private String post; + + /** + * 座机号 + */ + @Excel(name = "座机号", width = 15) + private String telephone; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + /** + * 同步工作流引擎1同步0不同步 + */ + private Integer activitiSync; + + /** + * 身份(0 普通成员 1 上级) + */ + @Excel(name="(1普通成员 2上级)",width = 15) + private Integer userIdentity; + + /** + * 负责部门 + */ + @Excel(name="负责部门",width = 15,dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") + @Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") + private String departIds; + + /** + * 多租户ids临时用,不持久化数据库(数据库字段不存在) + */ + @TableField(exist = false) + private String relTenantIds; + + /**设备id uniapp推送用*/ + private String clientId; + + /** + * 登录首页地址 + */ + @TableField(exist = false) + private String homePath; + + /** + * 职位名称 + */ + @TableField(exist = false) + private String postText; + + @TableField(exist = false) + private List roles; + + /** + * 流程状态 + */ + private String bpmStatus; +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMapper.java new file mode 100644 index 00000000..b381ec5f --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.AlarmContactGroup; + +public interface AlarmContactGroupMapper extends BaseMapper { +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMemberMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMemberMapper.java new file mode 100644 index 00000000..92c5f1a2 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMemberMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.AlarmContactGroupMember; + +public interface AlarmContactGroupMemberMapper extends BaseMapper { +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmLogMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmLogMapper.java new file mode 100644 index 00000000..689520b2 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmLogMapper.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dto.TypeDto; +import org.jeecg.modules.entity.AlarmHistory; +import org.jeecg.modules.entity.AlarmLog; +import org.jeecg.modules.vo.AlarmVo; + +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; +import java.util.Map; + +public interface AlarmLogMapper extends BaseMapper { + + List rangeDay(Map params); + List findPage(Map params); + + List typeAlarms(Map params); + + List ruleTop5(Map params); +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmRuleMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmRuleMapper.java new file mode 100644 index 00000000..ed2b8536 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmRuleMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.AlarmRule; + +public interface AlarmRuleMapper extends BaseMapper { +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysDatabaseMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysDatabaseMapper.java new file mode 100644 index 00000000..c3be5b15 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysDatabaseMapper.java @@ -0,0 +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 { + + List findAlarmHistory(@Param("databaseId") String databaseId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysEmailLogMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysEmailLogMapper.java new file mode 100644 index 00000000..674ed114 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysEmailLogMapper.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.SysEmailLog; + +/** + * 系统邮件日志 + * + * @author nieziyan + * @date 2023-06-19 + */ +public interface SysEmailLogMapper extends BaseMapper { + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysEmailMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysEmailMapper.java new file mode 100644 index 00000000..69ea7234 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysEmailMapper.java @@ -0,0 +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.base.entity.SysEmail; + +import java.util.Date; +import java.util.List; + +public interface SysEmailMapper extends BaseMapper { + + List findAlarmHistory( @Param("emailId") String emailId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysServerMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysServerMapper.java new file mode 100644 index 00000000..14a05596 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/SysServerMapper.java @@ -0,0 +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.SysServer; + +import java.util.Date; +import java.util.List; + +public interface SysServerMapper extends BaseMapper { + + List findAlarmHistory(@Param("serverId")String serverId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/AlarmLogMapper.xml b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/AlarmLogMapper.xml new file mode 100644 index 00000000..e6913a5c --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/AlarmLogMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + \ No newline at end of file diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysEmailLogMapper.xml b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysEmailLogMapper.xml new file mode 100644 index 00000000..b05d4dd6 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysEmailLogMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysEmailMapper.xml b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysEmailMapper.xml new file mode 100644 index 00000000..5d471498 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysEmailMapper.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysServerMapper.xml b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysServerMapper.xml new file mode 100644 index 00000000..c8ff987a --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/SysServerMapper.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/sysDatabaseMapper.xml b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/sysDatabaseMapper.xml new file mode 100644 index 00000000..5be1a952 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/xml/sysDatabaseMapper.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java new file mode 100644 index 00000000..8bb41e4a --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java @@ -0,0 +1,20 @@ +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.AlarmContactGroup; + +public interface IAlarmContactGroupService extends IService { + + Result findPage(QueryRequest queryRequest, AlarmContactGroup alarmContactGroup); + + Result findInfo(String id); + + Result create(AlarmContactGroup alarmContactGroup); + + Result update(AlarmContactGroup alarmContactGroup); + + Result deleteById(String id); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmLogService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmLogService.java new file mode 100644 index 00000000..02984b2f --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmLogService.java @@ -0,0 +1,28 @@ +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.AlarmLog; +import org.jeecg.modules.vo.AlarmVo; + +public interface IAlarmLogService extends IService { + + Result viewAll(AlarmVo alarmVo); + + Result findPage(AlarmVo alarmVo); + + Result typeAlarms(AlarmVo alarmVo); + + Result ruleTop5(AlarmVo alarmVo); + + Result findInfo(String id); + + Result create(AlarmLog alarmLog); + + Result update(AlarmLog alarmLog); + + Result deleteById(String id); + + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmRuleService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmRuleService.java new file mode 100644 index 00000000..66add3bb --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmRuleService.java @@ -0,0 +1,20 @@ +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.AlarmRule; + +public interface IAlarmRuleService extends IService { + + Result findPage(QueryRequest queryRequest, AlarmRule alarmRule); + + Result findInfo(String id); + + Result create(AlarmRule alarmRule); + + Result update(AlarmRule alarmRule); + + Result deleteById(String id); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmSysUserService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmSysUserService.java new file mode 100644 index 00000000..1dc4a1f9 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmSysUserService.java @@ -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("/sys/user/findUserMap") + Map findUserMap(); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysDatabaseService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysDatabaseService.java new file mode 100644 index 00000000..f5d6ced3 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysDatabaseService.java @@ -0,0 +1,25 @@ +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.SysDatabase; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +public interface ISysDatabaseService extends IService { + + Result findPage(QueryRequest queryRequest, SysDatabase sysDatabase); + + Result findInfo(String id); + + Result create(SysDatabase sysDatabase); + + Result update(SysDatabase sysDatabase); + + Result deleteById(String id); + + Result findAlarmHistory(String databaseId, Date startTime, Date endTime); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysEmailLogService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysEmailLogService.java new file mode 100644 index 00000000..1b2816ef --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysEmailLogService.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.SysEmailLog; + +public interface ISysEmailLogService extends IService { +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysEmailService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysEmailService.java new file mode 100644 index 00000000..4253a0fc --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysEmailService.java @@ -0,0 +1,24 @@ +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.base.entity.SysEmail; + +import java.util.Date; + +public interface ISysEmailService extends IService { + + Result findPage(QueryRequest queryRequest, SysEmail sysEmail); + + Result findInfo(String id); + + Result create(SysEmail sysEmail); + + Result update(SysEmail sysEmail); + + Result deleteById(String id); + + Result findAlarmHistory(String emailId, Date startTime, Date endTime); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysServerService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysServerService.java new file mode 100644 index 00000000..db5c97f0 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/ISysServerService.java @@ -0,0 +1,24 @@ +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.SysServer; + +import java.util.Date; + +public interface ISysServerService extends IService { + + Result findPage(QueryRequest queryRequest, SysServer sysServer); + + Result findInfo(String id); + + Result create(SysServer sysServer); + + Result update(SysServer sysServer); + + Result deleteById(String id); + + Result findAlarmHistory(String serverId, Date startTime, Date endTime); + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java new file mode 100644 index 00000000..5eb89be6 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java @@ -0,0 +1,171 @@ +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.core.toolkit.IdWorker; +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.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.SysUser; +import org.jeecg.modules.mapper.AlarmContactGroupMapper; +import org.jeecg.modules.mapper.AlarmContactGroupMemberMapper; +import org.jeecg.modules.service.IAlarmContactGroupService; +import org.jeecg.modules.service.IAlarmSysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDate; +import java.util.*; +import java.util.stream.Collectors; + +@Service("alarmContactGroupService") +public class AlarmContactGroupServiceImpl extends ServiceImpl implements IAlarmContactGroupService { + + @Autowired + private AlarmContactGroupMemberMapper alarmContactGroupMemberMapper; + @Autowired + private IAlarmSysUserService alarmSysUserService; + + @Override + public Result findPage(QueryRequest queryRequest, AlarmContactGroup alarmContactGroup) { + Result result = new Result(); + //获取用户信息 + Map userList = alarmSysUserService.findUserMap(); + Page page = new Page<>(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + Page alarmContactGroupPage = this.baseMapper.selectPage(page, queryWrapper); + LambdaQueryWrapper contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>(); + List alarmContactGroupMembers = alarmContactGroupMemberMapper.selectList(contactGroupMemberQueryWrapper); + alarmContactGroupPage.getRecords().forEach(item->{ + List sysUsers = new LinkedList<>(); + //联系人组对应联系人信息不为空 + if (CollectionUtils.isNotEmpty(alarmContactGroupMembers)){ + //根据联系人组id过滤出对应的联系人信息集合 + List contactGroupMembers = alarmContactGroupMembers.stream().filter(member-> member.getGroupId().equals(item.getId())).collect(Collectors.toList()); + item.setPersonNumber(contactGroupMembers.size()); + //过滤出对应的用户id集合 + List userIds = contactGroupMembers.stream().map(AlarmContactGroupMember::getUserId).collect(Collectors.toList()); + //根据用户id获得对应的用户信息 + if (CollectionUtils.isNotEmpty(userList)){ + for (String userId:userIds) { + if (userList.containsKey(userId)){ + sysUsers.add(userList.get(userId)); + } + } + item.setUsers(sysUsers); + } + } + }); + result.setSuccess(true); + result.setResult(alarmContactGroupPage); + return result; + } + + @Override + public Result findInfo(String id) { + Result result = new Result(); + //根据id查询对应的数据 判断数据是否在数据库中 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmContactGroup::getId, id); + AlarmContactGroup alarmContactGroup = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(alarmContactGroup)){ + result.error500("查询数据失败,对应数据不存在"); + return result; + } + //通过联系人组id查询出对应的联系人信息 + LambdaQueryWrapper contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>(); + contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getGroupId, alarmContactGroup.getId()); + List contactGroupMembers = alarmContactGroupMemberMapper.selectList(contactGroupMemberQueryWrapper); + if (CollectionUtils.isNotEmpty(contactGroupMembers)){ + List userIds = contactGroupMembers.stream().map(AlarmContactGroupMember::getUserId).collect(Collectors.toList()); + alarmContactGroup.setUserIds(userIds); + } + result.setSuccess(true); + result.setResult(alarmContactGroup); + return result; + } + + @Override + public Result create(AlarmContactGroup alarmContactGroup) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + Long id = IdWorker.getId(); + alarmContactGroup.setId(id.toString()); + alarmContactGroup.setCreateTime(LocalDate.now()); + alarmContactGroup.setCreateBy(username); + if (CollectionUtils.isNotEmpty(alarmContactGroup.getUserIds())){ + List userIds = alarmContactGroup.getUserIds(); + for (String userId:userIds) { + Long memberId = IdWorker.getId(); + AlarmContactGroupMember alarmContactGroupMember = new AlarmContactGroupMember(); + alarmContactGroupMember.setId(memberId.toString()); + alarmContactGroupMember.setGroupId(alarmContactGroup.getId()); + alarmContactGroupMember.setUserId(userId); + alarmContactGroupMemberMapper.insert(alarmContactGroupMember); + } + } + result.setSuccess(true); + result.success("新增成功"); + return result; + } + + @Override + public Result update(AlarmContactGroup alarmContactGroup) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmContactGroup::getId, alarmContactGroup.getId()); + AlarmContactGroup contactGroup = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(contactGroup)){ + result.error500("对应数据不存在"); + return result; + } + if (CollectionUtils.isNotEmpty(alarmContactGroup.getUserIds())){ + LambdaQueryWrapper contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>(); + contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getGroupId, alarmContactGroup.getId()); + alarmContactGroupMemberMapper.delete(contactGroupMemberQueryWrapper); + List userIds = alarmContactGroup.getUserIds(); + for (String userId:userIds) { + Long memberId = IdWorker.getId(); + AlarmContactGroupMember alarmContactGroupMember = new AlarmContactGroupMember(); + alarmContactGroupMember.setId(memberId.toString()); + alarmContactGroupMember.setGroupId(alarmContactGroup.getId()); + alarmContactGroupMember.setUserId(userId); + alarmContactGroupMemberMapper.insert(alarmContactGroupMember); + } + } + alarmContactGroup.setUpdateTime(LocalDate.now()); + alarmContactGroup.setUpdateBy(username); + this.baseMapper.updateById(alarmContactGroup); + result.setSuccess(true); + result.success("修改成功"); + return result; + } + + @Override + public Result deleteById(String id) { + Result result = new Result(); + //根据联系人组id删除关联的联系人信息 + LambdaQueryWrapper contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>(); + contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getGroupId, id); + alarmContactGroupMemberMapper.delete(contactGroupMemberQueryWrapper); + //删除联系人组信息 + this.baseMapper.deleteById(id); + result.setSuccess(true); + result.success("删除成功"); + return result; + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmLogServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmLogServiceImpl.java new file mode 100644 index 00000000..b5e323b6 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmLogServiceImpl.java @@ -0,0 +1,239 @@ +package org.jeecg.modules.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.dto.TypeDto; +import org.jeecg.modules.entity.AlarmHistory; +import org.jeecg.modules.entity.AlarmLog; +import org.jeecg.modules.mapper.AlarmLogMapper; +import org.jeecg.modules.service.IAlarmLogService; +import org.jeecg.modules.vo.AlarmVo; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +@Service("alarmLogService") +public class AlarmLogServiceImpl extends ServiceImpl implements IAlarmLogService { + + /** + * 总体统计柱状图 + * @param alarmVo + * @return + */ + @Override + public Result viewAll(AlarmVo alarmVo) { + String startDate = alarmVo.getStartDate(); + String endDate = alarmVo.getEndDate(); + // 拼接日期为合理的日期+时间范围 + alarmVo.setStartDate(startDate + " 00:00:00"); + alarmVo.setEndDate(endDate + " 23:59:59"); + // 定义返回结果 + Set xData = new HashSet<>(); + Collection yData = new ArrayList<>(); + Map statistic = new TreeMap<>(); + Map result = new HashMap<>(); + // 转换参数 数据查询 + Map params = BeanUtil.beanToMap(alarmVo); + List allDate = baseMapper.rangeDay(params); + // 查询数据为空则直接返回空集合 + if (CollUtil.isEmpty(allDate)){ + result.put("xData",xData); + result.put("yData",yData); + return Result.OK(result); + } + // 分情况处理 1.按小时统计 2.按天统计 + + /* 1.选择日期为同一天 按照小时划分 0-23小时 */ + if (startDate.equals(endDate)){ + Map> groupTime = allDate.stream() + .collect(Collectors.groupingBy(LocalDateTime::getHour)); + for (int i = 0; i < 24; i++) { + if(groupTime.containsKey(i)){ + Integer count = groupTime.get(i).size(); + statistic.put(timeStr(i),count); + }else { + statistic.put(timeStr(i),0); + } + } + // 返回x轴和y轴数据 + xData = statistic.keySet(); + yData = statistic.values(); + result.put("xData",xData); + result.put("yData",yData); + return Result.OK(result); + } + /* 2.选择日期不是同一天 按照天划分 */ + // 支持跨年跨月选择(包括闰年) + else { + // 通过年月日进行分组 例:2023-06-06 + DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE; + Map> group = allDate.stream() + .collect(Collectors.groupingBy(datetime -> datetime.format(formatter))); + + // 列举startDate和endDate之间所有日期(已考虑闰年情况) + // 没有报警日志的日期,对应的值设置为0 + LocalDate start = LocalDate.parse(startDate); + LocalDate end = LocalDate.parse(endDate); + while (!start.isAfter(end)) { + String key = start.format(formatter); + if (group.containsKey(key)){ + Integer count = group.get(key).size(); + statistic.put(key,count); + }else { + statistic.put(key,0); + } + start = start.plusDays(1); + } + // 返回x轴和y轴数据 + xData = statistic.keySet(); + yData = statistic.values(); + result.put("xData",xData); + result.put("yData",yData); + return Result.OK(result); + } + } + + /** + * 报警信息分页列表 + * @param alarmVo + * @return + */ + @Override + public Result findPage(AlarmVo alarmVo) { + Integer pageNo = alarmVo.getPageNo(); + Integer pageSize = alarmVo.getPageSize(); + Page page = new Page<>(pageNo,pageSize); + Integer pageStart = (pageNo - 1) * pageSize; + alarmVo.setPageStart(pageStart); + Map params = BeanUtil.beanToMap(alarmVo); + List alarmHistories = baseMapper.findPage(params); + // 当前页数据 + page.setRecords(alarmHistories); + // 获取数据总条数(经过查询条件过滤后的) + params.put("pageFlag","noPage"); + Integer total = baseMapper.findPage(params).size(); + page.setTotal(total); + return Result.OK(page); + } + + /** + * ALARM ANALYSIS -> Monitor Type Alarms + * @return + */ + @Override + public Result typeAlarms(AlarmVo alarmVo) { + /* 饼图数据 */ + // 警报类型-警报数 + Map params = BeanUtil.beanToMap(alarmVo); + List typeAlarms = baseMapper.typeAlarms(params); + // 警报总数 + Integer total = typeAlarms.stream().mapToInt(TypeDto::getValue).sum(); + Map result = new HashMap<>(); + result.put("pieData",typeAlarms); + result.put("pieTotal",total); + return Result.OK(result); + } + + /** + * ALARM ANALYSIS -> Alarms Rule Top5 + * @return + */ + @Override + public Result ruleTop5(AlarmVo alarmVo) { + /* 柱状图数据 */ + Map params = BeanUtil.beanToMap(alarmVo); + List ruleTop5 = baseMapper.ruleTop5(params); + // x轴数据 + List xData = ruleTop5.stream() + .map(TypeDto::getName) + .collect(Collectors.toList()); + // y轴数据 + List yData = ruleTop5.stream() + .map(TypeDto::getValue) + .collect(Collectors.toList()); + Map result = new HashMap<>(); + result.put("xData",xData); + result.put("yData",yData); + return Result.OK(result); + } + + @Override + public Result findInfo(String id) { + Result result = new Result(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmLog::getId, id); + AlarmLog alarmLog = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(alarmLog)){ + result.error500("当前查询数据不存在"); + return result; + } + result.setSuccess(true); + result.setResult(alarmLog); + return result; + } + + @Override + public Result create(AlarmLog alarmLog) { + Result result = new Result(); + Long id = IdWorker.getId(); + alarmLog.setId(id.toString()); + if (StringUtils.isNotBlank(alarmLog.getAlarmInfo())){ + String jsonString = JSON.toJSONString(alarmLog.getAlarmInfo()); + alarmLog.setAlarmInfo(jsonString); + } + this.baseMapper.insert(alarmLog); + result.setSuccess(true); + result.success("新增成功"); + return result; + } + + @Override + public Result update(AlarmLog alarmLog) { + Result result = new Result(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmLog::getId, alarmLog.getId()); + AlarmLog log = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(log)){ + result.error500("对应数据不存在,修改失败"); + return result; + } + if (StringUtils.isNotBlank(alarmLog.getAlarmInfo())){ + String jsonString = JSON.toJSONString(alarmLog.getAlarmInfo()); + alarmLog.setAlarmInfo(jsonString); + } + this.baseMapper.updateById(alarmLog); + result.setSuccess(true); + result.success("修改成功"); + return result; + } + + @Override + public Result deleteById(String id) { + Result result = new Result(); + this.baseMapper.deleteById(id); + result.setSuccess(true); + result.success("删除成功"); + return result; + } + + private String timeStr(Integer time){ + if (time < 10){ + return "0" + time + ":00"; + } + return time + ":00"; + } +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmRuleServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmRuleServiceImpl.java new file mode 100644 index 00000000..2ba6f004 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmRuleServiceImpl.java @@ -0,0 +1,112 @@ +package org.jeecg.modules.service.impl; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.netty.util.internal.StringUtil; +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.SpringContextUtils; +import org.jeecg.modules.entity.AlarmRule; +import org.jeecg.modules.mapper.AlarmRuleMapper; +import org.jeecg.modules.service.IAlarmRuleService; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDate; +import java.util.Date; +import java.util.Objects; + +@Service("alarmRuleService") +public class AlarmRuleServiceImpl extends ServiceImpl implements IAlarmRuleService { + + @Override + public Result findPage(QueryRequest queryRequest, AlarmRule alarmRule) { + Result result = new Result(); + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(Objects.nonNull(alarmRule.getEnabled()), AlarmRule::getEnabled, alarmRule.getEnabled()); + queryWrapper.eq(StringUtils.isNotBlank(alarmRule.getSourceId()), AlarmRule::getSourceId, alarmRule.getSourceId()); + Page alarmRulePage = this.baseMapper.selectPage(page, queryWrapper); + result.setSuccess(true); + result.setResult(alarmRulePage); + return result; + } + + @Override + public Result findInfo(String id) { + Result result = new Result(); + //根据id查询对应数据信息 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmRule::getId, id); + AlarmRule alarmRule = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(alarmRule)){ + result.error500("查询数据不存在"); + return result; + } + result.setSuccess(true); + result.setResult(alarmRule); + return result; + } + + @Override + public Result create(AlarmRule alarmRule) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + Long id = IdWorker.getId(); + alarmRule.setId(id.toString()); + alarmRule.setCreateTime(LocalDate.now()); + alarmRule.setCreateBy(username); + if (StringUtils.isNotBlank(alarmRule.getOperator())){ + String jsonString = JSON.toJSONString(alarmRule.getOperator()); + alarmRule.setOperator(jsonString); + } + this.baseMapper.insert(alarmRule); + result.setSuccess(true); + result.success("新增成功"); + return result; + } + + @Override + public Result update(AlarmRule alarmRule) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmRule::getId, alarmRule.getId()); + AlarmRule rule = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(rule)){ + result.error500("对应数据不存在"); + return result; + } + alarmRule.setUpdateTime(LocalDate.now()); + alarmRule.setUpdateBy(username); + if (StringUtils.isNotBlank(alarmRule.getOperator())){ + String jsonString = JSON.toJSONString(alarmRule.getOperator()); + alarmRule.setOperator(jsonString); + } + this.baseMapper.updateById(alarmRule); + result.setSuccess(true); + result.success("修改成功"); + return result; + } + + @Override + public Result deleteById(String id) { + Result result = new Result(); + this.baseMapper.deleteById(id); + result.setSuccess(true); + result.success("删除成功"); + return result; + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java new file mode 100644 index 00000000..bc7eeeb7 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java @@ -0,0 +1,132 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +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.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; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; +import java.time.LocalDate; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@Service("sysDatabaseService") +public class SysDatabaseServiceImpl extends ServiceImpl implements ISysDatabaseService { + + @Override + public Result findPage(QueryRequest queryRequest, SysDatabase sysDatabase) { + Result result = new Result(); + //声明page + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + //分页查询数据库配置信息 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + Page sysDatabasePage = this.baseMapper.selectPage(page, queryWrapper); + result.setSuccess(true); + result.setResult(sysDatabasePage); + return result; + } + + @Override + public Result findInfo(String id) { + Result result = new Result(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysDatabase::getId, id); + SysDatabase database = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(database)){ + result.error500("当前数据不存在"); + return result; + } + result.setSuccess(true); + result.setResult(database); + return result; + } + + @Override + @Transactional + public Result create(SysDatabase sysDatabase) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //声明id + Long id = IdWorker.getId(); + sysDatabase.setId(id.toString()); + sysDatabase.setCreateTime(LocalDate.now()); + sysDatabase.setCreateBy(username); + this.baseMapper.insert(sysDatabase); + result.setSuccess(true); + result.success("新增成功"); + return result; + } + + @Override + @Transactional + public Result update(SysDatabase sysDatabase) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysDatabase::getId, sysDatabase.getId()); + SysDatabase database = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(database)){ + result.error500("对应数据不存在,修改失败"); + return result; + } + sysDatabase.setUpdateTime(LocalDate.now()); + sysDatabase.setUpdateBy(username); + this.baseMapper.updateById(sysDatabase); + result.setSuccess(true); + result.success("修改成功"); + return result; + } + + @Override + @Transactional + public Result deleteById(String id) { + Result result = new Result(); + this.baseMapper.deleteById(id); + result.setSuccess(true); + result.success("删除成功"); + 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 = this.baseMapper.findAlarmHistory(databaseId, startDate, endDate); + result.setSuccess(true); + result.setResult(alarmHistory); + } catch (ParseException e) { + throw new RuntimeException(e); + } + return result; + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysEmailLogServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysEmailLogServiceImpl.java new file mode 100644 index 00000000..06e9cb66 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysEmailLogServiceImpl.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.SysEmailLog; +import org.jeecg.modules.mapper.SysEmailLogMapper; +import org.jeecg.modules.service.ISysEmailLogService; +import org.springframework.stereotype.Service; + +@Service("sysEmailLogService") +public class SysEmailLogServiceImpl extends ServiceImpl implements ISysEmailLogService { +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysEmailServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysEmailServiceImpl.java new file mode 100644 index 00000000..a9ba633d --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysEmailServiceImpl.java @@ -0,0 +1,136 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +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.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.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.time.LocalDate; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@Service("sysEmailService") +public class SysEmailServiceImpl extends ServiceImpl implements ISysEmailService { + + @Override + public Result findPage(QueryRequest queryRequest, SysEmail sysEmail) { + Result result = new Result(); + //声明page + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + //分页查询邮箱配置数据 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + Page sysEmailPage = this.baseMapper.selectPage(page, queryWrapper); + result.setSuccess(true); + result.setResult(sysEmailPage); + return result; + } + + @Override + public Result findInfo(String id) { + Result result = new Result(); + //根据id查询对应的邮箱配置信息 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysEmail::getId, id); + SysEmail sysEmail = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(sysEmail)){ + result.error500("查询数据不存在"); + return result; + } + result.setSuccess(true); + result.setResult(sysEmail); + return result; + } + + @Override + @Transactional + public Result create(SysEmail sysEmail) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //声明id + Long id = IdWorker.getId(); + sysEmail.setId(id.toString()); + //创建时间 + sysEmail.setCreateTime(LocalDate.now()); + sysEmail.setCreateBy(username); + this.baseMapper.insert(sysEmail); + result.setSuccess(true); + result.success("新增成功"); + return result; + } + + @Override + @Transactional + public Result update(SysEmail sysEmail) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //根据id查询数据 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysEmail::getId, sysEmail.getId()); + SysEmail email = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(email)){ + result.error500("对应数据不存在"); + return result; + } + //创建时间 + sysEmail.setUpdateTime(LocalDate.now()); + sysEmail.setUpdateBy(username); + this.baseMapper.updateById(sysEmail); + result.setSuccess(true); + result.success("修改成功"); + return result; + } + + @Override + @Transactional + public Result deleteById(String id) { + Result result = new Result(); + this.baseMapper.deleteById(id); + result.setSuccess(true); + result.success("删除成功"); + 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 = this.baseMapper.findAlarmHistory(emailId, startDate, endDate); + result.setSuccess(true); + result.setResult(alarmHistory); + } catch (ParseException e) { + throw new RuntimeException(e); + } + return result; + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysServerServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysServerServiceImpl.java new file mode 100644 index 00000000..3f2d7113 --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysServerServiceImpl.java @@ -0,0 +1,137 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +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.SysServer; +import org.jeecg.modules.mapper.SysServerMapper; +import org.jeecg.modules.service.ISysServerService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; +import java.time.LocalDate; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@Service("sysServerService") +public class SysServerServiceImpl extends ServiceImpl implements ISysServerService { + + @Override + public Result findPage(QueryRequest queryRequest, SysServer sysServer) { + Result result = new Result(); + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + Page sysServerPage = this.baseMapper.selectPage(page, queryWrapper); + result.setSuccess(true); + result.setResult(sysServerPage); + return result; + } + + @Override + public Result findInfo(String id) { + Result result = new Result(); + if (StringUtils.isBlank(id)){ + result.error500("id信息不能为空"); + } + //查询对应数据详情内容 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysServer::getId, id); + SysServer sysServer = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(sysServer)){ + result.error500("查询数据不存在"); + return result; + } + result.setSuccess(true); + result.setResult(sysServer); + return result; + } + + @Override + @Transactional + public Result create(SysServer sysServer) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //声明id + Long id = IdWorker.getId(); + sysServer.setId(id.toString()); + //赋值创建时间 + sysServer.setCreateTime(LocalDate.now()); + sysServer.setCreateBy(username); + this.baseMapper.insert(sysServer); + result.setSuccess(true); + result.success("新增成功"); + return result; + } + + @Override + @Transactional + public Result update(SysServer sysServer) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //根据id查询对应数据是否存在 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysServer::getId, sysServer.getId()); + SysServer server = this.baseMapper.selectOne(queryWrapper); + if (Objects.isNull(server)){ + result.error500("当前数据不存在"); + return result; + } + sysServer.setUpdateTime(LocalDate.now()); + sysServer.setUpdateBy(username); + this.baseMapper.updateById(sysServer); + result.setSuccess(true); + result.success("修改成功"); + return result; + } + + @Override + @Transactional + public Result deleteById(String id) { + Result result = new Result(); + this.baseMapper.deleteById(id); + result.setSuccess(true); + result.success("删除成功"); + return result; + } + + @Override + public Result findAlarmHistory(String serverId, 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 = this.baseMapper.findAlarmHistory(serverId, startDate, endDate); + result.setSuccess(true); + result.setResult(alarmHistory); + } catch (ParseException e) { + throw new RuntimeException(e); + } + return result; + } + +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/vo/AlarmVo.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/vo/AlarmVo.java new file mode 100644 index 00000000..6101023e --- /dev/null +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/vo/AlarmVo.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.vo; + +import lombok.Data; +import org.jeecg.common.api.QueryRequest; +import java.io.Serializable; + +@Data +public class AlarmVo extends QueryRequest implements Serializable { + private String name; + private String type; + private String startDate; + private String endDate; + private Integer pageStart; + // 标记:根据条件查询但不进行分页 + private String pageFlag; +} diff --git a/jeecg-module-auto-process/pom.xml b/jeecg-module-auto-process/pom.xml new file mode 100644 index 00000000..7374c1ed --- /dev/null +++ b/jeecg-module-auto-process/pom.xml @@ -0,0 +1,30 @@ + + + + jeecg-boot-parent + org.jeecgframework.boot + 3.5.1 + + 4.0.0 + + jeecg-module-auto-process + + + + org.jeecgframework.boot + jeecg-boot-base-core + + + + org.jeecgframework.boot + jeecg-boot-starter-cloud + + + org.springframework.boot + spring-boot-configuration-processor + true + + + \ No newline at end of file diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java new file mode 100644 index 00000000..ff06c53d --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/AutoProcessManager.java @@ -0,0 +1,251 @@ +package org.jeecg.modules; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.constant.EmailConstant; +import org.jeecg.common.email.EmailServiceManager; +import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.email.EmailParsingActuator; +import org.jeecg.modules.emuns.SysMailEnableType; +import org.jeecg.modules.email.EmailProperties; +import org.jeecg.modules.properties.SpectrumPathProperties; +import org.jeecg.modules.properties.TaskProperties; +import org.jeecg.modules.service.ISysMailService; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 自动处理程序管理器 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class AutoProcessManager{ + + private final ISysMailService mailService; + private final TaskProperties taskProperties; + private final RedisUtil redisUtil; + private final SpectrumPathProperties spectrumPathProperties; + + /** + * 邮件Map数据锁 + */ + private final Object lock = new Object(); + /** + * 以邮件Id为key,邮件信息为value + */ + private Map emailMap = new HashMap<>(); + + /** + * 以邮件id为key,以邮件执行线程为value + */ + private Map emailExecThreadMap = new HashMap<>(); + + /** + * 启动自动处理 + */ + public void start() { + //邮件数据监测线程 + final MailDataMonitor mailDataMonitor = new MailDataMonitor(); + mailDataMonitor.setName("mail-data-monitor"); + mailDataMonitor.start(); + //邮件服务监测线程 + final MailServerMonitor monitorThread = new MailServerMonitor(); + monitorThread.setName("mail-server-monitor"); + monitorThread.start(); + //邮件执行线程管理 + final MailExecManager autoProcessThread = new MailExecManager(); + autoProcessThread.setName("mail-exec-thread-manage"); + autoProcessThread.start(); + } + + /** + * 自动处理线程 + */ + private class MailExecManager extends Thread{ + + @Override + public void run() { + for(;;){ + long start = System.currentTimeMillis(); + if(!CollectionUtils.isEmpty(emailMap)){ + Iterator iterator = emailMap.values().iterator(); + while(iterator.hasNext()){ + EmailProperties next = iterator.next(); + if(next.isDelFlag()){ + if(emailExecThreadMap.containsKey(next.getId())){ + Thread thread = emailExecThreadMap.get(next.getId()); + thread.interrupt(); + emailExecThreadMap.remove(next.getId()); + } + iterator.remove(); + } + if(next.isNewEmailFlag()){ + EmailParsingActuator emailParsingActuator = new EmailParsingActuator(); + emailParsingActuator.init(taskProperties,next); + emailParsingActuator.setName(next.getUsername()+"-email-monitor"); + emailParsingActuator.start(); + //把邮件监测执行线程加入管理队列 + emailExecThreadMap.put(next.getId(),emailParsingActuator); + //新邮件监测监测线程已启动则修改新邮件标记为false + next.setNewEmailFlag(false); + } + } + } + long end = System.currentTimeMillis(); + long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start); + //如果sleepTime > 0 需要睡眠到指定时间,否则继续下次获取邮件 + if(sleepTime > 0){ + try { + //如果本次 + TimeUnit.MILLISECONDS.sleep(sleepTime); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + } + + /** + * 邮箱通信监测线程,具体功能如下: + * 监测邮件服务通讯是否正常,把各邮箱通信状态写入redis + */ + private class MailServerMonitor extends Thread{ + + @Override + public void run() { + for(;;){ + long start = System.currentTimeMillis(); + try{ + if(!CollectionUtils.isEmpty(emailMap)){ + emailMap.values().forEach(email->{ + if(!email.isDelFlag()){ + final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance(); + emailServiceManager.init(email); + boolean testFlag = emailServiceManager.testConnectEmailServer(); + redisUtil.hset(EmailConstant.EMAIL_STATUS_PREFIX,email.getId(),testFlag); + if(testFlag && !emailExecThreadMap.containsKey(email.getId())){ + email.setNewEmailFlag(true); + } + if(!testFlag){ + //如果邮件服务通信测试失败则添加删除标记 + email.setDelFlag(true); + } + } + }); + } + //捕获异常不处理保障线程异常不退出 + }catch (Exception e){ + e.printStackTrace(); + } + long end = System.currentTimeMillis(); + long sleepTime = taskProperties.getMonitoringMailCommStatusCycle() - (end-start); + //如果sleepTime > 0 需要睡眠到指定时间,否则继续下次监测 + if(sleepTime > 0){ + try { + TimeUnit.MILLISECONDS.sleep(sleepTime); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + } + + /** + * 邮箱数据监测线程,具体功能如下: + * 1.监测邮件数据表是否有变化 + * 1.1有新邮件记录并且已启用则启动新线程执行 + * 1.2有邮件记录被删除并且此邮箱信息已有线程执行则停止执行 + */ + private class MailDataMonitor extends Thread{ + + @Override + public void run() { + for (;;){ + long start = System.currentTimeMillis(); + try{ + final List receiveMails = mailService.findReceiveMails(); + if(!CollectionUtils.isEmpty(receiveMails)){ + //如果库里已有数据原来已开启使用并且监测Map中已存在,现在关闭使用则添加删除标记 + //如果本次查询数据监测Map中不存在,并且已开启使用的则加入监测Map + for(EmailProperties email : receiveMails){ + final boolean flag = emailMap.containsKey(email.getId()); + if(flag && email.getEnabled().equals(SysMailEnableType.NOT_ENABLE.getMailEnableType())){ + EmailProperties sourceEmail = emailMap.get(email.getId()); + sourceEmail.setDelFlag(true); + } + if(!flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){ + email.setNewEmailFlag(true); + putSysEmailMap(email); + log.info("{}邮箱加入监测队列",email.getEmailServerAddress()); + } + } + //如果监测Map中存在的邮箱数据,在本次查询数据中不存在说明库里已删除,则添加删除标记 + emailMap.forEach((emailId,sourceEmail)->{ + final long result = receiveMails.stream().filter(email -> emailId.equals(email.getId())).count(); + if (result <= 0){ + sourceEmail.setDelFlag(true); + } + }); + } + //捕获异常不处理保障线程异常不退出 + }catch (Exception e){ + e.printStackTrace(); + } + long end = System.currentTimeMillis(); + long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start); + //如果sleepTime > 0 需要睡眠到指定时间,否则继续下次监测 + if(sleepTime > 0){ + try { + TimeUnit.MILLISECONDS.sleep(sleepTime); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + } + + /** + * 新增邮箱数据 + * @param email + */ + private void putSysEmailMap(EmailProperties email){ + synchronized (this.lock){ + emailMap.put(email.getId(),email); + } + } + + /** + * 删除邮箱数据 + * @param emailId + */ + private void removeSysEmailMap(String emailId){ + synchronized (this.lock){ + if (emailMap.containsKey(emailId)){ + emailMap.remove(emailId); + } + } + } + + /** + * 删除邮箱数据 + * @param sysEmailIds + */ + private void removeSysEmailMap(List sysEmailIds){ + synchronized (this.lock){ + for(String sysEmailId : sysEmailIds){ + if (emailMap.containsKey(sysEmailId)){ + emailMap.remove(sysEmailId); + } + } + } + } +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/config/mybatis/CustomMetaObjectHandler.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/config/mybatis/CustomMetaObjectHandler.java new file mode 100644 index 00000000..8954a958 --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/config/mybatis/CustomMetaObjectHandler.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.config.mybatis; + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +/** + * 自定义实体字段填充 + * @author 86187 + */ +@Component +public class CustomMetaObjectHandler implements MetaObjectHandler { + + + @Override + public void insertFill(MetaObject metaObject) { + this.strictInsertFill(metaObject,"createTime", LocalDateTime.class,LocalDateTime.now()); + } + + @Override + public void updateFill(MetaObject metaObject) { + + } +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailLogProperties.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailLogProperties.java new file mode 100644 index 00000000..98da3486 --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailLogProperties.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.email; + +import lombok.Data; +import org.jeecg.modules.base.entity.SysEmailLog; + +import java.util.List; + +/** + * 邮件日志属性 + */ +@Data +public class EmailLogProperties extends SysEmailLog { + + /** + * 邮件附件本地存储路径 + */ + private List filePathList; +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailParsingActuator.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailParsingActuator.java new file mode 100644 index 00000000..21880970 --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailParsingActuator.java @@ -0,0 +1,107 @@ +package org.jeecg.modules.email; + +import org.jeecg.common.email.EmailServiceManager; +import org.jeecg.common.email.emuns.MailContentType; +import org.jeecg.modules.properties.TaskProperties; +import org.jetbrains.annotations.NotNull; +import org.springframework.scheduling.concurrent.CustomizableThreadFactory; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.internet.MimeUtility; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 邮件解析执行器 + */ +public class EmailParsingActuator extends Thread{ + + private TaskProperties taskProperties; + private EmailProperties emailProperties; + private ThreadPoolExecutor poolExecutor; + + public void init(TaskProperties taskProperties, + EmailProperties emailProperties){ + this.taskProperties = taskProperties; + this.emailProperties = emailProperties; + //初始化线程池 + ThreadFactory threadFactory = new CustomizableThreadFactory("mail-parsing-"); + ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(taskProperties.getReceiveNum(),taskProperties.getReceiveNum()*2,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory); + } + + @Override + public void run() { + for(;;){ + long start = System.currentTimeMillis(); + final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance(); + emailServiceManager.init(emailProperties,taskProperties.getReceiveNum(),taskProperties.getTemporaryStoragePath()); + try { + final Message[] messages = emailServiceManager.receiveMail(); + for(Message message : messages){ + final EmailLogProperties emailLogProperties = this.parseingMail(emailServiceManager,message); + //如果邮件没有附件、获取附件都不是PHD文件、也不是IMS2.0协议的文件,需把邮件删除 + +// emailServiceManager.removeMail(message); + } + }catch (MessagingException e) { + e.printStackTrace(); + }catch (IOException e) { + e.printStackTrace(); + }finally { + //关闭资源 + emailServiceManager.close(); + } + break; +// long end = System.currentTimeMillis(); +// long sleepTime = taskProperties.getMailThreadExecCycle() - (end-start); +// //如果sleepTime > 0 需要睡眠到指定时间,否则继续下次获取邮件 +// if(sleepTime > 0){ +// try { +// //如果本次 +// TimeUnit.MILLISECONDS.sleep(sleepTime); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// } + } + } + + /** + * 解析邮件 + * @param message + */ + public EmailLogProperties parseingMail(@NotNull EmailServiceManager emailServiceManager,@NotNull Message message) throws MessagingException, IOException { + //如果是带有附件的邮件 + if(message.getContentType().startsWith(MailContentType.MIXED.getContentType())){ + //封装邮件日志信息 + EmailLogProperties mailLog = new EmailLogProperties(); + mailLog.setEmailId(emailProperties.getId()); + mailLog.setSubject(MimeUtility.decodeText(message.getSubject())); + final StringBuilder content = new StringBuilder(); + emailServiceManager.getMailContent(message,content); + mailLog.setContext(content.toString()); + mailLog.setReceiveTime(message.getSentDate()); + final List filePathList = emailServiceManager.saveAttachment(message); + mailLog.setFilePathList(filePathList); + return mailLog; + }else{ + //如果此邮件不带有附件,则删除 + emailServiceManager.removeMail(message); + } + return null; + } + + //Sauna:β,Spalax:γ + private boolean checkMail(String filePath){ + File file = new File(filePath); + if(file.isFile()){ + + } + return true; + } +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailProperties.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailProperties.java new file mode 100644 index 00000000..14f20f05 --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/email/EmailProperties.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.email; + +import lombok.Data; +import org.jeecg.modules.base.entity.SysEmail; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.io.Serializable; + +/** + * 邮件属性 + * @author 86187 + */ +@Data +public class EmailProperties extends SysEmail { + + /** + * 是否是新邮件 + */ + private boolean newEmailFlag; + + /** + * 该邮件处理线程是否需要删除 + */ + private boolean delFlag; + +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/emuns/SysMailEnableType.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/emuns/SysMailEnableType.java new file mode 100644 index 00000000..a996288e --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/emuns/SysMailEnableType.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.emuns; + +/** + * 邮件类型 + */ +public enum SysMailEnableType { + + /** + * 未启用邮件 + */ + NOT_ENABLE(0), + /** + * 启用邮件 + */ + ENABLE(1); + + private Integer mailEnableType; + + SysMailEnableType(int mailEnableType) { + this.mailEnableType = mailEnableType; + } + + public Integer getMailEnableType(){ + return this.mailEnableType; + } +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/mapper/SysMailMapper.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/mapper/SysMailMapper.java new file mode 100644 index 00000000..0ca57666 --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/mapper/SysMailMapper.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.SysEmail; + +/** + * 邮件数据表Mapper + */ +public interface SysMailMapper extends BaseMapper { +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/properties/SpectrumPathProperties.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/properties/SpectrumPathProperties.java new file mode 100644 index 00000000..11794f5c --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/properties/SpectrumPathProperties.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.Map; + +/** + * 能谱文件存储路径属性 + * @author 86187 + */ +@Data +@Component +@ConfigurationProperties(prefix = "file-system") +public class SpectrumPathProperties implements Serializable { + + /** + * 能谱文件存储根路径 + */ + private String rootPath; + + /** + * 能谱文件存储路径以能谱系统类型/能谱类型为key,以存储路径为value + */ + private Map filePathMap; +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/properties/TaskProperties.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/properties/TaskProperties.java new file mode 100644 index 00000000..f3d3b2db --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/properties/TaskProperties.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.io.Serializable; + +/** + * 邮件任务运行参数 + * @author 86187 + */ +@Data +@Component +@ConfigurationProperties(prefix = "task") +public class TaskProperties implements Serializable { + + /** + * 单次获取邮件数量 + */ + private Integer receiveNum; + + /** + * 监测数据库邮箱数据变化周期 + */ + private Long monitoringMailDataCycle; + + /** + * 监测邮箱通信状态周期 + */ + private Long monitoringMailCommStatusCycle; + + /** + * 获取邮箱邮件线程执行周期 + */ + private Long mailThreadExecCycle; + + /** + * 邮件附件临时存储路径 + */ + private String temporaryStoragePath; +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/ISysMailService.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/ISysMailService.java new file mode 100644 index 00000000..8e9549e3 --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/ISysMailService.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.SysEmail; +import org.jeecg.modules.email.EmailProperties; +import java.util.List; + +/** + * 邮箱数据服务 + */ +public interface ISysMailService extends IService { + + /** + * 查询接收邮箱数据 + * @return + */ + List findReceiveMails(); +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SysMailServiceImpl.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SysMailServiceImpl.java new file mode 100644 index 00000000..cc21366b --- /dev/null +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/SysMailServiceImpl.java @@ -0,0 +1,47 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; +import org.jeecg.common.email.emuns.SysMailType; +import org.jeecg.modules.base.entity.SysEmail; +import org.jeecg.modules.email.EmailProperties; +import org.jeecg.modules.emuns.SysMailEnableType; +import org.jeecg.modules.mapper.SysMailMapper; +import org.jeecg.modules.service.ISysMailService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.Collections; +import java.util.List; + +/** + * 邮箱数据服务实现 + */ +@Service +@DS("master") +public class SysMailServiceImpl extends ServiceImpl implements ISysMailService { + + /** + * 查询接收邮箱数据 + * @return + */ + @Override + public List findReceiveMails() { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysEmail::getEmilType, SysMailType.RECEIVE_EMAIL.getEmailType()); + queryWrapper.eq(SysEmail::getEnabled, SysMailEnableType.ENABLE.getMailEnableType()); + List sysEmail = this.list(queryWrapper); + if(!CollectionUtils.isEmpty(sysEmail)){ + List emailPropertiesList = Lists.newArrayList(); + for (SysEmail email : sysEmail){ + EmailProperties mailProperties = new EmailProperties(); + BeanUtils.copyProperties(email,mailProperties); + emailPropertiesList.add(mailProperties); + } + return emailPropertiesList; + } + return Collections.emptyList(); + } +} diff --git a/jeecg-module-log-manage/pom.xml b/jeecg-module-log-manage/pom.xml index dbb0118b..062a533c 100644 --- a/jeecg-module-log-manage/pom.xml +++ b/jeecg-module-log-manage/pom.xml @@ -16,11 +16,11 @@ org.jeecgframework.boot jeecg-boot-base-core - + + - commons-net - commons-net - 3.3 + org.jeecgframework.boot + jeecg-boot-starter-cloud diff --git a/jeecg-module-log-manage/src/main/java/org/jeecg/common/util/FTPUtil.java b/jeecg-module-log-manage/src/main/java/org/jeecg/common/util/FTPUtil.java deleted file mode 100644 index d8fb73d2..00000000 --- a/jeecg-module-log-manage/src/main/java/org/jeecg/common/util/FTPUtil.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.jeecg.common.util; - -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.net.ftp.FTPClient; -import org.apache.commons.net.ftp.FTPFile; -import org.apache.commons.net.ftp.FTPReply; -import org.jeecg.modules.entity.LogManage; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -@Component -@Slf4j -public class FTPUtil { - - @Value("${ftp.host}") - private String host; - - @Value("${ftp.port}") - private Integer port; - - @Value("${ftp.userName}") - private String userName; - - @Value("${ftp.password}") - private String password; - - @Value("${ftp.encoding}") - private String encoding; - - /** - * 登录ftp - * @return - */ - public FTPClient LoginFTP(){ - //声明FTP客户端 - FTPClient ftp = new FTPClient(); - try { - // 切换为本地被动模式,可以解决FTP上传后文件为空的问题,但需要服务器将FTP服务添加至防火墙白名单 - ftp.enterLocalPassiveMode(); - //连接 - ftp.connect(host, port); - //登录 - ftp.login(userName, password); - //判断是否连接成功 - int reply = ftp.getReplyCode(); - if (!FTPReply.isPositiveCompletion(reply)) { - ftp.disconnect(); - return null; - } - } catch (IOException e) { - throw new RuntimeException(e); - } - return ftp; - } - - /** - * 遍历查询当前路径下的文件夹信息 - * @param ftp - * @param list - * @param filePath 以"/"开始和结束 - * @return - */ - public List findDirectory(FTPClient ftp,List list,Integer parentNum,String filePath){ - try { - if (filePath.indexOf("/")>0){ - List paths = Arrays.asList(filePath.split("/")); - for (String path:paths) { - ftp.changeWorkingDirectory(path); - } - } - List 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; - } - - public InputStream downloadFTPFile(String localPath, String fileName){ - InputStream in = null; - //传输模式 - try { - FTPClient ftpClient = this.LoginFTP(); - if (Objects.isNull(ftpClient)){ - throw new RuntimeException("ftp连接失败!"); - } - List paths = Arrays.asList(localPath.split("/")); - if (CollectionUtils.isNotEmpty(paths)){ - for (String workPath:paths) { - //切换工作文件路径 - ftpClient.changeWorkingDirectory(workPath); - } - } - ftpClient.enterLocalPassiveMode(); - ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); - // 设置编码,当文件中存在中文且上传后文件乱码时可使用此配置项 - ftpClient.setControlEncoding(encoding); - ftpClient.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE); - List ftpFiles = Arrays.asList(ftpClient.listFiles()); - if (CollectionUtils.isNotEmpty(ftpFiles)){ - for (FTPFile ftpFile:ftpFiles) { - if (ftpFile.getName().equals(fileName)){ - in = ftpClient.retrieveFileStream(new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)); - } - } - } - } catch (IOException e) { - throw new RuntimeException(e); - } - return in; - } - -} diff --git a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/controller/LogManageController.java b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/controller/LogManageController.java index 69050723..bc142853 100644 --- a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/controller/LogManageController.java +++ b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/controller/LogManageController.java @@ -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,78 +29,13 @@ public class LogManageController { @Autowired private FTPUtil ftpUtil; + @Autowired + private ILogManageService logManageService; @GetMapping("findFtpFolders") @ApiOperation(value = "查询日志文件夹树形结构", notes = "查询日志文件夹树形结构") public List findFtpFolders(String workPath){ - List result = new ArrayList<>(); - try { - FTPClient ftpClient = ftpUtil.LoginFTP(); - if(Objects.isNull(ftpClient)){ - throw new RuntimeException("ftp连接失败!"); - } - //切换工作文件路径 - ftpClient.changeWorkingDirectory(workPath); - ftpClient.enterLocalPassiveMode(); - List 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 list = new LinkedList<>(); - for (LogManage logManage:result) { - list = ftpUtil.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 logManages - * @return - */ - public List LogManageTree(List logManages){ - if (logManages == null) { - return null; - } - List 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); } /** @@ -110,71 +46,16 @@ public class LogManageController { @GetMapping("findFiles") @ApiOperation(value = "查询目录下文件内容", notes = "查询目录下文件内容") public List findFiles(String path){ - List result = new ArrayList<>(); - try { - FTPClient ftpClient = ftpUtil.LoginFTP(); - if (Objects.isNull(ftpClient)){ - throw new RuntimeException("ftp连接失败!"); - } - List paths = Arrays.asList(path.split("/")); - if (CollectionUtils.isNotEmpty(paths)){ - for (String workPath:paths) { - //切换工作文件路径 - ftpClient.changeWorkingDirectory(workPath); - } - } - ftpClient.enterLocalPassiveMode(); - List 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); } } diff --git a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/FileInfo.java b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/FileInfo.java index b1aed381..6371eb3f 100644 --- a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/FileInfo.java +++ b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/FileInfo.java @@ -5,12 +5,24 @@ import lombok.Data; @Data public class FileInfo { + /** + * 文件名称 + */ private String fileName; + /** + * 文件路径 + */ private String filePath; + /** + * 文件大小 + */ private String fileSize; + /** + * 文件日期 + */ private String fileDate; } diff --git a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/LogManage.java b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/LogManage.java index bcfd3004..9f60dfbe 100644 --- a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/LogManage.java +++ b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/entity/LogManage.java @@ -8,18 +8,39 @@ import java.util.List; @Data public class LogManage { + /** + * 名称 + */ private String name; + /** + * 路径 + */ private String path; + /** + * 排序编号 + */ private Integer orderNum; + /** + * 父级编号 + */ private Integer parentNum; + /** + * 是否有父级 + */ private boolean hashParent; + /** + * 是否有子级 + */ private boolean hashChild; + /** + * 子级数组 + */ private List children; public void initChildren(){ diff --git a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/service/ILogManageService.java b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/service/ILogManageService.java new file mode 100644 index 00000000..bab2dce0 --- /dev/null +++ b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/service/ILogManageService.java @@ -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 findFtpFolders(String workPath); + + /** + * 查询目录下文件内容 + * @param path + * @return + */ + List findFiles(String path); + +} diff --git a/jeecg-module-log-manage/src/main/java/org/jeecg/modules/service/impl/LogManageServiceImpl.java b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/service/impl/LogManageServiceImpl.java new file mode 100644 index 00000000..562aebea --- /dev/null +++ b/jeecg-module-log-manage/src/main/java/org/jeecg/modules/service/impl/LogManageServiceImpl.java @@ -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 findFtpFolders(String workPath) { + List result = new ArrayList<>(); + try { + FTPClient ftpClient = ftpUtil.LoginFTP(); + if(Objects.isNull(ftpClient)){ + throw new RuntimeException("ftp连接失败!"); + } + //切换工作文件路径 + ftpClient.changeWorkingDirectory(workPath); + ftpClient.enterLocalPassiveMode(); + List 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 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 findFiles(String path) { + List result = new ArrayList<>(); + try { + FTPClient ftpClient = ftpUtil.LoginFTP(); + if (Objects.isNull(ftpClient)){ + throw new RuntimeException("ftp连接失败!"); + } + List paths = Arrays.asList(path.split("/")); + if (CollectionUtils.isNotEmpty(paths)){ + for (String workPath:paths) { + //切换工作文件路径 + ftpClient.changeWorkingDirectory(workPath); + } + } + ftpClient.enterLocalPassiveMode(); + List 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 findDirectory(FTPClient ftp,List list,Integer parentNum,String filePath){ + try { + if (filePath.indexOf("/")>0){ + List paths = Arrays.asList(filePath.split("/")); + for (String path:paths) { + ftp.changeWorkingDirectory(path); + } + } + List 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 LogManageTree(List logManages){ + if (logManages == null) { + return null; + } + List 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; + } + +} diff --git a/jeecg-module-station-operation/pom.xml b/jeecg-module-station-operation/pom.xml new file mode 100644 index 00000000..5ecd6f67 --- /dev/null +++ b/jeecg-module-station-operation/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-boot-parent + 3.5.1 + + + jeecg-module-station-operation + + + + + org.jeecgframework.boot + jeecg-boot-starter-cloud + + + + org.jeecgframework.boot + jeecg-boot-base-core + + + + + com.spatial4j + spatial4j + 0.5 + + + + \ No newline at end of file diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/common/CacheName.java b/jeecg-module-station-operation/src/main/java/org/jeecg/common/CacheName.java new file mode 100644 index 00000000..b4e775de --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/common/CacheName.java @@ -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"; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/common/PointUtil.java b/jeecg-module-station-operation/src/main/java/org/jeecg/common/PointUtil.java new file mode 100644 index 00000000..379bfa94 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/common/PointUtil.java @@ -0,0 +1,39 @@ +package org.jeecg.common; + +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; + +import java.util.Objects; + +public class PointUtil { + + public static String calculate(String pointValue){ + Double Degrees = 0.0; + Double minutes = 0.0; + Double seconds = 0.0; + if (pointValue.indexOf("°")>0 || pointValue.indexOf("′")>0 || pointValue.indexOf("″")>0){ + if (pointValue.indexOf("°")>0){ + Degrees = Double.valueOf(pointValue.substring(0, pointValue.indexOf("°"))); + pointValue = pointValue.substring(pointValue.indexOf("°")+1); + } + if (pointValue.indexOf("′")>0){ + minutes = Double.valueOf(pointValue.substring(0, pointValue.indexOf("′"))); + pointValue = pointValue.substring(pointValue.indexOf("′")+1); + } + if (pointValue.indexOf("″")>0){ + seconds = Double.valueOf(pointValue.substring(0, pointValue.indexOf("″"))); + } + 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); + } + } + return pointValue; + } + + + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/common/StationTypeUtil.java b/jeecg-module-station-operation/src/main/java/org/jeecg/common/StationTypeUtil.java new file mode 100644 index 00000000..9ac4a4b2 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/common/StationTypeUtil.java @@ -0,0 +1,36 @@ +package org.jeecg.common; + +import org.apache.commons.lang3.StringUtils; +import org.jeecg.modules.entity.StationType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.stream.Collectors; + +@Component +public class StationTypeUtil { + + @Autowired + private StationType stationType; + + public List findAllStationType(){ + List stationTypeList = stationType.getTypes(); + List stationTypes = stationTypeList.stream().map(StationType::getName).collect(Collectors.toList()); + return stationTypes; + } + + public String getStationType(Integer stationId){ + String type = ""; + List stationTypeList = stationType.getTypes(); + for (StationType stationType:stationTypeList) { + if (StringUtils.isNotBlank(stationType.getMinId()) && StringUtils.isNotBlank(stationType.getMaxId())){ + if (stationId>Integer.valueOf(stationType.getMinId()) && stationId<=Integer.valueOf(stationType.getMaxId())){ + type = stationType.getName(); + } + } + } + return type; + } + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java new file mode 100644 index 00000000..aa6d7b1a --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/StationOperationController.java @@ -0,0 +1,68 @@ +package org.jeecg.modules.controller; + +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.entity.Point; +import org.jeecg.modules.entity.PointVo; +import org.jeecg.modules.entity.StationOperation; +import org.jeecg.modules.service.IStationOperationService; +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 +@RequestMapping("stationOperation") +@Api(value = "台站运行管理", tags = "台站运行管理") +public class StationOperationController { + + @Autowired + private IStationOperationService stationOperationService; + + @GetMapping("findStationType") + @ApiOperation(value = "查询台站,核设施类型", notes = "查询台站,核设施类型") + public List findStationType(){ + List result = stationOperationService.findStationType(); + return result; + } + + @GetMapping("findList") + @ApiOperation(value = "查询所有台站,核设施信息", notes = "查询所有台站,核设施信息") + public List findList(String status, String stationType){ + List result = stationOperationService.findList(status, stationType); + return result; + } + + @GetMapping("findInfo") + @ApiOperation(value = "查询台站/核设施详情信息", notes = "查询台站/核设施详情信息") + public Result findInfo(String stationId, String type){ + Result result = stationOperationService.findInfo(stationId, type); + return result; + } + + @GetMapping("findTree") + @ApiOperation(value = "查询台站树形结构", notes = "查询台站树形结构") + public Result findTree(){ + Result result = stationOperationService.findTree(); + return result; + } + + @PostMapping("getHitEquList") + @ApiOperation(value = "查询半径内核设施信息", notes = "查询半径内核设施信息") + public Result getHitEquList(@RequestBody PointVo pointVo){ + Result result = stationOperationService.getHitEquList(pointVo); + return result; + } + + @GetMapping("getDataReceivingStatus") + @ApiOperation(value = "查询台站监测数据信息", notes = "查询台站监测数据信息") + public Result getDataReceivingStatus(String userId){ + return stationOperationService.getDataReceivingStatus(userId); + } + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java new file mode 100644 index 00000000..85ef4324 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/controller/SysUserFocusStationController.java @@ -0,0 +1,51 @@ +package org.jeecg.modules.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.api.vo.Result; +import org.jeecg.config.valid.InsertGroup; +import org.jeecg.modules.entity.SysUserFocusStation; +import org.jeecg.modules.entity.UserFocusStation; +import org.jeecg.modules.service.ISysUserFocusStationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("sysUserFocusStation") +@Api(value = "关注台站管理", tags = "关注台站管理") +public class SysUserFocusStationController { + + @Autowired + private ISysUserFocusStationService sysUserFocusStationService; + + @GetMapping("findList") + @ApiOperation(value = "查询关注台站列表", notes = "查询关注台站列表") + public List findList(){ + List result = sysUserFocusStationService.findList(); + return result; + } + + @PostMapping("saveUserFocusByUserId") + @ApiOperation(value = "保存用户关注台站及缓存配置信息", notes = "保存用户关注台站及缓存配置信息") + public Result create(@RequestBody UserFocusStation userFocusStation){ + return sysUserFocusStationService.create(userFocusStation); + } + + @DeleteMapping("deleteById") + @ApiOperation(value = "取消关注", notes = "取消关注") + public Result deleteById(String stationId){ + return sysUserFocusStationService.deleteById(stationId); + } + + @GetMapping("findUserFocusByUserId") + @ApiOperation(value = "根据用户id查询用户的缓存配置信息及关注台站信息", notes = "根据用户id查询用户的缓存配置信息及关注台站信息") + public Result findUserFocusByUserId(String userId){ + return sysUserFocusStationService.findUserFocusByUserId(userId); + } + + + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/DataInfoVo.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/DataInfoVo.java new file mode 100644 index 00000000..1fa773df --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/DataInfoVo.java @@ -0,0 +1,43 @@ +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; + +@Data +public class DataInfoVo implements Serializable { + + /** + * 类型 + */ + private String type; + + /** + * 状态 + */ + private String status; + + /** + * 开始时间 + */ + private Double beginTime; + + /** + * 结束时间 + */ + private Double endTime; + + /** + * 时间间隔 + */ + private Double spanTime; + + /** + * 比率 + */ + private Double rate; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/DetectorData.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/DetectorData.java new file mode 100644 index 00000000..2059a209 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/DetectorData.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DetectorData implements Serializable { + + /** + * 探测器id + */ + private Integer detectorId; + + /** + * 探测器编码 + */ + private String detectorCode; + + /** + * 数据集合 + */ + private List dataList; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/Point.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/Point.java new file mode 100644 index 00000000..bdd4af19 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/Point.java @@ -0,0 +1,40 @@ +package org.jeecg.modules.entity; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class Point implements Serializable { + + /** + * 台站名称 + */ + private String stationName; + + /** + * 核设施名称 + */ + private String nuclearFacilityName; + + /** + * 经度 + */ + private String lon; + + /** + * 纬度 + */ + private String lat; + + /** + * 半径 + */ + private String radius; + + /** + * 核设施id + */ + private String nuclearFacilityId; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/PointVo.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/PointVo.java new file mode 100644 index 00000000..f9677726 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/PointVo.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class PointVo { + + /** + * 台站id集合 + */ + private List stationIds; + + /** + * 半径 + */ + private Double radius; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationData.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationData.java new file mode 100644 index 00000000..20ab50f2 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationData.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.entity; + +import lombok.Data; +import org.jeecg.modules.system.entity.GardsDetectors; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +public class StationData implements Serializable { + + /** + * 台站id + */ + private String stationId; + + /** + * 台站编码 + */ + private String stationCode; + + /** + * 探测器数据集合 + */ + private Map>> detectors; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationOperation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationOperation.java new file mode 100644 index 00000000..d562f278 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationOperation.java @@ -0,0 +1,50 @@ +package org.jeecg.modules.entity; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StationOperation implements Serializable { + + /** + * 台站/核设施id + */ + private Integer stationId; + + /** + * 台站/核设施名称 + */ + private String stationName; + + /** + * 台站/核设施类型 + */ + private String stationType; + + /** + * 海拔 + */ + private String altitude; + + /** + * 经度 + */ + private String lon; + + /** + * 纬度 + */ + private String lat; + + /** + * 状态 + */ + private String status; + + /** + * 标记 + */ + private String signal; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationReceivingConfig.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationReceivingConfig.java new file mode 100644 index 00000000..1983fe79 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationReceivingConfig.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +@TableName(value = "station_receiving_config") +public class StationReceivingConfig implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 用户id + */ + @TableField(value = "user_id") + private String userId; + + /** + * 缓存时间 + */ + @TableField(value = "cache_time") + private Double cacheTime; + + /** + * 间隔缩放 + */ + @TableField(value = "scale_interval") + private Double scaleInterval; + + /** + * 时间线长度 + */ + @TableField(value = "timeline_length") + private Double timelineLength; + + /** + * 更新间隔时间 + */ + @TableField(value = "update_interval_time") + private Double updateIntervalTime; + + /** + * 用户关注台站信息 + */ + @TableField(exist = false) + List sysUserFocusStations; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationTree.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationTree.java new file mode 100644 index 00000000..c4010b9a --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationTree.java @@ -0,0 +1,26 @@ +package org.jeecg.modules.entity; + +import lombok.Data; +import org.jeecg.modules.system.entity.GardsStations; + +import java.util.List; + +@Data +public class StationTree { + + /** + * 台站id + */ + private Integer stationId; + + /** + * 编码 + */ + private String code; + + /** + * 子数据集合 + */ + List children; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationType.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationType.java new file mode 100644 index 00000000..87b50d82 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/StationType.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.entity; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@Data +@Component +@ConfigurationProperties(prefix = "station") +public class StationType implements Serializable { + + private String name; + + private String minId; + + private String maxId; + + private List types = new ArrayList<>(); + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUser.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUser.java new file mode 100644 index 00000000..ca223594 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUser.java @@ -0,0 +1,33 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; + +@Data +@TableName("sys_user") +public class SysUser implements Serializable { + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + private String id; + + /** + * 登录账号 + */ + @Excel(name = "登录账号", width = 15) + private String username; + + /** + * 真实姓名 + */ + @Excel(name = "真实姓名", width = 15) + private String realname; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java new file mode 100644 index 00000000..5b012fa3 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/SysUserFocusStation.java @@ -0,0 +1,95 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +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 javax.validation.constraints.Null; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +@Data +@TableName("sys_user_focus_station") +public class SysUserFocusStation implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + @NotBlank(message = "不能为空", groups = UpdateGroup.class) + private String id; + + /** + * 用户id + */ + @TableField(value = "user_id") + private String userId; + + /** + * 台站id + */ + @TableField(value = "station_id") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) + private String stationId; + + /** + * 类型 + */ + @TableField(value = "station_type") + @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) + private String stationType; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + /** + * 创建人 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 经度 + */ + @TableField(exist = false) + private Double lon; + + /** + * 纬度 + */ + @TableField(exist = false) + private Double lat; + + /** + * 海拔 + */ + @TableField(exist = false) + private String altitude; + + /** + * 状态 + */ + @TableField(exist = false) + private String status; + + /** + * 台站编码 + */ + @TableField(exist = false) + private String stationCode; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/UserFocusStation.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/UserFocusStation.java new file mode 100644 index 00000000..1d4fac58 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/entity/UserFocusStation.java @@ -0,0 +1,36 @@ +package org.jeecg.modules.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class UserFocusStation implements Serializable { + + /** + * 缓存时间 + */ + private Double cacheTime; + + /** + * 间隔缩放 + */ + private Double scaleInterval; + + /** + * 时间线长度 + */ + private Double timelineLength; + + /** + * 更新间隔时间 + */ + private Double updateIntervalTime; + + /** + * 台站id集合 + */ + private List stationIds; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationMetDataMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationMetDataMapper.java new file mode 100644 index 00000000..831399d6 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationMetDataMapper.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.entity.GardsMetData; + +import java.util.List; + +@DS("ori") +public interface StationMetDataMapper extends BaseMapper { + + List findMetDataList(@Param("stationIds") List stationIds, @Param("startDate") String startDate); + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationOperationMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationOperationMapper.java new file mode 100644 index 00000000..6dc31b25 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationOperationMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.StationOperation; + +public interface StationOperationMapper extends BaseMapper { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationReceivingConfigMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationReceivingConfigMapper.java new file mode 100644 index 00000000..f20a592a --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationReceivingConfigMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.StationReceivingConfig; + +public interface StationReceivingConfigMapper extends BaseMapper { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSampleDataMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSampleDataMapper.java new file mode 100644 index 00000000..605e1479 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSampleDataMapper.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.entity.GardsSampleData; + +import java.util.List; + +@DS("ori") +public interface StationSampleDataMapper extends BaseMapper { + + List findSampleDataList(@Param("detectorIds") List detectorIds, @Param("startDate") String startDate); + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSohDataMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSohDataMapper.java new file mode 100644 index 00000000..2e1414ea --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSohDataMapper.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.entity.GardsSohData; + +import java.util.List; + +@DS("ori") +public interface StationSohDataMapper extends BaseMapper { + + List findSohDataList(@Param("stationId") String stationId, @Param("detectorIds") List detectorIds, @Param("startDate") String startDate); + + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserFocusStationMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserFocusStationMapper.java new file mode 100644 index 00000000..5996afbf --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserFocusStationMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.SysUserFocusStation; + +public interface SysUserFocusStationMapper extends BaseMapper { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserMapper.java new file mode 100644 index 00000000..9c11087e --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/SysUserMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.SysUser; + +public interface SysUserMapper extends BaseMapper { +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationMetDataMapper.xml b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationMetDataMapper.xml new file mode 100644 index 00000000..a1e8e89d --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationMetDataMapper.xml @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml new file mode 100644 index 00000000..a0d10797 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml @@ -0,0 +1,29 @@ + + + + + + + \ No newline at end of file diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml new file mode 100644 index 00000000..b430b1bb --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ICacheTimeService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ICacheTimeService.java new file mode 100644 index 00000000..5913222d --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ICacheTimeService.java @@ -0,0 +1,22 @@ +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.List; +import java.util.Map; + +@Component +@FeignClient(value = "jeecg-system") +public interface ICacheTimeService { + + @RequestMapping("/sys/dictItem/findCacheTime") + List> findCacheTime(); + + @RequestMapping("/gardsDetectors/findStationDetectors") + Map> findStationDetectors(@RequestBody List stationIds); + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java new file mode 100644 index 00000000..2d508031 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/IStationOperationService.java @@ -0,0 +1,55 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.entity.Point; +import org.jeecg.modules.entity.PointVo; +import org.jeecg.modules.entity.StationOperation; +import org.jeecg.modules.system.entity.GardsNuclearfacility; + +import java.util.List; + +public interface IStationOperationService extends IService { + + /** + * 查询台站,核设施类型 + * @return + */ + List findStationType(); + + /** + * 查询台站,核设施信息 + * @param status + * @return + */ + List findList(String status, String stationType); + + /** + * 查看台站,核设施详情信息 + * @param stationId + * @param type + * @return + */ + Result findInfo(String stationId, String type); + + /** + * 查询台站信息的树形结构 + * @return + */ + Result findTree(); + + /** + * 查询半径内核设施信息 + * @param pointVo + * @return + */ + Result getHitEquList(PointVo pointVo); + + /** + * 查询台站监测数据 + * @param userId + * @return + */ + Result getDataReceivingStatus(String userId); + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java new file mode 100644 index 00000000..2483c574 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/ISysUserFocusStationService.java @@ -0,0 +1,37 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.entity.SysUserFocusStation; +import org.jeecg.modules.entity.UserFocusStation; + +import java.util.List; + +public interface ISysUserFocusStationService extends IService { + + /** + * 查询当前用户的全部关注台站,核设施信息 + * @return + */ + List findList(); + + /** + * 新增关注的台站,核设施信息 + * @param userFocusStation + */ + Result create(UserFocusStation userFocusStation); + + /** + * 取消关注 + * @param stationId + */ + Result deleteById(String stationId); + + /** + * 根据用户id查询对应的缓存配置信息 + * @param userId + * @return + */ + Result findUserFocusByUserId(String userId); + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java new file mode 100644 index 00000000..08c10a6e --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java @@ -0,0 +1,516 @@ +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.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.spatial4j.core.context.SpatialContext; +import com.spatial4j.core.distance.DistanceUtils; +import com.spatial4j.core.shape.Rectangle; +import org.jeecg.common.CacheName; +import org.jeecg.common.PointUtil; +import org.jeecg.common.StationTypeUtil; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.util.RedisUtil; +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.entity.*; +import org.jeecg.modules.mapper.*; +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.service.IStationOperationService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.*; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.List; +import java.util.stream.Collectors; + +@Service("stationOperationService") +public class StationOperationServiceImpl extends ServiceImpl implements IStationOperationService { + @Autowired + private RedisUtil redisUtil; + @Autowired + private ICacheTimeService cacheTimeService; + @Autowired + private StationSampleDataMapper stationSampleDataMapper; + @Autowired + private StationSohDataMapper stationSohDataMapper; + @Autowired + private StationMetDataMapper stationMetDataMapper; + @Autowired + private SysUserFocusStationMapper sysUserFocusStationMapper; + @Autowired + private StationTypeUtil stationTypeUtil; + + private final SpatialContext spatialContext = SpatialContext.GEO; + + @Override + public List findStationType() { + List allStationType = stationTypeUtil.findAllStationType(); + allStationType.add("Nuclear Facility"); + return allStationType; + } + + @Override + public List findList(String status, String stationType) { + //声明结果集合 + List result = new LinkedList<>(); + //查询全部台站信息 + HashMap stationInfoMap = (HashMap) redisUtil.get("stationInfoMap"); + //查询全部核设施信息 + HashMap nuclearFacilityMap = (HashMap) redisUtil.get("nuclearFacilityMap"); + //遍历台站信息 + if (CollectionUtils.isNotEmpty(stationInfoMap)){ + for (Map.Entry gardsStations:stationInfoMap.entrySet()) { + GardsStations gardsStation = (GardsStations)gardsStations.getValue(); + StationOperation stationOperation = new StationOperation(); + stationOperation.setStationId(gardsStation.getStationId()); + stationOperation.setStationName(gardsStation.getStationCode()); + stationOperation.setStationType(stationTypeUtil.getStationType(gardsStation.getStationId())); + 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()); + result.add(stationOperation); + } + } + if (CollectionUtils.isNotEmpty(nuclearFacilityMap)){ + //遍历核设施信息 + for (Map.Entry nuclearfacilities:nuclearFacilityMap.entrySet()) { + GardsNuclearfacility nuclearfacility = (GardsNuclearfacility)nuclearfacilities.getValue(); + StationOperation stationOperation = new StationOperation(); + stationOperation.setStationId(nuclearfacility.getFacilityId()); + stationOperation.setStationName(nuclearfacility.getFacilityName()); + stationOperation.setStationType("Nuclear Facility"); + stationOperation.setAltitude("--"); + stationOperation.setLon(PointUtil.calculate(nuclearfacility.getLatitude())); + stationOperation.setLat(PointUtil.calculate(nuclearfacility.getLongitude())); + stationOperation.setStatus(nuclearfacility.getStatus()); + result.add(stationOperation); + } + } + //如果状态不为空 + if (StringUtils.isNotBlank(status)){ + result = result.stream().filter(item-> StringUtils.isNotBlank(item.getStatus()) && item.getStatus().equalsIgnoreCase(status)).collect(Collectors.toList()); + } + //如果类型不为空 + if (StringUtils.isNotBlank(stationType)){ + result = result.stream().filter(item-> StringUtils.isNotBlank(item.getStationType()) && item.getStationType().equalsIgnoreCase(stationType)).collect(Collectors.toList()); + } + return result; + } + + @Override + public Result findInfo(String stationId, String type) { + Result result = new Result(); + if (type.equals("IMS STATION(P)") || type.equals("IMS STATION(G)") || type.equals("NRL")){ + HashMap stationInfoMap = (HashMap) redisUtil.get("stationInfoMap"); + GardsStations stations = stationInfoMap.get(stationId); + if (Objects.nonNull(stations)){ + result.setResult(stations); + result.setSuccess(true); + }else { + result.error500("台站下对应信息不存在"); + } + }else if(type.equals("Nuclear Facility")){ + HashMap nuclearFacilityMap = (HashMap) redisUtil.get("nuclearFacilityMap"); + //从缓存的核设施map中获取对应的核设施信息 + GardsNuclearfacility nuclearfacility = nuclearFacilityMap.get(stationId); + if (Objects.nonNull(nuclearfacility)){ + String longitude = nuclearfacility.getLongitude(); + String latitude = nuclearfacility.getLatitude(); + nuclearfacility.setLongitude(PointUtil.calculate(latitude)); + nuclearfacility.setLatitude(PointUtil.calculate(longitude)); + result.setResult(nuclearfacility); + result.setSuccess(true); + }else { + result.error500("核设施下对应信息不存在"); + } + }else { + result.error500("当前类型不存在"); + } + return result; + } + + @Override + public Result findTree() { + Result result = new Result(); + //声明一个数组存储城市编码信息以及台站信息 + List stationTreeList = new LinkedList<>(); + //查询台站信息接口 + HashMap stationMap = (HashMap)redisUtil.get("stationInfoMap"); + if (CollectionUtils.isNotEmpty(stationMap)){ + //遍历台站信息存储进数组 + List gardsStationsList = new ArrayList<>(); + for (Map.Entry entry:stationMap.entrySet()) { + GardsStations entryValue = (GardsStations) entry.getValue(); + gardsStationsList.add(entryValue); + } + if (CollectionUtils.isNotEmpty(gardsStationsList)){ + //过滤出所有的台站城市编码 + List countryCodes = gardsStationsList.stream().map(GardsStations::getCountryCode).distinct().sorted().collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(countryCodes)){ + for (int i=0; i<3; i++){ + //树形结构子级 用于存储城市及城市下的台站信息 + List 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 stations = new LinkedList<>(); + String country = String.valueOf(countryCode); + //声明一个数组存储城市编码对应的数组信息 + StationTree stationChildTree = new StationTree(); + stationChildTree.setStationId(countryCodes.indexOf(countryCode)+1); + stationChildTree.setCode(country); + List 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); + } + } + } + } + result.setSuccess(true); + result.setResult(stationTreeList); + return result; + } + + @Override + public Result getHitEquList(PointVo pointVo) { + Result result = new Result(); + //声明一个map存储数据 + Map map = new HashMap<>(); + //存储台站及周边核设施数据信息 + List stationsList = new LinkedList<>(); + //存储台站及周边核设施的名称,距离信息 + List> resultList = new ArrayList<>(); + //获取传递的台站id数据 + List stationIds = pointVo.getStationIds(); + //获取传递的半径数据 + Double radius = pointVo.getRadius(); + if (Objects.isNull(radius)) { + result.error500("请传入半径"); + } + try { + if (CollectionUtils.isNotEmpty(stationIds)){ + //查询全部台站信息 + HashMap stationInfoMap = (HashMap) redisUtil.get("stationInfoMap"); + //查询全部核设施信息 + HashMap nuclearFacilityMap = (HashMap) redisUtil.get("nuclearFacilityMap"); + if (CollectionUtils.isNotEmpty(nuclearFacilityMap)){ + //声明一个集合存储转换经纬度后的核设施数据 + List nuclearPoints = new ArrayList<>(); + for (Map.Entry nuclearFacilityInfo:nuclearFacilityMap.entrySet()) { + GardsNuclearfacility facilityInfoValue = nuclearFacilityInfo.getValue(); + Point point = new Point(); + point.setNuclearFacilityId(String.valueOf(facilityInfoValue.getFacilityId())); + point.setNuclearFacilityName(facilityInfoValue.getFacilityName()); + if (StringUtils.isNotBlank(facilityInfoValue.getLongitude())){ + String pointValue = PointUtil.calculate(facilityInfoValue.getLongitude()); + facilityInfoValue.setLatitude(pointValue); + point.setLat(pointValue); + } + if (StringUtils.isNotBlank(facilityInfoValue.getLatitude())){ + String pointValue = PointUtil.calculate(facilityInfoValue.getLatitude()); + facilityInfoValue.setLongitude(pointValue); + point.setLon(pointValue); + } + nuclearPoints.add(point); + } + for (String stationId:stationIds) { + GardsStations point = (GardsStations)stationInfoMap.get(stationId); + stationsList.add(point); + //声明一个数组存储对应的核设施经纬度信息 + List nuclearFacilityPoints = deepCopy(nuclearPoints); + //获取当前查询的台站名称 + String stationName = point.getStationCode(); + //获取当前查询的经度 即 圆心位置经度信息 + Double longitudeD = point.getLon(); + //获取当前查询的纬度 即 圆心位置纬度信息 + Double latitudeD = point.getLat(); + if (Objects.isNull(longitudeD)) { + result.error500("请传入经度"); + } + if (Objects.isNull(latitudeD)) { + result.error500("请传入纬度"); + } + if (!(longitudeD >= -180 && longitudeD <= 180)) { + result.error500("经度不合法"); + } + if (!(latitudeD >= -85.05112878 && latitudeD <= 85.05112878)) { + result.error500("纬度不合法"); + } + // 1.获取外接正方形 + Rectangle rectangle = getRectangle(radius, longitudeD, latitudeD); + // 2.获取位置在正方形内的所有设备 判断核设施的经纬度是否为空 不为空 判断经纬度是否在正方形的最大最小范围内 如果在则过滤出来继续使用否则弃用 + nuclearFacilityPoints = nuclearFacilityPoints.stream().filter(item-> StringUtils.isNotBlank(item.getLon()) && StringUtils.isNotBlank(item.getLat()) && + (Double.valueOf(item.getLon())>=rectangle.getMinX() && Double.valueOf(item.getLon())<= rectangle.getMaxX()) + && (Double.valueOf(item.getLat())>=rectangle.getMinY() && Double.valueOf(item.getLat())<= rectangle.getMaxY())).collect(Collectors.toList()); + //遍历在正方形范围内的数据 根据点的经纬度信息以及圆心的经纬度信息 计算出两者之间的距离 与 半径进行比较 <=半径则说明点在范围内,否则点超出半径范围 + nuclearFacilityPoints = nuclearFacilityPoints.stream() + .filter(equ -> getDistance(Double.valueOf(equ.getLon()), Double.valueOf(equ.getLat()), longitudeD, latitudeD) <= radius).collect(Collectors.toList()); + //在范围内的点信息 计算点与圆心间的半径距离返回信息 + for (Point p:nuclearFacilityPoints) { + stationsList.add(nuclearFacilityMap.get(p.getNuclearFacilityId())); + //计算点与圆心间的距离信息 + double radiusR = getDistance(Double.valueOf(p.getLon()), Double.valueOf(p.getLat()), longitudeD, latitudeD); + p.setRadius(String.valueOf(radiusR)); + p.setStationName(stationName); + } + if (CollectionUtils.isNotEmpty(nuclearFacilityPoints)){ + resultList.add(nuclearFacilityPoints); + } + } + map.put("GIS", stationsList.stream().distinct().collect(Collectors.toList())); + map.put("table", resultList); + } + } + } catch (IOException e) { + throw new RuntimeException(e); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + result.setSuccess(true); + result.setResult(map); + return result; + } + + /** + * 通过序列化的方式对list进行深复制 + * + * @param src + * @param + * @return + * @throws IOException + * @throws ClassNotFoundException + */ + public static List deepCopy(List src) throws IOException, ClassNotFoundException { + + ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(byteOut); + out.writeObject(src); + + ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray()); + ObjectInputStream in = new ObjectInputStream(byteIn); + + @SuppressWarnings("unchecked") + List dest = (List) in.readObject(); + return dest; + } + + @Override + public Result getDataReceivingStatus(String userId) { + Result result = new Result(); + //获取四项缓存数据的对应内容 + List> cacheList = cacheTimeService.findCacheTime(); + //缓存时间 + String cacheTime = ""; + for (int i=0; i< cacheList.size(); i++){ + if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.cacheTime)) ){ + cacheTime = cacheList.get(i).get(CacheName.cacheTime); + break; + } + } + if (StringUtils.isBlank(cacheTime)){ + result.error500("缓存时间不能为空"); + return result; + } + //根据用户id查询出当前用户关注的台站信息 + LambdaQueryWrapper userFocusStationQueryWrapper = new LambdaQueryWrapper<>(); + userFocusStationQueryWrapper.eq(SysUserFocusStation::getUserId, userId); + List userFocusStations = sysUserFocusStationMapper.selectList(userFocusStationQueryWrapper); + List stationIds = userFocusStations.stream().map(SysUserFocusStation::getStationId).collect(Collectors.toList()); + //从redis中获取台站信息 + Map stationInfoMap = (Map)redisUtil.get("stationMap"); + //从redis中获取探测器信息 + Map detectorInfoMap = (Map)redisUtil.get("detectorsMap"); + //遍历台站id + if (CollectionUtils.isNotEmpty(stationIds)){ + //获取当前日期时间 作为结束查询时间 + LocalDateTime endDate = LocalDateTime.now(); + //根据缓存日期 得到开始查询时间 + LocalDateTime startDate = endDate.minusDays(Integer.valueOf(cacheTime)); + String startDateTime = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + //根据台站id,开始时间查询出台站下的气象数据 + List metDataList = stationMetDataMapper.findMetDataList(stationIds, startDateTime); + //根据台站id查询出当前台站下处于运行状态的数据 + Map> stationDetectors = cacheTimeService.findStationDetectors(stationIds); + //声明存储所有台站id对应的数据信息的集合 + List stationDataList = new LinkedList<>(); + //遍历台站id 获取台站下的探测器数据 + if (CollectionUtils.isNotEmpty(stationDetectors)){ + for (String stationId:stationIds) { + Map>> stationMap = new HashMap<>(); + //获取台站下对应的探测器数据 + List detectors = stationDetectors.get(stationId); + if (CollectionUtils.isNotEmpty(detectors)){ + StationData stationData = new StationData(); + //stream流获取探测器id + List detectorIds = detectors.stream().map(GardsDetectors::getDetectorId).collect(Collectors.toList()); + //根据探测器id 开始时间查询样品基础数据 + List sampleDataList = stationSampleDataMapper.findSampleDataList(detectorIds, startDateTime); + //根据台站id,探测器id,开始时间 + List sohDataList = stationSohDataMapper.findSohDataList(stationId, detectorIds, startDateTime); + //用于接收当前台站下所有探测器及探测器所有的样品数据,气体数据,状态数据集合 + List> detectorDataList = new LinkedList<>(); + for (Integer detectorId:detectorIds) { + Map detectorMap = new HashMap<>(); + DetectorData detectorData = new DetectorData(); + detectorData.setDetectorId(detectorId); + //声明数据实体实体类 根据参数存储 样品基础数据对应的数据 气体数据 状态数据 + List dataInfoList = new LinkedList<>(); + if (CollectionUtils.isNotEmpty(sampleDataList)){ + //根据探测器id过滤出对应的样品数据 并进行遍历封装进dataInfo + List dataListSample = sampleDataList.stream().filter(item -> item.getDetectorId().equals(detectorId)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(dataListSample)){ + for (GardsSampleData sampleData:dataListSample) { + DataInfoVo dataInfo = new DataInfoVo(); + //根据样品数据类型判断 数据类型 根据不同的样品数据状态 + if (sampleData.getDataType().equals("S")){ + dataInfo.setType("PHD"); + if(sampleData.getStatus() == "PREL") { + dataInfo.setStatus("SPREL"); + } else { + dataInfo.setStatus("SFULL"); + } + } else if (sampleData.getDataType().equals("Q")){ + dataInfo.setType("QC"); + dataInfo.setStatus("QC"); + } else if (sampleData.getDataType().equals("G")){ + dataInfo.setType("PHD"); + if(sampleData.getStatus() == "PREL") { + dataInfo.setStatus("GPREL"); + } else { + dataInfo.setStatus("GFULL"); + } + } else { + continue; + } + //处理开始时间 + Date acquisitionStart = sampleData.getAcquisitionStart(); + dataInfo.setBeginTime(Double.valueOf(acquisitionStart.getTime()/1000)); + //处理结束时间 + Date acquisitionStop = sampleData.getAcquisitionStop(); + dataInfo.setEndTime(Double.valueOf(acquisitionStop.getTime()/1000)); + //时间间隔 + Double span = Double.valueOf(acquisitionStop.getTime()/1000) - Double.valueOf(acquisitionStart.getTime()/1000); + dataInfo.setSpanTime(span); + dataInfoList.add(dataInfo); + } + } + } + if (CollectionUtils.isNotEmpty(sohDataList)){ + List dataListSoh = sohDataList.stream().filter(item -> item.getDetectorId().equals(detectorId)).collect(Collectors.toList()); + //根据探测器id 台站id 开始时间查询状态数据 + if (CollectionUtils.isNotEmpty(dataListSoh)){ + for (GardsSohData sohData:dataListSoh) { + DataInfoVo dataInfo = new DataInfoVo(); + dataInfo.setType("SOH"); + dataInfo.setStatus("SOH"); + Date startTime = sohData.getStartTime(); + dataInfo.setBeginTime(Double.valueOf(startTime.getTime()/1000)); + dataInfo.setSpanTime(Double.valueOf(sohData.getTime())); + dataInfoList.add(dataInfo); + } + } + } + if (CollectionUtils.isNotEmpty(metDataList)){ + List dataListMet = metDataList.stream().filter(item -> item.getStationId().equals(stationId)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(dataListMet)){ + for (GardsMetData metData:dataListMet) { + DataInfoVo dataInfo = new DataInfoVo(); + dataInfo.setType("MET"); + dataInfo.setStatus("MET"); + Date startTime = metData.getStartTime(); + dataInfo.setBeginTime(Double.valueOf(startTime.getTime()/1000)); + Date endTime = metData.getEndTime(); + dataInfo.setEndTime(Double.valueOf(endTime.getTime()/1000)); + Double span = Double.valueOf(startTime.getTime() / 1000) - Double.valueOf(endTime.getTime() / 1000); + dataInfo.setSpanTime(span); + dataInfoList.add(dataInfo); + } + } + } + detectorData.setDataList(dataInfoList); + if (CollectionUtils.isNotEmpty(detectorInfoMap)){ + if (StringUtils.isNotBlank(detectorInfoMap.get(detectorId.toString()))){ + detectorData.setDetectorCode(detectorInfoMap.get(detectorId.toString())); + } + } + detectorMap.put(String.valueOf(detectorId), detectorData); + detectorDataList.add(detectorMap); + } + stationMap.put(stationId, detectorDataList); + stationData.setStationId(stationId); + if (CollectionUtils.isNotEmpty(stationInfoMap)){ + if (StringUtils.isNotBlank(stationInfoMap.get(stationId))){ + stationData.setStationCode(stationInfoMap.get(stationId)); + } + } + stationData.setDetectors(stationMap); + stationDataList.add(stationData); + } + } + } + result.setSuccess(true); + result.setResult(stationDataList); + } + return result; + } + + /** + * 获取外接正方形的最大最小经纬度 + * + * @param radius 半径/距离 + * @param longitude 圆心经度 + * @param latitude 圆心纬度 + */ + private Rectangle getRectangle(Double radius, Double longitude, Double latitude) { + return spatialContext.getDistCalc() + .calcBoxByDistFromPt(spatialContext.makePoint(longitude, latitude), + radius * DistanceUtils.KM_TO_DEG, spatialContext, null); + } + + /*** + * 球面中,两点间的距离 + * + * @param lon 设备经度 + * @param lat 设备纬度 + * @param longitude 圆心经度 + * @param latitude 圆心纬度 + * @return 返回距离,单位km + */ + private double getDistance(Double lon, Double lat, double longitude, double latitude) { + return spatialContext.calcDistance(spatialContext.makePoint(longitude, latitude), + spatialContext.makePoint(lon, lat)) * DistanceUtils.DEG_TO_KM; + } + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java new file mode 100644 index 00000000..0327a8e5 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/SysUserFocusStationServiceImpl.java @@ -0,0 +1,199 @@ +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.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.CacheName; +import org.jeecg.common.StationTypeUtil; +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.StationReceivingConfig; +import org.jeecg.modules.entity.SysUser; +import org.jeecg.modules.entity.SysUserFocusStation; +import org.jeecg.modules.entity.UserFocusStation; +import org.jeecg.modules.mapper.StationReceivingConfigMapper; +import org.jeecg.modules.mapper.SysUserFocusStationMapper; +import org.jeecg.modules.mapper.SysUserMapper; +import org.jeecg.modules.service.ICacheTimeService; +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.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +@Service("sysUserFocusStationService") +public class SysUserFocusStationServiceImpl extends ServiceImpl implements ISysUserFocusStationService { + + @Autowired + private RedisUtil redisUtil; + @Autowired + private SysUserMapper sysUserMapper; + @Autowired + private ICacheTimeService cacheTimeService; + @Autowired + private StationReceivingConfigMapper stationReceivingConfigMapper; + @Autowired + private StationTypeUtil stationTypeUtil; + + @Override + public List findList() { + //查询全部台站信息 + HashMap stationInfoMap = (HashMap) redisUtil.get("stationInfoMap"); + List 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()); + String stationType = stationTypeUtil.getStationType(stations.getStationId()); + item.setStationType(stationType); + item.setStationCode(stations.getStationCode()); + item.setLon(stations.getLon()); + item.setLat(stations.getLat()); + item.setStatus(stations.getStatus()); + item.setAltitude(Objects.isNull(stations.getElevation())?"--":stations.getElevation()+"m"); + } + } + }); + return sysUserFocusStations; + } + return Collections.emptyList(); + } + + @Override + @Transactional + public Result create(UserFocusStation userFocusStation) { + Result result = new Result(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //根据用户名称查询对应的用户信息 + LambdaQueryWrapper userQueryWrapper = new LambdaQueryWrapper<>(); + userQueryWrapper.eq(SysUser::getUsername, username); + SysUser sysUser = sysUserMapper.selectOne(userQueryWrapper); + if (Objects.isNull(sysUser)){ + result.error500("当前用户不存在!"); + return result; + } + //判断传递参数信息是否为空 + if (Objects.nonNull(userFocusStation)){ + //通过用户id判断是否存在用户的缓存配置信息 + LambdaQueryWrapper receivingConfigQueryWrapper = new LambdaQueryWrapper<>(); + receivingConfigQueryWrapper.eq(StationReceivingConfig::getUserId, sysUser.getId()); + StationReceivingConfig receivingConfig = stationReceivingConfigMapper.selectOne(receivingConfigQueryWrapper); + //如果没有对应的用户缓存信息 则进行新增 + if (Objects.isNull(receivingConfig)){ + receivingConfig = new StationReceivingConfig(); + Long id = IdWorker.getId(); + receivingConfig.setId(id.toString()); + receivingConfig.setUserId(sysUser.getId()); + receivingConfig.setCacheTime(userFocusStation.getCacheTime()); + receivingConfig.setScaleInterval(userFocusStation.getScaleInterval()); + receivingConfig.setTimelineLength(userFocusStation.getTimelineLength()); + receivingConfig.setUpdateIntervalTime(userFocusStation.getUpdateIntervalTime()); + stationReceivingConfigMapper.insert(receivingConfig); + }else { + receivingConfig.setCacheTime(userFocusStation.getCacheTime()); + receivingConfig.setScaleInterval(userFocusStation.getScaleInterval()); + receivingConfig.setTimelineLength(userFocusStation.getTimelineLength()); + receivingConfig.setUpdateIntervalTime(userFocusStation.getUpdateIntervalTime()); + stationReceivingConfigMapper.updateById(receivingConfig); + } + } + if (CollectionUtils.isNotEmpty(userFocusStation.getStationIds())){ + //根据用户id查询出对应的用户关注台站信息 删除用户的所有关注台站信息并重新保存 + LambdaQueryWrapper userFocusStationQueryWrapper = new LambdaQueryWrapper<>(); + userFocusStationQueryWrapper.eq(SysUserFocusStation::getUserId, sysUser.getId()); + this.baseMapper.delete(userFocusStationQueryWrapper); + for (Integer stationId:userFocusStation.getStationIds()) { + SysUserFocusStation sysUserFocusStation = new SysUserFocusStation(); + Long id = IdWorker.getId(); + sysUserFocusStation.setId(String.valueOf(id)); + sysUserFocusStation.setUserId(sysUser.getId()); + sysUserFocusStation.setStationId(String.valueOf(stationId)); + String stationType = stationTypeUtil.getStationType(stationId); + sysUserFocusStation.setStationType(stationType); + sysUserFocusStation.setCreateTime(LocalDateTime.now()); + sysUserFocusStation.setCreateBy(username); + this.baseMapper.insert(sysUserFocusStation); + } + } + result.success("新增成功"); + return result; + } + + @Override + @Transactional + public Result deleteById(String stationId) { + Result result = new Result<>(); + //获取request + HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); + //获取当前操作人用户名 + String username = JwtUtil.getUserNameByToken(request); + //根据用户名称查询对应的用户信息 + LambdaQueryWrapper userQueryWrapper = new LambdaQueryWrapper<>(); + userQueryWrapper.eq(SysUser::getUsername, username); + SysUser sysUser = sysUserMapper.selectOne(userQueryWrapper); + if (Objects.isNull(sysUser)){ + result.error500("当前用户不存在!"); + return result; + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysUserFocusStation::getUserId, sysUser.getId()); + queryWrapper.eq(SysUserFocusStation::getStationId, stationId); + this.baseMapper.delete(queryWrapper); + result.success("删除成功"); + return result; + } + + @Override + public Result findUserFocusByUserId(String userId) { + Result result = new Result(); + //根据用户id查询存储的缓存配置信息 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StationReceivingConfig::getUserId, userId); + StationReceivingConfig receivingConfig = stationReceivingConfigMapper.selectOne(queryWrapper); + //如果用户对应的缓存配置信息为空时,查询字典表中的默认值 + if (Objects.isNull(receivingConfig)){ + receivingConfig = new StationReceivingConfig(); + //调用接口获取数据库中对应缓存配置信息默认值 + List> cacheList = cacheTimeService.findCacheTime(); + for (int i=0; i< cacheList.size(); i++){ + if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.cacheTime)) ){ + String cacheTime = cacheList.get(i).get(CacheName.cacheTime); + receivingConfig.setCacheTime(Double.valueOf(cacheTime)); + }else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.scaleInterval)) ){ + String scaleInterval = cacheList.get(i).get(CacheName.scaleInterval); + receivingConfig.setScaleInterval(Double.valueOf(scaleInterval)); + }else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.timelineLength)) ){ + String timelineLength = cacheList.get(i).get(CacheName.timelineLength); + receivingConfig.setTimelineLength(Double.valueOf(timelineLength)); + }else if ( StringUtils.isNotBlank(cacheList.get(i).get(CacheName.updateIntervalTime)) ){ + String updateIntervalTime = cacheList.get(i).get(CacheName.updateIntervalTime); + receivingConfig.setUpdateIntervalTime(Double.valueOf(updateIntervalTime)); + } + } + } + //根据用户id查询出用户的关注台站信息 + LambdaQueryWrapper focusStationQueryWrapper = new LambdaQueryWrapper<>(); + focusStationQueryWrapper.eq(SysUserFocusStation::getUserId, userId); + List sysUserFocusStations = this.baseMapper.selectList(focusStationQueryWrapper); + if (Objects.nonNull(sysUserFocusStations)){ + receivingConfig.setSysUserFocusStations(sysUserFocusStations); + } + result.setSuccess(true); + result.setResult(receivingConfig); + return result; + } + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java new file mode 100644 index 00000000..c6e2e0a0 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java @@ -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; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java new file mode 100644 index 00000000..65ab2de4 --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java @@ -0,0 +1,81 @@ +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.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName("GARDS_NUCLEARFACILITY") +public class GardsNuclearfacility implements Serializable { + + @TableField(value = "FACILITY_ID") + private Integer facilityId; + + @TableField(value = "FACILITY_NAME") + private String facilityName; + + @TableField(value = "TYPE") + private String type; + + @TableField(value = "LOCATION") + private String location; + + @TableField(value = "LONGITUDE") + private String longitude; + + @TableField(value = "LATITUDE") + private String latitude; + + @TableField(value = "STATUS") + private String status; + + @TableField(value = "BUILDDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date buildDate; + + @TableField(value = "CRITICALITYDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date criticalityDate; + + @TableField(value = "RETIREDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date retireDate; + + @TableField(value = "GRIDCONEETIONDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date gridconeetionDate; + + @TableField(value = "VENDOR") + private String vendor; + + @TableField(value = "OWNER") + private String owner; + + @TableField(value = "OPERARTOR") + private String operartor; + + @TableField(value = "CAPACITYGROSS") + private Integer capacitygross; + + @TableField(value = "CAPACITYNET") + private Integer capacitynet; + + @TableField(value = "CAPACITYTHERMAL") + private Integer capacitythermal; + + @TableField(value = "ACTIVITY_DAY") + private Integer activityDay; + + @TableField(value = "ACTIVITY_YEAR") + private Integer activityYear; + +} diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsStations.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsStations.java new file mode 100644 index 00000000..8966904d --- /dev/null +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/system/entity/GardsStations.java @@ -0,0 +1,58 @@ +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.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "GARDS_STATIONS") +public class GardsStations implements Serializable { + + @TableField(value = "STATION_ID") + private Integer stationId; + + @TableField(value = "STATION_CODE") + private String stationCode; + + @TableField(value = "COUNTRY_CODE") + private String countryCode; + + @TableField(value = "TYPE") + private String type; + + @TableField(value = "LON") + private Double lon; + + @TableField(value = "LAT") + private Double lat; + + @TableField(value = "ELEVATION") + private Double elevation; + + @TableField(value = "DESCRIPTION") + private String description; + + @TableField(value = "DATE_BEGIN") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date dateBegin; + + @TableField(value = "DATE_END") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date dateEnd; + + @TableField(value = "STATUS") + private String status; + + @TableField(value = "MODDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java index 7848e947..57060a17 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsDetectorsController.java @@ -1,6 +1,8 @@ package org.jeecg.modules.system.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.api.QueryRequest; @@ -13,7 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @RestController @RequestMapping("gardsDetectors") @@ -65,4 +70,9 @@ public class GardsDetectorsController { return result; } + @RequestMapping("findStationDetectors") + public Map> findStationDetectors(@RequestBody List stationIds){ + return gardsDetectorsService.findStationDetectors(stationIds); + } + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java index 5d641879..423176cc 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java @@ -6,7 +6,7 @@ import io.swagger.annotations.ApiOperation; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; import org.jeecg.common.util.RedisUtil; -import org.jeecg.modules.system.entity.GardsSampleData; +import org.jeecg.modules.base.entity.GardsSampleData; import org.jeecg.modules.system.service.IGardsSampleDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java index e9a5febc..15c22bb9 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java @@ -88,7 +88,8 @@ public class LoginController { //update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题 //update-begin-author:taoyan date:20190828 for:校验验证码 - String captcha = sysLoginModel.getCaptcha(); + + /* String captcha = sysLoginModel.getCaptcha(); if(captcha==null){ result.error500("验证码无效"); return result; @@ -107,7 +108,7 @@ public class LoginController { // 改成特殊的code 便于前端判断 result.setCode(HttpStatus.PRECONDITION_FAILED.value()); return result; - } + }*/ //update-end-author:taoyan date:20190828 for:校验验证码 //1. 校验用户是否有效 @@ -135,7 +136,7 @@ public class LoginController { //用户登录信息 userInfo(sysUser, result); //update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码 - redisUtil.del(realKey); + //redisUtil.del(realKey); //update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码 redisUtil.del(CommonConstant.LOGIN_FAIL + username); LoginUser loginUser = new LoginUser(); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDictItemController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDictItemController.java index 210dd6ef..6cc67a16 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDictItemController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysDictItemController.java @@ -1,12 +1,13 @@ package org.jeecg.modules.system.controller; -import java.util.Arrays; -import java.util.Date; +import java.util.*; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang.StringUtils; @@ -182,5 +183,10 @@ public class SysDictItemController { return Result.error("该值不可用,系统中已存在!"); } } - + + @RequestMapping("findCacheTime") + public List> findCacheTime(){ + return sysDictItemService.findCacheTime(); + } + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java index 9629a0af..f385df6c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysTaskController.java @@ -84,16 +84,19 @@ public class SysTaskController { } @PostMapping("exportExcel") + @ApiOperation(value = "导出排班任务", notes = "导出排班任务") public void exportExcel(@DateTimeFormat(pattern = "yyyy-MM") Date yearMonth, HttpServletRequest request, HttpServletResponse response){ sysTaskService.exportExcel(yearMonth, request, response); } @GetMapping("exportImportTemplate") + @ApiOperation(value = "导出排班任务导入模板", notes = "导出排班任务导入模板") public void exportImportTemplate(HttpServletRequest request, HttpServletResponse response){ sysTaskService.exportImportTemplate(request, response); } @PostMapping("importExcel") + @ApiOperation(value = "导入排班任务", notes = "导入排班任务") public ImportViewVo importExcel(MultipartFile file){ try { int headerRow = 1; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java index 5cfc0fbc..7111f314 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -49,6 +50,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.text.ParseException; import java.util.*; import java.util.stream.Collectors; @@ -223,9 +225,22 @@ public class SysUserController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public Result delete(@RequestParam(name="id",required=true) String id) { baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3); - this.sysUserService.deleteUser(id); - return Result.ok("删除用户成功"); - } + try { + return this.sysUserService.deleteUser(id); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * 删除用户 + */ + //@RequiresPermissions("system:user:delete") + @RequestMapping(value = "/deleteById", method = RequestMethod.DELETE) + public Result deleteById(@RequestParam(name="id",required=true) String id) { + baseCommonService.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3); + return this.sysUserService.deleteById(id); + } /** * 批量删除用户 @@ -1745,4 +1760,10 @@ public class SysUserController { sysUserService.editTenantUser(sysUser,tenantId,departs,roles); return Result.ok("修改成功"); } + + @GetMapping("findUserMap") + public Map findUserMap(){ + return sysUserService.findUserMap(); + } + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java index a1432f54..74fbf875 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java @@ -10,7 +10,6 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; @@ -18,23 +17,41 @@ import java.util.Date; @TableName("GARDS_DETECTORS") public class GardsDetectors implements Serializable { + /** + * 探测器id + */ @TableField(value = "DETECTOR_ID") @NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private Integer detectorId; + /** + * 探测器编码 + */ @TableField(value = "DETECTOR_CODE") @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) 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; @@ -44,33 +61,57 @@ public class GardsDetectors implements Serializable { @TableField(value = "RATED_RESOLUTION") private Double ratedResolution; + /** + * 能量刻度范围(keV) + */ @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; + /** + * Y:在运行,状态良好;N:停止 + */ @TableField(value = "STATUS") private String status; + /** + * 说明 + */ @TableField(value = "DESCRIPTION") private String description; + /** + * 操作时间 + */ @TableField(value = "MODDATE") @NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date moddate; + /** + * 台站id + */ @TableField(value = "STATION_ID") private Integer stationId; + /** + * 台站名称 + */ @TableField(exist = false) private String stationName; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java index fa44a24e..04ca335e 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsNuclearfacility.java @@ -10,7 +10,6 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Null; import java.io.Serializable; import java.util.Date; @@ -18,70 +17,127 @@ import java.util.Date; @TableName("GARDS_NUCLEARFACILITY") public class GardsNuclearfacility implements Serializable { + /** + * 核设施id + */ @TableField(value = "FACILITY_ID") @NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private Integer facilityId; + /** + * 核设施名称 + */ @TableField(value = "FACILITY_NAME") @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private String facilityName; + /** + * 核设施类型 + */ @TableField(value = "TYPE") private String type; + /** + * 地点 + */ @TableField(value = "LOCATION") private String location; + /** + * 经度 + */ @TableField(value = "LONGITUDE") private String longitude; + /** + * 纬度 + */ @TableField(value = "LATITUDE") private String latitude; + /** + * 状态 + */ @TableField(value = "STATUS") private String status; + /** + * 修建时间 + */ @TableField(value = "BUILDDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date buildDate; + /** + * 临界时间 + */ @TableField(value = "CRITICALITYDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date criticalityDate; + /** + * 退休时间 + */ @TableField(value = "RETIREDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date retireDate; + /** + * 网格工程日期 + */ @TableField(value = "GRIDCONEETIONDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date gridconeetionDate; + /** + * 销售公司 + */ @TableField(value = "VENDOR") private String vendor; + /** + * 拥有者 + */ @TableField(value = "OWNER") private String owner; + /** + * 操作人员 + */ @TableField(value = "OPERARTOR") private String operartor; + /** + * 容量 + */ @TableField(value = "CAPACITYGROSS") private Integer capacitygross; + /** + * 容量集 + */ @TableField(value = "CAPACITYNET") private Integer capacitynet; + /** + * 热容量 + */ @TableField(value = "CAPACITYTHERMAL") private Integer capacitythermal; + /** + * 活动时间 + */ @TableField(value = "ACTIVITY_DAY") private Integer activityDay; + /** + * 活动年份 + */ @TableField(value = "ACTIVITY_YEAR") private Integer activityYear; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java index 358cf982..eb654a06 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/GardsStations.java @@ -20,47 +20,84 @@ import java.util.Date; @TableName(value = "GARDS_STATIONS") public class GardsStations implements Serializable { + /** + * 台站id + */ @TableField(value = "STATION_ID") @NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private Integer stationId; + /** + * 台站编码 + */ @TableField(value = "STATION_CODE") @NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class}) private String stationCode; + /** + * 城市编码 + */ @TableField(value = "COUNTRY_CODE") private String countryCode; + /** + * 台站类型 + */ @TableField(value = "TYPE") private String type; + /** + * 经度 + */ @TableField(value = "LON") private Double lon; + /** + * 纬度 + */ @TableField(value = "LAT") private Double lat; + /** + * 海拔 + */ @TableField(value = "ELEVATION") private Double elevation; + /** + * 描述 + */ @TableField(value = "DESCRIPTION") private String description; + /** + * 开始运行日期 + */ @TableField(value = "DATE_BEGIN") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") private Date dateBegin; + /** + * 运行终止日期 + */ @TableField(value = "DATE_END") @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") private Date dateEnd; + /** + * 运行状态 + */ @TableField(value = "STATUS") private String status; + /** + * 操作时间 + */ @TableField(value = "MODDATE") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date moddate; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java index a1e158e9..fa1aeb9c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/entity/vo/SysTaskExportVo.java @@ -12,7 +12,7 @@ public class SysTaskExportVo { @ExcelField(title = "用户名称", width = 15, sort = 2) private String userName; - @ExcelField(title = "台站名称", width = 15, sort = 3) + @ExcelField(title = "台站名称", width = 90, sort = 3) private String stationName; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsDetectorsMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsDetectorsMapper.java index 88484f87..fa056350 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsDetectorsMapper.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsDetectorsMapper.java @@ -8,8 +8,18 @@ import java.util.List; public interface GardsDetectorsMapper extends BaseMapper { + /** + * 分页查询探测器数据 + * @param page + * @param gardsDetectors + * @return + */ Page findPage(Page page, GardsDetectors gardsDetectors); + /** + * 查询探测器类型数据 + * @return + */ List findType(); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java index 3e982896..eef52594 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java @@ -1,7 +1,7 @@ package org.jeecg.modules.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.system.entity.GardsSampleData; +import org.jeecg.modules.base.entity.GardsSampleData; public interface GardsSampleDataMapper extends BaseMapper { } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsDetectorsMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsDetectorsMapper.xml index a3b9af6b..d3a4cc52 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsDetectorsMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsDetectorsMapper.xml @@ -32,6 +32,7 @@ and RTRIM(STATUS, ' ') = #{gardsDetectors.status} + order by DETECTOR_ID asc @@ -25,7 +25,7 @@ FROM sys_task t left join sys_user u on u.id = t.user_id - where t.scheduling_date BETWEEN #{firstDay} and #{lastDay} + where t.scheduling_date BETWEEN to_date(#{firstDay}, 'YYYY-MM-DD') and to_date(#{lastDay}, 'YYYY-MM-DD') \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsDetectorsService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsDetectorsService.java index b028bc24..403102b9 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsDetectorsService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsDetectorsService.java @@ -7,6 +7,7 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.modules.system.entity.GardsDetectors; import java.util.List; +import java.util.Map; public interface IGardsDetectorsService extends IService { @@ -55,6 +56,13 @@ public interface IGardsDetectorsService extends IService { * 查询全部监测器信息 * @return */ - List findDetectors(); + void findDetectors(); + + /** + * 根据台站id查询对应的探测器数据信息 + * @param stationIds + * @return + */ + Map> findStationDetectors(List stationIds); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsNuclearfacilityService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsNuclearfacilityService.java index 1e59bbaf..e009ae4b 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsNuclearfacilityService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsNuclearfacilityService.java @@ -58,4 +58,8 @@ public interface IGardsNuclearfacilityService extends IService { diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDictItemService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDictItemService.java index 803b490e..913945a6 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDictItemService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDictItemService.java @@ -4,6 +4,7 @@ import org.jeecg.modules.system.entity.SysDictItem; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; +import java.util.Map; /** *

@@ -21,4 +22,11 @@ public interface ISysDictItemService extends IService { * @return */ public List selectItemsByMainId(String mainId); + + /** + * 查询缓存时间等信息 + * @return + */ + List> findCacheTime(); + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java index 34a427f2..a1362ac1 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java @@ -17,6 +17,7 @@ import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; import java.util.Collection; import java.util.List; import java.util.Map; @@ -34,7 +35,7 @@ public interface ISysUserService extends IService { /** * 查询用户数据列表 - * + * * @param req * @param queryWrapper * @param pageSize @@ -42,7 +43,7 @@ public interface ISysUserService extends IService { * @return */ Result> queryPageList(HttpServletRequest req, LambdaQueryWrapper queryWrapper, Integer pageSize, Integer pageNo); - + /** * 重置密码 * @@ -67,7 +68,14 @@ public interface ISysUserService extends IService { * @param userId * @return */ - public boolean deleteUser(String userId); + public Result deleteUser(String userId) throws ParseException; + + /** + * 删除用户 + * @param userId + * @return + */ + public Result deleteById(String userId); /** * 批量删除用户 @@ -389,4 +397,11 @@ public interface ISysUserService extends IService { * @param departs */ void editTenantUser(SysUser sysUser, String tenantId, String departs, String roles); + + /** + * 查询用户map + * @return + */ + Map findUserMap(); + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java index 5b6bec28..4fc84417 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsDetectorsServiceImpl.java @@ -4,7 +4,6 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -12,29 +11,20 @@ import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; import org.jeecg.common.util.RedisUtil; import org.jeecg.modules.system.entity.GardsDetectors; -import org.jeecg.modules.system.entity.GardsStations; import org.jeecg.modules.system.mapper.GardsDetectorsMapper; import org.jeecg.modules.system.service.IGardsDetectorsService; -import org.jeecg.modules.system.service.IGardsStationsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import java.sql.Timestamp; import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; @Service("gardsDetectorsService") @DS("ora") public class GardsDetectorsServiceImpl extends ServiceImpl implements IGardsDetectorsService { - - @Autowired - private IGardsStationsService gardsStationsService; @Autowired private RedisUtil redisUtil; @@ -47,8 +37,8 @@ public class GardsDetectorsServiceImpl extends ServiceImpl page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); Page detectorsPage = this.baseMapper.findPage(page, gardsDetectors); detectorsPage.getRecords().forEach(item->{ - if (CollectionUtils.isNotEmpty(stationMap)) { - String stationValue = stationMap.get(item.getStationId()); + if (CollectionUtils.isNotEmpty(stationMap) && Objects.nonNull(item.getStationId())) { + String stationValue = stationMap.get(item.getStationId().toString()); if (StringUtils.isNotBlank(stationValue)){ item.setStationName(stationValue); } @@ -69,8 +59,8 @@ public class GardsDetectorsServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(GardsDetectors::getDetectorCode, gardsDetectors.getDetectorCode()); GardsDetectors detectors = this.baseMapper.selectOne(queryWrapper); if (Objects.nonNull(detectors) && !detectors.getDetectorId().equals(gardsDetectors.getDetectorId())) { - throw new RuntimeException("当前数据"+gardsDetectors.getDetectorCode()+"已存在,修改失败!"); + result.error500("当前数据"+gardsDetectors.getDetectorCode()+"已存在,修改失败!"); + return result; } } LambdaQueryWrapper detectorsQueryWrapper = new LambdaQueryWrapper<>(); detectorsQueryWrapper.eq(GardsDetectors::getDetectorId, gardsDetectors.getDetectorId()); this.baseMapper.update(gardsDetectors, detectorsQueryWrapper); result.success("修改成功"); + this.findDetectors(); return result; } @@ -131,20 +127,34 @@ public class GardsDetectorsServiceImpl extends ServiceImpl findDetectors(){ + public void findDetectors(){ + if (redisUtil.hasKey("detectorsMap")){ + redisUtil.del("detectorsMap"); + } List gardsDetectors = this.baseMapper.selectList(new LambdaQueryWrapper<>()); - HashMap map = new HashMap<>(); - if (CollectionUtils.isNotEmpty(gardsDetectors)){ - for (GardsDetectors detectors:gardsDetectors) { - map.put(detectors.getDetectorId(),detectors.getDetectorCode()); + Map detectorsMap = gardsDetectors.stream().collect(Collectors.toMap(GardsDetectors::getDetectorId, GardsDetectors::getDetectorCode)); + redisUtil.set("detectorsMap",detectorsMap); + } + + @Override + public Map> findStationDetectors(List stationIds) { + Map> map = new HashMap<>(); + if (CollectionUtils.isNotEmpty(stationIds)){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(GardsDetectors::getStationId, stationIds); + List detectorsList = this.baseMapper.selectList(queryWrapper); + for (String stationId:stationIds) { + List detectors = detectorsList.stream().filter(item -> item.getStationId().equals(Integer.valueOf(stationId)) && item.getStatus().trim().equals("Operating")).collect(Collectors.toList()); + map.put(stationId, detectors); } } - redisUtil.set("detectorsMap",map); - return gardsDetectors; + return map; } + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java index 335b82f3..eaf034cc 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsNuclearfacilityServiceImpl.java @@ -9,12 +9,15 @@ 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.util.RedisUtil; import org.jeecg.modules.system.entity.GardsNuclearfacility; import org.jeecg.modules.system.mapper.GardsNuclearfacilityMapper; import org.jeecg.modules.system.service.IGardsNuclearfacilityService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.HashMap; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -23,6 +26,9 @@ import java.util.stream.Collectors; @DS("ora") public class GardsNuclearfacilityServiceImpl extends ServiceImpl implements IGardsNuclearfacilityService { + @Autowired + private RedisUtil redisUtil; + @Override public Result> findPage(QueryRequest queryRequest, GardsNuclearfacility gardsNuclearfacility) { Result> result = new Result<>(); @@ -32,6 +38,7 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl gardsNuclearfacilityPage = this.baseMapper.selectPage(page, queryWrapper); result.setSuccess(true); result.setResult(gardsNuclearfacilityPage); @@ -70,11 +77,13 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(GardsNuclearfacility::getFacilityName, gardsNuclearfacility.getFacilityName()); GardsNuclearfacility nuclearfacility = this.baseMapper.selectOne(queryWrapper); if (Objects.nonNull(nuclearfacility) && !nuclearfacility.getFacilityId().equals(gardsNuclearfacility.getFacilityId())){ - throw new RuntimeException("当前核设施"+gardsNuclearfacility.getFacilityName()+"已存在,修改失败"); + result.error500("当前核设施"+gardsNuclearfacility.getFacilityName()+"已存在,修改失败"); + return result; } } LambdaQueryWrapper nuclearfacilityQueryWrapper = new LambdaQueryWrapper<>(); nuclearfacilityQueryWrapper.eq(GardsNuclearfacility::getFacilityId, gardsNuclearfacility.getFacilityId()); this.baseMapper.update(gardsNuclearfacility, nuclearfacilityQueryWrapper); result.success("修改成功"); + this.findNuclearFacility(); return result; } @@ -111,7 +123,23 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + List gardsNuclearfacilities = this.baseMapper.selectList(queryWrapper); + HashMap nuclearFacilityMap = new HashMap<>(); + for (GardsNuclearfacility gardsNuclearfacility:gardsNuclearfacilities) { + nuclearFacilityMap.put(String.valueOf(gardsNuclearfacility.getFacilityId()), gardsNuclearfacility); + } + redisUtil.set("nuclearFacilityMap",nuclearFacilityMap); + } + + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java index bd17ce56..d62f75fd 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java @@ -11,7 +11,7 @@ import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; import org.jeecg.common.util.RedisUtil; import org.jeecg.modules.system.entity.GardsDetectors; -import org.jeecg.modules.system.entity.GardsSampleData; +import org.jeecg.modules.base.entity.GardsSampleData; import org.jeecg.modules.system.entity.GardsStations; import org.jeecg.modules.system.mapper.GardsSampleDataMapper; import org.jeecg.modules.system.service.IGardsDetectorsService; @@ -28,20 +28,15 @@ import java.util.Objects; @Service("gardsSampleDataService") @DS("ori") public class GardsSampleDataServiceImpl extends ServiceImpl implements IGardsSampleDataService { - - @Autowired - private IGardsStationsService gardsStationsService; @Autowired private RedisUtil redisUtil; - @Autowired - private IGardsDetectorsService gardsDetectorsService; @Override public Result> findPage(QueryRequest queryRequest, GardsSampleData gardsSampleData) { //查询全部台站信息 HashMap stationMap = (HashMap) redisUtil.get("stationMap"); //查询全部监测器信息 - List detectors = gardsDetectorsService.findDetectors(); + HashMap detectorsMap = (HashMap) redisUtil.get("detectorsMap"); Result> result = new Result<>(); Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -50,19 +45,19 @@ public class GardsSampleDataServiceImpl extends ServiceImpl sampleDataPage = this.baseMapper.selectPage(page, queryWrapper); sampleDataPage.getRecords().forEach(item->{ - if (CollectionUtils.isNotEmpty(stationMap)){ - String stationValue = stationMap.get(item.getStationId()); + if (CollectionUtils.isNotEmpty(stationMap) && Objects.nonNull(item.getStationId())){ + String stationValue = stationMap.get(item.getStationId().toString()); if (StringUtils.isNotBlank(stationValue)){ item.setStationName(stationValue); } } - if (CollectionUtils.isNotEmpty(detectors)){ - for (GardsDetectors detector:detectors) { - if (detector.getDetectorId().equals(item.getDetectorId())){ - item.setDetectorsName(detector.getDetectorCode()); - } + if (CollectionUtils.isNotEmpty(detectorsMap) && Objects.nonNull(item.getDetectorId())){ + String detectorValue = detectorsMap.get(item.getDetectorId().toString()); + if (StringUtils.isNotBlank(detectorValue)){ + item.setDetectorsName(detectorValue); } } }); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java index 31c6d7ba..e455c69a 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsStationsServiceImpl.java @@ -19,9 +19,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; @Service("gardsStationsService") @DS("ora") @@ -44,6 +44,7 @@ public class GardsStationsServiceImpl extends ServiceImpl pageList = this.baseMapper.selectPage(page, queryWrapper); result.setSuccess(true); result.setResult(pageList); @@ -93,12 +94,15 @@ public class GardsStationsServiceImpl extends ServiceImpl stationsQueryWrapper = new LambdaQueryWrapper<>(); @@ -130,6 +136,7 @@ public class GardsStationsServiceImpl extends ServiceImpl getGardsStations() { + if (redisUtil.hasKey("stationMap")){ + redisUtil.del("stationMap"); + } + if (redisUtil.hasKey("stationInfoMap")) { + redisUtil.del("stationInfoMap"); + } List gardsStations = this.baseMapper.selectList(new LambdaQueryWrapper<>()); - HashMap map = new HashMap<>(); + Map stationMap = gardsStations.stream().collect(Collectors.toMap(GardsStations::getStationId, GardsStations::getStationCode)); + HashMap stationInfoMap = new HashMap<>(); if (CollectionUtils.isNotEmpty(gardsStations)){ for (GardsStations station:gardsStations) { - map.put(station.getStationId(),station.getStationCode()); + stationInfoMap.put(station.getStationId(),station); } } - redisUtil.set("stationMap",map); + redisUtil.set("stationMap",stationMap); + redisUtil.set("stationInfoMap",stationInfoMap); return gardsStations; } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictItemServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictItemServiceImpl.java index 33184a9e..973d6fcc 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictItemServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictItemServiceImpl.java @@ -1,5 +1,7 @@ package org.jeecg.modules.system.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import org.jeecg.modules.system.entity.SysDictItem; import org.jeecg.modules.system.mapper.SysDictItemMapper; import org.jeecg.modules.system.service.ISysDictItemService; @@ -7,7 +9,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.LinkedList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** *

@@ -27,4 +32,37 @@ public class SysDictItemServiceImpl extends ServiceImpl selectItemsByMainId(String mainId) { return sysDictItemMapper.selectItemsByMainId(mainId); } + + @Override + public List> findCacheTime() { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + List sysDictItems = sysDictItemMapper.selectList(queryWrapper); + List> result = new LinkedList<>(); + //获取缓存时间对应的值 + List cacheTime = sysDictItems.stream().filter(item -> item.getItemText().equals("Cache time")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(cacheTime)){ + Map cacheTimeMap = cacheTime.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue)); + result.add(cacheTimeMap); + } + //获取实际分度值 + List scaleInterval = sysDictItems.stream().filter(item -> item.getItemText().equals("Scale interval")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(scaleInterval)){ + Map scaleIntervalMap = scaleInterval.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue)); + result.add(scaleIntervalMap); + } + //获取时间线长度 + List timelineLength = sysDictItems.stream().filter(item -> item.getItemText().equals("Timeline length")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(timelineLength)){ + Map timelineLengthMap = timelineLength.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue)); + result.add(timelineLengthMap); + } + //获取更新间隔时间 + List updateIntervalTime = sysDictItems.stream().filter(item -> item.getItemText().equals("Update interval time")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(updateIntervalTime)){ + Map updateIntervalTimeMap = updateIntervalTime.stream().collect(Collectors.toMap(SysDictItem::getItemText, SysDictItem::getItemValue)); + result.add(updateIntervalTimeMap); + } + return result; + } + } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java index 0e5474d9..2fed489e 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskServiceImpl.java @@ -96,12 +96,15 @@ public class SysTaskServiceImpl extends ServiceImpl impl if (CollectionUtils.isNotEmpty(sysTaskStations)){ //遍历所有台站信息并赋值台站名称 for (SysTaskStation taskStation:sysTaskStations) { - //通过台站id查询台站code - String stationValue = stationMap.get(taskStation.getStationId()); - //如果台站数量大于0,则说明有对应的台站信息 - if (StringUtils.isNotBlank(stationValue)){ - taskStation.setStationName(stationValue); + if (StringUtils.isNotBlank(taskStation.getStationId())){ + //通过台站id查询台站code + String stationValue = stationMap.get(taskStation.getStationId()); + //如果台站数量大于0,则说明有对应的台站信息 + if (StringUtils.isNotBlank(stationValue)){ + taskStation.setStationName(stationValue); + } } + } //遍历排版任务信息 for (SysTaskVo taskVo:sysTaskVos) { @@ -151,11 +154,13 @@ public class SysTaskServiceImpl extends ServiceImpl impl if (CollectionUtils.isNotEmpty(taskStations)){ //遍历所有台站信息并赋值台站名称 for (SysTaskStation taskStation:taskStations) { - //通过stream流获取当前台站id对应的台站信息 - String stationValue = stationMap.get(taskStation.getStationId()); - //如果台站数量大于0,则说明有对应的台站信息 - if (StringUtils.isNotBlank(stationValue)){ - taskStation.setStationName(stationValue); + if (StringUtils.isNotBlank(taskStation.getStationId())){ + //通过stream流获取当前台站id对应的台站信息 + String stationValue = stationMap.get(taskStation.getStationId()); + //如果台站数量大于0,则说明有对应的台站信息 + if (StringUtils.isNotBlank(stationValue)){ + taskStation.setStationName(stationValue); + } } } for (SysTask sysTask:sysTasks) { @@ -247,18 +252,22 @@ public class SysTaskServiceImpl extends ServiceImpl impl * @param schedulingDate */ private void deleteByDate(Date schedulingDate){ - //根据排班日期查询对应的任务信息 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(SysTask::getSchedulingDate, DateUtils.formatDate(schedulingDate, "yyyy-MM-dd")); - List sysTasks = this.baseMapper.selectList(queryWrapper); - //获取任务信息的id - List taskIds = sysTasks.stream().map(SysTask::getId).collect(Collectors.toList()); - //根据任务id删除关联的台站信息 - LambdaQueryWrapper taskStationQueryWrapper = new LambdaQueryWrapper<>(); - taskStationQueryWrapper.in(SysTaskStation::getTaskId, taskIds); - sysTaskStationMapper.delete(taskStationQueryWrapper); - //根据任务id删除任务信息 - this.baseMapper.deleteBatchIds(taskIds); + try { + //根据排班日期查询对应的任务信息 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(schedulingDate, "yyyy-MM-dd"), "yyyy-MM-dd")); + List sysTasks = this.baseMapper.selectList(queryWrapper); + //获取任务信息的id + List taskIds = sysTasks.stream().map(SysTask::getId).collect(Collectors.toList()); + //根据任务id删除关联的台站信息 + LambdaQueryWrapper taskStationQueryWrapper = new LambdaQueryWrapper<>(); + taskStationQueryWrapper.in(SysTaskStation::getTaskId, taskIds); + sysTaskStationMapper.delete(taskStationQueryWrapper); + //根据任务id删除任务信息 + this.baseMapper.deleteBatchIds(taskIds); + } catch (ParseException e) { + throw new RuntimeException(e); + } } @Override @@ -279,40 +288,44 @@ public class SysTaskServiceImpl extends ServiceImpl impl @Transactional public Result changeScheduling(SysTaskChangeVo sysTaskChangeVo) { Result result = new Result(); - //来源用户相关信息查询 - //查询出当前来源用户在排版日期的任务信息 - LambdaQueryWrapper fromQueryWrapper = new LambdaQueryWrapper<>(); - fromQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getFromUserId()); - fromQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd")); - SysTask fromSysTask = this.baseMapper.selectOne(fromQueryWrapper); - //根据来源用户的任务以及台站信息查询出对应的任务及台站信息 - LambdaQueryWrapper fromTaskQueryWrapper = new LambdaQueryWrapper<>(); - fromTaskQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId()); - fromTaskQueryWrapper.in(SysTaskStation::getStationId, sysTaskChangeVo.getStationIds()); - List sysTaskStations = sysTaskStationMapper.selectList(fromTaskQueryWrapper); - //转移到用户相关信息查询 - //查询出当前转移到用户在排班日期的任务信息 - LambdaQueryWrapper toQueryWrapper = new LambdaQueryWrapper<>(); - toQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getToUserId()); - toQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd")); - SysTask toSysTask = this.baseMapper.selectOne(toQueryWrapper); - //台站信息不为空 - if (CollectionUtils.isNotEmpty(sysTaskStations)){ - //遍历当前要进行修改的台站信息 - for (SysTaskStation taskStation:sysTaskStations) { - taskStation.setTaskId(toSysTask.getId()); - sysTaskStationMapper.updateById(taskStation); + try { + //来源用户相关信息查询 + //查询出当前来源用户在排版日期的任务信息 + LambdaQueryWrapper fromQueryWrapper = new LambdaQueryWrapper<>(); + fromQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getFromUserId()); + fromQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd"), "yyyy-MM-dd")); + SysTask fromSysTask = this.baseMapper.selectOne(fromQueryWrapper); + //根据来源用户的任务以及台站信息查询出对应的任务及台站信息 + LambdaQueryWrapper fromTaskQueryWrapper = new LambdaQueryWrapper<>(); + fromTaskQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId()); + fromTaskQueryWrapper.in(SysTaskStation::getStationId, sysTaskChangeVo.getStationIds()); + List sysTaskStations = sysTaskStationMapper.selectList(fromTaskQueryWrapper); + //转移到用户相关信息查询 + //查询出当前转移到用户在排班日期的任务信息 + LambdaQueryWrapper toQueryWrapper = new LambdaQueryWrapper<>(); + toQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getToUserId()); + toQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd"), "yyyy-MM-dd")); + SysTask toSysTask = this.baseMapper.selectOne(toQueryWrapper); + //台站信息不为空 + if (CollectionUtils.isNotEmpty(sysTaskStations)){ + //遍历当前要进行修改的台站信息 + for (SysTaskStation taskStation:sysTaskStations) { + taskStation.setTaskId(toSysTask.getId()); + sysTaskStationMapper.updateById(taskStation); + } } + //判断 如果当前来源用户及日期下的排班任务对应的台站信息为空,排班任务信息删除 + LambdaQueryWrapper sysTaskStationQueryWrapper = new LambdaQueryWrapper<>(); + sysTaskStationQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId()); + List stations = sysTaskStationMapper.selectList(sysTaskStationQueryWrapper); + if (CollectionUtils.isEmpty(stations)){ + this.baseMapper.deleteById(fromSysTask); + } + result.setSuccess(true); + result.success("交接完成"); + } catch (ParseException e) { + throw new RuntimeException(e); } - //判断 如果当前来源用户及日期下的排班任务对应的台站信息为空,排班任务信息删除 - LambdaQueryWrapper sysTaskStationQueryWrapper = new LambdaQueryWrapper<>(); - sysTaskStationQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId()); - List stations = sysTaskStationMapper.selectList(sysTaskStationQueryWrapper); - if (CollectionUtils.isEmpty(stations)){ - this.baseMapper.deleteById(fromSysTask); - } - result.setSuccess(true); - result.success("交接完成"); return result; } @@ -332,7 +345,7 @@ public class SysTaskServiceImpl extends ServiceImpl impl String username = sysTaskVo.getUsername(); String stationNames = ""; for (SysTaskStation sysTaskStation:sysTaskVo.getStationList()) { - stationNames+=sysTaskStation.getStationName()+","; + stationNames+=sysTaskStation.getStationName()+StringPool.COMMA; } stationNames = stationNames.substring(0,stationNames.length()-1); if (StringUtils.isNotBlank(stationNames)){ @@ -355,6 +368,7 @@ public class SysTaskServiceImpl extends ServiceImpl impl @Override public void exportImportTemplate(HttpServletRequest request, HttpServletResponse response) { String fileName = "排班任务导入模板"; + List list = this.createList(); try { //处理需要导出的列 List annotationList = Lists.newArrayList(); @@ -365,13 +379,26 @@ public class SysTaskServiceImpl extends ServiceImpl impl annotationList.add(new Object[] {ef,field}); } } - new ExportExcel().createXlsxExcel("排班任务信息", annotationList, 2, false).writeToXlsx(request, response, fileName); + new ExportExcel().createXlsxExcel("排班任务信息", annotationList, 2, false) + .setDataList(list).writeToXlsx(request, response, fileName); } catch (IOException e) { e.printStackTrace(); throw new BusinessException("模板导出失败"); } } + private List createList(){ + List list = new ArrayList<>(); + for(int i=1;i<=2;i++){ + SysTaskExportVo vo = new SysTaskExportVo(); + vo.setSchedulingDate("1997-01-01"); + vo.setStationName("AAA"+StringPool.COMMA+"BBB"); + vo.setUserName("sample"+i); + list.add(vo); + } + return list; + } + @Override @Transactional public ImportViewVo importExcel(List dataList, int headRow) { diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskStationServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskStationServiceImpl.java index 48ae9f91..999fb755 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskStationServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTaskStationServiceImpl.java @@ -26,6 +26,7 @@ public class SysTaskStationServiceImpl extends ServiceImpl impl private SysUserTenantMapper relationMapper; @Autowired private SysUserTenantMapper userTenantMapper; + @Autowired + private SysTaskMapper sysTaskMapper; + @Autowired + private SysTaskStationMapper sysTaskStationMapper; @Value("${system.auth.defaultPassword}") private String defaultPassword; @@ -157,7 +162,10 @@ public class SysUserServiceImpl extends ServiceImpl impl if (userIds != null && userIds.size() > 0) { Map useDepNames = this.getDepNamesByUserIds(userIds); pageList.getRecords().forEach(item -> { - item.setOrgCodeTxt(useDepNames.get(item.getId())); + String value = useDepNames.get(item.getId()); + if(StringUtils.isNotBlank(value)){ + item.setOrgCodeTxt(value); + } //查询用户的租户ids List list = userTenantMapper.getTenantIdsByUserId(item.getId()); if (oConvertUtils.isNotEmpty(list)) { @@ -220,10 +228,52 @@ public class SysUserServiceImpl extends ServiceImpl impl @Override @CacheEvict(value={CacheConstant.SYS_USERS_CACHE}, allEntries=true) @Transactional(rollbackFor = Exception.class) - public boolean deleteUser(String userId) { + public Result deleteUser(String userId) throws ParseException { + //判断当前用户是否有排班任务,如果有就不让删除 + LambdaQueryWrapper taskQueryWrapper = new LambdaQueryWrapper<>(); + taskQueryWrapper.eq(SysTask::getUserId, userId); + taskQueryWrapper.ge(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(new Date()) ,"yyyy-MM-dd")); + List sysTasks = sysTaskMapper.selectList(taskQueryWrapper); + if (CollectionUtils.isNotEmpty(sysTasks)){ + return Result.error("删除失败, 当前用户存在排班任务信息!"); + } + //删除用户关联的权限信息 + LambdaQueryWrapper userRoleQueryWrapper = new LambdaQueryWrapper<>(); + userRoleQueryWrapper.eq(SysUserRole::getUserId, userId); + sysUserRoleMapper.delete(userRoleQueryWrapper); //1.删除用户 - this.removeById(userId); - return false; + this.baseMapper.deleteById(userId); + List userIds = new ArrayList<>(); + userIds.add(userId); + this.baseMapper.deleteLogicDeleted(userIds); + return Result.ok("删除用户成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result deleteById(String userId) { + //根据用户id删除排班任务信息 + LambdaQueryWrapper taskQueryWrapper = new LambdaQueryWrapper<>(); + taskQueryWrapper.eq(SysTask::getUserId, userId); + List sysTasks = sysTaskMapper.selectList(taskQueryWrapper); + //如果排班任务信息不为空,删除排班任务相关台站信息 + if (CollectionUtils.isNotEmpty(sysTasks)){ + List taskIds = sysTasks.stream().map(SysTask::getId).collect(Collectors.toList()); + LambdaQueryWrapper taskStationQueryWrapper = new LambdaQueryWrapper<>(); + taskStationQueryWrapper.in(SysTaskStation::getTaskId, taskIds); + sysTaskStationMapper.delete(taskStationQueryWrapper); + } + sysTaskMapper.delete(taskQueryWrapper); + //删除用户关联的权限信息 + LambdaQueryWrapper userRoleQueryWrapper = new LambdaQueryWrapper<>(); + userRoleQueryWrapper.eq(SysUserRole::getUserId, userId); + sysUserRoleMapper.delete(userRoleQueryWrapper); + //1.删除用户 + this.baseMapper.deleteById(userId); + List userIds = new ArrayList<>(); + userIds.add(userId); + this.baseMapper.deleteLogicDeleted(userIds); + return Result.ok("删除用户成功"); } @Override @@ -1247,6 +1297,38 @@ public class SysUserServiceImpl extends ServiceImpl impl this.updateTenantDepart(user, tenantId, departs); } + @Override + public Map findUserMap() { + Map map = new HashMap<>(); + LambdaQueryWrapper userQueryWrapper = new LambdaQueryWrapper<>(); + List sysUsers = this.baseMapper.selectList(userQueryWrapper); + LambdaQueryWrapper userRoleQueryWrapper = new LambdaQueryWrapper<>(); + List sysUserRoles = sysUserRoleMapper.selectList(userRoleQueryWrapper); + LambdaQueryWrapper roleQueryWrapper = new LambdaQueryWrapper<>(); + List sysRoles = sysRoleMapper.selectList(roleQueryWrapper); + List roles = new LinkedList<>(); + //遍历所有用户信息 + if (CollectionUtils.isNotEmpty(sysUsers)){ + for (SysUser sysUser:sysUsers) { + if (CollectionUtils.isNotEmpty(sysUserRoles)){ + //获取各用户匹配的权限集合 + List userRoles = sysUserRoles.stream().filter(item -> item.getUserId().equals(sysUser.getId())).collect(Collectors.toList()); + List 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; + } + /** * 修改租户下的部门 * @param departs diff --git a/jeecg-module-web-statistics/pom.xml b/jeecg-module-web-statistics/pom.xml new file mode 100644 index 00000000..1fd83590 --- /dev/null +++ b/jeecg-module-web-statistics/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-boot-parent + 3.5.1 + + + jeecg-module-web-statistics + + + + + org.jeecgframework.boot + jeecg-boot-starter-cloud + + + + org.jeecgframework.boot + jeecg-boot-base-core + + + + \ No newline at end of file diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/RadionuclideController.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/RadionuclideController.java new file mode 100644 index 00000000..815d2f67 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/RadionuclideController.java @@ -0,0 +1,40 @@ +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; +import org.jeecg.modules.service.IReviewedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; + +@RestController +@RequestMapping("radionuclide") +public class RadionuclideController { + + @Autowired + private IAutoService autoService; + @Autowired + 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); + } + + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/WebStatisticsController.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/WebStatisticsController.java new file mode 100644 index 00000000..def3c856 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/WebStatisticsController.java @@ -0,0 +1,96 @@ +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.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; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.io.*; +import java.util.Date; +import java.util.List; + +@RestController +@RequestMapping("webStatistics") +@Api(value = "统计分析管理", tags = "统计分析管理") +public class WebStatisticsController { + + @Autowired + private IGardsSampleDataService gardsSampleDataService; + @Autowired + private IGardsMetDataService gardsMetDataService; + @Autowired + private IGardsSohDataService gardsSohDataService; + @Autowired + private ISysDictService sysDictService; + @Autowired + private IGardsSampleCertService gardsSampleCertService; + + + @GetMapping("findStationList") + @ApiOperation(value = "根据菜单名称查询对应的台站信息", notes = "根据菜单名称查询对应的台站信息") + public Result findStationList(String menuName){ + return sysDictService.findList(menuName); + } + + @GetMapping("findParticulatePage") + @ApiOperation(value = "气溶胶分页查询", notes = "气溶胶分页查询") + public Result findParticulatePage(QueryRequest queryRequest, Integer[] stationIds, String dataType, + String spectralQualifie, @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ + return gardsSampleDataService.findParticulatePage(queryRequest, stationIds, dataType, spectralQualifie, startTime, endTime); + } + + @GetMapping("findMetPage") + @ApiOperation(value = "气象数据分页查询", notes = "气象数据分页查询") + public Result findMetPage(QueryRequest queryRequest, Integer[] stationIds,@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ + return gardsMetDataService.findMetPage(queryRequest, stationIds, startTime, endTime); + } + + @GetMapping("findSohPage") + @ApiOperation(value = "状态数据分页查询", notes = "状态数据分页查询") + public Result findSohPage(QueryRequest queryRequest, Integer[] stationIds,@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ + return gardsSohDataService.findSohPage(queryRequest, stationIds, startTime, endTime); + } + + @GetMapping("findParticulateInfo") + @ApiOperation(value = "查看IMS DATA下气溶胶数据详情", notes = "查看IMS DATA下气溶胶数据详情") + public Result findParticulateInfo(Integer sampleId){ + return gardsSampleDataService.findParticulateInfo(sampleId); + } + + @GetMapping("findParticulateEnergy") + @ApiOperation(value = "查看IMS DATA下气溶胶ENERGY数据", notes = "查看IMS DATA下气溶胶ENERGY数据") + public Result findParticulateEnergy(Integer sampleId){ + return gardsSampleDataService.findParticulateEnergy(sampleId); + } + + @GetMapping("findParticulateResolution") + @ApiOperation(value = "查看IMS DATA下气溶胶RESOLUTION数据", notes = "查看IMS DATA下气溶胶RESOLUTION数据") + public Result findParticulateResolution(Integer sampleId){ + return gardsSampleDataService.findParticulateResolution(sampleId); + } + + @GetMapping("findParticulateEfficiency") + @ApiOperation(value = "查看IMS DATA下气溶胶EFFICIENCY数据", notes = "查看IMS DATA下气溶胶EFFICIENCY数据") + public Result findParticulateEfficiency(Integer sampleId){ + return gardsSampleDataService.findParticulateEfficiency(sampleId); + } + + + @GetMapping("findParticulateCertificate") + @ApiOperation(value = "查看IMS DATA下气溶胶CERTIFICATE数据", notes = "查看IMS DATA下气溶胶CERTIFICATE数据") + public Result findParticulateCertificate(Integer sampleId){ + return gardsSampleCertService.findParticulateCertificate(sampleId); + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsAnalyses.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsAnalyses.java new file mode 100644 index 00000000..93dd0ebd --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsAnalyses.java @@ -0,0 +1,177 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; + +@Data +@TableName(value = "gards_analyses") +public class GardsAnalyses implements Serializable { + + /** + * 分析ID号 + */ + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + /** + * 样品id + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + /** + * 分析开始时间 + */ + @TableField(value = "ANALYSISBEGIN") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date analysisBegin; + + /** + * 分析结束时间 + */ + @TableField(value = "ANALYSISEND") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date analysisEnd; + + /** + * Reviewed:交互; + */ + @TableField(value = "TYPE") + private String type; + + /** + * 使用的软件名称 + */ + @TableField(value = "SOFTWARE") + private String software; + + /** + * 软件版本号 + */ + @TableField(value = "SWVERSION") + private String swVersion; + + /** + * 分析员名称 + */ + @TableField(value = "ANALYST") + private String analyst; + + /** + * 基线计数方法描述 + */ + @TableField(value = "BASELINEMETHOD") + private String baseLineMethod; + + /** + * 寻峰方法描述 + */ + @TableField(value = "PEAKSMETHOD") + private String peaksMethod; + + /** + * 核素识别方法描述 + */ + @TableField(value = "NUCLIDEMETHOD") + private String nuclideMethod; + + /** + * 不确定度计算描述 + */ + @TableField(value = "UNCCALCMETHOD") + private String unccalcMethod; + + /** + * Lc计算方法描述 + */ + @TableField(value = "LCMETHOD") + private String lcMethod; + + /** + * 寻峰起始道 + */ + @TableField(value = "SEARCHSTARTCHANNEL") + private Integer searchStartChannel; + + /** + * 寻峰结束道 + */ + @TableField(value = "SEARCHENDCHANNEL") + private Integer searchEndChannel; + + /** + * 寻峰阈值(能窗宽度) + */ + @TableField(value = "SEARCHTHRESHOLD") + private Double searchThreshold; + + /** + * 峰数目 + */ + @TableField(value = "NUMBEROFPEAKS") + private Integer numberOfPeaks; + + /** + * 总计数 + */ + @TableField(value = "TOTALCOUNTS") + private Double totalCounts; + + /** + * 分级结果 + */ + @TableField(value = "CATEGORY") + private Integer cateGory; + + /** + * 注释 + */ + @TableField(value = "COMMENTS") + private String comments; + + /** + * 操作时间 + */ + @TableField(value = "MODDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + + @TableField(value = "USEDGASPHD") + private String usedGasPhd; + + @TableField(value = "USEDDETPHD") + private String usedDetPhd; + + @TableField(value = "USEDGASPHD_ID") + private Integer usedGasPhdId; + + @TableField(value = "USEDDETPHD_ID") + private Integer usedDetPhdId; + + @TableField(value = "BASELINE_PATH") + private String baseLinePath; + + @TableField(value = "LC_PATH") + private String lcPath; + + @TableField(value = "SCAC_PATH") + private String scacPath; + + @TableField(value = "LOG_PATH") + private String logPath; + + @TableField(value = "REPORT_PAHT") + private String reportPath; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsCalibrationPairsOrig.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsCalibrationPairsOrig.java new file mode 100644 index 00000000..5bc6877d --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsCalibrationPairsOrig.java @@ -0,0 +1,68 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +@Data +@TableName(value = "gards_calibration_pairs_orig") +public class GardsCalibrationPairsOrig implements Serializable { + + /** + * 样品ID号 + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + /** + * 系统类型 G:gamma探测器的数据,#g_;B:beta探测器的数据,#b_ + */ + @TableField(value = "SAMPLE_TYPE") + private String sampleType; + + /** + * 刻度类型 energy:能量刻度;efficiency:效率刻度; + * Resolution:分辨率刻度 + */ + @TableField(value = "CALTYPE") + private String caltype; + + /** + * 来源 PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等 + */ + @TableField(value = "INPUT") + private String input; + + /** + * 刻度点ID号 + */ + @TableField(value = "IDCALPOINT") + private Integer idcalpoint; + + /** + * x轴数值 + */ + @TableField(value = "XVALUE") + private Double xvalue; + + /** + * y轴数值 + */ + @TableField(value = "YVALUE") + private Double yvalue; + + /** + * y值不确定度 + */ + @TableField(value = "UNCYVALUE") + private Double uncyvalue; + + /** + * 衰变模式 + */ + @TableField(value = "DECAY_MODE") + private String decayMode; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleAux.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleAux.java new file mode 100644 index 00000000..a97edcd5 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleAux.java @@ -0,0 +1,103 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.Date; + +@Data +@TableName(value = "gards_sample_aux") +public class GardsSampleAux implements Serializable { + + /** + * 样品ID号 + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + /** + * 样品参考ID + */ + @TableField(value = "SAMPLE_REF_ID") + private String sampleRefId; + + /** + * 样品测量ID + */ + @TableField(value = "MEASUREMENT_ID") + private String measurementId; + + /** + * 探测器本底测量ID + */ + @TableField(value = "BKGD_MEASUREMENT_ID") + private String bkgdMeasurementId; + + /** + * 气体本底测量ID + */ + @TableField(value = "GAS_BKGD_MEASUREMENT_ID") + private String gasBkgdMeasurementId; + + /** + * 样品的几何尺寸,#Sample数据块 dimension2 + */ + @TableField(value = "SAMPLE_HEIGHT") + private Double sampleHeight; + + /** + * 样品的几何尺寸,#Sample数据块 dimension1 + */ + @TableField(value = "SAMPLE_DIAMETER") + private Double sampleDiameter; + + /** + * #calibration数据块 + */ + @TableField(value = "CALIBRATION_DTG") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date calibrationDtg; + + /** + * 报文ID号 + */ + @TableField(value = "MSG_ID") + private String msgId; + + /** + * 归档瓶ID号 + */ + @TableField(value = "ARCHIVE_BOTTLE_ID") + private String archiveBottleId; + + /** + * 氙体积 + */ + @TableField(value = "XE_VOLUME") + private Double xeVolume; + + /** + * 氙体积不确定度 + */ + @TableField(value = "XE_VOLUME_UNCER") + private Double xeVolumeUncer; + + /** + * 氙收集效率 + */ + @TableField(value = "XE_COLLECTION_YIED") + private Double xeCollectionYied; + + /** + * 氙收集效率不确定度 + */ + @TableField(value = "XE_COLLECTION_YIED_UNCER") + private Double xeCollectionYiedUncer; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleCert.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleCert.java new file mode 100644 index 00000000..5859b4a7 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleCert.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "gards_sample_cert") +public class GardsSampleCert implements Serializable { + + /** + * 台站ID号 + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + /** + * 刻度源活度(Bq)total_source_activity + */ + @TableField(value = "QUANTITY") + private Integer quantity; + + /** + * 鉴定日期 + */ + @TableField(value = "ASSAY_DATE") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date assayDate; + + /** + * 单位 + */ + @TableField(value = "UNIT") + private String unit; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleCertLine.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleCertLine.java new file mode 100644 index 00000000..32f94f2f --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleCertLine.java @@ -0,0 +1,79 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +@Data +@TableName(value = "gards_sample_cert_line") +public class GardsSampleCertLine implements Serializable { + + /** + * 台站ID号 + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + /** + * 核素名称 + */ + @TableField(value = "NUCL_NAME") + private String nuclName; + + /** + * 半衰期(秒S、小时H、天D、年Y) + */ + @TableField(value = "HALFLIFE") + private String halflife; + + /** + * γ能量(keV) + */ + @TableField(value = "ENERGY") + private Integer energy; + + /** + * 核素活度(Bq) + */ + @TableField(value = "ACTIVITY") + private Integer activity; + + /** + * 核素活度不确定度(%) + */ + @TableField(value = "ERROR") + private Integer error; + + /** + * γ射线强度(%) + */ + @TableField(value = "ABUNDANCE") + private Integer abundance; + + /** + * β射线强度(%) + */ + @TableField(value = "B_ABUNDANCE") + private Integer bAbundance; + + /** + * β能量 + */ + @TableField(value = "B_ENERGY") + private Integer bEnergy; + + /** + * 衰变模式: + */ + @TableField(value = "DECAY_MODE") + private String decayMode; + + /** + * 半衰期单位 + */ + @TableField(value = "HALFLIFT_UNIT") + private String halfliftUnit; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleDescription.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleDescription.java new file mode 100644 index 00000000..d23e6873 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/GardsSampleDescription.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +@Data +@TableName(value = "gards_sample_description") +public class GardsSampleDescription implements Serializable { + + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + @TableField(value = "DESCRIPTION") + private String description; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/SysDict.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/SysDict.java new file mode 100644 index 00000000..8bca9136 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/SysDict.java @@ -0,0 +1,50 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "sys_dict") +public class SysDict implements Serializable { + + @TableField(value = "id") + private String id; + + @TableField(value = "dict_name") + private String dictName; + + @TableField(value = "dict_code") + private String dictCode; + + @TableField(value = "description") + private String description; + + @TableField(value = "del_flag") + private Integer delFlag; + + @TableField(value = "create_by") + private String createBy; + + @TableField(value = "create_time") + private Date createTime; + + @TableField(value = "update_by") + private String updateBy; + + @TableField(value = "update_time") + private Date updateTime; + + @TableField(value = "type") + private Integer type; + + @TableField(value = "tenant_id") + private Integer tenantId; + + @TableField(value = "low_app_id") + private String lowAppId; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/SysDictItem.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/SysDictItem.java new file mode 100644 index 00000000..776d4aa4 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/SysDictItem.java @@ -0,0 +1,80 @@ +package org.jeecg.modules.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @Author zhangweijian + * @since 2018-12-28 + */ +@Data +@TableName(value = "sys_dict_item") +public class SysDictItem implements Serializable { + + /** + * id + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; + + /** + * 字典id + */ + @TableField(value = "dict_id") + private String dictId; + + /** + * 字典项文本 + */ + @TableField(value = "item_text") + private String itemText; + + /** + * 字典项值 + */ + @TableField(value = "item_value") + private String itemValue; + + /** + * 描述 + */ + @TableField(value = "description") + private String description; + + /** + * 排序 + */ + @TableField(value = "sort_order") + private Integer sortOrder; + + + /** + * 状态(1启用 0不启用) + */ + @TableField(value = "status") + private Integer status; + + @TableField(value = "create_by") + private String createBy; + + @TableField(value = "create_time") + private Date createTime; + + @TableField(value = "update_by") + private String updateBy; + + @TableField(value = "update_time") + private Date updateTime; + + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsAnalysesMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsAnalysesMapper.java new file mode 100644 index 00000000..b878d5c2 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsAnalysesMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsAnalyses; + +public interface GardsAnalysesMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsCalibrationPairsOrigMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsCalibrationPairsOrigMapper.java new file mode 100644 index 00000000..e71c3024 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsCalibrationPairsOrigMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsCalibrationPairsOrig; + +public interface GardsCalibrationPairsOrigMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsMetDataMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsMetDataMapper.java new file mode 100644 index 00000000..41a19fc0 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsMetDataMapper.java @@ -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 GardsMetDataMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleAuxMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleAuxMapper.java new file mode 100644 index 00000000..e92f66b1 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleAuxMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsSampleAux; + +public interface GardsSampleAuxMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleCertLineMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleCertLineMapper.java new file mode 100644 index 00000000..15f9efa9 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleCertLineMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsSampleCertLine; + +public interface GardsSampleCertLineMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleCertMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleCertMapper.java new file mode 100644 index 00000000..386c3f59 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleCertMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsSampleCert; + +public interface GardsSampleCertMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataMapper.java new file mode 100644 index 00000000..35071cf0 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.GardsSampleData; + +public interface GardsSampleDataMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDescriptionMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDescriptionMapper.java new file mode 100644 index 00000000..e08f418a --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDescriptionMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.GardsSampleDescription; + +public interface GardsSampleDescriptionMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSohDataMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSohDataMapper.java new file mode 100644 index 00000000..268c980d --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSohDataMapper.java @@ -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 GardsSohDataMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDictItemMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDictItemMapper.java new file mode 100644 index 00000000..a84dba66 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDictItemMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.SysDictItem; + +public interface SysDictItemMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDictMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDictMapper.java new file mode 100644 index 00000000..948c1789 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDictMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.entity.SysDict; + +public interface SysDictMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IAutoService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IAutoService.java new file mode 100644 index 00000000..045e710d --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IAutoService.java @@ -0,0 +1,15 @@ +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.GardsAnalyses; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +public interface IAutoService extends IService { + + Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsMetDataService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsMetDataService.java new file mode 100644 index 00000000..5241c1ec --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsMetDataService.java @@ -0,0 +1,24 @@ +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.base.entity.GardsMetData; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +public interface IGardsMetDataService extends IService { + + /** + * 分页查询气象数据信息 + * @param queryRequest + * @param stationIds + * @param startTime + * @param endTime + * @return + */ + Result findMetPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleCertService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleCertService.java new file mode 100644 index 00000000..bbb1acc0 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleCertService.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.entity.GardsSampleCert; + +public interface IGardsSampleCertService extends IService { + + Result findParticulateCertificate(Integer sampleId); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataService.java new file mode 100644 index 00000000..8571ef02 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataService.java @@ -0,0 +1,60 @@ +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.base.entity.GardsSampleData; + +import java.util.Date; +import java.util.List; + + +public interface IGardsSampleDataService extends IService { + + /** + * 分页查询气溶胶相关数据 + * @param queryRequest + * @param stationIds + * @param dataType + * @param spectralQualifie + * @param startTime + * @param endTime + * @return + */ + Result findParticulatePage(QueryRequest queryRequest, Integer[] stationIds, String dataType, String spectralQualifie, Date startTime,Date endTime); + + /** + * 查询谱数据详细信息 + * @param sampleId + * @return + */ + Result findParticulateInfo(Integer sampleId); + + /** + * 查询谱数据的能量数据 + * @param sampleId + * @return + */ + Result findParticulateEnergy(Integer sampleId); + + /** + * 查询 + * @param sampleId + * @return + */ + Result findParticulateResolution(Integer sampleId); + + /** + * 查询 + * @param sampleId + * @return + */ + Result findParticulateEfficiency(Integer sampleId); + + /** + * 查询全部基础数据 + * @return + */ + Result findPageBySampleIds(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime, List sampleIds); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSohDataService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSohDataService.java new file mode 100644 index 00000000..2e0d2f5b --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSohDataService.java @@ -0,0 +1,23 @@ +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.base.entity.GardsSohData; + +import java.util.Date; +import java.util.List; + +public interface IGardsSohDataService extends IService { + + /** + * 分页查询状态数据信息 + * @param queryRequest + * @param stationIds + * @param startTime + * @param endTime + * @return + */ + Result findSohPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IReviewedService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IReviewedService.java new file mode 100644 index 00000000..dad18d6c --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IReviewedService.java @@ -0,0 +1,15 @@ +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.GardsAnalyses; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +public interface IReviewedService extends IService { + + Result findReviewedPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysDictService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysDictService.java new file mode 100644 index 00000000..e4b799b9 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysDictService.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.entity.SysDict; + +public interface ISysDictService extends IService { + + /** + * 根据系统类型查询对应的台站信息 + * @param menuName + * @return + */ + Result findList(String menuName); + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/AutoServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/AutoServiceImpl.java new file mode 100644 index 00000000..b3913992 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/AutoServiceImpl.java @@ -0,0 +1,44 @@ +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.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.base.entity.GardsSampleData; +import org.jeecg.modules.mapper.GardsAnalysesMapper; +import org.jeecg.modules.service.IAutoService; +import org.jeecg.modules.service.IGardsSampleDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Service("autoService") +@DS("auo") +public class AutoServiceImpl extends ServiceImpl implements IAutoService { + + @Autowired + private IGardsSampleDataService gardsSampleDataService; + + @Override + public Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime) { + //查询自动处理后的 + LambdaQueryWrapper analysesQueryWrapper = new LambdaQueryWrapper<>(); + List gardsAnalyses = this.baseMapper.selectList(analysesQueryWrapper); + if (CollectionUtils.isNotEmpty(gardsAnalyses)){ + //获取全部样品id + List sampleIds = gardsAnalyses.stream().map(GardsAnalyses::getSampleId).collect(Collectors.toList()); + //查询全部样品基础数据 + Result result = gardsSampleDataService.findPageBySampleIds(queryRequest, stationIds, startTime, endTime, sampleIds); + return result; + }else { + return null; + } + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java new file mode 100644 index 00000000..45dd932a --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java @@ -0,0 +1,59 @@ +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.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.util.DateUtils; +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; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@Service("gardsMetDataService") +@DS("ori") +public class GardsMetDataServiceImpl extends ServiceImpl implements IGardsMetDataService { + + @Override + public Result findMetPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime) { + try { + Result result = new Result(); + if (Objects.isNull(stationIds)){ + result.setResult(Collections.emptyList()); + return result; + } + 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"); + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(GardsMetData::getStationId, stationIds); + queryWrapper.ge(GardsMetData::getStartTime, startDate); + queryWrapper.le(GardsMetData::getEndTime, endDate); + Page metDataPage = this.baseMapper.selectPage(page, queryWrapper); + result.setSuccess(true); + result.setResult(metDataPage); + return result; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleCertServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleCertServiceImpl.java new file mode 100644 index 00000000..27414116 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleCertServiceImpl.java @@ -0,0 +1,51 @@ +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.extension.service.impl.ServiceImpl; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.entity.GardsSampleCert; +import org.jeecg.modules.entity.GardsSampleCertLine; +import org.jeecg.modules.mapper.GardsSampleCertLineMapper; +import org.jeecg.modules.mapper.GardsSampleCertMapper; +import org.jeecg.modules.service.IGardsSampleCertService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@Service("gardsSampleCertService") +@DS("ori") +public class GardsSampleCertServiceImpl extends ServiceImpl implements IGardsSampleCertService { + + @Autowired + private GardsSampleCertLineMapper gardsSampleCertLineMapper; + + @Override + public Result findParticulateCertificate(Integer sampleId) { + Result result = new Result(); + Map map = new HashMap<>(); + LambdaQueryWrapper certLQueryWrapper = new LambdaQueryWrapper<>(); + certLQueryWrapper.eq(GardsSampleCert::getSampleId, sampleId); + GardsSampleCert gardsSampleCert = this.baseMapper.selectOne(certLQueryWrapper); + if (Objects.nonNull(gardsSampleCert)){ + map.put("Total Source Activity", gardsSampleCert.getQuantity()); + map.put("Assay Date", gardsSampleCert.getAssayDate()); + map.put("Units of Activity", gardsSampleCert.getUnit()); + } + LambdaQueryWrapper certLineQueryWrapper = new LambdaQueryWrapper<>(); + certLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId); + List sampleCertLines = gardsSampleCertLineMapper.selectList(certLineQueryWrapper); + if (CollectionUtils.isNotEmpty(sampleCertLines)){ + map.put("table", sampleCertLines); + } + result.setSuccess(true); + result.setResult(map); + return result; + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataServiceImpl.java new file mode 100644 index 00000000..6076eb51 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataServiceImpl.java @@ -0,0 +1,279 @@ +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.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +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.GardsCalibrationPairsOrig; +import org.jeecg.modules.entity.GardsSampleAux; +import org.jeecg.modules.base.entity.GardsSampleData; +import org.jeecg.modules.entity.GardsSampleDescription; +import org.jeecg.modules.mapper.GardsCalibrationPairsOrigMapper; +import org.jeecg.modules.mapper.GardsSampleAuxMapper; +import org.jeecg.modules.mapper.GardsSampleDataMapper; +import org.jeecg.modules.mapper.GardsSampleDescriptionMapper; +import org.jeecg.modules.service.IGardsSampleDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.text.ParseException; +import java.util.*; +import java.util.stream.Collectors; + +@Service("gardsSampleDataService") +@DS("ori") +public class GardsSampleDataServiceImpl extends ServiceImpl implements IGardsSampleDataService { + + @Autowired + private RedisUtil redisUtil; + @Autowired + private GardsSampleAuxMapper gardsSampleAuxMapper; + @Autowired + private GardsCalibrationPairsOrigMapper gardsCalibrationPairsOrigMapper; + @Autowired + private GardsSampleDescriptionMapper gardsSampleDescriptionMapper; + + @Override + public Result findParticulatePage(QueryRequest queryRequest, Integer[] stationIds, String dataType, String spectralQualifie, Date startTime,Date endTime) { + try { + Result result = new Result(); + //获取redis中缓存的台站信息 + Map stationMap = (Map)redisUtil.get("stationMap"); + if (StringUtils.isBlank(dataType)) { + result.error500("数据类型不能为空"); + return result; + } + if (Objects.isNull(startTime)){ + result.error500("开始时间不能为空"); + return result; + } + if (Objects.isNull(endTime)){ + result.error500("结束时间不能为空"); + return result; + } + if (Objects.isNull(stationIds)){ + result.setSuccess(true); + result.setResult(Collections.emptyList()); + 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"); + //声明page + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + //声明Lambda 传递参数进行条件查询 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(GardsSampleData::getDataType, dataType); + //数据分为全谱与过程谱则使用采集日期进行日期查询 + if (StringUtils.isNotBlank(spectralQualifie)) { + queryWrapper.eq(GardsSampleData::getSpectralQualifie, spectralQualifie); + queryWrapper.ge(GardsSampleData::getCollectStart, startDate); + queryWrapper.le(GardsSampleData::getCollectStop, endDate); + }else {//数据不区分全谱与过程谱则使用 + queryWrapper.ge(GardsSampleData::getAcquisitionStart, startDate); + queryWrapper.le(GardsSampleData::getAcquisitionStop, endDate); + } + queryWrapper.in(GardsSampleData::getStationId, stationIds); + //进行分页查询 + Page sampleDataPage = this.baseMapper.selectPage(page, queryWrapper); + sampleDataPage.getRecords().forEach(item->{ + item.setSiteDetCode(StringUtils.trim(item.getSiteDetCode())); + if (stationMap.containsKey(item.getStationId().toString()) && CollectionUtils.isNotEmpty(stationMap)){ + String stationName = stationMap.get(item.getStationId().toString()); + item.setStationName(stationName); + } + }); + result.setSuccess(true); + result.setResult(sampleDataPage); + return result; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + @Override + public Result findParticulateInfo(Integer sampleId) { + Result result = new Result(); + Map map = new HashMap<>(); + //获取redis中缓存的台站信息 + Map stationMap = (Map)redisUtil.get("stationMap"); + //根据sample_id查询sample_data内容 + LambdaQueryWrapper sampleDataQueryWrapper = new LambdaQueryWrapper<>(); + sampleDataQueryWrapper.eq(GardsSampleData::getSampleId, sampleId); + GardsSampleData gardsSampleData = this.baseMapper.selectOne(sampleDataQueryWrapper); + if (Objects.nonNull(gardsSampleData) && CollectionUtils.isNotEmpty(stationMap)){ + String stationName = stationMap.get(gardsSampleData.getStationId().toString()); + gardsSampleData.setStationName(stationName); + } + //根据sample_id查询sample_aux内容 + LambdaQueryWrapper sampleAuxQueryWrapper = new LambdaQueryWrapper<>(); + sampleAuxQueryWrapper.eq(GardsSampleAux::getSampleId, sampleId); + GardsSampleAux gardsSampleAux = gardsSampleAuxMapper.selectOne(sampleAuxQueryWrapper); + //查询comment数据 + LambdaQueryWrapper descriptionQueryWrapper = new LambdaQueryWrapper<>(); + descriptionQueryWrapper.eq(GardsSampleDescription::getSampleId, sampleId); + GardsSampleDescription gardsSampleDescription = gardsSampleDescriptionMapper.selectOne(descriptionQueryWrapper); + if (Objects.nonNull(gardsSampleData)){ + //封装数据内容 + map.put("Site Code", gardsSampleData.getStationName()); + map.put("Detector Code",gardsSampleData.getSiteDetCode()); + map.put("System Type",gardsSampleData.getSampleType()); + map.put("Sample Geometry",gardsSampleData.getGeometry()); + map.put("Spectrum Qualifier",gardsSampleData.getSpectralQualifie()); + map.put("Transmit Time", gardsSampleData.getTransmitDtg()); + map.put("Acquisition Time", gardsSampleData.getAcquisitionStart()); + map.put("Acquisition Real Time", gardsSampleData.getAcquisitionRealSec()); + map.put("Acquisition Live Time", gardsSampleData.getAcquisitionLiveSec()); + } + if (Objects.nonNull(gardsSampleAux)){ + map.put("Sample Reference Identification", gardsSampleAux.getSampleRefId()); + map.put("Measurement Identification", gardsSampleAux.getMeasurementId()); + map.put("Detector Background Measurement Identification", gardsSampleAux.getBkgdMeasurementId()); + map.put("Gas Background Measurement Identification", gardsSampleAux.getGasBkgdMeasurementId()); + map.put("Date of Last Calibration", gardsSampleAux.getCalibrationDtg()); + } + if (Objects.nonNull(gardsSampleDescription)){ + map.put("COMMENT", gardsSampleDescription.getDescription()); + } + result.setSuccess(true); + result.setResult(map); + return result; + } + + @Override + public Result findParticulateEnergy(Integer sampleId) { + Result result = new Result(); + //map 封装三个数组 + Map> map = new HashMap<>(); + //封装存储 g_energy + List GEnergyList = new LinkedList<>(); + //封装存储 Centroid channel + List centroidChannelList = new LinkedList<>(); + //封装存储 Uncertainty + List uncertaintyList = new LinkedList<>(); + LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); + calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); + List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); + gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item-> item.getCaltype().trim().equals("energy")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ + for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + // Xvalue 对应 centroid channel + centroidChannelList.add(orig.getXvalue()); + // Yvalue 对应 g_energy + GEnergyList.add(orig.getYvalue()); + // Uncyvalue 对应 Uncertainty + uncertaintyList.add(orig.getUncyvalue()); + } + } + map.put("G_Energy", GEnergyList); + map.put("Centroid channel", centroidChannelList); + map.put("Uncertainty", uncertaintyList); + result.setSuccess(true); + result.setResult(map); + return result; + } + + @Override + public Result findParticulateResolution(Integer sampleId) { + Result result = new Result(); + //map 封装三个数组 + Map> map = new HashMap<>(); + //封装存储 g_energy + List GEnergyList = new LinkedList<>(); + //封装存储 FWHM + List FWHMList = new LinkedList<>(); + //封装存储 Uncertainty + List uncertaintyList = new LinkedList<>(); + LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); + calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); + List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); + gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item-> item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ + for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + // Xvalue 对应 energy + GEnergyList.add(orig.getXvalue()); + // YValue 对应 efficiency + FWHMList.add(orig.getYvalue()); + // UncyValue 对应 Uncertainty + uncertaintyList.add(orig.getUncyvalue()); + } + } + map.put("G_energy", GEnergyList); + map.put("FWHM", FWHMList); + map.put("Uncertainty", uncertaintyList); + result.setSuccess(true); + result.setResult(map); + return result; + } + + @Override + public Result findParticulateEfficiency(Integer sampleId) { + Result result = new Result(); + //map 封装三个数组 + Map> map = new HashMap<>(); + //封装存储 energy + List energyList = new LinkedList<>(); + //封装存储 efficiency + List efficiencyList = new LinkedList<>(); + //封装存储 Uncertainty + List uncertaintyList = new LinkedList<>(); + LambdaQueryWrapper calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>(); + calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId); + List gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper); + gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("efficiency")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){ + for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) { + // Xvalue 对应 energy + energyList.add(orig.getXvalue()); + // YValue 对应 efficiency + efficiencyList.add(orig.getYvalue()); + // UncyValue 对应 Uncertainty + uncertaintyList.add(orig.getUncyvalue()); + } + } + map.put("Energy", energyList); + map.put("Efficiency", efficiencyList); + map.put("Uncertainty", uncertaintyList); + result.setSuccess(true); + result.setResult(map); + return result; + } + + @Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class) + public Result findPageBySampleIds(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime, List sampleIds){ + Result result = new Result(); + try { + //获取redis中缓存的台站信息 + Map stationMap = (Map)redisUtil.get("stationMap"); + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + 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") + " 00:00:00", "yyyy-MM-dd HH:mm:ss"); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(GardsSampleData::getStationId, stationIds); + queryWrapper.in(GardsSampleData::getSampleId, sampleIds); + queryWrapper.ge(GardsSampleData::getCollectStart, startDate); + queryWrapper.le(GardsSampleData::getCollectStop, endDate); + Page sampleDataPage = this.baseMapper.selectPage(page, queryWrapper); + sampleDataPage.getRecords().forEach(item->{ + item.setSiteDetCode(StringUtils.trim(item.getSiteDetCode())); + if (stationMap.containsKey(item.getStationId().toString()) && CollectionUtils.isNotEmpty(stationMap)){ + String stationName = stationMap.get(item.getStationId().toString()); + item.setStationName(stationName); + } + }); + result.setSuccess(true); + result.setResult(sampleDataPage); + return result; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java new file mode 100644 index 00000000..3526df39 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java @@ -0,0 +1,69 @@ +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.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +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.base.entity.GardsSohData; +import org.jeecg.modules.mapper.GardsSohDataMapper; +import org.jeecg.modules.service.IGardsSohDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.util.*; + +@Service("gardsSohDataService") +@DS("ori") +public class GardsSohDataServiceImpl extends ServiceImpl implements IGardsSohDataService { + + @Autowired + private RedisUtil redisUtil; + + @Override + public Result findSohPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime) { + try { + Result result = new Result(); + if (Objects.isNull(stationIds)){ + result.setResult(Collections.emptyList()); + return result; + } + 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"); + //获取redis中缓存的探测器信息 + Map detectorsMap = (Map)redisUtil.get("detectorsMap"); + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(GardsSohData::getStationId, stationIds); + queryWrapper.ge(GardsSohData::getStartTime, startDate); + queryWrapper.le(GardsSohData::getStartTime, endDate); + Page sohDataPage = this.baseMapper.selectPage(page, queryWrapper); + sohDataPage.getRecords().forEach(item->{ + if (Objects.nonNull(item.getDetectorId()) && detectorsMap.containsKey(item.getDetectorId().toString())){ + String detectorName = detectorsMap.get(item.getDetectorId().toString()); + item.setDetectorName(detectorName); + } + }); + result.setSuccess(true); + result.setResult(sohDataPage); + return result; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/ReviewedServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/ReviewedServiceImpl.java new file mode 100644 index 00000000..a65066c7 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/ReviewedServiceImpl.java @@ -0,0 +1,42 @@ +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.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.mapper.GardsAnalysesMapper; +import org.jeecg.modules.service.IGardsSampleDataService; +import org.jeecg.modules.service.IReviewedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Service("reviewedService") +@DS("man") +public class ReviewedServiceImpl extends ServiceImpl implements IReviewedService { + + @Autowired + private IGardsSampleDataService gardsSampleDataService; + + @Override + public Result findReviewedPage(QueryRequest queryRequest, Integer[] stationIds, Date startTime, Date endTime) { + //查询自动处理后的 + LambdaQueryWrapper analysesQueryWrapper = new LambdaQueryWrapper<>(); + List gardsAnalyses = this.baseMapper.selectList(analysesQueryWrapper); + if (CollectionUtils.isNotEmpty(gardsAnalyses)){ + //获取全部样品id + List sampleIds = gardsAnalyses.stream().map(GardsAnalyses::getSampleId).collect(Collectors.toList()); + //查询全部样品基础数据 + Result result = gardsSampleDataService.findPageBySampleIds(queryRequest, stationIds, startTime, endTime, sampleIds); + return result; + }else { + return null; + } + } +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/SysDictServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/SysDictServiceImpl.java new file mode 100644 index 00000000..68054528 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/SysDictServiceImpl.java @@ -0,0 +1,68 @@ +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.core.toolkit.StringPool; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.entity.SysDict; +import org.jeecg.modules.entity.SysDictItem; +import org.jeecg.modules.mapper.SysDictItemMapper; +import org.jeecg.modules.mapper.SysDictMapper; +import org.jeecg.modules.service.ISysDictService; +import org.jeecg.modules.system.entity.GardsStations; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +@Service("sysDictService") +public class SysDictServiceImpl extends ServiceImpl implements ISysDictService { + + @Autowired + private RedisUtil redisUtil; + @Autowired + private SysDictMapper sysDictMapper; + @Autowired + private SysDictItemMapper sysDictItemMapper; + + @Override + public Result findList(String menuName) { + Result result = new Result(); + List gardsStationsList = new LinkedList<>(); + //获取台站信息 + HashMap stationInfoMap = (HashMap) redisUtil.get("stationInfoMap"); + List stationsList = stationInfoMap.values().stream().collect(Collectors.toList()); + //如果传递的菜单名称不为空 则需要过滤出所需的台站信息 + if (StringUtils.isNotBlank(menuName)){ + //根据菜单名称查询出数据字典中对应的内容 + LambdaQueryWrapper dictQueryWrapper = new LambdaQueryWrapper<>(); + dictQueryWrapper.eq(SysDict::getDictCode, menuName); + SysDict sysDict = sysDictMapper.selectOne(dictQueryWrapper); + //如果字典内容不为空 + if (Objects.nonNull(sysDict)){ + LambdaQueryWrapper dictItemQueryWrapper = new LambdaQueryWrapper<>(); + dictItemQueryWrapper.eq(SysDictItem::getDictId, sysDict.getId()); + List dictItems = sysDictItemMapper.selectList(dictItemQueryWrapper); + List types = dictItems.stream().map(SysDictItem::getItemValue).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(types)){ + //遍历过滤出和类型匹配的台站信息 存入新的数据集合中 + for (String type:types) { + gardsStationsList.addAll(stationsList.stream().filter(item-> StringUtils.isNotBlank(item.getType()) && item.getType().equals(type)).collect(Collectors.toList())); + } + } + }else { + gardsStationsList.addAll(stationsList); + } + }else { + gardsStationsList.addAll(stationsList); + } + result.setSuccess(true); + result.setResult(gardsStationsList); + return result; + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java new file mode 100644 index 00000000..e022036b --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/system/entity/GardsDetectors.java @@ -0,0 +1,74 @@ +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.time.LocalDateTime; +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; + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/system/entity/GardsStations.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/system/entity/GardsStations.java new file mode 100644 index 00000000..cebc87bc --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/system/entity/GardsStations.java @@ -0,0 +1,59 @@ +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.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; + +@Data +@TableName(value = "GARDS_STATIONS") +public class GardsStations implements Serializable { + + @TableField(value = "STATION_ID") + private Integer stationId; + + @TableField(value = "STATION_CODE") + private String stationCode; + + @TableField(value = "COUNTRY_CODE") + private String countryCode; + + @TableField(value = "TYPE") + private String type; + + @TableField(value = "LON") + private Double lon; + + @TableField(value = "LAT") + private Double lat; + + @TableField(value = "ELEVATION") + private Double elevation; + + @TableField(value = "DESCRIPTION") + private String description; + + @TableField(value = "DATE_BEGIN") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date dateBegin; + + @TableField(value = "DATE_END") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date dateEnd; + + @TableField(value = "STATUS") + private String status; + + @TableField(value = "MODDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + +} diff --git a/jeecg-server-cloud/jeecg-abnormal-alarm-start/pom.xml b/jeecg-server-cloud/jeecg-abnormal-alarm-start/pom.xml new file mode 100644 index 00000000..7e5f8266 --- /dev/null +++ b/jeecg-server-cloud/jeecg-abnormal-alarm-start/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-server-cloud + 3.5.1 + + + jeecg-abnormal-alarm-start + + + + + org.jeecgframework.boot + jeecg-module-abnormal-alarm + 3.5.1 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/java/org/jeecg/JeecgAbnormalAlarmApplication.java b/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/java/org/jeecg/JeecgAbnormalAlarmApplication.java new file mode 100644 index 00000000..a7fa949f --- /dev/null +++ b/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/java/org/jeecg/JeecgAbnormalAlarmApplication.java @@ -0,0 +1,47 @@ +package org.jeecg; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.oConvertUtils; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.EnableScheduling; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +@Slf4j +@SpringBootApplication +@EnableFeignClients(basePackages = {"org.jeecg"}) +@EnableScheduling +public class JeecgAbnormalAlarmApplication extends SpringBootServletInitializer implements CommandLineRunner { + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JeecgAbnormalAlarmApplication.class); + } + + public static void main(String[] args) throws UnknownHostException { + ConfigurableApplicationContext application = SpringApplication.run(JeecgAbnormalAlarmApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); + log.info("\n----------------------------------------------------------\n\t" + + "Application Jeecg-Boot is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/doc.html\n" + + "External: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + } + + @Override + public void run(String... args) throws Exception { + + } + +} \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/resources/application.yml new file mode 100644 index 00000000..f10a11e4 --- /dev/null +++ b/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/resources/application.yml @@ -0,0 +1,18 @@ +server: + port: 7006 + +spring: + application: + name: jeecg-abnormal-alarm + cloud: + nacos: + config: + server-addr: @config.server-addr@ + group: @config.group@ + namespace: @config.namespace@ + discovery: + server-addr: ${spring.cloud.nacos.config.server-addr} + config: + import: + - optional:nacos:jeecg.yaml + - optional:nacos:jeecg-@profile.name@.yaml \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/resources/logback-spring.xml b/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..60d4c7df --- /dev/null +++ b/jeecg-server-cloud/jeecg-abnormal-alarm-start/src/main/resources/logback-spring.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.log + + 30 + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n + + + + + + + + ERROR + + + + %p%d%msg%M%F{32}%L + + + ${LOG_HOME}/error-log.html + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.html + + 30 + 10MB + + + + %p%d%msg%M%F{32}%L + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-auto-process-start/pom.xml b/jeecg-server-cloud/jeecg-auto-process-start/pom.xml new file mode 100644 index 00000000..bf367068 --- /dev/null +++ b/jeecg-server-cloud/jeecg-auto-process-start/pom.xml @@ -0,0 +1,42 @@ + + + + jeecg-server-cloud + org.jeecgframework.boot + 3.5.1 + + 4.0.0 + + jeecg-auto-process-start + + + + + org.jeecgframework.boot + jeecg-boot-starter-cloud + + + + org.jeecgframework.boot + jeecg-boot-base-core + + + + org.jeecgframework.boot + jeecg-module-auto-process + 3.5.1 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-auto-process-start/src/main/java/org/jeecg/JeecgAutoProcessApplication.java b/jeecg-server-cloud/jeecg-auto-process-start/src/main/java/org/jeecg/JeecgAutoProcessApplication.java new file mode 100644 index 00000000..c6c9daa7 --- /dev/null +++ b/jeecg-server-cloud/jeecg-auto-process-start/src/main/java/org/jeecg/JeecgAutoProcessApplication.java @@ -0,0 +1,54 @@ +package org.jeecg; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.AutoProcessManager; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.EnableScheduling; +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * @author 86187 + */ +@Slf4j +@SpringBootApplication +@EnableFeignClients(basePackages = {"org.jeecg"}) +@EnableScheduling +@RequiredArgsConstructor +public class JeecgAutoProcessApplication extends SpringBootServletInitializer implements CommandLineRunner { + + private final AutoProcessManager autoProcessManager; + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JeecgAutoProcessApplication.class); + } + + public static void main(String[] args) throws UnknownHostException { + ConfigurableApplicationContext application = SpringApplication.run(JeecgAutoProcessApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); + log.info("\n----------------------------------------------------------\n\t" + + "Application Jeecg-Boot is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/doc.html\n" + + "External: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + } + + @Override + public void run(String... args) throws Exception { + autoProcessManager.start(); + } +} \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-auto-process-start/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-auto-process-start/src/main/resources/application.yml new file mode 100644 index 00000000..9eb26427 --- /dev/null +++ b/jeecg-server-cloud/jeecg-auto-process-start/src/main/resources/application.yml @@ -0,0 +1,19 @@ +server: + port: 7004 + +spring: + application: + name: jeecg-auto-process + cloud: + nacos: + config: + server-addr: @config.server-addr@ + group: @config.group@ + namespace: @config.namespace@ + discovery: + server-addr: ${spring.cloud.nacos.config.server-addr} + config: + import: + - optional:nacos:jeecg.yaml + - optional:nacos:jeecg-auto-process-@profile.name@.yaml + diff --git a/jeecg-server-cloud/jeecg-auto-process-start/src/main/resources/logback-spring.xml b/jeecg-server-cloud/jeecg-auto-process-start/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..60d4c7df --- /dev/null +++ b/jeecg-server-cloud/jeecg-auto-process-start/src/main/resources/logback-spring.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.log + + 30 + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n + + + + + + + + ERROR + + + + %p%d%msg%M%F{32}%L + + + ${LOG_HOME}/error-log.html + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.html + + 30 + 10MB + + + + %p%d%msg%M%F{32}%L + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-log-manage-start/pom.xml b/jeecg-server-cloud/jeecg-log-manage-start/pom.xml new file mode 100644 index 00000000..1ad7845d --- /dev/null +++ b/jeecg-server-cloud/jeecg-log-manage-start/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-server-cloud + 3.5.1 + + + jeecg-log-manage-start + + + + + org.jeecgframework.boot + jeecg-system-cloud-api + + + org.jeecgframework.boot + jeecg-module-log-manage + 3.5.1 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-log-manage-start/src/main/java/org/jeecg/JeecgLogManageApplication.java b/jeecg-server-cloud/jeecg-log-manage-start/src/main/java/org/jeecg/JeecgLogManageApplication.java new file mode 100644 index 00000000..a4a117ed --- /dev/null +++ b/jeecg-server-cloud/jeecg-log-manage-start/src/main/java/org/jeecg/JeecgLogManageApplication.java @@ -0,0 +1,47 @@ +package org.jeecg; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.oConvertUtils; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.EnableScheduling; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +@Slf4j +@SpringBootApplication +@EnableFeignClients(basePackages = {"org.jeecg"}) +@EnableScheduling +public class JeecgLogManageApplication extends SpringBootServletInitializer implements CommandLineRunner { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JeecgLogManageApplication.class); + } + + public static void main(String[] args) throws UnknownHostException { + ConfigurableApplicationContext application = SpringApplication.run(JeecgLogManageApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); + log.info("\n----------------------------------------------------------\n\t" + + "Application Jeecg-Boot is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/doc.html\n" + + "External: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + } + + @Override + public void run(String... args) throws Exception { + + } +} \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-log-manage-start/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-log-manage-start/src/main/resources/application.yml new file mode 100644 index 00000000..8467c72d --- /dev/null +++ b/jeecg-server-cloud/jeecg-log-manage-start/src/main/resources/application.yml @@ -0,0 +1,18 @@ +server: + port: 7005 + +spring: + application: + name: jeecg-log-manage + cloud: + nacos: + config: + server-addr: @config.server-addr@ + group: @config.group@ + namespace: @config.namespace@ + discovery: + server-addr: ${spring.cloud.nacos.config.server-addr} + config: + import: + - optional:nacos:jeecg.yaml + - optional:nacos:jeecg-@profile.name@.yaml \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-log-manage-start/src/main/resources/logback-spring.xml b/jeecg-server-cloud/jeecg-log-manage-start/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..60d4c7df --- /dev/null +++ b/jeecg-server-cloud/jeecg-log-manage-start/src/main/resources/logback-spring.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.log + + 30 + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n + + + + + + + + ERROR + + + + %p%d%msg%M%F{32}%L + + + ${LOG_HOME}/error-log.html + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.html + + 30 + 10MB + + + + %p%d%msg%M%F{32}%L + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/pom.xml b/jeecg-server-cloud/jeecg-station-operation-start/pom.xml new file mode 100644 index 00000000..76b20966 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-server-cloud + 3.5.1 + + + jeecg-station-operation-start + + + + + org.jeecgframework.boot + jeecg-system-cloud-api + + + org.jeecgframework.boot + jeecg-module-station-operation + 3.5.1 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/java/org/jeecg/JeecgStationOperationApplication.java b/jeecg-server-cloud/jeecg-station-operation-start/src/main/java/org/jeecg/JeecgStationOperationApplication.java new file mode 100644 index 00000000..a158b8da --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/java/org/jeecg/JeecgStationOperationApplication.java @@ -0,0 +1,47 @@ +package org.jeecg; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.oConvertUtils; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.EnableScheduling; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +@Slf4j +@SpringBootApplication +@EnableFeignClients(basePackages = {"org.jeecg"}) +@EnableScheduling +public class JeecgStationOperationApplication extends SpringBootServletInitializer implements CommandLineRunner { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JeecgStationOperationApplication.class); + } + + public static void main(String[] args) throws UnknownHostException { + ConfigurableApplicationContext application = SpringApplication.run(JeecgStationOperationApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); + log.info("\n----------------------------------------------------------\n\t" + + "Application Jeecg-Boot is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/doc.html\n" + + "External: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + } + + @Override + public void run(String... args) throws Exception { + + } +} \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/application.yml new file mode 100644 index 00000000..faa36051 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/application.yml @@ -0,0 +1,18 @@ +server: + port: 7002 + +spring: + application: + name: jeecg-station-operation + cloud: + nacos: + config: + server-addr: @config.server-addr@ + group: @config.group@ + namespace: @config.namespace@ + discovery: + server-addr: ${spring.cloud.nacos.config.server-addr} + config: + import: + - optional:nacos:jeecg.yaml + - optional:nacos:jeecg-@profile.name@.yaml \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_config.properties b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_config.properties new file mode 100644 index 00000000..44618ab8 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_config.properties @@ -0,0 +1,29 @@ +#code_generate_project_path +project_path=E:\\workspace\\jeecg-boot +#bussi_package[User defined] +bussi_package=org.jeecg.modules.demo + + +#default code path +#source_root_package=src +#webroot_package=WebRoot + +#maven code path +source_root_package=src.main.java +webroot_package=src.main.webapp + +#ftl resource url +templatepath=/jeecg/code-template +system_encoding=utf-8 + +#db Table id [User defined] +db_table_id=id + +#db convert flag[true/false] +db_filed_convert=true + +#page Search Field num [User defined] +page_search_filed_num=1 +#page_filter_fields +page_filter_fields=create_time,create_by,update_time,update_by +exclude_table=act_,ext_act_,design_,onl_,sys_,qrtz_ diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_database.properties b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_database.properties new file mode 100644 index 00000000..45b49f60 --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/jeecg/jeecg_database.properties @@ -0,0 +1,27 @@ +#mysql +diver_name=com.mysql.jdbc.Driver +url=jdbc:mysql://localhost:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8 +username=root +password=root +database_name=jeecg-boot + +#oracle +#diver_name=oracle.jdbc.driver.OracleDriver +#url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL +#username=scott +#password=tiger +#database_name=ORCL + +#postgre +#diver_name=org.postgresql.Driver +#url=jdbc:postgresql://localhost:5432/jeecg +#username=postgres +#password=postgres +#database_name=jeecg + +#SQLServer2005\u4ee5\u4e0a +#diver_name=org.hibernate.dialect.SQLServerDialect +#url=jdbc:sqlserver://192.168.1.200:1433;DatabaseName=jeecg +#username=sa +#password=SA +#database_name=jeecg \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/logback-spring.xml b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..60d4c7df --- /dev/null +++ b/jeecg-server-cloud/jeecg-station-operation-start/src/main/resources/logback-spring.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.log + + 30 + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n + + + + + + + + ERROR + + + + %p%d%msg%M%F{32}%L + + + ${LOG_HOME}/error-log.html + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.html + + 30 + 10MB + + + + %p%d%msg%M%F{32}%L + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml b/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml index fad599a9..d745a2b5 100644 --- a/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml +++ b/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml @@ -36,11 +36,6 @@ - - - org.jeecgframework.boot - jeecg-module-log-manage - + + org.jeecgframework.boot + jeecg-system-cloud-api + + + org.jeecgframework.boot + jeecg-module-web-statistics + 3.5.1 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-web-statistics-start/src/main/java/org/jeecg/JeecgWebStatisticsApplication.java b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/java/org/jeecg/JeecgWebStatisticsApplication.java new file mode 100644 index 00000000..a31e14aa --- /dev/null +++ b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/java/org/jeecg/JeecgWebStatisticsApplication.java @@ -0,0 +1,46 @@ +package org.jeecg; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.oConvertUtils; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.EnableScheduling; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +@Slf4j +@SpringBootApplication +@EnableFeignClients(basePackages = {"org.jeecg"}) +@EnableScheduling +public class JeecgWebStatisticsApplication extends SpringBootServletInitializer implements CommandLineRunner { + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JeecgWebStatisticsApplication.class); + } + + public static void main(String[] args) throws UnknownHostException { + ConfigurableApplicationContext application = SpringApplication.run(JeecgWebStatisticsApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); + log.info("\n----------------------------------------------------------\n\t" + + "Application Jeecg-Boot is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/doc.html\n" + + "External: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + } + + @Override + public void run(String... args) throws Exception { + + } +} \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/application.yml new file mode 100644 index 00000000..68faf27d --- /dev/null +++ b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/application.yml @@ -0,0 +1,18 @@ +server: + port: 7003 + +spring: + application: + name: jeecg-web-statistics + cloud: + nacos: + config: + server-addr: @config.server-addr@ + group: @config.group@ + namespace: @config.namespace@ + discovery: + server-addr: ${spring.cloud.nacos.config.server-addr} + config: + import: + - optional:nacos:jeecg.yaml + - optional:nacos:jeecg-web-statistics-@profile.name@.yaml \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/jeecg/jeecg_config.properties b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/jeecg/jeecg_config.properties new file mode 100644 index 00000000..44618ab8 --- /dev/null +++ b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/jeecg/jeecg_config.properties @@ -0,0 +1,29 @@ +#code_generate_project_path +project_path=E:\\workspace\\jeecg-boot +#bussi_package[User defined] +bussi_package=org.jeecg.modules.demo + + +#default code path +#source_root_package=src +#webroot_package=WebRoot + +#maven code path +source_root_package=src.main.java +webroot_package=src.main.webapp + +#ftl resource url +templatepath=/jeecg/code-template +system_encoding=utf-8 + +#db Table id [User defined] +db_table_id=id + +#db convert flag[true/false] +db_filed_convert=true + +#page Search Field num [User defined] +page_search_filed_num=1 +#page_filter_fields +page_filter_fields=create_time,create_by,update_time,update_by +exclude_table=act_,ext_act_,design_,onl_,sys_,qrtz_ diff --git a/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/jeecg/jeecg_database.properties b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/jeecg/jeecg_database.properties new file mode 100644 index 00000000..45b49f60 --- /dev/null +++ b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/jeecg/jeecg_database.properties @@ -0,0 +1,27 @@ +#mysql +diver_name=com.mysql.jdbc.Driver +url=jdbc:mysql://localhost:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8 +username=root +password=root +database_name=jeecg-boot + +#oracle +#diver_name=oracle.jdbc.driver.OracleDriver +#url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL +#username=scott +#password=tiger +#database_name=ORCL + +#postgre +#diver_name=org.postgresql.Driver +#url=jdbc:postgresql://localhost:5432/jeecg +#username=postgres +#password=postgres +#database_name=jeecg + +#SQLServer2005\u4ee5\u4e0a +#diver_name=org.hibernate.dialect.SQLServerDialect +#url=jdbc:sqlserver://192.168.1.200:1433;DatabaseName=jeecg +#username=sa +#password=SA +#database_name=jeecg \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/logback-spring.xml b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..60d4c7df --- /dev/null +++ b/jeecg-server-cloud/jeecg-web-statistics-start/src/main/resources/logback-spring.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.log + + 30 + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n + + + + + + + + ERROR + + + + %p%d%msg%M%F{32}%L + + + ${LOG_HOME}/error-log.html + + + + + + + + ${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.html + + 30 + 10MB + + + + %p%d%msg%M%F{32}%L + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/pom.xml b/jeecg-server-cloud/pom.xml index 5930e2c7..137fef12 100644 --- a/jeecg-server-cloud/pom.xml +++ b/jeecg-server-cloud/pom.xml @@ -21,6 +21,11 @@ jeecg-visual + jeecg-station-operation-start + jeecg-web-statistics-start + jeecg-log-manage-start + jeecg-abnormal-alarm-start + jeecg-auto-process-start \ No newline at end of file diff --git a/pom.xml b/pom.xml index 180f7b47..3c9672c0 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,11 @@ jeecg-module-demo jeecg-module-system jeecg-module-log-manage - + jeecg-module-station-operation + jeecg-module-web-statistics + jeecg-module-abnormal-alarm + jeecg-module-auto-process + @@ -172,6 +176,18 @@ jeecg-module-log-manage ${jeecgboot.version} + + + org.jeecgframework.boot + jeecg-module-station-operation + ${jeecgboot.version} + + + + org.jeecgframework.boot + jeecg-module-web-statistics + ${jeecgboot.version} + org.jeecgframework.boot