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
9c33c8a9
Commit
9c33c8a9
authored
Nov 21, 2022
by
“zcwang”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 引用变更
parent
7b0420cf
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
207 additions
and
10 deletions
+207
-10
scheme.sql
doc/scheme.sql
+2
-1
ChangeFlowBiz.java
...om/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
+33
-6
ChangeFileService.java
...se/mail/yanxuan/change/biz/service/ChangeFileService.java
+27
-0
ChangeFileServiceImpl.java
...anxuan/change/biz/service/impl/ChangeFileServiceImpl.java
+42
-0
ChangeFileMapper.java
...ease/mail/yanxuan/change/dal/mapper/ChangeFileMapper.java
+8
-0
ChangeFlowFile.java
...ail/yanxuan/change/dal/meta/model/req/ChangeFlowFile.java
+6
-0
BasicChangeFlowVO.java
...l/yanxuan/change/dal/meta/model/vo/BasicChangeFlowVO.java
+85
-0
ChangeFlowController.java
...l/yanxuan/change/web/controller/ChangeFlowController.java
+4
-3
No files found.
doc/scheme.sql
View file @
9c33c8a9
...
...
@@ -84,7 +84,8 @@ CREATE TABLE `TB_YX_QC_CHANGE_FILE`
`file_url`
varchar
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'文件地址'
,
`create_time`
bigint
(
20
)
NOT
NULL
DEFAULT
'0'
COMMENT
'创建时间'
,
`update_time`
bigint
(
20
)
NOT
NULL
DEFAULT
'0'
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
),
KEY
`key_record_id`
(
`change_record_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'附件表'
;
CREATE
TABLE
`TB_YX_QC_CHANGE_EXEC_RECORD`
...
...
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
View file @
9c33c8a9
...
...
@@ -21,6 +21,7 @@ import org.springframework.util.CollectionUtils;
import
com.alibaba.fastjson.JSON
;
import
com.netease.mail.yanxuan.change.biz.config.AppConfig
;
import
com.netease.mail.yanxuan.change.biz.meta.exception.ExceptionFactory
;
import
com.netease.mail.yanxuan.change.biz.service.ChangeFileService
;
import
com.netease.mail.yanxuan.change.biz.service.ChangeFlowService
;
import
com.netease.mail.yanxuan.change.biz.service.change.ChangeConfigService
;
import
com.netease.mail.yanxuan.change.common.bean.CommonConstants
;
...
...
@@ -32,11 +33,14 @@ import com.netease.mail.yanxuan.change.common.enums.ChangeSubjectEnum;
import
com.netease.mail.yanxuan.change.common.enums.FlowOperationTypeEnum
;
import
com.netease.mail.yanxuan.change.common.enums.FlowxOperationEnum
;
import
com.netease.mail.yanxuan.change.common.util.DateUtils
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeFile
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeRecord
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeExecConfigReq
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowCancelReq
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowCreateReq
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowFile
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowSubmitReq
;
import
com.netease.mail.yanxuan.change.dal.meta.model.vo.BasicChangeFlowVO
;
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
;
...
...
@@ -65,6 +69,9 @@ public class ChangeFlowBiz {
@Autowired
private
FlowRpcService
flowRpcService
;
@Autowired
private
ChangeFileService
changeFileService
;
public
String
createAndSubmit
(
ChangeFlowCreateReq
changeFlowCreateReq
)
{
// String uid = RequestLocalBean.getUid();
String
uid
=
"x@mesg.com"
;
...
...
@@ -248,7 +255,9 @@ public class ChangeFlowBiz {
log
.
info
(
"[submitFlow] changeFlowReq:{}"
,
JSON
.
toJSONString
(
changeFlowSubmitReq
));
Long
flowId
=
changeFlowSubmitReq
.
getFlowId
();
// 查询工单有效性
ChangeRecord
changeRecord
=
this
.
checkFlow
(
flowId
,
changeFlowSubmitReq
.
getCurrentNodeId
());
ChangeRecord
changeRecord
=
this
.
getFlowInfo
(
flowId
);
// 检查工单节点
this
.
checkNode
(
changeRecord
.
getFlowNode
(),
changeFlowSubmitReq
.
getCurrentNodeId
());
// todo:检验操作权限
// String uid = RequestLocalBean.getUid();
...
...
@@ -270,22 +279,27 @@ public class ChangeFlowBiz {
ChangeFlowEnum
.
CHANGE_FLOW_SUBMIT
.
getTopoId
(),
JSON
.
toJSONString
(
content
));
}
private
ChangeRecord
checkFlow
(
Long
flowId
,
String
currentNode
Id
)
{
private
ChangeRecord
getFlowInfo
(
Long
flow
Id
)
{
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
;
}
private
void
checkNode
(
String
recordNode
,
String
currentNodeId
){
if
(!
recordNode
.
equals
(
currentNodeId
))
{
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
NODE_ERROR
,
"工单已流转至其他节点"
);
}
};
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
());
ChangeRecord
changeRecord
=
getFlowInfo
(
flowId
);
// 检查工单节点
this
.
checkNode
(
changeRecord
.
getFlowNode
(),
ChangeFlowEnum
.
CHANGE_FLOW_EXE
.
getNodeId
());
// todo:检查审核人
// 获取工单详情
...
...
@@ -308,4 +322,17 @@ public class ChangeFlowBiz {
changeRecord
.
setUpdateTime
(
DateUtils
.
getCurrentTime
());
return
changeFlowService
.
updateRecord
(
changeRecord
);
}
public
BasicChangeFlowVO
quote
(
Long
flowId
)
{
// 获取工单详情
ChangeRecord
changeRecord
=
this
.
getFlowInfo
(
flowId
);
// 获取附件
List
<
ChangeFlowFile
>
changeFileList
=
changeFileService
.
getChangeFileList
(
changeRecord
.
getId
());
return
BasicChangeFlowVO
.
builder
().
parentChangeClassId
(
changeRecord
.
getParentChangeClassId
())
.
sonChangeClassId
(
changeRecord
.
getSonChangeClassId
()).
changeSubject
(
changeRecord
.
getChangeSubject
())
.
changeItem
(
changeRecord
.
getChangeItem
()).
changeSupplier
(
changeRecord
.
getChangeSupplier
())
.
changeReason
(
changeRecord
.
getChangeReason
()).
changeContent
(
changeRecord
.
getChangeContent
())
.
changeRiskDesc
(
changeRecord
.
getChangeRiskDesc
()).
changeProfit
(
changeRecord
.
getChangeProfit
())
.
changeProfitDesc
(
changeRecord
.
getChangeProfitDesc
()).
files
(
changeFileList
).
build
();
}
}
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/ChangeFileService.java
0 → 100644
View file @
9c33c8a9
/**
* @(#)ChangeFileService.java, 2022/11/21.
* <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
;
import
java.util.List
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeFile
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowFile
;
/**
* @Author zcwang
* @Date 2022/11/21
*/
public
interface
ChangeFileService
{
/**
* 获取工单对应的附件
* @param changeRecordId
* @return
*/
List
<
ChangeFlowFile
>
getChangeFileList
(
Long
changeRecordId
);
}
\ No newline at end of file
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/impl/ChangeFileServiceImpl.java
0 → 100644
View file @
9c33c8a9
/**
* @(#)ChangeFileServiceImpl.java, 2022/11/21.
* <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
.
impl
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.netease.mail.yanxuan.change.biz.service.ChangeFileService
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeFile
;
import
com.netease.mail.yanxuan.change.dal.mapper.ChangeFileMapper
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowFile
;
/**
* @Author zcwang
* @Date 2022/11/21
*/
@Service
public
class
ChangeFileServiceImpl
implements
ChangeFileService
{
@Autowired
private
ChangeFileMapper
changeFileMapper
;
@Override
public
List
<
ChangeFlowFile
>
getChangeFileList
(
Long
changeRecordId
)
{
List
<
ChangeFile
>
changeFiles
=
changeFileMapper
.
selectByChangeRecordId
(
changeRecordId
);
if
(
CollectionUtils
.
isNotEmpty
(
changeFiles
))
{
return
changeFiles
.
stream
().
map
(
c
->
ChangeFlowFile
.
builder
().
fileType
(
c
.
getFileType
()).
fileName
(
c
.
getFileName
())
.
fileUrl
(
c
.
getFileUrl
()).
build
()).
collect
(
Collectors
.
toList
());
}
return
new
ArrayList
<>();
}
}
\ No newline at end of file
yanxuan-qc-change-system-dal/src/main/java/com/netease/mail/yanxuan/change/dal/mapper/ChangeFileMapper.java
View file @
9c33c8a9
...
...
@@ -6,7 +6,11 @@
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
dal
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeFile
;
...
...
@@ -16,4 +20,7 @@ import com.netease.mail.yanxuan.change.dal.entity.ChangeFile;
*/
@Mapper
public
interface
ChangeFileMapper
extends
tk
.
mybatis
.
mapper
.
common
.
Mapper
<
ChangeFile
>
{
@Select
(
"SELECT * FROM TB_YX_QC_CHANGE_FILE WHERE change_record_id = #{changeRecordId}"
)
List
<
ChangeFile
>
selectByChangeRecordId
(
@Param
(
"changeRecordId"
)
Long
changeRecordId
);
}
\ No newline at end of file
yanxuan-qc-change-system-dal/src/main/java/com/netease/mail/yanxuan/change/dal/meta/model/req/ChangeFlowFile.java
View file @
9c33c8a9
...
...
@@ -6,12 +6,18 @@
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
dal
.
meta
.
model
.
req
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author zcwang
* @Date 2022/11/14
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
public
class
ChangeFlowFile
{
...
...
yanxuan-qc-change-system-dal/src/main/java/com/netease/mail/yanxuan/change/dal/meta/model/vo/BasicChangeFlowVO.java
0 → 100644
View file @
9c33c8a9
/**
* @(#)BasicChangeFlowVO.java, 2022/11/21.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
dal
.
meta
.
model
.
vo
;
import
java.util.List
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeFile
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowFile
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author zcwang
* @Date 2022/11/21
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
public
class
BasicChangeFlowVO
{
/**
* 一级变更类型id
*/
private
Long
parentChangeClassId
;
/**
* 二级变更类型id
*/
private
Long
sonChangeClassId
;
/**
* 变更主体
*/
private
Integer
changeSubject
;
/**
* 变更商品(变更主体为商品时有效)
*/
private
String
changeItem
;
/**
* 变更供应商(变更主体为供应商时有效)
*/
private
String
changeSupplier
;
/**
* 变更原因
*/
private
String
changeReason
;
/**
* 变更内容
*/
private
String
changeContent
;
/**
* 变更潜在风险描述
*/
private
String
changeRiskDesc
;
/**
* 变更收益类型
*/
private
Integer
changeProfit
;
/**
* 变更收益说明
*/
private
String
changeProfitDesc
;
/**
* 附件
*/
private
List
<
ChangeFlowFile
>
files
;
}
\ No newline at end of file
yanxuan-qc-change-system-web/src/main/java/com/netease/mail/yanxuan/change/web/controller/ChangeFlowController.java
View file @
9c33c8a9
...
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -23,6 +24,7 @@ import com.netease.mail.yanxuan.change.biz.service.ChangeFlowService;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowCancelReq
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowCreateReq
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowSubmitReq
;
import
com.netease.mail.yanxuan.change.dal.meta.model.vo.BasicChangeFlowVO
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -111,9 +113,8 @@ public class ChangeFlowController {
* @return
*/
@GetMapping
(
"/quote"
)
public
AjaxResult
<
Void
>
quote
()
{
return
AjaxResult
.
success
();
public
AjaxResult
<
BasicChangeFlowVO
>
quote
(
@RequestParam
Long
flowId
)
{
return
AjaxResult
.
success
(
changeFlowBiz
.
quote
(
flowId
));
}
...
...
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