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