拆分项目;

修改定时任务
main
吴顺杰 4 months ago
parent a090092251
commit a95737cd59

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yingji</groupId>
<artifactId>yingjiAlgorithms</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>alarm</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<!--打包成jar包时的名字-->
<finalName>alarm</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.yingji.AlarmApplication</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -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);
}
}

@ -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;
}

@ -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)

@ -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;
/**
*

@ -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());
}
}

@ -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;
/**
*
* <p>
* {@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;
}
}

@ -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<Alarm> {
/**
*
*
* @return
*/
LocalDateTime findNowTime();
/**
*
*
* @param list
*/
void saveAll(List<Alarm> list);
}

@ -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<Source> {
/**
* id
*
* @param list id
*/
void addList(List<String> list);
}

@ -0,0 +1,130 @@
package com.yingji.quartz;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.yingji.entity.Alarm;
import com.yingji.entity.dto.request.AlarmRequest;
import com.yingji.service.AlarmService;
import com.yingji.service.SourceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* 110
*
* @author wu
* @since 2024/05/06 10:18
*/
@Configuration
public class AlarmQuartz {
public static final Logger log = LoggerFactory.getLogger(AlarmQuartz.class);
@Resource
private AlarmService alarmService;
@Resource
private SourceService sourceService;
/**
*
*/
@Async
@Scheduled(cron = "0 */1 * * * ? ")
public void savaData() {
// 获取token
String token = alarmService.getToken();
// 查询所有id
List<String> idList = findId(token);
// 查询数据条件
AlarmRequest alarmRequest = new AlarmRequest();
alarmRequest.setType("getValue");
alarmRequest.setPageIndex(1);
alarmRequest.setPageSize(10);
// 定义成功条数
int successNum = 0;
// 定义保存数据的集合
List<Alarm> list = new ArrayList<>();
if (CollUtil.isNotEmpty(idList)) {
try {
for (String x : idList) {
alarmRequest.setValue(x);
Alarm alarm = alarmService.findDataList(alarmRequest, token);
if (alarm != null) {
alarm.setSourceId(x);
list.add(alarm);
successNum++;
// 生成100到200的随机数
Random random = new Random();
int randomNumber = random.nextInt(101) + 100;
Thread.sleep(randomNumber);
} else {
return;
}
}
} catch (Exception e) {
log.info("==========================" + e.getMessage());
}
}
alarmService.saveAll(list);
log.info("成功条数==========================" + successNum);
}
/**
* id
*
* @param token token
* @return token token
*/
private List<String> findId(String token) {
// 定义变量存放 id
List<String> idList = new ArrayList<>();
if (StrUtil.isEmpty(token)) {
return idList;
}
// 获取数据库中最新的时间
LocalDateTime nowTime = alarmService.findNowTime();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
String yesterdayStr = nowTime.format(formatter) + "00";
// 定义起始页
int pageIndex = 1;
// 定义每页显示条数
int pageSize = 500;
// 定义总数据条数
int size = 0;
// 定义type
String type = "getId";
// 查询id条件
AlarmRequest req = new AlarmRequest();
req.setType(type);
req.setValue(yesterdayStr);
req.setPageIndex(pageIndex);
req.setPageSize(pageSize);
while (true) {
List<String> data = alarmService.findDataIdList(req, token);
if (data == null) {
return idList;
}
sourceService.addList(data);
idList.addAll(data);
size += data.size();
if (data.size() == pageSize) {
req.setPageIndex(pageIndex++);
log.info("第" + pageIndex + "页==========================" + size + "条数据");
} else {
break;
}
}
return idList;
}
}

@ -0,0 +1,58 @@
package com.yingji.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yingji.entity.Alarm;
import com.yingji.entity.dto.request.AlarmRequest;
import java.time.LocalDateTime;
import java.util.List;
/**
* (Alarm)
*
* @author wu
* @since 2024-05-06 09:15:01
*/
public interface AlarmService extends IService<Alarm> {
/**
* Id
*
* @param req
* @param token token
* @return IdList
*/
List<String> findDataIdList(AlarmRequest req, String token);
/**
*
*
* @param req
* @param token token
* @return List
*/
Alarm findDataList(AlarmRequest req, String token);
/**
* 110token
*
* @return token
*/
String getToken();
/**
*
*
* @return
*/
LocalDateTime findNowTime();
/**
*
*
* @param list
*/
void saveAll(List<Alarm> list);
}

@ -0,0 +1,24 @@
package com.yingji.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yingji.entity.Source;
import java.util.List;
/**
* (Source)
*
* @author wu
* @since 2024-05-07 18:03:09
*/
public interface SourceService extends IService<Source> {
/**
* id
*
* @param list id
*/
void addList(List<String> list);
}

