新增119接口

wushunjie
吴顺杰 11 months ago
parent 38b848da85
commit 6d38844948

@ -1,19 +1,23 @@
package com.ruoyi.system.controller;
package com.ruoyi.page.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.page.domain.Event;
import com.ruoyi.page.domain.dto.request.EventPageRequest;
import com.ruoyi.page.service.IEventService;
import com.ruoyi.system.domain.Event;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**

@ -1,28 +1,24 @@
package com.ruoyi.system.domain;
package com.ruoyi.page.domain;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* event
*
*
* @author ruoyi
* @date 2024-05-30
*/
@Data
@ApiModel("事故实体类")
public class Event extends BaseEntity
{
public class Event extends BaseEntity {
private static final long serialVersionUID = 1L;
/**

@ -1,12 +1,11 @@
package com.ruoyi.page.mapper;
import java.util.List;
import com.ruoyi.page.domain.Event;
import com.ruoyi.page.domain.dto.request.EventPageRequest;
import com.ruoyi.system.domain.Event;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*

@ -1,10 +1,9 @@
package com.ruoyi.page.service;
import java.util.List;
import com.ruoyi.page.domain.Event;
import com.ruoyi.page.domain.dto.request.EventPageRequest;
import com.ruoyi.system.domain.Event;
import java.util.List;
/**
* Service

@ -1,14 +1,13 @@
package com.ruoyi.page.service.impl;
import java.util.List;
import com.ruoyi.page.domain.Event;
import com.ruoyi.page.domain.dto.request.EventPageRequest;
import com.ruoyi.page.mapper.EventMapper;
import com.ruoyi.page.service.IEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.page.mapper.EventMapper;
import com.ruoyi.system.domain.Event;
import java.util.List;
/**

@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/mudu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/algorithms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: adminadmin
password: 123456
# 从库数据源
slave:
# 从数据源开关/默认关闭

@ -36,8 +36,8 @@ server:
# 日志配置
logging:
level:
com.ruoyi: debug
org.springframework: warn
com.ruoyi: error
org.springframework: error
# 用户配置
user:
@ -74,7 +74,7 @@ spring:
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
database: 4
# 密码
password:
# 连接超时时间
@ -116,7 +116,7 @@ pagehelper:
# Swagger配置
knife4j:
enable: true
enable: false
# 防止XSS攻击

@ -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>fire</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>fire</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.FireApplication</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 FireApplication {
public static void main(String[] args) {
SpringApplication.run(FireApplication.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,133 @@
package com.yingji.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author wu
* @since 2024/6/4 4:26
*/
@Data
@ApiModel("实体类")
@TableName(value = "Fire")
public class Fire implements Serializable {
private static final long serialVersionUID = 9084065880894382754L;
/**
* id
*/
private String id;
/**
*
*/
private String xzqh;
/**
*
*/
private String ajbh;
/**
*
*/
private String ajms;
/**
*
*/
@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 gdsj;
private String jjyxm;
/**
*
*/
@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 sjc;
/**
*
*/
private String wd;
/**
*
*/
private String jd;
/**
*
*/
private String bcxx;
/**
*
*/
@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 jssj;
/**
*
*/
private String afdz;
/**
*
*/
@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 cdsj;
/**
*
*/
private String lafsdm;
/**
* topic
*/
private String topic;
@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 xdsj;
/**
*
*/
@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 lasj;
/**
*
*/
private String xzqhmc;
/**
*
*/
@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 ddxcsj;
/**
*
*/
@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;
}

@ -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,24 @@
package com.yingji.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yingji.entity.Fire;
import java.util.List;
/**
* 119访
*
* @author wu
* @since 2024-05-06 09:15:01
*/
public interface FireMapper extends BaseMapper<Fire> {
/**
*
*
* @param list
*/
void saveAll(List<Fire> list);
}

@ -0,0 +1,53 @@
package com.yingji.quartz;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.yingji.entity.Fire;
import com.yingji.service.FireService;
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.util.List;
/**
* 119
*
* @author wu
* @since 2024/05/06 10:18
*/
@Configuration
public class FireQuartz {
public static final Logger log = LoggerFactory.getLogger(FireQuartz.class);
@Resource
private FireService fireService;
/**
*
*/
@Async
@Scheduled(cron = "0 */5 * * * ? ")
public void savaData() {
log.info("119接口开始" + LocalDateTime.now());
// 获取token
String token = fireService.getToken();
if (StrUtil.isNotEmpty(token)) {
// 根据id查询数据保存
List<Fire> list = fireService.findDataList(token);
// 110算法接口
if (CollectionUtil.isNotEmpty(list)) {
fireService.saveAll(list);
}
log.info("119接口结束" + LocalDateTime.now());
} else {
log.error("============119算法接口获取token失败119接口结束=============");
}
}
}

@ -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,41 @@
package com.yingji.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yingji.entity.Fire;
import java.util.List;
/**
* 119
*
* @author wu
* @since 2024-05-06 09:15:01
*/
public interface FireService extends IService<Fire> {
/**
*
*
* @param req
* @param token token
* @return List
*/
List<Fire> findDataList(String token);
/**
* 110token
*
* @return token
*/
String getToken();
/**
*
*
* @param list
*/
void saveAll(List<Fire> list);
}

@ -0,0 +1,136 @@
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.HttpException;
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.Fire;
import com.yingji.mapper.FireMapper;
import com.yingji.service.FireService;
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.util.List;
import java.util.stream.Collectors;
/**
* 119
*
* @author wu
* @since 2024-05-06 09:15:01
*/
@Service("fireService")
public class FireServiceImpl extends ServiceImpl<FireMapper, Fire> implements FireService {
public static final Logger log = LoggerFactory.getLogger(FireServiceImpl.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);
}
/**
*
*
* @param token token
* @return List
*/
@Override
public List<Fire> findDataList(String token) {
List<Fire> records = null;
// 获取id
String body = HttpRequest.post(specificWarn).header("Authorization", "Basic " + token).header("Content-Type", "application/json").execute().body();
log.info("===============================");
log.info("119body数据为:" + body);
try {
JSONObject json = JSONObject.parse(body);
Object response = json.get("response");
if (BeanUtil.isNotEmpty(response)) {
String recordsStr = JSONUtil.toJsonStr(response);
if (StrUtil.isEmpty(recordsStr)) {
return null;
}
records = JSONUtil.toList(recordsStr, Fire.class);
if (records == null) {
return null;
}
return records.stream()
.filter(district -> "苏州市".equals(district.getXzqhmc()))
.peek(district -> district.setCreateTime(LocalDateTime.now())) // 使用peek设置时间戳
.collect(Collectors.toList());
}
} catch (Exception e) {
log.info("json解析错误");
}
return records;
}
/**
* 119token
*
* @return token
*/
@Override
public String getToken() {
String accessToken = null;
String body = null;
try {
body = HttpRequest.get(getToken)
.header("Authorization", "Basic QkZTaFQzL1d3UGhaSlFkTDhlNEZkblExMWgwUU9lS3FCZG4reGVzQ1NKR2xESEtQazVmeG5tbkxrMW9ua20zWXpkZmpFMGdMR0VaN0g3dmZMczIxc0dNPTpHdGJnUmZOSW1Yam1CcVcwbnB4VWlHaS9zMG1iNVpkdlhBTnFVQ2dtSW00PQ==")
.header("Content-Type", "application/json")
.form("grant_type", "client_credentials").execute().body();
} catch (HttpException e) {
log.error("获取token接口响应超时");
}
JSONObject json = JSONObject.parse(body);
if (json == null) {
return accessToken;
}
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("119token为:" + accessToken);
return accessToken;
}
/**
*
*
* @param list
*/
@Override
public void saveAll(List<Fire> list) {
baseMapper.saveAll(list);
}
}

@ -0,0 +1,41 @@
# 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: 应急算法
# 119获取token
getToken: http://2.46.4.198:8008/token
# 119获取数据
specificWarn: http://2.46.4.198:8008/rs/8uu6d/DataAnalysisService/st/data/fire_alarm
# 119clientId
clientId: BFShT3/WwPhZJQdL8e4FdnQ11h0QOeKqBdn+xesCSJGlDHKPk5fxnmnLk1onkm3YzdfjE0gLGEZ7H7vfLs21sGM=
# 119clientSecret
clientSecret: GtbgRfNImXjmBqW0npxUiGi/s0mb5ZdvXANqUCgmIm4=

@ -0,0 +1,40 @@
server:
port: 9008
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

@ -0,0 +1,21 @@
<?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.FireMapper">
<insert id="saveAll">
INSERT IGNORE INTO `fire`(
id, xzqh, ajbh, ajms, gdsj, jjyxm, sjc, wd, jd, bcxx, jssj, afdz, cdsj, lafsdm, topic, xdsj, lasj, xzqhmc,
ddxcsj, create_time
) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id}, #{item.xzqh}, #{item.ajbh}, #{item.ajms}, #{item.gdsj}, #{item.jjyxm}, #{item.sjc}, #{item.wd},
#{item.jd}, #{item.bcxx}, #{item.jssj}, #{item.afdz},
#{item.cdsj}, #{item.lafsdm}, #{item.topic}, #{item.xdsj}, #{item.lasj}, #{item.xzqhmc}, #{item.ddxcsj},
#{item.createTime})
</foreach>
</insert>
</mapper>

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/logs/fire" />
<!-- 日志输出格式 -->
<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>

