diff --git a/pom.xml b/pom.xml
index 2ac5b32..8c7c6b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,12 +30,17 @@
4.1.2
2.3
0.9.1
+ 3.5.3.1
-
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ ${mybatis-plus.version}
+
org.springframework.boot
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 8ce9868..6bd3119 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -25,7 +25,13 @@
com.baomidou
mybatis-plus-boot-starter
- 3.5.3.1
+
+
+
+
+ cn.hutool
+ hutool-all
+ 5.8.23
@@ -39,7 +45,7 @@
-
+
mysql
mysql-connector-java
@@ -86,15 +92,15 @@
-
- org.apache.maven.plugins
- maven-war-plugin
- 3.1.0
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.1.0
false
${project.artifactId}
-
-
+
+
${project.artifactId}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/EventsController.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/EventsController.java
new file mode 100644
index 0000000..762081f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/EventsController.java
@@ -0,0 +1,106 @@
+package com.ruoyi.pt.controller;
+
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.pt.domain.Events;
+import com.ruoyi.pt.service.EventsService;
+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;
+
+/**
+ * 事件集合表(Events)表控制层
+ *
+ * @author wu
+ * @since 2023-12-15 23:19:46
+ */
+@RestController
+@RequestMapping("remoteCall/events")
+@Api(tags = "事件集合表")
+@Transactional(rollbackFor = Exception.class)
+public class EventsController extends BaseController {
+ /**
+ * 服务对象
+ */
+ @Resource
+ private EventsService eventsService;
+
+ /**
+ * 分页条件查询所有数据
+ *
+ * @param page 分页条件
+ * @param events 查询条件
+ * @return 所有数据
+ */
+ @GetMapping
+ @ApiOperation(value = "分页条件查询事件集合表", response = Events.class)
+ public AjaxResult page(Page page, Events events) {
+ return success(eventsService.page(page, new QueryWrapper<>(events)));
+ }
+
+ /**
+ * 通过主键查询单条数据
+ *
+ * @param id 主键
+ * @return 单条数据
+ */
+ @GetMapping("{id}")
+ @ApiOperation(value = "通过主键查询单条事件集合表", response = Events.class)
+ public AjaxResult getById(@PathVariable Serializable id) {
+ return success(eventsService.getById(id));
+ }
+
+ /**
+ * 新增数据
+ *
+ * @param events 实体对象
+ * @return 新增结果
+ */
+ @PostMapping
+ @ApiOperation(value = "新增事件集合表", response = Events.class)
+ public AjaxResult insert(@RequestBody Events events) {
+ return success(eventsService.save(events));
+ }
+
+ /**
+ * 修改数据
+ *
+ * @param events 实体对象
+ * @return 修改结果
+ */
+ @PutMapping
+ @ApiOperation(value = "修改事件集合表")
+ public AjaxResult update(@RequestBody Events events) {
+ return success(eventsService.updateById(events));
+ }
+
+ /**
+ * 删除数据
+ *
+ * @param idList 主键集合
+ * @return 删除结果
+ */
+ @DeleteMapping
+ @ApiOperation(value = "删除事件集合表")
+ public AjaxResult delete(@RequestParam("idList") List idList) {
+ return success(eventsService.removeByIds(idList));
+ }
+}
+
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/RemoteCallsController.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/RemoteCallsController.java
new file mode 100644
index 0000000..89ec29d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/RemoteCallsController.java
@@ -0,0 +1,54 @@
+package com.ruoyi.pt.controller;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.pt.service.RemoteCallsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 远程推送算法平台数据
+ *
+ * @author wu
+ * @since 2023/12/15 13:41
+ */
+@Api(tags = "远程推送算法平台数据⼊")
+@RestController
+@RequestMapping("/remoteCall")
+public class RemoteCallsController extends BaseController {
+
+ @Resource
+ private RemoteCallsService remoteCallsService;
+
+ /**
+ * 获取公共accessToken
+ *
+ * @return 响应类
+ */
+ @ApiOperation(value = "获取公共accessToken")
+ @GetMapping("/getAccessToken")
+ public AjaxResult getAccessToken() {
+
+ return success(remoteCallsService.getAccessToken());
+ }
+
+ /**
+ * 事件进度推送接口
+ *
+ * @return 响应类
+ */
+ @ApiOperation(value = "事件进度推送接口")
+ @PostMapping("/imports")
+ public AjaxResult imports() {
+ remoteCallsService.imports();
+ return success();
+ }
+
+
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/Events.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/Events.java
new file mode 100644
index 0000000..71d28ea
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/Events.java
@@ -0,0 +1,102 @@
+package com.ruoyi.pt.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+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.util.Date;
+
+
+/**
+ * 事件集合表(Events)表实体类
+ *
+ * @author wu
+ * @since 2023-12-15 22:58:42
+ */
+@Data
+@ApiModel("事件集合表实体类")
+@TableName(value = "Events")
+public class Events implements Serializable {
+
+ private static final long serialVersionUID = -80395930488019068L;
+
+ /**
+ * 事件集合编号(主键)
+ */
+ @ApiModelProperty(value = "事件集合编号(主键)")
+ @TableField(value = "innerEventId")
+ private String innerEventId;
+
+ /**
+ * 事件消息标题
+ */
+ @ApiModelProperty(value = "事件消息标题")
+ private String title;
+
+ /**
+ * 事件类型编码
+ */
+ @ApiModelProperty(value = "事件类型编码")
+ @TableField(value = "msgType")
+ private String msgType;
+
+ /**
+ * 事件类型名称
+ */
+ @ApiModelProperty(value = "事件类型名称")
+ @TableField(value = "msgTypeName")
+ private String msgTypeName;
+
+ /**
+ * 案件类型编码
+ */
+ @ApiModelProperty(value = "案件类型编码")
+ @TableField(value = "scenceType")
+ private Integer scenceType;
+
+ /**
+ * 案件类型名称
+ */
+ @ApiModelProperty(value = "案件类型名称")
+ @TableField(value = "scenceTypeName")
+ private String scenceTypename;
+
+ /**
+ * 第一次预警时间
+ */
+ @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")
+ @TableField(value = "firstWarnTime")
+ private Date firstWarnTimeDate;
+
+ /**
+ * 事件发生时间
+ */
+ @ApiModelProperty(value = "事件发生时间")
+ @TableField(value = "eventTime")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date eventTimeDate;
+
+ /**
+ * 预警因素
+ */
+ @ApiModelProperty(value = "预警因素")
+ @TableField(value = "warnFactor")
+ private String warnFactor;
+
+ /**
+ * 预警关联的事件单号
+ */
+ @ApiModelProperty(value = "预警关联的事件单号")
+ @TableField(value = "relationNums")
+ private String relationNums;
+
+}
+
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/dto/RemoteCallsDTO.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/dto/RemoteCallsDTO.java
new file mode 100644
index 0000000..a7d5c5d
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/dto/RemoteCallsDTO.java
@@ -0,0 +1,118 @@
+package com.ruoyi.pt.domain.dto;
+
+import cn.hutool.core.annotation.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 远程调用事件推送接口请求类
+ *
+ * @author wu
+ * @since 2023/12/15 16:35
+ */
+@Data
+public class RemoteCallsDTO implements Serializable {
+
+ /**
+ * 事件提供方的对事件的唯一标识
+ */
+ private String innerEventId;
+
+ /**
+ * 事件消息所属区域15位编码
+ * 固定值:320505000000000
+ */
+ private String areaCode = "320505000000000";
+
+ /**
+ * 件消息所属场景编码:该场
+ * 景编码由各提供⽅向指挥中
+ * ⼼平台申请 固定值: sjsffx
+ */
+ private String scence = "sjsffx";
+
+ /**
+ * 事件消息标题
+ */
+ private String title;
+
+ /**
+ * 事件消息内容描述
+ */
+ @Alias("title")
+ private String content;
+
+ /**
+ * 事件发⽣时间,格式为:yyyy-MM-dd HH:mm:ss
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date eventTimeDate;
+
+ private String eventTime;
+
+ private String firstWarnTime;
+
+ /**
+ * 事件类型编码
+ */
+ private String msgType;
+
+ /**
+ * 事件类型名称
+ */
+ private String msgTypeName;
+
+ /**
+ * 事件执⾏类型 1:流转 2:
+ * 展示 3:提级
+ * 【暂时默认都传展示】
+ */
+ private Integer executeType = 2;
+
+ /**
+ * 事件是否超时: 【超期办
+ * 结】传【1】
+ * 其他传【0】
+ */
+ private Integer remindStatus = 0;
+
+ /**
+ * 1、⼀般2、提级3、疑难4、
+ * 多跨5、逾期6、推诿7、督
+ * 办,多个逗号分隔
+ * 默认为⼀般
+ */
+ private String eventLabel = "1";
+
+ /**
+ * 案件类型编码
+ */
+ private String scenceType;
+
+ /**
+ * 案件类型名称
+ */
+ private String scenceTypename;
+
+ /**
+ * 预警关联的事件单号(案件单号)
+ */
+ private String relationNums;
+
+ /**
+ * 预警因素
+ */
+ private String warnFactor;
+
+ /**
+ * 第⼀次预警时间 格式为:yyyy-MM-dd HH:mm:ss
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date firstWarnTimeDate;
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/response/RemoteCallsAccessTokenResponse.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/response/RemoteCallsAccessTokenResponse.java
new file mode 100644
index 0000000..e0f1ca0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/response/RemoteCallsAccessTokenResponse.java
@@ -0,0 +1,26 @@
+package com.ruoyi.pt.domain.response;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 远程调用接口响应类
+ *
+ * @author wu
+ * @since 2023/12/15 23:49
+ */
+@Data
+public class RemoteCallsAccessTokenResponse implements Serializable {
+
+
+ private String accessToken;
+
+ private String tokenType;
+
+ private Integer expiresIn;
+
+ private String scope;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/response/RemoteCallsResponse.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/response/RemoteCallsResponse.java
new file mode 100644
index 0000000..6c650f0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/domain/response/RemoteCallsResponse.java
@@ -0,0 +1,27 @@
+package com.ruoyi.pt.domain.response;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 远程调用接口响应类
+ *
+ * @author wu
+ * @since 2023/12/15 23:49
+ */
+@Data
+public class RemoteCallsResponse implements Serializable {
+
+ private Boolean success;
+
+ private String errorCode;
+
+ private String errorMsg;
+
+ private RemoteCallsAccessTokenResponse data;
+
+ private String requestId;
+
+
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/mapper/EventsMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/mapper/EventsMapper.java
new file mode 100644
index 0000000..853b0ba
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/mapper/EventsMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.pt.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.pt.domain.Events;
+
+/**
+ * 事件集合表(Events)表数据库访问层
+ *
+ * @author wu
+ * @since 2023-12-15 22:58:42
+ */
+public interface EventsMapper extends BaseMapper {
+
+}
+
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/EventsService.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/EventsService.java
new file mode 100644
index 0000000..d216af0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/EventsService.java
@@ -0,0 +1,15 @@
+package com.ruoyi.pt.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.pt.domain.Events;
+
+/**
+ * 事件集合表(Events)表服务接口
+ *
+ * @author wu
+ * @since 2023-12-15 22:58:42
+ */
+public interface EventsService extends IService {
+
+}
+
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/RemoteCallsService.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/RemoteCallsService.java
new file mode 100644
index 0000000..1dc960e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/RemoteCallsService.java
@@ -0,0 +1,22 @@
+package com.ruoyi.pt.service;
+
+/**
+ * 远程调用服务层
+ *
+ * @author wu
+ * @since 2023/12/15 16:02
+ */
+public interface RemoteCallsService {
+
+ /**
+ * 获取公共accessToken
+ *
+ * @return accessToken
+ */
+ String getAccessToken();
+
+ /**
+ * 事件进度推送接口
+ */
+ void imports();
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/EventsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/EventsServiceImpl.java
new file mode 100644
index 0000000..38f586a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/EventsServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.pt.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.pt.mapper.EventsMapper;
+import com.ruoyi.pt.domain.Events;
+import com.ruoyi.pt.service.EventsService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 事件集合表(Events)表服务实现类
+ *
+ * @author wu
+ * @since 2023-12-15 22:58:42
+ */
+@Service("eventsService")
+public class EventsServiceImpl extends ServiceImpl implements EventsService {
+
+}
+
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java
new file mode 100644
index 0000000..cbe1505
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java
@@ -0,0 +1,119 @@
+package com.ruoyi.pt.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.pt.domain.Events;
+import com.ruoyi.pt.domain.dto.RemoteCallsDTO;
+import com.ruoyi.pt.domain.response.RemoteCallsResponse;
+import com.ruoyi.pt.service.EventsService;
+import com.ruoyi.pt.service.RemoteCallsService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author wu
+ * @since 2023/12/15 16:03
+ */
+@Service(value = "RemoteCallsService")
+public class RemoteCallsServiceImpl implements RemoteCallsService {
+
+ public static final Logger log = LoggerFactory.getLogger(RemoteCallsServiceImpl.class);
+
+ @Value("${remote.url}")
+ private String url;
+
+ @Value("${remote.appKey}")
+ private String appKey;
+
+ @Value("${remote.appSecret}")
+ private String appSecret;
+
+ @Value("${remote.grantType}")
+ private String grantType;
+
+ @Resource
+ private EventsService eventsService;
+
+ /**
+ * 获取填充信息后的map
+ *
+ * @return 填充信息后的map
+ */
+ private Map getMapValue() {
+ Map map = new HashMap<>();
+ map.put("appKey", appKey);
+ map.put("appSecret", appSecret);
+ map.put("grantType", grantType);
+ return map;
+ }
+
+
+ /**
+ * 获取公共accessToken
+ *
+ * @return accessToken
+ */
+ @Override
+ public String getAccessToken() {
+ Map form = getMapValue();
+ String body = HttpRequest.post(url + "/auth/oauth/token").form(form).execute().body();
+ RemoteCallsResponse res = JSONUtil.toBean(body, RemoteCallsResponse.class);
+ log.info(body);
+ return res.getData().getAccessToken();
+ }
+
+ /**
+ * 事件进度推送接口
+ */
+ @Override
+ public void imports() {
+// String accessToken = this.getAccessToken();
+ // 初始化MyBatis-Plus的分页对象 查询第1页,每页100条
+ Page page = new Page<>(1, 100);
+ // 创建查询条件
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ // 创建SimpleDateFormat对象,指定日期格式为yyyy-MM-dd HH:mm:ss
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ // 循环获取所有数据
+ while (true) {
+ IPage dataPage = eventsService.page(page, queryWrapper);
+ List data = dataPage.getRecords();
+ List dtos = BeanUtil.copyToList(data, RemoteCallsDTO.class);
+ dtos.forEach(x -> {
+ x.setContent(x.getTitle());
+ // 使用SimpleDateFormat对象将Date对象格式化为字符串
+ String firstWarnTime = sdf.format(x.getFirstWarnTimeDate());
+ String eventTime = sdf.format(x.getEventTimeDate());
+ x.setContent(x.getTitle());
+ x.setFirstWarnTime(firstWarnTime);
+ x.setEventTime(eventTime);
+ });
+ String jsonStr = JSONUtil.toJsonStr(dtos);
+ String body = HttpRequest.post(url + "/gateway/event/event/eventProgress/imports")
+// .header("Authorization", "Bearer " + accessToken)
+ .body(jsonStr)
+ .execute().body();
+ log.info(body);
+ // 判断是否还有下一页
+ if (dataPage.getPages() > dataPage.getCurrent()) {
+ // 设置下一页的页码
+ page.setCurrent(page.getCurrent() + 1);
+ } else {
+ break; // 已经获取完所有数据,结束循环
+ }
+ }
+
+ }
+}
diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml
new file mode 100644
index 0000000..71481fc
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/application-prod.yml
@@ -0,0 +1,65 @@
+# 数据源配置
+spring:
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ druid:
+ # 主库数据源
+ master:
+ url: jdbc:mysql://localhost:3306/public_platform?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+ username: root
+ password: 123456
+ # 从库数据源
+ slave:
+ # 从数据源开关/默认关闭
+ enabled: false
+ url:
+ username:
+ password:
+ # 初始连接数
+ initialSize: 5
+ # 最小连接池数量
+ minIdle: 10
+ # 最大连接池数量
+ maxActive: 20
+ # 配置获取连接等待超时的时间
+ maxWait: 60000
+ # 配置连接超时时间
+ connectTimeout: 30000
+ # 配置网络超时时间
+ socketTimeout: 60000
+ # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+ timeBetweenEvictionRunsMillis: 60000
+ # 配置一个连接在池中最小生存的时间,单位是毫秒
+ minEvictableIdleTimeMillis: 300000
+ # 配置一个连接在池中最大生存的时间,单位是毫秒
+ maxEvictableIdleTimeMillis: 900000
+ # 配置检测连接是否有效
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ webStatFilter:
+ enabled: true
+ statViewServlet:
+ enabled: true
+ # 设置白名单,不填则允许所有访问
+ allow:
+ url-pattern: /druid/*
+ # 控制台管理用户名和密码
+ login-username: ruoyi
+ login-password: 123456
+ filter:
+ stat:
+ enabled: true
+ # 慢SQL记录
+ log-slow-sql: true
+ slow-sql-millis: 1000
+ merge-sql: true
+ wall:
+ config:
+ multi-statement-allow: true
+# 开发环境配置
+server:
+ # 服务器的HTTP端口,默认为8080
+ port: 9002
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-test.yml
similarity index 94%
rename from ruoyi-admin/src/main/resources/application-druid.yml
rename to ruoyi-admin/src/main/resources/application-test.yml
index 180e295..172a950 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-test.yml
@@ -58,4 +58,8 @@ spring:
merge-sql: true
wall:
config:
- multi-statement-allow: true
\ No newline at end of file
+ multi-statement-allow: true
+# 开发环境配置
+server:
+ # 服务器的HTTP端口,默认为8080
+ port: 9102
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index c5e0ea9..10b6dc3 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -17,8 +17,6 @@ ruoyi:
# 开发环境配置
server:
- # 服务器的HTTP端口,默认为8080
- port: 9102
servlet:
# 应用的访问路径
context-path: /api
@@ -54,7 +52,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
- active: druid
+ active: prod
# 文件上传
servlet:
multipart:
@@ -128,3 +126,9 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
+
+remote:
+ url: http://4.15.24.101:10443
+ appKey: 7ae6c089a348b3565af38313f5610968
+ appSecret: 633e549c5b382cb8da14e36d9eeca3bc
+ grantType: client_credentials
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
index 0080343..8e85034 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
@@ -2,16 +2,20 @@ package com.ruoyi.common.constant;
/**
* 缓存的key 常量
- *
+ *
* @author ruoyi
*/
-public class CacheConstants
-{
+public class CacheConstants {
/**
* 登录用户 redis key
*/
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
+ /**
+ * 远程调用 redis key
+ */
+ public static final String REMOTE_TOKEN_KEY = "remote_token:";
+
/**
* 验证码 redis key
*/
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
index 44e80d8..f7c56a5 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
@@ -1,11 +1,5 @@
package com.ruoyi.common.core.redis;
-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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
@@ -13,64 +7,66 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
+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 ruoyi
**/
-@SuppressWarnings(value = { "unchecked", "rawtypes" })
+@SuppressWarnings(value = {"unchecked", "rawtypes"})
@Component
-public class RedisCache
-{
+public class RedisCache {
@Autowired
public RedisTemplate redisTemplate;
/**
* 缓存基本的对象,Integer、String、实体类等
*
- * @param key 缓存的键值
+ * @param key 缓存的键值
* @param value 缓存的值
*/
- public void setCacheObject(final String key, final T value)
- {
+ public void setCacheObject(final String key, final T value) {
redisTemplate.opsForValue().set(key, value);
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
- * @param key 缓存的键值
- * @param value 缓存的值
- * @param timeout 时间
+ * @param key 缓存的键值
+ * @param value 缓存的值
+ * @param timeout 时间
* @param timeUnit 时间颗粒度
*/
- public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
- {
+ public 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 key Redis键
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
*/
- public boolean expire(final String key, final long timeout)
- {
+ public boolean expire(final String key, final long timeout) {
return expire(key, timeout, TimeUnit.SECONDS);
}
/**
* 设置有效时间
*
- * @param key Redis键
+ * @param key Redis键
* @param timeout 超时时间
- * @param unit 时间单位
+ * @param unit 时间单位
* @return true=设置成功;false=设置失败
*/
- public boolean expire(final String key, final long timeout, final TimeUnit unit)
- {
+ public boolean expire(final String key, final long timeout, final TimeUnit unit) {
return redisTemplate.expire(key, timeout, unit);
}
@@ -80,8 +76,7 @@ public class RedisCache
* @param key Redis键
* @return 有效时间
*/
- public long getExpire(final String key)
- {
+ public long getExpire(final String key) {
return redisTemplate.getExpire(key);
}
@@ -91,8 +86,7 @@ public class RedisCache
* @param key 键
* @return true 存在 false不存在
*/
- public Boolean hasKey(String key)
- {
+ public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
@@ -102,8 +96,7 @@ public class RedisCache
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
- public T getCacheObject(final String key)
- {
+ public T getCacheObject(final String key) {
ValueOperations operation = redisTemplate.opsForValue();
return operation.get(key);
}
@@ -113,8 +106,7 @@ public class RedisCache
*
* @param key
*/
- public boolean deleteObject(final String key)
- {
+ public boolean deleteObject(final String key) {
return redisTemplate.delete(key);
}
@@ -124,20 +116,18 @@ public class RedisCache
* @param collection 多个对象
* @return
*/
- public boolean deleteObject(final Collection collection)
- {
+ public boolean deleteObject(final Collection collection) {
return redisTemplate.delete(collection) > 0;
}
/**
* 缓存List数据
*
- * @param key 缓存的键值
+ * @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
- public long setCacheList(final String key, final List dataList)
- {
+ public long setCacheList(final String key, final List dataList) {
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
@@ -148,24 +138,21 @@ public class RedisCache
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
- public List getCacheList(final String key)
- {
+ public List getCacheList(final String key) {
return redisTemplate.opsForList().range(key, 0, -1);
}
/**
* 缓存Set
*
- * @param key 缓存键值
+ * @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
- public BoundSetOperations setCacheSet(final String key, final Set dataSet)
- {
+ public BoundSetOperations setCacheSet(final String key, final Set dataSet) {
BoundSetOperations setOperation = redisTemplate.boundSetOps(key);
Iterator it = dataSet.iterator();
- while (it.hasNext())
- {
+ while (it.hasNext()) {
setOperation.add(it.next());
}
return setOperation;
@@ -177,8 +164,7 @@ public class RedisCache
* @param key
* @return
*/
- public Set getCacheSet(final String key)
- {
+ public Set getCacheSet(final String key) {
return redisTemplate.opsForSet().members(key);
}
@@ -188,8 +174,7 @@ public class RedisCache
* @param key
* @param dataMap
*/
- public void setCacheMap(final String key, final Map dataMap)
- {
+ public void setCacheMap(final String key, final Map dataMap) {
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
@@ -201,32 +186,29 @@ public class RedisCache
* @param key
* @return
*/
- public Map getCacheMap(final String key)
- {
+ public Map getCacheMap(final String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* 往Hash中存入数据
*
- * @param key Redis键
- * @param hKey Hash键
+ * @param key Redis键
+ * @param hKey Hash键
* @param value 值
*/
- public void setCacheMapValue(final String key, final String hKey, final T value)
- {
+ public void setCacheMapValue(final String key, final String hKey, final T value) {
redisTemplate.opsForHash().put(key, hKey, value);
}
/**
* 获取Hash中的数据
*
- * @param key Redis键
+ * @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
- public T getCacheMapValue(final String key, final String hKey)
- {
+ public T getCacheMapValue(final String key, final String hKey) {
HashOperations opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
@@ -234,24 +216,22 @@ public class RedisCache
/**
* 获取多个Hash中的数据
*
- * @param key Redis键
+ * @param key Redis键
* @param hKeys Hash键集合
* @return Hash对象集合
*/
- public List getMultiCacheMapValue(final String key, final Collection