Commit 6df275ea authored by yanghao's avatar yanghao

chore: 跟进编码生成bug修复

parent c653c100
......@@ -15,7 +15,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public interface CustomerFollowupService extends IService<CustomerFollowupDO> {
String generateFollowupNumber();
CustomerFollowupNumberBackVO generateFollowupNumber();
/**
* 创建客户跟进
......
......@@ -19,10 +19,7 @@ import cn.iocoder.yudao.module.customer.dal.mysql.customerContacts.CustomerConta
import cn.iocoder.yudao.module.customer.dal.mysql.customerFollowup.CustomerFollowupMapper;
import cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.CustomerFollowupCreateReqVO;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.CustomerFollowupQueryVO;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.CustomerFollowupUpdateReqVO;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.CustomerFollowupUpdateStatusReqVO;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.*;
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;
......@@ -76,14 +73,19 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
* @return
*/
@Override
public String generateFollowupNumber() {
public CustomerFollowupNumberBackVO generateFollowupNumber() {
// 跟进单号生成
OrderNumberLogEvent event = new OrderNumberLogEvent();
event.setType(6);
event.setNumberKey(FOLLOWUP_NEW_NUMBER);
applicationContext.publishEvent(event);
String newFollowupNumber = CodeUtils.getOddFollowupNumbers(event.getNumber());
return newFollowupNumber;
CustomerFollowupNumberBackVO customerFollowupNumberBackVO =
new CustomerFollowupNumberBackVO()
.setNumberId(event.getId())
.setNumberVersion(event.getVersion());
return customerFollowupNumberBackVO;
}
@Override
......@@ -91,6 +93,8 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
public Long createFollowup(CustomerFollowupCreateReqVO createReqVO) {
// 获取新编号
String newNumber = createReqVO.getNumber();
Long numberId = createReqVO.getNumberId();
Integer numberVersion = createReqVO.getNumberVersion();
// 编号不存在,报异常
if (StringUtils.isBlank(newNumber)) {
......@@ -99,9 +103,11 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 更新编号,内部会判断冲突
OrderNumberLogEvent event = new OrderNumberLogEvent();
event.setId(numberId);
event.setVersion(numberVersion);
event.setNewNumber(newNumber);
event.setType(6);
event.setNumberKey(FOLLOWUP_NEW_NUMBER);
event.setNewNumber(newNumber);
applicationContext.publishEvent(event);
// 插入
......
......@@ -11,4 +11,10 @@ import javax.validation.constraints.*;
@ApiModel("管理后台 - 客户跟进创建 Request VO")
public class CustomerFollowupCreateReqVO extends CustomerFollowupBaseVO {
@ApiModelProperty(value = "编号纪录ID")
private Long numberId;
@ApiModelProperty(value = "行号")
private Integer numberVersion;
}
package cn.iocoder.yudao.module.customer.vo.customerFollowup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 客户跟进 Base VO,提供给添加、修改、详细的子 VO 使用
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
*/
@Data
public class CustomerFollowupNumberBackVO {
@ApiModelProperty(value = "编号")
private String number;
@ApiModelProperty(value = "编号纪录ID")
private Long numberId;
@ApiModelProperty(value = "行号")
private Integer numberVersion;
}
......@@ -46,9 +46,9 @@ public class CustomerFollowupController {
@GetMapping("/getFollowupNewNumber")
@ApiOperation("获得最新的跟进编号")
public CommonResult<String> getFollowupNewNumber() {
String number = followupService.generateFollowupNumber();
return success(number);
public CommonResult<CustomerFollowupNumberBackVO> getFollowupNewNumber() {
CustomerFollowupNumberBackVO customerFollowupNumberBackVO = followupService.generateFollowupNumber();
return success(customerFollowupNumberBackVO);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment