Compare commits
2 Commits
c974008a62
...
2818bafd89
| Author | SHA1 | Date |
|---|---|---|
|
|
2818bafd89 | |
|
|
2731d24c9f |
7
pom.xml
7
pom.xml
|
|
@ -212,6 +212,13 @@
|
|||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 设备接口 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>tuoheng-api-device</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<modules>
|
||||
<module>ruoyi-api-system</module>
|
||||
<module>tuoheng-api-device</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>ruoyi-api</artifactId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-api</artifactId>
|
||||
<version>3.6.7</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>tuoheng-api-device</artifactId>
|
||||
|
||||
<description>
|
||||
tuoheng-api-device设备接口模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- RuoYi Common Core-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.device.api;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.device.api.domain.DeviceTemp;
|
||||
import com.ruoyi.device.api.factory.RemoteDeviceFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备服务
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-01-15
|
||||
*/
|
||||
@FeignClient(contextId = "remoteDeviceService", value = ServiceNameConstants.DEVICE_SERVICE, fallbackFactory = RemoteDeviceFallbackFactory.class)
|
||||
public interface RemoteDeviceService
|
||||
{
|
||||
/**
|
||||
* 根据ID查询设备信息
|
||||
*
|
||||
* @param id 设备ID
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/device/temp/{id}")
|
||||
R<DeviceTemp> getDeviceById(@PathVariable("id") String id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.device.api.domain;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备临时表对象 tuoheng_device_temp
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-01-15
|
||||
*/
|
||||
public class DeviceTemp extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private String id;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "DeviceTemp{" +
|
||||
"id='" + id + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.device.api.factory;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.device.api.RemoteDeviceService;
|
||||
import com.ruoyi.device.api.domain.DeviceTemp;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 设备服务降级处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-01-15
|
||||
*/
|
||||
@Component
|
||||
public class RemoteDeviceFallbackFactory implements FallbackFactory<RemoteDeviceService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteDeviceFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteDeviceService create(Throwable throwable)
|
||||
{
|
||||
log.error("设备服务调用失败:", throwable.getMessage());
|
||||
return new RemoteDeviceService()
|
||||
{
|
||||
@Override
|
||||
public R<DeviceTemp> getDeviceById(String id, String source)
|
||||
{
|
||||
return R.fail("获取设备信息失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -21,4 +21,9 @@ public class ServiceNameConstants
|
|||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "ruoyi-file";
|
||||
|
||||
/**
|
||||
* 设备服务的serviceid
|
||||
*/
|
||||
public static final String DEVICE_SERVICE = "tuoheng-device";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ CREATE TABLE `config_info` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';
|
||||
|
||||
insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_modified, src_user, src_ip, app_name, tenant_id, c_desc, c_use, effect, type, c_schema, encrypted_data_key) values
|
||||
(1,'application-prod.yml','DEFAULT_GROUP','spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n flyway:\n baseline-on-migrate: true\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n min-request-size: 8192\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','9928f41dfb10386ad38b3254af5692e0','2020-05-20 12:00:00','2024-08-29 12:14:45','nacos','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','',''),
|
||||
(1,'application-prod.yml','DEFAULT_GROUP','spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n flyway:\n baseline-on-migrate: true\n baseline-version: 0\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n min-request-size: 8192\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','9928f41dfb10386ad38b3254af5692e0','2020-05-20 12:00:00','2024-08-29 12:14:45','nacos','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','',''),
|
||||
(2,'ruoyi-gateway-prod.yml','DEFAULT_GROUP','spring:\n data:\n redis:\n host: ruoyi-redis\n port: 6379\n password: \n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestBody\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n # 拓恒审批模块\n - id: tuoheng-approval\n uri: lb://tuoheng-approval\n predicates:\n - Path=/approval/**\n filters:\n - StripPrefix=1\n # 拓恒设备模块\n - id: tuoheng-device\n uri: lb://tuoheng-device\n predicates:\n - Path=/device/**\n filters:\n - StripPrefix=1\n # 拓恒航线模块\n - id: tuoheng-airline\n uri: lb://tuoheng-airline\n predicates:\n - Path=/airline/**\n filters:\n - StripPrefix=1\n # 拓恒任务模块\n - id: tuoheng-task\n uri: lb://tuoheng-task\n predicates:\n - Path=/task/**\n filters:\n - StripPrefix=1\n # 拓恒FMS模块\n - id: tuoheng-fms\n uri: lb://tuoheng-fms\n predicates:\n - Path=/fms/**\n filters:\n - StripPrefix=1\n # 拓恒媒体模块\n - id: tuoheng-media\n uri: lb://tuoheng-media\n predicates:\n - Path=/media/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /*/v3/api-docs\n - /csrf\n\n# springdoc配置\nspringdoc:\n webjars:\n # 访问前缀\n prefix:\n','8c27a047f057fc05e5fc223adeb9c685','2020-05-14 14:17:55','2025-01-09 00:00:00','nacos','0:0:0:0:0:0:0:1','','','网关模块','null','null','yaml','',''),
|
||||
(3,'ruoyi-auth-prod.yml','DEFAULT_GROUP','spring:\n data:\n redis:\n host: ruoyi-redis\n port: 6379\n password: \n','72565b1a725e013154ee57c8fd3045c4','2020-11-20 00:00:00','2024-09-14 04:49:42','nacos','0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml','',''),
|
||||
(4,'ruoyi-monitor-prod.yml','DEFAULT_GROUP','# spring\nspring:\n security:\n user:\n name: ruoyi\n password: 123456\n boot:\n admin:\n ui:\n title: 若依服务状态监控\n','6f122fd2bfb8d45f858e7d6529a9cd44','2020-11-20 00:00:00','2024-08-29 12:15:11','nacos','0:0:0:0:0:0:0:1','','','监控中心','null','null','yaml','',''),
|
||||
|
|
|
|||
Loading…
Reference in New Issue