Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
ad561ed1
Commit
ad561ed1
authored
Aug 29, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口设备更新站点后,站点名称和编码未更新问题
parent
f72a414d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
...ortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
+0
-1
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+28
-9
No files found.
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
View file @
ad561ed1
...
...
@@ -65,7 +65,6 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
List
<
GetResponse
>
result
=
queues
.
stream
()
.
map
(
queue
->
{
try
{
GetResponse
getResponse
=
channel
.
basicGet
(
queue
,
true
);
return
getResponse
;
}
catch
(
IOException
e
)
{
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
ad561ed1
...
...
@@ -338,7 +338,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
* @param context
*/
@Override
public
void
deviceStat
(
Long
siteId
,
Context
context
)
{
public
void
deviceStat
(
Long
siteId
,
Context
context
)
{
//查询当天统计,如果有 则更新统计结果,否则新增
DeviceStatEntity
deviceStatEntity
=
deviceStatService
.
selectOne
(
new
DeviceStatQuery
()
.
siteId
(
siteId
)
...
...
@@ -403,7 +403,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
.
count
();
deviceStatEntity
.
setDeviceOnlineCount
(
deviceOnlineCount
.
intValue
());
//在线率=在线设备/所有激活设备
if
(
deviceActiveCount
>
0
)
{
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceOnlineRatio
(
new
BigDecimal
(
deviceOnlineCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
ROUND_HALF_DOWN
).
setScale
(
2
));
}
...
...
@@ -414,7 +414,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
.
filter
(
f
->
f
.
getDeviceStatus
()
==
DeviceStatusEnum
.
离线
.
getValue
())
.
count
();
deviceStatEntity
.
setDeviceOfflineCount
(
deviceOfflineCount
.
intValue
());
if
(
deviceActiveCount
>
0
)
{
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceOfflineRatio
(
new
BigDecimal
(
deviceOfflineCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
ROUND_HALF_DOWN
).
setScale
(
2
));
}
//停用数量
...
...
@@ -423,13 +423,13 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
.
filter
(
f
->
f
.
getEnabled
()
==
YesNoEnum
.
NO
.
getValue
())
.
count
();
deviceStatEntity
.
setDeviceStopCount
(
deviceStopCount
.
intValue
());
if
(
deviceActiveCount
>
0
)
{
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceStopRatio
(
new
BigDecimal
(
deviceStopCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
ROUND_HALF_DOWN
).
setScale
(
2
));
}
deviceStatEntity
.
setDeviceUnActiveCount
(
deviceUnActiveCount
.
intValue
());
if
(
deviceActiveCount
>
0
)
{
if
(
deviceActiveCount
>
0
)
{
deviceStatEntity
.
setDeviceUnActiveRatio
(
new
BigDecimal
(
deviceUnActiveCount
).
divide
(
new
BigDecimal
(
deviceActiveCount
),
ROUND_HALF_DOWN
).
setScale
(
2
));
}
...
...
@@ -673,8 +673,29 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
.
toString
();
entity
.
setHomeUrl
(
path
);
}
}
//判断当前站点与修改的站点不一致时候 更新设备站点关联信息
DeviceEntity
temp
=
this
.
get
(
entity
.
getId
(),
null
);
if
(!
entity
.
getSiteId
().
equals
(
temp
.
getSiteId
()))
{
Rest
<
SitePdu
>
info
=
siteFeign
.
info
(
entity
.
getSiteId
());
if
(
info
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
entity
.
setLeadingOfficial
(
info
.
getData
().
getLeadingOfficial
());
entity
.
setLeadingOfficialTelephone
(
info
.
getData
().
getLeadingOfficialTelephone
());
entity
.
setSiteCode
(
info
.
getData
().
getSiteCode
());
entity
.
setSiteName
(
info
.
getData
().
getSiteName
());
}
}
else
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getSiteCode
())
||
ObjectUtils
.
isEmpty
(
entity
.
getSiteName
()))
{
Rest
<
SitePdu
>
info
=
siteFeign
.
info
(
entity
.
getSiteId
());
if
(
info
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
entity
.
setLeadingOfficial
(
info
.
getData
().
getLeadingOfficial
());
entity
.
setLeadingOfficialTelephone
(
info
.
getData
().
getLeadingOfficialTelephone
());
entity
.
setSiteCode
(
info
.
getData
().
getSiteCode
());
entity
.
setSiteName
(
info
.
getData
().
getSiteName
());
}
}
}
}
public
static
void
main
(
String
[]
args
)
{
BigDecimal
bigDecimal
=
new
BigDecimal
(
"104.22241"
);
...
...
@@ -684,8 +705,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
System
.
out
.
println
(
add
.
toString
());
}
...
...
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