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>
|
@ -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;
|
package com.yingji.entity;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
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.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Source)表实体类
|
* (Source)表实体类
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<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" />
|
<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,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,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,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,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,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);
|
||||||
|
}
|
||||||
|
|
@ -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,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 >= #{req.startTime}
|
||||||
|
</if>
|
||||||
|
<if test="req.endTime != null ">
|
||||||
|
and emergency_event_time <= #{req.endTime}
|
||||||
|
</if>
|
||||||
|
<if test="req.endTime != null ">
|
||||||
|
and emergency_event_time <= #{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 <= #{req.aiNumMin}
|
||||||
|
</if>
|
||||||
|
<if test="req.aiNumMax != null ">
|
||||||
|
and ai_num <= #{req.aiNumMax}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by update_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -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,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,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,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,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,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,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> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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…
Reference in new issue