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
fb626b36
Commit
fb626b36
authored
Oct 14, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(jg):优化数据质量评分处理逻辑
- 修改默认数据质量评分名称为"三类" - 新增handleDataQualityScore2方法处理更多数据场景 - 引入EventPublisher用于发布设备创建或编辑事件 - 重构查询逻辑,支持处理缺失和错误的数据质量评分
parent
11a672da
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
14 deletions
+117
-14
DataHandlerController.java
.../boot/module/jg/biz/controller/DataHandlerController.java
+2
-1
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+1
-1
DataHandlerServiceImpl.java
...ot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
+114
-12
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/DataHandlerController.java
View file @
fb626b36
...
@@ -380,6 +380,6 @@ public class DataHandlerController extends BaseController {
...
@@ -380,6 +380,6 @@ public class DataHandlerController extends BaseController {
@PostMapping
(
value
=
"/handleDataQualityScore"
)
@PostMapping
(
value
=
"/handleDataQualityScore"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"修复es中未正常生成数据等级的数据"
,
notes
=
"修复es中未正常生成数据等级的数据"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"修复es中未正常生成数据等级的数据"
,
notes
=
"修复es中未正常生成数据等级的数据"
)
public
ResponseModel
<
String
>
handleDataQualityScore
()
{
public
ResponseModel
<
String
>
handleDataQualityScore
()
{
return
ResponseHelper
.
buildResponse
(
dataHandlerService
.
handleDataQualityScore
());
return
ResponseHelper
.
buildResponse
(
dataHandlerService
.
handleDataQualityScore
2
());
}
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/CommonServiceImpl.java
View file @
fb626b36
...
@@ -3230,7 +3230,7 @@ public class CommonServiceImpl implements ICommonService {
...
@@ -3230,7 +3230,7 @@ public class CommonServiceImpl implements ICommonService {
*/
*/
public
String
castDataQualityScore2Name
(
String
dataQualityScore
,
Boolean
isIntoManagement
){
public
String
castDataQualityScore2Name
(
String
dataQualityScore
,
Boolean
isIntoManagement
){
String
name
=
dataDictTypeHandler
.
handle
(
DATA_QUALITY_SCORE
,
dataQualityScore
);
String
name
=
dataDictTypeHandler
.
handle
(
DATA_QUALITY_SCORE
,
dataQualityScore
);
return
name
==
null
?
(
isIntoManagement
==
null
||
!
isIntoManagement
)
?
"二类"
:
"一
类"
:
name
;
return
name
==
null
?
"三
类"
:
name
;
}
}
public
void
setDataQualityScore2Json
(
Map
<
String
,
Object
>
result
,
String
bizId
,
BusinessTypeEnum
businessTypeEnum
)
{
public
void
setDataQualityScore2Json
(
Map
<
String
,
Object
>
result
,
String
bizId
,
BusinessTypeEnum
businessTypeEnum
)
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
View file @
fb626b36
...
@@ -38,13 +38,16 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto;
...
@@ -38,13 +38,16 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeEqDto;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PieLineEquipContraptionDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.handler.strategy.ProblemHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.handler.strategy.ProblemHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.listener.SafetyProblemTopicMessage
;
import
com.yeejoin.amos.boot.module.jg.biz.listener.SafetyProblemTopicMessage
;
import
com.yeejoin.amos.boot.module.jg.biz.refresh.StatisticsDataUpdateService
;
import
com.yeejoin.amos.boot.module.jg.biz.refresh.StatisticsDataUpdateService
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualityScore
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualityScore
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto
;
...
@@ -63,6 +66,7 @@ import org.elasticsearch.client.RestHighLevelClient;
...
@@ -63,6 +66,7 @@ import org.elasticsearch.client.RestHighLevelClient;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -174,6 +178,8 @@ public class DataHandlerServiceImpl {
...
@@ -174,6 +178,8 @@ public class DataHandlerServiceImpl {
private
final
RestHighLevelClient
restHighLevelClient
;
private
final
RestHighLevelClient
restHighLevelClient
;
@Autowired
private
EventPublisher
eventPublisher
;
/**
/**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
...
@@ -2312,18 +2318,7 @@ public class DataHandlerServiceImpl {
...
@@ -2312,18 +2318,7 @@ public class DataHandlerServiceImpl {
try
{
try
{
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
buildQuery
(
boolQuery
);
meBuilder
.
must
(
QueryBuilders
.
existsQuery
(
"USE_ORG_CODE"
));
meBuilder
.
mustNot
(
QueryBuilders
.
existsQuery
(
"DATA_QUALITY_SCORE"
));
meBuilder
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
boolQuery
.
must
(
meBuilder
);
BoolQueryBuilder
meBuilder1
=
QueryBuilders
.
boolQuery
();
meBuilder1
.
should
(
QueryBuilders
.
matchQuery
(
"STATUS"
,
"已认领"
));
meBuilder1
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
existsQuery
(
"STATUS"
)));
meBuilder1
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchPhraseQuery
(
"STATUS"
,
""
)));
meBuilder1
.
minimumShouldMatch
(
1
);
boolQuery
.
must
(
meBuilder1
);
esSearchService
.
searchResponseInBatch
(
IDX_BIZ_VIEW_JG_ALL
,
boolQuery
,
2000
,
searchHits
->
{
esSearchService
.
searchResponseInBatch
(
IDX_BIZ_VIEW_JG_ALL
,
boolQuery
,
2000
,
searchHits
->
{
List
<
ESEquipmentCategoryDto
>
esEquipmentCategoryList
=
searchHits
.
stream
().
map
(
searchHit
->
JSONObject
.
parseObject
(
searchHit
.
getSourceAsString
(),
ESEquipmentCategoryDto
.
class
)).
collect
(
Collectors
.
toList
());
List
<
ESEquipmentCategoryDto
>
esEquipmentCategoryList
=
searchHits
.
stream
().
map
(
searchHit
->
JSONObject
.
parseObject
(
searchHit
.
getSourceAsString
(),
ESEquipmentCategoryDto
.
class
)).
collect
(
Collectors
.
toList
());
...
@@ -2346,4 +2341,111 @@ public class DataHandlerServiceImpl {
...
@@ -2346,4 +2341,111 @@ public class DataHandlerServiceImpl {
log
.
info
(
"处理数据质量评分结束,更新{}条设备"
,
total
.
get
());
log
.
info
(
"处理数据质量评分结束,更新{}条设备"
,
total
.
get
());
return
"success"
;
return
"success"
;
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
handleDataQualityScore2
()
{
log
.
info
(
"处理数据质量评分开始"
);
AtomicLong
total
=
new
AtomicLong
(
0L
);
try
{
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
log
.
info
(
"开始处理设备es没有等级的数据"
);
buildQuery
(
boolQuery
);
processEquipmentData
(
boolQuery
,
total
);
log
.
info
(
"设备es没有等级的数据处理完成,当前总计处理{}条设备"
,
total
.
get
());
boolQuery
=
QueryBuilders
.
boolQuery
();
log
.
info
(
"开始处理设备es等级不对的数据"
);
buildQuery1
(
boolQuery
);
processEquipmentData
(
boolQuery
,
total
);
log
.
info
(
"设备es等级不对的数据处理完成,当前总计处理{}条设备"
,
total
.
get
());
}
catch
(
Exception
e
)
{
log
.
error
(
"处理数据质量评分过程中发生异常"
,
e
);
throw
new
RuntimeException
(
e
);
}
log
.
info
(
"处理数据质量评分结束,更新{}条设备"
,
total
.
get
());
return
"success"
;
}
/**
* 处理设备数据的通用方法
*
* @param boolQuery 查询条件
* @param total 计数器
*/
private
void
processEquipmentData
(
BoolQueryBuilder
boolQuery
,
AtomicLong
total
)
throws
Exception
{
log
.
debug
(
"开始执行ES批量查询,查询条件: {}"
,
boolQuery
);
esSearchService
.
searchResponseInBatch
(
IDX_BIZ_VIEW_JG_ALL
,
boolQuery
,
2000
,
searchHits
->
{
log
.
debug
(
"处理批次数据,当前批次包含{}条记录"
,
searchHits
.
size
());
List
<
ESEquipmentCategoryDto
>
esEquipmentCategoryList
=
searchHits
.
stream
()
.
map
(
searchHit
->
JSONObject
.
parseObject
(
searchHit
.
getSourceAsString
(),
ESEquipmentCategoryDto
.
class
))
.
collect
(
Collectors
.
toList
());
Set
<
String
>
projectContraptionIds
=
esEquipmentCategoryList
.
stream
()
.
filter
(
i
->
"8000"
.
equals
(
i
.
getEQU_LIST_CODE
()))
.
map
(
ESEquipmentCategoryDto:
:
getProjectContraptionId
)
.
collect
(
Collectors
.
toSet
());
Set
<
String
>
equipRecord
=
esEquipmentCategoryList
.
stream
()
.
filter
(
i
->
!
"8000"
.
equals
(
i
.
getEQU_LIST_CODE
()))
.
map
(
ESEquipmentCategoryDto:
:
getSEQUENCE_NBR
)
.
collect
(
Collectors
.
toSet
());
log
.
debug
(
"当前批次解析结果: 总设备数={}, 装置设备数={}, 设备数={}"
,
esEquipmentCategoryList
.
size
(),
projectContraptionIds
.
size
(),
equipRecord
.
size
());
if
(!
ValidationUtil
.
isEmpty
(
equipRecord
))
{
log
.
info
(
"发布设备事件,设备数量: {}"
,
equipRecord
.
size
());
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
equipRecord
,
EquipCreateOrEditEvent
.
EquipType
.
equip
));
}
if
(!
ValidationUtil
.
isEmpty
(
projectContraptionIds
))
{
log
.
info
(
"发布装置设备事件,设备数量: {}"
,
projectContraptionIds
.
size
());
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_PROJECT
.
name
(),
projectContraptionIds
,
EquipCreateOrEditEvent
.
EquipType
.
project
));
}
total
.
addAndGet
(
esEquipmentCategoryList
.
size
());
log
.
debug
(
"当前批次处理完成,累计处理{}条设备"
,
total
.
get
());
});
log
.
debug
(
"ES批量查询执行完成"
);
}
private
void
buildQuery
(
BoolQueryBuilder
boolQuery
)
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
existsQuery
(
"USE_ORG_CODE"
));
meBuilder
.
mustNot
(
QueryBuilders
.
existsQuery
(
"DATA_QUALITY_SCORE"
));
meBuilder
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
boolQuery
.
must
(
meBuilder
);
BoolQueryBuilder
meBuilder1
=
QueryBuilders
.
boolQuery
();
meBuilder1
.
should
(
QueryBuilders
.
matchQuery
(
"STATUS"
,
"已认领"
));
meBuilder1
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
existsQuery
(
"STATUS"
)));
meBuilder1
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchPhraseQuery
(
"STATUS"
,
""
)));
meBuilder1
.
minimumShouldMatch
(
1
);
boolQuery
.
must
(
meBuilder1
);
}
private
void
buildQuery1
(
BoolQueryBuilder
boolQuery
)
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
mustNot
(
QueryBuilders
.
existsQuery
(
"USE_ORG_CODE"
));
meBuilder
.
must
(
QueryBuilders
.
termQuery
(
"DATA_QUALITY_SCORE"
,
1
));
boolQuery
.
must
(
meBuilder
);
BoolQueryBuilder
meBuilder1
=
QueryBuilders
.
boolQuery
();
meBuilder1
.
should
(
QueryBuilders
.
matchQuery
(
"STATUS"
,
"已认领"
));
meBuilder1
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
existsQuery
(
"STATUS"
)));
meBuilder1
.
should
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchPhraseQuery
(
"STATUS"
,
""
)));
meBuilder1
.
minimumShouldMatch
(
1
);
boolQuery
.
must
(
meBuilder1
);
}
}
}
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