diff --git a/alarm/pom.xml b/alarm/pom.xml
new file mode 100644
index 0000000..766264d
--- /dev/null
+++ b/alarm/pom.xml
@@ -0,0 +1,53 @@
+
+
+ 4.0.0
+
+ com.yingji
+ yingjiAlgorithms
+ 0.0.1-SNAPSHOT
+
+
+ alarm
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+ alarm
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 1.8
+ UTF-8
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+ com.yingji.AlarmApplication
+
+
+
+ repackage
+
+ repackage
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/yingji/YingjiAlgorithmsApplication.java b/alarm/src/main/java/com/yingji/AlarmApplication.java
similarity index 81%
rename from src/main/java/com/yingji/YingjiAlgorithmsApplication.java
rename to alarm/src/main/java/com/yingji/AlarmApplication.java
index 4edf7ba..81dc1b9 100644
--- a/src/main/java/com/yingji/YingjiAlgorithmsApplication.java
+++ b/alarm/src/main/java/com/yingji/AlarmApplication.java
@@ -15,9 +15,9 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@MapperScan("com.yingji.mapper")
@EnableAsync
@EnableScheduling
-public class YingjiAlgorithmsApplication {
+public class AlarmApplication {
public static void main(String[] args) {
- SpringApplication.run(YingjiAlgorithmsApplication.class, args);
+ SpringApplication.run(AlarmApplication.class, args);
}
}
\ No newline at end of file
diff --git a/src/main/java/com/yingji/base/constant/HttpStatus.java b/alarm/src/main/java/com/yingji/base/constant/HttpStatus.java
similarity index 100%
rename from src/main/java/com/yingji/base/constant/HttpStatus.java
rename to alarm/src/main/java/com/yingji/base/constant/HttpStatus.java
diff --git a/src/main/java/com/yingji/base/controller/BaseController.java b/alarm/src/main/java/com/yingji/base/controller/BaseController.java
similarity index 100%
rename from src/main/java/com/yingji/base/controller/BaseController.java
rename to alarm/src/main/java/com/yingji/base/controller/BaseController.java
diff --git a/src/main/java/com/yingji/base/domain/AjaxResult.java b/alarm/src/main/java/com/yingji/base/domain/AjaxResult.java
similarity index 100%
rename from src/main/java/com/yingji/base/domain/AjaxResult.java
rename to alarm/src/main/java/com/yingji/base/domain/AjaxResult.java
diff --git a/src/main/java/com/yingji/config/MybatisPlusConfig.java b/alarm/src/main/java/com/yingji/config/MybatisPlusConfig.java
similarity index 100%
rename from src/main/java/com/yingji/config/MybatisPlusConfig.java
rename to alarm/src/main/java/com/yingji/config/MybatisPlusConfig.java
diff --git a/src/main/java/com/yingji/config/SwaggerConfig.java b/alarm/src/main/java/com/yingji/config/SwaggerConfig.java
similarity index 100%
rename from src/main/java/com/yingji/config/SwaggerConfig.java
rename to alarm/src/main/java/com/yingji/config/SwaggerConfig.java
diff --git a/alarm/src/main/java/com/yingji/entity/Alarm.java b/alarm/src/main/java/com/yingji/entity/Alarm.java
new file mode 100644
index 0000000..c190e5b
--- /dev/null
+++ b/alarm/src/main/java/com/yingji/entity/Alarm.java
@@ -0,0 +1,196 @@
+package com.yingji.entity;
+
+import cn.hutool.core.annotation.Alias;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+
+/**
+ * (Alarm)表实体类
+ *
+ * @author wu
+ * @since 2024-05-07 14:50:30
+ */
+@Data
+@ApiModel("实体类")
+@TableName(value = "alarm")
+public class Alarm implements Serializable {
+
+ private static final long serialVersionUID = -61131421311961793L;
+
+ /**
+ * 主键id
+ */
+ @ApiModelProperty(value = "主键id")
+ @TableId(type = IdType.AUTO)
+ private Long emergencyEventId;
+
+
+ private Integer emergencyEventSource;
+
+
+ private Integer emergencyEventStatus;
+
+
+ private Integer warnResponseStatus;
+
+
+ private Integer emergencyResponseStatus;
+
+
+ private String emergencyEventTitle;
+
+
+ private Integer emergencyEventType;
+
+
+ private Integer emergencyEventLevel;
+
+ /**
+ * 报警时间
+ */
+ @ApiModelProperty(value = "报警时间")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime emergencyEventTime;
+
+ /**
+ * 报警内容
+ */
+ @ApiModelProperty(value = "报警内容")
+ @Alias("bjnr")
+ private String emergencyEventDesc;
+
+ /**
+ * 报警地址
+ */
+ @Alias("sfdd")
+ @ApiModelProperty(value = "报警地址")
+ private String emergencyEventAddress;
+
+
+ private String emergencyEventArea;
+
+
+ private Double emergencyEventLon;
+
+
+ private Double emergencyEventLat;
+
+
+ private String submitUnit;
+
+
+ private String submitUnitContact;
+
+
+ private String submitUnitTelephone;
+
+
+ private String reportPerson;
+
+
+ private String reportPersonTelephone;
+
+
+ private String remark;
+
+
+ private String fileUrls;
+
+ /**
+ * 是否删除 0未删除 1删除
+ */
+ @ApiModelProperty(value = "是否删除 0未删除 1删除")
+ private Integer delFlag;
+
+ /**
+ * 创建人
+ */
+ @ApiModelProperty(value = "创建人")
+ private String createBy;
+
+ /**
+ * 创建时间
+ */
+ @ApiModelProperty(value = "创建时间")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ /**
+ * 最后更新人
+ */
+ @ApiModelProperty(value = "最后更新人")
+ private String updateBy;
+
+ /**
+ * 最后更新时间
+ */
+ @ApiModelProperty(value = "最后更新时间")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+
+ private String sendOutTimes;
+
+
+ private Long groupId;
+
+
+ private Integer isRehearsal;
+
+ /**
+ * 手机号
+ */
+ @ApiModelProperty(value = "报警电话")
+ @Alias("bjdh")
+ private String alarmPhoneNumber;
+
+ /**
+ * 源id
+ */
+ @ApiModelProperty(value = "源id")
+ private String sourceId;
+
+
+ private Integer isJudged;
+
+
+ private String eventDetail;
+
+ /**
+ * 预警大类
+ */
+ @ApiModelProperty(value = "预警大类")
+ private String aiClass;
+
+ /**
+ * 预警小类
+ */
+ @ApiModelProperty(value = "预警小类")
+ private String aiClass2;
+
+ /**
+ * 紧急程度
+ */
+ @ApiModelProperty(value = "紧急程度")
+ private String aiLevel;
+
+ /**
+ * 紧急系数
+ */
+ @ApiModelProperty(value = "紧急系数")
+ private Double aiNum;
+}
+
diff --git a/src/main/java/com/yingji/entity/Source.java b/alarm/src/main/java/com/yingji/entity/Source.java
similarity index 92%
rename from src/main/java/com/yingji/entity/Source.java
rename to alarm/src/main/java/com/yingji/entity/Source.java
index a59046f..515f536 100644
--- a/src/main/java/com/yingji/entity/Source.java
+++ b/alarm/src/main/java/com/yingji/entity/Source.java
@@ -1,14 +1,13 @@
package com.yingji.entity;
-import java.io.Serializable;
-
import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
-import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import java.io.Serializable;
+
/**
* (Source)表实体类
diff --git a/src/main/java/com/yingji/entity/dto/request/AlarmFindRequest.java b/alarm/src/main/java/com/yingji/entity/dto/request/AlarmFindRequest.java
similarity index 96%
rename from src/main/java/com/yingji/entity/dto/request/AlarmFindRequest.java
rename to alarm/src/main/java/com/yingji/entity/dto/request/AlarmFindRequest.java
index bdce96c..e491c77 100644
--- a/src/main/java/com/yingji/entity/dto/request/AlarmFindRequest.java
+++ b/alarm/src/main/java/com/yingji/entity/dto/request/AlarmFindRequest.java
@@ -15,8 +15,8 @@ import java.time.LocalDateTime;
* @author wu
* @since 2024/4/30 下午3:59
*/
-@ApiModel(value = "Alarm查询请求类")
@Data
+@ApiModel(value = "Alarm查询请求类")
public class AlarmFindRequest implements Serializable {
@@ -59,13 +59,13 @@ public class AlarmFindRequest implements Serializable {
* 预警大类
*/
@ApiModelProperty(value = "预警大类")
- private String aiCategories;
+ private String aiClass;
/**
* 预警小类
*/
@ApiModelProperty(value = "预警小类")
- private String aiSubCategories;
+ private String aiClass2;
/**
* 紧急程度
diff --git a/src/main/java/com/yingji/entity/dto/request/AlarmRequest.java b/alarm/src/main/java/com/yingji/entity/dto/request/AlarmRequest.java
similarity index 100%
rename from src/main/java/com/yingji/entity/dto/request/AlarmRequest.java
rename to alarm/src/main/java/com/yingji/entity/dto/request/AlarmRequest.java
diff --git a/src/main/java/com/yingji/exception/GlobalExceptionHandler.java b/alarm/src/main/java/com/yingji/exception/GlobalExceptionHandler.java
similarity index 88%
rename from src/main/java/com/yingji/exception/GlobalExceptionHandler.java
rename to alarm/src/main/java/com/yingji/exception/GlobalExceptionHandler.java
index 062e4df..59aa9d6 100644
--- a/src/main/java/com/yingji/exception/GlobalExceptionHandler.java
+++ b/alarm/src/main/java/com/yingji/exception/GlobalExceptionHandler.java
@@ -81,4 +81,14 @@ public class GlobalExceptionHandler {
public AjaxResult handleDemoModeException(NotLoginException e) {
return AjaxResult.error(e.getMessage());
}
+
+ /**
+ * 业务异常
+ */
+ @ExceptionHandler(ServiceException.class)
+ public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) {
+ log.error(e.getMessage(), e);
+ Integer code = e.getCode();
+ return code != null ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage());
+ }
}
diff --git a/alarm/src/main/java/com/yingji/exception/ServiceException.java b/alarm/src/main/java/com/yingji/exception/ServiceException.java
new file mode 100644
index 0000000..4d1e94a
--- /dev/null
+++ b/alarm/src/main/java/com/yingji/exception/ServiceException.java
@@ -0,0 +1,64 @@
+package com.yingji.exception;
+
+/**
+ * 业务异常
+ *
+ * @author ruoyi
+ */
+public final class ServiceException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 错误码
+ */
+ private Integer code;
+
+ /**
+ * 错误提示
+ */
+ private String message;
+
+ /**
+ * 错误明细,内部调试错误
+ *
+ * 和 {@link CommonResult#getDetailMessage()} 一致的设计
+ */
+ private String detailMessage;
+
+ /**
+ * 空构造方法,避免反序列化问题
+ */
+ public ServiceException() {
+ }
+
+ public ServiceException(String message) {
+ this.message = message;
+ }
+
+ public ServiceException(String message, Integer code) {
+ this.message = message;
+ this.code = code;
+ }
+
+ public String getDetailMessage() {
+ return detailMessage;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public ServiceException setMessage(String message) {
+ this.message = message;
+ return this;
+ }
+
+ public ServiceException setDetailMessage(String detailMessage) {
+ this.detailMessage = detailMessage;
+ return this;
+ }
+}
\ No newline at end of file
diff --git a/alarm/src/main/java/com/yingji/mapper/AlarmMapper.java b/alarm/src/main/java/com/yingji/mapper/AlarmMapper.java
new file mode 100644
index 0000000..6ae47ad
--- /dev/null
+++ b/alarm/src/main/java/com/yingji/mapper/AlarmMapper.java
@@ -0,0 +1,32 @@
+package com.yingji.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yingji.entity.Alarm;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 报警事件(Alarm)表数据库访问层
+ *
+ * @author wu
+ * @since 2024-05-06 09:15:01
+ */
+public interface AlarmMapper extends BaseMapper {
+
+
+ /**
+ * 获取最新一条数据的时间
+ *
+ * @return 最新一条数据的时间
+ */
+ LocalDateTime findNowTime();
+
+ /**
+ * 批量插入数据
+ *
+ * @param list 数据
+ */
+ void saveAll(List list);
+}
+
diff --git a/alarm/src/main/java/com/yingji/mapper/SourceMapper.java b/alarm/src/main/java/com/yingji/mapper/SourceMapper.java
new file mode 100644
index 0000000..15349f3
--- /dev/null
+++ b/alarm/src/main/java/com/yingji/mapper/SourceMapper.java
@@ -0,0 +1,24 @@
+package com.yingji.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yingji.entity.Source;
+
+import java.util.List;
+
+/**
+ * (Source)表数据库访问层
+ *
+ * @author wu
+ * @since 2024-05-07 18:03:09
+ */
+public interface SourceMapper extends BaseMapper