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
a26d1289
Commit
a26d1289
authored
Mar 13, 2024
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登记类修改并发问题
parent
e32392c0
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
450 additions
and
131 deletions
+450
-131
IJgChangeRegistrationReformService.java
...le/jg/api/service/IJgChangeRegistrationReformService.java
+3
-3
IJgChangeRegistrationTransferService.java
.../jg/api/service/IJgChangeRegistrationTransferService.java
+2
-2
JgChangeRegistrationNameController.java
...jg/biz/controller/JgChangeRegistrationNameController.java
+15
-19
JgChangeRegistrationReformController.java
.../biz/controller/JgChangeRegistrationReformController.java
+6
-2
JgChangeRegistrationTransferController.java
...iz/controller/JgChangeRegistrationTransferController.java
+17
-24
JgEnableDisableController.java
...t/module/jg/biz/controller/JgEnableDisableController.java
+12
-13
JgMaintenanceContractController.java
...le/jg/biz/controller/JgMaintenanceContractController.java
+7
-2
JgScrapCancelController.java
...oot/module/jg/biz/controller/JgScrapCancelController.java
+7
-2
JgChangeRegistrationNameServiceImpl.java
...biz/service/impl/JgChangeRegistrationNameServiceImpl.java
+10
-4
JgChangeRegistrationReformServiceImpl.java
...z/service/impl/JgChangeRegistrationReformServiceImpl.java
+62
-11
JgChangeRegistrationTransferServiceImpl.java
...service/impl/JgChangeRegistrationTransferServiceImpl.java
+60
-14
JgChangeRegistrationUnitServiceImpl.java
...biz/service/impl/JgChangeRegistrationUnitServiceImpl.java
+68
-16
JgEnableDisableServiceImpl.java
...odule/jg/biz/service/impl/JgEnableDisableServiceImpl.java
+58
-6
JgMaintenanceContractServiceImpl.java
...jg/biz/service/impl/JgMaintenanceContractServiceImpl.java
+59
-6
JgScrapCancelServiceImpl.java
.../module/jg/biz/service/impl/JgScrapCancelServiceImpl.java
+59
-6
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+5
-1
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/service/IJgChangeRegistrationReformService.java
View file @
a26d1289
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationReformDto
;
...
...
@@ -50,14 +49,15 @@ public interface IJgChangeRegistrationReformService {
* @param instanceId
* @param operate
* @param comment
* @param nextTaskId 页面上送下一任务id
*/
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
);
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
);
/**
* @deprecated 根据流程id执行撤回操作
* @param instanceId
*/
void
withdraw
(
String
instanceId
);
void
withdraw
(
String
instanceId
,
String
nextTaskId
);
/**
* @deprecated 根据id批量删除数据
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgChangeRegistrationTransferService.java
View file @
a26d1289
...
...
@@ -30,9 +30,9 @@ public interface IJgChangeRegistrationTransferService extends IService<JgChangeR
Page
<
Map
<
String
,
Object
>>
queryListForPage
(
Page
<
Map
<
String
,
Object
>>
page
,
JgChangeRegistrationTransferDto
params
,
String
companyTypeCode
,
String
companyType
);
void
flowExecute
(
Long
sequenceNbr
,
String
instanceId
,
String
operate
,
String
comment
);
void
flowExecute
(
Long
sequenceNbr
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
);
void
revocation
(
String
instanceId
);
void
revocation
(
String
instanceId
,
String
nextTaskId
);
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
,
String
printType
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationNameController.java
View file @
a26d1289
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.*
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.*
;
/**
* 更名变更登记
...
...
@@ -100,7 +92,11 @@ public class JgChangeRegistrationNameController extends BaseController {
LinkedHashMap
jgRegistrationInfoMap
=
(
LinkedHashMap
)
model1
.
get
(
"jgRegistrationInfo"
);
JgChangeRegistrationNameDto
jgScrapCancelDto
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
jgRegistrationInfoMap
),
JgChangeRegistrationNameDto
.
class
);
jgChangeRegistrationNameService
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
jgScrapCancelDto
.
getSequenceNbr
())),
jgScrapCancelDto
.
getInstanceId
(),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"opinion"
)));
jgChangeRegistrationNameService
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
jgScrapCancelDto
.
getSequenceNbr
())),
jgScrapCancelDto
.
getInstanceId
(),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"nextTaskId"
)));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationReformController.java
View file @
a26d1289
...
...
@@ -49,14 +49,18 @@ public class JgChangeRegistrationReformController extends BaseController {
@PostMapping
(
value
=
"/flowExecute"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"执行流程"
,
notes
=
"执行流程"
)
public
ResponseModel
<
Object
>
flowExecute
(
@RequestBody
JSONObject
map
)
{
jgChangeRegistrationReformServiceImpl
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))),
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"comment"
)));
jgChangeRegistrationReformServiceImpl
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))),
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"comment"
)),
String
.
valueOf
(
map
.
get
(
"nextTaskId"
)));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/withdraw"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"撤回"
,
notes
=
"撤回"
)
public
ResponseModel
<
Object
>
withdraw
(
@RequestBody
JSONObject
map
)
{
jgChangeRegistrationReformServiceImpl
.
withdraw
(
String
.
valueOf
(
map
.
get
(
"instanceId"
)));
jgChangeRegistrationReformServiceImpl
.
withdraw
(
String
.
valueOf
(
map
.
get
(
"instanceId"
))
,
String
.
valueOf
(
map
.
get
(
"nextTaskId"
))
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationTransferController.java
View file @
a26d1289
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.
netflix.ribbon.proxy.annotation.Http
;
import
com.
baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.io.BufferedOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.util.Map
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
java.util.Map
;
/**
* 移装变更登记登记
...
...
@@ -100,7 +88,11 @@ public class JgChangeRegistrationTransferController extends BaseController {
@PostMapping
(
value
=
"/flowExecute"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"执行流程"
,
notes
=
"执行流程"
)
public
ResponseModel
<
Object
>
flowExecute
(
@RequestBody
JSONObject
map
)
{
jgChangeRegistrationTransferService
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))),
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"opinion"
)));
jgChangeRegistrationTransferService
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))),
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"nextTaskId"
)));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
@@ -108,7 +100,8 @@ public class JgChangeRegistrationTransferController extends BaseController {
@PostMapping
(
value
=
"/revocation"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"撤回"
,
notes
=
"撤回"
)
public
ResponseModel
<
Object
>
revocation
(
@RequestBody
JSONObject
map
)
{
jgChangeRegistrationTransferService
.
revocation
(
String
.
valueOf
(
map
.
get
(
"instanceId"
)));
jgChangeRegistrationTransferService
.
revocation
(
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"nextTaskId"
)));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgEnableDisableController.java
View file @
a26d1289
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEnableDisableServiceImpl
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Map
;
/**
* @author system_generator
...
...
@@ -74,7 +73,7 @@ public class JgEnableDisableController extends BaseController {
@PostMapping
(
value
=
"/withdraw"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"撤回"
,
notes
=
"撤回"
)
public
ResponseModel
<
Object
>
withdraw
(
@RequestBody
JSONObject
map
)
{
jgEnableDisableServiceImpl
.
withdraw
(
String
.
valueOf
(
map
.
get
(
"instanceId"
)));
jgEnableDisableServiceImpl
.
withdraw
(
String
.
valueOf
(
map
.
get
(
"instanceId"
))
,
String
.
valueOf
(
map
.
get
(
"nextTaskId"
))
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgMaintenanceContractController.java
View file @
a26d1289
...
...
@@ -65,7 +65,7 @@ public class JgMaintenanceContractController extends BaseController {
@PostMapping
(
value
=
"/revocation"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"维保合同撤回"
,
notes
=
"维保合同撤回"
)
public
ResponseModel
<
Object
>
revocation
(
@RequestBody
JSONObject
map
)
{
jgMaintenanceContractServiceImpl
.
revocation
(
String
.
valueOf
(
map
.
get
(
"instanceId"
)));
jgMaintenanceContractServiceImpl
.
revocation
(
String
.
valueOf
(
map
.
get
(
"instanceId"
))
,
String
.
valueOf
(
map
.
get
(
"nextTaskId"
))
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
@@ -129,7 +129,12 @@ public class JgMaintenanceContractController extends BaseController {
@PostMapping
(
value
=
"/flowExecute"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"执行流程"
,
notes
=
"执行流程"
)
public
ResponseModel
<
Object
>
flowExecute
(
@RequestBody
JSONObject
map
)
{
jgMaintenanceContractServiceImpl
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))),
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"comment"
)),
true
);
jgMaintenanceContractServiceImpl
.
flowExecute
(
Long
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
))),
String
.
valueOf
(
map
.
get
(
"instanceId"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"comment"
)),
true
,
String
.
valueOf
(
map
.
get
(
"nextTaskId"
)));
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
map
.
containsKey
(
"formData"
)
&&
!
ObjectUtils
.
isEmpty
(
map
.
get
(
"formData"
))){
JgMaintenanceContract
dto
=
new
JgMaintenanceContract
();
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgScrapCancelController.java
View file @
a26d1289
...
...
@@ -78,7 +78,12 @@ public class JgScrapCancelController extends BaseController {
jgScrapCancelInfo
.
remove
(
"SEQUENCE_NBR"
);
JgScrapCancelDto
jgScrapCancelDto
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
jgScrapCancelInfo
),
JgScrapCancelDto
.
class
);
jgScrapCancelService
.
flowExecute
(
jgScrapCancelDto
.
getEquList
(),
Long
.
valueOf
(
String
.
valueOf
(
jgScrapCancelDto
.
getSequenceNbr
())),
jgScrapCancelDto
.
getInstanceId
(),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"opinion"
)));
jgScrapCancelService
.
flowExecute
(
jgScrapCancelDto
.
getEquList
(),
Long
.
valueOf
(
String
.
valueOf
(
jgScrapCancelDto
.
getSequenceNbr
())),
jgScrapCancelDto
.
getInstanceId
(),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"operate"
)),
String
.
valueOf
(
map
.
get
(
"nextTaskId"
)));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
@@ -135,7 +140,7 @@ public class JgScrapCancelController extends BaseController {
@PostMapping
(
value
=
"/withdraw"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"撤回"
,
notes
=
"撤回"
)
public
ResponseModel
<
Object
>
revocation
(
@RequestBody
JSONObject
map
)
{
jgScrapCancelService
.
revocation
(
String
.
valueOf
(
map
.
get
(
"instanceId"
)));
jgScrapCancelService
.
revocation
(
String
.
valueOf
(
map
.
get
(
"instanceId"
))
,
String
.
valueOf
(
map
.
get
(
"nextTaskId"
))
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
...
...
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/JgChangeRegistrationNameServiceImpl.java
View file @
a26d1289
...
...
@@ -494,6 +494,9 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
// 判断撤回后当前的节点,如果当前节点为提交节点则页面可编辑
jsonObject
.
put
(
"pageType"
,
this
.
getPageTypeByCurrentNode
(
jgChangeRegistrationName
.
getAuditStatus
()));
commonService
.
rollbackTask
(
instanceId
,
jsonObject
);
// 保存redis最新流程数据
commonService
.
saveExecuteFlowData2Redis
(
jgChangeRegistrationName
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
jgChangeRegistrationName
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
@@ -518,19 +521,20 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
}
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
)
{
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
();
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForExecuteFlow
(
nextTaskId
,
instanceId
);
JgChangeRegistrationName
jgChangeRegistrationName
=
this
.
getBaseMapper
().
selectById
(
id
);
String
taskId
=
jgChangeRegistrationName
.
getNextTaskId
();
// 流程执行时,状态及权限校验
commonService
.
checkForExecuteFlow
(
taskId
,
instanceId
);
// 组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
...
...
@@ -549,6 +553,8 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
taskId
,
dto
,
operate
);
// 更新下一步执行人、创建待办
updateExecuteIds
(
instanceId
,
id
,
operate
,
processTaskDTO
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
...
...
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 @
a26d1289
...
...
@@ -7,16 +7,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskMessageDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.EquipTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationReformService
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationReformDto
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
...
...
@@ -27,6 +24,8 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.model.*
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -42,6 +41,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletResponse
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -108,6 +108,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Autowired
private
JgChangeRegistrationNameEqMapper
jgChangeRegistrationNameEqMapper
;
@Autowired
private
RedissonClient
redissonClient
;
/***
* @deprecated 根据查询调教获取分页对象
* @param dto 查询的dto对象
...
...
@@ -227,7 +230,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
String
instanceId
=
""
;
if
(!
ObjectUtils
.
isEmpty
(
jgChangeRegistrationReform
.
getSequenceNbr
())
&&
!
ObjectUtils
.
isEmpty
(
jgChangeRegistrationReform
.
getInstanceId
()))
{
// 如果是旧流程则执行一步
flowExecute
(
jgChangeRegistrationReform
.
getSequenceNbr
(),
jgChangeRegistrationReform
.
getInstanceId
(),
"0"
,
""
);
flowExecute
(
jgChangeRegistrationReform
.
getSequenceNbr
(),
jgChangeRegistrationReform
.
getInstanceId
(),
"0"
,
""
,
jgChangeRegistrationReform
.
getNextTaskId
()
);
// updateExecuteIds(instanceId, jgChangeRegistrationReform.getSequenceNbr(), "0");
}
else
{
// 如果是新启动的流程开启自动访问
...
...
@@ -277,7 +280,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
WorkflowResultDto
workflowResultDto
=
conveterProcessTaskDTO2WorkflowResultDto
(
processTaskDTO
);
jgChangeRegistrationReform
.
setNextExecutorIds
(
workflowResultDto
.
getNextExecutorRoleIds
());
jgChangeRegistrationReform
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
String
nextTask
i
d
=
Optional
.
ofNullable
(
workflowResultDto
.
getNextTaskId
()).
orElse
(
""
);
String
nextTask
I
d
=
Optional
.
ofNullable
(
workflowResultDto
.
getNextTaskId
()).
orElse
(
""
);
String
taskCode
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
();
if
(!
ObjectUtils
.
isEmpty
(
workflowResultDto
.
getNextTaskCode
()))
{
taskCode
=
Optional
.
ofNullable
(
workflowResultDto
.
getNextTaskCode
()).
orElse
(
""
);
...
...
@@ -290,7 +293,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
updateTodoAndCreate
=
Boolean
.
FALSE
;
}
if
(!
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
taskCode
))
{
jgChangeRegistrationReform
.
setNextTaskId
(
nextTask
i
d
);
jgChangeRegistrationReform
.
setNextTaskId
(
nextTask
I
d
);
jgChangeRegistrationReform
.
setNextExecutorIds
(
role
);
jgChangeRegistrationReform
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
jgChangeRegistrationReform
.
setInstanceId
(
instanceId
);
...
...
@@ -356,11 +359,32 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
map
.
put
(
"model"
,
conveterTaskMessageDTO
(
jgChangeRegistrationReform
));
commonServiceImpl
.
updateTaskModel
(
map
);
}
// redis流程实时数据更新
commonServiceImpl
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgChangeRegistrationReform
));
this
.
getBaseMapper
().
updateById
(
jgChangeRegistrationReform
);
}
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
)
{
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
private
InstanceRuntimeData
buildInstanceRuntimeData
(
JgChangeRegistrationReform
jgChangeRegistrationReform
)
{
return
InstanceRuntimeData
.
builder
()
.
nextExecuteUserIds
(
jgChangeRegistrationReform
.
getNextExecuteUserIds
())
.
promoter
(
jgChangeRegistrationReform
.
getPromoter
())
.
nextTaskId
(
jgChangeRegistrationReform
.
getNextTaskId
())
.
build
();
}
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
)
{
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonServiceImpl
.
checkForExecuteFlow
(
nextTaskId
,
instanceId
);
ProcessTaskDTO
processTaskDTO
;
JgChangeRegistrationReform
jgChangeRegistrationReform
=
this
.
getBaseMapper
().
selectById
(
id
);
String
taskId
=
jgChangeRegistrationReform
.
getNextTaskId
();
//组装信息
...
...
@@ -380,10 +404,28 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
processTaskDTO
=
iCmWorkflowService
.
completeOrReject
(
taskId
,
dto
,
operate
);
// 更新下一步执行人
updateExecuteIds
(
instanceId
,
jgChangeRegistrationReform
,
operate
,
processTaskDTO
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
}
}
}
public
void
withdraw
(
String
instanceId
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
)
{
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonServiceImpl
.
checkForRevocationFlow
(
nextTaskId
,
instanceId
);
public
void
withdraw
(
String
instanceId
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
JgChangeRegistrationReform
jgChangeRegistrationReform
=
this
.
getBaseMapper
().
selectOne
(
new
QueryWrapper
<
JgChangeRegistrationReform
>().
eq
(
"instance_id"
,
instanceId
));
ProcessTaskDTO
processTaskDTO
=
iCmWorkflowService
.
rollBack
(
instanceId
);
...
...
@@ -399,7 +441,6 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReform
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
jgChangeRegistrationReform
.
setNextExecutorIds
(
role
);
this
.
getBaseMapper
().
updateById
(
jgChangeRegistrationReform
);
// commonServiceImpl.deleteTaskModel(instanceId);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
jgChangeRegistrationReform
));
jsonObject
.
put
(
"flowStatus"
,
commonServiceImpl
.
getDictionaryCodeByName
(
jgChangeRegistrationReform
.
getAuditStatus
()));
jsonObject
.
put
(
"flowStatusLabel"
,
jgChangeRegistrationReform
.
getAuditStatus
());
...
...
@@ -413,6 +454,16 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
}
jsonObject
.
put
(
"model"
,
conveterTaskMessageDTO
(
jgChangeRegistrationReform
));
commonServiceImpl
.
rollbackTask
(
instanceId
,
jsonObject
);
// redis流程实时数据更新
commonServiceImpl
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgChangeRegistrationReform
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
public
void
deleteBatch
(
List
<
Long
>
ids
)
{
...
...
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 @
a26d1289
...
...
@@ -10,10 +10,7 @@ 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.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskMessageDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransfer
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransferEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory
;
...
...
@@ -48,6 +45,8 @@ import org.elasticsearch.client.RestHighLevelClient;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -63,6 +62,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -125,6 +125,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
@Autowired
CommonServiceImpl
commonServiceImpl
;
@Autowired
private
RedissonClient
redissonClient
;
/**
* 新增移装变更登记
*
...
...
@@ -325,7 +328,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
String
instanceId
=
""
;
if
(!
ValidationUtil
.
isEmpty
(
oldTransfer
.
getSequenceNbr
())
&&
!
ValidationUtil
.
isEmpty
(
oldTransfer
.
getInstanceId
()))
{
this
.
flowExecute
(
oldTransfer
.
getSequenceNbr
(),
oldTransfer
.
getInstanceId
(),
"0"
,
""
);
this
.
flowExecute
(
oldTransfer
.
getSequenceNbr
(),
oldTransfer
.
getInstanceId
(),
"0"
,
""
,
String
.
valueOf
(
map
.
get
(
"nextTaskId"
))
);
}
else
{
// 如果是新启动的流程开启自动访问
String
equipListName
=
Optional
.
ofNullable
(
tableData
.
get
(
"equListDesc"
)).
orElse
(
"无"
).
toString
();
...
...
@@ -385,8 +388,19 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @param operate
* @param comment
*/
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
)
{
WorkflowResultDto
workflowResult
=
new
WorkflowResultDto
();
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForExecuteFlow
(
nextTaskId
,
instanceId
);
WorkflowResultDto
workflowResult
;
JgChangeRegistrationTransfer
transfer
=
this
.
getById
(
id
);
String
taskId
=
transfer
.
getNextTaskId
();
...
...
@@ -408,7 +422,13 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
workflowResult
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
complete
)).
get
(
0
);
// 更新下一步执行人
this
.
updateExecuteIds
(
instanceId
,
transfer
,
operate
,
workflowResult
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
/**
...
...
@@ -416,10 +436,21 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*
* @param instanceId
*/
public
void
revocation
(
String
instanceId
)
{
public
void
revocation
(
String
instanceId
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 撤回校验
commonServiceImpl
.
checkForRevocationFlow
(
nextTaskId
,
instanceId
);
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
JgChangeRegistrationTransfer
jgTransfer
=
new
JgChangeRegistrationTransfer
()
;
JgChangeRegistrationTransfer
jgTransfer
;
LambdaQueryWrapper
<
JgChangeRegistrationTransfer
>
lambda
=
new
QueryWrapper
<
JgChangeRegistrationTransfer
>().
lambda
();
lambda
.
eq
(
JgChangeRegistrationTransfer:
:
getInstanceId
,
instanceId
);
jgTransfer
=
this
.
getOne
(
lambda
);
...
...
@@ -451,8 +482,25 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
// 判断撤回后当前的节点,如果当前节点为提交节点则页面可编辑
jsonObject
.
put
(
"pageType"
,
this
.
getPageTypeByCurrentNode
(
jgTransfer
.
getAuditStatus
()));
commonService
.
rollbackTask
(
instanceId
,
jsonObject
);
// redis流程实时数据更新
commonServiceImpl
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgTransfer
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
public
InstanceRuntimeData
buildInstanceRuntimeData
(
JgChangeRegistrationTransfer
jgTransfer
)
{
return
InstanceRuntimeData
.
builder
()
.
nextExecuteUserIds
(
jgTransfer
.
getNextExecuteUserIds
())
.
promoter
(
jgTransfer
.
getPromoter
())
.
nextTaskId
(
jgTransfer
.
getNextTaskId
())
.
build
();
}
/**
* 批量删除
...
...
@@ -711,7 +759,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
}
else
{
jgChangeRegistrationTransfer
.
setAuditPassDate
(
new
Date
());
jgChangeRegistrationTransfer
.
setAuditStatus
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
...
...
@@ -727,11 +774,10 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
map
.
put
(
"relationId"
,
jgChangeRegistrationTransfer
.
getInstanceId
());
map
.
put
(
"model"
,
jgChangeRegistrationTransfer
);
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
}
// redis流程实时数据更新
commonServiceImpl
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgChangeRegistrationTransfer
));
this
.
getBaseMapper
().
updateById
(
jgChangeRegistrationTransfer
);
}
/**
...
...
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/JgChangeRegistrationUnitServiceImpl.java
View file @
a26d1289
...
...
@@ -28,6 +28,8 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.*
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -47,6 +49,7 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -123,6 +126,8 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
@Autowired
ICommonService
commonService
;
@Autowired
private
RedissonClient
redissonClient
;
public
static
byte
[]
file2byte
(
File
file
)
{
try
{
...
...
@@ -713,9 +718,18 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
}
public
void
cancel
(
JgChangeRegistrationUnitDto
noticeDto
)
{
String
taskCode
=
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
();
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// FeignClientResult ajaxResult = Workflow.taskV2Client.rollBack(noticeDto.getInstanceId());
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
noticeDto
.
getInstanceId
());
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 撤回校验
commonServiceImpl
.
checkForRevocationFlow
(
noticeDto
.
getNextTaskId
(),
noticeDto
.
getInstanceId
());
String
taskCode
;
List
<
String
>
roleListNext
=
new
ArrayList
<>();
List
<
String
>
roleListAll
=
new
ArrayList
<>();
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
rollBack
(
noticeDto
.
getInstanceId
());
...
...
@@ -725,25 +739,54 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
// 待调整
taskCode
=
processTaskDTO
.
getNextTask
().
get
(
0
).
getKey
();
JgChangeRegistrationUnit
J
gChangeRegistrationUnit
=
this
.
baseMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
J
gChangeRegistrationUnit
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getRollBack
());
J
gChangeRegistrationUnit
.
setPromoter
(
""
);
J
gChangeRegistrationUnit
.
setNextTaskId
(
nextTaskId
);
J
gChangeRegistrationUnit
.
setNextExecuteUserIds
(
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
());
J
gChangeRegistrationUnit
.
setNextExecutorIds
(
String
.
join
(
","
,
roleListNext
));
JgChangeRegistrationUnitMapper
.
updateById
(
J
gChangeRegistrationUnit
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
J
gChangeRegistrationUnit
));
jsonObject
.
put
(
"nextTaskId"
,
J
gChangeRegistrationUnit
.
getNextTaskId
());
jsonObject
.
put
(
"nextExecuteUser"
,
J
gChangeRegistrationUnit
.
getNextExecutorIds
());
JgChangeRegistrationUnit
j
gChangeRegistrationUnit
=
this
.
baseMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
j
gChangeRegistrationUnit
.
setStatus
(
WorkFlowStatusEnum
.
getMessage
(
taskCode
).
getRollBack
());
j
gChangeRegistrationUnit
.
setPromoter
(
""
);
j
gChangeRegistrationUnit
.
setNextTaskId
(
nextTaskId
);
j
gChangeRegistrationUnit
.
setNextExecuteUserIds
(
workflowResultDtos
.
get
(
0
).
getNextExecutorUserIds
());
j
gChangeRegistrationUnit
.
setNextExecutorIds
(
String
.
join
(
","
,
roleListNext
));
JgChangeRegistrationUnitMapper
.
updateById
(
j
gChangeRegistrationUnit
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
j
gChangeRegistrationUnit
));
jsonObject
.
put
(
"nextTaskId"
,
j
gChangeRegistrationUnit
.
getNextTaskId
());
jsonObject
.
put
(
"nextExecuteUser"
,
j
gChangeRegistrationUnit
.
getNextExecutorIds
());
jsonObject
.
put
(
"taskType"
,
BusinessTypeEnum
.
JG_COMPANY_CHANGE_REGISTRATION
.
getCode
());
jsonObject
.
put
(
"flowStatus"
,
this
.
getTaskCodeByName
(
J
gChangeRegistrationUnit
.
getStatus
()));
jsonObject
.
put
(
"flowStatusLabel"
,
J
gChangeRegistrationUnit
.
getStatus
());
jsonObject
.
put
(
"flowStatus"
,
this
.
getTaskCodeByName
(
j
gChangeRegistrationUnit
.
getStatus
()));
jsonObject
.
put
(
"flowStatusLabel"
,
j
gChangeRegistrationUnit
.
getStatus
());
commonServiceImpl
.
rollbackTask
(
noticeDto
.
getInstanceId
(),
jsonObject
);
// redis流程实时数据更新
commonServiceImpl
.
saveExecuteFlowData2Redis
(
noticeDto
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
jgChangeRegistrationUnit
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
public
InstanceRuntimeData
buildInstanceRuntimeData
(
JgChangeRegistrationUnit
jgChangeRegistrationUnit
)
{
return
InstanceRuntimeData
.
builder
()
.
nextExecuteUserIds
(
jgChangeRegistrationUnit
.
getNextExecuteUserIds
())
.
promoter
(
jgChangeRegistrationUnit
.
getPromoter
())
.
nextTaskId
(
jgChangeRegistrationUnit
.
getNextTaskId
())
.
build
();
}
@Transactional
public
void
accept
(
JgChangeRegistrationUnitDto
dto
,
String
op
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
dto
.
getInstanceId
());
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonServiceImpl
.
checkForExecuteFlow
(
dto
.
getNextTaskId
(),
dto
.
getInstanceId
());
String
[]
taskName
=
new
String
[]{
"已完成"
};
String
userId
=
RequestContext
.
getExeUserId
();
String
taskId
=
dto
.
getNextTaskId
();
...
...
@@ -857,7 +900,16 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
executeOneStep
(
jgChangeRegistrationUnit
,
taskName1
,
nextUserIds
,
op
);
}
JgChangeRegistrationUnitMapper
.
updateById
(
jgChangeRegistrationUnit
);
// }
// redis流程实时数据更新
commonServiceImpl
.
saveExecuteFlowData2Redis
(
dto
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
jgChangeRegistrationUnit
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
private
Integer
getTaskCodeByName
(
String
auditStatus
)
{
...
...
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 @
a26d1289
...
...
@@ -8,9 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskMessageDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
...
...
@@ -18,7 +16,6 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableEqMapper;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgEnableDisableService
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto
;
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.IIdxBizJgRegisterInfoService
;
...
...
@@ -30,6 +27,8 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.*
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -40,9 +39,11 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
* 服务实现类
...
...
@@ -85,6 +86,9 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
@Autowired
ICmWorkflowService
iCmWorkflowService
;
@Autowired
private
RedissonClient
redissonClient
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgEnableDisable
>
saveOrUpdate
(
JSONObject
map
,
ReginParams
reginParams
)
{
JgEnableDisable
jgEnableDisable
=
new
JgEnableDisable
();
...
...
@@ -389,7 +393,18 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
@Autowired
RegistrationInfoMapper
tzsJgRegistrationInfoMapper
;
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
)
{
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForExecuteFlow
(
nextTaskId
,
instanceId
);
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
JgEnableDisable
jgEnableDisable
=
this
.
baseMapper
.
selectById
(
id
);
...
...
@@ -476,6 +491,15 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
jgEnableDisable
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
this
.
baseMapper
.
updateById
(
jgEnableDisable
);
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgEnableDisable
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
...
...
@@ -508,7 +532,18 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
}
public
void
withdraw
(
String
instanceId
)
{
public
void
withdraw
(
String
instanceId
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForRevocationFlow
(
nextTaskId
,
instanceId
);
JgEnableDisable
jgEnableDisable
=
this
.
baseMapper
.
selectOne
(
new
QueryWrapper
<
JgEnableDisable
>().
lambda
().
eq
(
JgEnableDisable:
:
getInstanceId
,
instanceId
));
ProcessTaskDTO
processTaskDTO
=
iCmWorkflowService
.
rollBack
(
instanceId
);
// 提取节点等信息
...
...
@@ -527,8 +562,25 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
jsonObject
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
ROLLBACK
.
getName
());
jsonObject
.
put
(
"flowStatus"
,
FlowStatusEnum
.
ROLLBACK
.
getCode
());
commonService
.
rollbackTask
(
jgEnableDisable
.
getInstanceId
(),
jsonObject
);
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgEnableDisable
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
public
InstanceRuntimeData
buildInstanceRuntimeData
(
JgEnableDisable
jgEnableDisable
)
{
return
InstanceRuntimeData
.
builder
()
.
nextExecuteUserIds
(
jgEnableDisable
.
getNextExecuteUserIds
())
.
promoter
(
jgEnableDisable
.
getPromoter
())
.
nextTaskId
(
jgEnableDisable
.
getNextTaskId
())
.
build
();
}
public
void
updateExecuteIds
(
String
instanceId
,
Long
sequenceNbr
,
String
operate
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
...
...
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 @
a26d1289
...
...
@@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgMaintenanceContractDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskMessageDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto
;
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.enums.BusinessTypeEnum
;
...
...
@@ -33,6 +30,8 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -47,6 +46,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -83,6 +83,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
@Autowired
private
IdxBizJgMaintenanceRecordInfoServiceImpl
idxBizJgMaintenanceRecordInfoService
;
@Autowired
private
RedissonClient
redissonClient
;
/**
* 分页查询
*/
...
...
@@ -162,7 +165,18 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
return
maintenanceContractMapper
.
updateBySequenceNbr
(
dto
);
}
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
Boolean
update
)
{
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
Boolean
update
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForExecuteFlow
(
nextTaskId
,
instanceId
);
JgMaintenanceContract
contract
=
this
.
getBaseMapper
().
selectById
(
id
);
String
taskId
=
contract
.
getNextTaskId
();
// 组装信息
...
...
@@ -181,6 +195,21 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
ProcessTaskDTO
complete
=
workflowService
.
completeOrReject
(
taskId
,
dto
,
operate
);
// 更新下一步执行人、创建待办
updateExecuteIds
(
instanceId
,
id
,
operate
,
complete
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
public
InstanceRuntimeData
buildInstanceRuntimeData
(
JgMaintenanceContract
jgMaintenanceContract
)
{
return
InstanceRuntimeData
.
builder
()
.
nextExecuteUserIds
(
jgMaintenanceContract
.
getNextExecuteUserIds
())
.
promoter
(
jgMaintenanceContract
.
getPromoter
())
.
nextTaskId
(
jgMaintenanceContract
.
getNextTaskId
())
.
build
();
}
public
String
getNextUserOrgCode
(
String
operate
,
JgMaintenanceContract
contract
)
{
...
...
@@ -258,7 +287,18 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
* 维保合同撤回
*/
@Transactional
public
void
revocation
(
String
instanceId
)
{
public
void
revocation
(
String
instanceId
,
String
_nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForRevocationFlow
(
_nextTaskId
,
instanceId
);
LambdaQueryWrapper
<
JgMaintenanceContract
>
lambda
=
new
QueryWrapper
<
JgMaintenanceContract
>().
lambda
();
lambda
.
eq
(
JgMaintenanceContract:
:
getInstanceId
,
instanceId
);
List
<
String
>
roleListNext
=
new
ArrayList
<>();
...
...
@@ -289,6 +329,16 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
jsonObject
.
put
(
"flowStatusLabel"
,
contract
.
getStatus
());
jsonObject
.
put
(
"maintenanceContract"
,
null
);
// 不传合同照片附件信息
commonService
.
rollbackTask
(
instanceId
,
jsonObject
);
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
contract
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
/**
...
...
@@ -505,6 +555,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
updateEquipMessage
(
contract
.
getSequenceNbr
());
}
this
.
getBaseMapper
().
updateById
(
contract
);
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
contract
));
}
/**
...
...
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 @
a26d1289
...
...
@@ -10,10 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskMessageDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgScrapCancel
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgScrapCancelEq
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
...
...
@@ -39,6 +36,8 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -50,9 +49,11 @@ import org.springframework.util.StringUtils;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -96,6 +97,9 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
@Autowired
private
IdxBizJgUseInfoMapper
idxBizJgUseInfoMapper
;
@Autowired
private
RedissonClient
redissonClient
;
/**
* 移装移装注销/报废注销判断
*
...
...
@@ -555,7 +559,18 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
@Transactional
public
void
revocation
(
String
instanceId
)
{
public
void
revocation
(
String
instanceId
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForRevocationFlow
(
nextTaskId
,
instanceId
);
ReginParams
reginParams
=
this
.
getSelectedOrgInfo
();
LambdaQueryWrapper
<
JgScrapCancel
>
lambda
=
new
QueryWrapper
<
JgScrapCancel
>().
lambda
();
lambda
.
eq
(
JgScrapCancel:
:
getInstanceId
,
instanceId
);
...
...
@@ -584,6 +599,16 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// 判断撤回后当前的节点,如果当前节点为提交节点则页面可编辑
jsonObject
.
put
(
"pageType"
,
this
.
getPageTypeByCurrentNode
(
jgScrapCancel
.
getAuditStatus
()));
commonService
.
rollbackTask
(
instanceId
,
jsonObject
);
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgScrapCancel
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
private
Integer
getTaskCodeByName
(
String
auditStatus
)
{
...
...
@@ -599,7 +624,18 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
@Transactional
public
void
flowExecute
(
String
equList
,
Long
id
,
String
instanceId
,
String
operate
,
String
comment
)
{
public
void
flowExecute
(
String
equList
,
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 流程执行时,状态及权限校验
commonService
.
checkForExecuteFlow
(
nextTaskId
,
instanceId
);
JgScrapCancel
jgScrapCancel
=
this
.
getBaseMapper
().
selectById
(
id
);
String
taskId
=
jgScrapCancel
.
getNextTaskId
();
// 组装信息
...
...
@@ -619,8 +655,25 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
taskId
,
dto
,
operate
);
// 更新下一步执行人、创建待办
updateExecuteIds
(
equList
,
instanceId
,
id
,
operate
,
processTaskDTO
);
// redis流程实时数据更新
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgScrapCancel
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
}
}
}
public
InstanceRuntimeData
buildInstanceRuntimeData
(
JgScrapCancel
jgScrapCancel
)
{
return
InstanceRuntimeData
.
builder
()
.
nextExecuteUserIds
(
jgScrapCancel
.
getNextExecuteUserIds
())
.
promoter
(
jgScrapCancel
.
getPromoter
())
.
nextTaskId
(
jgScrapCancel
.
getNextTaskId
())
.
build
();
}
public
void
updateExecuteIds
(
String
equList
,
String
instanceId
,
Long
sequenceNbr
,
String
operate
,
ProcessTaskDTO
processTaskDTO
)
{
List
<
String
>
roleListNext
=
new
ArrayList
<>();
...
...
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 @
a26d1289
...
...
@@ -641,6 +641,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
// 流程执行时,状态及权限校验
commonService
.
checkForExecuteFlow
(
nextTaskId
,
instanceId
);
JgUseRegistration
jgUseRegistration
=
this
.
getBaseMapper
().
selectById
(
id
);
// 组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
...
...
@@ -682,13 +683,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
try
{
boolean
isLocked
=
lock
.
tryLock
();
boolean
isLocked
=
lock
.
tryLock
(
0
,
180
,
TimeUnit
.
SECONDS
);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if
(!
isLocked
){
throw
new
BadRequest
(
"当前流程已经被执行!"
);
}
// 撤回校验
commonServiceImpl
.
checkForRevocationFlow
(
nextTaskId
,
instanceId
);
JgUseRegistration
jgUseRegistration
=
new
JgUseRegistration
();
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
rollBack
(
instanceId
);
...
...
@@ -732,6 +734,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
commonServiceImpl
.
rollbackTask
(
instanceId
,
jsonObject
);
// redis流程实时数据更新
commonServiceImpl
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
data
));
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
lock
.
isHeldByCurrentThread
()){
lock
.
unlock
();
...
...
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