Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
705da10d
Commit
705da10d
authored
Nov 18, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
补充跟进必填字段逻辑校验
parent
ef71df7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
3 deletions
+74
-3
ErrorCodeConstants.java
...coder/yudao/module/customer/enums/ErrorCodeConstants.java
+13
-0
CustomerFollowupServiceImpl.java
...service/customerFollowup/CustomerFollowupServiceImpl.java
+61
-3
No files found.
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/enums/ErrorCodeConstants.java
View file @
705da10d
...
...
@@ -37,4 +37,17 @@ public interface ErrorCodeConstants {
ErrorCode
FOLLOWUP_NUMBER_NOT_NULL
=
new
ErrorCode
(
1005001015
,
"客户跟进编号不能为空"
);
ErrorCode
FOLLOWUP_TYPE_NOT_NULL
=
new
ErrorCode
(
1005001016
,
"请选择跟进类型"
);
ErrorCode
BUSINESS_OPPORTUNITY_FOLLOWUP_OFFER_NOT_NULL
=
new
ErrorCode
(
1005001017
,
"商机跟进时,请选择报价单"
);
ErrorCode
CUSTOMER_NOT_NULL
=
new
ErrorCode
(
1005001018
,
"请选择客户"
);
ErrorCode
CUSTOMER_CONTACT_NOT_NULL
=
new
ErrorCode
(
1005001019
,
"请选择客户联系人"
);
ErrorCode
FOLLOWUP_TIME_NOT_NULL
=
new
ErrorCode
(
1005001020
,
"请选择跟进时间"
);
ErrorCode
FOLLOWUP_METHOD_NOT_NULL
=
new
ErrorCode
(
1005001021
,
"请选择跟进方式"
);
ErrorCode
CUSTOMER_SERVICE_NOT_NULL
=
new
ErrorCode
(
1005001022
,
"请选择客户经理"
);
ErrorCode
FOLLOWUP_RESULT_NOT_NULL
=
new
ErrorCode
(
1005001023
,
"请选择跟进结果"
);
ErrorCode
FOLLOWUP_PURPOSE_NOT_NULL
=
new
ErrorCode
(
1005001024
,
"请填写跟进目的"
);
ErrorCode
FOLLOWUP_FEEFBACK_NOT_NULL
=
new
ErrorCode
(
1005001025
,
"请填写跟进情况"
);
ErrorCode
NEXT_FOLLOWUP_TIME_NOT_NULL
=
new
ErrorCode
(
1005001026
,
"请选择下次跟进时间"
);
ErrorCode
NEXT_FOLLOWUP_PLAN_NOT_NULL
=
new
ErrorCode
(
1005001027
,
"请填写下一步计划"
);
}
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customerFollowup/CustomerFollowupServiceImpl.java
View file @
705da10d
...
...
@@ -24,7 +24,10 @@ import cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum;
import
cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum
;
import
cn.iocoder.yudao.module.system.api.user.AdminUserApi
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -36,8 +39,8 @@ import java.util.List;
import
java.util.Objects
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
customer
.
enums
.
ErrorCodeConstants
.
FOLLOWUP_ALREADY_SUBMITTE
D
;
import
static
cn
.
iocoder
.
yudao
.
module
.
customer
.
enums
.
ErrorCodeConstants
.
FOLLOWUP_NOT_EXISTS
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECON
D
;
import
static
cn
.
iocoder
.
yudao
.
module
.
customer
.
enums
.
ErrorCodeConstants
.
*
;
/**
* 客户跟进 Service 实现类
...
...
@@ -93,6 +96,7 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
createFollowup
(
CustomerFollowupCreateReqVO
createReqVO
)
{
// 更新编号,内部会判断冲突
//OrderNumberLogListener
OrderNumberLogEvent
event
=
new
OrderNumberLogEvent
();
...
...
@@ -106,6 +110,12 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
applicationContext
.
publishEvent
(
event
);
// 插入
CustomerFollowupDO
followup
=
CustomerFollowupConvert
.
INSTANCE
.
convert
(
createReqVO
);
if
(
Objects
.
isNull
(
followup
.
getFollowType
())){
throw
exception
(
FOLLOWUP_TYPE_NOT_NULL
);
}
if
(
followup
.
getFollowType
()
==
2
&&
Objects
.
isNull
(
followup
.
getOfferId
())){
throw
exception
(
BUSINESS_OPPORTUNITY_FOLLOWUP_OFFER_NOT_NULL
);
}
// 设置联系人名称
setContactName
(
followup
);
followup
.
setNumber
(
newNumber
);
...
...
@@ -113,6 +123,10 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 获取客户经理的部门id
followup
.
setDeptId
(
adminUserApi
.
getUserDeptId
(
followup
.
getFollowUserId
()));
}
// 当跟进为提交结果时,除附件和上级跟进单非必填,其他参数都时必填
if
(
followup
.
getStatus
()
==
1
){
validateFollowupMustParams
(
followup
);
}
followupMapper
.
insert
(
followup
);
Long
customerId
=
createReqVO
.
getCustomerId
();
...
...
@@ -143,6 +157,40 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
return
followup
.
getId
();
}
private
void
validateFollowupMustParams
(
CustomerFollowupDO
followup
)
{
if
(
Objects
.
isNull
(
followup
.
getCustomerId
())){
throw
exception
(
CUSTOMER_NOT_NULL
);
}
if
(
Objects
.
isNull
(
followup
.
getContactId
())){
throw
exception
(
CUSTOMER_CONTACT_NOT_NULL
);
}
if
(
Objects
.
isNull
(
followup
.
getFollowTime
())){
throw
exception
(
FOLLOWUP_TIME_NOT_NULL
);
}
if
(
Objects
.
isNull
(
followup
.
getFollowMethod
())){
throw
exception
(
FOLLOWUP_METHOD_NOT_NULL
);
}
if
(
Objects
.
isNull
(
followup
.
getFollowUserId
())){
throw
exception
(
CUSTOMER_SERVICE_NOT_NULL
);
}
if
(
Objects
.
isNull
(
followup
.
getResultType
())){
throw
exception
(
FOLLOWUP_RESULT_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
followup
.
getPurpose
())){
throw
exception
(
FOLLOWUP_PURPOSE_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
followup
.
getFeedback
())){
throw
exception
(
FOLLOWUP_FEEFBACK_NOT_NULL
);
}
if
(
Objects
.
isNull
(
followup
.
getNextTime
())){
throw
exception
(
NEXT_FOLLOWUP_TIME_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
followup
.
getNextPlan
())){
throw
exception
(
NEXT_FOLLOWUP_PLAN_NOT_NULL
);
}
}
private
void
setContactName
(
CustomerFollowupDO
followup
)
{
// 设置联系人名称
Long
contactId
=
followup
.
getContactId
();
...
...
@@ -156,6 +204,7 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Override
public
void
updateFollowup
(
CustomerFollowupUpdateReqVO
updateReqVO
)
{
// 校验存在
Long
id
=
updateReqVO
.
getId
();
CustomerFollowupDO
customerFollowupDO
=
followupMapper
.
selectById
(
id
);
...
...
@@ -167,13 +216,22 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
}
// 更新
CustomerFollowupDO
updateObj
=
CustomerFollowupConvert
.
INSTANCE
.
convert
(
updateReqVO
);
if
(
Objects
.
isNull
(
updateObj
.
getFollowType
())){
throw
exception
(
FOLLOWUP_TYPE_NOT_NULL
);
}
if
(
updateObj
.
getFollowType
()
==
2
&&
Objects
.
isNull
(
updateObj
.
getOfferId
())){
throw
exception
(
BUSINESS_OPPORTUNITY_FOLLOWUP_OFFER_NOT_NULL
);
}
// 设置联系人名称
setContactName
(
updateObj
);
if
(
Objects
.
nonNull
(
updateObj
.
getFollowUserId
())){
// 获取客户经理的部门id
updateObj
.
setDeptId
(
adminUserApi
.
getUserDeptId
(
updateObj
.
getFollowUserId
()));
}
// 当跟进为提交结果时,除附件和上级跟进单非必填,其他参数都时必填
if
(
updateObj
.
getStatus
()
==
1
){
validateFollowupMustParams
(
updateObj
);
}
followupMapper
.
updateById
(
updateObj
);
Long
customerId
=
updateReqVO
.
getCustomerId
();
...
...
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