@ -0,0 +1,165 @@
package com.yingji.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yingji.entity.Alarm;
import com.yingji.entity.dto.request.AlarmRequest;
import com.yingji.mapper.AlarmMapper;
import com.yingji.service.AlarmService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* (Alarm)
*
* @author wu
* @since 2024-05-06 09:15:01
*/
@Service("alarmService")
public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements AlarmService {
public static final Logger log = LoggerFactory.getLogger(AlarmServiceImpl.class);
@Value("${clientId}")
private String clientId;
@Value("${clientSecret}")
private String clientSecret;
@Value("${getToken}")
private String getToken;
@Value("${specificWarn}")
private String specificWarn;
/**
* base64
*
* @return base64
*/
public String findBase() {
String str = clientId + ":" + clientSecret;
return Base64.encode(str);
}
/**
* Id
*
* @param req
* @param token token
* @return IdList
*/
@Override
public List<String> findDataIdList(AlarmRequest req, String token) {
String bodyJson = JSONObject.toJSONString(req);
List<String> records = null;
// 获取id
String body = HttpRequest.post(specificWarn).header("Authorization", "Basic " + token).body(bodyJson).execute().body();
JSONObject json = JSONObject.parse(body);
Object response = json.get("response");
if (BeanUtil.isNotEmpty(response)) {
String responseStr = JSONUtil.toJsonStr(response);
JSONObject res = JSONObject.parse(responseStr);
String recordsStr = JSONUtil.toJsonStr(res.get("records"));
if (StrUtil.isNotEmpty(recordsStr)) {
records = JSONUtil.toList(recordsStr, String.class);
}
}
return records;
}
/**
*
*
* @param req
* @param token token
* @return List
*/
@Override
public Alarm findDataList(AlarmRequest req, String token) {
String bodyJson = JSONObject.toJSONString(req);
Alarm records = null;
// 获取id
String body = HttpRequest.post(specificWarn).header("Authorization", "Basic " + token).header("Content-Type", "application/json").body(bodyJson).execute().body();
log.info("===============================");
log.info("body数据为:" + body);
try {
JSONObject json = JSONObject.parse(body);
Object response = json.get("response");
if (BeanUtil.isNotEmpty(response)) {
String recordsStr = JSONUtil.toJsonStr(response);
records = JSONUtil.toBean(recordsStr, Alarm.class);
JSONObject recordsJson = JSONObject.parse(recordsStr);
Object bjdhsj = recordsJson.get("bjdhsj");
String bjdhsjStr = JSONUtil.toJsonStr(bjdhsj);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss").withZone(ZoneId.systemDefault());
LocalDateTime emergencyEventTime = LocalDateTime.parse(bjdhsjStr, formatter);
records.setEmergencyEventTime(emergencyEventTime);
records.setCreateTime(LocalDateTime.now());
records.setUpdateTime(LocalDateTime.now());
records.setDelFlag(0);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return records;
}
/**
* 110token
*
* @return token
*/
@Override
public String getToken() {
String accessToken = null;
String body = HttpRequest.get(getToken)
.header("Authorization", "Basic Qk5qUDlTOHAyRUpaeXQxVUYrRDZrQ3NLNlpWYXB5S3FpR3phckVkc1ozUW1JV29WZEI3WWtyWDJHQkFtQ0RPMTZ0US9hazg2cFpnUDVaUzNzNEVHZGNvPTpBTTRvTU9zSmowVUxBVU9PWGx6NXhIaklGNGtwOVc2M2FqWnJYeFRHTEhFbg==")
.header("Content-Type", "application/json")
.form("grant_type", "client_credentials").execute().body();
JSONObject json = JSONObject.parse(body);
Object response = json.get("response");
if (BeanUtil.isNotEmpty(response)) {
String recordsStr = JSONUtil.toJsonStr(response);
JSONObject res = JSONObject.parse(recordsStr);
accessToken = (String) res.get("access_token");
}
log.info("=======================================");
log.info("token为:" + accessToken);
return accessToken;
}
/**
*
*
* @return
*/
@Override
public LocalDateTime findNowTime() {
return baseMapper.findNowTime();
}
/**
*
*
* @param list
*/
@Override
public void saveAll(List<Alarm> list) {
baseMapper.saveAll(list);
}
}

@ -0,0 +1,31 @@
package com.yingji.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yingji.entity.Source;
import com.yingji.mapper.SourceMapper;
import com.yingji.service.SourceService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* (Source)
*
* @author wu
* @since 2024-05-07 18:03:09
*/
@Service("sourceService")
public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> implements SourceService {
/**
* id
*
* @param list id
*/
@Override
public void addList(List<String> list) {
baseMapper.addList(list);
}
}

@ -0,0 +1,40 @@
server:
port: 9004
spring:
profiles:
active: dev
redis:
host: localhost
port: 6379
password:
database: 1
jedis:
pool:
max-active: 8 # 最大连接数
max-wait: 1ms # 最大阻塞时间
max-idle: 4
min-idle: 0
# 日志配置
logging:
level:
com.yingji: info
org.springframework: info
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: token
# token 有效期(单位:秒) 默认30天-1 代表永久有效
timeout: 86400
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token
is-share: true
# token 风格默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik
token-style: uuid
# 是否输出操作日志
is-log: true

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs/towLog" />
<property name="log.path" value="/home/logs/alarm" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yingji.mapper.AlarmMapper">
<insert id="saveAll">
INSERT IGNORE INTO `alarm`(
emergency_event_time,
emergency_event_desc,
emergency_event_address,
del_flag,
create_time,
update_time,
alarm_phone_number,
source_id)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.emergencyEventTime},
#{item.emergencyEventDesc},
#{item.emergencyEventAddress},
#{item.delFlag},
#{item.createTime},
#{item.updateTime},
#{item.alarmPhoneNumber},
#{item.sourceId})
</foreach>
</insert>
<select id="findNowTime" resultType="java.time.LocalDateTime">
select emergency_event_time
from alarm
order by emergency_event_time desc
limit 1
</select>
</mapper>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yingji.mapper.SourceMapper">
<insert id="addList">
insert into source
(source_id) values
<foreach collection="list" item="id" separator=",">
(#{id})
</foreach>
</insert>
</mapper>

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yingji</groupId>
<artifactId>yingjiAlgorithms</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>page</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<!--打包成jar包时的名字-->
<finalName>page</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.yingji.PageApplication</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,23 @@
package com.yingji;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @author wu
* @since 2024/2/26 10:24
*/
@SpringBootApplication
@MapperScan("com.yingji.mapper")
@EnableAsync
@EnableScheduling
public class PageApplication {
public static void main(String[] args) {
SpringApplication.run(PageApplication.class, args);
}
}

@ -0,0 +1,93 @@
package com.yingji.base.constant;
/**
*
*
* @author ruoyi
*/
public class HttpStatus {
/**
*
*/
public static final int SUCCESS = 200;
/**
*
*/
public static final int CREATED = 201;
/**
*
*/
public static final int ACCEPTED = 202;
/**
*
*/
public static final int NO_CONTENT = 204;
/**
*
*/
public static final int MOVED_PERM = 301;
/**
*
*/
public static final int SEE_OTHER = 303;
/**
*
*/
public static final int NOT_MODIFIED = 304;
/**
*
*/
public static final int BAD_REQUEST = 400;
/**
*
*/
public static final int UNAUTHORIZED = 401;
/**
* 访
*/
public static final int FORBIDDEN = 403;
/**
*
*/
public static final int NOT_FOUND = 404;
/**
* http
*/
public static final int BAD_METHOD = 405;
/**
*
*/
public static final int CONFLICT = 409;
/**
*
*/
public static final int UNSUPPORTED_TYPE = 415;
/**
*
*/
public static final int ERROR = 500;
/**
*
*/
public static final int NOT_IMPLEMENTED = 501;
/**
*
*/
public static final int WARN = 601;
}

@ -0,0 +1,78 @@
package com.yingji.base.controller;
import com.yingji.base.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* web
*
* @author ruoyi
*/
public class BaseController {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
*
*/
public AjaxResult success() {
return AjaxResult.success();
}
/**
*
*/
public AjaxResult error() {
return AjaxResult.error();
}
/**
*
*/
public AjaxResult success(String message) {
return AjaxResult.success(message);
}
/**
*
*/
public AjaxResult success(Object data) {
return AjaxResult.success(data);
}
/**
*
*/
public AjaxResult error(String message) {
return AjaxResult.error(message);
}
/**
*
*/
public AjaxResult warn(String message) {
return AjaxResult.warn(message);
}
/**
*
*
* @param rows
* @return
*/
protected AjaxResult toAjax(int rows) {
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
*
*
* @param result
* @return
*/
protected AjaxResult toAjax(boolean result) {
return result ? success() : error();
}
}

@ -0,0 +1,202 @@
package com.yingji.base.domain;
import cn.hutool.core.bean.BeanUtil;
import com.yingji.base.constant.HttpStatus;
import java.util.HashMap;
import java.util.Objects;
/**
*
*
* @author ruoyi
*/
public class AjaxResult extends HashMap<String, Object> {
/**
*
*/
public static final String CODE_TAG = "code";
/**
*
*/
public static final String MSG_TAG = "msg";
/**
*
*/
public static final String DATA_TAG = "data";
private static final long serialVersionUID = 1L;
/**
* AjaxResult 使
*/
public AjaxResult() {
}
/**
* AjaxResult
*
* @param code
* @param msg
*/
public AjaxResult(int code, String msg) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
}
/**
* AjaxResult
*
* @param code
* @param msg
* @param data
*/
public AjaxResult(int code, String msg, Object data) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (BeanUtil.isNotEmpty(data)) {
super.put(DATA_TAG, data);
}
}
/**
*
*
* @return
*/
public static AjaxResult success() {
return AjaxResult.success("操作成功");
}
/**
*
*
* @return
*/
public static AjaxResult success(Object data) {
return AjaxResult.success("操作成功", data);
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult success(String msg) {
return AjaxResult.success(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult success(String msg, Object data) {
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult warn(String msg) {
return AjaxResult.warn(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult warn(String msg, Object data) {
return new AjaxResult(HttpStatus.WARN, msg, data);
}
/**
*
*
* @return
*/
public static AjaxResult error() {
return AjaxResult.error("操作失败");
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult error(String msg) {
return AjaxResult.error(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult error(String msg, Object data) {
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
*
*
* @param code
* @param msg
* @return
*/
public static AjaxResult error(int code, String msg) {
return new AjaxResult(code, msg, null);
}
/**
*
*
* @return
*/
public boolean isSuccess() {
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isWarn() {
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isError() {
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
/**
* 便
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value) {
super.put(key, value);
return this;
}
}

@ -0,0 +1,26 @@
package com.yingji.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author wu
* @since 2024/2/26 11:28
*/
@Configuration
public class MybatisPlusConfig {
/**
*
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//如果配置多个插件,切记分页最后添加
//interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); 如果有多数据源可以不配具体类型 否则都建议配上具体的DbType
return interceptor;
}
}

@ -0,0 +1,74 @@
package com.yingji.config;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* Swagger2
*
* @author ruoyi
*/
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {
/**
* swagger
*/
@Value("${knife4j.enable}")
private boolean enabled;
/**
* API
*/
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
// 是否启用Swagger
.enable(enabled)
//分组名称
.groupName("应急算法")
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
.select()
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
// .pathMapping(pathMapping)
// 排除mybatis-plus的分页参数
.ignoredParameterTypes(Page.class, IPage.class);
}
/**
*
*/
private ApiInfo apiInfo() {
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("应急算法")
// 描述
.description("描述:用于应急算法")
// 版本
.version("版本号:" + 1)
.build();
}
}

@ -55,21 +55,10 @@ public class AlarmController extends BaseController {
@ApiOperation(value = "分页条件查询报警事件", response = Alarm.class)
public AjaxResult page(Page<Alarm> page, AlarmFindRequest req) {
StpUtil.checkLogin();
return success(alarmService.page(page, req));
if (page.getSize() > 500) {
page.setSize(500);
}
/**
*
*
* @param req
* @return
*/
@GetMapping("/findAll")
@ApiOperation(value = "条件查询所有报警事件", response = Alarm.class)
public AjaxResult findAll(AlarmFindRequest req) {
StpUtil.checkLogin();
// StpUtil.renewTimeout(100);
return success(alarmService.findAll(req));
return success(alarmService.page(page, req));
}
/**

@ -0,0 +1,116 @@
package com.yingji.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yingji.base.controller.BaseController;
import com.yingji.base.domain.AjaxResult;
import com.yingji.entity.Event;
import com.yingji.entity.dto.response.EventPageRequest;
import com.yingji.entity.dto.response.EventsFindResponse;
import com.yingji.service.EventService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
/**
* (Event)
*
* @author wu
* @since 2024-05-13 16:19:25
*/
@RestController
@RequestMapping("algorithms/event")
@Api(tags = "事故")
@Transactional(rollbackFor = Exception.class)
public class EventController extends BaseController {
/**
*
*/
@Resource
private EventService eventService;
/**
*
*
* @param page
* @param event
* @return
*/
@GetMapping
@ApiOperation(value = "分页条件查询事故", response = Event.class)
public AjaxResult page(Page<Event> page, EventPageRequest event) {
StpUtil.checkLogin();
if (page.getSize() > 500) {
page.setSize(500);
}
return success(eventService.page(page, event));
}
/**
*
*
* @param id
* @return
*/
@GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条事故", response = EventsFindResponse.class)
public AjaxResult findById(@PathVariable Serializable id) {
StpUtil.checkLogin();
return success(eventService.findById(id));
}
/**
*
*
* @param event
* @return
*/
@PostMapping
@ApiOperation(value = "新增事故", response = Event.class)
public AjaxResult insert(@RequestBody Event event) {
StpUtil.checkLogin();
return success(eventService.save(event));
}
/**
*
*
* @param event
* @return
*/
@PutMapping
@ApiOperation(value = "修改事故")
public AjaxResult update(@RequestBody Event event) {
StpUtil.checkLogin();
return success(eventService.updateById(event));
}
/**
*
*
* @param idList
* @return
*/
@DeleteMapping
@ApiOperation(value = "删除事故")
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
StpUtil.checkLogin();
return success(eventService.removeByIds(idList));
}
}

@ -0,0 +1,35 @@
package com.yingji.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* (Source)
*
* @author wu
* @since 2024-05-07 18:03:09
*/
@Data
@ApiModel("实体类")
@TableName(value = "source")
public class Source implements Serializable {
private static final long serialVersionUID = -80185849209851185L;
/**
* id
*/
@ApiModelProperty(value = "主键id")
private Long id;
/**
* id
*/
@ApiModelProperty(value = "任务id")
private String sourceId;
}

@ -0,0 +1,87 @@
package com.yingji.entity.dto.request;
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/4/30 3:59
*/
@ApiModel(value = "Alarm查询请求类")
@Data
public class AlarmFindRequest implements Serializable {
private static final long serialVersionUID = 5773800327954649047L;
/**
*
*/
@ApiModelProperty("开始时间")
@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 startTime;
/**
*
*/
@ApiModelProperty("结束时间")
@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 endTime;
/**
*
*/
@ApiModelProperty(value = "报警内容")
private String emergencyEventDesc;
/**
*
*/
@ApiModelProperty(value = "报警地址")
private String emergencyEventAddress;
/**
*
*/
@ApiModelProperty(value = "报警电话")
private String alarmPhoneNumber;
/**
*
*/
@ApiModelProperty(value = "预警大类")
private String aiClass;
/**
*
*/
@ApiModelProperty(value = "预警小类")
private String aiClass2;
/**
*
*/
@ApiModelProperty(value = "紧急程度")
private String aiLevel;
/**
*
*/
@ApiModelProperty(value = "紧急系数最小值")
private Double aiNumMin;
/**
*
*/
@ApiModelProperty(value = "紧急系数最大值")
private Double aiNumMax;
}

@ -0,0 +1,44 @@
package com.yingji.entity.dto.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 110
*
* @author wu
* @since 2024/4/30 3:59
*/
@ApiModel(value = "110报警请求类")
@Data
public class AlarmRequest implements Serializable {
private static final long serialVersionUID = 7661630897162054093L;
/**
* getId / getValue
*/
@ApiModelProperty(value = "类型getId / getValue", required = true)
private String type;
/**
* / Id
*/
@ApiModelProperty(value = "值(时间 / Id", required = true)
private String value;
/**
*
*/
@ApiModelProperty(value = "当前页 默认1")
private Integer pageIndex;
/**
*
*/
@ApiModelProperty(value = "每页显示条数 默认10")
private Integer pageSize;
}

@ -0,0 +1,100 @@
package com.yingji.entity.dto.response;
import cn.hutool.core.annotation.Alias;
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;
/**
* (Event)
*
* @author wu
* @since 2024-05-10 17:10:32
*/
@Data
@ApiModel("事故分页查询请求类")
public class EventPageRequest implements Serializable {
private static final long serialVersionUID = -5290914853773569936L;
/**
*
*/
@ApiModelProperty(value = "事件标题")
private String eventName;
/**
*
*/
@ApiModelProperty(value = "事件类型")
private String eventType;
/**
*
*/
@ApiModelProperty(value = "事件等级")
private String eventLevel;
/**
*
*/
@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 startTime;
/**
*
*/
@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 endTime;
/**
* ()
*/
@ApiModelProperty(value = "事发地区(行政区划)")
private String eventArea;
/**
*
*/
@ApiModelProperty(value = "详细位置")
private String eventAddress;
/**
* /
*/
@ApiModelProperty(value = "出动次数(出动救护车次/辆数量)")
@Alias("SendAmbCount")
private Integer sendAmbCount;
/**
*
*/
@ApiModelProperty(value = "事件描述")
@Alias("EventDescribe")
private String eventDescribe;
/**
*
*/
@ApiModelProperty(value = "报送单位")
@Alias("AlarmUnit")
private String alarmUnit;
/**
*
*/
@ApiModelProperty(value = "报送单位联系人")
@Alias("AlarmUnitContactor")
private String alarmUnitContactor;
/**
*
*/
@ApiModelProperty(value = "报送单位联系电话")
@Alias("AlarmUnitTelephone")
private String alarmUnitTelephone;
}

@ -0,0 +1,144 @@
package com.yingji.entity.dto.response;
import cn.hutool.core.annotation.Alias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yingji.entity.AcceptEvents;
import com.yingji.entity.Amb;
import com.yingji.entity.Task;
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;
import java.util.List;
/**
* @author wu
* @since 2024/4/30 4:24
*/
@Data
@ApiModel(value = "响应类")
public class EventsFindResponse implements Serializable {
private static final long serialVersionUID = -3894493286879970663L;
/**
*
*/
@ApiModelProperty(value = "受理调度信息")
private List<AcceptEvents> acceptEvents;
/**
*
*/
@ApiModelProperty(value = "任务车辆")
private List<Amb> ambs;
/**
*
*/
@ApiModelProperty(value = "任务信息")
private List<Task> tasks;
/**
*
*/
@ApiModelProperty(value = "事件编码主键")
@Alias("EventId")
private String eventId;
/**
*
*/
@ApiModelProperty(value = "事件标题")
@Alias("EventName")
private String eventName;
/**
*
*/
@ApiModelProperty(value = "事件类型")
@Alias("EventType")
private String eventType;
/**
*
*/
@ApiModelProperty(value = "事件等级")
@Alias("EventLevel")
private String eventLevel;
/**
*
*/
@ApiModelProperty(value = "事发时间")
@Alias("EventDateTime")
@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 eventDateTime;
/**
* ()
*/
@ApiModelProperty(value = "事发地区(行政区划)")
@Alias("EventArea")
private String eventArea;
/**
*
*/
@ApiModelProperty(value = "详细位置")
@Alias("EventAddress")
private String eventAddress;
/**
*
*/
@ApiModelProperty(value = "经度")
@Alias("EventLongitude")
private String eventLongitude;
/**
*
*/
@ApiModelProperty(value = "维度")
@Alias("EventLatitude")
private String eventLatitude;
/**
* /
*/
@ApiModelProperty(value = "出动次数(出动救护车次/辆数量)")
@Alias("SendAmbCount")
private Integer sendAmbCount;
/**
*
*/
@ApiModelProperty(value = "事件描述")
@Alias("EventDescribe")
private String eventDescribe;
/**
*
*/
@ApiModelProperty(value = "报送单位")
@Alias("AlarmUnit")
private String alarmUnit;
/**
*
*/
@ApiModelProperty(value = "报送单位联系人")
@Alias("AlarmUnitContactor")
private String alarmUnitContactor;
/**
*
*/
@ApiModelProperty(value = "报送单位联系电话")
@Alias("AlarmUnitTelephone")
private String alarmUnitTelephone;
/**
*
*/
@ApiModelProperty(value = "附件资料")
@Alias("AttachmentInfo")
private String attachmentInfo;
/**
*
*/
@ApiModelProperty(value = "备注")
@Alias("Remark")
private String remark;
}

@ -0,0 +1,94 @@
package com.yingji.exception;
import cn.dev33.satoken.exception.NotLoginException;
import com.yingji.base.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest;
/**
*
*
* @author wu
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
*
*/
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod());
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(RuntimeException.class)
public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生未知异常.", requestURI, e);
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(Exception.class)
public AjaxResult handleException(Exception e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生系统异常.", requestURI, e);
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(BindException.class)
public AjaxResult handleBindException(BindException e) {
log.error(e.getMessage(), e);
String message = e.getAllErrors().get(0).getDefaultMessage();
return AjaxResult.error(message);
}
/**
*
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
log.error(e.getMessage(), e);
String message = e.getBindingResult().getFieldError().getDefaultMessage();
return AjaxResult.error(message);
}
/**
*
*/
@ExceptionHandler(NotLoginException.class)
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());
}
}

@ -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;
/**
*
* <p>
* {@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;
}
}

@ -6,8 +6,6 @@ import com.yingji.entity.Alarm;
import com.yingji.entity.dto.request.AlarmFindRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (Alarm)访
*
@ -25,12 +23,5 @@ public interface AlarmMapper extends BaseMapper<Alarm> {
*/
Page<Alarm> page(Page<Alarm> page, @Param("req") AlarmFindRequest req);
/**
*
*
* @param req
* @return
*/
List<Alarm> findAll(@Param("req") AlarmFindRequest req);
}

@ -0,0 +1,248 @@
package com.yingji.redis;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* spring redis
*
* @author wu
**/
@SuppressWarnings(value = {"unchecked", "rawtypes"})
@Component
public class RedisCache {
@Resource
public RedisTemplate redisTemplate;
/**
* IntegerString
*
* @param key
* @param value
*/
public <T> void setCacheObject(final String key, final T value) {
redisTemplate.opsForValue().set(key, value);
}
/**
* IntegerString
*
* @param key
* @param value
* @param timeout
* @param timeUnit
*/
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
}
/**
*
*
* @param key Redis
* @param timeout
* @return true=false=
*/
public boolean expire(final String key, final long timeout) {
return expire(key, timeout, TimeUnit.SECONDS);
}
/**
*
*
* @param key Redis
* @param timeout
* @param unit
* @return true=false=
*/
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
return redisTemplate.expire(key, timeout, unit);
}
/**
*
*
* @param key Redis
* @return
*/
public long getExpire(final String key) {
return redisTemplate.getExpire(key);
}
/**
* key
*
* @param key
* @return true false
*/
public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
/**
*
*
* @param key
* @return
*/
public <T> T getCacheObject(final String key) {
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
/**
*
*
* @param key
*/
public boolean deleteObject(final String key) {
return redisTemplate.delete(key);
}
/**
*
*
* @param collection
* @return
*/
public boolean deleteObject(final Collection collection) {
return redisTemplate.delete(collection) > 0;
}
/**
* List
*
* @param key
* @param dataList List
* @return
*/
public <T> long setCacheList(final String key, final List<T> dataList) {
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
/**
* list
*
* @param key
* @return
*/
public <T> List<T> getCacheList(final String key) {
return redisTemplate.opsForList().range(key, 0, -1);
}
/**
* Set
*
* @param key
* @param dataSet
* @return
*/
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator();
while (it.hasNext()) {
setOperation.add(it.next());
}
return setOperation;
}
/**
* set
*
* @param key
* @return
*/
public <T> Set<T> getCacheSet(final String key) {
return redisTemplate.opsForSet().members(key);
}
/**
* Map
*
* @param key
* @param dataMap
*/
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
}
/**
* Map
*
* @param key
* @return
*/
public <T> Map<String, T> getCacheMap(final String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @param value
*/
public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
redisTemplate.opsForHash().put(key, hKey, value);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @return Hash
*/
public <T> T getCacheMapValue(final String key, final String hKey) {
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
/**
* Hash
*
* @param key Redis
* @param hKeys Hash
* @return Hash
*/
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @return
*/
public boolean deleteCacheMapValue(final String key, final String hKey) {
return redisTemplate.opsForHash().delete(key, hKey) > 0;
}
/**
*
*
* @param pattern
* @return
*/
public Collection<String> keys(final String pattern) {
return redisTemplate.keys(pattern);
}
}

@ -59,12 +59,5 @@ public interface AlarmService extends IService<Alarm> {
*/
Page<Alarm> page(Page<Alarm> page, AlarmFindRequest req);
/**
*
*
* @param req
* @return
*/
List<Alarm> findAll(AlarmFindRequest req);
}

@ -0,0 +1,36 @@
package com.yingji.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yingji.entity.Event;
import com.yingji.entity.dto.response.EventPageRequest;
import com.yingji.entity.dto.response.EventsFindResponse;
import java.io.Serializable;
/**
* (Event)
*
* @author wu
* @since 2024-05-10 17:10:33
*/
public interface EventService extends IService<Event> {
/**
*
*
* @param page
* @param event
* @return
*/
Page<Event> page(Page<Event> page, EventPageRequest event);
/**
* id
*
* @param id id
* @return
*/
EventsFindResponse findById(Serializable id);
}

@ -126,21 +126,6 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
}
}
public static void main(String[] args) {
LocalDateTime dateTime1 = LocalDateTime.of(2022, 1, 1, 12, 0, 0);
LocalDateTime dateTime2 = LocalDateTime.of(2022, 1, 1, 14, 0, 0);
int comparisonResult = dateTime1.compareTo(dateTime2);
if (comparisonResult < 0) {
System.out.println("dateTime1 在 dateTime2 之前");
} else if (comparisonResult > 0) {
System.out.println("dateTime1 在 dateTime2 之后");
} else {
System.out.println("dateTime1 和 dateTime2 相等");
}
}
/**
* Id
*
@ -240,15 +225,6 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
return baseMapper.page(page, req);
}
/**
*
*
* @param req
* @return
*/
@Override
public List<Alarm> findAll(AlarmFindRequest req) {
return baseMapper.findAll(req);
}
}

@ -0,0 +1,108 @@
package com.yingji.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yingji.entity.AcceptEvents;
import com.yingji.entity.Amb;
import com.yingji.entity.Event;
import com.yingji.entity.Task;
import com.yingji.entity.dto.response.EventPageRequest;
import com.yingji.entity.dto.response.EventsFindResponse;
import com.yingji.exception.ServiceException;
import com.yingji.mapper.EventMapper;
import com.yingji.service.AcceptService;
import com.yingji.service.AmbService;
import com.yingji.service.EventService;
import com.yingji.service.TaskService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* (Event)
*
* @author wu
* @since 2024-05-10 17:10:33
*/
@Service("eventService")
public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements EventService {
@Resource
private TaskService taskService;
@Resource
private AmbService ambService;
@Resource
private AcceptService acceptService;
/**
*
*
* @param page
* @param event
* @return
*/
@Override
public Page<Event> page(Page<Event> page, EventPageRequest event) {
QueryWrapper<Event> wrapper = new QueryWrapper<>();
wrapper.ne("event_type", "转院")
.like(StrUtil.isNotEmpty(event.getEventName()), "event_name", event.getEventName())
.eq(StrUtil.isNotEmpty(event.getEventType()), "event_type", event.getEventType())
.eq(StrUtil.isNotEmpty(event.getEventLevel()), "event_level", event.getEventLevel())
.ge(event.getStartTime() != null, "event_date_time", event.getStartTime())
.le(event.getEndTime() != null, "event_date_time", event.getEndTime())
.like(StrUtil.isNotEmpty(event.getEventArea()), "event_area", event.getEventArea())
.like(StrUtil.isNotEmpty(event.getEventAddress()), "event_address", event.getEventAddress())
.eq(event.getSendAmbCount() != null, "send_amb_count", event.getSendAmbCount())
.like(StrUtil.isNotEmpty(event.getEventDescribe()), "event_describe", event.getEventDescribe())
.like(StrUtil.isNotEmpty(event.getAlarmUnit()), "alarm_unit", event.getAlarmUnit())
.like(StrUtil.isNotEmpty(event.getAlarmUnitContactor()), "alarm_unit_contactor", event.getAlarmUnitContactor())
.like(StrUtil.isNotEmpty(event.getAlarmUnitTelephone()), "alarm_unit_telephone", event.getAlarmUnitTelephone());
return this.page(page, wrapper);
}
/**
* id
*
* @param id id
* @return
*/
@Override
public EventsFindResponse findById(Serializable id) {
Event event = this.getById(id);
if (BeanUtil.isEmpty(event)) {
throw new ServiceException("所选数据不存在");
}
EventsFindResponse res = BeanUtil.copyProperties(event, EventsFindResponse.class);
// 查询任务信息
QueryWrapper<Task> taskWrapper = new QueryWrapper<>();
taskWrapper.eq("event_id", res.getEventId());
List<Task> taskList = taskService.list(taskWrapper);
// 受理调度信息
QueryWrapper<AcceptEvents> acceptWrapper = new QueryWrapper<>();
acceptWrapper.eq("event_id", res.getEventId());
List<AcceptEvents> acceptList = acceptService.list(acceptWrapper);
// 任务车辆
List<String> taskIdList = taskList.stream().map(Task::getTaskId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(taskIdList)) {
QueryWrapper<Amb> ambWrapper = new QueryWrapper<>();
ambWrapper.in("task_id", taskIdList);
List<Amb> ambList = ambService.list(ambWrapper);
res.setAmbs(ambList);
}
res.setAcceptEvents(acceptList);
res.setTasks(taskList);
return res;
}
}

@ -0,0 +1,50 @@
# DataSource Config
spring:
datasource:
url: jdbc:mysql://localhost:3306/algorithms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
driverClassName: com.mysql.cj.jdbc.Driver
# 日志配置
logging:
level:
com.yingji: debug
org.springframework: warn
# MyBatis配置
mybatis-plus:
# 指定实体类所在包的路径MyBatis-Plus 会自动扫描该路径下的实体类
typeAliasesPackage: com.yingji.entity
# 指定 Mapper 接口所在包的路径MyBatis-Plus 会自动扫描该路径下的 Mapper 接口
mapperLocations: classpath*:mapper/yingji/*Mapper.xml
knife4j:
enable: true
# openapi:
# group:
# test1:
# group-name: 应急算法
# 110获取token
getToken: http://2.46.4.198:8008/token
# 110获取数据
specificWarn: http://2.46.4.198:8008/rs/k4r3h/DataAnalysisService/sz/share/specificWarn
# 110clientId
clientId: BNjP9S8p2EJZyt1UF+D6kCsK6ZVapyKqiGzarEdsZ3QmIWoVdB7YkrX2GBAmCDO16tQ/ak86pZgP5ZS3s4EGdco=
# 110clientSecret
clientSecret: AM4oMOsJj0ULAUOOXlz5xHjIF4kp9W63ajZrXxTGLHEn
# 120获取token授权码
getAuthorizeValidateUrl: http://192.180.22.214:7015/api/Authorize/validate/v1
# 120获取token
getAuthorizeTokenUrl: http://192.180.22.214:7015/api/Authorize/token/get/v1
# 120获取数据
getAccidentUrl: http://192.180.22.214:7015/api/Event/accident/list/get/v2

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/logs/page" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yingji.mapper.AlarmMapper">
<select id="page" resultType="com.yingji.entity.Alarm">
select * from alarm
<where>
<if test="req.startTime != null ">
emergency_event_time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null ">
and emergency_event_time &lt;= #{req.endTime}
</if>
<if test="req.endTime != null ">
and emergency_event_time &lt;= #{req.endTime}
</if>
<if test="req.emergencyEventDesc != null and req.emergencyEventDesc != ''">
and emergency_event_desc like concat('%', #{req.emergencyEventDesc}, '%')
</if>
<if test="req.emergencyEventAddress != null and req.emergencyEventAddress != ''">
and emergency_event_address like concat('%', #{req.emergencyEventAddress}, '%')
</if>
<if test="req.alarmPhoneNumber != null and req.alarmPhoneNumber != ''">
and alarm_phone_number like concat('%', #{req.alarmPhoneNumber}, '%')
</if>
<if test="req.aiClass != null and req.aiClass != ''">
and ai_class like concat('%', #{req.aiClass}, '%')
</if>
<if test="req.aiClass2 != null and req.aiClass2 != ''">
and ai_class2 like concat('%', #{req.aiClass2}, '%')
</if>
<if test="req.aiLevel != null and req.aiLevel != ''">
and ai_level like concat('%', #{req.aiLevel}, '%')
</if>
<if test="req.aiNumMin != null ">
and ai_num &lt;= #{req.aiNumMin}
</if>
<if test="req.aiNumMax != null ">
and ai_num &lt;= #{req.aiNumMax}
</if>
</where>
order by update_time desc
</select>
</mapper>

@ -5,8 +5,14 @@
<groupId>com.yingji</groupId>
<artifactId>yingjiAlgorithms</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>yingjiAlgorithms</name>
<description>应急算法</description>
<modules>
<module>alarm</module>
<module>rescue</module>
<module>page</module>
</modules>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yingji</groupId>
<artifactId>yingjiAlgorithms</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>rescue</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<!--打包成jar包时的名字-->
<finalName>rescue</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.yingji.RescueApplication</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,23 @@
package com.yingji;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @author wu
* @since 2024/2/26 10:24
*/
@SpringBootApplication
@MapperScan("com.yingji.mapper")
@EnableAsync
@EnableScheduling
public class RescueApplication {
public static void main(String[] args) {
SpringApplication.run(RescueApplication.class, args);
}
}

@ -0,0 +1,93 @@
package com.yingji.base.constant;
/**
*
*
* @author ruoyi
*/
public class HttpStatus {
/**
*
*/
public static final int SUCCESS = 200;
/**
*
*/
public static final int CREATED = 201;
/**
*
*/
public static final int ACCEPTED = 202;
/**
*
*/
public static final int NO_CONTENT = 204;
/**
*
*/
public static final int MOVED_PERM = 301;
/**
*
*/
public static final int SEE_OTHER = 303;
/**
*
*/
public static final int NOT_MODIFIED = 304;
/**
*
*/
public static final int BAD_REQUEST = 400;
/**
*
*/
public static final int UNAUTHORIZED = 401;
/**
* 访
*/
public static final int FORBIDDEN = 403;
/**
*
*/
public static final int NOT_FOUND = 404;
/**
* http
*/
public static final int BAD_METHOD = 405;
/**
*
*/
public static final int CONFLICT = 409;
/**
*
*/
public static final int UNSUPPORTED_TYPE = 415;
/**
*
*/
public static final int ERROR = 500;
/**
*
*/
public static final int NOT_IMPLEMENTED = 501;
/**
*
*/
public static final int WARN = 601;
}

@ -0,0 +1,78 @@
package com.yingji.base.controller;
import com.yingji.base.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* web
*
* @author ruoyi
*/
public class BaseController {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
*
*/
public AjaxResult success() {
return AjaxResult.success();
}
/**
*
*/
public AjaxResult error() {
return AjaxResult.error();
}
/**
*
*/
public AjaxResult success(String message) {
return AjaxResult.success(message);
}
/**
*
*/
public AjaxResult success(Object data) {
return AjaxResult.success(data);
}
/**
*
*/
public AjaxResult error(String message) {
return AjaxResult.error(message);
}
/**
*
*/
public AjaxResult warn(String message) {
return AjaxResult.warn(message);
}
/**
*
*
* @param rows
* @return
*/
protected AjaxResult toAjax(int rows) {
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
*
*
* @param result
* @return
*/
protected AjaxResult toAjax(boolean result) {
return result ? success() : error();
}
}

@ -0,0 +1,202 @@
package com.yingji.base.domain;
import cn.hutool.core.bean.BeanUtil;
import com.yingji.base.constant.HttpStatus;
import java.util.HashMap;
import java.util.Objects;
/**
*
*
* @author ruoyi
*/
public class AjaxResult extends HashMap<String, Object> {
/**
*
*/
public static final String CODE_TAG = "code";
/**
*
*/
public static final String MSG_TAG = "msg";
/**
*
*/
public static final String DATA_TAG = "data";
private static final long serialVersionUID = 1L;
/**
* AjaxResult 使
*/
public AjaxResult() {
}
/**
* AjaxResult
*
* @param code
* @param msg
*/
public AjaxResult(int code, String msg) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
}
/**
* AjaxResult
*
* @param code
* @param msg
* @param data
*/
public AjaxResult(int code, String msg, Object data) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (BeanUtil.isNotEmpty(data)) {
super.put(DATA_TAG, data);
}
}
/**
*
*
* @return
*/
public static AjaxResult success() {
return AjaxResult.success("操作成功");
}
/**
*
*
* @return
*/
public static AjaxResult success(Object data) {
return AjaxResult.success("操作成功", data);
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult success(String msg) {
return AjaxResult.success(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult success(String msg, Object data) {
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult warn(String msg) {
return AjaxResult.warn(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult warn(String msg, Object data) {
return new AjaxResult(HttpStatus.WARN, msg, data);
}
/**
*
*
* @return
*/
public static AjaxResult error() {
return AjaxResult.error("操作失败");
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult error(String msg) {
return AjaxResult.error(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult error(String msg, Object data) {
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
*
*
* @param code
* @param msg
* @return
*/
public static AjaxResult error(int code, String msg) {
return new AjaxResult(code, msg, null);
}
/**
*
*
* @return
*/
public boolean isSuccess() {
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isWarn() {
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isError() {
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
/**
* 便
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value) {
super.put(key, value);
return this;
}
}

@ -0,0 +1,26 @@
package com.yingji.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author wu
* @since 2024/2/26 11:28
*/
@Configuration
public class MybatisPlusConfig {
/**
*
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//如果配置多个插件,切记分页最后添加
//interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); 如果有多数据源可以不配具体类型 否则都建议配上具体的DbType
return interceptor;
}
}

@ -0,0 +1,74 @@
package com.yingji.config;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* Swagger2
*
* @author ruoyi
*/
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {
/**
* swagger
*/
@Value("${knife4j.enable}")
private boolean enabled;
/**
* API
*/
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
// 是否启用Swagger
.enable(enabled)
//分组名称
.groupName("应急算法")
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
.select()
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
// .pathMapping(pathMapping)
// 排除mybatis-plus的分页参数
.ignoredParameterTypes(Page.class, IPage.class);
}
/**
*
*/
private ApiInfo apiInfo() {
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("应急算法")
// 描述
.description("描述:用于应急算法")
// 版本
.version("版本号:" + 1)
.build();
}
}

@ -0,0 +1,140 @@
package com.yingji.entity;
import cn.hutool.core.annotation.Alias;
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;
/**
* (Accept)
*
* @author wu
* @since 2024-05-10 17:10:32
*/
@Data
@ApiModel("受理调度信息实体类")
@TableName(value = "accept")
public class AcceptEvents implements Serializable {
private static final long serialVersionUID = 817570017991202657L;
/**
*
*/
@ApiModelProperty(value = "受理编码 主键")
@Alias("AcceptId")
@TableId
private String acceptId;
/**
*
*/
@ApiModelProperty(value = "呼救电话")
@Alias("AlarmTelephone")
private String alarmTelephone;
/**
*
*/
@ApiModelProperty(value = "病种判断")
@Alias("DiseaseJudge")
private String diseaseJudge;
/**
*
*/
@ApiModelProperty(value = "患者姓名")
@Alias("PatientName")
private String patientName;
/**
*
*/
@ApiModelProperty(value = "患者性别")
@Alias("PatientSex")
private String patientSex;
/**
*
*/
@ApiModelProperty(value = "患者年龄")
@Alias("PatientAge")
private String patientAge;
/**
*
*/
@ApiModelProperty(value = "受理类型")
@Alias("AcceptType")
private String acceptType;
/**
*
*/
@ApiModelProperty(value = "责任受理人")
@Alias("ResponsibleRecipient")
private String responsibleRecipient;
/**
*
*/
@ApiModelProperty(value = "现场地址")
@Alias("EventAddress")
private String eventAddress;
/**
*
*/
@ApiModelProperty(value = "等车地点")
@Alias("WaitAddress")
private String waitAddress;
/**
*
*/
@ApiModelProperty(value = "送往地点")
@Alias("SendAddress")
private String sendAddress;
/**
*
*/
@ApiModelProperty(value = "电话振铃时刻")
@Alias("RingDateTime")
@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 ringDateTime;
/**
*
*/
@ApiModelProperty(value = "开始受理时刻")
@Alias("StartAcceptDateTime")
@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 startAcceptDateTime;
/**
*
*/
@ApiModelProperty(value = "结束受理时刻")
@Alias("EndAcceptDateTime")
@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 endAcceptDateTime;
/**
*
*/
@ApiModelProperty(value = "发送指令时刻")
@Alias("SendOrderDateTime")
@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 sendOrderDateTime;
/**
*
*/
@ApiModelProperty(value = "事件编码")
@Alias("EventId")
private String eventId;
/**
*
*/
@ApiModelProperty(value = "受理序号")
@Alias("AcceptOrder")
private String acceptOrder;
}

@ -0,0 +1,75 @@
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* (Amb)
*
* @author wu
* @since 2024-05-10 17:10:32
*/
@Data
@ApiModel("任务车辆实体类")
@TableName(value = "amb")
public class Amb implements Serializable {
private static final long serialVersionUID = -69012811106234254L;
/**
* id
*/
@ApiModelProperty(value = "主键id")
@TableId(type = IdType.AUTO)
private Long id;
/**
* id
*/
@ApiModelProperty(value = "任务id")
private String taskId;
/**
*
*/
@ApiModelProperty(value = "车牌号码")
@Alias("PlateNumber")
private String plateNumber;
/**
*
*/
@ApiModelProperty(value = "实际标识")
@Alias("RealSign")
private String realSign;
/**
*
*/
@ApiModelProperty(value = "车辆编码")
@Alias("AmbCode")
private String ambCode;
/**
*
*/
@ApiModelProperty(value = "分站")
@Alias("StationName")
private String stationName;
/**
*
*/
@ApiModelProperty(value = "车辆类型")
@Alias("AmbType")
private String ambType;
/**
*
*/
@ApiModelProperty(value = "随车电话")
@Alias("AmbPhone")
private String ambPhone;
}

@ -0,0 +1,128 @@
package com.yingji.entity;
import cn.hutool.core.annotation.Alias;
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;
/**
* (Event)
*
* @author wu
* @since 2024-05-10 17:10:32
*/
@Data
@ApiModel("事故实体类")
@TableName(value = "event")
public class Event implements Serializable {
private static final long serialVersionUID = -50765468921159766L;
/**
*
*/
@ApiModelProperty(value = "事件编码主键")
@Alias("EventId")
@TableId
private String eventId;
/**
*
*/
@ApiModelProperty(value = "事件标题")
@Alias("EventName")
private String eventName;
/**
*
*/
@ApiModelProperty(value = "事件类型")
@Alias("EventType")
private String eventType;
/**
*
*/
@ApiModelProperty(value = "事件等级")
@Alias("EventLevel")
private String eventLevel;
/**
*
*/
@ApiModelProperty(value = "事发时间")
@Alias("EventDateTime")
@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 eventDateTime;
/**
* ()
*/
@ApiModelProperty(value = "事发地区(行政区划)")
@Alias("EventArea")
private String eventArea;
/**
*
*/
@ApiModelProperty(value = "详细位置")
@Alias("EventAddress")
private String eventAddress;
/**
*
*/
@ApiModelProperty(value = "经度")
@Alias("EventLongitude")
private String eventLongitude;
/**
*
*/
@ApiModelProperty(value = "维度")
@Alias("EventLatitude")
private String eventLatitude;
/**
* /
*/
@ApiModelProperty(value = "出动次数(出动救护车次/辆数量)")
@Alias("SendAmbCount")
private Integer sendAmbCount;
/**
*
*/
@ApiModelProperty(value = "事件描述")
@Alias("EventDescribe")
private String eventDescribe;
/**
*
*/
@ApiModelProperty(value = "报送单位")
@Alias("AlarmUnit")
private String alarmUnit;
/**
*
*/
@ApiModelProperty(value = "报送单位联系人")
@Alias("AlarmUnitContactor")
private String alarmUnitContactor;
/**
*
*/
@ApiModelProperty(value = "报送单位联系电话")
@Alias("AlarmUnitTelephone")
private String alarmUnitTelephone;
/**
*
*/
@ApiModelProperty(value = "附件资料")
@Alias("AttachmentInfo")
private String attachmentInfo;
/**
*
*/
@ApiModelProperty(value = "备注")
@Alias("Remark")
private String remark;
}

@ -0,0 +1,172 @@
package com.yingji.entity;
import cn.hutool.core.annotation.Alias;
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;
/**
* (Task)
*
* @author wu
* @since 2024-05-10 17:10:33
*/
@Data
@ApiModel("任务信息实体类")
@TableName(value = "task")
public class Task implements Serializable {
private static final long serialVersionUID = 148870996673219596L;
/**
* id
*/
@ApiModelProperty(value = "主键id")
@Alias("TaskId")
@TableId
private String taskId;
/**
*
*/
@ApiModelProperty(value = "是否结束")
@Alias("IsOver")
private Boolean isOver;
/**
*
*/
@ApiModelProperty(value = "送往地点")
@Alias("RealSendAddress")
private String realSendAddress;
/**
*
*/
@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")
@Alias("TaskCreatedDateTime")
private LocalDateTime taskCreatedDateTime;
/**
*
*/
@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")
@Alias("AcceptOrderDateTime")
private LocalDateTime acceptOrderDateTime;
/**
*
*/
@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")
@Alias("OutAmbDateTime")
private LocalDateTime outAmbDateTime;
/**
*
*/
@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")
@Alias("ArriveSceneDateTime")
private LocalDateTime arriveSceneDateTime;
/**
*
*/
@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")
@Alias("LeaveSceneDateTime")
private LocalDateTime leaveSceneDateTime;
/**
*
*/
@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")
@Alias("ArriveHospitalDateTime")
private LocalDateTime arriveHospitalDateTime;
/**
*
*/
@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")
@Alias("ComplatedDateTime")
private LocalDateTime complatedDateTime;
/**
*
*/
@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")
@Alias("ReturnStationDateTime")
private LocalDateTime returnStationDateTime;
/**
*
*/
@ApiModelProperty(value = "是否正常结束")
@Alias("IsNormalOver")
private Boolean isNormalOver;
/**
*
*/
@ApiModelProperty(value = "异常原因")
@Alias("AbnormalReason")
private String abnormalReason;
/**
*
*/
@ApiModelProperty(value = "司机")
@Alias("Driver")
private String driver;
/**
*
*/
@ApiModelProperty(value = "医生")
@Alias("Doctor")
private String doctor;
/**
*
*/
@ApiModelProperty(value = "担架工")
@Alias("Stretcher")
private String stretcher;
/**
*
*/
@ApiModelProperty(value = "担架工")
@Alias("Nurse")
private String nurse;
/**
*
*/
@ApiModelProperty(value = "出车分站")
@Alias("StationName")
private String stationName;
/**
*
*/
@ApiModelProperty(value = "受理序号")
@Alias("AcceptOrder")
private String acceptOrder;
/**
*
*/
@ApiModelProperty(value = "受理编码")
@Alias("AcceptId")
private String acceptId;
/**
*
*/
@ApiModelProperty(value = "事件编码")
@Alias("EventId")
private String eventId;
}

@ -0,0 +1,100 @@
package com.yingji.entity.dto.response;
import cn.hutool.core.annotation.Alias;
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;
/**
* (Event)
*
* @author wu
* @since 2024-05-10 17:10:32
*/
@Data
@ApiModel("事故分页查询请求类")
public class EventPageRequest implements Serializable {
private static final long serialVersionUID = -5290914853773569936L;
/**
*
*/
@ApiModelProperty(value = "事件标题")
private String eventName;
/**
*
*/
@ApiModelProperty(value = "事件类型")
private String eventType;
/**
*
*/
@ApiModelProperty(value = "事件等级")
private String eventLevel;
/**
*
*/
@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 startTime;
/**
*
*/
@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 endTime;
/**
* ()
*/
@ApiModelProperty(value = "事发地区(行政区划)")
private String eventArea;
/**
*
*/
@ApiModelProperty(value = "详细位置")
private String eventAddress;
/**
* /
*/
@ApiModelProperty(value = "出动次数(出动救护车次/辆数量)")
@Alias("SendAmbCount")
private Integer sendAmbCount;
/**
*
*/
@ApiModelProperty(value = "事件描述")
@Alias("EventDescribe")
private String eventDescribe;
/**
*
*/
@ApiModelProperty(value = "报送单位")
@Alias("AlarmUnit")
private String alarmUnit;
/**
*
*/
@ApiModelProperty(value = "报送单位联系人")
@Alias("AlarmUnitContactor")
private String alarmUnitContactor;
/**
*
*/
@ApiModelProperty(value = "报送单位联系电话")
@Alias("AlarmUnitTelephone")
private String alarmUnitTelephone;
}

@ -0,0 +1,144 @@
package com.yingji.entity.dto.response;
import cn.hutool.core.annotation.Alias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yingji.entity.AcceptEvents;
import com.yingji.entity.Amb;
import com.yingji.entity.Task;
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;
import java.util.List;
/**
* @author wu
* @since 2024/4/30 4:24
*/
@Data
@ApiModel(value = "响应类")
public class EventsFindResponse implements Serializable {
private static final long serialVersionUID = -3894493286879970663L;
/**
*
*/
@ApiModelProperty(value = "受理调度信息")
private List<AcceptEvents> acceptEvents;
/**
*
*/
@ApiModelProperty(value = "任务车辆")
private List<Amb> ambs;
/**
*
*/
@ApiModelProperty(value = "任务信息")
private List<Task> tasks;
/**
*
*/
@ApiModelProperty(value = "事件编码主键")
@Alias("EventId")
private String eventId;
/**
*
*/
@ApiModelProperty(value = "事件标题")
@Alias("EventName")
private String eventName;
/**
*
*/
@ApiModelProperty(value = "事件类型")
@Alias("EventType")
private String eventType;
/**
*
*/
@ApiModelProperty(value = "事件等级")
@Alias("EventLevel")
private String eventLevel;
/**
*
*/
@ApiModelProperty(value = "事发时间")
@Alias("EventDateTime")
@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 eventDateTime;
/**
* ()
*/
@ApiModelProperty(value = "事发地区(行政区划)")
@Alias("EventArea")
private String eventArea;
/**
*
*/
@ApiModelProperty(value = "详细位置")
@Alias("EventAddress")
private String eventAddress;
/**
*
*/
@ApiModelProperty(value = "经度")
@Alias("EventLongitude")
private String eventLongitude;
/**
*
*/
@ApiModelProperty(value = "维度")
@Alias("EventLatitude")
private String eventLatitude;
/**
* /
*/
@ApiModelProperty(value = "出动次数(出动救护车次/辆数量)")
@Alias("SendAmbCount")
private Integer sendAmbCount;
/**
*
*/
@ApiModelProperty(value = "事件描述")
@Alias("EventDescribe")
private String eventDescribe;
/**
*
*/
@ApiModelProperty(value = "报送单位")
@Alias("AlarmUnit")
private String alarmUnit;
/**
*
*/
@ApiModelProperty(value = "报送单位联系人")
@Alias("AlarmUnitContactor")
private String alarmUnitContactor;
/**
*
*/
@ApiModelProperty(value = "报送单位联系电话")
@Alias("AlarmUnitTelephone")
private String alarmUnitTelephone;
/**
*
*/
@ApiModelProperty(value = "附件资料")
@Alias("AttachmentInfo")
private String attachmentInfo;
/**
*
*/
@ApiModelProperty(value = "备注")
@Alias("Remark")
private String remark;
}

@ -0,0 +1,147 @@
package com.yingji.entity.dto.response;
import cn.hutool.core.annotation.Alias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yingji.entity.AcceptEvents;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author wu
* @since 2024/4/30 4:24
*/
@Data
public class EventsResponse implements Serializable {
private static final long serialVersionUID = -3894493286879970663L;
/**
*
*/
@Alias("AcceptEvents")
@ApiModelProperty(value = "受理调度信息")
private List<AcceptEvents> acceptEvents;
@Alias("TaskInfos")
private List<TaskInfos> taskInfos;
/**
*
*/
@Alias("EventName")
@ApiModelProperty(value = "事件标题")
private String eventName;
/**
*
*/
@Alias("EventType")
@ApiModelProperty(value = "事件类型")
private String eventType;
/**
*
*/
@Alias("EventLevel")
@ApiModelProperty(value = "事件等级")
private String eventLevel;
/**
*
*/
@Alias("EventDateTime")
@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 eventDateTime;
/**
*
*/
@Alias("EventDescribe")
@ApiModelProperty(value = "事件描述")
private String eventDescribe;
/**
* ()
*/
@Alias("EventArea")
@ApiModelProperty(value = "事发地区(行政区划)")
private String eventArea;
/**
*
*/
@Alias("EventAddress")
@ApiModelProperty(value = "详细位置")
private String eventAddress;
/**
*
*/
@Alias("EventLongitude")
@ApiModelProperty(value = "经度")
private String eventLongitude;
/**
*
*/
@Alias("EventLatitude")
@ApiModelProperty(value = "维度")
private Double eventLatitude;
/**
*
*/
@Alias("AlarmUnit")
@ApiModelProperty(value = "报送单位")
private String alarmUnit;
/**
*
*/
@Alias("AlarmUnitContactor")
@ApiModelProperty(value = "报送单位联系人")
private String alarmUnitContactor;
/**
*
*/
@Alias("AlarmUnitTelephone")
@ApiModelProperty(value = "报送单位联系电话")
private String alarmUnitTelephone;
/**
* /
*/
@Alias("SendAmbCount")
@ApiModelProperty(value = "出动次数(出动救护车次/辆数量)")
private Integer sendAmbCount;
/**
*
*/
@Alias("AttachmentInfo")
@ApiModelProperty(value = "附件资料")
private String attachmentInfo;
/**
*
*/
@Alias("Remark")
@ApiModelProperty(value = "备注")
private String remark;
/**
*
*/
@Alias("EventId")
@ApiModelProperty(value = "事件编码 主键")
private String eventId;
}

@ -0,0 +1,24 @@
package com.yingji.entity.dto.response;
import cn.hutool.core.annotation.Alias;
import com.yingji.entity.Amb;
import com.yingji.entity.Task;
import lombok.Data;
import java.io.Serializable;
/**
* @author wu
* @since 2024/4/30 4:19
*/
@Data
public class TaskInfos implements Serializable {
private static final long serialVersionUID = 4118581272605160572L;
@Alias("Amb")
private Amb amb;
@Alias("Task")
private Task task;
}

@ -0,0 +1,94 @@
package com.yingji.exception;
import cn.dev33.satoken.exception.NotLoginException;
import com.yingji.base.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest;
/**
*
*
* @author wu
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
*
*/
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod());
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(RuntimeException.class)
public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生未知异常.", requestURI, e);
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(Exception.class)
public AjaxResult handleException(Exception e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生系统异常.", requestURI, e);
return AjaxResult.error(e.getMessage());
}
/**
*
*/
@ExceptionHandler(BindException.class)
public AjaxResult handleBindException(BindException e) {
log.error(e.getMessage(), e);
String message = e.getAllErrors().get(0).getDefaultMessage();
return AjaxResult.error(message);
}
/**
*
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
log.error(e.getMessage(), e);
String message = e.getBindingResult().getFieldError().getDefaultMessage();
return AjaxResult.error(message);
}
/**
*
*/
@ExceptionHandler(NotLoginException.class)
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());
}
}

@ -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;
/**
*
* <p>
* {@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;
}
}

@ -0,0 +1,15 @@
package com.yingji.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yingji.entity.AcceptEvents;
/**
* (Accept)访
*
* @author wu
* @since 2024-05-10 17:10:32
*/
public interface AcceptMapper extends BaseMapper<AcceptEvents> {
}

@ -0,0 +1,15 @@
package com.yingji.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yingji.entity.Amb;
/**
* (Amb)访
*
* @author wu
* @since 2024-05-10 17:10:32
*/
public interface AmbMapper extends BaseMapper<Amb> {
}

@ -0,0 +1,15 @@
package com.yingji.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yingji.entity.Event;
/**
* (Event)访
*
* @author wu
* @since 2024-05-10 17:10:32
*/
public interface EventMapper extends BaseMapper<Event> {
}

@ -0,0 +1,15 @@
package com.yingji.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yingji.entity.Task;
/**
* (Task)访
*
* @author wu
* @since 2024-05-10 17:10:33
*/
public interface TaskMapper extends BaseMapper<Task> {
}

@ -3,6 +3,10 @@ package com.yingji.quartz;
import com.yingji.service.AccidentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -12,8 +16,8 @@ import javax.annotation.Resource;
* @author wu
* @since 2024/5/10 10:05
*/
//@Configuration
//@Transactional(rollbackFor = Exception.class)
@Configuration
@Transactional(rollbackFor = Exception.class)
public class AccidentQuartz {
public static final Logger log = LoggerFactory.getLogger(AccidentQuartz.class);
@ -21,10 +25,9 @@ public class AccidentQuartz {
@Resource
private AccidentService accidentService;
// @Async
// @Scheduled(cron = "*/10 * * * * ? ")
@Async
@Scheduled(cron = "*/10 * * * * ? ")
public void savaData() {
accidentService.getAuthorizeValidate();
String accessToken = accidentService.getAuthorizeToken();
accidentService.getAccidentUrl(accessToken);
log.info("=================120定时任务结束===============");

@ -0,0 +1,248 @@
package com.yingji.redis;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* spring redis
*
* @author wu
**/
@SuppressWarnings(value = {"unchecked", "rawtypes"})
@Component
public class RedisCache {
@Resource
public RedisTemplate redisTemplate;
/**
* IntegerString
*
* @param key
* @param value
*/
public <T> void setCacheObject(final String key, final T value) {
redisTemplate.opsForValue().set(key, value);
}
/**
* IntegerString
*
* @param key
* @param value
* @param timeout
* @param timeUnit
*/
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
}
/**
*
*
* @param key Redis
* @param timeout
* @return true=false=
*/
public boolean expire(final String key, final long timeout) {
return expire(key, timeout, TimeUnit.SECONDS);
}
/**
*
*
* @param key Redis
* @param timeout
* @param unit
* @return true=false=
*/
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
return redisTemplate.expire(key, timeout, unit);
}
/**
*
*
* @param key Redis
* @return
*/
public long getExpire(final String key) {
return redisTemplate.getExpire(key);
}
/**
* key
*
* @param key
* @return true false
*/
public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
/**
*
*
* @param key
* @return
*/
public <T> T getCacheObject(final String key) {
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
/**
*
*
* @param key
*/
public boolean deleteObject(final String key) {
return redisTemplate.delete(key);
}
/**
*
*
* @param collection
* @return
*/
public boolean deleteObject(final Collection collection) {
return redisTemplate.delete(collection) > 0;
}
/**
* List
*
* @param key
* @param dataList List
* @return
*/
public <T> long setCacheList(final String key, final List<T> dataList) {
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
/**
* list
*
* @param key
* @return
*/
public <T> List<T> getCacheList(final String key) {
return redisTemplate.opsForList().range(key, 0, -1);
}
/**
* Set
*
* @param key
* @param dataSet
* @return
*/
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator();
while (it.hasNext()) {
setOperation.add(it.next());
}
return setOperation;
}
/**
* set
*
* @param key
* @return
*/
public <T> Set<T> getCacheSet(final String key) {
return redisTemplate.opsForSet().members(key);
}
/**
* Map
*
* @param key
* @param dataMap
*/
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
}
/**
* Map
*
* @param key
* @return
*/
public <T> Map<String, T> getCacheMap(final String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @param value
*/
public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
redisTemplate.opsForHash().put(key, hKey, value);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @return Hash
*/
public <T> T getCacheMapValue(final String key, final String hKey) {
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
/**
* Hash
*
* @param key Redis
* @param hKeys Hash
* @return Hash
*/
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
/**
* Hash
*
* @param key Redis
* @param hKey Hash
* @return
*/
public boolean deleteCacheMapValue(final String key, final String hKey) {
return redisTemplate.opsForHash().delete(key, hKey) > 0;
}
/**
*
*
* @param pattern
* @return
*/
public Collection<String> keys(final String pattern) {
return redisTemplate.keys(pattern);
}
}

@ -0,0 +1,15 @@
package com.yingji.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yingji.entity.AcceptEvents;
/**
* (Accept)
*
* @author wu
* @since 2024-05-10 17:10:32
*/
public interface AcceptService extends IService<AcceptEvents> {
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save