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
0fde1e3f
Commit
0fde1e3f
authored
Feb 04, 2026
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(设备创建) :es双写优化
1.写es移动到最后执行
parent
4b7e4c6a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
20 deletions
+36
-20
JgChangeRegistrationReformServiceImpl.java
...z/service/impl/JgChangeRegistrationReformServiceImpl.java
+3
-1
JgChangeRegistrationTransferServiceImpl.java
...service/impl/JgChangeRegistrationTransferServiceImpl.java
+3
-1
JgEnableDisableServiceImpl.java
...odule/jg/biz/service/impl/JgEnableDisableServiceImpl.java
+3
-1
JgScrapCancelServiceImpl.java
.../module/jg/biz/service/impl/JgScrapCancelServiceImpl.java
+3
-1
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+17
-13
JgVehicleInformationServiceImpl.java
.../jg/biz/service/impl/JgVehicleInformationServiceImpl.java
+3
-1
InspectionResultProcessor.java
...biz/event/listener/service/InspectionResultProcessor.java
+2
-0
CommonServiceImpl.java
.../boot/module/jyjc/biz/service/impl/CommonServiceImpl.java
+2
-2
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/service/impl/JgChangeRegistrationReformServiceImpl.java
View file @
0fde1e3f
...
...
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -692,7 +693,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
esEquipmentCategoryDto
.
setUSC_UNIT_NAME
(
null
);
esEquipmentCategoryDto
.
setUSC_UNIT_CREDIT_CODE
(
null
);
});
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryDtos
);
esEquipmentCategory
.
saveAll
WithFallback
(
esEquipmentCategoryDtos
);
}
/**
...
...
@@ -924,6 +925,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@EnableEsRollback
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
...
...
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/JgChangeRegistrationTransferServiceImpl.java
View file @
0fde1e3f
...
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.ImmutableMap
;
import
com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldMapping
;
import
com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
...
...
@@ -499,6 +500,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*/
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@EnableEsRollback
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
...
...
@@ -888,7 +890,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
commonServiceImpl
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgChangeRegistrationTransfer
));
this
.
getBaseMapper
().
updateById
(
jgChangeRegistrationTransfer
);
if
(!
esEquipmentCategoryDtos
.
isEmpty
()){
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryDtos
);
esEquipmentCategory
.
saveAll
WithFallback
(
esEquipmentCategoryDtos
);
}
}
}
...
...
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/JgEnableDisableServiceImpl.java
View file @
0fde1e3f
...
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
...
...
@@ -569,6 +570,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
@Transactional
(
rollbackFor
=
Exception
.
class
)
@EnableEsRollback
public
void
flowExecute
(
JSONObject
map
,
ReginParams
reginParams
)
{
Long
id
=
map
.
getLong
(
"sequenceNbr"
);
String
instanceId
=
map
.
getString
(
"instanceId"
);
...
...
@@ -682,7 +684,7 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgEnableDisable
));
this
.
delRepeatUseEquipData
(
jgEnableDisable
);
if
(!
esEquipmentCategoryDtos
.
isEmpty
()){
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryDtos
);
esEquipmentCategory
.
saveAll
WithFallback
(
esEquipmentCategoryDtos
);
}
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
...
...
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/JgScrapCancelServiceImpl.java
View file @
0fde1e3f
...
...
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
...
...
@@ -1001,6 +1002,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
}
@EnableEsRollback
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
,
timeoutMills
=
600000
)
public
void
flowExecute
(
String
equList
,
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
...
...
@@ -1038,7 +1040,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgScrapCancel
));
this
.
delRepeatUseEquipData
(
jgScrapCancel
);
if
(!
esEquipmentCategoryDtos
.
isEmpty
()){
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryDtos
);
esEquipmentCategory
.
saveAll
WithFallback
(
esEquipmentCategoryDtos
);
}
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
...
...
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/JgUseRegistrationServiceImpl.java
View file @
0fde1e3f
...
...
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback
;
import
com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -629,6 +630,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@EnableEsRollback
public
List
<
Map
<
String
,
Object
>>
handleUseRegistration
(
JSONObject
map
)
{
try
{
String
equipId
=
Optional
.
ofNullable
(
Objects
.
toString
(
map
.
get
(
"equipId"
),
null
))
...
...
@@ -1395,6 +1397,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 更新设备信息 && 生成使用登记证编号 && 同步es
ESEquipmentCategoryDto
esData
=
this
.
processMapData
(
sequenceNbr
,
mapData
,
jgUseRegistration
,
jgRegistrationHistory
,
registerInfo
,
otherInfo
,
taskV2Model
,
jsonObject
,
flag
.
get
(),
useRegistrationCode
,
equipment
,
isMerge
);
// 压力管道时,
if
(
jgUseRegistration
.
getProjectContraptionId
()
!=
null
)
{
esData
.
setProjectContraptionId
(
jgUseRegistration
.
getProjectContraptionId
());
}
esEquipmentCategoryDtos
.
add
(
esData
);
// 查询设备制造信息
LambdaQueryWrapper
<
IdxBizJgFactoryInfo
>
factoryInfoWrapper
=
new
LambdaQueryWrapper
<>();
...
...
@@ -1443,7 +1449,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
commonServiceImpl
.
saveExecuteFlowData2Redis
(
jgUseRegistration
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
jgUseRegistration
));
// 循环结束后,统一批量更新ES
if
(!
esEquipmentCategoryDtos
.
isEmpty
())
{
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryDtos
);
esEquipmentCategory
.
saveAll
WithFallback
(
esEquipmentCategoryDtos
);
}
}
}
...
...
@@ -1532,12 +1538,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.
list
();
useInfoList
.
forEach
(
useInfo
->
{
esEquipmentCategory
.
findById
(
useInfo
.
getRecord
()).
ifPresent
(
equInfoEs
->
{
if
(
PipelineEnum
.
INDUSTRIAL_PIPELINE
.
getCode
().
equals
(
equInfoEs
.
getEQU_CATEGORY_CODE
()))
{
equInfoEs
.
setProjectContraptionId
(
jgUseRegistration
.
getProjectContraptionId
());
esEquipmentCategory
.
save
(
equInfoEs
);
}
});
useInfo
.
setProjectContraptionId
(
jgUseRegistration
.
getProjectContraptionId
());
useInfoMapper
.
updateById
(
useInfo
);
});
...
...
@@ -1885,7 +1885,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
commonServiceImpl
.
saveExecuteFlowData2Redis
(
jgUseRegistration
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
jgUseRegistration
));
// 更新es
ESEquipmentCategoryDto
esData
=
processMapData
(
sequenceNbr
,
mapData
,
jgUseRegistration
,
jgRegistrationHistory
,
registerInfo
,
otherInfo
,
taskV2Model
,
jsonObject
,
Boolean
.
FALSE
,
null
,
mapData
,
Boolean
.
FALSE
);
esEquipmentCategory
.
save
(
esData
);
esEquipmentCategory
.
save
WithFallback
(
esData
);
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_USAGE_REGISTRATION
.
name
(),
Sets
.
newHashSet
(
registerInfo
.
getRecord
()),
EquipCreateOrEditEvent
.
EquipType
.
equip
));
}
return
jgUseRegistration
;
...
...
@@ -2212,6 +2212,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
,
timeoutMills
=
6000000
)
@EnableEsRollback
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
carNumber
,
String
manageType
,
String
nextTaskId
,
JSONObject
jsonObject
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
...
...
@@ -3525,9 +3526,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
equInfoEs
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentCategory
.
save
(
equInfoEs
);
ESEquipmentInfo
esEquipmentInfo
=
esEquipmentDao
.
findById
(
v
.
getEquId
()).
get
();
esEquipmentInfo
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentDao
.
save
(
esEquipmentInfo
);
Optional
<
ESEquipmentInfo
>
esEquipmentInfoOp
=
esEquipmentDao
.
findById
(
v
.
getEquId
());
if
(
esEquipmentInfoOp
.
isPresent
()){
ESEquipmentInfo
esEquipmentInfo
=
esEquipmentInfoOp
.
get
();
esEquipmentInfo
.
setProjectContraptionId
(
v
.
getOriginProjectContraptionId
());
esEquipmentDao
.
save
(
esEquipmentInfo
);
}
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
String
.
valueOf
(
v
.
getEquId
()));
...
...
@@ -3926,7 +3930,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
esEquipmentCategoryDto
.
setUSC_UNIT_NAME
(
jgConstructionInfo
.
getUscUnitName
());
esEquipmentCategoryDto
.
setUSC_UNIT_CREDIT_CODE
(
jgConstructionInfo
.
getUscUnitCreditCode
());
}
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
esEquipmentCategory
.
save
WithFallback
(
esEquipmentCategoryDto
);
}
if
(
esEquipmentDaoOptional
.
isPresent
())
{
...
...
@@ -4586,7 +4590,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.
changeContent
(
BusinessTypeEnum
.
JG_HISTORY_USAGE_REGISTRATION
.
getName
()
+
"业务办理"
)
.
build
());
}
esEquipmentCategory
.
save
(
equipmentCategoryDto
);
esEquipmentCategory
.
save
WithFallback
(
equipmentCategoryDto
);
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
Sets
.
newHashSet
(
equipId
),
EquipCreateOrEditEvent
.
EquipType
.
equip
));
return
this
.
baseMapper
.
getDetailById
(
jgUseRegistration
.
getSequenceNbr
());
}
...
...
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/JgVehicleInformationServiceImpl.java
View file @
0fde1e3f
...
...
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldMapping
;
import
com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
...
...
@@ -1932,6 +1933,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@EnableEsRollback
public
List
<
JgVehicleInformation
>
saveOrUpdateHisData
(
JSONObject
map
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
()))
+
""
,
ReginParams
.
class
);
CompanyBo
company
=
reginParams
.
getCompany
();
...
...
@@ -2264,7 +2266,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
.
map
(
v
->
(
String
)
v
.
get
(
"record"
))
.
collect
(
Collectors
.
toSet
());
if
(!
esEquipmentCategoryDtos
.
isEmpty
()){
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryDtos
);
esEquipmentCategory
.
saveAll
WithFallback
(
esEquipmentCategoryDtos
);
}
eventPublisher
.
publish
(
new
EquipCreateOrEditEvent
(
this
,
BusinessTypeEnum
.
JG_NEW_EQUIP
.
name
(),
recordSet
,
EquipCreateOrEditEvent
.
EquipType
.
equip
));
return
Collections
.
singletonList
(
vehicleInformation
);
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/event/listener/service/InspectionResultProcessor.java
View file @
0fde1e3f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
event
.
listener
.
service
;
import
com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback
;
import
com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult
;
import
com.yeejoin.amos.boot.module.jyjc.biz.result.factory.ResultProcessorFactory
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -15,6 +16,7 @@ public class InspectionResultProcessor {
private
final
ResultProcessorFactory
resultProcessorFactory
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@EnableEsRollback
public
void
process
(
JyjcInspectionResult
jyjcInspectionResult
)
{
resultProcessorFactory
.
getProcessor
(
jyjcInspectionResult
.
getEquList
()).
process
(
jyjcInspectionResult
);
}
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/CommonServiceImpl.java
View file @
0fde1e3f
...
...
@@ -403,7 +403,7 @@ public class CommonServiceImpl {
if
(
nextInspectionDate
!=
null
)
{
Iterable
<
ESEquipmentCategoryDto
>
equipmentCategoryDtos
=
esEquipmentCategory
.
findAllById
(
records
);
equipmentCategoryDtos
.
forEach
(
esEquipmentCategoryDto
->
esEquipmentCategoryDto
.
setNEXT_INSPECT_DATE
(
nextInspectionDate
.
getTime
()));
esEquipmentCategory
.
saveAll
(
equipmentCategoryDtos
);
esEquipmentCategory
.
saveAll
WithFallback
(
equipmentCategoryDtos
);
}
}
...
...
@@ -419,7 +419,7 @@ public class CommonServiceImpl {
if
(
optional
.
isPresent
())
{
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setNEXT_INSPECT_DATE
(
nextInspectionDate
.
getTime
());
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
esEquipmentCategory
.
save
WithFallback
(
esEquipmentCategoryDto
);
}
}
}
...
...
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