crm:code review 联系人

This commit is contained in:
YunaiV 2023-11-18 20:43:32 +08:00
parent bf8bfef8cb
commit 966690125b
12 changed files with 123 additions and 140 deletions

View File

@ -1,28 +0,0 @@
SET NAMES utf8mb4;
CREATE TABLE `crm_contact` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系人名称',
`next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
`mobile` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
`telephone` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '电话',
`email` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '电子邮箱',
`post` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '职务',
`customer_id` bigint(20) DEFAULT NULL COMMENT '客户编号',
`address` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地址',
`remark` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
`creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
`owner_user_id` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '负责人用户编号',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
`update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间',
`last_time` timestamp NULL DEFAULT NULL COMMENT '最后跟进时间',
`updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
`deleted` bit(1) NOT NULL DEFAULT b'0',
`tenant_id` bigint(20) DEFAULT NULL,
`parent_id` bigint(20) DEFAULT NULL COMMENT '直系上属',
`qq` int(11) DEFAULT NULL,
`webchat` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sex` int(1) DEFAULT NULL COMMENT '性别',
`policy_makers` bit(1) DEFAULT NULL COMMENT '是否关键决策人',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUAUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='crm联系人';

View File

@ -2,42 +2,41 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO;
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import cn.iocoder.yudao.module.crm.service.contact.ContactService;
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.*; import javax.annotation.Resource;
import javax.validation.*; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.*; import javax.validation.Valid;
import java.util.*;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; // TODO @zyacrm 所有的类dou带 Crm 前缀因为它的名字太通用了可能和后续的 erp 之类的冲突
@Tag(name = "管理后台 - CRM 联系人")
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
import cn.iocoder.yudao.module.crm.service.contact.ContactService;
@Tag(name = "管理后台 - crm联系人")
@RestController @RestController
@RequestMapping("/crm/contact") @RequestMapping("/crm/contact")
@Validated @Validated
@ -45,20 +44,22 @@ public class ContactController {
@Resource @Resource
private ContactService contactService; private ContactService contactService;
@Resource // TODO @zyna模块内注入的变量不用带 crm 前缀哈
private AdminUserApi adminUserApi;
@Resource @Resource
private CrmCustomerService crmCustomerService; private CrmCustomerService crmCustomerService;
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建crm联系人") @Operation(summary = "创建联系人")
@PreAuthorize("@ss.hasPermission('crm:contact:create')") @PreAuthorize("@ss.hasPermission('crm:contact:create')")
public CommonResult<Long> createContact(@Valid @RequestBody ContactCreateReqVO createReqVO) { public CommonResult<Long> createContact(@Valid @RequestBody ContactCreateReqVO createReqVO) {
return success(contactService.createContact(createReqVO)); return success(contactService.createContact(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新crm联系人") @Operation(summary = "更新联系人")
@PreAuthorize("@ss.hasPermission('crm:contact:update')") @PreAuthorize("@ss.hasPermission('crm:contact:update')")
public CommonResult<Boolean> updateContact(@Valid @RequestBody ContactUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateContact(@Valid @RequestBody ContactUpdateReqVO updateReqVO) {
contactService.updateContact(updateReqVO); contactService.updateContact(updateReqVO);
@ -66,7 +67,7 @@ public class ContactController {
} }
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除crm联系人") @Operation(summary = "删除联系人")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('crm:contact:delete')") @PreAuthorize("@ss.hasPermission('crm:contact:delete')")
public CommonResult<Boolean> deleteContact(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteContact(@RequestParam("id") Long id) {
@ -75,12 +76,14 @@ public class ContactController {
} }
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得crm联系人") @Operation(summary = "获得联系人")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('crm:contact:query')") @PreAuthorize("@ss.hasPermission('crm:contact:query')")
public CommonResult<ContactRespVO> getContact(@RequestParam("id") Long id) { public CommonResult<ContactRespVO> getContact(@RequestParam("id") Long id) {
ContactDO contact = contactService.getContact(id); ContactDO contact = contactService.getContact(id);
// TODO @zyna需要考虑 null 的情况
ContactRespVO contactRespVO = ContactConvert.INSTANCE.convert(contact); ContactRespVO contactRespVO = ContactConvert.INSTANCE.convert(contact);
// TODO @zyna可以把数据读完后convert 统一交给 ContactConvert controller 更简洁 convert 专门去做一些转换逻辑
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(CollUtil.removeNull(Lists.newArrayList( Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(CollUtil.removeNull(Lists.newArrayList(
NumberUtil.parseLong(contact.getCreator())))); NumberUtil.parseLong(contact.getCreator()))));
contactRespVO.setCreatorName(Optional.ofNullable(userMap.get(NumberUtil.parseLong(contact.getCreator()))).map(AdminUserRespDTO::getNickname).orElse(null)); contactRespVO.setCreatorName(Optional.ofNullable(userMap.get(NumberUtil.parseLong(contact.getCreator()))).map(AdminUserRespDTO::getNickname).orElse(null));
@ -88,27 +91,24 @@ public class ContactController {
return success(contactRespVO); return success(contactRespVO);
} }
@GetMapping("/list") // TODO @zynaurl 使用中划线噢然后单词的拼写也要注意呀AllList 是不是更好呀
@Operation(summary = "获得crm联系人列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
public CommonResult<List<ContactRespVO>> getContactList(@RequestParam("ids") Collection<Long> ids) {
List<ContactDO> list = contactService.getContactList(ids);
return success(ContactConvert.INSTANCE.convertList(list));
}
@GetMapping("/simpleAlllist") @GetMapping("/simpleAlllist")
@Operation(summary = "获得crm联系人列表") @Operation(summary = "获得联系人列表")
@PreAuthorize("@ss.hasPermission('crm:contact:query')") @PreAuthorize("@ss.hasPermission('crm:contact:query')")
public CommonResult<List<ContactSimpleRespVO>> simpleAlllist() { public CommonResult<List<ContactSimpleRespVO>> simpleAlllist() {
// TODO @zyna方法名改成getContactList方法命名要动名词get 动词all 可以去掉因为没条件自然是全部
List<ContactDO> list = contactService.allContactList(); List<ContactDO> list = contactService.allContactList();
return success(ContactConvert.INSTANCE.convertAllList(list)); return success(ContactConvert.INSTANCE.convertAllList(list));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得crm联系人分页") @Operation(summary = "获得联系人分页")
@PreAuthorize("@ss.hasPermission('crm:contact:query')") @PreAuthorize("@ss.hasPermission('crm:contact:query')")
public CommonResult<PageResult<ContactRespVO>> getContactPage(@Valid ContactPageReqVO pageVO) { public CommonResult<PageResult<ContactRespVO>> getContactPage(@Valid ContactPageReqVO pageVO) {
PageResult<ContactDO> pageData = contactService.getContactPage(pageVO); PageResult<ContactDO> pageData = contactService.getContactPage(pageVO);
PageResult<ContactRespVO> pageResult =ContactConvert.INSTANCE.convertPage(pageData); PageResult<ContactRespVO> pageResult =ContactConvert.INSTANCE.convertPage(pageData);
// TODO @zyna需要考虑 null 的情况
// TODO @zyna可以把数据读完后convert 统一交给 ContactConvert controller 更简洁 convert 专门去做一些转换逻辑
//待接口实现后修改 //待接口实现后修改
List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(new CrmCustomerExportReqVO()); List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(new CrmCustomerExportReqVO());
Map<Long,CrmCustomerDO> crmCustomerDOMap = crmCustomerDOList.stream().collect(Collectors.toMap(CrmCustomerDO::getId,v->v)); Map<Long,CrmCustomerDO> crmCustomerDOMap = crmCustomerDOList.stream().collect(Collectors.toMap(CrmCustomerDO::getId,v->v));
@ -118,8 +118,9 @@ public class ContactController {
return success(pageResult); return success(pageResult);
} }
// TODO @zyna可以看下新的导出写法这里调整下
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出crm联系人 Excel") @Operation(summary = "导出联系人 Excel")
@PreAuthorize("@ss.hasPermission('crm:contact:export')") @PreAuthorize("@ss.hasPermission('crm:contact:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportContactExcel(@Valid ContactExportReqVO exportReqVO, public void exportContactExcel(@Valid ContactExportReqVO exportReqVO,

View File

@ -1,26 +1,25 @@
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import java.time.LocalDate;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
// TODO zyna参考新的 vo重新拆分下 VO
/** /**
* crm联系人 Base VO提供给添加修改详细的子 VO 使用 * CRM 联系人 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class ContactBaseVO { public class ContactBaseVO {
// TODO @zynaexample 最好都写下
// TODO @zyna必要的字段校验例如说 @Mobile@Emal 等等
@Schema(description = "下次联系时间") @Schema(description = "下次联系时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDateTime nextTime; private LocalDateTime nextTime;

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - crm联系人创建 Request VO") @Schema(description = "管理后台 - CRM 联系人创建 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)

View File

@ -1,22 +1,18 @@
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.time.LocalDateTime;
// TODO @zyna参考新的 VO 结构 ContactExcelVO 融合到 ContactRespVO
/** /**
* crm联系人 Excel VO * crm联系人 Excel VO
* *
* @author 芋道源码 * @author 芋道源码
*/ */
@Data @Data
@Deprecated
public class ContactExcelVO { public class ContactExcelVO {
@ExcelProperty("下次联系时间") @ExcelProperty("下次联系时间")

View File

@ -1,18 +1,17 @@
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import lombok.Data;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
// TODO @zyna参考新的 VO 结构使用 ContactPageReqVO 查询导出的数据
@Schema(description = "管理后台 - crm联系人 Excel 导出 Request VO参数和 ContactPageReqVO 是一致的") @Schema(description = "管理后台 - crm联系人 Excel 导出 Request VO参数和 ContactPageReqVO 是一致的")
@Data @Data
@Deprecated
public class ContactExportReqVO { public class ContactExportReqVO {
@Schema(description = "下次联系时间") @Schema(description = "下次联系时间")

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -17,6 +17,11 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true) @ToString(callSuper = true)
public class ContactPageReqVO extends PageParam { public class ContactPageReqVO extends PageParam {
// TODO @zyna筛选条件
// 客户
// 姓名
// 手机电话座机QQ微信邮箱
@Schema(description = "下次联系时间") @Schema(description = "下次联系时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] nextTime; private LocalDateTime[] nextTime;

View File

@ -4,19 +4,24 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - crm联系人 Response VO") @Schema(description = "管理后台 - CRM 联系人 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class ContactRespVO extends ContactBaseVO { public class ContactRespVO extends ContactBaseVO {
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "创建人")
private String creatorName;
@Schema(description = "客户")
private String customerName;
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167") @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
private Long id; private Long id;
@Schema(description = "创建时间")
private LocalDateTime createTime;
// TODO @zynaexample 最好写下
@Schema(description = "创建人")
private String creatorName;
@Schema(description = "客户名字")
private String customerName;
} }

View File

@ -2,16 +2,13 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import java.time.LocalDateTime; @Schema(description = "管理后台 - CRM 联系人 Response VO")
@Schema(description = "管理后台 - crm联系人 Response VO")
@Data @Data
@ToString(callSuper = true) @ToString(callSuper = true)
public class ContactSimpleRespVO { public class ContactSimpleRespVO {
@Schema(description = "姓名", example = "芋艿") @Schema(description = "姓名", example = "芋艿") // TODO @zynarequiredMode = Schema.RequiredMode.REQUIRED需要空一行字段的顺序改下id name 前面会更干净
private String name; private String name;
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167") @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")

View File

@ -1,11 +1,13 @@
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo; package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import java.util.*; import lombok.EqualsAndHashCode;
import javax.validation.constraints.*; import lombok.ToString;
@Schema(description = "管理后台 - crm联系人更新 Request VO") import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - CRM 联系人更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)

View File

@ -1,17 +1,15 @@
package cn.iocoder.yudao.module.crm.dal.dataobject.contact; package cn.iocoder.yudao.module.crm.dal.dataobject.contact;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*; import lombok.*;
import java.time.LocalDate;
import java.util.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/** /**
* crm联系人 DO * CRM 联系人 DO
* *
* @author 芋道源码 * @author 芋道源码
*/ */
@ -25,6 +23,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@AllArgsConstructor @AllArgsConstructor
public class ContactDO extends BaseDO { public class ContactDO extends BaseDO {
// TODO @zyna这个字段的顺序是不是整理下
/** /**
* 下次联系时间 * 下次联系时间
*/ */
@ -57,11 +56,13 @@ public class ContactDO extends BaseDO {
* 最后跟进时间 * 最后跟进时间
*/ */
private LocalDateTime lastTime; private LocalDateTime lastTime;
// TODO @zyna这个放在最前面吧
/** /**
* 主键 * 主键
*/ */
@TableId @TableId
private Long id; private Long id;
// TODO @zyna直接上级最好写下它关联的字段例如说这个应该关联 ContactDO id 字段
/** /**
* 直属上级 * 直属上级
*/ */
@ -78,18 +79,22 @@ public class ContactDO extends BaseDO {
* QQ * QQ
*/ */
private Long qq; private Long qq;
// TODO @zynawechat
/** /**
* 微信 * 微信
*/ */
private String webchat; private String webchat;
// TODO @zyna关联的枚举
/** /**
* 性别 * 性别
*/ */
private Integer sex; private Integer sex;
// TODO @zyna这个字段改成 master
/** /**
* 是否关键决策人 * 是否关键决策人
*/ */
private Boolean policyMakers; private Boolean policyMakers;
// TODO @zyna应该是 Long
/** /**
* 负责人用户编号 * 负责人用户编号
*/ */

View File

@ -1,22 +1,24 @@
package cn.iocoder.yudao.module.crm.service.contact; package cn.iocoder.yudao.module.crm.service.contact;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
import cn.iocoder.yudao.module.crm.dal.mysql.contact.ContactMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactCreateReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactExportReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactPageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactUpdateReqVO;
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
import cn.iocoder.yudao.module.crm.dal.mysql.contact.ContactMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTACT_NOT_EXISTS;
/** /**
* crm联系人 Service 实现类 * crm联系人 Service 实现类
@ -30,7 +32,7 @@ public class ContactServiceImpl implements ContactService {
@Resource @Resource
private ContactMapper contactMapper; private ContactMapper contactMapper;
@Override @Override // TODO @zyna新增和修改时关联字段要校验例如说 直属上级是不是真的存在
public Long createContact(ContactCreateReqVO createReqVO) { public Long createContact(ContactCreateReqVO createReqVO) {
// 插入 // 插入
ContactDO contact = ContactConvert.INSTANCE.convert(createReqVO); ContactDO contact = ContactConvert.INSTANCE.convert(createReqVO);