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
184318be
Commit
184318be
authored
May 16, 2025
by
李松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
69f008f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
AdpterService.java
...n/java/com/yeejoin/amos/adpter/service/AdpterService.java
+25
-4
area.sql
...ls/amos-boot-utils-adpter/src/main/resources/sql/area.sql
+2
-1
device.sql
.../amos-boot-utils-adpter/src/main/resources/sql/device.sql
+3
-2
No files found.
amos-boot-utils/amos-boot-utils-adpter/src/main/java/com/yeejoin/amos/adpter/service/AdpterService.java
View file @
184318be
...
...
@@ -67,6 +67,9 @@ public class AdpterService {
@Value
(
"${goal.jdbc.ip.dlbuss}"
)
String
dlBuss
;
@Value
(
"${goal.jdbc.ip.relation}"
)
String
relation
;
@Value
(
"${goal.jdbc.ip.dlcom}"
)
String
dlCom
;
String
driver
=
"com.mysql.cj.jdbc.Driver"
;
...
...
@@ -719,11 +722,29 @@ public class AdpterService {
String
replace
=
new
String
(
Files
.
readAllBytes
(
resource
.
getFile
().
toPath
()));
String
sql
=
replace
.
replace
(
"#{gatewayId}"
,
gatewayId
);
List
<
Map
<
String
,
Object
>>
list
=
query
(
dlBuss
,
sql
);
getRelation
(
list
);
ArrayList
<
DeviceExcelModel
>
deviceList
=
new
ArrayList
<>();
setData
(
list
,
deviceList
);
return
deviceList
;
}
public
void
getRelation
(
List
<
Map
<
String
,
Object
>>
list
)
{
String
relationSql
=
"SELECT * from iot_index_relation"
;
List
<
Map
<
String
,
Object
>>
relationList
=
query
(
relation
,
relationSql
);
list
.
forEach
(
dev
->
{
List
<
Map
<
String
,
Object
>>
collect
=
relationList
.
stream
().
filter
(
r
->
!
ObjectUtils
.
isEmpty
(
dev
.
get
(
"equipmentIndexKey"
))
&&
!
ObjectUtils
.
isEmpty
(
dev
.
get
(
"equipTypeCode"
))
&&
r
.
get
(
"oldIndexCode"
).
toString
().
equals
(
dev
.
get
(
"equipmentIndexKey"
).
toString
())
&&
r
.
get
(
"oldequipTypeCode"
).
toString
().
equals
(
dev
.
get
(
"equipTypeCode"
).
toString
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
collect
)
&&
collect
.
size
()
==
1
)
{
Map
<
String
,
Object
>
objectMap
=
collect
.
get
(
0
);
dev
.
put
(
"iotProperName"
,
objectMap
.
get
(
"newIndexName"
));
dev
.
put
(
"deviceType"
,
objectMap
.
get
(
"newEquipType"
));
}
else
{
dev
.
put
(
"iotProperName"
,
dev
.
get
(
"iotProperName"
)+
"-"
+(!
ObjectUtils
.
isEmpty
(
dev
.
get
(
"equipmentIndexKey"
))?
dev
.
get
(
"equipmentIndexKey"
):
""
).
toString
()+
"缺失"
);
dev
.
put
(
"deviceType"
,
dev
.
get
(
"deviceType"
)+
"-"
+(!
ObjectUtils
.
isEmpty
(
dev
.
get
(
"equipTypeCode"
))?
dev
.
get
(
"equipTypeCode"
):
""
).
toString
()+
"缺失"
);
}
});
}
public
void
syncMainDeviceRelation
()
throws
IOException
{
// 获取主设备关联物联设备记录
Resource
mainResource
=
new
ClassPathResource
(
"sql/mainDeviceRelation.sql"
);
...
...
@@ -746,7 +767,7 @@ public class AdpterService {
params
.
forEach
(
p
->
{
try
{
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"INSERT INTO iot_device_bind_relation
_test
(SEQUENCE_NBR"
+
sql
.
append
(
"INSERT INTO iot_device_bind_relation (SEQUENCE_NBR"
+
", DEVICE_SEQ"
+
", SUB_DEVICE_SEQ"
+
",SUB_DEVICE_ID"
+
...
...
@@ -787,9 +808,9 @@ public class AdpterService {
}
});
// 更新数据
finalStatement
.
addBatch
(
"UPDATE iot_device_bind_relation
_test
a "
+
"JOIN iot_device_info
_test
b1 ON b1.DEVICE_CODE = a.DEVICE_ID "
+
"JOIN iot_device_info
_test
b2 ON b2.DEVICE_CODE = a.SUB_DEVICE_ID "
+
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,"
+
...
...
amos-boot-utils/amos-boot-utils-adpter/src/main/resources/sql/area.sql
View file @
184318be
...
...
@@ -18,5 +18,5 @@ from (
)
a
,
wl_form_instance
i
WHERE
i
.
instance_id
=
a
.
id
group
by
a
.
id
group
by
a
.
id
,
i
.
group_type
)
temp
\ No newline at end of file
amos-boot-utils/amos-boot-utils-adpter/src/main/resources/sql/device.sql
View file @
184318be
...
...
@@ -14,7 +14,7 @@ from (
temp
.
`NAME`
AS
pointName
,
temp
.
FIELD_NAME
,
temp
.
equipment_index_name
AS
iotProperName
,
temp
.
equipment_index_key
,
temp
.
equipment_index_key
as
equipmentIndexKey
,
wes
.
`code`
AS
deviceCode
,
wed
.
equipment_name
AS
deviceType
,
wes
.
`name`
AS
deviceName
,
...
...
@@ -25,7 +25,8 @@ from (
we
.
maintenance_cycle
AS
mainDate
,
we
.
expiry_date
AS
scraplife
,
wes
.
warranty_period
AS
period
,
ffs
.
`name`
AS
`system`
ffs
.
`name`
AS
`system`
,
SUBSTR
(
temp
.
PRODUCT_KEY
,
3
)
AS
equipTypeCode
FROM
(
SELECT
gdp
.
DATA_TYPE
,
gdp
.
PRODUCT_KEY
,
...
...
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