@ -55,8 +55,8 @@ public class AlarmController extends BaseController {
@ApiOperation(value = "分页条件查询报警事件", response = Alarm.class)
public AjaxResult page(Page<Alarm> page, AlarmFindRequest req) {
StpUtil.checkLogin();
if (page.getSize() > 500) {
page.setSize(500);
if (page.getSize() > 1000) {
page.setSize(1000);
}
return success(alarmService.page(page, req));
}

@ -55,8 +55,8 @@ public class EventController extends BaseController {
@ApiOperation(value = "分页条件查询事故", response = Event.class)
public AjaxResult page(Page<Event> page, EventPageRequest event) {
StpUtil.checkLogin();
if (page.getSize() > 500) {
page.setSize(500);
if (page.getSize() > 1000) {
page.setSize(1000);
}
return success(eventService.page(page, event));
}

@ -0,0 +1,71 @@
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.Fire;
import com.yingji.entity.dto.request.FireFindRequest;
import com.yingji.service.FireService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.Serializable;
/**
* 119(Fire)
*
* @author wu
* @since 2024-06-05 09:24:14
*/
@RestController
@RequestMapping("algorithms/fire")
@Api(tags = "119数据")
@Transactional(rollbackFor = Exception.class)
public class FireController extends BaseController {
/**
*
*/
@Resource
private FireService fireService;
/**
*
*
* @param page
* @param fire
* @return
*/
@GetMapping
@ApiOperation(value = "分页条件查询119数据", response = Fire.class)
public AjaxResult page(Page<Fire> page, FireFindRequest fire) {
StpUtil.checkLogin();
if (page.getSize() > 1000) {
page.setSize(1000);
}
return success(fireService.page(page, fire));
}
/**
*
*
* @param id
* @return
*/
@GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条119数据", response = Fire.class)
public AjaxResult getById(@PathVariable Serializable id) {
StpUtil.checkLogin();
return success(fireService.getById(id));
}
}

@ -132,5 +132,22 @@ public class Event implements Serializable {
@ApiModelProperty(value = "110的emergency_event_id")
@TableField(value = "ai_110_id")
private Long ai110Id;
/**
*
*/
@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 = "最后更新时间")
@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;
}

@ -0,0 +1,117 @@
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;
import java.util.Date;
/**
* 119(Fire)
*
* @author wu
* @since 2024-06-05 09:24:14
*/
@Data
@ApiModel("119数据实体类")
@TableName(value = "fire")
public class Fire implements Serializable {
private static final long serialVersionUID = -96682169109217319L;
/**
* id
*/
@ApiModelProperty(value = "主键id")
private String id;
/**
*
*/
@ApiModelProperty(value = "行政区划")
private String xzqh;
/**
*
*/
@ApiModelProperty(value = "案件编号")
private String ajbh;
/**
*
*/
@ApiModelProperty(value = "案件描述")
private String ajms;
/**
*
*/
@ApiModelProperty(value = "归队时间")
private Date gdsj;
private String jjyxm;
/**
*
*/
@ApiModelProperty(value = "时间戳")
private Date sjc;
/**
*
*/
@ApiModelProperty(value = "纬度")
private String wd;
/**
*
*/
@ApiModelProperty(value = "经度")
private String jd;
/**
*
*/
@ApiModelProperty(value = "备注信息")
private String bcxx;
/**
*
*/
@ApiModelProperty(value = "结束时间")
private Date jssj;
/**
*
*/
@ApiModelProperty(value = "案发地址")
private String afdz;
/**
*
*/
@ApiModelProperty(value = "出动时间")
private Date cdsj;
/**
*
*/
@ApiModelProperty(value = "立案方式代码")
private String lafsdm;
/**
* topic
*/
@ApiModelProperty(value = "topic")
private String topic;
private Date xdsj;
/**
*
*/
@ApiModelProperty(value = "立案时间")
private Date lasj;
/**
*
*/
@ApiModelProperty(value = "行政区划名称")
private String xzqhmc;
/**
*
*/
@ApiModelProperty(value = "到达现场时间")
private Date ddxcsj;
/**
*
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
}

@ -0,0 +1,57 @@
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;
/**
* 119
*
* @author wu
* @since 2024/4/30 3:59
*/
@ApiModel(value = "119查询请求类")
@Data
public class FireFindRequest implements Serializable {
private static final long serialVersionUID = -3688091864596277161L;
/**
*
*/
@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 ajbh;
/**
*
*/
@ApiModelProperty(value = "案件描述")
private String ajms;
/**
*
*/
@ApiModelProperty(value = "案发地址")
private String afdz;
}

@ -0,0 +1,15 @@
package com.yingji.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yingji.entity.Fire;
/**
* 119(Fire)访
*
* @author wu
* @since 2024-06-05 09:24:14
*/
public interface FireMapper extends BaseMapper<Fire> {
}

@ -0,0 +1,25 @@
package com.yingji.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yingji.entity.Fire;
import com.yingji.entity.dto.request.FireFindRequest;
/**
* 119(Fire)
*
* @author wu
* @since 2024-06-05 09:24:14
*/
public interface FireService extends IService<Fire> {
/**
*
*
* @param page
* @param fire
* @return
*/
Page<Fire> page(Page<Fire> page, FireFindRequest fire);
}

@ -57,8 +57,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
.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())
.ge(event.getStartTime() != null, "create_time", event.getStartTime())
.le(event.getEndTime() != null, "create_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())

@ -0,0 +1,40 @@
package com.yingji.service.impl;
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.Fire;
import com.yingji.entity.dto.request.FireFindRequest;
import com.yingji.mapper.FireMapper;
import com.yingji.service.FireService;
import org.springframework.stereotype.Service;
/**
* 119(Fire)
*
* @author wu
* @since 2024-06-05 09:24:14
*/
@Service("fireService")
public class FireServiceImpl extends ServiceImpl<FireMapper, Fire> implements FireService {
/**
*
*
* @param page
* @param fire
* @return
*/
@Override
public Page<Fire> page(Page<Fire> page, FireFindRequest fire) {
QueryWrapper<Fire> wrapper = new QueryWrapper<>();
wrapper.like(StrUtil.isNotEmpty(fire.getAjbh()), "ajbh", fire.getAjbh())
.ge(fire.getStartTime() != null, "create_time", fire.getStartTime())
.le(fire.getEndTime() != null, "create_time", fire.getEndTime())
.like(StrUtil.isNotEmpty(fire.getAjms()), "ajms", fire.getAjms())
.like(StrUtil.isNotEmpty(fire.getAfdz()), "afdz", fire.getAfdz());
return this.page(page, wrapper);
}
}

@ -9,13 +9,10 @@
select * from alarm
where ai_class is not null
<if test="req.startTime != null ">
and emergency_event_time &gt;= #{req.startTime}
and create_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}
and create_time &lt;= #{req.endTime}
</if>
<if test="req.emergencyEventDesc != null and req.emergencyEventDesc != ''">
and emergency_event_desc like concat('%', #{req.emergencyEventDesc}, '%')

@ -12,6 +12,7 @@
<module>alarm</module>
<module>rescue</module>
<module>page</module>
<module>fire</module>
</modules>
<properties>
<java.version>1.8</java.version>

@ -132,5 +132,21 @@ public class Event implements Serializable {
@ApiModelProperty(value = "110的emergency_event_id")
@TableField(value = "ai_110_id")
private Long ai110Id;
/**
*
*/
@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 = "最后更新时间")
@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;
}

@ -187,10 +187,14 @@ public class AccidentServiceImpl implements AccidentService {
wrapper.eq("event_id", event.getEventId());
Event one = eventService.getOne(wrapper);
if (BeanUtil.isEmpty(one)) {
event.setCreateTime(LocalDateTime.now());
event.setUpdateTime(LocalDateTime.now());
eventService.save(event);
// 调用120和110事件对比接口
linkAlgorithm(event.getEventId());
log.info("======调用120和110事件对比接口======");
} else {
event.setUpdateTime(LocalDateTime.now());
eventService.updateById(event);
}
}

Loading…
Cancel
Save