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
71202182
Commit
71202182
authored
Dec 14, 2023
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(jyjc):新增工作流启动流程
parent
797acdb8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
7 deletions
+96
-7
JyjcOpeningApplicationDto.java
...s/boot/module/jyjc/api/dto/JyjcOpeningApplicationDto.java
+3
-0
JyjcOpeningApplication.java
...s/boot/module/jyjc/api/entity/JyjcOpeningApplication.java
+7
-0
WorkflowFeignClient.java
.../amos/boot/module/jyjc/biz/feign/WorkflowFeignClient.java
+61
-0
JyjcOpeningApplicationServiceImpl.java
...c/biz/service/impl/JyjcOpeningApplicationServiceImpl.java
+25
-7
No files found.
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/java/com/yeejoin/amos/boot/module/jyjc/api/dto/JyjcOpeningApplicationDto.java
View file @
71202182
...
...
@@ -25,6 +25,9 @@ public class JyjcOpeningApplicationDto extends BaseDto {
@ApiModelProperty
(
value
=
"单位编码"
)
private
String
unitCode
;
@ApiModelProperty
(
value
=
"单位编码Name"
)
private
String
unitCodeName
;
@ApiModelProperty
(
value
=
"检测区域编码"
)
private
String
detectionRegion
;
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/java/com/yeejoin/amos/boot/module/jyjc/api/entity/JyjcOpeningApplication.java
View file @
71202182
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -31,6 +32,12 @@ public class JyjcOpeningApplication extends BaseEntity {
private
String
unitCode
;
/**
* 单位编码Name
*/
@ApiModelProperty
(
value
=
"unit_code_name"
)
private
String
unitCodeName
;
/**
* 检测区域编码
*/
@TableField
(
"detection_region"
)
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/feign/WorkflowFeignClient.java
0 → 100644
View file @
71202182
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@FeignClient
(
contextId
=
"jyjc"
,
name
=
"${workflow.feign.name:AMOS-API-WORKFLOW}"
,
path
=
"workflow"
,
configuration
=
{
MultipartSupportConfig
.
class
})
public
interface
WorkflowFeignClient
{
/***
* 根据task_id 获取节点信息
*
* */
@RequestMapping
(
value
=
"/history/task/nodeInfo"
,
method
=
RequestMethod
.
GET
)
FeignClientResult
<
JSONObject
>
getNodeInfo
(
@RequestParam
(
value
=
"taskId"
)
String
taskId
);
/***
*
* 查询当前流程对应的可执行任务,无权限级别
* */
@RequestMapping
(
value
=
"/task/getTaskNoAuth/{processInstanceId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
getTaskNoAuth
(
@PathVariable
(
value
=
"processInstanceId"
)
String
processInstanceId
);
/***
*
* 获取流程审批日志
* */
@RequestMapping
(
value
=
"/task/flowLogger/{procInsId}"
,
method
=
RequestMethod
.
GET
)
FeignClientResult
<
Map
<
String
,
Object
>>
getFlowLogger
(
@PathVariable
(
value
=
"procInsId"
)
String
procInsId
);
@RequestMapping
(
value
=
"/history/task/nodeInfo"
,
method
=
RequestMethod
.
GET
)
FeignClientResult
<
JSONObject
>
getNodeInfotoken
(
@RequestHeader
(
name
=
"appKey"
,
required
=
true
)
String
appKey
,
@RequestHeader
(
name
=
"product"
,
required
=
true
)
String
product
,
@RequestHeader
(
name
=
"token"
,
required
=
true
)
String
token
,
@RequestParam
(
value
=
"taskId"
)
String
taskId
);
/***
*
* 查询当前流程对应的可执行任务,无权限级别
* */
@RequestMapping
(
value
=
"/task/getTaskNoAuth/{processInstanceId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
getTaskNoAuthtoken
(
@RequestHeader
(
name
=
"appKey"
,
required
=
true
)
String
appKey
,
@RequestHeader
(
name
=
"product"
,
required
=
true
)
String
product
,
@RequestHeader
(
name
=
"token"
,
required
=
true
)
String
token
,
@PathVariable
(
value
=
"processInstanceId"
)
String
processInstanceId
);
}
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 @
71202182
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import
cn.hutool.core.map.MapBuilder
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -14,21 +15,25 @@ import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcOpeningApplicationServ
import
com.yeejoin.amos.boot.module.jyjc.api.dto.JyjcOpeningApplicationDto
;
import
com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException
;
import
com.yeejoin.amos.boot.module.jyjc.biz.config.CommonException
;
import
com.yeejoin.amos.boot.module.jyjc.biz.feign.WorkflowFeignClient
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseUnitLicenceDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.CommonErrorEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.LicenceTypeEnum
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.AjaxResult
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
org.apache.commons.lang3.ObjectUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.bouncycastle.cert.ocsp.Req
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
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.springframework.stereotype.Service
;
...
...
@@ -39,8 +44,11 @@ import java.text.SimpleDateFormat;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -68,6 +76,9 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
private
WorkflowFeignClient
workflowFeignClient
;
@Transactional
(
rollbackFor
=
{
Exception
.
class
,
CommonException
.
class
})
public
JyjcOpeningApplicationDto
saveModel
(
JyjcOpeningApplicationDto
model
)
{
// 开启工作流 startProcess
...
...
@@ -83,11 +94,17 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
throw
new
BaseException
(
"开启工作流错误"
);
}
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
// JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
// model.setWorkflowRole();
JSONObject
dataObject
=
getTask
(
instanceId
);
JSONArray
executorArray
=
dataObject
.
getJSONObject
(
"nodeInfo"
).
getJSONArray
(
"executor"
);
if
(!
ValidationUtil
.
isEmpty
(
executorArray
))
{
String
roleGroups
=
executorArray
.
stream
().
map
(
json
->
Optional
.
ofNullable
(((
LinkedHashMap
)
json
).
get
(
"groupId"
)).
orElse
(
""
).
toString
()).
collect
(
Collectors
.
joining
(
","
));
model
.
setWorkflowRole
(
roleGroups
);
}
CompanyBo
companyBo
=
commonserviceImpl
.
getReginParamsOfCurrentUser
().
getCompany
();
model
.
setUnitCode
(
companyBo
.
getCompanyCode
());
model
.
setUnitCodeName
(
companyBo
.
getCompanyName
());
model
.
setApplicationSeq
(
buildApplicationSeq
());
model
.
setStatus
(!
ValidationUtil
.
isEmpty
(
dataObject
)
&&
!
ValidationUtil
.
isEmpty
(
dataObject
.
get
(
"
name"
))
?
String
.
valueOf
(
dataObject
.
get
(
"name
"
))
:
""
);
model
.
setStatus
(!
ValidationUtil
.
isEmpty
(
dataObject
)
&&
!
ValidationUtil
.
isEmpty
(
dataObject
.
get
(
"
status"
))
?
String
.
valueOf
(
dataObject
.
get
(
"status
"
))
:
""
);
model
.
setWorkflowProstanceId
(
instanceId
);
return
this
.
createWithModel
(
model
);
}
catch
(
Exception
e
)
{
...
...
@@ -96,12 +113,13 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
}
public
JSONObject
getTask
(
String
instanceId
)
{
private
JSONObject
getTask
(
String
instanceId
)
{
try
{
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
JSONObject
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
log
.
info
(
"getTask: dataObject={}"
,
dataObject
);
String
taskId
=
dataObject
.
getString
(
"id"
);
// 工作流ID
FeignClientResult
<
JSONObject
>
nodeInfo
=
workflowFeignClient
.
getNodeInfotoken
(
RequestContext
.
getAppKey
(),
RequestContext
.
getProduct
(),
RequestContext
.
getToken
(),
taskId
);
dataObject
.
put
(
"nodeInfo"
,
nodeInfo
.
getResult
());
return
dataObject
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -230,7 +248,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
if
(
increment
==
0
)
{
redisUtils
.
expire
(
CommonConstants
.
OPEN_APPLICATION_SEQ_KEY
,
nextDay
());
}
return
CommonConstants
.
APPLICATION_SEQ_PREFIX
+
sdf
+
String
.
format
(
"%0
5
d"
,
increment
);
return
CommonConstants
.
APPLICATION_SEQ_PREFIX
+
sdf
+
String
.
format
(
"%0
3
d"
,
increment
);
}
private
long
nextDay
()
{
...
...
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