Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yanxuan-qc-change-system
Overview
Overview
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
yx-qc-change-flow
yanxuan-qc-change-system
Commits
e406d60a
Commit
e406d60a
authored
Nov 29, 2022
by
jx-art
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature-changeFlow-221110' into feature-changeFlow-221110
parents
90663abd
acc199e3
Pipeline
#43185
passed with stages
in 1 minute 33 seconds
Changes
6
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
141 additions
and
11 deletions
+141
-11
ChangeFlowBiz.java
...om/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
+0
-0
FlowService.java
...ease/mail/yanxuan/change/biz/service/rpc/FlowService.java
+125
-0
TodoService.java
...ease/mail/yanxuan/change/biz/service/rpc/TodoService.java
+5
-2
AutoSubmit.java
.../com/netease/mail/yanxuan/change/biz/task/AutoSubmit.java
+4
-3
ChangeFlowVO.java
...e/mail/yanxuan/change/dal/meta/model/vo/ChangeFlowVO.java
+1
-1
TestController.java
...se/mail/yanxuan/change/web/controller/TestController.java
+6
-5
No files found.
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
View file @
e406d60a
This diff is collapsed.
Click to expand it.
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/rpc/FlowService.java
0 → 100644
View file @
e406d60a
/**
* @(#)FlowService.java, 2022/11/29.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
service
.
rpc
;
import
java.util.List
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.alibaba.fastjson.JSON
;
import
com.netease.mail.yanxuan.change.biz.meta.exception.ExceptionFactory
;
import
com.netease.mail.yanxuan.change.common.bean.CommonConstants
;
import
com.netease.mail.yanxuan.change.common.bean.ResponseCode
;
import
com.netease.mail.yanxuan.change.common.bean.ResponseCodeEnum
;
import
com.netease.mail.yanxuan.change.common.enums.ChangeFlowEnum
;
import
com.netease.mail.yanxuan.change.common.enums.FlowxOperationEnum
;
import
com.netease.mail.yanxuan.change.integration.flow.FlowRpcService
;
import
com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse
;
import
com.netease.yanxuan.flowx.sdk.meta.dto.base.FlowDataDTO
;
import
com.netease.yanxuan.flowx.sdk.meta.dto.flow.FlowCreateReqDTO
;
import
com.netease.yanxuan.flowx.sdk.meta.dto.flow.NodeSubmitReqDTO
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @Author zcwang
* @Date 2022/11/29
* 工单流转相关操作
*/
@Slf4j
@Component
public
class
FlowService
{
@Autowired
private
FlowRpcService
flowRpcService
;
/**
* 创建工单
* @param flowCreateReqDTO
* @return
*/
public
String
createFlow
(
FlowCreateReqDTO
flowCreateReqDTO
)
{
// 先创建工单,创建完成后直接提交
log
.
info
(
"[createFlow] flowCreateReqDTO={}"
,
flowCreateReqDTO
);
AjaxResponse
<
String
>
flowCreateResponse
=
flowRpcService
.
create
(
CommonConstants
.
FLOWX_PRODUCT
,
flowCreateReqDTO
);
String
flowId
;
if
(
ResponseCodeEnum
.
SUCCESS
.
getCode
()
==
flowCreateResponse
.
getCode
())
{
flowId
=
flowCreateResponse
.
getData
();
log
.
info
(
"[createFlow] flowId ={}"
,
JSON
.
toJSONString
(
flowId
));
}
else
{
log
.
error
(
"[createFlow] create flow failed, query={}, errMsg={}"
,
JSON
.
toJSONString
(
flowCreateReqDTO
),
JSON
.
toJSONString
(
flowCreateResponse
));
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
CREATE_FLOW_ERROR
,
"创建工单错误"
);
}
return
flowId
;
}
/**
* 提交工单
* @param flowId
* @param flowDataDTO
* @param uid
* @param topoId
* @param content
* @param approved
* @return
*/
public
String
submitFlow
(
String
flowId
,
FlowDataDTO
flowDataDTO
,
String
uid
,
String
topoId
,
String
content
,
boolean
approved
)
{
NodeSubmitReqDTO
nodeSubmitReqDTO
=
new
NodeSubmitReqDTO
();
nodeSubmitReqDTO
.
setFlowId
(
flowId
);
nodeSubmitReqDTO
.
setNodeId
(
flowDataDTO
.
getFlowMeta
().
getCurrNodeDataList
().
get
(
0
).
getNodeId
());
nodeSubmitReqDTO
.
setUid
(
uid
);
nodeSubmitReqDTO
.
setUserName
(
uid
);
nodeSubmitReqDTO
.
setTopoId
(
topoId
);
nodeSubmitReqDTO
.
setContent
(
content
);
nodeSubmitReqDTO
.
setOperateResult
(
FlowxOperationEnum
.
SUBMIT
.
getName
());
nodeSubmitReqDTO
.
setCreateTime
(
System
.
currentTimeMillis
());
nodeSubmitReqDTO
.
setApproved
(
approved
);
nodeSubmitReqDTO
.
setOccLock
(
flowDataDTO
.
getOccLock
()
+
1
);
log
.
info
(
"[submitFlow] nodeSubmitReqDTO={}"
,
JSON
.
toJSONString
(
nodeSubmitReqDTO
));
List
<
String
>
nextNodeIdList
;
// 提交工单
AjaxResponse
<
List
<
String
>>
submitResponse
=
flowRpcService
.
submit
(
CommonConstants
.
FLOWX_PRODUCT
,
nodeSubmitReqDTO
);
if
(
ResponseCodeEnum
.
SUCCESS
.
getCode
()
==
submitResponse
.
getCode
())
{
nextNodeIdList
=
submitResponse
.
getData
();
log
.
info
(
"[submitFlow] nextNodeIdList={}"
,
JSON
.
toJSONString
(
nextNodeIdList
));
}
else
{
log
.
error
(
"[submitFlow] submit flow failed, query={}, errMsg={}"
,
JSON
.
toJSONString
(
nodeSubmitReqDTO
),
JSON
.
toJSONString
(
submitResponse
));
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
SUBMIT_FLOW_ERROR
,
"提交工单错误"
);
}
if
(
CollectionUtils
.
isEmpty
(
nextNodeIdList
))
{
return
ChangeFlowEnum
.
END
.
getNodeId
();
}
return
nextNodeIdList
.
get
(
0
);
}
/**
* 查询工单详情
* @param flowId
* @return
*/
public
FlowDataDTO
flowDetail
(
String
flowId
)
{
// 查询工单详情,根据详情提交
FlowDataDTO
flowDataDTO
;
AjaxResponse
<
FlowDataDTO
>
flowDetailResponse
=
flowRpcService
.
getDetail
(
CommonConstants
.
FLOWX_PRODUCT
,
flowId
);
if
(
ResponseCodeEnum
.
SUCCESS
.
getCode
()
==
flowDetailResponse
.
getCode
())
{
flowDataDTO
=
flowDetailResponse
.
getData
();
log
.
info
(
"[detailFlow] flowDataDTO={}"
,
JSON
.
toJSONString
(
flowDataDTO
));
}
else
{
log
.
error
(
"[detailFlow] get flow detail failed, query={}, errMsg={}"
,
JSON
.
toJSONString
(
flowId
),
JSON
.
toJSONString
(
flowDetailResponse
));
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
DETAIL_FLOW_ERROR
,
"查询工单详情错误"
);
}
return
flowDataDTO
;
}
}
\ No newline at end of file
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/rpc/TodoService.java
View file @
e406d60a
...
...
@@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
/**
* @Author zcwang
* @Date 2022/11/29
* 待办相关操作
*/
@Component
@Slf4j
...
...
@@ -78,10 +79,12 @@ public class TodoService {
}
/**
*
完成代
办
*
处理待
办
* @param entity
* @param operateType
* @see OperateTypeEnum
*/
public
void
finishTodoTask
(
ChangeRecord
entity
)
{
public
void
progressTodoTask
(
ChangeRecord
entity
,
Integer
operateType
)
{
String
changeCommander
=
entity
.
getChangeCommander
();
String
flowId
=
String
.
valueOf
(
entity
.
getFlowId
());
log
.
info
(
"[finishSupplierTodoTask] taskFlowId={}, supplierId={}"
,
flowId
,
changeCommander
);
...
...
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/task/AutoSubmit.java
View file @
e406d60a
...
...
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
import
com.alibaba.fastjson.JSON
;
import
com.netease.mail.yanxuan.change.biz.biz.ChangeFlowBiz
;
import
com.netease.mail.yanxuan.change.biz.service.ChangeFlowService
;
import
com.netease.mail.yanxuan.change.biz.service.rpc.FlowService
;
import
com.netease.mail.yanxuan.change.common.bean.CommonConstants
;
import
com.netease.mail.yanxuan.change.common.enums.ChangeFlowEnum
;
import
com.netease.mail.yanxuan.change.common.enums.FlowOperationTypeEnum
;
...
...
@@ -44,7 +45,7 @@ public class AutoSubmit extends IJobHandler {
private
ChangeFlowService
changeFlowService
;
@Autowired
private
ChangeFlowBiz
changeFlowBiz
;
private
FlowService
flowService
;
@Override
public
ReturnT
<
String
>
execute
(
String
...
strings
)
throws
Exception
{
...
...
@@ -80,7 +81,7 @@ public class AutoSubmit extends IJobHandler {
// 执行变更节点,提交节点
if
(
ChangeFlowEnum
.
CHANGE_FLOW_EXE
.
getNodeId
().
equals
(
flowNode
))
{
// 获取工单详情
FlowDataDTO
flowDataDTO
=
changeFlowBiz
.
flowDetail
(
flowId
.
toString
());
FlowDataDTO
flowDataDTO
=
flowService
.
flowDetail
(
flowId
.
toString
());
if
(
flowDataDTO
==
null
)
{
log
.
debug
(
"[progressRecord] get flowDataDTO error, flowId{}"
,
flowId
);
}
...
...
@@ -89,7 +90,7 @@ public class AutoSubmit extends IJobHandler {
content
.
put
(
"updateTime"
,
System
.
currentTimeMillis
());
content
.
put
(
CommonConstants
.
FLOW_OPERATION_KEY
,
FlowOperationTypeEnum
.
PASS
.
getValue
());
try
{
String
execNode
=
changeFlowBiz
.
submitFlow
(
flowId
.
toString
(),
flowDataDTO
,
uid
,
String
execNode
=
flowService
.
submitFlow
(
flowId
.
toString
(),
flowDataDTO
,
uid
,
ChangeFlowEnum
.
CHANGE_FLOW_EXE
.
getTopoId
(),
JSON
.
toJSONString
(
content
),
true
);
// 更新工单数据
changeRecord
.
setFlowNode
(
execNode
);
...
...
yanxuan-qc-change-system-dal/src/main/java/com/netease/mail/yanxuan/change/dal/meta/model/vo/ChangeFlowVO.java
View file @
e406d60a
...
...
@@ -110,7 +110,7 @@ public class ChangeFlowVO {
/**
* 变更行动部门
*/
private
List
<
ChangeFlowExecVO
>
changeExec
Departmen
t
;
private
List
<
ChangeFlowExecVO
>
changeExec
ProjectLis
t
;
/**
* 变更行动部门列表
...
...
yanxuan-qc-change-system-web/src/main/java/com/netease/mail/yanxuan/change/web/controller/TestController.java
View file @
e406d60a
...
...
@@ -12,9 +12,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
import
com.netease.mail.yanxuan.change.biz.biz.ChangeFlowBiz
;
import
com.netease.mail.yanxuan.change.biz.service.rpc.TodoService
;
import
com.netease.mail.yanxuan.change.common.bean.AjaxResult
;
import
com.netease.mail.yanxuan.change.common.enums.OperateTypeEnum
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeRecord
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -38,10 +38,10 @@ public class TestController {
return
AjaxResult
.
success
();
}
@PostMapping
(
"/
finishToD
o"
)
public
AjaxResult
<
Void
>
finishTodoTask
(
ChangeRecord
entity
)
{
log
.
info
(
"[createToDoTask] entity:{}
"
,
JSON
.
toJSONString
(
entity
)
);
todoService
.
finishTodoTask
(
entity
);
@PostMapping
(
"/
progressTod
o"
)
public
AjaxResult
<
Void
>
progressTodoTask
(
ChangeRecord
entity
,
Integer
operateType
)
{
log
.
info
(
"[createToDoTask] entity:{}
, operateType:{}"
,
JSON
.
toJSONString
(
entity
),
operateType
);
todoService
.
progressTodoTask
(
entity
,
operateType
);
return
AjaxResult
.
success
();
}
}
\ 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