feat: 物联平台分支创建及代码整合。
This commit is contained in:
28
intc-api/intc-api-iot/pom.xml
Normal file
28
intc-api/intc-api-iot/pom.xml
Normal file
@@ -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.intc</groupId>
|
||||
<artifactId>intc-api</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>intc-api-iot</artifactId>
|
||||
|
||||
<description>
|
||||
intc-api-iot
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- RuoYi Common Core-->
|
||||
<dependency>
|
||||
<groupId>com.intc</groupId>
|
||||
<artifactId>intc-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.intc.api.iot;
|
||||
|
||||
import com.intc.api.iot.factory.RemoteIotFallbackFactory;
|
||||
import com.intc.common.core.domain.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import com.intc.common.core.constant.ServiceNameConstants;
|
||||
/**
|
||||
* 基础服务
|
||||
*
|
||||
* @author YaphetS
|
||||
*/
|
||||
@FeignClient(contextId = "remoteIotService", value = ServiceNameConstants.IOT_SERVICE, fallbackFactory = RemoteIotFallbackFactory.class)
|
||||
public interface RemoteIotService
|
||||
{
|
||||
/**
|
||||
* 生成模拟数据
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@RequestMapping(value = "/job/generateSimulationData",method = RequestMethod.POST)
|
||||
public R generateSimulationData();
|
||||
|
||||
/**
|
||||
* 生成能耗模拟数据
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@RequestMapping(value = "/job/generateEnergyData",method = RequestMethod.POST)
|
||||
public R generateEnergyData();
|
||||
|
||||
/**
|
||||
* 生成传感器模拟数据
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@RequestMapping(value = "/job/generateSensorData",method = RequestMethod.POST)
|
||||
public R generateSensorData();
|
||||
|
||||
/**
|
||||
* 生成信息屏模拟数据
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@RequestMapping(value = "/job/generateInfoScreenData", method = RequestMethod.POST)
|
||||
public R generateInfoScreenData();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.intc.api.iot.factory;
|
||||
|
||||
import com.intc.common.core.domain.R;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class RemoteIotFallbackFactory implements FallbackFactory<com.intc.api.iot.RemoteIotService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteIotFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public com.intc.api.iot.RemoteIotService create(Throwable throwable)
|
||||
{
|
||||
log.error("照明服务调用失败:{}", throwable.getMessage());
|
||||
return new com.intc.api.iot.RemoteIotService()
|
||||
{
|
||||
|
||||
@Override
|
||||
public R generateSimulationData() {
|
||||
return R.fail("照明服务调用生成模拟数据失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R generateEnergyData() {
|
||||
return R.fail("照明服务调用生成能耗模拟数据失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R generateSensorData() {
|
||||
return R.fail("照明服务调用生成传感器模拟数据失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R generateInfoScreenData() {
|
||||
return R.fail("照明服务调用生成信息屏模拟数据失败");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
com.intc.api.iot.factory.RemoteIotFallbackFactory
|
||||
Reference in New Issue
Block a user