8 changed files with 71 additions and 115 deletions
-
35APIService/pom.xml
-
1pom.xml
-
11storeroom/pom.xml
-
60storeroom/src/main/java/com/storeroom/modules/storeroom3d/controller/ApiServiceController.java
-
61storeroom/src/main/java/com/storeroom/modules/storeroom3d/controller/TestApiServiceController.java
-
3storeroom/src/main/java/com/storeroom/modules/storeroom3d/service/ThirdApiService.java
-
10storeroom/src/main/java/com/storeroom/modules/storeroom3d/service/impl/ThirdApiServiceImpl.java
-
5system/pom.xml
@ -1,35 +0,0 @@ |
|||
<?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"> |
|||
<parent> |
|||
<artifactId>yxk_StoreroomSystem</artifactId> |
|||
<groupId>com.storeroom</groupId> |
|||
<version>1.0</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>APIService</artifactId> |
|||
<name>第三方接口服务</name> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>17</maven.compiler.source> |
|||
<maven.compiler.target>17</maven.compiler.target> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.storeroom</groupId> |
|||
<artifactId>common</artifactId> |
|||
<version>1.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.ejlchina</groupId> |
|||
<artifactId>okhttps-fastjson</artifactId> |
|||
<version>3.5.2</version> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
|
|||
</project> |
@ -0,0 +1,60 @@ |
|||
package com.storeroom.modules.storeroom3d.controller; |
|||
|
|||
import com.storeroom.annotaion.rest.AnonymousGetMapping; |
|||
import com.storeroom.annotaion.rest.AnonymousPostMapping; |
|||
import com.storeroom.modules.storeroom3d.service.PushService; |
|||
import com.storeroom.modules.storeroom3d.service.ThirdApiService; |
|||
import com.storeroom.utils.ApiResponse; |
|||
import com.storeroom.utils.MacUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.Set; |
|||
|
|||
@RestController |
|||
@RequestMapping("/api/service/") |
|||
@Api(tags = "测试第三方接口") |
|||
@RequiredArgsConstructor |
|||
public class ApiServiceController { |
|||
|
|||
private final ThirdApiService apiService; |
|||
private final PushService pushService; |
|||
|
|||
@ApiOperation("获取库房token") |
|||
@AnonymousGetMapping("token") |
|||
public ApiResponse<Object> getToken() { |
|||
return ApiResponse.success(apiService.getToken()); |
|||
} |
|||
|
|||
@ApiOperation("获取所有设备") |
|||
@AnonymousGetMapping("list") |
|||
public ApiResponse<Object> getAllDevice() { |
|||
return ApiResponse.success(apiService.getDeviceAll()); |
|||
} |
|||
|
|||
@AnonymousGetMapping("ip") |
|||
@ApiOperation("获取内网ip") |
|||
public ApiResponse<Object> getIp() { |
|||
return ApiResponse.success(MacUtil.getIpAddress()); |
|||
} |
|||
|
|||
|
|||
@ApiOperation("获取报警信息") |
|||
@AnonymousGetMapping("getcuralarm") |
|||
public ApiResponse<Object> getInfo() { |
|||
Object objMsg = apiService.getAllDeviceAlarm(); |
|||
pushService.pushMsgToAll(objMsg.toString()); |
|||
return ApiResponse.success(apiService.getAllDeviceAlarm()); |
|||
} |
|||
|
|||
@ApiOperation("获取设备监控参数实时值") |
|||
@AnonymousPostMapping("getrealtimedata") |
|||
public ApiResponse<Object> getrealtimedata(@RequestBody Set<String> deviceIds) { |
|||
|
|||
return ApiResponse.success(apiService.getRealTimeData(deviceIds)); |
|||
} |
|||
} |
@ -1,61 +0,0 @@ |
|||
package com.storeroom.modules.storeroom3d.controller; |
|||
|
|||
|
|||
import com.storeroom.annotaion.rest.AnonymousGetMapping; |
|||
import com.storeroom.annotaion.rest.AnonymousPostMapping; |
|||
import com.storeroom.modules.storeroom3d.service.ApiService; |
|||
import com.storeroom.modules.storeroom3d.service.PushService; |
|||
import com.storeroom.utils.ApiResponse; |
|||
import com.storeroom.utils.MacUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.Set; |
|||
|
|||
@RestController |
|||
@RequestMapping("/api/service/") |
|||
@Api(tags = "测试第三方接口") |
|||
@RequiredArgsConstructor |
|||
public class TestApiServiceController { |
|||
|
|||
private final ApiService apiService; |
|||
private final PushService pushService; |
|||
|
|||
@ApiOperation("获取库房token") |
|||
@AnonymousGetMapping("token") |
|||
public ApiResponse<Object> getToken() { |
|||
return ApiResponse.success(apiService.getToken()); |
|||
} |
|||
|
|||
@ApiOperation("获取所有设备") |
|||
@AnonymousGetMapping("list") |
|||
public ApiResponse<Object> getAllDevice() { |
|||
return ApiResponse.success(apiService.getDeviceAll()); |
|||
} |
|||
|
|||
@AnonymousGetMapping("ip") |
|||
@ApiOperation("获取内网ip") |
|||
public ApiResponse<Object> getIp() { |
|||
return ApiResponse.success(MacUtil.getIpAddress()); |
|||
} |
|||
|
|||
|
|||
@ApiOperation("获取报警信息") |
|||
@AnonymousGetMapping("getcuralarm") |
|||
public ApiResponse<Object> getInfo() { |
|||
Object objMsg = apiService.getAllDeviceAlarm(); |
|||
pushService.pushMsgToAll(objMsg.toString()); |
|||
return ApiResponse.success(apiService.getAllDeviceAlarm()); |
|||
} |
|||
|
|||
@ApiOperation("获取设备监控参数实时值") |
|||
@AnonymousPostMapping("getrealtimedata") |
|||
public ApiResponse<Object> getrealtimedata(@RequestBody Set<String> deviceIds) { |
|||
|
|||
return ApiResponse.success(apiService.getRealTimeData(deviceIds)); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue