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
e6f2ffd0
Commit
e6f2ffd0
authored
May 19, 2025
by
李松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加接口
parent
184318be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
173 additions
and
5 deletions
+173
-5
AdpterController.java
.../com/yeejoin/amos/adpter/controller/AdpterController.java
+8
-1
AdpterService.java
...n/java/com/yeejoin/amos/adpter/service/AdpterService.java
+160
-0
application-dev.properties
...tils-adpter/src/main/resources/application-dev.properties
+5
-4
No files found.
amos-boot-utils/amos-boot-utils-adpter/src/main/java/com/yeejoin/amos/adpter/controller/AdpterController.java
View file @
e6f2ffd0
...
@@ -64,9 +64,16 @@ public class AdpterController {
...
@@ -64,9 +64,16 @@ public class AdpterController {
adpterService
.
syncMainDeviceRelation
();
adpterService
.
syncMainDeviceRelation
();
}
}
@ApiOperation
(
value
=
"视频信息及主设备绑定视频关系同步"
)
@RequestMapping
(
value
=
"/syncMainVideoRelation"
,
method
=
RequestMethod
.
POST
)
public
void
syncMainVideoRelation
(
@RequestParam
(
value
=
"orgCode"
)
String
orgCode
,
@RequestParam
(
value
=
"agencyCode"
)
String
agencyCode
)
{
adpterService
.
syncMainVideoRelation
(
orgCode
,
agencyCode
);
}
@ApiOperation
(
value
=
"建筑信息"
)
@ApiOperation
(
value
=
"建筑信息"
)
@RequestMapping
(
value
=
"/buildingExcel"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/buildingExcel"
,
method
=
RequestMethod
.
POST
)
public
void
systemExcel
(
HttpServletResponse
response
,
String
gatewayId
)
throws
IOException
{
public
void
systemExcel
(
HttpServletResponse
response
,
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
)
throws
IOException
{
adpterService
.
buildingExcel
(
response
,
gatewayId
);
adpterService
.
buildingExcel
(
response
,
gatewayId
);
}
}
...
...
amos-boot-utils/amos-boot-utils-adpter/src/main/java/com/yeejoin/amos/adpter/service/AdpterService.java
View file @
e6f2ffd0
...
@@ -754,6 +754,166 @@ public class AdpterService {
...
@@ -754,6 +754,166 @@ public class AdpterService {
execute
(
mainList
,
dataView
,
userName
,
pwd
);
execute
(
mainList
,
dataView
,
userName
,
pwd
);
}
}
public
void
syncMainVideoRelation
(
String
orgCode
,
String
agencyCode
)
{
// 获取自动化中视频信息
String
videoSql
=
"SELECT \n"
+
"wv.id,\n"
+
"wv.name,\n"
+
"wv.address, \n"
+
"wv.video_type ,\n"
+
"wv.code\n"
+
"FROM `wl_video` wv"
;
List
<
Map
<
String
,
Object
>>
videoList
=
query
(
dlBuss
,
videoSql
);
// 获取自动化中主设备和视频绑定关系
String
videoRelationSql
=
"SELECT wvie.id ,\n"
+
"wvie.video_id,\n"
+
"wvie.important_equipment_id,\n"
+
"we.code\n"
+
"from wl_video_important_equipment wvie inner JOIN f_equipment we on wvie.important_equipment_id = we.id"
;
List
<
Map
<
String
,
Object
>>
videoRelationList
=
query
(
dlBuss
,
videoRelationSql
);
// 构建一张图数据入库
executeVideo
(
videoList
,
videoRelationList
,
dataView
,
userName
,
pwd
,
orgCode
,
agencyCode
);
}
public
void
executeVideo
(
List
<
Map
<
String
,
Object
>>
videoList
,
List
<
Map
<
String
,
Object
>>
videoRelationList
,
String
url
,
String
username
,
String
password
,
String
orgCode
,
String
agencyCode
)
{
// 视频信息入库
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Connection
connection
=
null
;
Statement
statement
=
null
;
try
{
// 获取数据库连接
connection
=
DriverManager
.
getConnection
(
url
,
username
,
password
);
connection
.
setAutoCommit
(
false
);
statement
=
connection
.
createStatement
();
Statement
finalStatement
=
statement
;
videoList
.
forEach
(
v
->
{
try
{
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"INSERT INTO `iot_device_video_test`("
+
"`SEQUENCE_NBR`"
+
", `REC_USER_ID`"
+
", `REC_USER_NAME`"
+
", `CREATE_DATE`"
+
", `REC_DATE`"
+
", `DEVICE_LOCATION`"
+
", `STREAM_URL`"
+
", `DEVICE_NAME`"
+
", `DEVICE_IP`"
+
", `DEVICE_PORT`"
+
", `DEVICE_STATUS`"
+
", `DEVICE_CODE`"
+
", `DEVICE_MODEL`"
+
", `OTHER_PARAM`"
+
", `AGENCY_CODE`"
+
", `ORG_CODE`"
+
", `VIDEO_TYPE`) VALUES ("
);
sql
.
append
(
v
.
get
(
"id"
));
sql
.
append
(
","
);
sql
.
append
(
"'admin'"
);
sql
.
append
(
","
);
sql
.
append
(
"'admin'"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
sdf
.
format
(
new
Date
()));
sql
.
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
sdf
.
format
(
new
Date
()));
sql
.
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
v
.
get
(
"address"
));
sql
.
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"null"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
v
.
get
(
"name"
));
sql
.
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"null"
);
sql
.
append
(
","
);
sql
.
append
(
"null"
);
sql
.
append
(
","
);
sql
.
append
(
"null"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
v
.
get
(
"code"
));
sql
.
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"null"
);
sql
.
append
(
","
);
sql
.
append
(
"null"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
).
append
(
agencyCode
).
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
).
append
(
orgCode
).
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
v
.
get
(
"video_type"
));
sql
.
append
(
"'"
);
sql
.
append
(
")"
);
finalStatement
.
addBatch
(
sql
.
toString
());
}
catch
(
SQLException
throwables
)
{
throwables
.
printStackTrace
();
}
});
// 绑定关系表
videoRelationList
.
forEach
(
v
->
{
try
{
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"INSERT INTO `iot_device_bind_video_test`("
+
"`SEQUENCE_NBR`"
+
", `REC_USER_ID`"
+
", `REC_DATE`"
+
", `DEVICE_SEQ`"
+
", `VIDEO_SEQ`) VALUES ("
);
sql
.
append
(
v
.
get
(
"id"
));
sql
.
append
(
","
);
sql
.
append
(
"'admin'"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
sdf
.
format
(
new
Date
()));
sql
.
append
(
"'"
);
sql
.
append
(
","
);
sql
.
append
(
"(SELECT SEQUENCE_NBR FROM iot_device_info WHERE DEVICE_CODE = '"
).
append
(
v
.
get
(
"code"
)).
append
(
"')"
);
sql
.
append
(
","
);
sql
.
append
(
"'"
);
sql
.
append
(
v
.
get
(
"video_id"
));
sql
.
append
(
"'"
);
sql
.
append
(
")"
);
finalStatement
.
addBatch
(
sql
.
toString
());
}
catch
(
SQLException
throwables
)
{
throwables
.
printStackTrace
();
}
});
// 执行批处理
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
();
}
}
}
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
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Connection
connection
=
null
;
Connection
connection
=
null
;
...
...
amos-boot-utils/amos-boot-utils-adpter/src/main/resources/application-dev.properties
View file @
e6f2ffd0
...
@@ -28,8 +28,9 @@ goal.jdbc.ip.idx=jdbc:mysql://172.16.11.201:3306/dl_amos_idx_biz_bak?useUnicode=
...
@@ -28,8 +28,9 @@ goal.jdbc.ip.idx=jdbc:mysql://172.16.11.201:3306/dl_amos_idx_biz_bak?useUnicode=
source.jdbc.ip.buss
=
jdbc:mysql://172.16.11.201:3306/dl_business?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
source.jdbc.ip.buss
=
jdbc:mysql://172.16.11.201:3306/dl_business?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
goal.jdbc.ip.buss
=
jdbc:mysql://172.16.11.201:3306/dl_business_copy?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
goal.jdbc.ip.buss
=
jdbc:mysql://172.16.11.201:3306/dl_business_copy?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
source.jdbc.ip.dataview
=
jdbc:mysql://172.16.11.201:3307/amos-iot-data-view?allowMultiQueries=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
source.jdbc.ip.dataview
=
jdbc:mysql://39.100.71.139:3307/amos-iot-data-view?allowMultiQueries=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
goal.jdbc.ip.dlbuss
=
jdbc:mysql://172.16.11.201:3307/gusu_business?allowMultiQueries=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
goal.jdbc.ip.dlbuss
=
jdbc:mysql://39.100.71.139:3307/ykz_business?allowMultiQueries=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
goal.jdbc.ip.relation
=
jdbc:mysql://39.100.71.139:3307/iot-data-index?allowMultiQueries=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
goal.jdbc.ip.dlcom
=
jdbc:mysql://172.16.11.201:3307/gusu_common?allowMultiQueries=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
goal.jdbc.ip.dlcom
=
jdbc:mysql://172.16.11.201:3307/gusu_common?allowMultiQueries=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
...
@@ -37,4 +38,4 @@ goal.jdbc.ip.project=jdbc:mysql://39.100.71.139:3307/amos_project?useUnicode=tru
...
@@ -37,4 +38,4 @@ goal.jdbc.ip.project=jdbc:mysql://39.100.71.139:3307/amos_project?useUnicode=tru
source.jdbc.ip.project
=
jdbc:mysql://39.100.71.139:3307/wh_project?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
source.jdbc.ip.project
=
jdbc:mysql://39.100.71.139:3307/wh_project?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yeejoin.user
=
root
yeejoin.user
=
root
yeejoin.pwd
=
ENC(9OWq6vJ9UzjgCfz8dAdzgMT5WkUTmyHkVdd3HoP80K9l5XOzu7dbmpgfXzvqANjJ)
yeejoin.pwd
=
Yeejoin@2020
\ No newline at end of file
\ No newline at end of file
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