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
9750fca0
Commit
9750fca0
authored
Nov 15, 2022
by
“zcwang”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 创建工单
parent
5152a603
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
150 additions
and
19 deletions
+150
-19
scheme.sql
doc/scheme.sql
+4
-3
ChangeFlowBiz.java
...om/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
+75
-0
ChangeFlowService.java
...se/mail/yanxuan/change/biz/service/ChangeFlowService.java
+5
-0
ChangeFlowServiceImpl.java
...anxuan/change/biz/service/impl/ChangeFlowServiceImpl.java
+12
-0
ChangeSubjectEnum.java
...e/mail/yanxuan/change/common/enums/ChangeSubjectEnum.java
+11
-1
NeedFileEnum.java
...etease/mail/yanxuan/change/common/enums/NeedFileEnum.java
+30
-0
ChangeRecord.java
.../netease/mail/yanxuan/change/dal/entity/ChangeRecord.java
+4
-9
ChangeFlowCreateReq.java
...anxuan/change/dal/meta/model/req/ChangeFlowCreateReq.java
+8
-5
ChangeFlowController.java
...l/yanxuan/change/web/controller/ChangeFlowController.java
+1
-1
No files found.
doc/scheme.sql
View file @
9750fca0
...
@@ -41,7 +41,7 @@ CREATE TABLE `TB_YX_CHANGE_TYPE`
...
@@ -41,7 +41,7 @@ CREATE TABLE `TB_YX_CHANGE_TYPE`
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'变更类型表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'变更类型表'
;
CREATE
TABLE
`
TB_YX_CHANGE_RECORD
`
CREATE
TABLE
`
tb_yx_change_record
`
(
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
,
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
,
`flow_id`
bigint
(
20
)
NOT
NULL
COMMENT
'工单id'
,
`flow_id`
bigint
(
20
)
NOT
NULL
COMMENT
'工单id'
,
...
@@ -49,6 +49,7 @@ CREATE TABLE `TB_YX_CHANGE_RECORD`
...
@@ -49,6 +49,7 @@ CREATE TABLE `TB_YX_CHANGE_RECORD`
`change_subject`
int
(
11
)
NOT
NULL
COMMENT
'变更主体'
,
`change_subject`
int
(
11
)
NOT
NULL
COMMENT
'变更主体'
,
`parent_change_class_id`
int
(
11
)
NOT
NULL
COMMENT
'一级变更类型id'
,
`parent_change_class_id`
int
(
11
)
NOT
NULL
COMMENT
'一级变更类型id'
,
`son_change_class_id`
int
(
11
)
NOT
NULL
COMMENT
'二级变更类型id'
,
`son_change_class_id`
int
(
11
)
NOT
NULL
COMMENT
'二级变更类型id'
,
`change_level`
int
(
11
)
NOT
NULL
COMMENT
'变更等级'
,
`change_commander`
varchar
(
20
)
NOT
NULL
COMMENT
'变更负责人'
,
`change_commander`
varchar
(
20
)
NOT
NULL
COMMENT
'变更负责人'
,
`change_item`
varchar
(
20
)
NOT
NULL
COMMENT
'变更商品(变更主体为商品时有效)'
,
`change_item`
varchar
(
20
)
NOT
NULL
COMMENT
'变更商品(变更主体为商品时有效)'
,
`change_supplier`
varchar
(
20
)
NOT
NULL
COMMENT
'变更供应商(变更主体为供应商时有效)'
,
`change_supplier`
varchar
(
20
)
NOT
NULL
COMMENT
'变更供应商(变更主体为供应商时有效)'
,
...
@@ -56,7 +57,7 @@ CREATE TABLE `TB_YX_CHANGE_RECORD`
...
@@ -56,7 +57,7 @@ CREATE TABLE `TB_YX_CHANGE_RECORD`
`change_content`
varchar
(
500
)
NOT
NULL
COMMENT
'变更内容'
,
`change_content`
varchar
(
500
)
NOT
NULL
COMMENT
'变更内容'
,
`change_risk_desc`
varchar
(
255
)
NOT
NULL
COMMENT
'变更潜在风险描述'
,
`change_risk_desc`
varchar
(
255
)
NOT
NULL
COMMENT
'变更潜在风险描述'
,
`change_checking`
varchar
(
255
)
NOT
NULL
COMMENT
'变更验证措施'
,
`change_checking`
varchar
(
255
)
NOT
NULL
COMMENT
'变更验证措施'
,
`change_profit`
varchar
(
255
)
NOT
NULL
COMMENT
'变更收益'
,
`change_profit`
int
(
10
)
NOT
NULL
COMMENT
'变更收益'
,
`change_profit_desc`
varchar
(
255
)
NOT
NULL
COMMENT
'变更收益说明'
,
`change_profit_desc`
varchar
(
255
)
NOT
NULL
COMMENT
'变更收益说明'
,
`change_confirm_result_time`
bigint
(
20
)
NOT
NULL
COMMENT
'变更结果确认时间'
,
`change_confirm_result_time`
bigint
(
20
)
NOT
NULL
COMMENT
'变更结果确认时间'
,
`state`
int
(
2
)
NOT
NULL
COMMENT
'工单状态'
,
`state`
int
(
2
)
NOT
NULL
COMMENT
'工单状态'
,
...
@@ -70,7 +71,7 @@ CREATE TABLE `TB_YX_CHANGE_RECORD`
...
@@ -70,7 +71,7 @@ CREATE TABLE `TB_YX_CHANGE_RECORD`
`create_time`
bigint
(
20
)
NOT
NULL
COMMENT
'创建时间'
,
`create_time`
bigint
(
20
)
NOT
NULL
COMMENT
'创建时间'
,
`update_time`
bigint
(
20
)
NOT
NULL
COMMENT
'更新时间'
,
`update_time`
bigint
(
20
)
NOT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'变更工单记录表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COMMENT
=
'变更工单记录表'
;
CREATE
TABLE
`TB_YX_CHANGE_FILE`
CREATE
TABLE
`TB_YX_CHANGE_FILE`
(
(
...
...
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/biz/ChangeFlowBiz.java
View file @
9750fca0
...
@@ -6,7 +6,20 @@
...
@@ -6,7 +6,20 @@
*/
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
biz
;
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
biz
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
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.enums.ChangeStatusEnum
;
import
com.netease.mail.yanxuan.change.common.enums.ChangeSubjectEnum
;
import
com.netease.mail.yanxuan.change.common.enums.NeedFileEnum
;
import
com.netease.mail.yanxuan.change.common.util.DateUtils
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeConfig
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeRecord
;
import
com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeFlowCreateReq
;
/**
/**
* @Author zcwang
* @Author zcwang
...
@@ -15,5 +28,66 @@ import org.springframework.stereotype.Component;
...
@@ -15,5 +28,66 @@ import org.springframework.stereotype.Component;
@Component
@Component
public
class
ChangeFlowBiz
{
public
class
ChangeFlowBiz
{
@Autowired
private
ChangeConfigService
changeConfigService
;
@Autowired
private
ChangeFlowService
changeFlowService
;
public
Boolean
createAndSubmit
(
ChangeFlowCreateReq
changeFlowCreateReq
)
{
// 校验变更主体
Boolean
containsChangeSubject
=
ChangeSubjectEnum
.
getByType
(
changeFlowCreateReq
.
getChangeSubject
());
Assert
.
isTrue
(
containsChangeSubject
,
"变更主体不存在"
);
// 检验是否需要资料
ChangeConfig
changeConfig
=
changeConfigService
.
queryChangeConfig
(
changeFlowCreateReq
.
getSonChangeClassId
());
Assert
.
notNull
(
changeConfig
,
"二级变更类型不存在"
);
Integer
needFile
=
changeConfig
.
getNeedFile
();
if
(
NeedFileEnum
.
NEED
.
getStatus
().
equals
(
needFile
))
{
Assert
.
notEmpty
(
changeFlowCreateReq
.
getFiles
(),
"必须上传资料"
);
}
// 创建并提交工作流
// 保存工单数据
ChangeRecord
record
=
buildRecord
(
changeFlowCreateReq
);
changeFlowService
.
saveRecord
(
record
);
return
null
;
}
private
ChangeRecord
buildRecord
(
ChangeFlowCreateReq
changeFlowCreateReq
)
{
ChangeRecord
changeRecord
=
new
ChangeRecord
();
// todo
changeRecord
.
setFlowId
(
null
);
// todo
changeRecord
.
setFlowNode
(
null
);
changeRecord
.
setChangeSubject
(
changeFlowCreateReq
.
getChangeSubject
());
changeRecord
.
setParentChangeClassId
(
changeFlowCreateReq
.
getParentChangeClassId
());
changeRecord
.
setSonChangeClassId
(
changeFlowCreateReq
.
getSonChangeClassId
());
// todo: 变更负责人
changeRecord
.
setChangeCommander
(
null
);
changeRecord
.
setChangeItem
(
changeFlowCreateReq
.
getChangeItems
());
changeRecord
.
setChangeSupplier
(
changeFlowCreateReq
.
getChangeSupplier
());
changeRecord
.
setChangeReason
(
changeFlowCreateReq
.
getChangeReason
());
changeRecord
.
setChangeContent
(
changeFlowCreateReq
.
getChangeContent
());
changeRecord
.
setChangeRiskDesc
(
changeFlowCreateReq
.
getChangeRiskDesc
());
changeRecord
.
setChangeProfit
(
changeFlowCreateReq
.
getChangeProfit
());
changeRecord
.
setChangeProfitDesc
(
changeFlowCreateReq
.
getChangeProfitDesc
());
changeRecord
.
setChangeConfirmResultTime
(
changeFlowCreateReq
.
getChangeConfirmResultTime
());
// todo: 工单状态
changeRecord
.
setState
(
ChangeStatusEnum
.
IN
.
getStatus
());
// todo:工单是否被取消
changeRecord
.
setIsCancel
(
0
);
// 变更结论
changeRecord
.
setChangeResult
(
null
);
changeRecord
.
setCreateSource
(
changeFlowCreateReq
.
getCreateSource
());
changeRecord
.
setCreateSupplier
(
changeFlowCreateReq
.
getChangeSupplier
());
changeRecord
.
setChangeResultDesc
(
""
);
changeRecord
.
setRemark
(
""
);
changeRecord
.
setCreator
(
null
);
changeRecord
.
setCreateTime
(
DateUtils
.
getCurrentTime
());
changeRecord
.
setUpdateTime
(
DateUtils
.
getCurrentTime
());
return
changeRecord
;
}
}
}
\ No newline at end of file
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/ChangeFlowService.java
View file @
9750fca0
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
service
;
package
com
.
netease
.
mail
.
yanxuan
.
change
.
biz
.
service
;
import
com.netease.mail.yanxuan.change.biz.config.TitleConfig
;
import
com.netease.mail.yanxuan.change.biz.config.TitleConfig
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeRecord
;
import
com.netease.mail.yanxuan.change.dal.meta.model.vo.ChangeFlowVO
;
/**
/**
* @Author zcwang
* @Author zcwang
...
@@ -19,4 +21,6 @@ public interface ChangeFlowService {
...
@@ -19,4 +21,6 @@ public interface ChangeFlowService {
* @return
* @return
*/
*/
TitleConfig
getTitleConfig
();
TitleConfig
getTitleConfig
();
Integer
saveRecord
(
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 @
9750fca0
...
@@ -12,6 +12,9 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,9 @@ import org.springframework.stereotype.Service;
import
com.netease.mail.yanxuan.change.biz.config.AppConfig
;
import
com.netease.mail.yanxuan.change.biz.config.AppConfig
;
import
com.netease.mail.yanxuan.change.biz.config.TitleConfig
;
import
com.netease.mail.yanxuan.change.biz.config.TitleConfig
;
import
com.netease.mail.yanxuan.change.biz.service.ChangeFlowService
;
import
com.netease.mail.yanxuan.change.biz.service.ChangeFlowService
;
import
com.netease.mail.yanxuan.change.dal.entity.ChangeRecord
;
import
com.netease.mail.yanxuan.change.dal.mapper.ChangeRecordMapper
;
import
com.netease.mail.yanxuan.change.dal.meta.model.vo.ChangeFlowVO
;
/**
/**
* @Author zcwang
* @Author zcwang
...
@@ -21,10 +24,18 @@ import com.netease.mail.yanxuan.change.biz.service.ChangeFlowService;
...
@@ -21,10 +24,18 @@ import com.netease.mail.yanxuan.change.biz.service.ChangeFlowService;
public
class
ChangeFlowServiceImpl
implements
ChangeFlowService
{
public
class
ChangeFlowServiceImpl
implements
ChangeFlowService
{
@Autowired
@Autowired
private
ChangeRecordMapper
changeRecordMapper
;
@Autowired
private
AppConfig
appConfig
;
private
AppConfig
appConfig
;
@Override
@Override
public
TitleConfig
getTitleConfig
()
{
public
TitleConfig
getTitleConfig
()
{
return
appConfig
.
getTitleConfig
();
return
appConfig
.
getTitleConfig
();
}
}
@Override
public
Integer
saveRecord
(
ChangeRecord
changeRecord
)
{
return
changeRecordMapper
.
insertSelective
(
changeRecord
);
}
}
}
\ No newline at end of file
yanxuan-qc-change-system-common/src/main/java/com/netease/mail/yanxuan/change/common/enums/ChangeSubjectEnum.java
View file @
9750fca0
...
@@ -15,7 +15,7 @@ public enum ChangeSubjectEnum {
...
@@ -15,7 +15,7 @@ public enum ChangeSubjectEnum {
PRODUCT
(
1
,
"商品变更"
),
PRODUCT
(
1
,
"商品变更"
),
SUPPLIER
(
2
,
"供应商变更"
),
SUPPLIER
(
2
,
"供应商变更"
),
O
ther
(
3
,
"其他变更"
);
O
THER
(
3
,
"其他变更"
);
private
Integer
type
;
private
Integer
type
;
...
@@ -33,4 +33,13 @@ public enum ChangeSubjectEnum {
...
@@ -33,4 +33,13 @@ public enum ChangeSubjectEnum {
public
String
getDesc
()
{
public
String
getDesc
()
{
return
desc
;
return
desc
;
}
}
public
static
Boolean
getByType
(
Integer
type
)
{
for
(
ChangeSubjectEnum
value
:
ChangeSubjectEnum
.
values
())
{
if
(
value
.
getType
().
equals
(
type
))
{
return
true
;
}
}
return
false
;
}
}
}
\ No newline at end of file
yanxuan-qc-change-system-common/src/main/java/com/netease/mail/yanxuan/change/common/enums/NeedFileEnum.java
0 → 100644
View file @
9750fca0
/**
* @(#)NeedFileEnum.java, 2022/11/15.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package
com
.
netease
.
mail
.
yanxuan
.
change
.
common
.
enums
;
/**
* @Author zcwang
* @Date 2022/11/15
*/
public
enum
NeedFileEnum
{
NEED
(
1
,
"需要上传文件"
),
NOT_NEED
(
2
,
"无需上传文件"
);
private
Integer
status
;
private
String
desc
;
NeedFileEnum
(
Integer
status
,
String
desc
)
{
this
.
status
=
status
;
this
.
desc
=
desc
;
}
public
Integer
getStatus
()
{
return
status
;
}
}
\ No newline at end of file
yanxuan-qc-change-system-dal/src/main/java/com/netease/mail/yanxuan/change/dal/entity/ChangeRecord.java
View file @
9750fca0
...
@@ -50,12 +50,12 @@ public class ChangeRecord {
...
@@ -50,12 +50,12 @@ public class ChangeRecord {
/**
/**
* 一级变更类型id
* 一级变更类型id
*/
*/
private
Integer
parentChangeClassId
;
private
Long
parentChangeClassId
;
/**
/**
* 二级变更类型id
* 二级变更类型id
*/
*/
private
Integer
sonChangeClassId
;
private
Long
sonChangeClassId
;
/**
/**
* 变更负责人
* 变更负责人
...
@@ -88,14 +88,9 @@ public class ChangeRecord {
...
@@ -88,14 +88,9 @@ public class ChangeRecord {
private
String
changeRiskDesc
;
private
String
changeRiskDesc
;
/**
/**
* 变更
验证措施
* 变更
收益类型
*/
*/
private
String
changeChecking
;
private
Integer
changeProfit
;
/**
* 变更收益
*/
private
String
changeProfit
;
/**
/**
* 变更收益说明
* 变更收益说明
...
...
yanxuan-qc-change-system-dal/src/main/java/com/netease/mail/yanxuan/change/dal/meta/model/req/ChangeFlowCreateReq.java
View file @
9750fca0
...
@@ -12,30 +12,32 @@ import javax.validation.constraints.Max;
...
@@ -12,30 +12,32 @@ import javax.validation.constraints.Max;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
lombok.Data
;
/**
/**
* @Author zcwang
* @Author zcwang
* @Date 2022/11/15
* @Date 2022/11/15
*/
*/
@Data
public
class
ChangeFlowCreateReq
{
public
class
ChangeFlowCreateReq
{
/**
/**
* 变更主体
* 变更主体
*/
*/
@NotNull
(
message
=
"变更
类型
不能为空"
)
@NotNull
(
message
=
"变更
主体
不能为空"
)
private
Integer
changeSubject
;
private
Integer
changeSubject
;
/**
/**
* 一级变更类型id
* 一级变更类型id
*/
*/
@NotNull
(
message
=
"一级变更类型不能为空"
)
@NotNull
(
message
=
"一级变更类型不能为空"
)
private
Integer
parentChangeClassId
;
private
Long
parentChangeClassId
;
/**
/**
* 二级变更类型id
* 二级变更类型id
*/
*/
@NotNull
(
message
=
"二级变更类型不能为空"
)
@NotNull
(
message
=
"二级变更类型不能为空"
)
private
Integer
sonChangeClassId
;
private
Long
sonChangeClassId
;
/**
/**
* 变更商品列表
* 变更商品列表
...
@@ -74,7 +76,8 @@ public class ChangeFlowCreateReq {
...
@@ -74,7 +76,8 @@ public class ChangeFlowCreateReq {
/**
/**
* 变更收益类型
* 变更收益类型
*/
*/
private
String
changeProfit
;
@NotNull
(
message
=
"变更收益类型不能为空"
)
private
Integer
changeProfit
;
/**
/**
* 变更收益说明
* 变更收益说明
...
...
yanxuan-qc-change-system-web/src/main/java/com/netease/mail/yanxuan/change/web/controller/ChangeFlowController.java
View file @
9750fca0
...
@@ -76,7 +76,7 @@ public class ChangeFlowController {
...
@@ -76,7 +76,7 @@ public class ChangeFlowController {
@PostMapping
(
"/create"
)
@PostMapping
(
"/create"
)
public
AjaxResult
<
Boolean
>
createAndSubmit
(
@RequestBody
@Valid
ChangeFlowCreateReq
changeFlowCreateReq
)
{
public
AjaxResult
<
Boolean
>
createAndSubmit
(
@RequestBody
@Valid
ChangeFlowCreateReq
changeFlowCreateReq
)
{
log
.
info
(
"[createAndSubmit] createAndSubmit req={}"
,
JSON
.
toJSONString
(
changeFlowCreateReq
));
log
.
info
(
"[createAndSubmit] createAndSubmit req={}"
,
JSON
.
toJSONString
(
changeFlowCreateReq
));
return
AjaxResult
.
success
();
return
AjaxResult
.
success
(
changeFlowBiz
.
createAndSubmit
(
changeFlowCreateReq
)
);
}
}
/**
/**
...
...
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