Commit 4d68e5e747124913b72fffc9bcc445d65e210a9b

Authored by min
1 parent 4237cfb4

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

yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueBaseVO.java
... ... @@ -3,11 +3,10 @@ package cn.iocoder.yudao.module.crm.controller.admin.clue.vo;
3 3 import cn.iocoder.yudao.framework.common.validation.Mobile;
4 4 import cn.iocoder.yudao.framework.common.validation.Telephone;
5 5 import io.swagger.v3.oas.annotations.media.Schema;
  6 +import jakarta.validation.constraints.NotEmpty;
6 7 import lombok.Data;
7 8 import org.springframework.format.annotation.DateTimeFormat;
8 9  
9   -import jakarta.validation.constraints.NotEmpty;
10   -import jakarta.validation.constraints.NotNull;
11 10 import java.time.LocalDateTime;
12 11  
13 12 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
... ... @@ -24,7 +23,6 @@ public class CrmClueBaseVO {
24 23 private String name;
25 24  
26 25 @Schema(description = "客户 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "520")
27   - @NotNull(message = "客户不能为空")
28 26 private Long customerId;
29 27  
30 28 @Schema(description = "下次联系时间", example = "2023-10-18 01:00:00")
... ... @@ -46,6 +44,9 @@ public class CrmClueBaseVO {
46 44 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
47 45 private LocalDateTime contactLastTime;
48 46  
  47 + @Schema(description = "负责人编号")
  48 + private Long ownerUserId;
  49 +
49 50 @Schema(description = "备注", example = "随便")
50 51 private String remark;
51 52  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
... ... @@ -20,6 +20,7 @@ import org.springframework.validation.annotation.Validated;
20 20  
21 21 import java.util.Collection;
22 22 import java.util.List;
  23 +import java.util.Objects;
23 24  
24 25 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
25 26 import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CLUE_NOT_EXISTS;
... ... @@ -43,11 +44,14 @@ public class CrmClueServiceImpl implements CrmClueService {
43 44  
44 45 @Override
45 46 public Long createClue(CrmClueCreateReqVO createReqVO) {
46   - // 校验客户是否存在
47   - customerService.validateCustomer(createReqVO.getCustomerId());
  47 + // 如果传入客户,校验客户是否存在
  48 + if (Objects.nonNull(createReqVO.getCustomerId())) {
  49 + customerService.validateCustomer(createReqVO.getCustomerId());
  50 + }
48 51 // 插入
49 52 CrmClueDO clue = CrmClueConvert.INSTANCE.convert(createReqVO);
50 53 clueMapper.insert(clue);
  54 + System.out.println(1);
51 55 // 返回
52 56 return clue.getId();
53 57 }
... ... @@ -57,8 +61,10 @@ public class CrmClueServiceImpl implements CrmClueService {
57 61 public void updateClue(CrmClueUpdateReqVO updateReqVO) {
58 62 // 校验存在
59 63 validateClueExists(updateReqVO.getId());
60   - // 校验客户是否存在
61   - customerService.validateCustomer(updateReqVO.getCustomerId());
  64 + // 如果传入客户,校验客户是否存在
  65 + if (Objects.nonNull(updateReqVO.getCustomerId())) {
  66 + customerService.validateCustomer(updateReqVO.getCustomerId());
  67 + }
62 68  
63 69 // 更新
64 70 CrmClueDO updateObj = CrmClueConvert.INSTANCE.convert(updateReqVO);
... ...