Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王衍超
cloud-fb
Commits
bab46709
Commit
bab46709
authored
2 years ago
by
yanHeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[初始化] wuLink对接
parent
3366cb4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
62 deletions
+46
-62
IotPlatformUtils.java
...in/java/com/beecode/inz/common/util/IotPlatformUtils.java
+11
-6
IotPlatformController.java
...java/com/xyst/dinas/camera/web/IotPlatformController.java
+0
-51
WatershedCameraPlayController.java
.../xyst/dinas/camera/web/WatershedCameraPlayController.java
+33
-3
WsClient.java
...c/main/java/com/xyst/dinas/camera/websocket/WsClient.java
+2
-2
No files found.
backend/inz.common/src/main/java/com/beecode/inz/common/util/IotPlatformUtils.java
View file @
bab46709
...
@@ -76,14 +76,19 @@ public class IotPlatformUtils {
...
@@ -76,14 +76,19 @@ public class IotPlatformUtils {
if
(
StringUtils
.
isEmpty
(
imeis
)){
if
(
StringUtils
.
isEmpty
(
imeis
)){
return
null
;
return
null
;
}
}
String
token
=
""
;
HashMap
<
String
,
Object
>
tokenMap
=
getAuthToken
(
CLIET_ID
,
CLIENT_SECRET
);
String
token
=
null
;
if
((
int
)
tokenMap
.
get
(
"status"
)
==
-
1
||
(
int
)
tokenMap
.
get
(
"status"
)
==
-
2
)
{
try
{
token
=
tokenMap
.
get
(
"data"
).
toString
();
token
=
RedisUtils
.
getInstance
().
get
(
getGpsWuLingTokenRedisKey
(
CLIET_ID
,
CLIENT_SECRET
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
token
==
null
||
""
.
equals
(
token
)){
if
(
token
==
null
||
""
.
equals
(
token
)){
return
null
;
HashMap
<
String
,
Object
>
tokenMap
=
getAuthToken
(
CLIET_ID
,
CLIENT_SECRET
);
if
((
int
)
tokenMap
.
get
(
"status"
)
==
0
)
{
token
=
tokenMap
.
get
(
"data"
).
toString
();
}
}
}
List
<
Map
<
String
,
Object
>>
imeisInfos
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
imeisInfos
=
new
ArrayList
<>();
List
<
String
>
imeisInfoKey
=
new
ArrayList
<>();
List
<
String
>
imeisInfoKey
=
new
ArrayList
<>();
...
@@ -104,7 +109,7 @@ public class IotPlatformUtils {
...
@@ -104,7 +109,7 @@ public class IotPlatformUtils {
int
findCode
=
findStr
.
getInt
(
"code"
);
int
findCode
=
findStr
.
getInt
(
"code"
);
String
id
=
""
;
String
id
=
""
;
if
(
20000
==(
findCode
))
{
if
(
20000
==(
findCode
))
{
id
=
findStr
.
get
JSONObject
(
"data"
).
toString
();
id
=
findStr
.
get
(
"data"
).
toString
();
}
}
if
(
""
.
equals
(
id
)){
if
(
""
.
equals
(
id
)){
return
null
;
return
null
;
...
...
This diff is collapsed.
Click to expand it.
backend/xyst.dinas.camera/src/main/java/com/xyst/dinas/camera/web/IotPlatformController.java
deleted
100644 → 0
View file @
3366cb4d
package
com
.
xyst
.
dinas
.
camera
.
web
;
import
com.beecode.inz.basis.team.pojo.ResponseObj
;
import
com.beecode.inz.common.util.IotPlatformUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
/**
* Description:对接IOT平台controller
* @param
* @author yanHeng
* @version 1.0
* @date: 2021/7/15 9:37
*/
@RestController
@RequestMapping
(
"/iotplatform"
)
public
class
IotPlatformController
{
//获取token必填参数 如下三个
private
static
final
String
GRANT_TYPE
=
"client_credentials"
;
private
static
final
String
CLIET_ID
=
"jt808"
;
private
static
final
String
CLIENT_SECRET
=
"f04dd1e4"
;
@Autowired
private
IotPlatformUtils
iotPlatformUtils
;
/**Description:从IOT平台获取access_token
* @Author yanHeng
* @Date 2022/4/24 18:25
* @Param []
* @return com.beecode.inz.basis.team.pojo.ResponseObj
**/
@GetMapping
(
"/getAccessToken"
)
public
ResponseObj
getAccessToken
()
throws
Exception
{
HashMap
<
String
,
Object
>
tokenMap
=
IotPlatformUtils
.
getAuthToken
(
CLIET_ID
,
CLIENT_SECRET
);
if
((
int
)
tokenMap
.
get
(
"status"
)
==
-
1
||
(
int
)
tokenMap
.
get
(
"status"
)
==
-
2
)
{
return
ResponseObj
.
success
(
"获取失败"
,
tokenMap
.
get
(
"message"
).
toString
());
}
else
{
String
token
=
tokenMap
.
get
(
"data"
).
toString
();
return
ResponseObj
.
success
(
"获取成功"
,
token
);
}
}
}
This diff is collapsed.
Click to expand it.
backend/xyst.dinas.camera/src/main/java/com/xyst/dinas/camera/web/WatershedCameraPlayController.java
View file @
bab46709
...
@@ -3,16 +3,22 @@ package com.xyst.dinas.camera.web;
...
@@ -3,16 +3,22 @@ package com.xyst.dinas.camera.web;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.inz.basis.team.pojo.ResponseObj
;
import
com.beecode.inz.basis.team.pojo.ResponseObj
;
import
com.beecode.inz.common.util.IotPlatformUtils
;
import
com.xyst.dinas.biz.service.SandMiningAreaService
;
import
com.xyst.dinas.biz.service.SandMiningAreaService
;
import
com.xyst.dinas.biz.service.ShipInfoService
;
import
com.xyst.dinas.biz.service.ShipInfoService
;
import
com.xyst.dinas.camera.entity.RegionalCompanyWatershedCameraTree
;
import
com.xyst.dinas.camera.entity.RegionalCompanyWatershedCameraTree
;
import
com.xyst.dinas.camera.service.CameraInfoService
;
import
com.xyst.dinas.camera.service.CameraInfoService
;
import
com.xyst.dinas.production.service.SandMiningService
;
import
com.xyst.dinas.production.service.SandMiningService
;
import
org.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
/**
/**
* @author scol
* @author scol
...
@@ -32,6 +38,12 @@ public class WatershedCameraPlayController {
...
@@ -32,6 +38,12 @@ public class WatershedCameraPlayController {
@Autowired
@Autowired
private
SandMiningService
sandMiningService
;
private
SandMiningService
sandMiningService
;
//获取token必填参数 如下三个
private
static
final
String
GRANT_TYPE
=
"client_credentials"
;
private
static
final
String
CLIET_ID
=
"jt808"
;
private
static
final
String
CLIENT_SECRET
=
"f04dd1e4"
;
/**
/**
* 获取摄像头树列表
* 获取摄像头树列表
* @param uuidList
* @param uuidList
...
@@ -77,5 +89,23 @@ public class WatershedCameraPlayController {
...
@@ -77,5 +89,23 @@ public class WatershedCameraPlayController {
}
}
/**Description:从IOT平台获取access_token
* @Author yanHeng
* @Date 2022/4/24 18:25
* @Param []
* @return com.beecode.inz.basis.team.pojo.ResponseObj
**/
@GetMapping
(
"/getAccessToken"
)
public
ResponseObj
getAccessToken
()
throws
Exception
{
HashMap
<
String
,
Object
>
tokenMap
=
IotPlatformUtils
.
getAuthToken
(
CLIET_ID
,
CLIENT_SECRET
);
if
((
int
)
tokenMap
.
get
(
"status"
)
==
-
1
||
(
int
)
tokenMap
.
get
(
"status"
)
==
-
2
)
{
return
ResponseObj
.
success
(
"获取失败"
,
tokenMap
.
get
(
"message"
).
toString
());
}
else
{
String
token
=
tokenMap
.
get
(
"data"
).
toString
();
return
ResponseObj
.
success
(
"获取成功"
,
token
);
}
}
}
}
This diff is collapsed.
Click to expand it.
backend/xyst.dinas.camera/src/main/java/com/xyst/dinas/camera/websocket/WsClient.java
View file @
bab46709
...
@@ -2,7 +2,7 @@ package com.xyst.dinas.camera.websocket;
...
@@ -2,7 +2,7 @@ package com.xyst.dinas.camera.websocket;
import
com.beecode.amino.core.Amino
;
import
com.beecode.amino.core.Amino
;
import
com.xyst.dinas.camera.web.
IotPlatform
Controller
;
import
com.xyst.dinas.camera.web.
WatershedCameraPlay
Controller
;
import
org.java_websocket.client.WebSocketClient
;
import
org.java_websocket.client.WebSocketClient
;
import
org.java_websocket.handshake.ServerHandshake
;
import
org.java_websocket.handshake.ServerHandshake
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -33,7 +33,7 @@ public class WsClient extends WebSocketClient {
...
@@ -33,7 +33,7 @@ public class WsClient extends WebSocketClient {
static
{
static
{
try
{
try
{
IotPlatformController
iotPlatformController
=
Amino
.
getApplicationContext
().
getBean
(
IotPlatform
Controller
.
class
);
WatershedCameraPlayController
iotPlatformController
=
Amino
.
getApplicationContext
().
getBean
(
WatershedCameraPlay
Controller
.
class
);
String
accessToken
=
(
String
)
iotPlatformController
.
getAccessToken
().
getData
();
String
accessToken
=
(
String
)
iotPlatformController
.
getAccessToken
().
getData
();
// EquipmentController equipmentController = Amino.getApplicationContext().getBean(EquipmentController.class);
// EquipmentController equipmentController = Amino.getApplicationContext().getBean(EquipmentController.class);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment