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
ff5e1cd8
Commit
ff5e1cd8
authored
Aug 29, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf(tcm): 优化设备监管单位变更性能
- 增加日志记录,监控关键步骤的执行时间
parent
0dcd2d84
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
TzBaseEnterpriseInfoServiceImpl.java
...tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+10
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
ff5e1cd8
...
@@ -1463,10 +1463,12 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1463,10 +1463,12 @@ public class TzBaseEnterpriseInfoServiceImpl
List
<
String
>
companySeqList
=
tzBaseEnterpriseInfoMapper
.
selectCompanyBySupervisionOrgCode
(
oldOrgCode
);
List
<
String
>
companySeqList
=
tzBaseEnterpriseInfoMapper
.
selectCompanyBySupervisionOrgCode
(
oldOrgCode
);
// 2. 查询旧属地监管部门orgCode对应的所有设备
// 2. 查询旧属地监管部门orgCode对应的所有设备
List
<
String
>
equipmentRecordList
=
tzBaseEnterpriseInfoMapper
.
selectEquipmentBySupervisionOrgCode
(
oldOrgCode
);
List
<
String
>
equipmentRecordList
=
tzBaseEnterpriseInfoMapper
.
selectEquipmentBySupervisionOrgCode
(
oldOrgCode
);
log
.
info
(
"start-查询旧属地监管部门orgCode对应的所有设备equipmentRecordList:{},companySeqList:{}"
,
equipmentRecordList
.
size
(),
companySeqList
.
size
());
// 3. 3.1 更新单位及业务表的监管单位orgCode
// 3. 3.1 更新单位及业务表的监管单位orgCode
tzBaseEnterpriseInfoMapper
.
updateRedundantSupervisionOrgCodeUnit
(
newModel
.
getString
(
"companyName"
),
newOrgCode
,
oldOrgCode
);
tzBaseEnterpriseInfoMapper
.
updateRedundantSupervisionOrgCodeUnit
(
newModel
.
getString
(
"companyName"
),
newOrgCode
,
oldOrgCode
);
// 3.2 更新业务表统计表冗余的监管单位orgCode
// 3.2 更新业务表统计表冗余的监管单位orgCode
tzBaseEnterpriseInfoMapper
.
updateRedundantSupervisionOrgCodeStatistics
(
newOrgCode
,
oldOrgCode
);
tzBaseEnterpriseInfoMapper
.
updateRedundantSupervisionOrgCodeStatistics
(
newOrgCode
,
oldOrgCode
);
log
.
info
(
"end-查询旧属地监管部门orgCode对应的所有设备equipmentRecordList:{},companySeqList:{}"
,
equipmentRecordList
.
size
(),
companySeqList
.
size
());
// 4. 更新idx_biz_view_jg_all es设备信息
// 4. 更新idx_biz_view_jg_all es设备信息
updateEquipmentJgAllEs
(
newOrgCode
,
oldOrgCode
,
equipmentRecordList
,
newModel
.
getString
(
"companyName"
));
updateEquipmentJgAllEs
(
newOrgCode
,
oldOrgCode
,
equipmentRecordList
,
newModel
.
getString
(
"companyName"
));
// 5. 发送数据刷新事件 - 内存分页处理
// 5. 发送数据刷新事件 - 内存分页处理
...
@@ -1485,6 +1487,7 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1485,6 +1487,7 @@ public class TzBaseEnterpriseInfoServiceImpl
private
void
updateEquipmentJgAllEs
(
String
newOrgCode
,
String
oldOrgCode
,
List
<
String
>
equipmentRecordList
,
String
supervisionName
)
{
private
void
updateEquipmentJgAllEs
(
String
newOrgCode
,
String
oldOrgCode
,
List
<
String
>
equipmentRecordList
,
String
supervisionName
)
{
log
.
info
(
"开始更新idx_biz_view_jg_all es设备属地监管部门信息,新orgCode{}, 旧orgCode:{}"
,
newOrgCode
,
oldOrgCode
);
log
.
info
(
"开始更新idx_biz_view_jg_all es设备属地监管部门信息,新orgCode{}, 旧orgCode:{}"
,
newOrgCode
,
oldOrgCode
);
if
(!
ValidationUtil
.
isEmpty
(
equipmentRecordList
))
{
if
(!
ValidationUtil
.
isEmpty
(
equipmentRecordList
))
{
log
.
info
(
"待更新equipmentRecordList数量:{}"
,
equipmentRecordList
.
size
());
int
batchSize
=
1000
;
int
batchSize
=
1000
;
for
(
int
i
=
0
;
i
<
equipmentRecordList
.
size
();
i
+=
batchSize
)
{
for
(
int
i
=
0
;
i
<
equipmentRecordList
.
size
();
i
+=
batchSize
)
{
int
endIndex
=
Math
.
min
(
i
+
batchSize
,
equipmentRecordList
.
size
());
int
endIndex
=
Math
.
min
(
i
+
batchSize
,
equipmentRecordList
.
size
());
...
@@ -1503,6 +1506,7 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1503,6 +1506,7 @@ public class TzBaseEnterpriseInfoServiceImpl
});
});
if
(!
updatedCategories
.
isEmpty
())
{
if
(!
updatedCategories
.
isEmpty
())
{
log
.
info
(
"待更新updatedCategories数量:{}"
,
updatedCategories
.
size
());
esEquipmentCategory
.
saveAll
(
updatedCategories
);
esEquipmentCategory
.
saveAll
(
updatedCategories
);
}
}
}
}
...
@@ -1524,11 +1528,13 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1524,11 +1528,13 @@ public class TzBaseEnterpriseInfoServiceImpl
int
endIndex
=
Math
.
min
(
i
+
batchSize
,
updatedEsDtoList
.
size
());
int
endIndex
=
Math
.
min
(
i
+
batchSize
,
updatedEsDtoList
.
size
());
List
<
ESEquipmentCategoryDto
>
subList
=
updatedEsDtoList
.
subList
(
i
,
endIndex
);
List
<
ESEquipmentCategoryDto
>
subList
=
updatedEsDtoList
.
subList
(
i
,
endIndex
);
esEquipmentCategory
.
saveAll
(
subList
);
esEquipmentCategory
.
saveAll
(
subList
);
log
.
info
(
"es jgAll表本批次更新数据{}条"
,
subList
.
size
());
}
}
for
(
int
i
=
0
;
i
<
esRecordList
.
size
();
i
+=
batchSize
)
{
for
(
int
i
=
0
;
i
<
esRecordList
.
size
();
i
+=
batchSize
)
{
int
endIndex
=
Math
.
min
(
i
+
batchSize
,
esRecordList
.
size
());
int
endIndex
=
Math
.
min
(
i
+
batchSize
,
esRecordList
.
size
());
List
<
String
>
subList
=
esRecordList
.
subList
(
i
,
endIndex
);
List
<
String
>
subList
=
esRecordList
.
subList
(
i
,
endIndex
);
tzBaseEnterpriseInfoMapper
.
updateEquipmentSupervisionOrgCode
(
newOrgCode
,
supervisionName
,
subList
);
tzBaseEnterpriseInfoMapper
.
updateEquipmentSupervisionOrgCode
(
newOrgCode
,
supervisionName
,
subList
);
log
.
info
(
"数据库supervision表本批次更新数据{}条"
,
subList
.
size
());
}
}
}
}
log
.
info
(
"更新数据库设备有属地监管部门,数据库无属地监管部门的设备结束"
);
log
.
info
(
"更新数据库设备有属地监管部门,数据库无属地监管部门的设备结束"
);
...
@@ -1549,6 +1555,7 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1549,6 +1555,7 @@ public class TzBaseEnterpriseInfoServiceImpl
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
@Override
public
void
afterCommit
()
{
public
void
afterCommit
()
{
log
.
info
(
"开始发布数据刷新事件"
);
int
total
=
dataIds
.
size
();
int
total
=
dataIds
.
size
();
int
pages
=
(
total
+
batchSize
-
1
)
/
batchSize
;
// 计算总页数
int
pages
=
(
total
+
batchSize
-
1
)
/
batchSize
;
// 计算总页数
...
@@ -1559,7 +1566,9 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1559,7 +1566,9 @@ public class TzBaseEnterpriseInfoServiceImpl
if
(!
ValidationUtil
.
isEmpty
(
subList
))
{
if
(!
ValidationUtil
.
isEmpty
(
subList
))
{
try
{
try
{
log
.
info
(
"开始发布数据刷新事件列表size:{}"
,
subList
.
size
());
emqKeeper
.
getMqttClient
().
publish
(
String
.
format
(
TZSCommonConstant
.
DATA_REFRESH_TOPIC
,
dataType
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
),
JSONObject
.
toJSONString
(
subList
).
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
String
.
format
(
TZSCommonConstant
.
DATA_REFRESH_TOPIC
,
dataType
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
),
JSONObject
.
toJSONString
(
subList
).
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
log
.
info
(
"发布数据刷新事件列表结束"
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -1571,6 +1580,7 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1571,6 +1580,7 @@ public class TzBaseEnterpriseInfoServiceImpl
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
log
.
info
(
"发布数据刷新事件结束"
);
}
}
});
});
}
}
...
...
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