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
bc21d1b2
Commit
bc21d1b2
authored
Jul 08, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(综合搜索):增量数据同步调整
1.大编辑时,会触发重要提醒时的评分计算,在评分计算时,进行约束,只有目前实现的评分才会进行评分,否则设备等级会变为3级
parent
0bf213ef
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
123 additions
and
54 deletions
+123
-54
Constants.java
...ejoin/amos/boot/module/common/biz/constats/Constants.java
+4
-0
QualityScoreUpdateFactory.java
...g/biz/reminder/biz/factory/QualityScoreUpdateFactory.java
+12
-1
EquipOperationEventHandler.java
...inder/core/event/listener/EquipOperationEventHandler.java
+1
-1
DefaultQualityScoreUpdateService.java
.../core/event/service/DefaultQualityScoreUpdateService.java
+34
-0
IQualityScoreUpdate.java
.../biz/reminder/core/event/service/IQualityScoreUpdate.java
+1
-1
EquipQualityScoreUpdateService.java
...re/event/service/impl/EquipQualityScoreUpdateService.java
+41
-30
ProjectQualityScoreUpdateService.java
.../event/service/impl/ProjectQualityScoreUpdateService.java
+30
-21
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/constats/Constants.java
View file @
bc21d1b2
...
...
@@ -27,5 +27,9 @@ public class Constants {
public
static
final
Integer
REFRESH_STATUS_FAILURE
=
3
;
public
static
final
String
JG_EDIT_PROJECT
=
"JG_EDIT_PROJECT"
;
public
static
final
String
JG_EDIT_EQUIP
=
"JG_EDIT_EQUIP"
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/reminder/biz/factory/QualityScoreUpdateFactory.java
View file @
bc21d1b2
...
...
@@ -3,11 +3,14 @@ package com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.service.IQualityScoreUpdate
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
@Component
...
...
@@ -18,7 +21,7 @@ public class QualityScoreUpdateFactory {
private
final
Map
<
String
,
IQualityScoreUpdate
>
qualityScoreUpdaterMap
=
new
ConcurrentHashMap
<>();
p
ublic
IQualityScoreUpdate
getUpdater
(
EquipCreateOrEditEvent
.
EquipType
equipType
)
{
p
rivate
IQualityScoreUpdate
getUpdater
(
EquipCreateOrEditEvent
.
EquipType
equipType
)
{
return
qualityScoreUpdaterMap
.
computeIfAbsent
(
equipType
.
name
(),
(
k
)
->
{
for
(
IQualityScoreUpdate
qualityScoreUpdater
:
qualityScoreUpdaters
)
{
if
(
qualityScoreUpdater
.
support
(
equipType
))
{
...
...
@@ -28,4 +31,12 @@ public class QualityScoreUpdateFactory {
throw
new
BadRequest
(
"not found updater handler for "
+
equipType
.
name
());
});
}
@Async
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
EquipCreateOrEditEvent
.
EquipType
equipType
,
String
bizType
,
Set
<
String
>
recordOrPIds
)
{
IQualityScoreUpdate
qualityScoreUpdateHandler
=
getUpdater
(
equipType
);
qualityScoreUpdateHandler
.
doUpdate
(
bizType
,
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/listener/EquipOperationEventHandler.java
View file @
bc21d1b2
...
...
@@ -60,6 +60,6 @@ public class EquipOperationEventHandler {
private
void
processEvent
(
EquipCreateOrEditEvent
event
)
{
qualityScoreUpdateFactory
.
getUpdater
(
event
.
getEquipType
()).
update
(
event
.
getBizType
(),
event
.
getUpdatedIds
());
qualityScoreUpdateFactory
.
update
(
event
.
getEquipType
(),
event
.
getBizType
(),
event
.
getUpdatedIds
());
}
}
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
0 → 100644
View file @
bc21d1b2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
reminder
.
core
.
event
.
service
;
import
java.util.Set
;
public
abstract
class
DefaultQualityScoreUpdateService
implements
IQualityScoreUpdate
{
/**
* 前置处理-定义目前支持的业务类型,由于目前仅实现使用登记、新增设备、新增装置、大编辑设备、大编辑装置、安装告知准则,
* 所有都实现后返回true即可
* @param bizType 业务类型
* @return 是否通过前置检验
*/
protected
abstract
Boolean
preHandle
(
String
bizType
);
public
void
doUpdate
(
String
bizType
,
Set
<
String
>
recordOrPIds
)
{
if
(
preHandle
(
bizType
))
{
doHandle
(
bizType
,
recordOrPIds
);
}
afterHandle
(
recordOrPIds
);
}
/**
* 执行
* @param bizType 业务类型
* @param recordOrPIds 装置或者设备id集合
*/
protected
abstract
void
doHandle
(
String
bizType
,
Set
<
String
>
recordOrPIds
);
/**
* 事后处理
* @param recordOrPIds 装置或者设备id集合
*/
protected
abstract
void
afterHandle
(
Set
<
String
>
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/IQualityScoreUpdate.java
View file @
bc21d1b2
...
...
@@ -7,5 +7,5 @@ import java.util.Set;
public
interface
IQualityScoreUpdate
{
Boolean
support
(
EquipCreateOrEditEvent
.
EquipType
equipType
);
void
update
(
String
bizType
,
Set
<
String
>
biz
Ids
);
void
doUpdate
(
String
bizType
,
Set
<
String
>
recordOrP
Ids
);
}
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 @
bc21d1b2
...
...
@@ -5,13 +5,15 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.dto.ESEquipmentCategoryDto
;
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.service.impl.EquipmentCategoryService
;
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.biz.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.GradeStrategyFactory
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.service.
IQualityScoreUpdat
e
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.service.
DefaultQualityScoreUpdateServic
e
;
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.service.impl.IdxBizJgRegisterInfoServiceImpl
;
...
...
@@ -21,17 +23,14 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
@Component
@RequiredArgsConstructor
public
class
EquipQualityScoreUpdateService
implements
IQualityScoreUpdat
e
{
public
class
EquipQualityScoreUpdateService
extends
DefaultQualityScoreUpdateServic
e
{
private
final
ESEquipmentCategory
equipmentCategoryDao
;
...
...
@@ -55,32 +54,8 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
return
EquipCreateOrEditEvent
.
EquipType
.
equip
.
equals
(
equipType
);
}
@Async
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
String
bizType
,
Set
<
String
>
records
)
{
records
.
forEach
(
record
->
{
Optional
<
ESEquipmentCategoryDto
>
op
=
equipmentCategoryDao
.
findById
(
record
);
// 压力管道不进行管道登记的计算
if
(
op
.
isPresent
()
&&
op
.
get
().
getEQU_LIST_CODE
().
equals
(
EquipmentClassifityEnum
.
YLGD
.
getCode
()))
{
return
;
}
Integer
level
=
this
.
getReminderLevel
(
bizType
,
record
);
op
.
ifPresent
(
equipmentCategory
->
{
equipmentCategory
.
setDataQualityScore
(
level
);
equipmentCategoryService
.
saveWithImmediateRefresh
(
equipmentCategory
);
});
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getDataQualityScore
,
level
);
updateWrapper
.
set
(
TzsBaseEntity:
:
getRecDate
,
new
Date
());
idxBizJgUseInfoService
.
update
(
updateWrapper
);
});
// 事务提交后发送数据变更消息
this
.
sendDataRefreshMsgEquip
(
new
ArrayList
<>(
records
));
}
p
ublic
Integer
getReminderLevel
(
String
bizType
,
String
record
)
{
p
rivate
Integer
getReminderLevel
(
String
bizType
,
String
record
)
{
MatchItemDto
matchItemDto
=
MatchItemDto
.
builder
().
build
();
IdxBizJgUseInfo
useInfo
=
getIdxBizJgUseInfo
(
record
);
IdxBizJgRegisterInfo
registerInfo
=
getIdxBizJgRegisterInfo
(
record
);
...
...
@@ -119,4 +94,40 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
private
void
sendDataRefreshMsgEquip
(
List
<
String
>
records
)
{
eventPublisher
.
publish
(
new
DataRefreshEvent
(
this
,
records
,
DataRefreshEvent
.
DataType
.
equipment
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
}
@Override
protected
Boolean
preHandle
(
String
bizType
)
{
return
BusinessTypeEnum
.
JG_USAGE_REGISTRATION
.
name
().
equals
(
bizType
)
||
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
name
().
equals
(
bizType
)
||
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
().
equals
(
bizType
)
||
BusinessTypeEnum
.
JG_VEHICLE_GAS_APPLICATION
.
name
().
equals
(
bizType
)
||
Constants
.
JG_EDIT_EQUIP
.
equals
(
bizType
);
}
@Override
protected
void
doHandle
(
String
bizType
,
Set
<
String
>
recordOrPIds
)
{
recordOrPIds
.
forEach
(
record
->
{
Optional
<
ESEquipmentCategoryDto
>
op
=
equipmentCategoryDao
.
findById
(
record
);
// 压力管道不进行管道登记的计算
if
(
op
.
isPresent
()
&&
op
.
get
().
getEQU_LIST_CODE
().
equals
(
EquipmentClassifityEnum
.
YLGD
.
getCode
()))
{
return
;
}
Integer
level
=
this
.
getReminderLevel
(
bizType
,
record
);
op
.
ifPresent
(
equipmentCategory
->
{
equipmentCategory
.
setDataQualityScore
(
level
);
equipmentCategoryService
.
saveWithImmediateRefresh
(
equipmentCategory
);
});
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getDataQualityScore
,
level
);
updateWrapper
.
set
(
TzsBaseEntity:
:
getRecDate
,
new
Date
());
idxBizJgUseInfoService
.
update
(
updateWrapper
);
});
}
@Override
protected
void
afterHandle
(
Set
<
String
>
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 @
bc21d1b2
...
...
@@ -4,12 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
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.jg.api.dto.ReminderItemDto
;
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.reminder.biz.factory.GradeStrategyFactory
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.service.
IQualityScoreUpdat
e
;
import
com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.service.
DefaultQualityScoreUpdateServic
e
;
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.service.IIdxBizJgUseInfoService
;
...
...
@@ -19,9 +21,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Collections
;
import
java.util.Date
;
...
...
@@ -31,7 +31,7 @@ import java.util.stream.Collectors;
@Component
@RequiredArgsConstructor
public
class
ProjectQualityScoreUpdateService
implements
IQualityScoreUpdat
e
{
public
class
ProjectQualityScoreUpdateService
extends
DefaultQualityScoreUpdateServic
e
{
private
final
GradeStrategyFactory
gradeStrategyFactory
;
...
...
@@ -50,23 +50,7 @@ public class ProjectQualityScoreUpdateService implements IQualityScoreUpdate {
return
EquipCreateOrEditEvent
.
EquipType
.
project
.
equals
(
equipType
);
}
@Async
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
String
bizType
,
Set
<
String
>
projectContraptionIds
)
{
projectContraptionIds
.
forEach
(
projectContraptionId
->
{
Integer
level
=
this
.
getReminderLevel
(
bizType
,
projectContraptionId
);
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgProjectContraption:
:
getSequenceNbr
,
projectContraptionId
);
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getDataQualityScore
,
level
);
updateWrapper
.
set
(
BaseEntity:
:
getRecDate
,
new
Date
());
idxBizJgProjectContraptionService
.
update
(
updateWrapper
);
});
this
.
sendDataRefreshMsg
(
projectContraptionIds
);
}
public
Integer
getReminderLevel
(
String
bizType
,
String
projectContraptionId
)
{
private
Integer
getReminderLevel
(
String
bizType
,
String
projectContraptionId
)
{
IdxBizJgProjectContraption
projectContraption
=
idxBizJgProjectContraptionService
.
getById
(
projectContraptionId
);
MatchItemDto
matchItemDto
=
MatchItemDto
.
builder
().
build
();
matchItemDto
.
setBizType
(
bizType
);
...
...
@@ -94,4 +78,29 @@ public class ProjectQualityScoreUpdateService implements IQualityScoreUpdate {
.
select
(
IdxBizJgUseInfo:
:
getRecord
));
eventPublisher
.
publish
(
new
DataRefreshEvent
(
this
,
useInfos
.
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
Collectors
.
toList
()),
DataRefreshEvent
.
DataType
.
equipment
.
name
(),
DataRefreshEvent
.
Operation
.
UPDATE
));
}
@Override
protected
Boolean
preHandle
(
String
bizType
)
{
return
BusinessTypeEnum
.
JG_USAGE_REGISTRATION
.
name
().
equals
(
bizType
)
||
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
name
().
equals
(
bizType
)
||
BusinessTypeEnum
.
JG_NEW_PROJECT
.
name
().
equals
(
bizType
)
||
Constants
.
JG_EDIT_PROJECT
.
equals
(
bizType
);
}
@Override
protected
void
doHandle
(
String
bizType
,
Set
<
String
>
projectContraptionIds
)
{
projectContraptionIds
.
forEach
(
projectContraptionId
->
{
Integer
level
=
this
.
getReminderLevel
(
bizType
,
projectContraptionId
);
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgProjectContraption:
:
getSequenceNbr
,
projectContraptionId
);
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getDataQualityScore
,
level
);
updateWrapper
.
set
(
BaseEntity:
:
getRecDate
,
new
Date
());
idxBizJgProjectContraptionService
.
update
(
updateWrapper
);
});
}
@Override
protected
void
afterHandle
(
Set
<
String
>
projectContraptionIds
)
{
this
.
sendDataRefreshMsg
(
projectContraptionIds
);
}
}
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