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
b3e5cdc6
Commit
b3e5cdc6
authored
Sep 09, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.作废功能进行流程作废时,要判断设备是否有其他流程正常存在,如果有则设备的纳管状态依然为已纳管,且设备不可编辑;
2.作废流程后,设备没有任何流程数据时,变更设备纳管状态为未纳管;设备可以编辑。
parent
515cce39
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
382 additions
and
15 deletions
+382
-15
CommonMapper.java
.../yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
+7
-0
CommonMapper.xml
...-module-jg-api/src/main/resources/mapper/CommonMapper.xml
+145
-0
CancellationEvent.java
...join/amos/boot/module/jg/biz/event/CancellationEvent.java
+26
-0
CancellationEventListener.java
...dule/jg/biz/event/listener/CancellationEventListener.java
+97
-0
EventPublisher.java
...os/boot/module/jg/biz/event/publisher/EventPublisher.java
+24
-0
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+20
-4
JgMaintenanceContractServiceImpl.java
...jg/biz/service/impl/JgMaintenanceContractServiceImpl.java
+19
-0
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+24
-9
JgVehicleInformationServiceImpl.java
.../jg/biz/service/impl/JgVehicleInformationServiceImpl.java
+20
-2
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
View file @
b3e5cdc6
...
...
@@ -63,6 +63,13 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
*/
Integer
countEquipInUseTimesForDel
(
String
record
);
/**
* 统计设备被引用的次数(只有存在就算引用-作废除外)
* @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
Integer
countEquipInUseTimesWithOutZF
(
String
record
);
List
<
String
>
refreshTheDetailsDataOfCompletedUsageRegistration
(
String
since
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/CommonMapper.xml
View file @
b3e5cdc6
...
...
@@ -2248,4 +2248,149 @@
WHERE tjvi."USE_UNIT_CREDIT_CODE" = #{useCode}
AND tjvi.is_delete = '0'
</select>
<select
id=
"countEquipInUseTimesWithOutZF"
resultType=
"java.lang.Integer"
>
select
sum(inUseNumber)
from (
select
count(1) as inUseNumber
from
tzs_jg_use_registration a,
tzs_jg_use_registration_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and ( a.status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_reform a,
tzs_jg_change_registration_reform_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and ( a.audit_status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_transfer a,
tzs_jg_change_registration_transfer_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.audit_status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_registration_unit a,
tzs_jg_change_registration_unit_eq b
where
a.sequence_nbr = b.unit_change_registration_id
and b.equ_id = #{record}
and (a.status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_enable_disable a,
tzs_jg_enable_disable_eq b
where
a.sequence_nbr = b.enable_disable_apply_id
and b.equ_id = #{record}
and (a.audit_status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_equip_transfer a,
tzs_jg_equip_transfer_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.apply_status
<![CDATA[ <> ]]>
'6617')
UNION
select
count(1) as inUseNumber
from
tzs_jg_installation_notice a,
tzs_jg_installation_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status
<![CDATA[ <> ]]>
'6617')
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintain_notice a,
tzs_jg_maintain_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status
<![CDATA[ <> ]]>
'6617')
UNION
select
count(1) as inUseNumber
from
tzs_jg_maintenance_contract a,
tzs_jg_maintenance_contract_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_reform_notice a,
tzs_jg_reform_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.notice_status
<![CDATA[ <> ]]>
'6617')
UNION
select
count(1) as inUseNumber
from
tzs_jg_scrap_cancel a,
tzs_jg_scrap_cancel_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and (a.audit_status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_transfer_notice a,
tzs_jg_transfer_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and b.equ_id = #{record}
and ( a.notice_status
<![CDATA[ <> ]]>
'6617')
UNION
select
count(1) as inUseNumber
from
tzs_jg_vehicle_information a,
tzs_jg_vehicle_information_eq b
where
a.sequence_nbr = b.vehicle_id
and b.equ_id = #{record}
and (a.status
<![CDATA[ <> ]]>
'已作废')
UNION
select
count(1) as inUseNumber
from
tzs_jg_change_vehicle_registration_unit a,
tzs_jg_change_vehicle_registration_unit_eq b
where
a.sequence_nbr = b.unit_change_id
and b.equ_id = #{record}
and (a.status
<![CDATA[ <> ]]>
'已作废')
)
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/CancellationEvent.java
0 → 100644
View file @
b3e5cdc6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
;
import
lombok.Getter
;
import
org.springframework.context.ApplicationEvent
;
import
java.util.List
;
/**
* @author Administrator
*/
@Getter
public
class
CancellationEvent
extends
ApplicationEvent
{
private
List
<
String
>
records
;
/**
* Create a new {@code ApplicationEvent}.
*
* @param source the object on which the event initially occurred or with
* which the event is associated (never {@code null})
*/
public
CancellationEvent
(
Object
source
,
List
<
String
>
records
)
{
super
(
source
);
this
.
records
=
records
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/listener/CancellationEventListener.java
0 → 100644
View file @
b3e5cdc6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
listener
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
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.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
/**
* @author Administrator
*/
@Component
@Slf4j
public
class
CancellationEventListener
{
@Value
(
"${cancellation.deal.thread.number:1}"
)
private
int
threadNumber
;
private
CommonMapper
commonMapper
;
private
ESEquipmentCategory
esEquipmentCategoryDao
;
private
IdxBizJgUseInfoMapper
idxBizJgUseInfoMapper
;
private
BlockingQueue
<
String
>
queue
=
new
LinkedBlockingQueue
<>();
public
CancellationEventListener
(
CommonMapper
commonMapper
,
ESEquipmentCategory
esEquipmentCategoryDao
,
IdxBizJgUseInfoMapper
idxBizJgUseInfoMapper
)
{
this
.
commonMapper
=
commonMapper
;
this
.
esEquipmentCategoryDao
=
esEquipmentCategoryDao
;
this
.
idxBizJgUseInfoMapper
=
idxBizJgUseInfoMapper
;
}
@EventListener
(
value
=
CancellationEvent
.
class
)
public
void
handleTransactionalEvent
(
CancellationEvent
event
)
{
List
<
String
>
records
=
event
.
getRecords
();
log
.
info
(
"收到作废消息:{}"
,
JSONObject
.
toJSONString
(
records
));
queue
.
addAll
(
records
);
}
private
Boolean
checkEquipIsUsed
(
String
record
)
{
Integer
useTime
=
commonMapper
.
countEquipInUseTimesWithOutZF
(
record
);
return
useTime
<=
0
;
}
@PostConstruct
public
void
init
()
{
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
threadNumber
);
for
(
int
i
=
0
;
i
<
threadNumber
;
i
++)
{
executorService
.
execute
(()
->
{
while
(
true
)
{
try
{
String
record
=
queue
.
take
();
this
.
dealData
(
record
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
});
}
}
private
void
dealData
(
String
record
)
{
// 所有业务单据(除去作废状态单据),有在引用设备的则不修改设备纳管状态
Boolean
inUsed
=
this
.
checkEquipIsUsed
(
record
);
// 无引用则进行修改纳管状态为未纳管
if
(!
inUsed
)
{
// 更新已纳管为未纳管-数据库
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
false
);
idxBizJgUseInfoMapper
.
update
(
null
,
updateWrapper
);
// 更新已纳管为未纳管-es
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategoryDao
.
findById
(
record
);
if
(
optional
.
isPresent
())
{
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setIS_INTO_MANAGEMENT
(
false
);
esEquipmentCategoryDao
.
save
(
esEquipmentCategoryDto
);
}
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/publisher/EventPublisher.java
0 → 100644
View file @
b3e5cdc6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
publisher
;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
/**
* @author Administrator
*/
@Component
public
class
EventPublisher
{
private
ApplicationEventPublisher
publisher
;
public
EventPublisher
(
ApplicationEventPublisher
publisher
)
{
this
.
publisher
=
publisher
;
}
@Async
public
void
publish
(
ApplicationEvent
event
)
{
publisher
.
publishEvent
(
event
);
}
}
\ 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/JgInstallationNoticeServiceImpl.java
View file @
b3e5cdc6
...
...
@@ -32,6 +32,8 @@ import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
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.IIdxBizJgConstructionInfoService
;
...
...
@@ -65,6 +67,8 @@ import org.springframework.core.io.Resource;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
...
...
@@ -189,6 +193,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired
private
EquipTechParamPipelineMapper
equipTechParamPipelineMapper
;
@Autowired
EventPublisher
eventPublisher
;
/**
* 根据sequenceNbr查询
*
...
...
@@ -1051,11 +1058,15 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
* @param jgInstallationNotice 安装告知entry
*/
private
void
delRepeatUseEquipData
(
JgInstallationNotice
jgInstallationNotice
)
{
List
<
String
>
ids
=
getEquList
(
jgInstallationNotice
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_INSTALL_NOTICE_KEY
).
delDataForCheckEquipRepeatUsed
(
ids
,
jgInstallationNotice
.
getInstallUnitCreditCode
());
}
private
List
<
String
>
getEquList
(
JgInstallationNotice
jgInstallationNotice
)
{
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
List
<
JgInstallationNoticeEq
>
jgInstallationNoticeEqs
=
jgInstallationNoticeEqMapper
.
selectList
(
queryWrapper
);
List
<
String
>
ids
=
jgInstallationNoticeEqs
.
stream
().
map
(
item
->
item
.
getEquId
()).
collect
(
Collectors
.
toList
());
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_INSTALL_NOTICE_KEY
).
delDataForCheckEquipRepeatUsed
(
ids
,
jgInstallationNotice
.
getInstallUnitCreditCode
());
return
jgInstallationNoticeEqs
.
stream
().
map
(
JgInstallationNoticeEq:
:
getEquId
).
collect
(
Collectors
.
toList
());
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -1505,9 +1516,16 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
this
.
updateById
(
installationNotice
);
// 2.更新关联的业务
this
.
processElseDataByStatus
(
Objects
.
requireNonNull
(
FlowStatusEnum
.
getEumByCode
(
Integer
.
parseInt
(
oldNoticeStatus
))),
installationNotice
);
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
eventPublisher
.
publish
(
new
CancellationEvent
(
this
,
getEquList
(
installationNotice
)));
}
});
return
installationNotice
;
}
private
void
processElseDataByStatus
(
FlowStatusEnum
oldNoticeStatus
,
JgInstallationNotice
installationNotice
)
{
switch
(
oldNoticeStatus
)
{
case
TO_BE_SUBMITTED:
// 待提交
...
...
@@ -1568,7 +1586,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
updateWrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
// 设置更新条件
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getUseUnitCreditCode
,
null
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getUseUnitName
,
null
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
Boolean
.
FALSE
);
useInfoService
.
update
(
updateWrapper
);
// 2.2 es的USE_UNIT_CREDIT_CODE赋空
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
jgRelationEquip
.
getEquId
());
...
...
@@ -1576,7 +1593,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setUSE_UNIT_CREDIT_CODE
(
null
);
esEquipmentCategoryDto
.
setUSE_UNIT_NAME
(
null
);
esEquipmentCategoryDto
.
setIS_INTO_MANAGEMENT
(
Boolean
.
FALSE
);
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
});
...
...
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/JgMaintenanceContractServiceImpl.java
View file @
b3e5cdc6
...
...
@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.*;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContractEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
...
...
@@ -26,6 +27,8 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgMaintenanceContractService
import
com.yeejoin.amos.boot.module.jg.api.vo.JgMaintenanceContractVo
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
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.IIdxBizJgUseInfoService
;
...
...
@@ -47,6 +50,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
...
...
@@ -108,6 +113,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
@Autowired
IIdxBizJgUseInfoService
useInfoService
;
@Autowired
EventPublisher
eventPublisher
;
/**
* 分页查询
*/
...
...
@@ -239,6 +247,11 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
}
}
private
List
<
String
>
getEquList
(
Long
id
)
{
List
<
JgMaintenanceContractEq
>
list
=
jgMaintenanceContractEqService
.
lambdaQuery
().
eq
(
JgMaintenanceContractEq:
:
getEquipTransferId
,
id
).
list
();
return
list
.
stream
().
map
(
JgMaintenanceContractEq:
:
getEquId
).
collect
(
Collectors
.
toList
());
}
private
void
delRepeatUseEquipData
(
Long
id
,
String
companyCode
)
{
List
<
JgMaintenanceContractEq
>
list
=
jgMaintenanceContractEqService
.
lambdaQuery
().
eq
(
JgMaintenanceContractEq:
:
getEquipTransferId
,
id
).
list
();
// 获取单位变更设备列表
...
...
@@ -796,6 +809,12 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
maintenanceContract
.
setPromoter
(
null
);
this
.
updateById
(
maintenanceContract
);
this
.
processElseDataByStatus
(
this
.
confirmBusinessPhase
(
oldNoticeStatus
),
maintenanceContract
);
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
eventPublisher
.
publish
(
new
CancellationEvent
(
this
,
getEquList
(
maintenanceContract
.
getSequenceNbr
())));
}
});
return
maintenanceContract
;
}
...
...
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 @
b3e5cdc6
...
...
@@ -33,6 +33,8 @@ import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
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.feign.WorkFlowFeignService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
...
...
@@ -62,7 +64,12 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.TransactionManager
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.event.TransactionalEventListener
;
import
org.springframework.transaction.reactive.TransactionalOperator
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
...
@@ -131,6 +138,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
EquipTechParamPipelineMapper
equipTechParamPipelineMapper
;
@Autowired
EventPublisher
eventPublisher
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
String
[]
jsonFields
=
{
"productPhoto"
,
"factoryStandard"
,
"productQualityYieldProve"
,
"insUseMaintainExplain"
,
"inspectReport"
,
"designStandard"
,
"designDoc"
,
"longitudeLatitude"
,
"otherAccessoriesDes"
,
"otherAccessoriesFact"
,
...
...
@@ -2346,6 +2356,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
this
.
updateById
(
jgUseRegistration
);
// 2.更新关联的业务
processElseDataByStatus
(
oldStatus
,
jgUseRegistration
);
List
<
JgUseRegistrationEq
>
eqList
=
getJgUseRegistrationEqs
(
jgUseRegistration
);
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
eventPublisher
.
publish
(
new
CancellationEvent
(
this
,
eqList
.
stream
().
map
(
JgUseRegistrationEq:
:
getEquId
).
collect
(
Collectors
.
toList
())));
}
});
return
jgUseRegistration
;
}
...
...
@@ -2376,8 +2393,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
private
void
clearUseInfoOfEquip
(
JgUseRegistration
jgUseRegistration
)
{
LambdaQueryWrapper
<
JgUseRegistrationEq
>
eqLambdaQueryWrapper
=
new
LambdaQueryWrapper
<
JgUseRegistrationEq
>().
eq
(
JgUseRegistrationEq:
:
getEquipTransferId
,
jgUseRegistration
.
getSequenceNbr
());
List
<
JgUseRegistrationEq
>
eqList
=
jgRelationEquipMapper
.
selectList
(
eqLambdaQueryWrapper
);
List
<
JgUseRegistrationEq
>
eqList
=
getJgUseRegistrationEqs
(
jgUseRegistration
);
eqList
.
forEach
(
e
->
{
String
record
=
e
.
getEquId
();
Boolean
flag
=
Boolean
.
FALSE
;
...
...
@@ -2404,6 +2420,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
});
}
private
List
<
JgUseRegistrationEq
>
getJgUseRegistrationEqs
(
JgUseRegistration
jgUseRegistration
)
{
LambdaQueryWrapper
<
JgUseRegistrationEq
>
eqLambdaQueryWrapper
=
new
LambdaQueryWrapper
<
JgUseRegistrationEq
>().
eq
(
JgUseRegistrationEq:
:
getEquipTransferId
,
jgUseRegistration
.
getSequenceNbr
());
return
jgRelationEquipMapper
.
selectList
(
eqLambdaQueryWrapper
);
}
private
void
rollBackForEquipEsInfo
(
String
record
,
Boolean
flag
)
{
LambdaQueryWrapper
<
IdxBizJgConstructionInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
select
(
IdxBizJgConstructionInfo:
:
getUscUnitCreditCode
,
...
...
@@ -2425,13 +2446,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if
(
jgConstructionInfo
!=
null
){
esEquipmentCategoryDto
.
setUSC_UNIT_NAME
(
jgConstructionInfo
.
getUscUnitName
());
esEquipmentCategoryDto
.
setUSC_UNIT_CREDIT_CODE
(
jgConstructionInfo
.
getUscUnitCreditCode
());
}
if
(
flag
)
{
esEquipmentCategoryDto
.
setIS_INTO_MANAGEMENT
(
Boolean
.
FALSE
);
}
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
}
}
/**
* 作废使用登记证 & 生成使用登记证的流水
...
...
@@ -2514,9 +2532,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getSafetyManagerId
,
null
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getSafetyManager
,
null
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getFactoryUseSiteStreet
,
null
);
if
(
flag
)
{
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
Boolean
.
FALSE
);
}
useInfoMapper
.
update
(
null
,
updateWrapper
);
}
...
...
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 @
b3e5cdc6
...
...
@@ -31,6 +31,8 @@ import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
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.feign.WorkFlowFeignService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService
;
...
...
@@ -61,6 +63,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
...
...
@@ -164,6 +168,9 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
private
Map
<
String
,
Object
>
fillingMediumMap
;
@Autowired
EventPublisher
eventPublisher
;
/**
* @param auditPassDate 通过时间
* @param exportParamsMap 参数map
...
...
@@ -444,6 +451,13 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}
}
private
List
<
String
>
getEquList
(
JgVehicleInformation
notice
)
{
LambdaQueryWrapper
<
JgVehicleInformationEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgVehicleInformationEq:
:
getVehicleId
,
notice
.
getSequenceNbr
());
List
<
JgVehicleInformationEq
>
noticeEqList
=
jgVehicleInformationEqService
.
list
(
queryWrapper
);
return
noticeEqList
.
stream
().
map
(
JgVehicleInformationEq:
:
getEquId
).
collect
(
Collectors
.
toList
());
}
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
DEFINITION_KEY
)
...
...
@@ -1343,6 +1357,12 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
this
.
updateById
(
vehicleInformation
);
// 2.更新关联的业务
processElseDataByStatus
(
oldStatus
,
vehicleInformation
);
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
eventPublisher
.
publish
(
new
CancellationEvent
(
this
,
getEquList
(
vehicleInformation
)));
}
});
return
vehicleInformation
;
}
...
...
@@ -1451,7 +1471,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
esEquipmentCategoryDto
.
setEQU_STATE
(
null
);
esEquipmentCategoryDto
.
setORG_BRANCH_CODE
(
null
);
esEquipmentCategoryDto
.
setORG_BRANCH_NAME
(
null
);
esEquipmentCategoryDto
.
setIS_INTO_MANAGEMENT
(
Boolean
.
FALSE
);
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
}
...
...
@@ -1495,7 +1514,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getSafetyManagerId
,
null
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getSafetyManager
,
null
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getFactoryUseSiteStreet
,
null
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getIsIntoManagement
,
Boolean
.
FALSE
);
useInfoMapper
.
update
(
null
,
updateWrapper
);
}
...
...
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