Commit fe50356ae8cedc4ffacdcc87aca00e56535b4e4d

Authored by YunaiV
1 parent 0657c357

code review:crm 客户模块的实现

sql/mysql/crm.sql
... ... @@ -185,45 +185,7 @@ CREATE TABLE `crm_contact` (
185 185 PRIMARY KEY (`id`)
186 186 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='crm联系人';
187 187  
188   --- ----------------------------
189   --- 客户表
190   --- ----------------------------
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;
  188 +
227 189 -- ----------------------------
228 190 -- 商机状态表
229 191 -- ----------------------------
... ...
sql/mysql/crm_data.sql
... ... @@ -18,41 +18,3 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
18 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 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');
59 21 \ No newline at end of file
... ...
sql/mysql/crm_menu.sql
... ... @@ -233,13 +233,6 @@ VALUES (
233 233 '', '', '', 0
234 234 );
235 235  
236   -
237   --- ----------------------------
238   --- 客户管理菜单
239   --- ----------------------------
240   -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2375, '客户管理', '', 1, 0, 0, '/crm', 'ep:avatar', '', '', 0, b'1', b'1', b'1', '1', '2023-10-20 00:36:13', '1', '2023-10-19 16:37:24', b'0');
241   -
242   -
243 236 -- ----------------------------
244 237 -- 回款菜单
245 238 -- ----------------------------
... ... @@ -360,63 +353,3 @@ VALUES (
360 353 '回款计划导出', 'crm:receivable-plan:export', 3, 5, @parentId,
361 354 '', '', '', 0
362 355 );
363   -
364   --- ----------------------------
365   --- 客户管理菜单
366   --- ----------------------------
367   -
368   --- 菜单 SQL
369   -INSERT INTO system_menu(
370   - name, permission, type, sort, parent_id,
371   - path, icon, component, status, component_name
372   -)
373   -VALUES (
374   - '客户管理', '', 2, 0, 2375,
375   - 'customer', '', 'crm/customer/index', 0, 'CrmCustomer'
376   -);
377   -
378   --- 按钮父菜单ID
379   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
380   -SELECT @parentId := LAST_INSERT_ID();
381   -
382   --- 按钮 SQL
383   -INSERT INTO system_menu(
384   - name, permission, type, sort, parent_id,
385   - path, icon, component, status
386   -)
387   -VALUES (
388   - '客户查询', 'crm:customer:query', 3, 1, @parentId,
389   - '', '', '', 0
390   -);
391   -INSERT INTO system_menu(
392   - name, permission, type, sort, parent_id,
393   - path, icon, component, status
394   -)
395   -VALUES (
396   - '客户创建', 'crm:customer:create', 3, 2, @parentId,
397   - '', '', '', 0
398   -);
399   -INSERT INTO system_menu(
400   - name, permission, type, sort, parent_id,
401   - path, icon, component, status
402   -)
403   -VALUES (
404   - '客户更新', 'crm:customer:update', 3, 3, @parentId,
405   - '', '', '', 0
406   -);
407   -INSERT INTO system_menu(
408   - name, permission, type, sort, parent_id,
409   - path, icon, component, status
410   -)
411   -VALUES (
412   - '客户删除', 'crm:customer:delete', 3, 4, @parentId,
413   - '', '', '', 0
414   -);
415   -INSERT INTO system_menu(
416   - name, permission, type, sort, parent_id,
417   - path, icon, component, status
418   -)
419   -VALUES (
420   - '客户导出', 'crm:customer:export', 3, 5, @parentId,
421   - '', '', '', 0
422   -);
... ...
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java
1 1 package cn.iocoder.yudao.module.crm.enums;
2 2  
3 3 /**
4   - * System 字典类型的枚举类
  4 + * CRM 字典类型的枚举类
5 5 *
6 6 * @author 芋道源码
7 7 */
... ...
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/customer/CrmCustomerLevelEnum.java
... ... @@ -15,12 +15,13 @@ import java.util.Arrays;
15 15 @AllArgsConstructor
16 16 public enum CrmCustomerLevelEnum implements IntArrayValuable {
17 17  
18   - IMPORTANT(1, "A (重点客户)"),
19   - GENERAL(2, "B (普通客户)"),
20   - LOW_PRIORITY(3, "C (非优先客户)");
  18 + IMPORTANT(1, "A(重点客户)"),
  19 + GENERAL(2, "B(普通客户)"),
  20 + LOW_PRIORITY(3, "C(非优先客户)");
21 21  
22 22 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmCustomerLevelEnum::getStatus).toArray();
23 23  
  24 + // TODO @wanwan:这里的 status 字段,可以考虑改成 level
