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
7eaabac8
Commit
7eaabac8
authored
Mar 26, 2025
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):超设计使用年限作废功能开发
parent
3bdbe47b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
1 deletion
+122
-1
JgOverDesignServiceLifeController.java
.../jg/biz/controller/JgOverDesignServiceLifeController.java
+13
-1
JgOverDesignServiceLifeServiceImpl.java
.../biz/service/impl/JgOverDesignServiceLifeServiceImpl.java
+109
-0
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/controller/JgOverDesignServiceLifeController.java
View file @
7eaabac8
...
...
@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLife
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
...
...
@@ -152,4 +151,17 @@ public class JgOverDesignServiceLifeController extends BaseController {
String
.
valueOf
(
map
.
get
(
"equDefineCode"
)));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
/**
* 超设计使用年限作废
* @param dto
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"超设计使用年限作废"
,
notes
=
"超设计使用年限作废"
)
@PutMapping
(
value
=
"/invalid"
)
@RestEventTrigger
(
value
=
"operateLogRestEventHandler"
)
public
ResponseModel
<
JgOverDesignServiceLife
>
invalid
(
@RequestBody
JgOverDesignServiceLifeDto
dto
)
{
return
ResponseHelper
.
buildResponse
(
jgOverDesignServiceLifeServiceImpl
.
invalid
(
dto
.
getSequenceNbr
(),
dto
.
getCancelReason
()));
}
}
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/JgOverDesignServiceLifeServiceImpl.java
View file @
7eaabac8
...
...
@@ -26,6 +26,8 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgOverDesignServiceLifeServi
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.ICompensateFlowDataOfRedis
;
...
...
@@ -48,6 +50,8 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
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
;
...
...
@@ -115,6 +119,8 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private
InspectionDetectionInfoMapper
inspectionDetectionInfoMapper
;
@Autowired
private
SnowflakeIdUtil
sequence
;
@Autowired
private
EventPublisher
eventPublisher
;
/**
* 分页查询
...
...
@@ -855,4 +861,106 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
.
eq
(
JgRegistrationHistory:
:
getCurrentDocumentId
,
sequenceNbr
));
return
Boolean
.
TRUE
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
public
JgOverDesignServiceLife
invalid
(
Long
sequenceNbr
,
String
cancelReason
)
{
JgOverDesignServiceLife
overDesignServiceLife
=
this
.
getById
(
sequenceNbr
);
String
oldStatus
=
overDesignServiceLife
.
getStatus
();
overDesignServiceLife
.
setStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()));
overDesignServiceLife
.
setCancelReason
(
cancelReason
);
overDesignServiceLife
.
setCancelDate
(
new
Date
());
overDesignServiceLife
.
setCancelUserId
(
RequestContext
.
getExeUserId
());
overDesignServiceLife
.
setNextExecuteUserIds
(
null
);
overDesignServiceLife
.
setPromoter
(
null
);
this
.
updateById
(
overDesignServiceLife
);
// 2.更新关联的业务
this
.
processElseDataByStatus
(
Objects
.
requireNonNull
(
FlowStatusEnum
.
getEumByCode
(
Integer
.
parseInt
(
oldStatus
))),
overDesignServiceLife
);
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
eventPublisher
.
publish
(
new
CancellationEvent
(
this
,
getEquList
(
overDesignServiceLife
)));
}
});
return
overDesignServiceLife
;
}
private
List
<
String
>
getEquList
(
JgOverDesignServiceLife
overDesignServiceLife
)
{
return
jgOverDesignServiceLifeEqMapper
.
selectList
(
new
LambdaQueryWrapper
<
JgOverDesignServiceLifeEq
>()
.
eq
(
JgOverDesignServiceLifeEq:
:
getOverDesignId
,
overDesignServiceLife
.
getSequenceNbr
()))
.
stream
()
.
map
(
JgOverDesignServiceLifeEq:
:
getEquId
)
.
collect
(
toList
());
}
private
void
processElseDataByStatus
(
FlowStatusEnum
oldStatus
,
JgOverDesignServiceLife
overDesignServiceLife
)
{
switch
(
oldStatus
)
{
case
TO_BE_SUBMITTED:
commonService
.
deleteTasksByRelationId
(
overDesignServiceLife
.
getSequenceNbr
()
+
""
);
break
;
case
TO_BE_FINISHED:
this
.
delRepeatUseEquipData
(
overDesignServiceLife
);
this
.
recoverDesignInfoOfEquip
(
overDesignServiceLife
);
this
.
recoverUseRegistrationManage
(
overDesignServiceLife
);
break
;
default
:
this
.
finishedTask
(
overDesignServiceLife
);
cmWorkflowService
.
stopProcess
(
overDesignServiceLife
.
getInstanceId
(),
overDesignServiceLife
.
getCancelReason
());
this
.
delRepeatUseEquipData
(
overDesignServiceLife
);
}
}
private
void
recoverUseRegistrationManage
(
JgOverDesignServiceLife
overDesignServiceLife
)
{
List
<
String
>
useOrgCodes
=
jgOverDesignServiceLifeEqMapper
.
selectList
(
new
LambdaQueryWrapper
<
JgOverDesignServiceLifeEq
>()
.
eq
(
JgOverDesignServiceLifeEq:
:
getOverDesignId
,
overDesignServiceLife
.
getSequenceNbr
()))
.
stream
()
.
map
(
JgOverDesignServiceLifeEq:
:
getUseRegistrationCode
)
.
collect
(
Collectors
.
toList
());
if
(!
useOrgCodes
.
isEmpty
())
{
List
<
JgUseRegistrationManage
>
registrationList
=
useRegistrationManageService
.
lambdaQuery
()
.
in
(
JgUseRegistrationManage:
:
getUseRegistrationCode
,
useOrgCodes
)
.
list
();
if
(!
registrationList
.
isEmpty
())
{
useRegistrationManageService
.
updateBatchById
(
registrationList
.
stream
().
peek
(
v
->
{
v
.
setIsOverDesign
(
"0"
);
v
.
setVersion
(
v
.
getVersion
()
-
1
);
}).
collect
(
Collectors
.
toList
())
);
}
}
}
private
void
recoverDesignInfoOfEquip
(
JgOverDesignServiceLife
overDesignServiceLife
)
{
List
<
String
>
records
=
jgOverDesignServiceLifeEqMapper
.
selectList
(
new
LambdaQueryWrapper
<
JgOverDesignServiceLifeEq
>()
.
eq
(
JgOverDesignServiceLifeEq:
:
getOverDesignId
,
overDesignServiceLife
.
getSequenceNbr
()))
.
stream
()
.
map
(
JgOverDesignServiceLifeEq:
:
getEquId
)
.
collect
(
Collectors
.
toList
());
List
<
IdxBizJgDesignInfo
>
designInfoList
=
idxBizJgDesignInfoServiceImpl
.
checkOverDesignRegNum
(
records
);
designInfoList
.
forEach
(
designInfo
->
{
designInfo
.
setOverDesignRegNum
(
Math
.
max
(
designInfo
.
getOverDesignRegNum
()
-
1
,
0
));
designInfo
.
setDelayServiceLifeDate
(
""
);
jgResumeInfoService
.
deleteByBusinessId
(
String
.
valueOf
(
overDesignServiceLife
.
getSequenceNbr
()));
});
}
private
void
finishedTask
(
JgOverDesignServiceLife
overDesignServiceLife
)
{
HashMap
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
taskMap
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
taskMap
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
());
taskMap
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
taskMap
.
put
(
"relationId"
,
overDesignServiceLife
.
getInstanceId
());
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
overDesignServiceLife
.
setOtherAccessories
(
null
);
BeanUtils
.
copyProperties
(
overDesignServiceLife
,
taskMessageDto
);
this
.
setEquListForWorkSpace
(
overDesignServiceLife
,
taskMessageDto
);
taskMap
.
put
(
"model"
,
taskMessageDto
);
commonServiceImpl
.
updateTaskModel
(
taskMap
);
}
}
\ 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