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
d99fa404
Commit
d99fa404
authored
Sep 23, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.redis缓存的流程数据在事务回滚后可能和数据库数据不一致问题处理
parent
5f8aa960
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
16 deletions
+81
-16
ApplicationRunnerImpl.java
...n/amos/boot/module/jg/biz/init/ApplicationRunnerImpl.java
+14
-14
ICompensateFlowDataOfRedis.java
...oot/module/jg/biz/service/ICompensateFlowDataOfRedis.java
+31
-0
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+23
-1
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+13
-1
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/init/ApplicationRunnerImpl.java
View file @
d99fa404
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/ICompensateFlowDataOfRedis.java
0 → 100644
View file @
d99fa404
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
;
/**
* @author Administrator
* redis 数据补偿
*/
public
interface
ICompensateFlowDataOfRedis
<
T
>
{
/**
* 补偿redis数据
* @param t 参数
*/
default
void
doCompensate
(
T
t
)
{
if
(
beforeCheck
(
t
))
{
compensate
(
t
);
}
}
/**
* 补偿前校验
* @param t 参数
* @return 是否检验通过
*/
boolean
beforeCheck
(
T
t
);
/**
* 补偿实现
* @param t 参数
*/
void
compensate
(
T
t
);
}
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/JgInstallationNoticeServiceImpl.java
View file @
d99fa404
...
...
@@ -38,6 +38,7 @@ import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent;
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.service.ICmWorkflowService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil
;
...
...
@@ -98,7 +99,7 @@ import static com.alibaba.fastjson.JSON.parseArray;
*/
@Service
@Slf4j
public
class
JgInstallationNoticeServiceImpl
extends
BaseService
<
JgInstallationNoticeDto
,
JgInstallationNotice
,
JgInstallationNoticeMapper
>
implements
IJgInstallationNoticeService
{
public
class
JgInstallationNoticeServiceImpl
extends
BaseService
<
JgInstallationNoticeDto
,
JgInstallationNotice
,
JgInstallationNoticeMapper
>
implements
IJgInstallationNoticeService
,
ICompensateFlowDataOfRedis
<
JgInstallationNotice
>
{
private
static
final
String
SUBMIT_TYPE_FLOW
=
"1"
;
private
static
final
String
PROCESS_DEFINITION_KEY
=
"installationNotificationNew"
;
...
...
@@ -211,6 +212,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if
(
Objects
.
isNull
(
notice
))
{
return
null
;
}
// 流程数据补偿 防止redis缓存数据存在与数据库不一致问题
this
.
doCompensate
(
notice
);
Map
<
String
,
Object
>
installationInfo
=
BeanUtil
.
beanToMap
(
notice
,
false
,
true
);
installationInfo
.
put
(
"province"
,
notice
.
getProvince
()
+
"_"
+
notice
.
getProvinceName
());
...
...
@@ -312,6 +315,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
}
private
void
compensateFlowDataOfRedis
(
JgInstallationNotice
notice
)
{
if
(
notice
.
getInstanceId
()
!=
null
&&
!
notice
.
getNoticeStatus
().
equals
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()))
&&!
notice
.
getNoticeStatus
().
equals
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()))){
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
}
private
List
<
Map
<
String
,
Object
>>
getEquipListMaps
(
Iterable
<
ESEquipmentCategoryDto
>
equips
)
{
List
<
Map
<
String
,
Object
>>
arrayList
=
new
ArrayList
<>();
equips
.
forEach
(
equip
->
{
...
...
@@ -1726,4 +1736,15 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
jgInstallationNoticeEqService
.
updateBatchById
(
jgInstallationNoticeEqs
);
return
Boolean
.
TRUE
;
}
@Override
public
boolean
beforeCheck
(
JgInstallationNotice
notice
)
{
return
notice
.
getInstanceId
()
!=
null
&&
!
notice
.
getNoticeStatus
().
equals
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()))
&&!
notice
.
getNoticeStatus
().
equals
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()));
}
@Override
public
void
compensate
(
JgInstallationNotice
notice
)
{
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
}
\ 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/JgUseRegistrationServiceImpl.java
View file @
d99fa404
...
...
@@ -38,6 +38,7 @@ 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.WorkFlowFeignService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil
;
import
com.yeejoin.amos.boot.module.ymt.api.common.StringUtil
;
...
...
@@ -107,7 +108,7 @@ import static java.util.stream.Collectors.toList;
*/
@Service
@Slf4j
public
class
JgUseRegistrationServiceImpl
extends
BaseService
<
JgUseRegistrationDto
,
JgUseRegistration
,
JgUseRegistrationMapper
>
implements
IJgUseRegistrationService
{
public
class
JgUseRegistrationServiceImpl
extends
BaseService
<
JgUseRegistrationDto
,
JgUseRegistration
,
JgUseRegistrationMapper
>
implements
IJgUseRegistrationService
,
ICompensateFlowDataOfRedis
<
JgUseRegistration
>
{
private
static
final
String
DEFINITION_KEY
=
"useRegistration"
;
private
final
List
<
String
>
NOT_FLOWING_STATE
=
Arrays
.
asList
(
"使用单位待提交"
,
"一级受理已驳回"
,
"使用单位已撤回"
,
"已作废"
);
...
...
@@ -1685,6 +1686,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
public
Map
<
String
,
Object
>
getDetail
(
String
record
,
Long
sequenceNbr
)
{
if
(!
ObjectUtils
.
isEmpty
(
sequenceNbr
))
{
JgUseRegistration
jgUseRegistration
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
this
.
doCompensate
(
jgUseRegistration
);
LambdaQueryWrapper
<
JgRegistrationHistory
>
lambda
=
new
QueryWrapper
<
JgRegistrationHistory
>().
lambda
();
lambda
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
sequenceNbr
);
JgRegistrationHistory
jgRegistrationHistory
=
jgRegistrationHistoryService
.
getBaseMapper
().
selectOne
(
lambda
);
...
...
@@ -3360,4 +3362,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return
true
;
}
@Override
public
boolean
beforeCheck
(
JgUseRegistration
jgUseRegistration
)
{
return
jgUseRegistration
.
getInstanceId
()
!=
null
&&
!
jgUseRegistration
.
getStatus
().
equals
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
())
&&
!
jgUseRegistration
.
getStatus
().
equals
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
());
}
@Override
public
void
compensate
(
JgUseRegistration
jgUseRegistration
)
{
commonService
.
saveExecuteFlowData2Redis
(
jgUseRegistration
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
jgUseRegistration
));
}
}
\ No newline at end of file
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