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
f3eb5eb0
Commit
f3eb5eb0
authored
Feb 27, 2026
by
suhuiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_tzs_register' into develop_tzs_main
parents
af7b57bd
1f8a90fd
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
176 additions
and
55 deletions
+176
-55
EquipmentCategoryService.java
...ule/common/biz/service/impl/EquipmentCategoryService.java
+4
-3
BaseService.java
...com/yeejoin/amos/boot/module/jg/biz/core/BaseService.java
+27
-4
DefaultQualityScoreUpdateService.java
.../core/event/service/DefaultQualityScoreUpdateService.java
+24
-3
EquipQualityScoreUpdateService.java
...re/event/service/impl/EquipQualityScoreUpdateService.java
+45
-23
ProjectQualityScoreUpdateService.java
.../event/service/impl/ProjectQualityScoreUpdateService.java
+23
-17
EsBulkService.java
...n/amos/boot/module/jg/biz/service/impl/EsBulkService.java
+35
-0
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+0
-1
PersonIdentifyTzsAspect.java
...m/yeejoin/amos/patrol/config/PersonIdentifyTzsAspect.java
+2
-1
EquipWaitRefreshDataQualityScore.java
.../module/ymt/api/dto/EquipWaitRefreshDataQualityScore.java
+2
-0
IdxBizJgUseInfoMapper.java
...mos/boot/module/ymt/api/mapper/IdxBizJgUseInfoMapper.java
+1
-1
IdxBizJgUseInfoMapper.xml
...t-api/src/main/resources/mapper/IdxBizJgUseInfoMapper.xml
+13
-2
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/EquipmentCategoryService.java
View file @
f3eb5eb0
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl;
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl;
import
com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RequestOptions
;
...
@@ -11,9 +12,6 @@ import org.elasticsearch.index.query.QueryBuilders;
...
@@ -11,9 +12,6 @@ import org.elasticsearch.index.query.QueryBuilders;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.data.elasticsearch.core.ElasticsearchOperations
;
import
org.springframework.data.elasticsearch.core.ElasticsearchOperations
;
import
org.springframework.data.elasticsearch.core.SearchHits
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQuery
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -25,6 +23,7 @@ import static com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
...
@@ -25,6 +23,7 @@ import static com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
@Service
@Service
@RequiredArgsConstructor
@RequiredArgsConstructor
@Slf4j
public
class
EquipmentCategoryService
{
public
class
EquipmentCategoryService
{
private
final
ESEquipmentCategory
equipmentCategoryDao
;
private
final
ESEquipmentCategory
equipmentCategoryDao
;
...
@@ -55,4 +54,5 @@ public class EquipmentCategoryService {
...
@@ -55,4 +54,5 @@ public class EquipmentCategoryService {
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
}
}
\ 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/core/BaseService.java
View file @
f3eb5eb0
...
@@ -11,18 +11,32 @@ import com.baomidou.mybatisplus.core.toolkit.Assert;
...
@@ -11,18 +11,32 @@ import com.baomidou.mybatisplus.core.toolkit.Assert;
import
com.baomidou.mybatisplus.core.toolkit.ReflectionKit
;
import
com.baomidou.mybatisplus.core.toolkit.ReflectionKit
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableSet
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.function.Supplier
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
utils
.
ReflectiveFieldAccessor
.
getAllFields
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
utils
.
ReflectiveFieldAccessor
.
getAllFields
;
public
class
BaseService
<
M
extends
BaseMapper
<
T
>,
T
extends
TzsBaseEntity
>
extends
ServiceImpl
<
M
,
T
>
{
public
class
BaseService
<
M
extends
BaseMapper
<
T
>,
T
extends
TzsBaseEntity
>
extends
ServiceImpl
<
M
,
T
>
{
private
static
final
String
COLUMN_NAME_REC_DATE
=
"\"REC_DATE\""
;
private
static
final
String
COLUMN_NAME_REC_USER_ID
=
"\"REC_USER_ID\""
;
private
static
final
ImmutableSet
<
String
>
AUTO_FILL_FIELDS
=
ImmutableSet
.
of
(
COLUMN_NAME_REC_DATE
,
COLUMN_NAME_REC_USER_ID
);
private
static
final
ImmutableMap
<
String
,
Supplier
<
Object
>>
FIELD_PROCESSORS
=
ImmutableMap
.<
String
,
Supplier
<
Object
>>
builder
().
put
(
COLUMN_NAME_REC_DATE
,
Date:
:
new
).
put
(
COLUMN_NAME_REC_USER_ID
,
RequestContext:
:
getExeUserId
).
build
();
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveOrUpdateWithNull
(
T
entity
)
{
public
boolean
saveOrUpdateWithNull
(
T
entity
)
{
...
@@ -48,7 +62,7 @@ public class BaseService<M extends BaseMapper<T>, T extends TzsBaseEntity> exten
...
@@ -48,7 +62,7 @@ public class BaseService<M extends BaseMapper<T>, T extends TzsBaseEntity> exten
// 动态设置非空字段到 SET 语句
// 动态设置非空字段到 SET 语句
allFields
.
stream
().
filter
(
field
->
field
.
getAnnotation
(
TableField
.
class
)
!=
null
&&
field
.
getAnnotation
(
TableField
.
class
).
exist
()).
forEach
(
field
->
{
allFields
.
stream
().
filter
(
field
->
field
.
getAnnotation
(
TableField
.
class
)
!=
null
&&
field
.
getAnnotation
(
TableField
.
class
).
exist
()).
forEach
(
field
->
{
String
columnName
=
getColumnName
(
field
);
// 获取字段名(处理 @TableField 注解)
String
columnName
=
getColumnName
(
field
);
// 获取字段名(处理 @TableField 注解)
wrapper
.
set
(
columnName
,
getFieldValue
(
field
,
entity
));
wrapper
.
set
(
columnName
,
getFieldValue
(
columnName
,
field
,
entity
));
});
});
// 设置主键条件(确保主键在父类也能获取)
// 设置主键条件(确保主键在父类也能获取)
String
idColumn
=
getColumnName
(
getIdField
(
entity
.
getClass
()));
// 获取主键字段名
String
idColumn
=
getColumnName
(
getIdField
(
entity
.
getClass
()));
// 获取主键字段名
...
@@ -82,12 +96,21 @@ public class BaseService<M extends BaseMapper<T>, T extends TzsBaseEntity> exten
...
@@ -82,12 +96,21 @@ public class BaseService<M extends BaseMapper<T>, T extends TzsBaseEntity> exten
}
}
// 安全获取字段值
// 安全获取字段值
private
Object
getFieldValue
(
Field
field
,
Object
obj
)
{
private
Object
getFieldValue
(
String
columnName
,
Field
field
,
Object
obj
)
{
try
{
try
{
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
return
field
.
get
(
obj
);
Object
value
=
field
.
get
(
obj
);
// 特殊字段自动填充处理
String
upperColumnName
=
columnName
.
toUpperCase
();
if
(
value
==
null
&&
AUTO_FILL_FIELDS
.
contains
(
upperColumnName
))
{
Supplier
<
Object
>
processor
=
FIELD_PROCESSORS
.
get
(
upperColumnName
);
if
(
processor
!=
null
)
{
value
=
processor
.
get
();
}
}
return
value
;
}
catch
(
IllegalAccessException
e
)
{
}
catch
(
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
"获取字段值失败"
,
e
);
throw
new
RuntimeException
(
String
.
format
(
"获取字段[%s]值失败"
,
field
.
getName
())
,
e
);
}
}
}
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/reminder/core/event/service/DefaultQualityScoreUpdateService.java
View file @
f3eb5eb0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
reminder
.
core
.
event
.
service
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
reminder
.
core
.
event
.
service
;
import
cn.hutool.core.map.MapUtil
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
public
abstract
class
DefaultQualityScoreUpdateService
implements
IQualityScoreUpdate
{
public
abstract
class
DefaultQualityScoreUpdateService
implements
IQualityScoreUpdate
{
/**
/**
* 前置处理-定义目前支持的业务类型,由于目前仅实现使用登记、新增设备、新增装置、大编辑设备、大编辑装置、安装告知准则,
* 前置处理-定义目前支持的业务类型,由于目前仅实现使用登记、新增设备、新增装置、大编辑设备、大编辑装置、安装告知准则,
* 所有都实现后返回true即可
* 所有都实现后返回true即可
*
* @param bizType 业务类型
* @param bizType 业务类型
* @return 是否通过前置检验
* @return 是否通过前置检验
*/
*/
protected
abstract
Boolean
shouldProcess
(
String
bizType
);
protected
abstract
Boolean
shouldProcess
(
String
bizType
);
public
void
doUpdate
(
String
bizType
,
Set
<
String
>
recordOrPIds
)
{
public
void
doUpdate
(
String
bizType
,
Set
<
String
>
recordOrPIds
)
{
if
(
recordOrPIds
.
isEmpty
())
{
return
;
}
if
(
shouldProcess
(
bizType
))
{
if
(
shouldProcess
(
bizType
))
{
doHandle
(
bizType
,
recordOrPIds
);
doHandle
(
bizType
,
recordOrPIds
);
}
}
...
@@ -21,14 +31,25 @@ public abstract class DefaultQualityScoreUpdateService implements IQualityScoreU
...
@@ -21,14 +31,25 @@ public abstract class DefaultQualityScoreUpdateService implements IQualityScoreU
/**
/**
* 执行
* 执行
* @param bizType 业务类型
*
* @param bizType 业务类型
* @param recordOrPIds 装置或者设备id集合
* @param recordOrPIds 装置或者设备id集合
*/
*/
protected
abstract
void
doHandle
(
String
bizType
,
Set
<
String
>
recordOrPIds
);
protected
abstract
void
doHandle
(
String
bizType
,
Set
<
String
>
recordOrPIds
);
/**
/**
* 事后处理
* 事后处理
*
* @param recordOrPIds 装置或者设备id集合
* @param recordOrPIds 装置或者设备id集合
*/
*/
protected
abstract
void
afterHandle
(
Set
<
String
>
recordOrPIds
);
protected
abstract
void
afterHandle
(
Set
<
String
>
recordOrPIds
);
protected
Map
<
String
,
Map
<
String
,
Object
>>
buildUpdateFields
(
List
<
EquipWaitRefreshDataQualityScore
>
dataQualityScores
)
{
Map
<
String
,
Map
<
String
,
Object
>>
fieldMap
=
new
HashMap
<>();
dataQualityScores
.
forEach
(
dataQualityScore
->
{
fieldMap
.
put
(
dataQualityScore
.
getRecord
(),
MapUtil
.
of
(
"DATA_QUALITY_SCORE"
,
dataQualityScore
.
getDataQualityScore
()));
});
return
fieldMap
;
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/reminder/core/event/service/impl/EquipQualityScoreUpdateService.java
View file @
f3eb5eb0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
reminder
.
core
.
event
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
reminder
.
core
.
event
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.
baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.
google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.common.biz.constats.Constants
;
import
com.yeejoin.amos.boot.module.common.biz.constats.Constants
;
import
com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent
;
import
com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.EquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
...
@@ -16,25 +14,32 @@ import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEdit
...
@@ -16,25 +14,32 @@ import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEdit
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.service.DefaultQualityScoreUpdateService
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.service.DefaultQualityScoreUpdateService
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.dto.MatchItemDto
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.dto.MatchItemDto
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.service.CommonReminderService
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.service.CommonReminderService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.EsBulkService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StopWatch
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Component
@Component
@RequiredArgsConstructor
@RequiredArgsConstructor
@Slf4j
public
class
EquipQualityScoreUpdateService
extends
DefaultQualityScoreUpdateService
{
public
class
EquipQualityScoreUpdateService
extends
DefaultQualityScoreUpdateService
{
private
final
ESEquipmentCategory
equipmentCategoryDao
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
private
final
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
private
final
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
...
@@ -46,7 +51,7 @@ public class EquipQualityScoreUpdateService extends DefaultQualityScoreUpdateSer
...
@@ -46,7 +51,7 @@ public class EquipQualityScoreUpdateService extends DefaultQualityScoreUpdateSer
private
final
GradeStrategyFactory
gradeStrategyFactory
;
private
final
GradeStrategyFactory
gradeStrategyFactory
;
private
final
E
quipmentCategoryService
equipmentCategory
Service
;
private
final
E
sBulkService
esBulk
Service
;
private
final
EventPublisher
eventPublisher
;
private
final
EventPublisher
eventPublisher
;
...
@@ -113,28 +118,45 @@ public class EquipQualityScoreUpdateService extends DefaultQualityScoreUpdateSer
...
@@ -113,28 +118,45 @@ public class EquipQualityScoreUpdateService extends DefaultQualityScoreUpdateSer
@Override
@Override
protected
void
doHandle
(
String
bizType
,
Set
<
String
>
recordOrPIds
)
{
protected
void
doHandle
(
String
bizType
,
Set
<
String
>
recordOrPIds
)
{
recordOrPIds
.
forEach
(
record
->
{
if
(
recordOrPIds
.
isEmpty
())
{
Optional
<
ESEquipmentCategoryDto
>
op
=
equipmentCategoryDao
.
findById
(
record
);
return
;
// 压力管道不进行管道登记的计算
}
if
(
op
.
isPresent
()
&&
op
.
get
().
getEQU_LIST_CODE
().
equals
(
EquipmentClassifityEnum
.
YLGD
.
getCode
()))
{
StopWatch
watch
=
new
StopWatch
();
return
;
watch
.
start
();
List
<
IdxBizJgRegisterInfo
>
idxBizJgRegisterInfos
=
idxBizJgRegisterInfoService
.
list
(
new
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>().
in
(
IdxBizJgRegisterInfo:
:
getRecord
,
recordOrPIds
).
select
(
IdxBizJgRegisterInfo:
:
getRecord
,
IdxBizJgRegisterInfo:
:
getEquList
));
List
<
EquipWaitRefreshDataQualityScore
>
dataQualityScores
=
idxBizJgRegisterInfos
.
parallelStream
().
filter
(
r
->
!
EquipmentClassifityEnum
.
YLGD
.
getCode
().
equals
(
r
.
getEquList
())).
map
(
registerInfo
->
{
EquipWaitRefreshDataQualityScore
dataQualityScore
=
new
EquipWaitRefreshDataQualityScore
();
dataQualityScore
.
setRecord
(
registerInfo
.
getRecord
());
try
{
Integer
level
=
this
.
getReminderLevel
(
bizType
,
registerInfo
.
getRecord
());
dataQualityScore
.
setDataQualityScore
(
level
);
}
catch
(
Exception
e
)
{
log
.
error
(
"设备:「{}」,计算数据质量登记失败。"
,
registerInfo
.
getRecord
(),
e
);
dataQualityScore
.
setDataQualityScore
(
null
);
}
}
Integer
level
=
this
.
getReminderLevel
(
bizType
,
record
);
return
dataQualityScore
;
op
.
ifPresent
(
equipmentCategory
->
{
}).
collect
(
Collectors
.
toList
());
equipmentCategory
.
setDataQualityScore
(
level
);
if
(!
dataQualityScores
.
isEmpty
())
{
equipmentCategoryService
.
saveWithImmediateRefresh
(
equipmentCategory
);
// 分批数据库更新
Lists
.
partition
(
dataQualityScores
,
200
).
forEach
(
partitionData
->
{
try
{
idxBizJgUseInfoService
.
getBaseMapper
().
updateDataQualityScoreBatch
(
partitionData
,
null
);
// es更新
esBulkService
.
bulkUpdateFieldsByIds
(
this
.
buildUpdateFields
(
partitionData
),
TZSCommonConstant
.
ES_INDEX_NAME_JG_ALL
);
}
catch
(
Exception
e
)
{
log
.
error
(
"更新数据质量等级失败,数据为:「{}」"
,
partitionData
,
e
);
}
});
});
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
}
updateWrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
);
watch
.
stop
();
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getDataQualityScore
,
level
);
log
.
info
(
"计算数据质量等级数量:「{}」,耗时:「{}」"
,
dataQualityScores
.
size
(),
watch
.
getTotalTimeSeconds
());
updateWrapper
.
set
(
TzsBaseEntity:
:
getRecDate
,
new
Date
());
idxBizJgUseInfoService
.
update
(
updateWrapper
);
});
}
}
@Override
@Override
protected
void
afterHandle
(
Set
<
String
>
recordOrPIds
)
{
protected
void
afterHandle
(
Set
<
String
>
recordOrPIds
)
{
// 事务提交后发送数据变更消息
// 事务提交后发送数据变更消息
this
.
sendDataRefreshMsgEquip
(
new
ArrayList
<>(
recordOrPIds
));
this
.
sendDataRefreshMsgEquip
(
new
ArrayList
<>(
recordOrPIds
));
}
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/reminder/core/event/service/impl/ProjectQualityScoreUpdateService.java
View file @
f3eb5eb0
...
@@ -21,6 +21,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContrapti
...
@@ -21,6 +21,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContrapti
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -34,6 +35,7 @@ import java.util.stream.Collectors;
...
@@ -34,6 +35,7 @@ import java.util.stream.Collectors;
@Component
@Component
@RequiredArgsConstructor
@RequiredArgsConstructor
@Slf4j
public
class
ProjectQualityScoreUpdateService
extends
DefaultQualityScoreUpdateService
{
public
class
ProjectQualityScoreUpdateService
extends
DefaultQualityScoreUpdateService
{
...
@@ -101,24 +103,28 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
...
@@ -101,24 +103,28 @@ public class ProjectQualityScoreUpdateService extends DefaultQualityScoreUpdateS
@Override
@Override
protected
void
doHandle
(
String
bizType
,
Set
<
String
>
projectContraptionIds
)
{
protected
void
doHandle
(
String
bizType
,
Set
<
String
>
projectContraptionIds
)
{
projectContraptionIds
.
forEach
(
projectContraptionId
->
{
projectContraptionIds
.
forEach
(
projectContraptionId
->
{
Integer
level
=
this
.
getReminderLevel
(
bizType
,
projectContraptionId
);
try
{
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
Integer
level
=
this
.
getReminderLevel
(
bizType
,
projectContraptionId
);
updateWrapper
.
eq
(
IdxBizJgProjectContraption:
:
getSequenceNbr
,
projectContraptionId
);
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getDataQualityScore
,
level
);
updateWrapper
.
eq
(
IdxBizJgProjectContraption:
:
getSequenceNbr
,
projectContraptionId
);
updateWrapper
.
set
(
BaseEntity:
:
getRecDate
,
new
Date
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getDataQualityScore
,
level
);
idxBizJgProjectContraptionService
.
update
(
updateWrapper
);
updateWrapper
.
set
(
BaseEntity:
:
getRecDate
,
new
Date
());
// 更新管道的等级与装置一样
idxBizJgProjectContraptionService
.
update
(
updateWrapper
);
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper2
=
new
LambdaUpdateWrapper
<>();
// 更新管道的等级与装置一样
updateWrapper2
.
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
projectContraptionId
);
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper2
=
new
LambdaUpdateWrapper
<>();
updateWrapper2
.
set
(
IdxBizJgUseInfo:
:
getDataQualityScore
,
level
);
updateWrapper2
.
eq
(
IdxBizJgUseInfo:
:
getProjectContraptionId
,
projectContraptionId
);
idxBizJgUseInfoService
.
update
(
updateWrapper2
);
updateWrapper2
.
set
(
IdxBizJgUseInfo:
:
getDataQualityScore
,
level
);
idxBizJgUseInfoService
.
update
(
updateWrapper2
);
List
<
ESEquipmentCategoryDto
>
projectEquips
=
equipmentCategoryDao
.
findAllByProjectContraptionId
(
projectContraptionId
);
if
(!
ValidationUtil
.
isEmpty
(
projectEquips
))
{
List
<
ESEquipmentCategoryDto
>
projectEquips
=
equipmentCategoryDao
.
findAllByProjectContraptionId
(
projectContraptionId
);
for
(
ESEquipmentCategoryDto
esEquipmentCategoryDto
:
projectEquips
)
{
if
(!
ValidationUtil
.
isEmpty
(
projectEquips
))
{
esEquipmentCategoryDto
.
setDataQualityScore
(
level
);
for
(
ESEquipmentCategoryDto
esEquipmentCategoryDto
:
projectEquips
)
{
esEquipmentCategoryDto
.
setDataQualityScore
(
level
);
}
equipmentCategoryDao
.
saveAll
(
projectEquips
);
}
}
equipmentCategoryDao
.
saveAll
(
projectEquips
);
}
catch
(
Exception
e
)
{
log
.
error
(
"装置更新数据质量等级失败,装置 id为:「{}」"
,
projectContraptionId
,
e
);
}
}
});
});
}
}
...
...
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/EsBulkService.java
View file @
f3eb5eb0
...
@@ -3,13 +3,18 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
...
@@ -3,13 +3,18 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import
com.yeejoin.amos.boot.module.common.api.entity.EsEntity
;
import
com.yeejoin.amos.boot.module.common.api.entity.EsEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.elasticsearch.action.bulk.BulkItemResponse
;
import
org.elasticsearch.action.bulk.BulkRequest
;
import
org.elasticsearch.action.bulk.BulkRequest
;
import
org.elasticsearch.action.bulk.BulkResponse
;
import
org.elasticsearch.action.update.UpdateRequest
;
import
org.elasticsearch.action.update.UpdateRequest
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.common.xcontent.XContentType
;
import
org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter
;
import
org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -39,4 +44,34 @@ public class EsBulkService {
...
@@ -39,4 +44,34 @@ public class EsBulkService {
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
/**
* 批量更新指定索引中的文档字段
*
* @param documentIdFieldsMap key: 要更新的文档ID列表 ,value: 需要更新的字段映射(字段名 → 新值)
* @param targetIndex 目标索引名称
* @throws RuntimeException 当ES操作失败时抛出
*/
public
void
bulkUpdateFieldsByIds
(
Map
<
String
,
Map
<
String
,
Object
>>
documentIdFieldsMap
,
String
targetIndex
)
{
try
{
BulkRequest
bulkRequest
=
new
BulkRequest
();
documentIdFieldsMap
.
forEach
((
documentId
,
fieldsToUpdate
)
->
{
// 构建批量请求
UpdateRequest
updateRequest
=
new
UpdateRequest
(
targetIndex
,
documentId
).
doc
(
fieldsToUpdate
,
XContentType
.
JSON
);
bulkRequest
.
add
(
updateRequest
);
});
BulkResponse
response
=
restHighLevelClient
.
bulk
(
bulkRequest
,
RequestOptions
.
DEFAULT
);
// 更详细的错误日志记录
if
(
response
.
hasFailures
())
{
Arrays
.
stream
(
response
.
getItems
())
.
filter
(
BulkItemResponse:
:
isFailed
)
.
forEach
(
item
->
log
.
error
(
"Failed to update {}: {}"
,
item
.
getId
(),
item
.
getFailureMessage
()));
}
}
catch
(
IOException
e
)
{
log
.
error
(
"批量更新指定索引中的文档字段: batchSize={}, index={}"
,
documentIdFieldsMap
.
size
(),
targetIndex
,
e
);
}
}
}
}
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/IdxBizJgRegisterInfoServiceImpl.java
View file @
f3eb5eb0
...
@@ -3769,7 +3769,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -3769,7 +3769,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 使用信息
// 使用信息
useInfo
.
setRecord
(
record
);
useInfo
.
setRecord
(
record
);
useInfo
.
setRecDate
(
date
);
useInfo
.
setDataSource
(
dataSource
);
useInfo
.
setDataSource
(
dataSource
);
useInfo
.
setIsIntoManagement
(
Boolean
.
FALSE
);
useInfo
.
setIsIntoManagement
(
Boolean
.
FALSE
);
useInfo
.
setSequenceNbr
(
OPERATESAVE
.
equals
(
operateType
)
?
null
:
String
.
valueOf
(
equipmentInfoForm
.
get
(
"USEINFO_SEQ"
)));
useInfo
.
setSequenceNbr
(
OPERATESAVE
.
equals
(
operateType
)
?
null
:
String
.
valueOf
(
equipmentInfoForm
.
get
(
"USEINFO_SEQ"
)));
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/config/PersonIdentifyTzsAspect.java
View file @
f3eb5eb0
...
@@ -69,7 +69,8 @@ public class PersonIdentifyTzsAspect {
...
@@ -69,7 +69,8 @@ public class PersonIdentifyTzsAspect {
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
//电力默认走公司权限
//电力默认走公司权限
// if (!logic) {
// if (!logic) {
personIdentity
.
setBizOrgCode
(
StringUtils
.
isEmpty
(
reginParam
.
getCompany
().
getOrgCode
())
?
"-1"
:
reginParam
.
getCompany
().
getOrgCode
());
personIdentity
.
setBizOrgCode
(
StringUtils
.
isEmpty
(
reginParam
.
getCompany
().
getOrgCode
())
?
"-1"
:
reginParam
.
getCompany
().
getOrgCode
());
personIdentity
.
setCompanyBizOrgCode
(
StringUtils
.
isEmpty
(
reginParam
.
getCompany
().
getOrgCode
())
?
"-1"
:
reginParam
.
getCompany
().
getOrgCode
());
// }
// }
reginParam
.
setPersonIdentity
(
personIdentity
);
reginParam
.
setPersonIdentity
(
personIdentity
);
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/dto/EquipWaitRefreshDataQualityScore.java
View file @
f3eb5eb0
...
@@ -2,9 +2,11 @@ package com.yeejoin.amos.boot.module.ymt.api.dto;
...
@@ -2,9 +2,11 @@ package com.yeejoin.amos.boot.module.ymt.api.dto;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Data
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
public
class
EquipWaitRefreshDataQualityScore
{
public
class
EquipWaitRefreshDataQualityScore
{
private
String
record
;
private
String
record
;
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/IdxBizJgUseInfoMapper.java
View file @
f3eb5eb0
...
@@ -31,7 +31,7 @@ public interface IdxBizJgUseInfoMapper extends CustomBaseMapper<IdxBizJgUseInfo>
...
@@ -31,7 +31,7 @@ public interface IdxBizJgUseInfoMapper extends CustomBaseMapper<IdxBizJgUseInfo>
Integer
selectMaxVersionWithParams
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
Integer
selectMaxVersionWithParams
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
void
updateDataQualityScoreBatch
(
@Param
(
"equips"
)
List
<
EquipWaitRefreshDataQualityScore
>
refreshDataQualityScores
,
@Param
(
"version"
)
int
version
);
void
updateDataQualityScoreBatch
(
@Param
(
"equips"
)
List
<
EquipWaitRefreshDataQualityScore
>
refreshDataQualityScores
,
@Param
(
"version"
)
Integer
version
);
void
updateVersionBatch
(
@Param
(
"records"
)
List
<
String
>
records
,
@Param
(
"version"
)
int
version
);
void
updateVersionBatch
(
@Param
(
"records"
)
List
<
String
>
records
,
@Param
(
"version"
)
int
version
);
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/resources/mapper/IdxBizJgUseInfoMapper.xml
View file @
f3eb5eb0
...
@@ -9,10 +9,21 @@
...
@@ -9,10 +9,21 @@
</foreach>
</foreach>
</update>
</update>
<update
id=
"updateDataQualityScoreBatch"
>
<update
id=
"updateDataQualityScoreBatch"
>
<foreach
collection=
"equips"
separator=
";"
item=
"equip"
open=
""
close=
""
>
UPDATE idx_biz_jg_use_info SET
UPDATE idx_biz_jg_use_info SET "DATA_QUALITY_SCORE" = #{equip.dataQualityScore} , "VERSION"=#{version} WHERE record = #{equip.record}
"DATA_QUALITY_SCORE" = tmp."DATA_QUALITY_SCORE"
<if
test=
"version != null and version !=''"
>
, "VERSION"=#{version}
</if>
FROM (
<foreach
collection=
"equips"
item=
"equip"
separator=
"UNION ALL"
>
SELECT
#{equip.record} AS record,
#{equip.dataQualityScore} AS "DATA_QUALITY_SCORE"
</foreach>
</foreach>
) AS tmp
WHERE idx_biz_jg_use_info.record = tmp.record
</update>
</update>
<select
id=
"selectXAList"
resultType=
"com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo"
>
<select
id=
"selectXAList"
resultType=
"com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo"
>
select
select
u."SEQUENCE_NBR",
u."SEQUENCE_NBR",
...
...
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