Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
fc6d7ea5
Commit
fc6d7ea5
authored
Jan 13, 2022
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
d7b0565f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
153 additions
and
42 deletions
+153
-42
IotIndexResVo.java
...java/com/yeejoin/equipmanage/common/vo/IotIndexResVo.java
+35
-0
IotTrendDataVO.java
...ava/com/yeejoin/equipmanage/common/vo/IotTrendDataVO.java
+19
-0
TopographyIotIndexTrendVo.java
...join/equipmanage/common/vo/TopographyIotIndexTrendVo.java
+2
-0
TopographyController.java
.../yeejoin/equipmanage/controller/TopographyController.java
+70
-42
IotFeign.java
...src/main/java/com/yeejoin/equipmanage/fegin/IotFeign.java
+27
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/vo/IotIndexResVo.java
0 → 100644
View file @
fc6d7ea5
package
com
.
yeejoin
.
equipmanage
.
common
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author keyong
* @title: TopographyAlarmVo
* <pre>
* @description: TODO
* </pre>
* @date 2022/01/12 18:57
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
IotIndexResVo
{
private
Long
id
;
private
String
name
;
private
String
nameKey
;
private
String
unit
;
private
List
<
Date
>
times
;
private
List
<
IotDataVO
>
iotData
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/vo/IotTrendDataVO.java
0 → 100644
View file @
fc6d7ea5
package
com
.
yeejoin
.
equipmanage
.
common
.
vo
;
import
lombok.Data
;
/**
* @author keyong
* @title: IotDataVO
* <pre>
* @description: 物联系统发送的增量数据封装VO
* </pre>
* @date 2021/1/7 17:44
*/
@Data
public
class
IotTrendDataVO
{
private
String
key
;
private
Object
value
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/vo/TopographyIotIndexTrendVo.java
View file @
fc6d7ea5
...
...
@@ -29,6 +29,8 @@ public class TopographyIotIndexTrendVo {
private
String
unit
;
private
List
<
Date
>
times
;
private
IotDataVO
iotData
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/TopographyController.java
View file @
fc6d7ea5
...
...
@@ -15,6 +15,7 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
import
com.yeejoin.equipmanage.common.enums.TopoNodeTypeEnum
;
import
com.yeejoin.equipmanage.common.utils.*
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.fegin.IotFeign
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.impl.TopographyNodeDetailService
;
...
...
@@ -22,6 +23,7 @@ import com.yeejoin.equipmanage.service.impl.TopographyService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
liquibase.pro.packaged.S
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -36,6 +38,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
...
...
@@ -91,6 +95,8 @@ public class TopographyController extends AbstractBaseController {
EquipmentSpecificIndexMapper
equipmentSpecificIndexMapper
;
@Autowired
IEquipmentService
iEquipmentService
;
@Autowired
IotFeign
iotFeign
;
@Value
(
"${iot.vehicle.track}"
)
private
String
iotServerName
;
...
...
@@ -807,16 +813,16 @@ public class TopographyController extends AbstractBaseController {
/***
*
* 根拓补节点id查询当前节点物联
数据记录
* 根拓补节点id查询当前节点物联
指标趋势
*
* **/
@RequestMapping
(
value
=
"/equipment/tren"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据节点id查询当前节点物联
数据记录"
,
notes
=
"根据节点id查询当前节点物联数据记录
"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据节点id查询当前节点物联
指标趋势"
,
notes
=
"根据节点id查询当前节点物联指标趋势
"
)
public
ResponseModel
getEquipmentIndexTrendInfo
(
@RequestParam
(
required
=
false
)
String
id
,
@RequestParam
(
required
=
false
)
String
equipSpeId
,
@RequestParam
(
required
=
false
)
String
beginDate
,
@RequestParam
(
required
=
false
)
String
endDate
)
{
@RequestParam
(
required
=
false
)
String
endDate
)
throws
ParseException
{
String
eqpId
;
if
(
StringUtil
.
isNotEmpty
(
equipSpeId
))
{
eqpId
=
equipSpeId
;
...
...
@@ -845,53 +851,75 @@ public class TopographyController extends AbstractBaseController {
headers
.
set
(
"product"
,
getProduct
());
headers
.
set
(
"token"
,
getToken
());
headers
.
set
(
"appKey"
,
getAppKey
());
HttpEntity
httpEntity
=
new
HttpEntity
<>(
lonAndLatEntityVo
,
headers
);
ResponseEntity
<
FeignClientResult
>
feignClientResult
=
null
;
ResponseModel
entity
=
null
;
try
{
feignClientResult
=
restTemplate
.
exchange
(
"http://"
+
url
+
"/iot/v1/livedata/list?timeStart="
+
beginDate
+
"&timeEnd="
+
endDate
+
"&productKey="
+
prefix
+
"&deviceName="
+
suffix
,
HttpMethod
.
GET
,
httpEntity
,
FeignClientResult
.
class
);
entity
=
iotFeign
.
selectList
(
getAppKey
(),
getProduct
(),
getToken
(),
beginDate
,
endDate
,
prefix
,
suffix
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
null
!=
feignClientResult
&&
feignClientResult
.
getBody
().
getStatus
()
==
200
)
{
if
(
null
!=
feignClientResult
.
getBody
().
getResult
())
{
String
json
=
JSON
.
toJSONString
(
feignClientResult
.
getBody
().
getResult
());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
json
);
Iterator
it
=
jsonObject
.
entrySet
().
iterator
();
List
<
IotDataVO
>
iotDatalist
=
new
ArrayList
<
IotDataVO
>();
while
(
it
.
hasNext
())
{
IotDataVO
iotDataVO
=
new
IotDataVO
();
Map
.
Entry
<
String
,
Object
>
entry
=
(
Map
.
Entry
<
String
,
Object
>)
it
.
next
();
if
(!
"name"
.
equals
(
entry
.
getKey
())
||
!
"deviceName"
.
equals
(
entry
.
getKey
())
||
!
"time"
.
equals
(
entry
.
getKey
()))
{
iotDataVO
.
setKey
(
entry
.
getKey
());
iotDataVO
.
setValue
(
entry
.
getValue
());
if
(
200
==
entity
.
getStatus
()
&&
StringUtil
.
isNotEmpty
(
entity
.
getResult
()))
{
String
json
=
JSON
.
toJSONString
(
entity
.
getResult
());
List
<
Map
<
String
,
String
>>
listObject
=
(
List
<
Map
<
String
,
String
>>)
JSONArray
.
parse
(
json
);
List
<
IotDataVO
>
vos
=
new
ArrayList
<>();
for
(
Map
<
String
,
String
>
mapList
:
listObject
){
for
(
Map
.
Entry
entry
:
mapList
.
entrySet
()){
if
(!
"name"
.
equals
(
entry
.
getKey
())
&&
!
"deviceName"
.
equals
(
entry
.
getKey
()))
{
IotDataVO
vo
=
new
IotDataVO
();
vo
.
setKey
(
String
.
valueOf
(
entry
.
getKey
()));
vo
.
setValue
(
String
.
valueOf
(
entry
.
getValue
()));
vos
.
add
(
vo
);
}
iotDatalist
.
add
(
iotDataVO
);
}
List
<
EquipmentSpecificIndex
>
indexes
=
equipmentSpecificIndexMapper
.
getEquipmentSpeIndexByIotCodeAndTrend
(
iotCode
);
if
(
0
<
indexes
.
size
())
{
List
<
TopographyIotIndexTrendVo
>
list
=
new
ArrayList
<>();
indexes
.
forEach
(
x
->
{
iotDatalist
.
forEach
(
iotDataVO
->
{
if
(
x
.
getNameKey
().
equals
(
iotDataVO
.
getKey
()))
{
TopographyIotIndexTrendVo
vo
=
new
TopographyIotIndexTrendVo
();
vo
.
setId
(
x
.
getId
());
vo
.
setName
(
x
.
getIndexName
());
vo
.
setNameKey
(
x
.
getNameKey
());
vo
.
setUnit
(
x
.
getIndexUnitName
());
vo
.
setIotData
(
iotDataVO
);
list
.
add
(
vo
);
}
});
}
List
<
IotDataVO
>
timeList
=
vos
.
stream
().
filter
(
x
->
x
.
getKey
().
equals
(
"time"
)).
collect
(
Collectors
.
toList
());
List
<
Date
>
dates
=
new
ArrayList
<>();
for
(
IotDataVO
vo
:
timeList
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DateUtils
.
DATE_TIME_T_PATTERN
);
dates
.
add
(
sdf
.
parse
(
String
.
valueOf
(
vo
.
getValue
())));
}
List
<
EquipmentSpecificIndex
>
indexes
=
equipmentSpecificIndexMapper
.
getEquipmentSpeIndexByIotCodeAndTrend
(
iotCode
);
if
(
0
<
indexes
.
size
())
{
List
<
TopographyIotIndexTrendVo
>
list
=
new
ArrayList
<>();
vos
.
forEach
(
iotDataVO
->
{
indexes
.
forEach
(
x
->
{
if
(
x
.
getNameKey
().
equals
(
iotDataVO
.
getKey
()))
{
TopographyIotIndexTrendVo
vo
=
new
TopographyIotIndexTrendVo
();
vo
.
setId
(
x
.
getId
());
vo
.
setName
(
x
.
getIndexName
());
vo
.
setNameKey
(
x
.
getNameKey
());
vo
.
setUnit
(
x
.
getIndexUnitName
());
vo
.
setTimes
(
dates
);
vo
.
setIotData
(
iotDataVO
);
list
.
add
(
vo
);
}
});
Map
<
Long
,
List
<
TopographyIotIndexTrendVo
>>
resMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getId
()));
return
CommonResponseUtil
.
success
(
resMap
);
}
});
List
<
IotIndexResVo
>
res
=
new
ArrayList
<>();
Long
equId
=
0L
;
String
name
=
""
;
String
nameKey
=
""
;
String
unit
=
""
;
IotIndexResVo
vo
=
new
IotIndexResVo
();
if
(
0
<
list
.
size
())
{
List
<
IotDataVO
>
dataVOS
=
new
ArrayList
<>();
for
(
TopographyIotIndexTrendVo
trendVo
:
list
)
{
dataVOS
.
add
(
trendVo
.
getIotData
());
equId
=
trendVo
.
getId
();
name
=
trendVo
.
getName
();
nameKey
=
trendVo
.
getNameKey
();
unit
=
trendVo
.
getUnit
();
}
vo
.
setId
(
equId
);
vo
.
setName
(
name
);
vo
.
setNameKey
(
nameKey
);
vo
.
setUnit
(
unit
);
vo
.
setTimes
(
dates
);
vo
.
setIotData
(
dataVOS
);
res
.
add
(
vo
);
}
return
CommonResponseUtil
.
success
(
res
);
}
}
else
{
logger
.
error
(
"注:iotCode为 ("
+
iotCode
+
") 的装备不存在于物联系统中!"
);
return
CommonResponseUtil
.
success
();
}
return
CommonResponseUtil
.
success
();
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/fegin/IotFeign.java
0 → 100644
View file @
fc6d7ea5
package
com
.
yeejoin
.
equipmanage
.
fegin
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
/**
* @author DELL
*/
@FeignClient
(
name
=
"${iot.vehicle.track}"
,
path
=
"iot"
,
configuration
=
{
FeignConfiguration
.
class
})
public
interface
IotFeign
{
@RequestMapping
(
value
=
"/v1/livedata/list"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
ResponseModel
selectList
(
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
,
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"timeStart"
)
String
beginDate
,
@RequestParam
(
value
=
"timeEnd"
)
String
endDate
,
@RequestParam
(
value
=
"productKey"
)
String
productKey
,
@RequestParam
(
value
=
"deviceName"
)
String
deviceName
);
}
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