Commit d8e49fa0f6b54df99541588b8cc299f514adbf1e

Authored by 芋道源码
Committed by Gitee
2 parents 81b6aebf 3af96883

!701 feat: 调整 CRM 客户表的字段

Merge pull request !701 from wanwan/feature/crm
Showing 18 changed files with 266 additions and 122 deletions
sql/mysql/crm.sql
@@ -188,34 +188,42 @@ CREATE TABLE `crm_contact` ( @@ -188,34 +188,42 @@ CREATE TABLE `crm_contact` (
188 -- ---------------------------- 188 -- ----------------------------
189 -- 客户表 189 -- 客户表
190 -- ---------------------------- 190 -- ----------------------------
191 -CREATE TABLE `crm_customer` (  
192 - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,主键自增',  
193 - `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '客户名称',  
194 - `follow_up_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '跟进状态',  
195 - `lock_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '锁定状态',  
196 - `deal_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '成交状态',  
197 - `mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机',  
198 - `telephone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '电话',  
199 - `website` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '网址',  
200 - `remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',  
201 - `owner_user_id` bigint DEFAULT NULL COMMENT '负责人的用户编号',  
202 - `ro_user_ids` varchar(4096) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '只读权限的用户编号数组',  
203 - `rw_user_ids` varchar(4096) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '读写权限的用户编号数组',  
204 - `area_id` bigint DEFAULT NULL COMMENT '地区编号',  
205 - `detail_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细地址',  
206 - `longitude` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地理位置经度',  
207 - `latitude` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地理位置维度',  
208 - `contact_last_time` datetime DEFAULT NULL COMMENT '最后跟进时间',  
209 - `contact_next_time` datetime DEFAULT NULL COMMENT '下次联系时间',  
210 - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',  
211 - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',  
212 - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',  
213 - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',  
214 - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',  
215 - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',  
216 - PRIMARY KEY (`id`),  
217 - KEY `owner_user_id` (`owner_user_id`)  
218 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户表'; 191 +DROP TABLE IF EXISTS `crm_customer`;
  192 +CREATE TABLE `crm_customer` (
  193 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,主键自增',
  194 + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '客户名称',
  195 + `follow_up_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '跟进状态',
  196 + `lock_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '锁定状态',
  197 + `deal_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '成交状态',
  198 + `industry_id` int NULL DEFAULT NULL COMMENT '所属行业',
  199 + `level` int NULL DEFAULT NULL COMMENT '客户等级',
  200 + `source` int NULL DEFAULT NULL COMMENT '客户来源',
  201 + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机',
  202 + `telephone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '电话',
  203 + `website` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '网址',
  204 + `qq` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'QQ',
  205 + `wechat` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信',
  206 + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '邮箱',
  207 + `description` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '客户描述',
  208 + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
  209 + `owner_user_id` bigint NULL DEFAULT NULL COMMENT '负责人的用户编号',
  210 + `ro_user_ids` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '只读权限的用户编号数组',
  211 + `rw_user_ids` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '读写权限的用户编号数组',
  212 + `area_id` bigint NULL DEFAULT NULL COMMENT '地区编号',
  213 + `detail_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '详细地址',
  214 + `longitude` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地理位置经度',
  215 + `latitude` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地理位置维度',
  216 + `contact_last_time` datetime NULL DEFAULT NULL COMMENT '最后跟进时间',
  217 + `contact_next_time` datetime NULL DEFAULT NULL COMMENT '下次联系时间',
  218 + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  219 + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  220 + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  221 + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  222 + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  223 + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
  224 + PRIMARY KEY (`id`) USING BTREE,
  225 + INDEX `owner_user_id`(`owner_user_id`) USING BTREE
  226 +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客户表' ROW_FORMAT = Dynamic;
219 -- ---------------------------- 227 -- ----------------------------
220 -- 商机状态表 228 -- 商机状态表
221 -- ---------------------------- 229 -- ----------------------------
sql/mysql/crm_data.sql
@@ -17,3 +17,42 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st @@ -17,3 +17,42 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
17 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0'); 17 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0');
18 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0'); 18 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0');
19 19
  20 +
  21 +
  22 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (188, '客户来源', 'crm_customer_source', 0, 'CRM 客户来源', '1', '2023-10-28 23:00:34', '1', '2023-10-28 15:11:16', b'0', NULL);
  23 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (187, '客户等级', 'crm_customer_level', 0, 'CRM 客户等级', '1', '2023-10-28 22:59:12', '1', '2023-10-28 15:11:16', b'0', NULL);
  24 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (186, '客户所属行业', 'crm_customer_industry', 0, 'CRM 客户所属行业', '1', '2023-10-28 22:57:07', '1', '2023-10-28 15:11:16', b'0', NULL);
  25 +
  26 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1434, 10, '邮件咨询', '10', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:33', '1', '2023-10-28 23:10:33', b'0');
  27 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1433, 9, '电话咨询', '9', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:18', '1', '2023-10-28 23:10:18', b'0');
  28 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1432, 8, '陌拜', '8', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:04', '1', '2023-10-28 23:10:04', b'0');
  29 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1431, 7, '预约上门', '7', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:39', '1', '2023-10-28 23:09:39', b'0');
  30 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1430, 6, '线上咨询', '6', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:22', '1', '2023-10-28 23:09:22', b'0');
  31 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1429, 5, '线上注册', '5', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:12', '1', '2023-10-28 23:09:12', b'0');
  32 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1428, 4, '转介绍', '4', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:58', '1', '2023-10-28 23:08:58', b'0');
  33 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1427, 3, '广告', '3', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:47', '1', '2023-10-28 23:08:47', b'0');
  34 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1426, 2, '搜索引擎', '2', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:39', '1', '2023-10-28 23:08:39', b'0');
  35 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1425, 1, '促销', '1', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:29', '1', '2023-10-28 23:08:29', b'0');
  36 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1424, 3, 'C (非优先客户)', '3', 'crm_customer_level', 0, 'default', '', '', '1', '2023-10-28 23:07:53', '1', '2023-10-28 23:07:53', b'0');
  37 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1423, 2, 'B (普通客户)', '2', 'crm_customer_level', 0, 'info', '', '', '1', '2023-10-28 23:07:35', '1', '2023-10-28 23:07:35', b'0');
  38 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1422, 1, 'A (重点客户)', '1', 'crm_customer_level', 0, 'primary', '', '', '1', '2023-10-28 23:07:13', '1', '2023-10-28 23:07:13', b'0');
  39 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1421, 20, 'T 国际组织', '20', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:06:15', '1', '2023-10-28 23:06:15', b'0');
  40 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1420, 19, 'S 公共管理、社会保障和社会组织', '19', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:06:05', '1', '2023-10-28 23:06:05', b'0');
  41 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1419, 18, 'R 文化、体育和娱乐业', '18', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:55', '1', '2023-10-28 23:05:55', b'0');
  42 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1418, 17, 'Q 卫生和社会工作', '17', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:44', '1', '2023-10-28 23:05:44', b'0');
  43 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1417, 16, 'P 教育', '16', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:15', '1', '2023-10-28 23:05:15', b'0');
  44 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1416, 15, 'O 居民服务、修理和其他服务业', '15', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:05:05', '1', '2023-10-28 23:05:05', b'0');
  45 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1415, 14, 'N 水利、环境和公共设施管理业', '14', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:53', '1', '2023-10-28 23:04:53', b'0');
  46 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1414, 13, 'M 科学研究和技术服务业', '13', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:43', '1', '2023-10-28 23:04:43', b'0');
  47 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1413, 12, 'L 租赁和商务服务业', '12', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:33', '1', '2023-10-28 23:04:33', b'0');
  48 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1412, 11, 'K 房地产业', '11', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:04:15', '1', '2023-10-28 23:04:22', b'0');
  49 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1411, 10, 'J 金融业', '10', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:57', '1', '2023-10-28 23:03:57', b'0');
  50 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1410, 9, 'I 信息传输、软件和信息技术服务业', '9', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:47', '1', '2023-10-28 23:03:47', b'0');
  51 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1409, 8, 'H 住宿和餐饮业', '8', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:37', '1', '2023-10-28 23:03:37', b'0');
  52 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1408, 7, 'G 交通运输、仓储和邮政业', '7', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:27', '1', '2023-10-28 23:03:27', b'0');
  53 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1407, 6, 'F 批发和零售业', '6', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:13', '1', '2023-10-28 23:03:13', b'0');
  54 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1406, 5, 'E 建筑业', '5', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:03', '1', '2023-10-28 23:03:03', b'0');
  55 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1405, 4, 'D 电力、热力、燃气及水生产和供应业', '4', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:54', '1', '2023-10-28 23:02:54', b'0');
  56 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1404, 3, 'C 制造业', '3', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:41', '1', '2023-10-28 23:02:41', b'0');
  57 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1403, 2, 'B 采矿业', '2', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:29', '1', '2023-10-28 23:02:29', b'0');
  58 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1402, 1, 'A 农、林、牧、渔业', '1', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:15', '1', '2023-10-28 23:02:15', b'0');
20 \ No newline at end of file 59 \ No newline at end of file
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.enums;
  2 +
  3 +/**
  4 + * System 字典类型的枚举类
  5 + *
  6 + * @author 芋道源码
  7 + */
  8 +public interface DictTypeConstants {
  9 +
  10 + // ========== CRM 模块 ==========
  11 + String CRM_CUSTOMER_INDUSTRY = "crm_customer_industry"; // CRM 客户所属行业
  12 + String CRM_CUSTOMER_LEVEL = "crm_customer_level"; // CRM 客户等级
  13 + String CRM_CUSTOMER_SOURCE = "crm_customer_source"; // CRM 客户来源
  14 +
  15 +}
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLevelEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.crm.enums.customer;
  2 +
  3 +import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Getter;
  6 +
  7 +import java.util.Arrays;
  8 +
  9 +/**
  10 + * CRM 客户等级
  11 + *
  12 + * @author Wanwan
  13 + */
  14 +@Getter
  15 +@AllArgsConstructor
  16 +public enum CrmCustomerLevelEnum implements IntArrayValuable {
  17 +
  18 + IMPORTANT(1, "A (重点客户)"),
  19 + GENERAL(2, "B (普通客户)"),
  20 + LOW_PRIORITY(3, "C (非优先客户)");
  21 +
  22 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmCustomerLevelEnum::getStatus).toArray();
  23 +
  24 + /**
  25 + * 状态
  26 + */
  27 + private final Integer status;
  28 + /**
  29 + * 状态名
  30 + */
  31 + private final String name;
  32 +
  33 + @Override
  34 + public int[] array() {
  35 + return ARRAYS;
  36 + }
  37 +
  38 +}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
@@ -19,7 +19,6 @@ import javax.annotation.Resource; @@ -19,7 +19,6 @@ import javax.annotation.Resource;
19 import javax.servlet.http.HttpServletResponse; 19 import javax.servlet.http.HttpServletResponse;
20 import javax.validation.Valid; 20 import javax.validation.Valid;
21 import java.io.IOException; 21 import java.io.IOException;
22 -import java.util.Collection;  
23 import java.util.List; 22 import java.util.List;
24 23
25 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 24 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerBaseVO.java
1 package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; 1 package cn.iocoder.yudao.module.crm.controller.admin.customer.vo;
2 2
  3 +import cn.iocoder.yudao.framework.common.validation.InEnum;
3 import cn.iocoder.yudao.framework.common.validation.Mobile; 4 import cn.iocoder.yudao.framework.common.validation.Mobile;
4 import cn.iocoder.yudao.framework.common.validation.Telephone; 5 import cn.iocoder.yudao.framework.common.validation.Telephone;
  6 +import cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLevelEnum;
5 import io.swagger.v3.oas.annotations.media.Schema; 7 import io.swagger.v3.oas.annotations.media.Schema;
6 import lombok.Data; 8 import lombok.Data;
7 import org.springframework.format.annotation.DateTimeFormat; 9 import org.springframework.format.annotation.DateTimeFormat;
8 10
  11 +import javax.validation.constraints.Email;
9 import javax.validation.constraints.NotEmpty; 12 import javax.validation.constraints.NotEmpty;
10 import javax.validation.constraints.NotNull; 13 import javax.validation.constraints.NotNull;
  14 +import javax.validation.constraints.Size;
11 import java.time.LocalDateTime; 15 import java.time.LocalDateTime;
12 16
13 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; 17 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@@ -23,15 +27,15 @@ public class CrmCustomerBaseVO { @@ -23,15 +27,15 @@ public class CrmCustomerBaseVO {
23 @NotEmpty(message = "客户名称不能为空") 27 @NotEmpty(message = "客户名称不能为空")
24 private String name; 28 private String name;
25 29
26 - // TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;  
27 - @Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")  
28 - @NotNull(message = "跟进状态不能为空")  
29 - private Boolean followUpStatus; 30 + @Schema(description = "所属行业", example = "1")
  31 + private Integer industryId;
30 32
31 - // TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;  
32 - @Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")  
33 - @NotNull(message = "锁定状态不能为空")  
34 - private Boolean lockStatus; 33 + @Schema(description = "客户等级", example = "2")
  34 + @InEnum(CrmCustomerLevelEnum.class)
  35 + private Integer level;
  36 +
  37 + @Schema(description = "客户来源", example = "3")
  38 + private Integer source;
35 39
36 @Schema(description = "手机", example = "18000000000") 40 @Schema(description = "手机", example = "18000000000")
37 @Mobile 41 @Mobile
@@ -44,32 +48,32 @@ public class CrmCustomerBaseVO { @@ -44,32 +48,32 @@ public class CrmCustomerBaseVO {
44 @Schema(description = "网址", example = "https://www.baidu.com") 48 @Schema(description = "网址", example = "https://www.baidu.com")
45 private String website; 49 private String website;
46 50
  51 + @Schema(description = "QQ", example = "123456789")
  52 + @Size(max = 20, message = "QQ长度不能超过20个字符")
  53 + private String qq;
  54 +
  55 + @Schema(description = "wechat", example = "123456789")
  56 + @Size(max = 255, message = "微信长度不能超过255个字符")
  57 + private String wechat;
  58 +
  59 + @Schema(description = "email", example = "123456789@qq.com")
  60 + @Email(message = "邮箱格式不正确")
  61 + @Size(max = 255, message = "邮箱长度不能超过255个字符")
  62 + private String email;
  63 +
  64 + @Schema(description = "客户描述", example = "任意文字")
  65 + @Size(max = 4096, message = "客户描述长度不能超过255个字符")
  66 + private String description;
  67 +
47 @Schema(description = "备注", example = "随便") 68 @Schema(description = "备注", example = "随便")
48 private String remark; 69 private String remark;
49 70
50 - // TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;因为它会在“移交”里面做哈  
51 - @Schema(description = "负责人的用户编号", example = "25682")  
52 - @NotNull(message = "负责人不能为空")  
53 - private Long ownerUserId;  
54 -  
55 @Schema(description = "地区编号", example = "20158") 71 @Schema(description = "地区编号", example = "20158")
56 private Long areaId; 72 private Long areaId;
57 73
58 @Schema(description = "详细地址", example = "北京市海淀区") 74 @Schema(description = "详细地址", example = "北京市海淀区")
59 private String detailAddress; 75 private String detailAddress;
60 76
61 - // TODO @芋艿:longitude、latitude 这两个字段删除;  
62 - @Schema(description = "地理位置经度", example = "116.40341")  
63 - private String longitude;  
64 -  
65 - @Schema(description = "地理位置维度", example = "39.92409")  
66 - private String latitude;  
67 -  
68 - // TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;  
69 - @Schema(description = "最后跟进时间")  
70 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
71 - private LocalDateTime contactLastTime;  
72 -  
73 @Schema(description = "下次联系时间") 77 @Schema(description = "下次联系时间")
74 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 78 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
75 private LocalDateTime contactNextTime; 79 private LocalDateTime contactNextTime;
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerCreateReqVO.java
@@ -11,12 +11,4 @@ import lombok.ToString; @@ -11,12 +11,4 @@ import lombok.ToString;
11 @ToString(callSuper = true) 11 @ToString(callSuper = true)
12 public class CrmCustomerCreateReqVO extends CrmCustomerBaseVO { 12 public class CrmCustomerCreateReqVO extends CrmCustomerBaseVO {
13 13
14 - // TODO @wanwan:类型应该是传递 List<Long>; 不过这个字段,默认新建的时候不传递,在“移交”功能里管理  
15 - @Schema(description = "只读权限的用户编号数组")  
16 - private String roUserIds;  
17 -  
18 - // TODO @wanwan:类型应该是传递 List<Long>; 不过这个字段,默认新建的时候不传递,在“移交”功能里管理  
19 - @Schema(description = "读写权限的用户编号数组")  
20 - private String rwUserIds;  
21 -  
22 } 14 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerExcelVO.java
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
4 import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; 4 import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
5 import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; 5 import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
6 import com.alibaba.excel.annotation.ExcelProperty; 6 import com.alibaba.excel.annotation.ExcelProperty;
  7 +import io.swagger.v3.oas.annotations.media.Schema;
7 import lombok.Data; 8 import lombok.Data;
8 9
9 import java.time.LocalDateTime; 10 import java.time.LocalDateTime;
@@ -35,6 +36,18 @@ public class CrmCustomerExcelVO { @@ -35,6 +36,18 @@ public class CrmCustomerExcelVO {
35 @DictFormat(DictTypeConstants.BOOLEAN_STRING) 36 @DictFormat(DictTypeConstants.BOOLEAN_STRING)
36 private Boolean dealStatus; 37 private Boolean dealStatus;
37 38
  39 + @ExcelProperty(value = "所属行业", converter = DictConvert.class)
  40 + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY)
  41 + private Integer industryId;
  42 +
  43 + @ExcelProperty(value = "客户等级", converter = DictConvert.class)
  44 + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL)
  45 + private Integer level;
  46 +
  47 + @ExcelProperty(value = "客户来源", converter = DictConvert.class)
  48 + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE)
  49 + private Integer source;
  50 +
38 @ExcelProperty("手机") 51 @ExcelProperty("手机")
39 private String mobile; 52 private String mobile;
40 53
@@ -44,6 +57,18 @@ public class CrmCustomerExcelVO { @@ -44,6 +57,18 @@ public class CrmCustomerExcelVO {
44 @ExcelProperty("网址") 57 @ExcelProperty("网址")
45 private String website; 58 private String website;
46 59
  60 + @ExcelProperty("QQ")
  61 + private String qq;
  62 +
  63 + @ExcelProperty("wechat")
  64 + private String wechat;
  65 +
  66 + @ExcelProperty("email")
  67 + private String email;
  68 +
  69 + @ExcelProperty("客户描述")
  70 + private String description;
  71 +
47 @ExcelProperty("备注") 72 @ExcelProperty("备注")
48 private String remark; 73 private String remark;
49 74
@@ -56,12 +81,6 @@ public class CrmCustomerExcelVO { @@ -56,12 +81,6 @@ public class CrmCustomerExcelVO {
56 @ExcelProperty("详细地址") 81 @ExcelProperty("详细地址")
57 private String detailAddress; 82 private String detailAddress;
58 83
59 - @ExcelProperty("地理位置经度")  
60 - private String longitude;  
61 -  
62 - @ExcelProperty("地理位置维度")  
63 - private String latitude;  
64 -  
65 @ExcelProperty("最后跟进时间") 84 @ExcelProperty("最后跟进时间")
66 private LocalDateTime contactLastTime; 85 private LocalDateTime contactLastTime;
67 86
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerExportReqVO.java
@@ -14,10 +14,4 @@ public class CrmCustomerExportReqVO { @@ -14,10 +14,4 @@ public class CrmCustomerExportReqVO {
14 @Schema(description = "手机", example = "18000000000") 14 @Schema(description = "手机", example = "18000000000")
15 private String mobile; 15 private String mobile;
16 16
17 - @Schema(description = "电话", example = "18000000000")  
18 - private String telephone;  
19 -  
20 - @Schema(description = "网址", example = "https://www.baidu.com")  
21 - private String website;  
22 -  
23 } 17 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPageReqVO.java
@@ -18,13 +18,5 @@ public class CrmCustomerPageReqVO extends PageParam { @@ -18,13 +18,5 @@ public class CrmCustomerPageReqVO extends PageParam {
18 @Schema(description = "手机", example = "18000000000") 18 @Schema(description = "手机", example = "18000000000")
19 private String mobile; 19 private String mobile;
20 20
21 - // TODO @wanwan:这个字段不需要哈  
22 - @Schema(description = "电话", example = "18000000000")  
23 - private String telephone;  
24 -  
25 - // TODO @wanwan:这个字段不需要哈  
26 - @Schema(description = "网址", example = "https://www.baidu.com")  
27 - private String website;  
28 -  
29 // TODO @芋艿:场景; 21 // TODO @芋艿:场景;
30 } 22 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerRespVO.java
@@ -4,9 +4,12 @@ import io.swagger.v3.oas.annotations.media.Schema; @@ -4,9 +4,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 4 import lombok.Data;
5 import lombok.EqualsAndHashCode; 5 import lombok.EqualsAndHashCode;
6 import lombok.ToString; 6 import lombok.ToString;
  7 +import org.springframework.format.annotation.DateTimeFormat;
7 8
8 import java.time.LocalDateTime; 9 import java.time.LocalDateTime;
9 10
  11 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  12 +
10 @Schema(description = "管理后台 - 客户 Response VO") 13 @Schema(description = "管理后台 - 客户 Response VO")
11 @Data 14 @Data
12 @EqualsAndHashCode(callSuper = true) 15 @EqualsAndHashCode(callSuper = true)
@@ -16,9 +19,22 @@ public class CrmCustomerRespVO extends CrmCustomerBaseVO { @@ -16,9 +19,22 @@ public class CrmCustomerRespVO extends CrmCustomerBaseVO {
16 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") 19 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563")
17 private Long id; 20 private Long id;
18 21
  22 + @Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
  23 + private Boolean followUpStatus;
  24 +
  25 + @Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
  26 + private Boolean lockStatus;
  27 +
19 @Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") 28 @Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
20 private Boolean dealStatus; 29 private Boolean dealStatus;
21 30
  31 + @Schema(description = "负责人的用户编号", example = "25682")
  32 + private Long ownerUserId;
  33 +
  34 + @Schema(description = "最后跟进时间")
  35 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  36 + private LocalDateTime contactLastTime;
  37 +
22 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) 38 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
23 private LocalDateTime createTime; 39 private LocalDateTime createTime;
24 40
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerUpdateReqVO.java
@@ -17,11 +17,4 @@ public class CrmCustomerUpdateReqVO extends CrmCustomerBaseVO { @@ -17,11 +17,4 @@ public class CrmCustomerUpdateReqVO extends CrmCustomerBaseVO {
17 @NotNull(message = "编号不能为空") 17 @NotNull(message = "编号不能为空")
18 private Long id; 18 private Long id;
19 19
20 - // TODO @wanwan:下面两个字段,同 CrmCustomerCreateReqVO  
21 - @Schema(description = "只读权限的用户编号数组")  
22 - private String roUserIds;  
23 -  
24 - @Schema(description = "读写权限的用户编号数组")  
25 - private String rwUserIds;  
26 -  
27 } 20 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerDO.java
1 package cn.iocoder.yudao.module.crm.dal.dataobject.customer; 1 package cn.iocoder.yudao.module.crm.dal.dataobject.customer;
2 2
3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
4 import com.baomidou.mybatisplus.annotation.KeySequence; 5 import com.baomidou.mybatisplus.annotation.KeySequence;
  6 +import com.baomidou.mybatisplus.annotation.TableField;
5 import com.baomidou.mybatisplus.annotation.TableId; 7 import com.baomidou.mybatisplus.annotation.TableId;
6 import com.baomidou.mybatisplus.annotation.TableName; 8 import com.baomidou.mybatisplus.annotation.TableName;
7 import lombok.*; 9 import lombok.*;
8 10
9 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
  12 +import java.util.List;
10 13
11 // TODO 芋艿:调整下字段 14 // TODO 芋艿:调整下字段
  15 +
12 /** 16 /**
13 * 客户 DO 17 * 客户 DO
14 * 18 *
15 * @author Wanwan 19 * @author Wanwan
16 */ 20 */
17 -@TableName("crm_customer") 21 +@TableName(value = "crm_customer", autoResultMap = true)
18 @KeySequence("crm_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 22 @KeySequence("crm_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
19 @Data 23 @Data
20 @EqualsAndHashCode(callSuper = true) 24 @EqualsAndHashCode(callSuper = true)
@@ -46,6 +50,21 @@ public class CrmCustomerDO extends BaseDO { @@ -46,6 +50,21 @@ public class CrmCustomerDO extends BaseDO {
46 */ 50 */
47 private Boolean dealStatus; 51 private Boolean dealStatus;
48 /** 52 /**
  53 + * 所属行业
  54 + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY}
  55 + */
  56 + private Integer industryId;
  57 + /**
  58 + * 客户等级
  59 + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL}
  60 + */
  61 + private Integer level;
  62 + /**
  63 + * 客户来源
  64 + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE}
  65 + */
  66 + private Integer source;
  67 + /**
49 * 手机 68 * 手机
50 */ 69 */
51 private String mobile; 70 private String mobile;
@@ -58,6 +77,22 @@ public class CrmCustomerDO extends BaseDO { @@ -58,6 +77,22 @@ public class CrmCustomerDO extends BaseDO {
58 */ 77 */
59 private String website; 78 private String website;
60 /** 79 /**
  80 + * QQ
  81 + */
  82 + private String qq;
  83 + /**
  84 + * wechat
  85 + */
  86 + private String wechat;
  87 + /**
  88 + * email
  89 + */
  90 + private String email;
  91 + /**
  92 + * 客户描述
  93 + */
  94 + private String description;
  95 + /**
61 * 备注 96 * 备注
62 */ 97 */
63 private String remark; 98 private String remark;
@@ -65,15 +100,16 @@ public class CrmCustomerDO extends BaseDO { @@ -65,15 +100,16 @@ public class CrmCustomerDO extends BaseDO {
65 * 负责人的用户编号 100 * 负责人的用户编号
66 */ 101 */
67 private Long ownerUserId; 102 private Long ownerUserId;
68 - // TODO @wanwan:下面两个字段,使用 List<Long>,然后使用 typeHandler = LongListTypeHandler 解决持久化的问题;注意类上需要加 autoResultMap = true  
69 /** 103 /**
70 * 只读权限的用户编号数组 104 * 只读权限的用户编号数组
71 */ 105 */
72 - private String roUserIds; 106 + @TableField(typeHandler = LongListTypeHandler.class)
  107 + private List<Long> roUserIds;
73 /** 108 /**
74 * 读写权限的用户编号数组 109 * 读写权限的用户编号数组
75 */ 110 */
76 - private String rwUserIds; 111 + @TableField(typeHandler = LongListTypeHandler.class)
  112 + private List<Long> rwUserIds;
77 /** 113 /**
78 * 地区编号 114 * 地区编号
79 */ 115 */
@@ -82,15 +118,6 @@ public class CrmCustomerDO extends BaseDO { @@ -82,15 +118,6 @@ public class CrmCustomerDO extends BaseDO {
82 * 详细地址 118 * 详细地址
83 */ 119 */
84 private String detailAddress; 120 private String detailAddress;
85 - // TODO @wanwan:下面两个字段:删除  
86 - /**  
87 - * 地理位置经度  
88 - */  
89 - private String longitude;  
90 - /**  
91 - * 地理位置维度  
92 - */  
93 - private String latitude;  
94 /** 121 /**
95 * 最后跟进时间 122 * 最后跟进时间
96 */ 123 */
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
@@ -19,11 +19,10 @@ import java.util.List; @@ -19,11 +19,10 @@ import java.util.List;
19 public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { 19 public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
20 20
21 default PageResult<CrmCustomerDO> selectPage(CrmCustomerPageReqVO reqVO) { 21 default PageResult<CrmCustomerDO> selectPage(CrmCustomerPageReqVO reqVO) {
  22 + // TODO @Wanwan 填充负责人,所属部门字段
22 return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>() 23 return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>()
23 .likeIfPresent(CrmCustomerDO::getName, reqVO.getName()) 24 .likeIfPresent(CrmCustomerDO::getName, reqVO.getName())
24 .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile()) 25 .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile())
25 - .eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone())  
26 - .likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite())  
27 .orderByDesc(CrmCustomerDO::getId)); 26 .orderByDesc(CrmCustomerDO::getId));
28 } 27 }
29 28
@@ -31,8 +30,6 @@ public interface CrmCustomerMapper extends BaseMapperX&lt;CrmCustomerDO&gt; { @@ -31,8 +30,6 @@ public interface CrmCustomerMapper extends BaseMapperX&lt;CrmCustomerDO&gt; {
31 return selectList(new LambdaQueryWrapperX<CrmCustomerDO>() 30 return selectList(new LambdaQueryWrapperX<CrmCustomerDO>()
32 .likeIfPresent(CrmCustomerDO::getName, reqVO.getName()) 31 .likeIfPresent(CrmCustomerDO::getName, reqVO.getName())
33 .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile()) 32 .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile())
34 - .eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone())  
35 - .likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite())  
36 .orderByDesc(CrmCustomerDO::getId)); 33 .orderByDesc(CrmCustomerDO::getId));
37 } 34 }
38 35
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
@@ -39,7 +39,7 @@ public class CrmClueServiceImpl implements CrmClueService { @@ -39,7 +39,7 @@ public class CrmClueServiceImpl implements CrmClueService {
39 @Override 39 @Override
40 public Long createClue(CrmClueCreateReqVO createReqVO) { 40 public Long createClue(CrmClueCreateReqVO createReqVO) {
41 // 校验客户是否存在 41 // 校验客户是否存在
42 - validateCustomerExists(createReqVO.getCustomerId()); 42 + customerService.validateCustomer(createReqVO.getCustomerId());
43 // 插入 43 // 插入
44 CrmClueDO clue = CrmClueConvert.INSTANCE.convert(createReqVO); 44 CrmClueDO clue = CrmClueConvert.INSTANCE.convert(createReqVO);
45 clueMapper.insert(clue); 45 clueMapper.insert(clue);
@@ -52,7 +52,7 @@ public class CrmClueServiceImpl implements CrmClueService { @@ -52,7 +52,7 @@ public class CrmClueServiceImpl implements CrmClueService {
52 // 校验存在 52 // 校验存在
53 validateClueExists(updateReqVO.getId()); 53 validateClueExists(updateReqVO.getId());
54 // 校验客户是否存在 54 // 校验客户是否存在
55 - validateCustomerExists(updateReqVO.getCustomerId()); 55 + customerService.validateCustomer(updateReqVO.getCustomerId());
56 56
57 // 更新 57 // 更新
58 CrmClueDO updateObj = CrmClueConvert.INSTANCE.convert(updateReqVO); 58 CrmClueDO updateObj = CrmClueConvert.INSTANCE.convert(updateReqVO);
@@ -96,16 +96,4 @@ public class CrmClueServiceImpl implements CrmClueService { @@ -96,16 +96,4 @@ public class CrmClueServiceImpl implements CrmClueService {
96 return clueMapper.selectList(exportReqVO); 96 return clueMapper.selectList(exportReqVO);
97 } 97 }
98 98
99 - // TODO @wanwan:可以在 CrmClueServiceImpl 中,增加一个方法,用于校验客户是否存在;validateCustomer;然后其它方法可以调用它。不过要注意,需要把 CustomerDO 返回,因为其它模块可能要它的信息  
100 - /**  
101 - * 校验客户是否存在  
102 - *  
103 - * @param customerId 客户id  
104 - */  
105 - private void validateCustomerExists(Long customerId) {  
106 - if (customerService.getCustomer(customerId) == null) {  
107 - throw exception(CUSTOMER_NOT_EXISTS);  
108 - }  
109 - }  
110 -  
111 } 99 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
@@ -72,4 +72,12 @@ public interface CrmCustomerService { @@ -72,4 +72,12 @@ public interface CrmCustomerService {
72 */ 72 */
73 List<CrmCustomerDO> getCustomerList(CrmCustomerExportReqVO exportReqVO); 73 List<CrmCustomerDO> getCustomerList(CrmCustomerExportReqVO exportReqVO);
74 74
  75 + /**
  76 + * 校验客户是否存在
  77 + *
  78 + * @param customerId 客户id
  79 + * @return
  80 + */
  81 + CrmCustomerDO validateCustomer(Long customerId);
  82 +
75 } 83 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
1 package cn.iocoder.yudao.module.crm.service.customer; 1 package cn.iocoder.yudao.module.crm.service.customer;
2 2
  3 +import cn.iocoder.yudao.module.system.api.dept.DeptApi;
3 import org.springframework.stereotype.Service; 4 import org.springframework.stereotype.Service;
4 import javax.annotation.Resource; 5 import javax.annotation.Resource;
5 import org.springframework.validation.annotation.Validated; 6 import org.springframework.validation.annotation.Validated;
@@ -29,6 +30,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @@ -29,6 +30,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
29 30
30 @Resource 31 @Resource
31 private CrmCustomerMapper customerMapper; 32 private CrmCustomerMapper customerMapper;
  33 + @Resource
  34 + private DeptApi deptApi;
32 35
33 @Override 36 @Override
34 public Long createCustomer(CrmCustomerCreateReqVO createReqVO) { 37 public Long createCustomer(CrmCustomerCreateReqVO createReqVO) {
@@ -85,4 +88,18 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @@ -85,4 +88,18 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
85 return customerMapper.selectList(exportReqVO); 88 return customerMapper.selectList(exportReqVO);
86 } 89 }
87 90
  91 + /**
  92 + * 校验客户是否存在
  93 + *
  94 + * @param customerId 客户id
  95 + * @return
  96 + */
  97 + @Override
  98 + public CrmCustomerDO validateCustomer(Long customerId) {
  99 + CrmCustomerDO customer = getCustomer(customerId);
  100 + if (Objects.isNull(customer)) {
  101 + throw exception(CUSTOMER_NOT_EXISTS);
  102 + }
  103 + return customer;
  104 + }
88 } 105 }
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/create_tables.sql
@@ -113,8 +113,6 @@ CREATE TABLE IF NOT EXISTS &quot;crm_customer&quot; ( @@ -113,8 +113,6 @@ CREATE TABLE IF NOT EXISTS &quot;crm_customer&quot; (
113 "rw_user_ids" varchar, 113 "rw_user_ids" varchar,
114 "area_id" bigint, 114 "area_id" bigint,
115 "detail_address" varchar, 115 "detail_address" varchar,
116 - "longitude" varchar,  
117 - "latitude" varchar,  
118 "contact_last_time" varchar, 116 "contact_last_time" varchar,
119 "contact_next_time" varchar, 117 "contact_next_time" varchar,
120 "creator" varchar DEFAULT '', 118 "creator" varchar DEFAULT '',