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
23679a4c
Commit
23679a4c
authored
Dec 14, 2023
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(jyjc):新增工作流启动流程
parent
c47dba14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
12 deletions
+60
-12
JyjcOpeningApplicationServiceImpl.java
...c/biz/service/impl/JyjcOpeningApplicationServiceImpl.java
+60
-12
No files found.
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/JyjcOpeningApplicationServiceImpl.java
View file @
23679a4c
...
@@ -4,7 +4,9 @@ import cn.hutool.core.map.MapBuilder;
...
@@ -4,7 +4,9 @@ import cn.hutool.core.map.MapBuilder;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
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.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
...
@@ -33,6 +35,7 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult;
...
@@ -33,6 +35,7 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.bouncycastle.cert.ocsp.Req
;
import
org.bouncycastle.cert.ocsp.Req
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -43,6 +46,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...
@@ -43,6 +46,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -95,17 +100,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -95,17 +100,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
public
JyjcOpeningApplicationModel
saveModel
(
JyjcOpeningApplicationModel
model
)
{
public
JyjcOpeningApplicationModel
saveModel
(
JyjcOpeningApplicationModel
model
)
{
// 开启工作流 startProcess
// 开启工作流 startProcess
try
{
try
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
String
instanceId
=
startFlow
();
dto
.
setProcessDefinitionKey
(
processDefinitionKey
);
dto
.
setBusinessKey
(
"1"
);
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"开启工作流结果:{}"
,
ajaxResult
);
}
if
(
ajaxResult
==
null
||
(
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
)
!=
null
&&
!
"200"
.
equals
(
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
).
toString
())))
{
throw
new
BaseException
(
"开启工作流错误"
);
}
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
JSONObject
dataObject
=
getTask
(
instanceId
);
JSONObject
dataObject
=
getTask
(
instanceId
);
JSONArray
executorArray
=
dataObject
.
getJSONObject
(
"nodeInfo"
).
getJSONArray
(
"executor"
);
JSONArray
executorArray
=
dataObject
.
getJSONObject
(
"nodeInfo"
).
getJSONArray
(
"executor"
);
if
(!
ValidationUtil
.
isEmpty
(
executorArray
))
{
if
(!
ValidationUtil
.
isEmpty
(
executorArray
))
{
...
@@ -114,6 +109,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -114,6 +109,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
}
CompanyBo
companyBo
=
commonserviceImpl
.
getReginParamsOfCurrentUser
().
getCompany
();
CompanyBo
companyBo
=
commonserviceImpl
.
getReginParamsOfCurrentUser
().
getCompany
();
model
.
setUnitCode
(
companyBo
.
getCompanyCode
());
model
.
setUnitCode
(
companyBo
.
getCompanyCode
());
model
.
setUnitCode
(
"91611103MAC4Q1EG7B"
);
model
.
setUnitCodeName
(
companyBo
.
getCompanyName
());
model
.
setUnitCodeName
(
companyBo
.
getCompanyName
());
model
.
setApplicationSeq
(
buildApplicationSeq
());
model
.
setApplicationSeq
(
buildApplicationSeq
());
model
.
setStatus
(!
ValidationUtil
.
isEmpty
(
dataObject
)
&&
!
ValidationUtil
.
isEmpty
(
dataObject
.
get
(
"status"
))
?
String
.
valueOf
(
dataObject
.
get
(
"status"
))
:
""
);
model
.
setStatus
(!
ValidationUtil
.
isEmpty
(
dataObject
)
&&
!
ValidationUtil
.
isEmpty
(
dataObject
.
get
(
"status"
))
?
String
.
valueOf
(
dataObject
.
get
(
"status"
))
:
""
);
...
@@ -125,6 +121,37 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -125,6 +121,37 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
}
}
}
@Transactional
(
rollbackFor
=
{
Exception
.
class
,
CommonException
.
class
})
public
JyjcOpeningApplicationModel
updateModel
(
JyjcOpeningApplicationModel
model
)
{
if
(
model
.
getSequenceNbr
()
==
null
)
{
throw
new
BadRequest
(
"sequenceNbr不能为空!"
);
}
return
this
.
updateModel
(
model
);
}
public
void
updateModelByInstanceId
(
String
instanceId
)
{
JyjcOpeningApplication
entity
=
this
.
lambdaQuery
().
eq
(
JyjcOpeningApplication:
:
getWorkflowProstanceId
,
instanceId
).
one
();
if
(
entity
==
null
)
{
return
;
}
JSONObject
taskJson
=
getTask
(
instanceId
);
entity
.
setWorkflowRole
(
getWorkflowRoleGroups
(
taskJson
));
entity
.
setStatus
(
getWorkflowStatus
(
taskJson
));
this
.
updateById
(
entity
);
}
private
String
getWorkflowStatus
(
JSONObject
dataObject
)
{
return
!
ValidationUtil
.
isEmpty
(
dataObject
)
&&
!
ValidationUtil
.
isEmpty
(
dataObject
.
get
(
"status"
))
?
String
.
valueOf
(
dataObject
.
get
(
"status"
))
:
""
;
}
private
String
getWorkflowRoleGroups
(
JSONObject
dataObject
)
{
JSONArray
executorArray
=
dataObject
.
getJSONObject
(
"nodeInfo"
).
getJSONArray
(
"executor"
);
if
(!
ValidationUtil
.
isEmpty
(
executorArray
))
{
return
executorArray
.
stream
().
map
(
json
->
Optional
.
ofNullable
(((
LinkedHashMap
)
json
).
get
(
"groupId"
)).
orElse
(
""
).
toString
()).
collect
(
Collectors
.
joining
(
","
));
}
return
null
;
}
private
JSONObject
getTask
(
String
instanceId
)
{
private
JSONObject
getTask
(
String
instanceId
)
{
try
{
try
{
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
...
@@ -184,6 +211,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -184,6 +211,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
jyjcOpeningApplicationModel
=
new
JyjcOpeningApplicationModel
();
jyjcOpeningApplicationModel
=
new
JyjcOpeningApplicationModel
();
}
}
String
unitCode
=
reginParams
.
getCompany
().
getCompanyCode
();
String
unitCode
=
reginParams
.
getCompany
().
getCompanyCode
();
unitCode
=
"91611103MAC4Q1EG7B"
;
// 测试用,之后务必删除!!!
QueryWrapper
enterpriseInfoQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
enterpriseInfoQueryWrapper
=
new
QueryWrapper
<>();
enterpriseInfoQueryWrapper
.
eq
(
"use_code"
,
unitCode
);
enterpriseInfoQueryWrapper
.
eq
(
"use_code"
,
unitCode
);
TzBaseEnterpriseInfo
baseUnitLicenceEntity
=
enterpriseInfoMapper
.
selectOne
(
enterpriseInfoQueryWrapper
);
TzBaseEnterpriseInfo
baseUnitLicenceEntity
=
enterpriseInfoMapper
.
selectOne
(
enterpriseInfoQueryWrapper
);
...
@@ -194,6 +222,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -194,6 +222,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
jyjcOpeningApplicationModel
.
setIndustrySupervisor
(
baseUnitLicenceEntity
.
getIndustrySupervisor
());
jyjcOpeningApplicationModel
.
setIndustrySupervisor
(
baseUnitLicenceEntity
.
getIndustrySupervisor
());
jyjcOpeningApplicationModel
.
setLongitude
(
baseUnitLicenceEntity
.
getLongitude
());
jyjcOpeningApplicationModel
.
setLongitude
(
baseUnitLicenceEntity
.
getLongitude
());
jyjcOpeningApplicationModel
.
setLatitude
(
baseUnitLicenceEntity
.
getLatitude
());
jyjcOpeningApplicationModel
.
setLatitude
(
baseUnitLicenceEntity
.
getLatitude
());
jyjcOpeningApplicationModel
.
setUnitBusinessLicense
(
baseUnitLicenceEntity
.
getUnitBusinessLicense
());
}
}
// QueryWrapper unitLicenceQueryWrapper = new QueryWrapper<>();
// QueryWrapper unitLicenceQueryWrapper = new QueryWrapper<>();
// unitLicenceQueryWrapper.eq("unit_code", unitCode);
// unitLicenceQueryWrapper.eq("unit_code", unitCode);
...
@@ -230,6 +259,22 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -230,6 +259,22 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
return
jyjcOpeningApplicationModel
;
return
jyjcOpeningApplicationModel
;
}
}
public
String
startFlow
()
throws
Exception
{
// 重新开启工作流
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
processDefinitionKey
);
dto
.
setBusinessKey
(
"1"
);
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"开启工作流结果:{}"
,
ajaxResult
);
}
if
(
ajaxResult
==
null
||
(
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
)
!=
null
&&
!
"200"
.
equals
(
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
).
toString
())))
{
throw
new
BaseException
(
"开启工作流错误"
);
}
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
return
instanceId
;
}
/**
/**
* 接收/驳回通知检验单
* 接收/驳回通知检验单
*/
*/
...
@@ -250,11 +295,14 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -250,11 +295,14 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
}
updateModelByInstanceId
(
instanceId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
/**
/**
* 撤回流程办理单
* 撤回流程办理单
*/
*/
...
@@ -265,7 +313,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
...
@@ -265,7 +313,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
if
(
ObjectUtils
.
isEmpty
(
ajaxResult1
))
{
if
(
ObjectUtils
.
isEmpty
(
ajaxResult1
))
{
}
}
updateModelByInstanceId
(
instanceId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
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