Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
09a648bf
authored
Nov 03, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:修复bug
parent
38601e7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
09a648bf
...
@@ -192,7 +192,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -192,7 +192,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
}
}
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
void
edit
(
PlatDeviceEditDTO
dto
)
{
public
void
edit
(
PlatDeviceEditDTO
dto
)
{
...
@@ -422,10 +422,17 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -422,10 +422,17 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
log
.
info
(
"写入设备属性请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
log
.
info
(
"写入设备属性请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
String
deviceId
=
dto
.
getDeviceId
();
String
deviceId
=
dto
.
getDeviceId
();
UserServerInfo
usrServerInfo
=
dto
.
getUsrServerInfo
();
UserServerInfo
usrServerInfo
=
dto
.
getUsrServerInfo
();
Map
<
String
,
Object
>
map
=
getAttrMap
(
dto
);
if
(
usrServerInfo
!=
null
)
{
map
.
put
(
"usrServerInfo"
,
JSON
.
toJSONString
(
usrServerInfo
));
}
String
result
=
devicePropertiesOperateService
.
deviceWriteAttr
(
deviceId
,
map
);
if
(
StringUtils
.
isNotEmpty
(
result
))
{
throw
new
RuntimeException
(
"设备写入失败:"
+
result
);
}
PlatDeviceOther
other
=
platDeviceOtherService
.
getOne
(
new
QueryWrapper
<
PlatDeviceOther
>().
lambda
()
PlatDeviceOther
other
=
platDeviceOtherService
.
getOne
(
new
QueryWrapper
<
PlatDeviceOther
>().
lambda
()
.
eq
(
PlatDeviceOther:
:
getOriDeviceId
,
deviceId
)
.
eq
(
PlatDeviceOther:
:
getOriDeviceId
,
deviceId
)
.
last
(
"limit 1"
));
.
last
(
"limit 1"
));
Map
<
String
,
Object
>
map
=
getAttrMap
(
dto
);
if
(
other
!=
null
&&
usrServerInfo
!=
null
)
{
if
(
other
!=
null
&&
usrServerInfo
!=
null
)
{
other
.
setProtocolAccount
(
usrServerInfo
.
getUsername
());
other
.
setProtocolAccount
(
usrServerInfo
.
getUsername
());
other
.
setProtocolPassword
(
usrServerInfo
.
getPassword
());
other
.
setProtocolPassword
(
usrServerInfo
.
getPassword
());
...
@@ -436,14 +443,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -436,14 +443,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
other
.
setAttribute
(
JSON
.
toJSONString
(
map
));
other
.
setAttribute
(
JSON
.
toJSONString
(
map
));
platDeviceOtherService
.
updateById
(
other
);
platDeviceOtherService
.
updateById
(
other
);
}
}
if
(
usrServerInfo
!=
null
)
{
map
.
put
(
"usrServerInfo"
,
JSON
.
toJSONString
(
usrServerInfo
));
}
String
result
=
devicePropertiesOperateService
.
deviceWriteAttr
(
deviceId
,
map
);
if
(
StringUtils
.
isNotEmpty
(
result
))
{
throw
new
RuntimeException
(
"设备写入失败:"
+
result
);
}
if
(
dto
.
getRadarMount
()
!=
null
)
{
if
(
dto
.
getRadarMount
()
!=
null
)
{
//更新区域设置设备安装方式
//更新区域设置设备安装方式
platRegionSettingService
.
update
(
new
UpdateWrapper
<
PlatRegionSetting
>().
lambda
()
platRegionSettingService
.
update
(
new
UpdateWrapper
<
PlatRegionSetting
>().
lambda
()
...
@@ -475,8 +474,11 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -475,8 +474,11 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
Map
<
String
,
Object
>
map
=
getAttrMap
(
dto
);
Map
<
String
,
Object
>
map
=
getAttrMap
(
dto
);
List
<
String
>
resultList
=
Lists
.
newArrayList
();
List
<
String
>
resultList
=
Lists
.
newArrayList
();
for
(
String
deviceId
:
dto
.
getDeviceIdList
())
{
for
(
String
deviceId
:
dto
.
getDeviceIdList
())
{
String
result
=
devicePropertiesOperateService
.
deviceWriteAttr
(
deviceId
,
map
);
if
(
StringUtils
.
isNotEmpty
(
result
))
{
resultList
.
add
(
result
);
}
PlatDeviceOther
other
=
platDeviceOtherService
.
getOne
(
new
QueryWrapper
<
PlatDeviceOther
>().
lambda
()
PlatDeviceOther
other
=
platDeviceOtherService
.
getOne
(
new
QueryWrapper
<
PlatDeviceOther
>().
lambda
()
.
eq
(
PlatDeviceOther:
:
getOriDeviceId
,
deviceId
)
.
eq
(
PlatDeviceOther:
:
getOriDeviceId
,
deviceId
)
.
last
(
"limit 1"
));
.
last
(
"limit 1"
));
...
@@ -484,10 +486,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -484,10 +486,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
other
.
setAttribute
(
JSON
.
toJSONString
(
map
));
other
.
setAttribute
(
JSON
.
toJSONString
(
map
));
platDeviceOtherService
.
updateById
(
other
);
platDeviceOtherService
.
updateById
(
other
);
}
}
String
result
=
devicePropertiesOperateService
.
deviceWriteAttr
(
deviceId
,
map
);
if
(
StringUtils
.
isNotEmpty
(
result
))
{
resultList
.
add
(
result
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
resultList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
resultList
))
{
throw
new
RuntimeException
(
"修改设备属性失败:"
+
resultList
.
get
(
0
));
throw
new
RuntimeException
(
"修改设备属性失败:"
+
resultList
.
get
(
0
));
...
...
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