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
b1082215
Commit
b1082215
authored
Oct 26, 2024
by
yanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: #803 【客户】6. 创建跟进记录,没有带入编号
parent
ec6a10ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
16 deletions
+82
-16
CodeUtils.java
...n/iocoder/yudao/framework/common/util/code/CodeUtils.java
+34
-0
ErrorCodeConstants.java
...coder/yudao/module/customer/enums/ErrorCodeConstants.java
+2
-0
CustomerFollowupServiceImpl.java
...service/customerFollowup/CustomerFollowupServiceImpl.java
+35
-16
CustomerFollowupController.java
...er/admin/customerFollowup/CustomerFollowupController.java
+10
-0
OrderNumberEnum.java
.../cn/iocoder/yudao/module/order/enums/OrderNumberEnum.java
+1
-0
No files found.
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/code/CodeUtils.java
View file @
b1082215
...
...
@@ -221,6 +221,40 @@ public class CodeUtils {
}
}
/**
* 功能描述: 自动生成跟进单单号. 格式: GJ+年份YYYY+六位数
*
* @param maxOddNumbers 数据库中的最新单号
* @return java.lang.String
*/
public
static
String
getOddFollowupNumbers
(
String
maxOddNumbers
)
{
// 格式: GJ+年份YYYY+六位数
int
numberLength
=
14
;
//获取当前日期并将其进行格式化
String
formatYear
=
getDateTime
(
"yyyy"
);
int
newEndIntNum
;
//判断数据中的最大单号是否存在,是否包含当前日期
if
(
StringUtils
.
isNotEmpty
(
maxOddNumbers
)
&&
maxOddNumbers
.
length
()
==
numberLength
&&
maxOddNumbers
.
substring
(
2
,
8
).
equals
(
formatYear
))
{
//截取后四位数
String
endNum
=
maxOddNumbers
.
substring
(
maxOddNumbers
.
length
()
-
6
);
//把截取的最后六位数解析为int
int
endIntNum
=
Integer
.
parseInt
(
endNum
);
//在将其加1(自增1)
newEndIntNum
=
endIntNum
+
1
;
}
else
{
// 如果为空(第一次生成)或者当前最大订单号的日期与当前日期不一致说明需要重新计数生成单号
newEndIntNum
=
1
;
}
//生成单号
String
newOddNumber
=
String
.
format
(
"%s%s%06d"
,
"GJ"
,
formatYear
,
newEndIntNum
);
//将单号返回
return
newOddNumber
;
}
/**
* 功能描述: 自动生成收款单单单号
...
...
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/enums/ErrorCodeConstants.java
View file @
b1082215
...
...
@@ -35,4 +35,6 @@ public interface ErrorCodeConstants {
ErrorCode
FOLLOWUP_NOT_EXISTS
=
new
ErrorCode
(
1005001013
,
"客户跟进不存在"
);
ErrorCode
FOLLOWUP_ALREADY_SUBMITTED
=
new
ErrorCode
(
1005001014
,
"客户跟进已提交不可再修改"
);
ErrorCode
FOLLOWUP_NUMBER_NOT_NULL
=
new
ErrorCode
(
1005001015
,
"客户跟进编号不能为空"
);
}
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/service/customerFollowup/CustomerFollowupServiceImpl.java
View file @
b1082215
package
cn
.
iocoder
.
yudao
.
module
.
customer
.
service
.
customerFollowup
;
import
java.text.MessageFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.util.*
;
import
javax.annotation.Resource
;
import
cn.iocoder.yudao.framework.apollo.core.event.OrderNumberLogEvent
;
import
cn.iocoder.yudao.framework.common.util.code.CodeUtils
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils
;
...
...
@@ -15,12 +18,16 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO
;
import
cn.iocoder.yudao.module.customer.dal.mysql.customer.CustomerMapper
;
import
cn.iocoder.yudao.module.customer.dal.mysql.customerContacts.CustomerContactsMapper
;
import
cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants
;
import
cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService
;
import
cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO
;
import
cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum
;
import
cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.framework.mybatis.core.service.AbstractService
;
...
...
@@ -54,36 +61,48 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Resource
private
CustomerContactsMapper
customerContactsMapper
;
// 注入applicationContext
@Resource
private
ApplicationContext
applicationContext
;
private
static
final
String
FOLLOWUP_NEW_NUMBER
=
"followup:new:number"
;
/**
* 跟进单编号生成方式:GJ+年份+六位数字,按年份累计
* @return
*/
@Override
public
String
generateFollowupNumber
()
{
// 获取当前时间的年份
LocalDate
now
=
LocalDate
.
now
();
int
year
=
now
.
getYear
();
// 获取当前年份的初始化时间
LocalDateTime
startOfYear
=
LocalDateTime
.
of
(
year
,
1
,
1
,
0
,
0
,
0
,
0
);
Date
from
=
Date
.
from
(
startOfYear
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
());
Long
count
=
followupMapper
.
selectCount
(
new
LambdaQueryWrapperX
<
CustomerFollowupDO
>()
.
ge
(
CustomerFollowupDO:
:
getCreateTime
,
from
));
return
String
.
format
(
"GJ%d%06d"
,
year
,
count
+
1
);
// 跟进单号生成
OrderNumberLogEvent
event
=
new
OrderNumberLogEvent
();
event
.
setType
(
6
);
event
.
setNumberKey
(
FOLLOWUP_NEW_NUMBER
);
applicationContext
.
publishEvent
(
event
);
String
newFollowupNumber
=
CodeUtils
.
getOddFollowupNumbers
(
event
.
getNumber
());
return
newFollowupNumber
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
createFollowup
(
CustomerFollowupCreateReqVO
createReqVO
)
{
// 获取新编号
String
newNumber
=
createReqVO
.
getNumber
();
String
number
=
generateFollowupNumber
();
createReqVO
.
setNumber
(
number
);
// 编号不存在,报异常
if
(
StringUtils
.
isBlank
(
newNumber
))
{
throw
exception
(
ErrorCodeConstants
.
FOLLOWUP_NUMBER_NOT_NULL
);
}
// 更新编号,内部会判断冲突
OrderNumberLogEvent
event
=
new
OrderNumberLogEvent
();
event
.
setType
(
6
);
event
.
setNumberKey
(
FOLLOWUP_NEW_NUMBER
);
event
.
setNewNumber
(
newNumber
);
applicationContext
.
publishEvent
(
event
);
// 插入
CustomerFollowupDO
followup
=
CustomerFollowupConvert
.
INSTANCE
.
convert
(
createReqVO
);
// 设置联系人名称
setContactName
(
followup
);
...
...
yudao-module-customer/yudao-module-customer-rest/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/customerFollowup/CustomerFollowupController.java
View file @
b1082215
...
...
@@ -42,6 +42,16 @@ public class CustomerFollowupController {
@Resource
private
FileMakeApi
fileMakeApi
;
@GetMapping
(
"/getFollowupNewNumber"
)
@ApiOperation
(
"获得最新的跟进编号"
)
public
CommonResult
<
String
>
getFollowupNewNumber
()
{
String
number
=
followupService
.
generateFollowupNumber
();
return
success
(
number
);
}
@PostMapping
(
"/create"
)
@ApiOperation
(
"创建客户跟进"
)
// @PreAuthorize("@ss.hasPermission('customer:followup:create')")
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/enums/OrderNumberEnum.java
View file @
b1082215
...
...
@@ -15,6 +15,7 @@ public enum OrderNumberEnum {
RECEIPT_NO
(
3
,
"收款单号"
),
PAYMENT_NO
(
3
,
"付款单号"
),
COMMISSION_PAYMENT_NO
(
5
,
"佣金付款单号"
),
FOLLOWUP_NO
(
6
,
"跟进单号"
),
;
/**
* 类型
...
...
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