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
胡园园
yanxuan-qc-change-system
Commits
feb96a57
Commit
feb96a57
authored
Nov 21, 2022
by
“zcwang”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify: 取消变更
parent
933e7902
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
16 deletions
+65
-16
ChangeFlowBiz.java
...om/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
+48
-16
ChangeFlowService.java
...se/mail/yanxuan/change/biz/service/ChangeFlowService.java
+9
-0
ChangeFlowServiceImpl.java
...anxuan/change/biz/service/impl/ChangeFlowServiceImpl.java
+8
-0
No files found.
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
View file @
feb96a57
...
...
@@ -107,12 +107,12 @@ public class ChangeFlowBiz {
// 如果发起人=变更负责人
if
(
true
)
{
List
<
String
>
nextNodeIdList
=
submitFlow
(
flowId
,
flowDataDTO
,
uid
,
String
nextNodeId
=
submitFlow
(
flowId
,
flowDataDTO
,
uid
,
ChangeFlowEnum
.
CHANGE_FLOW_START
.
getTopoId
(),
JSON
.
toJSONString
(
content
));
if
(
CollectionUtils
.
isEmpty
(
nextNodeIdList
)
)
{
if
(
null
==
nextNodeId
)
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
SUBMIT_FLOW_ERROR
,
"首次提交节点失败"
);
}
return
nextNodeId
List
.
get
(
0
)
;
return
nextNodeId
;
}
return
flowId
;
}
...
...
@@ -159,7 +159,7 @@ public class ChangeFlowBiz {
return
flowCreateReqDTO
;
}
private
List
<
String
>
submitFlow
(
String
flowId
,
FlowDataDTO
flowDataDTO
,
String
uid
,
String
topoId
,
String
content
)
{
private
String
submitFlow
(
String
flowId
,
FlowDataDTO
flowDataDTO
,
String
uid
,
String
topoId
,
String
content
)
{
NodeSubmitReqDTO
nodeSubmitReqDTO
=
new
NodeSubmitReqDTO
();
nodeSubmitReqDTO
.
setFlowId
(
flowId
);
nodeSubmitReqDTO
.
setNodeId
(
flowDataDTO
.
getFlowMeta
().
getCurrNodeDataList
().
get
(
0
).
getNodeId
());
...
...
@@ -184,7 +184,10 @@ public class ChangeFlowBiz {
JSON
.
toJSONString
(
submitResponse
));
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
SUBMIT_FLOW_ERROR
,
"提交工单错误"
);
}
return
nextNodeIdList
;
if
(
CollectionUtils
.
isEmpty
(
nextNodeIdList
))
{
return
ChangeFlowEnum
.
END
.
getNodeId
();
}
return
nextNodeIdList
.
get
(
0
);
}
private
String
createFlow
(
FlowCreateReqDTO
flowCreateReqDTO
)
{
...
...
@@ -245,14 +248,9 @@ public class ChangeFlowBiz {
log
.
info
(
"[submitFlow] changeFlowReq:{}"
,
JSON
.
toJSONString
(
changeFlowSubmitReq
));
Long
flowId
=
changeFlowSubmitReq
.
getFlowId
();
// 查询工单有效性
ChangeRecord
changeRecord
=
changeFlowService
.
getByFlowId
(
flowId
);
if
(
changeRecord
==
null
)
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
ERROR_FLOW_ID
,
"工单id不存在"
);
}
if
(!
changeRecord
.
getFlowNode
().
equals
(
changeFlowSubmitReq
.
getCurrentNodeId
()))
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
NODE_ERROR
,
"工单已流转至其他节点"
);
}
ChangeRecord
changeRecord
=
this
.
checkFlow
(
flowId
,
changeFlowSubmitReq
.
getCurrentNodeId
());
// todo:检验操作权限
// String uid = RequestLocalBean.getUid();
String
uid
=
"1"
;
String
changeCommander
=
changeRecord
.
getChangeCommander
();
...
...
@@ -261,20 +259,54 @@ public class ChangeFlowBiz {
}
// 获取工单详情
FlowDataDTO
flowDataDTO
=
this
.
flowDetail
(
flowId
.
toString
());
if
(
flowDataDTO
==
null
)
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
DETAIL_FLOW_ERROR
,
"工单查询错误,不存在"
);
}
// 工单流传
Map
<
String
,
Object
>
content
=
new
HashMap
<>(
CommonConstants
.
INIT_HASH_MAP_SIZE
);
content
.
put
(
"updateTime"
,
System
.
currentTimeMillis
());
content
.
put
(
CommonConstants
.
FLOW_OPERATION_KEY
,
FlowOperationTypeEnum
.
PASS
.
getValue
());
List
<
String
>
nextNodeList
=
this
.
submitFlow
(
flowId
.
toString
(),
flowDataDTO
,
uid
,
return
this
.
submitFlow
(
flowId
.
toString
(),
flowDataDTO
,
uid
,
ChangeFlowEnum
.
CHANGE_FLOW_SUBMIT
.
getTopoId
(),
JSON
.
toJSONString
(
content
));
if
(
CollectionUtils
.
isEmpty
(
nextNodeList
))
{
return
ChangeFlowEnum
.
END
.
getNodeId
();
}
return
nextNodeList
.
get
(
0
);
private
ChangeRecord
checkFlow
(
Long
flowId
,
String
currentNodeId
)
{
ChangeRecord
changeRecord
=
changeFlowService
.
getByFlowId
(
flowId
);
if
(
changeRecord
==
null
)
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
ERROR_FLOW_ID
,
"工单id不存在"
);
}
if
(!
changeRecord
.
getFlowNode
().
equals
(
currentNodeId
))
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
NODE_ERROR
,
"工单已流转至其他节点"
);
}
return
changeRecord
;
}
public
Boolean
cancel
(
ChangeFlowCancelReq
req
)
{
log
.
info
(
"[cancel] req:{}"
,
JSON
.
toJSONString
(
req
));
Long
flowId
=
req
.
getFlowId
();
// 查询工单有效性
ChangeRecord
changeRecord
=
checkFlow
(
flowId
,
ChangeFlowEnum
.
CHANGE_FLOW_EXE
.
getNodeId
());
// todo:检查审核人
// 获取工单详情
FlowDataDTO
flowDataDTO
=
this
.
flowDetail
(
flowId
.
toString
());
if
(
flowDataDTO
==
null
)
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
DETAIL_FLOW_ERROR
,
"工单查询错误,不存在"
);
}
// 工单流转
Map
<
String
,
Object
>
content
=
new
HashMap
<>(
CommonConstants
.
INIT_HASH_MAP_SIZE
);
content
.
put
(
"updateTime"
,
System
.
currentTimeMillis
());
content
.
put
(
CommonConstants
.
FLOW_OPERATION_KEY
,
FlowOperationTypeEnum
.
REFUSE
.
getValue
());
// String uid = RequestLocalBean.getUid();
String
uid
=
"1"
;
String
nextNodeId
=
this
.
submitFlow
(
String
.
valueOf
(
flowId
),
flowDataDTO
,
uid
,
ChangeFlowEnum
.
CHANGE_FLOW_EXE
.
getTopoId
(),
JSON
.
toJSONString
(
content
));
log
.
info
(
"[cancel] nextNodeId:{}"
,
nextNodeId
);
// 填充更新数据
changeRecord
.
setFlowNode
(
nextNodeId
);
changeRecord
.
setState
(
ChangeStatusEnum
.
CANCEL
.
getStatus
());
changeRecord
.
setCancelReason
(
req
.
getCancelReason
());
changeRecord
.
setUpdateTime
(
DateUtils
.
getCurrentTime
());
changeFlowService
.
updateRecord
(
changeRecord
);
return
false
;
}
}
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/ChangeFlowService.java
View file @
feb96a57
...
...
@@ -6,6 +6,8 @@
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
service
;
import
java.util.List
;
import
com.netease.mail.yanxuan.change.biz.config.TitleConfig
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeRecord
;
...
...
@@ -35,4 +37,10 @@ public interface ChangeFlowService {
*/
ChangeRecord
getByFlowId
(
Long
flowId
);
/**
* 更新工单信息
* @param changeRecord
* @return
*/
Boolean
updateRecord
(
ChangeRecord
changeRecord
);
}
\ No newline at end of file
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/impl/ChangeFlowServiceImpl.java
View file @
feb96a57
...
...
@@ -6,6 +6,8 @@
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -43,4 +45,9 @@ public class ChangeFlowServiceImpl implements ChangeFlowService {
public
ChangeRecord
getByFlowId
(
Long
flowId
)
{
return
changeRecordMapper
.
selectByFlowId
(
flowId
);
}
@Override
public
Boolean
updateRecord
(
ChangeRecord
changeRecord
)
{
return
changeRecordMapper
.
updateByPrimaryKey
(
changeRecord
)
>
0
;
}
}
\ 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