CRM:【线索】创建线索时客户改为非必填

This commit is contained in:
min 2024-01-09 00:19:38 +08:00
parent 4237cfb4a9
commit 4d68e5e747
2 changed files with 14 additions and 7 deletions

View File

@ -3,11 +3,10 @@ package cn.iocoder.yudao.module.crm.controller.admin.clue.vo;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import cn.iocoder.yudao.framework.common.validation.Telephone;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -24,7 +23,6 @@ public class CrmClueBaseVO {
private String name;
@Schema(description = "客户 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "520")
@NotNull(message = "客户不能为空")
private Long customerId;
@Schema(description = "下次联系时间", example = "2023-10-18 01:00:00")
@ -46,6 +44,9 @@ public class CrmClueBaseVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime contactLastTime;
@Schema(description = "负责人编号")
private Long ownerUserId;
@Schema(description = "备注", example = "随便")
private String remark;

View File

@ -20,6 +20,7 @@ import org.springframework.validation.annotation.Validated;
import java.util.Collection;
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.crm.enums.ErrorCodeConstants.CLUE_NOT_EXISTS;
@ -43,11 +44,14 @@ public class CrmClueServiceImpl implements CrmClueService {
@Override
public Long createClue(CrmClueCreateReqVO createReqVO) {
// 校验客户是否存在
customerService.validateCustomer(createReqVO.getCustomerId());
// 如果传入客户校验客户是否存在
if (Objects.nonNull(createReqVO.getCustomerId())) {
customerService.validateCustomer(createReqVO.getCustomerId());
}
// 插入
CrmClueDO clue = CrmClueConvert.INSTANCE.convert(createReqVO);
clueMapper.insert(clue);
System.out.println(1);
// 返回
return clue.getId();
}
@ -57,8 +61,10 @@ public class CrmClueServiceImpl implements CrmClueService {
public void updateClue(CrmClueUpdateReqVO updateReqVO) {
// 校验存在
validateClueExists(updateReqVO.getId());
// 校验客户是否存在
customerService.validateCustomer(updateReqVO.getCustomerId());
// 如果传入客户校验客户是否存在
if (Objects.nonNull(updateReqVO.getCustomerId())) {
customerService.validateCustomer(updateReqVO.getCustomerId());
}
// 更新
CrmClueDO updateObj = CrmClueConvert.INSTANCE.convert(updateReqVO);