24 25 /**
25 26 * 状态
26 27 */
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerBaseVO.java
... ... @@ -10,7 +10,6 @@ import org.springframework.format.annotation.DateTimeFormat;
10 10  
11 11 import javax.validation.constraints.Email;
12 12 import javax.validation.constraints.NotEmpty;
13   -import javax.validation.constraints.NotNull;
14 13 import javax.validation.constraints.Size;
15 14 import java.time.LocalDateTime;
16 15  
... ... @@ -49,20 +48,20 @@ public class CrmCustomerBaseVO {
49 48 private String website;
50 49  
51 50 @Schema(description = "QQ", example = "123456789")
52   - @Size(max = 20, message = "QQ长度不能超过20个字符")
  51 + @Size(max = 20, message = "QQ长度不能超过 20 个字符")
53 52 private String qq;
54 53  
55 54 @Schema(description = "wechat", example = "123456789")
56   - @Size(max = 255, message = "微信长度不能超过255个字符")
  55 + @Size(max = 255, message = "微信长度不能超过 255 个字符")
57 56 private String wechat;
58 57  
59 58 @Schema(description = "email", example = "123456789@qq.com")
60 59 @Email(message = "邮箱格式不正确")
61   - @Size(max = 255, message = "邮箱长度不能超过255个字符")
  60 + @Size(max = 255, message = "邮箱长度不能超过 255 个字符")
62 61 private String email;
63 62  
64 63 @Schema(description = "客户描述", example = "任意文字")
65   - @Size(max = 4096, message = "客户描述长度不能超过255个字符")
  64 + @Size(max = 4096, message = "客户描述长度不能超过 4096 个字符")
66 65 private String description;
67 66  
68 67 @Schema(description = "备注", example = "随便")
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerCreateReqVO.java
... ... @@ -11,4 +11,6 @@ import lombok.ToString;
11 11 @ToString(callSuper = true)
12 12 public class CrmCustomerCreateReqVO extends CrmCustomerBaseVO {
13 13  
  14 + // TODO @wanwan:负责人
  15 +
14 16 }
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerDO.java
... ... @@ -51,17 +51,20 @@ public class CrmCustomerDO extends BaseDO {
51 51 private Boolean dealStatus;
52 52 /**
53 53 * 所属行业
54   - * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY}
  54 + *
  55 + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_CUSTOMER_INDUSTRY}
55 56 */
56 57 private Integer industryId;
57 58 /**
58 59 * 客户等级
59   - * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL}
  60 + *
  61 + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_CUSTOMER_LEVEL}
60 62 */
61 63 private Integer level;
62 64 /**
63 65 * 客户来源
64   - * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE}
  66 + *
  67 + * 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_CUSTOMER_SOURCE}
65 68 */
66 69 private Integer source;
67 70 /**
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
... ... @@ -19,7 +19,7 @@ import java.util.List;
19 19 public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
20 20  
21 21 default PageResult<CrmCustomerDO> selectPage(CrmCustomerPageReqVO reqVO) {
22   - // TODO @Wanwan 填充负责人,所属部门字段
  22 + // TODO @Wanwan 填充负责人,所属部门字段;这个可以在 controller 填哈;
23 23 return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>()
24 24 .likeIfPresent(CrmCustomerDO::getName, reqVO.getName())
25 25 .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile())
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
... ... @@ -75,8 +75,8 @@ public interface CrmCustomerService {
75 75 /**
76 76 * 校验客户是否存在
77 77 *
78   - * @param customerId 客户id
79   - * @return
  78 + * @param customerId 客户 id
  79 + * @return 客户
80 80 */
81 81 CrmCustomerDO validateCustomer(Long customerId);
82 82  
... ...
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
1 1 package cn.iocoder.yudao.module.crm.service.customer;
2 2  
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.collection.ListUtil;
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerCreateReqVO;
  7 +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO;
  8 +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO;
  9 +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerUpdateReqVO;
  10 +import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
  11 +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
  12 +import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper;
3 13 import cn.iocoder.yudao.module.system.api.dept.DeptApi;
4 14 import org.springframework.stereotype.Service;
5   -import javax.annotation.Resource;
6 15 import org.springframework.validation.annotation.Validated;
7 16  
8   -import java.util.*;
9   -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*;
10   -import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
11   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
12   -
13   -import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
14   -import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper;
  17 +import javax.annotation.Resource;
  18 +import java.util.Collection;
  19 +import java.util.List;
  20 +import java.util.Objects;
15 21  
16 22 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
17   -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
18   -
19   -import cn.hutool.core.collection.CollUtil;
20   -import cn.hutool.core.collection.ListUtil;
  23 +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS;
21 24  
22 25 /**
23 26 * 客户 Service 实现类
... ... @@ -31,7 +34,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
31 34 @Resource
32 35 private CrmCustomerMapper customerMapper;
33 36 @Resource
34   - private DeptApi deptApi;
  37 + private DeptApi deptApi; // TODO @wanwan:拼接数据,可以放到 controller;所以这里的引入,可以考虑放到 controller 哈;
35 38  
36 39 @Override
37 40 public Long createCustomer(CrmCustomerCreateReqVO createReqVO) {
... ... @@ -46,6 +49,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
46 49 public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) {
47 50 // 校验存在
48 51 validateCustomerExists(updateReqVO.getId());
  52 + // TODO 芋艿:数据权限,校验是否可以操作
  53 +
49 54 // 更新
50 55 CrmCustomerDO updateObj = CrmCustomerConvert.INSTANCE.convert(updateReqVO);
51 56 customerMapper.updateById(updateObj);
... ... @@ -55,6 +60,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
55 60 public void deleteCustomer(Long id) {
56 61 // 校验存在
57 62 validateCustomerExists(id);
  63 + // TODO 芋艿:数据权限,校验是否可以操作
  64 +
58 65 // 删除
59 66 customerMapper.deleteById(id);
60 67 }
... ... @@ -80,6 +87,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
80 87  
81 88 @Override
82 89 public PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO) {
  90 + // TODO 芋艿:数据权限,是否可以查询到;
83 91 return customerMapper.selectPage(pageReqVO);
84 92 }
85 93  
... ... @@ -88,6 +96,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
88 96 return customerMapper.selectList(exportReqVO);
89 97 }
90 98  
  99 + // TODO wanwan:service 接口已经注释,实现类就不需要了。
91 100 /**
92 101 * 校验客户是否存在
93 102 *
... ... @@ -102,4 +111,5 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
102 111 }
103 112 return customer;
104 113 }
  114 +
105 115 }
... ...