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
e6e32733
Commit
e6e32733
authored
May 27, 2025
by
李松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
f073cc23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
AdpterController.java
.../com/yeejoin/amos/adpter/controller/AdpterController.java
+2
-2
AdpterService.java
...n/java/com/yeejoin/amos/adpter/service/AdpterService.java
+16
-11
No files found.
amos-boot-utils/amos-boot-utils-adpter/src/main/java/com/yeejoin/amos/adpter/controller/AdpterController.java
View file @
e6e32733
...
...
@@ -60,8 +60,8 @@ public class AdpterController {
@ApiOperation
(
value
=
"主设备关联信息同步"
)
@RequestMapping
(
value
=
"/syncMainDeviceRelation"
,
method
=
RequestMethod
.
POST
)
public
void
syncMainDeviceRelation
()
throws
IOException
{
adpterService
.
syncMainDeviceRelation
();
public
void
syncMainDeviceRelation
(
@RequestParam
(
value
=
"orgCode"
)
String
orgCode
)
throws
IOException
{
adpterService
.
syncMainDeviceRelation
(
orgCode
);
}
@ApiOperation
(
value
=
"视频信息及主设备绑定视频关系同步"
)
...
...
amos-boot-utils/amos-boot-utils-adpter/src/main/java/com/yeejoin/amos/adpter/service/AdpterService.java
View file @
e6e32733
...
...
@@ -780,13 +780,13 @@ public class AdpterService {
});
}
public
void
syncMainDeviceRelation
()
throws
IOException
{
public
void
syncMainDeviceRelation
(
String
orgCode
)
throws
IOException
{
// 获取主设备关联物联设备记录
Resource
mainResource
=
new
ClassPathResource
(
"sql/mainDeviceRelation.sql"
);
String
mainSql
=
new
String
(
Files
.
readAllBytes
(
mainResource
.
getFile
().
toPath
()));
List
<
Map
<
String
,
Object
>>
mainList
=
query
(
dlBuss
,
mainSql
);
// 构建入库sql
execute
(
mainList
,
dataView
,
userName
,
pwd
);
execute
(
mainList
,
dataView
,
userName
,
pwd
,
orgCode
);
}
public
void
syncPlanRelation
()
{
...
...
@@ -1079,7 +1079,7 @@ public class AdpterService {
}
}
private
void
execute
(
List
<
Map
<
String
,
Object
>>
params
,
String
url
,
String
username
,
String
password
)
{
private
void
execute
(
List
<
Map
<
String
,
Object
>>
params
,
String
url
,
String
username
,
String
password
,
String
orgCode
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Connection
connection
=
null
;
Statement
statement
=
null
;
...
...
@@ -1132,15 +1132,20 @@ public class AdpterService {
throwables
.
printStackTrace
();
}
});
String
updateSql
=
new
StringBuilder
().
append
(
"UPDATE iot_device_bind_relation a "
)
.
append
(
"JOIN iot_device_info b1 ON b1.DEVICE_CODE = a.DEVICE_ID "
)
.
append
(
"JOIN iot_device_info b2 ON b2.DEVICE_CODE = a.SUB_DEVICE_ID "
)
.
append
(
"SET a.DEVICE_SEQ = b1.SEQUENCE_NBR,"
)
.
append
(
" a.DEVICE_ID = b1.DEVICE_ID,"
)
.
append
(
" a.SUB_DEVICE_SEQ = b2.SEQUENCE_NBR,"
)
.
append
(
" a.SUB_DEVICE_ID = b2.DEVICE_ID"
)
.
append
(
" WHERE a.DEVICE_ID IS NOT NULL AND a.SUB_DEVICE_ID IS NOT NULL and b1.ORG_CODE = "
)
.
append
(
"'"
)
.
append
(
orgCode
)
.
append
(
"'"
).
append
(
" and b2.ORG_CODE = "
)
.
append
(
"'"
).
append
(
orgCode
).
append
(
"'"
).
toString
();
// 更新数据
finalStatement
.
addBatch
(
"UPDATE iot_device_bind_relation a "
+
"JOIN iot_device_info b1 ON b1.DEVICE_CODE = a.DEVICE_ID "
+
"JOIN iot_device_info b2 ON b2.DEVICE_CODE = a.SUB_DEVICE_ID "
+
"SET a.DEVICE_SEQ = b1.SEQUENCE_NBR,"
+
" a.DEVICE_ID = b1.DEVICE_ID,"
+
" a.SUB_DEVICE_SEQ = b2.SEQUENCE_NBR,"
+
" a.SUB_DEVICE_ID = b2.DEVICE_ID"
+
" WHERE a.DEVICE_ID IS NOT NULL AND a.SUB_DEVICE_ID IS NOT NULL"
);
finalStatement
.
addBatch
(
updateSql
);
// 执行批处理
int
[]
result
=
statement
.
executeBatch
();
// 提交事务
...
...
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