mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
feat: 调整客户表的字段
This commit is contained in:
parent
81b6aebf47
commit
c18f5baa4b
@ -203,8 +203,6 @@ CREATE TABLE `crm_customer` (
|
||||
`rw_user_ids` varchar(4096) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '读写权限的用户编号数组',
|
||||
`area_id` bigint DEFAULT NULL COMMENT '地区编号',
|
||||
`detail_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细地址',
|
||||
`longitude` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地理位置经度',
|
||||
`latitude` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地理位置维度',
|
||||
`contact_last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',
|
||||
`contact_next_time` datetime DEFAULT NULL COMMENT '下次联系时间',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
|
@ -19,7 +19,6 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
@ -6,8 +6,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@ -23,16 +25,6 @@ public class CrmCustomerBaseVO {
|
||||
@NotEmpty(message = "客户名称不能为空")
|
||||
private String name;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;
|
||||
@Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "跟进状态不能为空")
|
||||
private Boolean followUpStatus;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;
|
||||
@Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "锁定状态不能为空")
|
||||
private Boolean lockStatus;
|
||||
|
||||
@Schema(description = "手机", example = "18000000000")
|
||||
@Mobile
|
||||
private String mobile;
|
||||
@ -44,32 +36,32 @@ public class CrmCustomerBaseVO {
|
||||
@Schema(description = "网址", example = "https://www.baidu.com")
|
||||
private String website;
|
||||
|
||||
@Schema(description = "QQ", example = "123456789")
|
||||
@Size(max = 20, message = "QQ长度不能超过20个字符")
|
||||
private String qq;
|
||||
|
||||
@Schema(description = "wechat", example = "123456789")
|
||||
@Size(max = 255, message = "微信长度不能超过255个字符")
|
||||
private String wechat;
|
||||
|
||||
@Schema(description = "email", example = "123456789@qq.com")
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(max = 255, message = "邮箱长度不能超过255个字符")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "客户描述", example = "任意文字")
|
||||
@Size(max = 4096, message = "客户描述长度不能超过255个字符")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;因为它会在“移交”里面做哈
|
||||
@Schema(description = "负责人的用户编号", example = "25682")
|
||||
@NotNull(message = "负责人不能为空")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "地区编号", example = "20158")
|
||||
private Long areaId;
|
||||
|
||||
@Schema(description = "详细地址", example = "北京市海淀区")
|
||||
private String detailAddress;
|
||||
|
||||
// TODO @芋艿:longitude、latitude 这两个字段删除;
|
||||
@Schema(description = "地理位置经度", example = "116.40341")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "地理位置维度", example = "39.92409")
|
||||
private String latitude;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;
|
||||
@Schema(description = "最后跟进时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime contactLastTime;
|
||||
|
||||
@Schema(description = "下次联系时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime contactNextTime;
|
||||
|
@ -11,12 +11,4 @@ import lombok.ToString;
|
||||
@ToString(callSuper = true)
|
||||
public class CrmCustomerCreateReqVO extends CrmCustomerBaseVO {
|
||||
|
||||
// TODO @wanwan:类型应该是传递 List<Long>; 不过这个字段,默认新建的时候不传递,在“移交”功能里管理
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private String roUserIds;
|
||||
|
||||
// TODO @wanwan:类型应该是传递 List<Long>; 不过这个字段,默认新建的时候不传递,在“移交”功能里管理
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private String rwUserIds;
|
||||
|
||||
}
|
||||
|
@ -44,6 +44,18 @@ public class CrmCustomerExcelVO {
|
||||
@ExcelProperty("网址")
|
||||
private String website;
|
||||
|
||||
@ExcelProperty("QQ")
|
||||
private String qq;
|
||||
|
||||
@ExcelProperty("wechat")
|
||||
private String wechat;
|
||||
|
||||
@ExcelProperty("email")
|
||||
private String email;
|
||||
|
||||
@ExcelProperty("客户描述")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ -56,12 +68,6 @@ public class CrmCustomerExcelVO {
|
||||
@ExcelProperty("详细地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("地理位置经度")
|
||||
private String longitude;
|
||||
|
||||
@ExcelProperty("地理位置维度")
|
||||
private String latitude;
|
||||
|
||||
@ExcelProperty("最后跟进时间")
|
||||
private LocalDateTime contactLastTime;
|
||||
|
||||
|
@ -14,10 +14,4 @@ public class CrmCustomerExportReqVO {
|
||||
@Schema(description = "手机", example = "18000000000")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "电话", example = "18000000000")
|
||||
private String telephone;
|
||||
|
||||
@Schema(description = "网址", example = "https://www.baidu.com")
|
||||
private String website;
|
||||
|
||||
}
|
||||
|
@ -18,13 +18,5 @@ public class CrmCustomerPageReqVO extends PageParam {
|
||||
@Schema(description = "手机", example = "18000000000")
|
||||
private String mobile;
|
||||
|
||||
// TODO @wanwan:这个字段不需要哈
|
||||
@Schema(description = "电话", example = "18000000000")
|
||||
private String telephone;
|
||||
|
||||
// TODO @wanwan:这个字段不需要哈
|
||||
@Schema(description = "网址", example = "https://www.baidu.com")
|
||||
private String website;
|
||||
|
||||
// TODO @芋艿:场景;
|
||||
}
|
||||
|
@ -4,9 +4,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
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;
|
||||
|
||||
@Schema(description = "管理后台 - 客户 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -16,9 +19,22 @@ public class CrmCustomerRespVO extends CrmCustomerBaseVO {
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean followUpStatus;
|
||||
|
||||
@Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean lockStatus;
|
||||
|
||||
@Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean dealStatus;
|
||||
|
||||
@Schema(description = "负责人的用户编号", example = "25682")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "最后跟进时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime contactLastTime;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
@ -17,11 +17,4 @@ public class CrmCustomerUpdateReqVO extends CrmCustomerBaseVO {
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
// TODO @wanwan:下面两个字段,同 CrmCustomerCreateReqVO
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private String roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private String rwUserIds;
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.dataobject.customer;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
// TODO 芋艿:调整下字段
|
||||
/**
|
||||
@ -14,7 +17,7 @@ import java.time.LocalDateTime;
|
||||
*
|
||||
* @author Wanwan
|
||||
*/
|
||||
@TableName("crm_customer")
|
||||
@TableName(value = "crm_customer", autoResultMap = true)
|
||||
@KeySequence("crm_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -57,6 +60,22 @@ public class CrmCustomerDO extends BaseDO {
|
||||
* 网址
|
||||
*/
|
||||
private String website;
|
||||
/**
|
||||
* QQ
|
||||
*/
|
||||
private String qq;
|
||||
/**
|
||||
* wechat
|
||||
*/
|
||||
private String wechat;
|
||||
/**
|
||||
* email
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ -65,15 +84,16 @@ public class CrmCustomerDO extends BaseDO {
|
||||
* 负责人的用户编号
|
||||
*/
|
||||
private Long ownerUserId;
|
||||
// TODO @wanwan:下面两个字段,使用 List<Long>,然后使用 typeHandler = LongListTypeHandler 解决持久化的问题;注意类上需要加 autoResultMap = true
|
||||
/**
|
||||
* 只读权限的用户编号数组
|
||||
*/
|
||||
private String roUserIds;
|
||||
@TableField(typeHandler = LongListTypeHandler.class)
|
||||
private List<Long> roUserIds;
|
||||
/**
|
||||
* 读写权限的用户编号数组
|
||||
*/
|
||||
private String rwUserIds;
|
||||
@TableField(typeHandler = LongListTypeHandler.class)
|
||||
private List<Long> rwUserIds;
|
||||
/**
|
||||
* 地区编号
|
||||
*/
|
||||
@ -82,15 +102,6 @@ public class CrmCustomerDO extends BaseDO {
|
||||
* 详细地址
|
||||
*/
|
||||
private String detailAddress;
|
||||
// TODO @wanwan:下面两个字段:删除
|
||||
/**
|
||||
* 地理位置经度
|
||||
*/
|
||||
private String longitude;
|
||||
/**
|
||||
* 地理位置维度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
* 最后跟进时间
|
||||
*/
|
||||
|
@ -22,8 +22,6 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>()
|
||||
.likeIfPresent(CrmCustomerDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone())
|
||||
.likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite())
|
||||
.orderByDesc(CrmCustomerDO::getId));
|
||||
}
|
||||
|
||||
@ -31,8 +29,6 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
||||
return selectList(new LambdaQueryWrapperX<CrmCustomerDO>()
|
||||
.likeIfPresent(CrmCustomerDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone())
|
||||
.likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite())
|
||||
.orderByDesc(CrmCustomerDO::getId));
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class CrmClueServiceImpl implements CrmClueService {
|
||||
@Override
|
||||
public Long createClue(CrmClueCreateReqVO createReqVO) {
|
||||
// 校验客户是否存在
|
||||
validateCustomerExists(createReqVO.getCustomerId());
|
||||
customerService.validateCustomer(createReqVO.getCustomerId());
|
||||
// 插入
|
||||
CrmClueDO clue = CrmClueConvert.INSTANCE.convert(createReqVO);
|
||||
clueMapper.insert(clue);
|
||||
@ -52,7 +52,7 @@ public class CrmClueServiceImpl implements CrmClueService {
|
||||
// 校验存在
|
||||
validateClueExists(updateReqVO.getId());
|
||||
// 校验客户是否存在
|
||||
validateCustomerExists(updateReqVO.getCustomerId());
|
||||
customerService.validateCustomer(updateReqVO.getCustomerId());
|
||||
|
||||
// 更新
|
||||
CrmClueDO updateObj = CrmClueConvert.INSTANCE.convert(updateReqVO);
|
||||
@ -96,16 +96,4 @@ public class CrmClueServiceImpl implements CrmClueService {
|
||||
return clueMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
// TODO @wanwan:可以在 CrmClueServiceImpl 中,增加一个方法,用于校验客户是否存在;validateCustomer;然后其它方法可以调用它。不过要注意,需要把 CustomerDO 返回,因为其它模块可能要它的信息
|
||||
/**
|
||||
* 校验客户是否存在
|
||||
*
|
||||
* @param customerId 客户id
|
||||
*/
|
||||
private void validateCustomerExists(Long customerId) {
|
||||
if (customerService.getCustomer(customerId) == null) {
|
||||
throw exception(CUSTOMER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,4 +72,12 @@ public interface CrmCustomerService {
|
||||
*/
|
||||
List<CrmCustomerDO> getCustomerList(CrmCustomerExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 校验客户是否存在
|
||||
*
|
||||
* @param customerId 客户id
|
||||
* @return
|
||||
*/
|
||||
CrmCustomerDO validateCustomer(Long customerId);
|
||||
|
||||
}
|
||||
|
@ -85,4 +85,18 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
return customerMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验客户是否存在
|
||||
*
|
||||
* @param customerId 客户id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CrmCustomerDO validateCustomer(Long customerId) {
|
||||
CrmCustomerDO customer = getCustomer(customerId);
|
||||
if (Objects.isNull(customer)) {
|
||||
throw exception(CUSTOMER_NOT_EXISTS);
|
||||
}
|
||||
return customer;
|
||||
}
|
||||
}
|
||||
|
@ -113,8 +113,6 @@ CREATE TABLE IF NOT EXISTS "crm_customer" (
|
||||
"rw_user_ids" varchar,
|
||||
"area_id" bigint,
|
||||
"detail_address" varchar,
|
||||
"longitude" varchar,
|
||||
"latitude" varchar,
|
||||
"contact_last_time" varchar,
|
||||
"contact_next_time" varchar,
|
||||
"creator" varchar DEFAULT '',
|
||||
|
Loading…
Reference in New Issue
Block a user