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
77c46594
Commit
77c46594
authored
Feb 10, 2022
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复bug
parent
cfcfc6de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
84 deletions
+75
-84
TopographyController.java
.../yeejoin/equipmanage/controller/TopographyController.java
+66
-80
EquipmentSpecificAlarmServiceImpl.java
...anage/service/impl/EquipmentSpecificAlarmServiceImpl.java
+2
-2
EquipmentSpecificAlarmMapper.xml
...rc/main/resources/mapper/EquipmentSpecificAlarmMapper.xml
+7
-2
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/TopographyController.java
View file @
77c46594
...
...
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.dto.TopographyLineDTO
;
import
com.yeejoin.equipmanage.common.entity.dto.TopographyNodeDTO
;
...
...
@@ -23,16 +22,14 @@ 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
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.
http.*
;
import
org.springframework.
util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
...
...
@@ -84,8 +81,6 @@ public class TopographyController extends AbstractBaseController {
@Autowired
EquipmentSpecificAlarmMapper
equipmentSpecificAlarmMapper
;
@Autowired
private
RestTemplate
restTemplate
;
@Autowired
FireFightingSystemMapper
fireFightingSystemMapper
;
@Autowired
IEquipmentSpecificAlarmService
iEquipmentSpecificAlarmService
;
...
...
@@ -96,6 +91,8 @@ public class TopographyController extends AbstractBaseController {
@Autowired
IEquipmentService
iEquipmentService
;
@Autowired
IEquipmentIndexService
iEquipmentIndexService
;
@Autowired
IotFeign
iotFeign
;
@Value
(
"${iot.vehicle.track}"
)
private
String
iotServerName
;
...
...
@@ -750,63 +747,64 @@ public class TopographyController extends AbstractBaseController {
}
else
{
return
CommonResponseUtil
.
failure
(
"装备物联编码错误,请确认!"
);
}
LonAndLatEntityVo
lonAndLatEntityVo
=
new
LonAndLatEntityVo
();
String
url
=
iotServerName
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
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
(
200
==
entity
.
getStatus
()
&&
!
ObjectUtils
.
isEmpty
(
entity
.
getResult
())
)
{
List
<
TopographyIotVo
>
list
=
new
ArrayList
<>();
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
());
String
json
=
JSON
.
toJSONString
(
entity
.
getResult
());
List
<
Map
<
String
,
String
>>
listObject
=
(
List
<
Map
<
String
,
String
>>)
JSONArray
.
parse
(
json
);
List
<
IotDataVO
>
iotDatalist
=
new
ArrayList
<>();
for
(
Map
<
String
,
String
>
mapList
:
listObject
)
{
for
(
Map
.
Entry
entry
:
mapList
.
entrySet
())
{
if
(!
"name"
.
equals
(
entry
.
getKey
())
&&
!
"deviceName"
.
equals
(
entry
.
getKey
()))
{
IotDataVO
iotDataVO
=
new
IotDataVO
();
iotDataVO
.
setKey
(
String
.
valueOf
(
entry
.
getKey
()));
iotDataVO
.
setValue
(
entry
.
getValue
());
iotDatalist
.
add
(
iotDataVO
);
}
iotDatalist
.
add
(
iotDataVO
);
}
List
<
EquipmentSpecificIndex
>
indexes
=
equipmentSpecificIndexMapper
.
getEquipmentSpeIndexByIotCode
(
iotCode
);
if
(
0
<
indexes
.
size
())
{
iotDatalist
.
forEach
(
iotDataVO
->
{
TopographyIotVo
iotVo
=
new
TopographyIotVo
();
List
<
TopographyIotDataVO
>
lists
=
new
ArrayList
<
TopographyIotDataVO
>();
indexes
.
forEach
(
x
->
{
iotVo
.
setTime
(
x
.
getUpdateDate
());
if
(
x
.
getNameKey
().
equals
(
iotDataVO
.
getKey
()))
{
TopographyIotDataVO
dataVO
=
new
TopographyIotDataVO
();
dataVO
.
setId
(
x
.
getId
());
dataVO
.
setName
(
x
.
getIndexName
());
dataVO
.
setValue
(
x
.
getValue
());
dataVO
.
setUnit
(
x
.
getIndexUnitName
());
lists
.
add
(
dataVO
);
}
});
}
List
<
IotDataVO
>
timeList
=
iotDatalist
.
stream
().
filter
(
x
->
"time"
.
equals
(
x
.
getKey
())).
collect
(
Collectors
.
toList
());
List
<
EquipmentSpecificIndex
>
indexes
=
equipmentSpecificIndexMapper
.
getEquipmentSpeIndexByIotCode
(
iotCode
);
if
(
0
<
indexes
.
size
())
{
int
j
=
0
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
iotDatalist
.
size
();
i
++)
{
TopographyIotVo
iotVo
=
new
TopographyIotVo
();
List
<
TopographyIotDataVO
>
lists
=
new
ArrayList
<>();
if
(
i
==
0
)
{
map
.
put
(
iotDatalist
.
get
(
i
).
getKey
(),
iotDatalist
.
get
(
i
).
getValue
());
}
if
(
map
.
containsKey
(
iotDatalist
.
get
(
i
).
getKey
()))
{
j
++;
}
for
(
EquipmentSpecificIndex
x
:
indexes
)
{
if
(
x
.
getNameKey
().
equals
(
iotDatalist
.
get
(
i
).
getKey
()))
{
TopographyIotDataVO
dataVO
=
new
TopographyIotDataVO
();
dataVO
.
setId
(
x
.
getId
());
dataVO
.
setName
(
x
.
getIndexName
());
dataVO
.
setValue
(
x
.
getValue
());
dataVO
.
setUnit
(
x
.
getIndexUnitName
());
lists
.
add
(
dataVO
);
iotVo
.
setList
(
lists
);
try
{
Date
date
=
DateUtils
.
dateParse
(
String
.
valueOf
(
timeList
.
get
(
j
-
1
).
getValue
()),
DateUtils
.
DATE_TIME_T_PATTERN
);
iotVo
.
setTime
(
date
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
list
.
add
(
iotVo
);
});
}
}
}
}
return
CommonResponseUtil
.
success
(
list
);
}
else
{
logger
.
error
(
"
注:
iotCode为 ("
+
iotCode
+
") 的装备不存在于物联系统中!"
);
logger
.
error
(
"
查询物联日志数据为空或
iotCode为 ("
+
iotCode
+
") 的装备不存在于物联系统中!"
);
return
CommonResponseUtil
.
success
();
}
}
...
...
@@ -843,21 +841,13 @@ public class TopographyController extends AbstractBaseController {
}
else
{
return
CommonResponseUtil
.
failure
(
"装备物联编码错误,请确认!"
);
}
LonAndLatEntityVo
lonAndLatEntityVo
=
new
LonAndLatEntityVo
();
String
url
=
iotServerName
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"product"
,
getProduct
());
headers
.
set
(
"token"
,
getToken
());
headers
.
set
(
"appKey"
,
getAppKey
());
ResponseModel
entity
=
null
;
try
{
entity
=
iotFeign
.
selectList
(
getAppKey
(),
getProduct
(),
getToken
(),
beginDate
,
endDate
,
prefix
,
suffix
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
200
==
entity
.
getStatus
()
&&
StringUtil
.
isNot
Empty
(
entity
.
getResult
()))
{
if
(
200
==
entity
.
getStatus
()
&&
!
ObjectUtils
.
is
Empty
(
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
<>();
...
...
@@ -895,29 +885,25 @@ public class TopographyController extends AbstractBaseController {
}
});
});
Map
<
String
,
List
<
TopographyIotIndexTrendVo
>>
maps
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getIotData
().
getKey
()));
Map
<
String
,
List
<
IotDataVO
>>
map
=
new
HashMap
<>();
for
(
String
str
:
maps
.
keySet
())
{
map
.
put
(
str
,
maps
.
get
(
str
).
stream
().
map
(
TopographyIotIndexTrendVo:
:
getIotData
).
collect
(
Collectors
.
toList
()));
}
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
);
}
for
(
String
s
:
map
.
keySet
())
{
IotIndexResVo
vo
=
new
IotIndexResVo
();
LambdaQueryWrapper
<
EquipmentIndex
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
EquipmentIndex:
:
getPerfQuotaDefinitionId
,
s
);
EquipmentIndex
index
=
iEquipmentIndexService
.
getOne
(
queryWrapper
);
vo
.
setIotData
(
map
.
get
(
s
));
vo
.
setId
(
index
.
getId
());
vo
.
setName
(
index
.
getPerfQuotaName
());
vo
.
setNameKey
(
index
.
getPerfQuotaDefinitionId
());
vo
.
setUnit
(
index
.
getUnitName
());
vo
.
setTimes
(
dates
);
res
.
add
(
vo
);
}
return
CommonResponseUtil
.
success
(
res
);
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificAlarmServiceImpl.java
View file @
77c46594
...
...
@@ -252,8 +252,8 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
||
AlarmTypeEnum
.
PB
.
getCode
().
equals
(
type
))
{
dataVO
.
setAlarmType
(
AlarmTypeEnum
.
getTypeByCode
(
String
.
valueOf
(
type
)));
}
dataVO
.
setAlarmContent
(
x
.
get
(
"fireEquipmentName"
)
+
dataVO
.
getAlarmType
(
));
dataVO
.
setHandleType
(
null
==
x
.
get
(
"handleType"
)
?
null
:
String
.
valueOf
(
x
.
get
(
"handleType"
)));
dataVO
.
setAlarmContent
(
String
.
valueOf
(
x
.
get
(
"alamContent"
)
));
dataVO
.
setHandleType
(
null
==
x
.
get
(
"handleType"
)
?
null
:
ConfirmAlamEnum
.
getTypeByCode
(
String
.
valueOf
(
x
.
get
(
"handleType"
)
)));
res
.
add
(
dataVO
);
});
}
...
...
amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificAlarmMapper.xml
View file @
77c46594
...
...
@@ -336,7 +336,7 @@
wlesal.create_date AS createDate,
wlesal.build_id AS buildId,
wlesa.recovery_date AS recoveryDate,
wlesal.location
AS warehouseStructureName,
CONCAT_WS(' ',ware.full_name,wsd.description)
AS warehouseStructureName,
(
SELECT
group_concat(fet.`name`)
...
...
@@ -349,7 +349,12 @@
FROM
wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment we ON wlesal.equipment_code = we.code
LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id) d
LEFT JOIN wl_equipment_specific wles ON wlesal.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id
LEFT JOIN wl_stock_detail as wsd on wsd.equipment_specific_id = wlesal.equipment_specific_id
LEFT JOIN wl_warehouse_structure as ware on wsd.warehouse_structure_id = ware.id
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
) d
WHERE d.fireEquipmentName IS NOT NULL
<if
test=
"param.warehouseStructureName != null and param.warehouseStructureName != ''"
>
and
d.warehouseStructureName like
...
...
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