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
f7b207b1
Commit
f7b207b1
authored
May 26, 2025
by
李松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加预案关系同步接口
parent
52f50dc6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
1 deletion
+99
-1
AdpterController.java
.../com/yeejoin/amos/adpter/controller/AdpterController.java
+6
-0
AdpterService.java
...n/java/com/yeejoin/amos/adpter/service/AdpterService.java
+93
-1
No files found.
amos-boot-utils/amos-boot-utils-adpter/src/main/java/com/yeejoin/amos/adpter/controller/AdpterController.java
View file @
f7b207b1
...
@@ -71,6 +71,12 @@ public class AdpterController {
...
@@ -71,6 +71,12 @@ public class AdpterController {
adpterService
.
syncMainVideoRelation
(
orgCode
,
agencyCode
);
adpterService
.
syncMainVideoRelation
(
orgCode
,
agencyCode
);
}
}
@ApiOperation
(
value
=
"预案关联关系数据同步"
)
@RequestMapping
(
value
=
"/syncPlanRelation"
,
method
=
RequestMethod
.
POST
)
public
void
syncPlanRelation
()
{
adpterService
.
syncPlanRelation
();
}
@ApiOperation
(
value
=
"建筑信息"
)
@ApiOperation
(
value
=
"建筑信息"
)
@RequestMapping
(
value
=
"/buildingExcel"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/buildingExcel"
,
method
=
RequestMethod
.
POST
)
public
void
systemExcel
(
HttpServletResponse
response
,
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
)
throws
IOException
{
public
void
systemExcel
(
HttpServletResponse
response
,
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
)
throws
IOException
{
...
...
amos-boot-utils/amos-boot-utils-adpter/src/main/java/com/yeejoin/amos/adpter/service/AdpterService.java
View file @
f7b207b1
...
@@ -97,7 +97,7 @@ public class AdpterService {
...
@@ -97,7 +97,7 @@ public class AdpterService {
String
systemUserRecTime
;
String
systemUserRecTime
;
public
Map
<
String
,
String
>
handle
()
{
public
Map
<
String
,
String
>
handle
()
{
Map
<
String
,
String
>
rMap
=
new
HashMap
<>();
Map
<
String
,
String
>
rMap
=
new
HashMap
<>();
...
@@ -789,6 +789,98 @@ public class AdpterService {
...
@@ -789,6 +789,98 @@ public class AdpterService {
execute
(
mainList
,
dataView
,
userName
,
pwd
);
execute
(
mainList
,
dataView
,
userName
,
pwd
);
}
}
public
void
syncPlanRelation
()
{
// 查询原主设备信息
String
mainSql
=
"SELECT id , name ,code from f_equipment "
;
List
<
Map
<
String
,
Object
>>
mainList
=
query
(
dlBuss
,
mainSql
);
// 查询主设备绑定物联设备关系
String
mainRelationSql
=
"SELECT a.id,\n"
+
"a.equipment_id, \n"
+
"a.fire_equipment_id,"
+
"(SELECT code from f_equipment b where b.id = a.equipment_id ) as mainCode,\n"
+
"(SELECT code from wl_equipment_specific b where b.id = a.fire_equipment_id ) as equipCode\n"
+
"from f_equipment_fire_equipment a"
;
List
<
Map
<
String
,
Object
>>
mainRelationList
=
query
(
dlBuss
,
mainRelationSql
);
// 构建更新sql
executePlanRelation
(
mainList
,
mainRelationList
,
dataView
,
userName
,
pwd
);
}
public
void
executePlanRelation
(
List
<
Map
<
String
,
Object
>>
mainList
,
List
<
Map
<
String
,
Object
>>
mainRelationList
,
String
url
,
String
username
,
String
password
)
{
// 视频信息入库
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Connection
connection
=
null
;
Statement
statement
=
null
;
String
getIdSql
=
"(SELECT SEQUENCE_NBR from iot_device_info where DEVICE_CODE = %s)"
;
try
{
// 获取数据库连接
connection
=
DriverManager
.
getConnection
(
url
,
username
,
password
);
connection
.
setAutoCommit
(
false
);
statement
=
connection
.
createStatement
();
Statement
finalStatement
=
statement
;
// 主设备信息
mainList
.
forEach
(
a
->
{
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"UPDATE `c_plan_equipment` SET `fire_equipment_code` = "
);
sql
.
append
(
"'"
);
sql
.
append
(
a
.
get
(
"code"
));
sql
.
append
(
"', fire_equipment_name = "
).
append
(
"'"
);
sql
.
append
(
a
.
get
(
"name"
)).
append
(
"'"
);
sql
.
append
(
" WHERE `fire_equipment_id` = '"
).
append
(
a
.
get
(
"id"
)).
append
(
"'"
);
try
{
finalStatement
.
addBatch
(
sql
.
toString
());
}
catch
(
SQLException
throwables
)
{
throwables
.
printStackTrace
();
}
});
// 更新c_plan_equipment表主设备id
String
updateMainSql
=
"UPDATE c_plan_equipment a SET a.fire_equipment_id = "
+
"(SELECT SEQUENCE_NBR from iot_device_info where DEVICE_CODE = a.fire_equipment_code and a.fire_equipment_code is not null )"
;
finalStatement
.
addBatch
(
updateMainSql
);
mainRelationList
.
forEach
(
m
->
{
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"UPDATE `c_equipment_fire_equipment` SET `equipment_id` = "
);
sql
.
append
(
String
.
format
(
getIdSql
,
"'"
+
m
.
get
(
"mainCode"
)
+
"'"
));
sql
.
append
(
","
);
sql
.
append
(
"equipment_specific_id = "
);
sql
.
append
(
String
.
format
(
getIdSql
,
"'"
+
m
.
get
(
"equipCode"
)
+
"'"
));
sql
.
append
(
" where id = '"
);
sql
.
append
(
m
.
get
(
"id"
)).
append
(
"'"
);
try
{
finalStatement
.
addBatch
(
sql
.
toString
());
}
catch
(
SQLException
throwables
)
{
throwables
.
printStackTrace
();
}
});
String
updateIdSql
=
"UPDATE c_equipment a SET a.id = "
+
"(SELECT SEQUENCE_NBR from iot_device_info where DEVICE_CODE = a.code and a.code is not null )"
;
finalStatement
.
addBatch
(
updateIdSql
);
// 执行批处理
int
[]
result
=
statement
.
executeBatch
();
// 提交事务
connection
.
commit
();
System
.
out
.
println
(
"批量插入完成,影响行数: "
+
Arrays
.
toString
(
result
));
}
catch
(
SQLException
e
)
{
if
(
connection
!=
null
)
{
try
{
connection
.
rollback
();
}
catch
(
SQLException
ex
)
{
ex
.
printStackTrace
();
}
}
e
.
printStackTrace
();
}
finally
{
// 关闭资源
try
{
if
(
statement
!=
null
)
statement
.
close
();
if
(
connection
!=
null
)
connection
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
public
void
syncMainVideoRelation
(
String
orgCode
,
String
agencyCode
)
{
public
void
syncMainVideoRelation
(
String
orgCode
,
String
agencyCode
)
{
// 获取自动化中视频信息
// 获取自动化中视频信息
String
videoSql
=
"SELECT \n"
+
String
videoSql
=
"SELECT \n"
+
...
...
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