Commit b0ddd522fbf9390656ed22657ffdf3fb6faad141
Merge branch 'feature/crm' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/crm
Showing
62 changed files
with
3520 additions
and
135 deletions
sql/mysql/crm.sql
| ... | ... | @@ -62,6 +62,10 @@ CREATE TABLE `crm_clue` ( |
| 62 | 62 | PRIMARY KEY (`id`) USING BTREE |
| 63 | 63 | ) ENGINE = InnoDB COMMENT = '线索表' ; |
| 64 | 64 | |
| 65 | +-- ---------------------------- | |
| 66 | +-- 商机表 | |
| 67 | +-- ---------------------------- | |
| 68 | + | |
| 65 | 69 | DROP TABLE IF EXISTS `crm_business`; |
| 66 | 70 | CREATE TABLE `crm_business` ( |
| 67 | 71 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', |
| ... | ... | @@ -180,3 +184,64 @@ CREATE TABLE `crm_contact` ( |
| 180 | 184 | `tenant_id` bigint DEFAULT NULL, |
| 181 | 185 | PRIMARY KEY (`id`) |
| 182 | 186 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='crm联系人'; |
| 187 | + | |
| 188 | +-- ---------------------------- | |
| 189 | +-- 客户表 | |
| 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='客户表'; | |
| 219 | +-- ---------------------------- | |
| 220 | +-- 商机状态表 | |
| 221 | +-- ---------------------------- | |
| 222 | +DROP TABLE IF EXISTS `crm_business_status`; | |
| 223 | +CREATE TABLE `crm_business_status` ( | |
| 224 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | |
| 225 | + `type_id` bigint NOT NULL COMMENT '状态类型编号', | |
| 226 | + `name` varchar(100) NOT NULL COMMENT '状态名', | |
| 227 | + `percent` varchar(20) DEFAULT NULL COMMENT '赢单率', | |
| 228 | + `sort` int DEFAULT NULL COMMENT '排序', | |
| 229 | + `tenant_id` bigint DEFAULT '1' COMMENT '租户ID', | |
| 230 | + PRIMARY KEY (`id`) | |
| 231 | +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商机状态表' | |
| 232 | + | |
| 233 | +-- ---------------------------- | |
| 234 | +-- 商机状态类型表 | |
| 235 | +-- ---------------------------- | |
| 236 | +DROP TABLE IF EXISTS `crm_business_status_type`; | |
| 237 | +CREATE TABLE `crm_business_status_type` ( | |
| 238 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | |
| 239 | + `name` varchar(100) NOT NULL COMMENT '状态类型名', | |
| 240 | + `dept_ids` varchar(200) NOT NULL COMMENT '使用的部门编号', | |
| 241 | + `status` bit(1) NOT NULL DEFAULT b'0' COMMENT '开启状态', | |
| 242 | + `creator` varchar(64) NOT NULL COMMENT '创建人', | |
| 243 | + `create_time` datetime NOT NULL COMMENT '创建时间', | |
| 244 | + `update_time` datetime DEFAULT NULL COMMENT '更新时间', | |
| 245 | + `tenant_id` bigint DEFAULT '1' COMMENT '租户ID', | |
| 246 | + PRIMARY KEY (`id`) | |
| 247 | +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商机状态类型表' | ... | ... |
sql/mysql/crm_menu.sql
| ... | ... | @@ -117,6 +117,61 @@ VALUES ( |
| 117 | 117 | '线索导出', 'crm:clue:export', 3, 5, @parentId, |
| 118 | 118 | '', '', '', 0 |
| 119 | 119 | ); |
| 120 | +-- 菜单 SQL | |
| 121 | +INSERT INTO system_menu( | |
| 122 | + name, permission, type, sort, parent_id, | |
| 123 | + path, icon, component, status, component_name | |
| 124 | +) | |
| 125 | +VALUES ( | |
| 126 | + '联系人', '', 2, 0, ${table.parentMenuId}, | |
| 127 | + 'contact', '', 'crm/contact/index', 0, 'Contact' | |
| 128 | + ); | |
| 129 | + | |
| 130 | +-- 按钮父菜单ID | |
| 131 | +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 | |
| 132 | +SELECT @parentId := LAST_INSERT_ID(); | |
| 133 | + | |
| 134 | +-- 按钮 SQL | |
| 135 | +INSERT INTO system_menu( | |
| 136 | + name, permission, type, sort, parent_id, | |
| 137 | + path, icon, component, status | |
| 138 | +) | |
| 139 | +VALUES ( | |
| 140 | + '联系人查询', 'crm:contact:query', 3, 1, @parentId, | |
| 141 | + '', '', '', 0 | |
| 142 | + ); | |
| 143 | +INSERT INTO system_menu( | |
| 144 | + name, permission, type, sort, parent_id, | |
| 145 | + path, icon, component, status | |
| 146 | +) | |
| 147 | +VALUES ( | |
| 148 | + '联系人创建', 'crm:contact:create', 3, 2, @parentId, | |
| 149 | + '', '', '', 0 | |
| 150 | + ); | |
| 151 | +INSERT INTO system_menu( | |
| 152 | + name, permission, type, sort, parent_id, | |
| 153 | + path, icon, component, status | |
| 154 | +) | |
| 155 | +VALUES ( | |
| 156 | + '联系人更新', 'crm:contact:update', 3, 3, @parentId, | |
| 157 | + '', '', '', 0 | |
| 158 | + ); | |
| 159 | +INSERT INTO system_menu( | |
| 160 | + name, permission, type, sort, parent_id, | |
| 161 | + path, icon, component, status | |
| 162 | +) | |
| 163 | +VALUES ( | |
| 164 | + '联系人删除', 'crm:contact:delete', 3, 4, @parentId, | |
| 165 | + '', '', '', 0 | |
| 166 | + ); | |
| 167 | +INSERT INTO system_menu( | |
| 168 | + name, permission, type, sort, parent_id, | |
| 169 | + path, icon, component, status | |
| 170 | +) | |
| 171 | +VALUES ( | |
| 172 | + '联系人导出', 'crm:contact:export', 3, 5, @parentId, | |
| 173 | + '', '', '', 0 | |
| 174 | + ); | |
| 120 | 175 | |
| 121 | 176 | -- ---------------------------- |
| 122 | 177 | -- 合同菜单 |
| ... | ... | @@ -305,3 +360,63 @@ VALUES ( |
| 305 | 360 | '回款计划导出', 'crm:receivable-plan:export', 3, 5, @parentId, |
| 306 | 361 | '', '', '', 0 |
| 307 | 362 | ); |
| 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/ErrorCodeConstants.java
| ... | ... | @@ -18,6 +18,11 @@ public interface ErrorCodeConstants { |
| 18 | 18 | // ========== 商机管理 1-020-002-000 ========== |
| 19 | 19 | ErrorCode BUSINESS_NOT_EXISTS = new ErrorCode(1_020_002_000, "商机不存在"); |
| 20 | 20 | |
| 21 | + // TODO @lilleo:商机状态、商机类型,都单独错误码段 | |
| 22 | + | |
| 23 | + ErrorCode BUSINESS_STATUS_TYPE_NOT_EXISTS = new ErrorCode(1_020_002_001, "商机状态类型不存在"); | |
| 24 | + ErrorCode BUSINESS_STATUS_NOT_EXISTS = new ErrorCode(1_020_002_002, "商机状态不存在"); | |
| 25 | + | |
| 21 | 26 | // ========== 联系人管理 1-020-003-000 ========== |
| 22 | 27 | ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在"); |
| 23 | 28 | |
| ... | ... | @@ -27,4 +32,7 @@ public interface ErrorCodeConstants { |
| 27 | 32 | // ========== 合同管理 1-020-005-000 ========== |
| 28 | 33 | ErrorCode RECEIVABLE_PLAN_NOT_EXISTS = new ErrorCode(1_020_005_000, "回款计划不存在"); |
| 29 | 34 | |
| 35 | + // ========== 客户管理 1_020_006_000 ========== | |
| 36 | + ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(1_020_006_000, "客户不存在"); | |
| 37 | + | |
| 30 | 38 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| ... | ... | @@ -71,6 +71,7 @@ public class CrmBusinessController { |
| 71 | 71 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
| 72 | 72 | public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { |
| 73 | 73 | PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(pageVO); |
| 74 | + | |
| 74 | 75 | return success(CrmBusinessConvert.INSTANCE.convertPage(pageResult)); |
| 75 | 76 | } |
| 76 | 77 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessBaseVO.java
| ... | ... | @@ -21,13 +21,11 @@ public class CrmBusinessBaseVO { |
| 21 | 21 | @NotNull(message = "商机名称不能为空") |
| 22 | 22 | private String name; |
| 23 | 23 | |
| 24 | - // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED | |
| 25 | - @Schema(description = "商机状态类型编号", example = "25714") | |
| 24 | + @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714") | |
| 26 | 25 | @NotNull(message = "商机状态类型不能为空") |
| 27 | 26 | private Long statusTypeId; |
| 28 | 27 | |
| 29 | - // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED | |
| 30 | - @Schema(description = "商机状态编号", example = "30320") | |
| 28 | + @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | |
| 31 | 29 | @NotNull(message = "商机状态不能为空") |
| 32 | 30 | private Long statusId; |
| 33 | 31 | |
| ... | ... | @@ -43,13 +41,12 @@ public class CrmBusinessBaseVO { |
| 43 | 41 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 44 | 42 | private LocalDateTime dealTime; |
| 45 | 43 | |
| 46 | - // TODO @ljileo:金额使用 Integer 类型,转换成分 | |
| 47 | 44 | @Schema(description = "商机金额", example = "12371") |
| 48 | - private BigDecimal price; | |
| 45 | + private Integer price; | |
| 49 | 46 | |
| 50 | 47 | // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 |
| 51 | 48 | @Schema(description = "整单折扣") |
| 52 | - private BigDecimal discountPercent; | |
| 49 | + private Integer discountPercent; | |
| 53 | 50 | |
| 54 | 51 | @Schema(description = "产品总金额", example = "12025") |
| 55 | 52 | private BigDecimal productPrice; |
| ... | ... | @@ -57,33 +54,4 @@ public class CrmBusinessBaseVO { |
| 57 | 54 | @Schema(description = "备注", example = "随便") |
| 58 | 55 | private String remark; |
| 59 | 56 | |
| 60 | - // TODO @ljileo:这个新建和修改的时候,应该不传递哈;应该新建的人,就是它的负责人 | |
| 61 | - @Schema(description = "负责人的用户编号", example = "25562") | |
| 62 | - private Long ownerUserId; | |
| 63 | - | |
| 64 | - // TODO @ljileo:这个新建和修改的时候,应该不传递哈 | |
| 65 | - @Schema(description = "只读权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 66 | - private String roUserIds; | |
| 67 | - | |
| 68 | - // TODO @ljileo:这个新建和修改的时候,应该不传递哈 | |
| 69 | - @Schema(description = "读写权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 70 | - private String rwUserIds; | |
| 71 | - | |
| 72 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | |
| 73 | - @Schema(description = "1赢单2输单3无效", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 74 | - private Integer endStatus; | |
| 75 | - | |
| 76 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | |
| 77 | - @Schema(description = "结束时的备注", example = "你说的对") | |
| 78 | - private String endRemark; | |
| 79 | - | |
| 80 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | |
| 81 | - @Schema(description = "最后跟进时间") | |
| 82 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 83 | - private LocalDateTime contactLastTime; | |
| 84 | - | |
| 85 | - // TODO @lijieo:新建的时候,不传递这个字段哈; | |
| 86 | - @Schema(description = "跟进状态", example = "1") | |
| 87 | - private Integer followUpStatus; | |
| 88 | - | |
| 89 | 57 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessPageReqVO.java
| ... | ... | @@ -5,12 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | - | |
| 10 | -import java.math.BigDecimal; | |
| 11 | -import java.time.LocalDateTime; | |
| 12 | - | |
| 13 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 14 | 8 | |
| 15 | 9 | @Schema(description = "管理后台 - 商机分页 Request VO") |
| 16 | 10 | @Data |
| ... | ... | @@ -18,64 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ |
| 18 | 12 | @ToString(callSuper = true) |
| 19 | 13 | public class CrmBusinessPageReqVO extends PageParam { |
| 20 | 14 | |
| 21 | - // TODO @ljileo:目前就使用 name 检索即可; | |
| 22 | - | |
| 23 | 15 | @Schema(description = "商机名称", example = "李四") |
| 24 | 16 | private String name; |
| 25 | 17 | |
| 26 | - @Schema(description = "商机状态类型编号", example = "25714") | |
| 27 | - private Long statusTypeId; | |
| 28 | - | |
| 29 | - @Schema(description = "商机状态编号", example = "30320") | |
| 30 | - private Long statusId; | |
| 31 | - | |
| 32 | - @Schema(description = "下次联系时间") | |
| 33 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 34 | - private LocalDateTime[] contactNextTime; | |
| 35 | - | |
| 36 | - @Schema(description = "客户编号", example = "10299") | |
| 37 | - private Long customerId; | |
| 38 | - | |
| 39 | - @Schema(description = "预计成交日期") | |
| 40 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 41 | - private LocalDateTime[] dealTime; | |
| 42 | - | |
| 43 | - @Schema(description = "商机金额", example = "12371") | |
| 44 | - private BigDecimal price; | |
| 45 | - | |
| 46 | - @Schema(description = "整单折扣") | |
| 47 | - private BigDecimal discountPercent; | |
| 48 | - | |
| 49 | - @Schema(description = "产品总金额", example = "12025") | |
| 50 | - private BigDecimal productPrice; | |
| 51 | - | |
| 52 | - @Schema(description = "备注", example = "随便") | |
| 53 | - private String remark; | |
| 54 | - | |
| 55 | - @Schema(description = "负责人的用户编号", example = "25562") | |
| 56 | - private Long ownerUserId; | |
| 57 | - | |
| 58 | - @Schema(description = "创建时间") | |
| 59 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 60 | - private LocalDateTime[] createTime; | |
| 61 | - | |
| 62 | - @Schema(description = "只读权限的用户编号数组") | |
| 63 | - private String roUserIds; | |
| 64 | - | |
| 65 | - @Schema(description = "读写权限的用户编号数组") | |
| 66 | - private String rwUserIds; | |
| 67 | - | |
| 68 | - @Schema(description = "1赢单2输单3无效", example = "1") | |
| 69 | - private Integer endStatus; | |
| 70 | - | |
| 71 | - @Schema(description = "结束时的备注", example = "你说的对") | |
| 72 | - private String endRemark; | |
| 73 | - | |
| 74 | - @Schema(description = "最后跟进时间") | |
| 75 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 76 | - private LocalDateTime[] contactLastTime; | |
| 77 | - | |
| 78 | - @Schema(description = "跟进状态", example = "1") | |
| 79 | - private Integer followUpStatus; | |
| 80 | - | |
| 81 | 18 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/CrmBusinessStatusController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 6 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; | |
| 8 | +import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 10 | +import cn.iocoder.yudao.module.crm.service.businessstatus.CrmBusinessStatusService; | |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 16 | +import org.springframework.web.bind.annotation.*; | |
| 17 | + | |
| 18 | +import javax.annotation.Resource; | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | +import javax.validation.Valid; | |
| 21 | +import java.io.IOException; | |
| 22 | +import java.util.Collection; | |
| 23 | +import java.util.List; | |
| 24 | + | |
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 27 | + | |
| 28 | +// TODO @lilleo:这个模块,可以挪到 business 下;这样我打开 business 包下,就知道,噢~原来里面有 business 商机、有 type 状态类型、status 具体状态; | |
| 29 | +@Tag(name = "管理后台 - 商机状态") | |
| 30 | +@RestController | |
| 31 | +@RequestMapping("/crm/business-status") | |
| 32 | +@Validated | |
| 33 | +public class CrmBusinessStatusController { | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private CrmBusinessStatusService businessStatusService; | |
| 37 | + | |
| 38 | + @PostMapping("/create") | |
| 39 | + @Operation(summary = "创建商机状态") | |
| 40 | + @PreAuthorize("@ss.hasPermission('crm:business-status:create')") | |
| 41 | + public CommonResult<Long> createBusinessStatus(@Valid @RequestBody CrmBusinessStatusCreateReqVO createReqVO) { | |
| 42 | + return success(businessStatusService.createBusinessStatus(createReqVO)); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @PutMapping("/update") | |
| 46 | + @Operation(summary = "更新商机状态") | |
| 47 | + @PreAuthorize("@ss.hasPermission('crm:business-status:update')") | |
| 48 | + public CommonResult<Boolean> updateBusinessStatus(@Valid @RequestBody CrmBusinessStatusUpdateReqVO updateReqVO) { | |
| 49 | + businessStatusService.updateBusinessStatus(updateReqVO); | |
| 50 | + return success(true); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @DeleteMapping("/delete") | |
| 54 | + @Operation(summary = "删除商机状态") | |
| 55 | + @Parameter(name = "id", description = "编号", required = true) | |
| 56 | + @PreAuthorize("@ss.hasPermission('crm:business-status:delete')") | |
| 57 | + public CommonResult<Boolean> deleteBusinessStatus(@RequestParam("id") Long id) { | |
| 58 | + businessStatusService.deleteBusinessStatus(id); | |
| 59 | + return success(true); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @GetMapping("/get") | |
| 63 | + @Operation(summary = "获得商机状态") | |
| 64 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 65 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 66 | + public CommonResult<CrmBusinessStatusRespVO> getBusinessStatus(@RequestParam("id") Long id) { | |
| 67 | + CrmBusinessStatusDO businessStatus = businessStatusService.getBusinessStatus(id); | |
| 68 | + return success(CrmBusinessStatusConvert.INSTANCE.convert(businessStatus)); | |
| 69 | + } | |
| 70 | + | |
| 71 | + // TODO @lilleo:这个接口,暂时用不到,可以考虑先删除掉 | |
| 72 | + @GetMapping("/list") | |
| 73 | + @Operation(summary = "获得商机状态列表") | |
| 74 | + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | |
| 75 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 76 | + public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusList(@RequestParam("ids") Collection<Long> ids) { | |
| 77 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(ids); | |
| 78 | + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @GetMapping("/page") | |
| 82 | + @Operation(summary = "获得商机状态分页") | |
| 83 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 84 | + public CommonResult<PageResult<CrmBusinessStatusRespVO>> getBusinessStatusPage(@Valid CrmBusinessStatusPageReqVO pageVO) { | |
| 85 | + PageResult<CrmBusinessStatusDO> pageResult = businessStatusService.getBusinessStatusPage(pageVO); | |
| 86 | + return success(CrmBusinessStatusConvert.INSTANCE.convertPage(pageResult)); | |
| 87 | + } | |
| 88 | + | |
| 89 | + @GetMapping("/export-excel") | |
| 90 | + @Operation(summary = "导出商机状态 Excel") | |
| 91 | + @PreAuthorize("@ss.hasPermission('crm:business-status:export')") | |
| 92 | + @OperateLog(type = EXPORT) | |
| 93 | + public void exportBusinessStatusExcel(@Valid CrmBusinessStatusExportReqVO exportReqVO, | |
| 94 | + HttpServletResponse response) throws IOException { | |
| 95 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(exportReqVO); | |
| 96 | + // 导出 Excel | |
| 97 | + List<CrmBusinessStatusExcelVO> datas = CrmBusinessStatusConvert.INSTANCE.convertList02(list); | |
| 98 | + ExcelUtils.write(response, "商机状态.xls", "数据", CrmBusinessStatusExcelVO.class, datas); | |
| 99 | + } | |
| 100 | + | |
| 101 | + // TODO 芋艿:后续再看看 | |
| 102 | + @GetMapping("/get-simple-list") | |
| 103 | + @Operation(summary = "获得商机状态列表") | |
| 104 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 105 | + public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusListByTypeId(@RequestParam("typeId") Integer typeId) { | |
| 106 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusListByTypeId(typeId); | |
| 107 | + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | |
| 108 | + } | |
| 109 | + | |
| 110 | + // TODO 芋艿:后续再看看 | |
| 111 | + @GetMapping("/get-all-list") | |
| 112 | + @Operation(summary = "获得商机状态列表") | |
| 113 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") | |
| 114 | + public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusList() { | |
| 115 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(); | |
| 116 | + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); | |
| 117 | + } | |
| 118 | + | |
| 119 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 商机状态 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | + */ | |
| 12 | +@Data | |
| 13 | +public class CrmBusinessStatusBaseVO { | |
| 14 | + | |
| 15 | + // TODO @lilleo:example 要写下 | |
| 16 | + | |
| 17 | + @Schema(description = "状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22882") | |
| 18 | + @NotNull(message = "状态类型编号不能为空") | |
| 19 | + private Long typeId; | |
| 20 | + | |
| 21 | + @Schema(description = "状态名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 22 | + @NotNull(message = "状态名不能为空") | |
| 23 | + private String name; | |
| 24 | + | |
| 25 | + // TODO @lilleo:percent 应该是 Integer; | |
| 26 | + @Schema(description = "赢单率") | |
| 27 | + private String percent; | |
| 28 | + | |
| 29 | + // TODO @lilleo:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; | |
| 30 | + @Schema(description = "排序") | |
| 31 | + private Integer sort; | |
| 32 | + | |
| 33 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import javax.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 商机状态创建 Request VO") | |
| 9 | +@Data | |
| 10 | +@EqualsAndHashCode(callSuper = true) | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class CrmBusinessStatusCreateReqVO extends CrmBusinessStatusBaseVO { | |
| 13 | + | |
| 14 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | + | |
| 3 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 7 | +/** | |
| 8 | + * 商机状态 Excel VO | |
| 9 | + * | |
| 10 | + * @author ljlleo | |
| 11 | + */ | |
| 12 | +@Data | |
| 13 | +public class CrmBusinessStatusExcelVO { | |
| 14 | + | |
| 15 | + @ExcelProperty("主键") | |
| 16 | + private Long id; | |
| 17 | + | |
| 18 | + @ExcelProperty("状态类型编号") | |
| 19 | + private Long typeId; | |
| 20 | + | |
| 21 | + @ExcelProperty("状态名") | |
| 22 | + private String name; | |
| 23 | + | |
| 24 | + @ExcelProperty("赢单率") | |
| 25 | + private String percent; | |
| 26 | + | |
| 27 | + @ExcelProperty("排序") | |
| 28 | + private Integer sort; | |
| 29 | + | |
| 30 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 7 | +@Schema(description = "管理后台 - 商机状态 Excel 导出 Request VO,参数和 CrmBusinessStatusPageReqVO 是一致的") | |
| 8 | +@Data | |
| 9 | +public class CrmBusinessStatusExportReqVO { | |
| 10 | + | |
| 11 | + @Schema(description = "状态类型编号", example = "22882") | |
| 12 | + private Long typeId; | |
| 13 | + | |
| 14 | + @Schema(description = "状态名", example = "李四") | |
| 15 | + private String name; | |
| 16 | + | |
| 17 | + @Schema(description = "赢单率") | |
| 18 | + private String percent; | |
| 19 | + | |
| 20 | + @Schema(description = "排序") | |
| 21 | + private Integer sort; | |
| 22 | + | |
| 23 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - 商机状态分页 Request VO") | |
| 10 | +@Data | |
| 11 | +@EqualsAndHashCode(callSuper = true) | |
| 12 | +@ToString(callSuper = true) | |
| 13 | +public class CrmBusinessStatusPageReqVO extends PageParam { | |
| 14 | + | |
| 15 | + @Schema(description = "状态类型编号", example = "22882") | |
| 16 | + private Long typeId; | |
| 17 | + | |
| 18 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | + | |
| 6 | +@Schema(description = "管理后台 - 商机状态 Response VO") | |
| 7 | +@Data | |
| 8 | +@EqualsAndHashCode(callSuper = true) | |
| 9 | +@ToString(callSuper = true) | |
| 10 | +public class CrmBusinessStatusRespVO extends CrmBusinessStatusBaseVO { | |
| 11 | + | |
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 商机状态更新 Request VO") | |
| 11 | +@Data | |
| 12 | +@EqualsAndHashCode(callSuper = true) | |
| 13 | +@ToString(callSuper = true) | |
| 14 | +public class CrmBusinessStatusUpdateReqVO extends CrmBusinessStatusBaseVO { | |
| 15 | + | |
| 16 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") | |
| 17 | + @NotNull(message = "编号不能为空") | |
| 18 | + private Long id; | |
| 19 | + | |
| 20 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/CrmBusinessStatusTypeController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 7 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; | |
| 9 | +import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 11 | +import cn.iocoder.yudao.module.crm.service.businessstatustype.CrmBusinessStatusTypeService; | |
| 12 | +import io.swagger.v3.oas.annotations.Operation; | |
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 14 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 15 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 16 | +import org.springframework.validation.annotation.Validated; | |
| 17 | +import org.springframework.web.bind.annotation.*; | |
| 18 | + | |
| 19 | +import javax.annotation.Resource; | |
| 20 | +import javax.servlet.http.HttpServletResponse; | |
| 21 | +import javax.validation.Valid; | |
| 22 | +import java.io.IOException; | |
| 23 | +import java.util.Collection; | |
| 24 | +import java.util.List; | |
| 25 | + | |
| 26 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 27 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 28 | + | |
| 29 | +// TODO @lilleo:这个模块,可以挪到 business 下;这样我打开 business 包下,就知道,噢~原来里面有 business 商机、有 type 状态类型、status 具体状态; | |
| 30 | +@Tag(name = "管理后台 - 商机状态类型") | |
| 31 | +@RestController | |
| 32 | +@RequestMapping("/crm/business-status-type") | |
| 33 | +@Validated | |
| 34 | +public class CrmBusinessStatusTypeController { | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + private CrmBusinessStatusTypeService businessStatusTypeService; | |
| 38 | + | |
| 39 | + @PostMapping("/create") | |
| 40 | + @Operation(summary = "创建商机状态类型") | |
| 41 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:create')") | |
| 42 | + public CommonResult<Long> createBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeCreateReqVO createReqVO) { | |
| 43 | + return success(businessStatusTypeService.createBusinessStatusType(createReqVO)); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @PutMapping("/update") | |
| 47 | + @Operation(summary = "更新商机状态类型") | |
| 48 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:update')") | |
| 49 | + public CommonResult<Boolean> updateBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeUpdateReqVO updateReqVO) { | |
| 50 | + businessStatusTypeService.updateBusinessStatusType(updateReqVO); | |
| 51 | + return success(true); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @DeleteMapping("/delete") | |
| 55 | + @Operation(summary = "删除商机状态类型") | |
| 56 | + @Parameter(name = "id", description = "编号", required = true) | |
| 57 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:delete')") | |
| 58 | + public CommonResult<Boolean> deleteBusinessStatusType(@RequestParam("id") Long id) { | |
| 59 | + businessStatusTypeService.deleteBusinessStatusType(id); | |
| 60 | + return success(true); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @GetMapping("/get") | |
| 64 | + @Operation(summary = "获得商机状态类型") | |
| 65 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 66 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | |
| 67 | + public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { | |
| 68 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); | |
| 69 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(businessStatusType)); | |
| 70 | + } | |
| 71 | + | |
| 72 | + // TODO @lilleo:这个接口,暂时用不到,可以考虑先删除掉 | |
| 73 | + @GetMapping("/list") | |
| 74 | + @Operation(summary = "获得商机状态类型列表") | |
| 75 | + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | |
| 76 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | |
| 77 | + public CommonResult<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList(@RequestParam("ids") Collection<Long> ids) { | |
| 78 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(ids); | |
| 79 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); | |
| 80 | + } | |
| 81 | + | |
| 82 | + @GetMapping("/page") | |
| 83 | + @Operation(summary = "获得商机状态类型分页") | |
| 84 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | |
| 85 | + public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageVO) { | |
| 86 | + PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageVO); | |
| 87 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult)); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @GetMapping("/export-excel") | |
| 91 | + @Operation(summary = "导出商机状态类型 Excel") | |
| 92 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:export')") | |
| 93 | + @OperateLog(type = EXPORT) | |
| 94 | + public void exportBusinessStatusTypeExcel(@Valid CrmBusinessStatusTypeExportReqVO exportReqVO, | |
| 95 | + HttpServletResponse response) throws IOException { | |
| 96 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(exportReqVO); | |
| 97 | + // 导出 Excel | |
| 98 | + List<CrmBusinessStatusTypeExcelVO> datas = CrmBusinessStatusTypeConvert.INSTANCE.convertList02(list); | |
| 99 | + ExcelUtils.write(response, "商机状态类型.xls", "数据", CrmBusinessStatusTypeExcelVO.class, datas); | |
| 100 | + } | |
| 101 | + | |
| 102 | + @GetMapping("/get-simple-list") | |
| 103 | + @Operation(summary = "获得商机状态类型列表") | |
| 104 | + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | |
| 105 | + public CommonResult<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList() { | |
| 106 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 107 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); | |
| 108 | + } | |
| 109 | + | |
| 110 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 商机状态类型 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | + */ | |
| 12 | +@Data | |
| 13 | +public class CrmBusinessStatusTypeBaseVO { | |
| 14 | + | |
| 15 | + @Schema(description = "状态类型名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 16 | + @NotNull(message = "状态类型名不能为空") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 20 | + @NotNull(message = "使用的部门编号不能为空") | |
| 21 | + private String deptIds; | |
| 22 | + | |
| 23 | + @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | + @NotNull(message = "开启状态不能为空") | |
| 25 | + private Boolean status; | |
| 26 | + | |
| 27 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +// TODO 状态类型和状态添加,是在一个请求里,所以需要把 CrmBusinessStatusCreateReqVO 融合进来; | |
| 9 | +@Schema(description = "管理后台 - 商机状态类型创建 Request VO") | |
| 10 | +@Data | |
| 11 | +@EqualsAndHashCode(callSuper = true) | |
| 12 | +@ToString(callSuper = true) | |
| 13 | +public class CrmBusinessStatusTypeCreateReqVO extends CrmBusinessStatusTypeBaseVO { | |
| 14 | + | |
| 15 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | + | |
| 3 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | + | |
| 8 | +// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 9 | +/** | |
| 10 | + * 商机状态类型 Excel VO | |
| 11 | + * | |
| 12 | + * @author ljlleo | |
| 13 | + */ | |
| 14 | +@Data | |
| 15 | +public class CrmBusinessStatusTypeExcelVO { | |
| 16 | + | |
| 17 | + @ExcelProperty("主键") | |
| 18 | + private Long id; | |
| 19 | + | |
| 20 | + @ExcelProperty("状态类型名") | |
| 21 | + private String name; | |
| 22 | + | |
| 23 | + @ExcelProperty("使用的部门编号") | |
| 24 | + private String deptIds; | |
| 25 | + | |
| 26 | + @ExcelProperty("开启状态") | |
| 27 | + private Boolean status; | |
| 28 | + | |
| 29 | + @ExcelProperty("创建时间") | |
| 30 | + private LocalDateTime createTime; | |
| 31 | + | |
| 32 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 6 | + | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 10 | + | |
| 11 | +// TODO @lilleo:这个暂时不需要;嘿嘿~不是每个模块都需要导出哈 | |
| 12 | +@Schema(description = "管理后台 - 商机状态类型 Excel 导出 Request VO,参数和 CrmBusinessStatusTypePageReqVO 是一致的") | |
| 13 | +@Data | |
| 14 | +public class CrmBusinessStatusTypeExportReqVO { | |
| 15 | + | |
| 16 | + @Schema(description = "状态类型名", example = "芋艿") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "使用的部门编号") | |
| 20 | + private String deptIds; | |
| 21 | + | |
| 22 | + @Schema(description = "开启状态", example = "1") | |
| 23 | + private Boolean status; | |
| 24 | + | |
| 25 | + @Schema(description = "创建时间") | |
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | + private LocalDateTime[] createTime; | |
| 28 | + | |
| 29 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - 商机状态类型分页 Request VO") | |
| 10 | +@Data | |
| 11 | +@EqualsAndHashCode(callSuper = true) | |
| 12 | +@ToString(callSuper = true) | |
| 13 | +public class CrmBusinessStatusTypePageReqVO extends PageParam { | |
| 14 | + | |
| 15 | + @Schema(description = "状态类型名", example = "芋艿") | |
| 16 | + private String name; | |
| 17 | + | |
| 18 | + @Schema(description = "开启状态", example = "1") | |
| 19 | + private Boolean status; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | + | |
| 7 | +@Schema(description = "管理后台 - 商机状态类型 Response VO") | |
| 8 | +@Data | |
| 9 | +@EqualsAndHashCode(callSuper = true) | |
| 10 | +@ToString(callSuper = true) | |
| 11 | +public class CrmBusinessStatusTypeRespVO extends CrmBusinessStatusTypeBaseVO { | |
| 12 | + | |
| 13 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 17 | + private LocalDateTime createTime; | |
| 18 | + | |
| 19 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 9 | + | |
| 10 | +// TODO 状态类型和状态添加,是在一个请求里,所以需要把 CrmBusinessStatusUpdateReqVO 融合进来; | |
| 11 | +@Schema(description = "管理后台 - 商机状态类型更新 Request VO") | |
| 12 | +@Data | |
| 13 | +@EqualsAndHashCode(callSuper = true) | |
| 14 | +@ToString(callSuper = true) | |
| 15 | +public class CrmBusinessStatusTypeUpdateReqVO extends CrmBusinessStatusTypeBaseVO { | |
| 16 | + | |
| 17 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") | |
| 18 | + @NotNull(message = "主键不能为空") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 6 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | |
| 8 | +import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 10 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 4 | 13 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 5 | 15 | import org.springframework.validation.annotation.Validated; |
| 6 | -import org.springframework.web.bind.annotation.GetMapping; | |
| 7 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | -import org.springframework.web.bind.annotation.RestController; | |
| 16 | +import org.springframework.web.bind.annotation.*; | |
| 17 | + | |
| 18 | +import javax.annotation.Resource; | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | +import javax.validation.Valid; | |
| 21 | +import java.io.IOException; | |
| 22 | +import java.util.Collection; | |
| 23 | +import java.util.List; | |
| 9 | 24 | |
| 10 | 25 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 11 | 27 | |
| 12 | -@Tag(name = "管理后台 - 客户信息") | |
| 28 | +@Tag(name = "管理后台 - 客户") | |
| 13 | 29 | @RestController |
| 14 | 30 | @RequestMapping("/crm/customer") |
| 15 | 31 | @Validated |
| 16 | 32 | public class CrmCustomerController { |
| 17 | 33 | |
| 18 | - @GetMapping("/test") | |
| 19 | - public CommonResult<String> test() { | |
| 20 | - return success("hello"); | |
| 34 | + @Resource | |
| 35 | + private CrmCustomerService customerService; | |
| 36 | + | |
| 37 | + @PostMapping("/create") | |
| 38 | + @Operation(summary = "创建客户") | |
| 39 | + @PreAuthorize("@ss.hasPermission('crm:customer:create')") | |
| 40 | + public CommonResult<Long> createCustomer(@Valid @RequestBody CrmCustomerCreateReqVO createReqVO) { | |
| 41 | + return success(customerService.createCustomer(createReqVO)); | |
| 42 | + } | |
| 43 | + | |
| 44 | + @PutMapping("/update") | |
| 45 | + @Operation(summary = "更新客户") | |
| 46 | + @PreAuthorize("@ss.hasPermission('crm:customer:update')") | |
| 47 | + public CommonResult<Boolean> updateCustomer(@Valid @RequestBody CrmCustomerUpdateReqVO updateReqVO) { | |
| 48 | + customerService.updateCustomer(updateReqVO); | |
| 49 | + return success(true); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @DeleteMapping("/delete") | |
| 53 | + @Operation(summary = "删除客户") | |
| 54 | + @Parameter(name = "id", description = "编号", required = true) | |
| 55 | + @PreAuthorize("@ss.hasPermission('crm:customer:delete')") | |
| 56 | + public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Long id) { | |
| 57 | + customerService.deleteCustomer(id); | |
| 58 | + return success(true); | |
| 59 | + } | |
| 60 | + | |
| 61 | + @GetMapping("/get") | |
| 62 | + @Operation(summary = "获得客户") | |
| 63 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 64 | + @PreAuthorize("@ss.hasPermission('crm:customer:query')") | |
| 65 | + public CommonResult<CrmCustomerRespVO> getCustomer(@RequestParam("id") Long id) { | |
| 66 | + CrmCustomerDO customer = customerService.getCustomer(id); | |
| 67 | + return success(CrmCustomerConvert.INSTANCE.convert(customer)); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @GetMapping("/page") | |
| 71 | + @Operation(summary = "获得客户分页") | |
| 72 | + @PreAuthorize("@ss.hasPermission('crm:customer:query')") | |
| 73 | + public CommonResult<PageResult<CrmCustomerRespVO>> getCustomerPage(@Valid CrmCustomerPageReqVO pageVO) { | |
| 74 | + PageResult<CrmCustomerDO> pageResult = customerService.getCustomerPage(pageVO); | |
| 75 | + return success(CrmCustomerConvert.INSTANCE.convertPage(pageResult)); | |
| 76 | + } | |
| 77 | + | |
| 78 | + @GetMapping("/export-excel") | |
| 79 | + @Operation(summary = "导出客户 Excel") | |
| 80 | + @PreAuthorize("@ss.hasPermission('crm:customer:export')") | |
| 81 | + @OperateLog(type = EXPORT) | |
| 82 | + public void exportCustomerExcel(@Valid CrmCustomerExportReqVO exportReqVO, | |
| 83 | + HttpServletResponse response) throws IOException { | |
| 84 | + List<CrmCustomerDO> list = customerService.getCustomerList(exportReqVO); | |
| 85 | + // 导出 Excel | |
| 86 | + List<CrmCustomerExcelVO> datas = CrmCustomerConvert.INSTANCE.convertList02(list); | |
| 87 | + ExcelUtils.write(response, "客户.xls", "数据", CrmCustomerExcelVO.class, datas); | |
| 21 | 88 | } |
| 22 | 89 | |
| 23 | 90 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.Mobile; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.Telephone; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import lombok.Data; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | + | |
| 9 | +import javax.validation.constraints.NotEmpty; | |
| 10 | +import javax.validation.constraints.NotNull; | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | + | |
| 13 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 客户 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 17 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 18 | + */ | |
| 19 | +@Data | |
| 20 | +public class CrmCustomerBaseVO { | |
| 21 | + | |
| 22 | + @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 23 | + @NotEmpty(message = "客户名称不能为空") | |
| 24 | + private String name; | |
| 25 | + | |
| 26 | + // TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递; | |
| 27 | + @Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 28 | + @NotNull(message = "跟进状态不能为空") | |
| 29 | + private Boolean followUpStatus; | |
| 30 | + | |
| 31 | + // TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递; | |
| 32 | + @Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 33 | + @NotNull(message = "锁定状态不能为空") | |
| 34 | + private Boolean lockStatus; | |
| 35 | + | |
| 36 | + @Schema(description = "手机", example = "18000000000") | |
| 37 | + @Mobile | |
| 38 | + private String mobile; | |
| 39 | + | |
| 40 | + @Schema(description = "电话", example = "18000000000") | |
| 41 | + @Telephone | |
| 42 | + private String telephone; | |
| 43 | + | |
| 44 | + @Schema(description = "网址", example = "https://www.baidu.com") | |
| 45 | + private String website; | |
| 46 | + | |
| 47 | + @Schema(description = "备注", example = "随便") | |
| 48 | + private String remark; | |
| 49 | + | |
| 50 | + // TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;因为它会在“移交”里面做哈 | |
| 51 | + @Schema(description = "负责人的用户编号", example = "25682") | |
| 52 | + @NotNull(message = "负责人不能为空") | |
| 53 | + private Long ownerUserId; | |
| 54 | + | |
| 55 | + @Schema(description = "地区编号", example = "20158") | |
| 56 | + private Long areaId; | |
| 57 | + | |
| 58 | + @Schema(description = "详细地址", example = "北京市海淀区") | |
| 59 | + private String detailAddress; | |
| 60 | + | |
| 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 = "下次联系时间") | |
| 74 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 75 | + private LocalDateTime contactNextTime; | |
| 76 | + | |
| 77 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 客户创建 Request VO") | |
| 9 | +@Data | |
| 10 | +@EqualsAndHashCode(callSuper = true) | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class CrmCustomerCreateReqVO extends CrmCustomerBaseVO { | |
| 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 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | |
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | |
| 5 | +import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | |
| 6 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | + | |
| 11 | +// TODO 芋艿:导出最后做,等基本确认的差不多之后; | |
| 12 | +/** | |
| 13 | + * 客户 Excel VO | |
| 14 | + * | |
| 15 | + * @author Wanwan | |
| 16 | + */ | |
| 17 | +@Data | |
| 18 | +public class CrmCustomerExcelVO { | |
| 19 | + | |
| 20 | + @ExcelProperty("编号") | |
| 21 | + private Long id; | |
| 22 | + | |
| 23 | + @ExcelProperty("客户名称") | |
| 24 | + private String name; | |
| 25 | + | |
| 26 | + @ExcelProperty(value = "跟进状态", converter = DictConvert.class) | |
| 27 | + @DictFormat(DictTypeConstants.BOOLEAN_STRING) | |
| 28 | + private Boolean followUpStatus; | |
| 29 | + | |
| 30 | + @ExcelProperty(value = "锁定状态", converter = DictConvert.class) | |
| 31 | + @DictFormat(DictTypeConstants.BOOLEAN_STRING) | |
| 32 | + private Boolean lockStatus; | |
| 33 | + | |
| 34 | + @ExcelProperty(value = "成交状态", converter = DictConvert.class) | |
| 35 | + @DictFormat(DictTypeConstants.BOOLEAN_STRING) | |
| 36 | + private Boolean dealStatus; | |
| 37 | + | |
| 38 | + @ExcelProperty("手机") | |
| 39 | + private String mobile; | |
| 40 | + | |
| 41 | + @ExcelProperty("电话") | |
| 42 | + private String telephone; | |
| 43 | + | |
| 44 | + @ExcelProperty("网址") | |
| 45 | + private String website; | |
| 46 | + | |
| 47 | + @ExcelProperty("备注") | |
| 48 | + private String remark; | |
| 49 | + | |
| 50 | + @ExcelProperty("负责人的用户编号") | |
| 51 | + private Long ownerUserId; | |
| 52 | + | |
| 53 | + @ExcelProperty("地区编号") | |
| 54 | + private Long areaId; | |
| 55 | + | |
| 56 | + @ExcelProperty("详细地址") | |
| 57 | + private String detailAddress; | |
| 58 | + | |
| 59 | + @ExcelProperty("地理位置经度") | |
| 60 | + private String longitude; | |
| 61 | + | |
| 62 | + @ExcelProperty("地理位置维度") | |
| 63 | + private String latitude; | |
| 64 | + | |
| 65 | + @ExcelProperty("最后跟进时间") | |
| 66 | + private LocalDateTime contactLastTime; | |
| 67 | + | |
| 68 | + @ExcelProperty("下次联系时间") | |
| 69 | + private LocalDateTime contactNextTime; | |
| 70 | + | |
| 71 | + @ExcelProperty("创建时间") | |
| 72 | + private LocalDateTime createTime; | |
| 73 | + | |
| 74 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +// TODO 芋艿:导出最后做,等基本确认的差不多之后; | |
| 7 | +@Schema(description = "管理后台 - 客户 Excel 导出 Request VO,参数和 CrmCustomerPageReqVO 是一致的") | |
| 8 | +@Data | |
| 9 | +public class CrmCustomerExportReqVO { | |
| 10 | + | |
| 11 | + @Schema(description = "客户名称", example = "赵六") | |
| 12 | + private String name; | |
| 13 | + | |
| 14 | + @Schema(description = "手机", example = "18000000000") | |
| 15 | + private String mobile; | |
| 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 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - 客户分页 Request VO") | |
| 10 | +@Data | |
| 11 | +@EqualsAndHashCode(callSuper = true) | |
| 12 | +@ToString(callSuper = true) | |
| 13 | +public class CrmCustomerPageReqVO extends PageParam { | |
| 14 | + | |
| 15 | + @Schema(description = "客户名称", example = "赵六") | |
| 16 | + private String name; | |
| 17 | + | |
| 18 | + @Schema(description = "手机", example = "18000000000") | |
| 19 | + private String mobile; | |
| 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 @芋艿:场景; | |
| 30 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 客户 Response VO") | |
| 11 | +@Data | |
| 12 | +@EqualsAndHashCode(callSuper = true) | |
| 13 | +@ToString(callSuper = true) | |
| 14 | +public class CrmCustomerRespVO extends CrmCustomerBaseVO { | |
| 15 | + | |
| 16 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 20 | + private Boolean dealStatus; | |
| 21 | + | |
| 22 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 23 | + private LocalDateTime createTime; | |
| 24 | + | |
| 25 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 客户更新 Request VO") | |
| 11 | +@Data | |
| 12 | +@EqualsAndHashCode(callSuper = true) | |
| 13 | +@ToString(callSuper = true) | |
| 14 | +public class CrmCustomerUpdateReqVO extends CrmCustomerBaseVO { | |
| 15 | + | |
| 16 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | |
| 17 | + @NotNull(message = "编号不能为空") | |
| 18 | + private Long id; | |
| 19 | + | |
| 20 | + // TODO @wanwan:下面两个字段,同 CrmCustomerCreateReqVO | |
| 21 | + @Schema(description = "只读权限的用户编号数组") | |
| 22 | + private String roUserIds; | |
| 23 | + | |
| 24 | + @Schema(description = "读写权限的用户编号数组") | |
| 25 | + private String rwUserIds; | |
| 26 | + | |
| 27 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.convert.businessstatus; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | + | |
| 7 | +import org.mapstruct.Mapper; | |
| 8 | +import org.mapstruct.factory.Mappers; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 商机状态 Convert | |
| 14 | + * | |
| 15 | + * @author ljlleo | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface CrmBusinessStatusConvert { | |
| 19 | + | |
| 20 | + CrmBusinessStatusConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusConvert.class); | |
| 21 | + | |
| 22 | + CrmBusinessStatusDO convert(CrmBusinessStatusCreateReqVO bean); | |
| 23 | + | |
| 24 | + CrmBusinessStatusDO convert(CrmBusinessStatusUpdateReqVO bean); | |
| 25 | + | |
| 26 | + CrmBusinessStatusRespVO convert(CrmBusinessStatusDO bean); | |
| 27 | + | |
| 28 | + List<CrmBusinessStatusRespVO> convertList(List<CrmBusinessStatusDO> list); | |
| 29 | + | |
| 30 | + PageResult<CrmBusinessStatusRespVO> convertPage(PageResult<CrmBusinessStatusDO> page); | |
| 31 | + | |
| 32 | + List<CrmBusinessStatusExcelVO> convertList02(List<CrmBusinessStatusDO> list); | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.convert.businessstatustype; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | + | |
| 7 | +import org.mapstruct.Mapper; | |
| 8 | +import org.mapstruct.factory.Mappers; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 商机状态类型 Convert | |
| 14 | + * | |
| 15 | + * @author ljlleo | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface CrmBusinessStatusTypeConvert { | |
| 19 | + | |
| 20 | + CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); | |
| 21 | + | |
| 22 | + CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeCreateReqVO bean); | |
| 23 | + | |
| 24 | + CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeUpdateReqVO bean); | |
| 25 | + | |
| 26 | + CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); | |
| 27 | + | |
| 28 | + List<CrmBusinessStatusTypeRespVO> convertList(List<CrmBusinessStatusTypeDO> list); | |
| 29 | + | |
| 30 | + PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page); | |
| 31 | + | |
| 32 | + List<CrmBusinessStatusTypeExcelVO> convertList02(List<CrmBusinessStatusTypeDO> list); | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.convert.customer; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | + | |
| 7 | +import org.mapstruct.Mapper; | |
| 8 | +import org.mapstruct.factory.Mappers; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 客户 Convert | |
| 14 | + * | |
| 15 | + * @author Wanwan | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface CrmCustomerConvert { | |
| 19 | + | |
| 20 | + CrmCustomerConvert INSTANCE = Mappers.getMapper(CrmCustomerConvert.class); | |
| 21 | + | |
| 22 | + CrmCustomerDO convert(CrmCustomerCreateReqVO bean); | |
| 23 | + | |
| 24 | + CrmCustomerDO convert(CrmCustomerUpdateReqVO bean); | |
| 25 | + | |
| 26 | + CrmCustomerRespVO convert(CrmCustomerDO bean); | |
| 27 | + | |
| 28 | + PageResult<CrmCustomerRespVO> convertPage(PageResult<CrmCustomerDO> page); | |
| 29 | + | |
| 30 | + List<CrmCustomerExcelVO> convertList02(List<CrmCustomerDO> list); | |
| 31 | + | |
| 32 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 4 | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 9 | import lombok.*; |
| 8 | 10 | |
| 9 | -import java.math.BigDecimal; | |
| 10 | 11 | import java.time.LocalDateTime; |
| 11 | 12 | |
| 12 | 13 | /** |
| ... | ... | @@ -36,13 +37,13 @@ public class CrmBusinessDO extends BaseDO { |
| 36 | 37 | /** |
| 37 | 38 | * 商机状态类型编号 |
| 38 | 39 | * |
| 39 | - * TODO @ljileo:这个字段,后续要写下关联的实体哈 | |
| 40 | + * 关联 {@link CrmBusinessStatusTypeDO#getId()} | |
| 40 | 41 | */ |
| 41 | 42 | private Long statusTypeId; |
| 42 | 43 | /** |
| 43 | 44 | * 商机状态编号 |
| 44 | 45 | * |
| 45 | - * TODO @ljileo:这个字段,后续要写下关联的实体哈 | |
| 46 | + * 关联 {@link CrmBusinessStatusDO#getId()} | |
| 46 | 47 | */ |
| 47 | 48 | private Long statusId; |
| 48 | 49 | /** |
| ... | ... | @@ -62,21 +63,18 @@ public class CrmBusinessDO extends BaseDO { |
| 62 | 63 | /** |
| 63 | 64 | * 商机金额 |
| 64 | 65 | * |
| 65 | - * TODO @lijie:Integer | |
| 66 | 66 | */ |
| 67 | - private BigDecimal price; | |
| 67 | + private Integer price; | |
| 68 | 68 | /** |
| 69 | 69 | * 整单折扣 |
| 70 | 70 | * |
| 71 | - * TODO @lijie:Integer | |
| 72 | 71 | */ |
| 73 | - private BigDecimal discountPercent; | |
| 72 | + private Integer discountPercent; | |
| 74 | 73 | /** |
| 75 | 74 | * 产品总金额 |
| 76 | 75 | * |
| 77 | - * TODO @lijie:Integer | |
| 78 | 76 | */ |
| 79 | - private BigDecimal productPrice; | |
| 77 | + private Integer productPrice; | |
| 80 | 78 | /** |
| 81 | 79 | * 备注 |
| 82 | 80 | */ | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatus/CrmBusinessStatusDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 6 | +import lombok.*; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 商机状态 DO | |
| 10 | + * | |
| 11 | + * @author ljlleo | |
| 12 | + */ | |
| 13 | +@TableName("crm_business_status") | |
| 14 | +@KeySequence("crm_business_status_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 15 | +@Data | |
| 16 | +@ToString(callSuper = true) | |
| 17 | +@Builder | |
| 18 | +@NoArgsConstructor | |
| 19 | +@AllArgsConstructor | |
| 20 | +public class CrmBusinessStatusDO { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 主键 | |
| 24 | + */ | |
| 25 | + @TableId | |
| 26 | + private Long id; | |
| 27 | + /** | |
| 28 | + * 状态类型编号 | |
| 29 | + * | |
| 30 | + * // TODO @ljlleo:要写下关联字段噢 | |
| 31 | + */ | |
| 32 | + private Long typeId; | |
| 33 | + /** | |
| 34 | + * 状态名 | |
| 35 | + */ | |
| 36 | + private String name; | |
| 37 | + /** | |
| 38 | + * 赢单率 | |
| 39 | + */ | |
| 40 | + private String percent; | |
| 41 | + /** | |
| 42 | + * 排序 | |
| 43 | + */ | |
| 44 | + private Integer sort; | |
| 45 | + | |
| 46 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatustype/CrmBusinessStatusTypeDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 6 | +import lombok.*; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 商机状态类型 DO | |
| 10 | + * | |
| 11 | + * @author ljlleo | |
| 12 | + */ | |
| 13 | +@TableName("crm_business_status_type") | |
| 14 | +@KeySequence("crm_business_status_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 15 | +@Data | |
| 16 | +@ToString(callSuper = true) | |
| 17 | +@Builder | |
| 18 | +@NoArgsConstructor | |
| 19 | +@AllArgsConstructor | |
| 20 | +public class CrmBusinessStatusTypeDO { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 主键 | |
| 24 | + */ | |
| 25 | + @TableId | |
| 26 | + private Long id; | |
| 27 | + /** | |
| 28 | + * 状态类型名 | |
| 29 | + */ | |
| 30 | + private String name; | |
| 31 | + // TODO @ljlleo:List 存储哈 | |
| 32 | + /** | |
| 33 | + * 使用的部门编号 | |
| 34 | + */ | |
| 35 | + private String deptIds; | |
| 36 | + /** | |
| 37 | + * 开启状态 | |
| 38 | + */ | |
| 39 | + // TODO @ljlleo:这个字段,使用 Integer,对应 CommonStatus | |
| 40 | + private Boolean status; | |
| 41 | + | |
| 42 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/clue/CrmClueDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.clue; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 4 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -44,7 +45,7 @@ public class CrmClueDO extends BaseDO { |
| 44 | 45 | /** |
| 45 | 46 | * 客户 id |
| 46 | 47 | * |
| 47 | - * // TODO @wanwan:要写下关联的实体,以及对应的属性哈 | |
| 48 | + * 关联 {@link CrmCustomerDO#getId()} | |
| 48 | 49 | */ |
| 49 | 50 | private Long customerId; |
| 50 | 51 | /** | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | + | |
| 11 | +// TODO 芋艿:调整下字段 | |
| 12 | +/** | |
| 13 | + * 客户 DO | |
| 14 | + * | |
| 15 | + * @author Wanwan | |
| 16 | + */ | |
| 17 | +@TableName("crm_customer") | |
| 18 | +@KeySequence("crm_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | +@Data | |
| 20 | +@EqualsAndHashCode(callSuper = true) | |
| 21 | +@ToString(callSuper = true) | |
| 22 | +@Builder | |
| 23 | +@NoArgsConstructor | |
| 24 | +@AllArgsConstructor | |
| 25 | +public class CrmCustomerDO extends BaseDO { | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 编号 | |
| 29 | + */ | |
| 30 | + @TableId | |
| 31 | + private Long id; | |
| 32 | + /** | |
| 33 | + * 客户名称 | |
| 34 | + */ | |
| 35 | + private String name; | |
| 36 | + /** | |
| 37 | + * 跟进状态 | |
| 38 | + */ | |
| 39 | + private Boolean followUpStatus; | |
| 40 | + /** | |
| 41 | + * 锁定状态 | |
| 42 | + */ | |
| 43 | + private Boolean lockStatus; | |
| 44 | + /** | |
| 45 | + * 成交状态 | |
| 46 | + */ | |
| 47 | + private Boolean dealStatus; | |
| 48 | + /** | |
| 49 | + * 手机 | |
| 50 | + */ | |
| 51 | + private String mobile; | |
| 52 | + /** | |
| 53 | + * 电话 | |
| 54 | + */ | |
| 55 | + private String telephone; | |
| 56 | + /** | |
| 57 | + * 网址 | |
| 58 | + */ | |
| 59 | + private String website; | |
| 60 | + /** | |
| 61 | + * 备注 | |
| 62 | + */ | |
| 63 | + private String remark; | |
| 64 | + /** | |
| 65 | + * 负责人的用户编号 | |
| 66 | + */ | |
| 67 | + private Long ownerUserId; | |
| 68 | + // TODO @wanwan:下面两个字段,使用 List<Long>,然后使用 typeHandler = LongListTypeHandler 解决持久化的问题;注意类上需要加 autoResultMap = true | |
| 69 | + /** | |
| 70 | + * 只读权限的用户编号数组 | |
| 71 | + */ | |
| 72 | + private String roUserIds; | |
| 73 | + /** | |
| 74 | + * 读写权限的用户编号数组 | |
| 75 | + */ | |
| 76 | + private String rwUserIds; | |
| 77 | + /** | |
| 78 | + * 地区编号 | |
| 79 | + */ | |
| 80 | + private Long areaId; | |
| 81 | + /** | |
| 82 | + * 详细地址 | |
| 83 | + */ | |
| 84 | + private String detailAddress; | |
| 85 | + // TODO @wanwan:下面两个字段:删除 | |
| 86 | + /** | |
| 87 | + * 地理位置经度 | |
| 88 | + */ | |
| 89 | + private String longitude; | |
| 90 | + /** | |
| 91 | + * 地理位置维度 | |
| 92 | + */ | |
| 93 | + private String latitude; | |
| 94 | + /** | |
| 95 | + * 最后跟进时间 | |
| 96 | + */ | |
| 97 | + private LocalDateTime contactLastTime; | |
| 98 | + /** | |
| 99 | + * 下次联系时间 | |
| 100 | + */ | |
| 101 | + private LocalDateTime contactNextTime; | |
| 102 | + | |
| 103 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java
| ... | ... | @@ -21,23 +21,6 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> { |
| 21 | 21 | default PageResult<CrmBusinessDO> selectPage(CrmBusinessPageReqVO reqVO) { |
| 22 | 22 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessDO>() |
| 23 | 23 | .likeIfPresent(CrmBusinessDO::getName, reqVO.getName()) |
| 24 | - .eqIfPresent(CrmBusinessDO::getStatusTypeId, reqVO.getStatusTypeId()) | |
| 25 | - .eqIfPresent(CrmBusinessDO::getStatusId, reqVO.getStatusId()) | |
| 26 | - .betweenIfPresent(CrmBusinessDO::getContactNextTime, reqVO.getContactNextTime()) | |
| 27 | - .eqIfPresent(CrmBusinessDO::getCustomerId, reqVO.getCustomerId()) | |
| 28 | - .betweenIfPresent(CrmBusinessDO::getDealTime, reqVO.getDealTime()) | |
| 29 | - .eqIfPresent(CrmBusinessDO::getPrice, reqVO.getPrice()) | |
| 30 | - .eqIfPresent(CrmBusinessDO::getDiscountPercent, reqVO.getDiscountPercent()) | |
| 31 | - .eqIfPresent(CrmBusinessDO::getProductPrice, reqVO.getProductPrice()) | |
| 32 | - .eqIfPresent(CrmBusinessDO::getRemark, reqVO.getRemark()) | |
| 33 | - .eqIfPresent(CrmBusinessDO::getOwnerUserId, reqVO.getOwnerUserId()) | |
| 34 | - .betweenIfPresent(CrmBusinessDO::getCreateTime, reqVO.getCreateTime()) | |
| 35 | - .eqIfPresent(CrmBusinessDO::getRoUserIds, reqVO.getRoUserIds()) | |
| 36 | - .eqIfPresent(CrmBusinessDO::getRwUserIds, reqVO.getRwUserIds()) | |
| 37 | - .eqIfPresent(CrmBusinessDO::getEndStatus, reqVO.getEndStatus()) | |
| 38 | - .eqIfPresent(CrmBusinessDO::getEndRemark, reqVO.getEndRemark()) | |
| 39 | - .betweenIfPresent(CrmBusinessDO::getContactLastTime, reqVO.getContactLastTime()) | |
| 40 | - .eqIfPresent(CrmBusinessDO::getFollowUpStatus, reqVO.getFollowUpStatus()) | |
| 41 | 24 | .orderByDesc(CrmBusinessDO::getId)); |
| 42 | 25 | } |
| 43 | 26 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatus/CrmBusinessStatusMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.businessstatus; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 商机状态 Mapper | |
| 15 | + * | |
| 16 | + * @author ljlleo | |
| 17 | + */ | |
| 18 | +@Mapper | |
| 19 | +public interface CrmBusinessStatusMapper extends BaseMapperX<CrmBusinessStatusDO> { | |
| 20 | + | |
| 21 | + default PageResult<CrmBusinessStatusDO> selectPage(CrmBusinessStatusPageReqVO reqVO) { | |
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusDO>() | |
| 23 | + .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) | |
| 24 | + .orderByDesc(CrmBusinessStatusDO::getId)); | |
| 25 | + } | |
| 26 | + | |
| 27 | + default List<CrmBusinessStatusDO> selectList(CrmBusinessStatusExportReqVO reqVO) { | |
| 28 | + return selectList(new LambdaQueryWrapperX<CrmBusinessStatusDO>() | |
| 29 | + .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) | |
| 30 | + .likeIfPresent(CrmBusinessStatusDO::getName, reqVO.getName()) | |
| 31 | + .eqIfPresent(CrmBusinessStatusDO::getPercent, reqVO.getPercent()) | |
| 32 | + .eqIfPresent(CrmBusinessStatusDO::getSort, reqVO.getSort()) | |
| 33 | + .orderByDesc(CrmBusinessStatusDO::getId)); | |
| 34 | + } | |
| 35 | + | |
| 36 | + default List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) { | |
| 37 | + return selectList(CrmBusinessStatusDO::getTypeId, typeId); | |
| 38 | + } | |
| 39 | + | |
| 40 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatustype/CrmBusinessStatusTypeMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 商机状态类型 Mapper | |
| 15 | + * | |
| 16 | + * @author ljlleo | |
| 17 | + */ | |
| 18 | +@Mapper | |
| 19 | +public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStatusTypeDO> { | |
| 20 | + | |
| 21 | + default PageResult<CrmBusinessStatusTypeDO> selectPage(CrmBusinessStatusTypePageReqVO reqVO) { | |
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>() | |
| 23 | + .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) | |
| 24 | +// .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) TODO 报错,临时注释掉 | |
| 25 | + .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) | |
| 26 | + .orderByDesc(CrmBusinessStatusTypeDO::getId)); | |
| 27 | + } | |
| 28 | + | |
| 29 | + default List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeExportReqVO reqVO) { | |
| 30 | + return selectList(new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>() | |
| 31 | + .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) | |
| 32 | + .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) | |
| 33 | + .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) | |
| 34 | + .orderByDesc(CrmBusinessStatusTypeDO::getId)); | |
| 35 | + } | |
| 36 | + | |
| 37 | + default List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) { | |
| 38 | + return selectList(CrmBusinessStatusTypeDO::getStatus, status.byteValue()); | |
| 39 | + } | |
| 40 | + | |
| 41 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 客户 Mapper | |
| 15 | + * | |
| 16 | + * @author Wanwan | |
| 17 | + */ | |
| 18 | +@Mapper | |
| 19 | +public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> { | |
| 20 | + | |
| 21 | + default PageResult<CrmCustomerDO> selectPage(CrmCustomerPageReqVO reqVO) { | |
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>() | |
| 23 | + .likeIfPresent(CrmCustomerDO::getName, reqVO.getName()) | |
| 24 | + .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile()) | |
| 25 | + .eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone()) | |
| 26 | + .likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite()) | |
| 27 | + .orderByDesc(CrmCustomerDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | + default List<CrmCustomerDO> selectList(CrmCustomerExportReqVO reqVO) { | |
| 31 | + return selectList(new LambdaQueryWrapperX<CrmCustomerDO>() | |
| 32 | + .likeIfPresent(CrmCustomerDO::getName, reqVO.getName()) | |
| 33 | + .eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile()) | |
| 34 | + .eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone()) | |
| 35 | + .likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite()) | |
| 36 | + .orderByDesc(CrmCustomerDO::getId)); | |
| 37 | + } | |
| 38 | + | |
| 39 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatus; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 9 | + | |
| 10 | +import javax.validation.Valid; | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 商机状态 Service 接口 | |
| 16 | + * | |
| 17 | + * @author ljlleo | |
| 18 | + */ | |
| 19 | +public interface CrmBusinessStatusService { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 创建商机状态 | |
| 23 | + * | |
| 24 | + * @param createReqVO 创建信息 | |
| 25 | + * @return 编号 | |
| 26 | + */ | |
| 27 | + Long createBusinessStatus(@Valid CrmBusinessStatusCreateReqVO createReqVO); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 更新商机状态 | |
| 31 | + * | |
| 32 | + * @param updateReqVO 更新信息 | |
| 33 | + */ | |
| 34 | + void updateBusinessStatus(@Valid CrmBusinessStatusUpdateReqVO updateReqVO); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 删除商机状态 | |
| 38 | + * | |
| 39 | + * @param id 编号 | |
| 40 | + */ | |
| 41 | + void deleteBusinessStatus(Long id); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 获得商机状态 | |
| 45 | + * | |
| 46 | + * @param id 编号 | |
| 47 | + * @return 商机状态 | |
| 48 | + */ | |
| 49 | + CrmBusinessStatusDO getBusinessStatus(Long id); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 获得商机状态列表 | |
| 53 | + * | |
| 54 | + * @param ids 编号 | |
| 55 | + * @return 商机状态列表 | |
| 56 | + */ | |
| 57 | + List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids); | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 获得商机状态分页 | |
| 61 | + * | |
| 62 | + * @param pageReqVO 分页查询 | |
| 63 | + * @return 商机状态分页 | |
| 64 | + */ | |
| 65 | + PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获得商机状态列表, 用于 Excel 导出 | |
| 69 | + * | |
| 70 | + * @param exportReqVO 查询条件 | |
| 71 | + * @return 商机状态列表 | |
| 72 | + */ | |
| 73 | + List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 根据类型 ID 获得商机状态列表 | |
| 77 | + * | |
| 78 | + * @param typeId 商机状态类型 ID | |
| 79 | + * @return 商机状态列表 | |
| 80 | + */ | |
| 81 | + List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId); | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 获得商机状态列表 | |
| 85 | + * | |
| 86 | + * @return 商机状态列表 | |
| 87 | + */ | |
| 88 | + List<CrmBusinessStatusDO> getBusinessStatusList(); | |
| 89 | + | |
| 90 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatus; | |
| 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.businessstatus.vo.CrmBusinessStatusCreateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | |
| 10 | +import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; | |
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 12 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatus.CrmBusinessStatusMapper; | |
| 13 | +import org.springframework.stereotype.Service; | |
| 14 | +import org.springframework.validation.annotation.Validated; | |
| 15 | + | |
| 16 | +import javax.annotation.Resource; | |
| 17 | +import java.util.Collection; | |
| 18 | +import java.util.List; | |
| 19 | + | |
| 20 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 21 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_NOT_EXISTS; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 商机状态 Service 实现类 | |
| 25 | + * | |
| 26 | + * @author ljlleo | |
| 27 | + */ | |
| 28 | +@Service | |
| 29 | +@Validated | |
| 30 | +public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private CrmBusinessStatusMapper businessStatusMapper; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Long createBusinessStatus(CrmBusinessStatusCreateReqVO createReqVO) { | |
| 37 | + // 插入 | |
| 38 | + CrmBusinessStatusDO businessStatus = CrmBusinessStatusConvert.INSTANCE.convert(createReqVO); | |
| 39 | + businessStatusMapper.insert(businessStatus); | |
| 40 | + // 返回 | |
| 41 | + return businessStatus.getId(); | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public void updateBusinessStatus(CrmBusinessStatusUpdateReqVO updateReqVO) { | |
| 46 | + // 校验存在 | |
| 47 | + validateBusinessStatusExists(updateReqVO.getId()); | |
| 48 | + // 更新 | |
| 49 | + CrmBusinessStatusDO updateObj = CrmBusinessStatusConvert.INSTANCE.convert(updateReqVO); | |
| 50 | + businessStatusMapper.updateById(updateObj); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @Override | |
| 54 | + public void deleteBusinessStatus(Long id) { | |
| 55 | + // 校验存在 | |
| 56 | + validateBusinessStatusExists(id); | |
| 57 | + // 删除 | |
| 58 | + businessStatusMapper.deleteById(id); | |
| 59 | + } | |
| 60 | + | |
| 61 | + private void validateBusinessStatusExists(Long id) { | |
| 62 | + if (businessStatusMapper.selectById(id) == null) { | |
| 63 | + throw exception(BUSINESS_STATUS_NOT_EXISTS); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + @Override | |
| 68 | + public CrmBusinessStatusDO getBusinessStatus(Long id) { | |
| 69 | + return businessStatusMapper.selectById(id); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public List<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids) { | |
| 74 | + if (CollUtil.isEmpty(ids)) { | |
| 75 | + return ListUtil.empty(); | |
| 76 | + } | |
| 77 | + return businessStatusMapper.selectBatchIds(ids); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Override | |
| 81 | + public PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO) { | |
| 82 | + return businessStatusMapper.selectPage(pageReqVO); | |
| 83 | + } | |
| 84 | + | |
| 85 | + @Override | |
| 86 | + public List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO) { | |
| 87 | + return businessStatusMapper.selectList(exportReqVO); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @Override | |
| 91 | + public List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) { | |
| 92 | + return businessStatusMapper.getBusinessStatusListByTypeId(typeId); | |
| 93 | + } | |
| 94 | + | |
| 95 | + @Override | |
| 96 | + public List<CrmBusinessStatusDO> getBusinessStatusList() { | |
| 97 | + return businessStatusMapper.selectList(); | |
| 98 | + } | |
| 99 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatustype; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 9 | + | |
| 10 | +import javax.validation.Valid; | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 商机状态类型 Service 接口 | |
| 16 | + * | |
| 17 | + * @author ljlleo | |
| 18 | + */ | |
| 19 | +public interface CrmBusinessStatusTypeService { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 创建商机状态类型 | |
| 23 | + * | |
| 24 | + * @param createReqVO 创建信息 | |
| 25 | + * @return 编号 | |
| 26 | + */ | |
| 27 | + Long createBusinessStatusType(@Valid CrmBusinessStatusTypeCreateReqVO createReqVO); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 更新商机状态类型 | |
| 31 | + * | |
| 32 | + * @param updateReqVO 更新信息 | |
| 33 | + */ | |
| 34 | + void updateBusinessStatusType(@Valid CrmBusinessStatusTypeUpdateReqVO updateReqVO); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 删除商机状态类型 | |
| 38 | + * | |
| 39 | + * @param id 编号 | |
| 40 | + */ | |
| 41 | + void deleteBusinessStatusType(Long id); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 获得商机状态类型 | |
| 45 | + * | |
| 46 | + * @param id 编号 | |
| 47 | + * @return 商机状态类型 | |
| 48 | + */ | |
| 49 | + CrmBusinessStatusTypeDO getBusinessStatusType(Long id); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 获得商机状态类型列表 | |
| 53 | + * | |
| 54 | + * @param ids 编号 | |
| 55 | + * @return 商机状态类型列表 | |
| 56 | + */ | |
| 57 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids); | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 获得商机状态类型分页 | |
| 61 | + * | |
| 62 | + * @param pageReqVO 分页查询 | |
| 63 | + * @return 商机状态类型分页 | |
| 64 | + */ | |
| 65 | + PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获得商机状态类型列表, 用于 Excel 导出 | |
| 69 | + * | |
| 70 | + * @param exportReqVO 查询条件 | |
| 71 | + * @return 商机状态类型列表 | |
| 72 | + */ | |
| 73 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 获得商机状态类型列表 | |
| 77 | + * | |
| 78 | + * @param status 状态 | |
| 79 | + * @return 商机状态类型列表 | |
| 80 | + */ | |
| 81 | + List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status); | |
| 82 | + | |
| 83 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatustype; | |
| 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.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | |
| 10 | +import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; | |
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 12 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper; | |
| 13 | +import org.springframework.stereotype.Service; | |
| 14 | +import org.springframework.validation.annotation.Validated; | |
| 15 | + | |
| 16 | +import javax.annotation.Resource; | |
| 17 | +import java.util.Collection; | |
| 18 | +import java.util.List; | |
| 19 | + | |
| 20 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 21 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 商机状态类型 Service 实现类 | |
| 25 | + * | |
| 26 | + * @author ljlleo | |
| 27 | + */ | |
| 28 | +@Service | |
| 29 | +@Validated | |
| 30 | +public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeService { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Long createBusinessStatusType(CrmBusinessStatusTypeCreateReqVO createReqVO) { | |
| 37 | + // TODO ljlleo:name 应该需要唯一哈; | |
| 38 | + // 插入 | |
| 39 | + CrmBusinessStatusTypeDO businessStatusType = CrmBusinessStatusTypeConvert.INSTANCE.convert(createReqVO); | |
| 40 | + businessStatusTypeMapper.insert(businessStatusType); | |
| 41 | + // 返回 | |
| 42 | + return businessStatusType.getId(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void updateBusinessStatusType(CrmBusinessStatusTypeUpdateReqVO updateReqVO) { | |
| 47 | + // TODO ljlleo:name 应该需要唯一哈; | |
| 48 | + // 校验存在 | |
| 49 | + validateBusinessStatusTypeExists(updateReqVO.getId()); | |
| 50 | + // 更新 | |
| 51 | + CrmBusinessStatusTypeDO updateObj = CrmBusinessStatusTypeConvert.INSTANCE.convert(updateReqVO); | |
| 52 | + businessStatusTypeMapper.updateById(updateObj); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Override | |
| 56 | + public void deleteBusinessStatusType(Long id) { | |
| 57 | + // 校验存在 | |
| 58 | + validateBusinessStatusTypeExists(id); | |
| 59 | + // TODO 艿艿:这里在看看,是不是要校验业务是否在使用; | |
| 60 | + // 删除 | |
| 61 | + businessStatusTypeMapper.deleteById(id); | |
| 62 | + } | |
| 63 | + | |
| 64 | + private void validateBusinessStatusTypeExists(Long id) { | |
| 65 | + if (businessStatusTypeMapper.selectById(id) == null) { | |
| 66 | + throw exception(BUSINESS_STATUS_TYPE_NOT_EXISTS); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public CrmBusinessStatusTypeDO getBusinessStatusType(Long id) { | |
| 72 | + return businessStatusTypeMapper.selectById(id); | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids) { | |
| 77 | + if (CollUtil.isEmpty(ids)) { | |
| 78 | + return ListUtil.empty(); | |
| 79 | + } | |
| 80 | + return businessStatusTypeMapper.selectBatchIds(ids); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @Override | |
| 84 | + public PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO) { | |
| 85 | + return businessStatusTypeMapper.selectPage(pageReqVO); | |
| 86 | + } | |
| 87 | + | |
| 88 | + @Override | |
| 89 | + public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO) { | |
| 90 | + return businessStatusTypeMapper.selectList(exportReqVO); | |
| 91 | + } | |
| 92 | + | |
| 93 | + @Override | |
| 94 | + public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) { | |
| 95 | + return businessStatusTypeMapper.getBusinessStatusTypeListByStatus(status); | |
| 96 | + } | |
| 97 | + | |
| 98 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
| ... | ... | @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueUpdateReqVO; |
| 10 | 10 | import cn.iocoder.yudao.module.crm.convert.clue.CrmClueConvert; |
| 11 | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; |
| 12 | 12 | import cn.iocoder.yudao.module.crm.dal.mysql.clue.CrmClueMapper; |
| 13 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | |
| 13 | 14 | import org.springframework.stereotype.Service; |
| 14 | 15 | import org.springframework.validation.annotation.Validated; |
| 15 | 16 | |
| ... | ... | @@ -19,6 +20,7 @@ import java.util.List; |
| 19 | 20 | |
| 20 | 21 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 21 | 22 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CLUE_NOT_EXISTS; |
| 23 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS; | |
| 22 | 24 | |
| 23 | 25 | /** |
| 24 | 26 | * 线索 Service 实现类 |
| ... | ... | @@ -31,10 +33,13 @@ public class CrmClueServiceImpl implements CrmClueService { |
| 31 | 33 | |
| 32 | 34 | @Resource |
| 33 | 35 | private CrmClueMapper clueMapper; |
| 36 | + @Resource | |
| 37 | + private CrmCustomerService customerService; | |
| 34 | 38 | |
| 35 | 39 | @Override |
| 36 | 40 | public Long createClue(CrmClueCreateReqVO createReqVO) { |
| 37 | - // TODO @wanwan:校验客户是否存在;以及类似的逻辑哈;如果目前还缺对应的模块的 service,可以先给自己写 todo; | |
| 41 | + // 校验客户是否存在 | |
| 42 | + validateCustomerExists(createReqVO.getCustomerId()); | |
| 38 | 43 | // 插入 |
| 39 | 44 | CrmClueDO clue = CrmClueConvert.INSTANCE.convert(createReqVO); |
| 40 | 45 | clueMapper.insert(clue); |
| ... | ... | @@ -44,9 +49,10 @@ public class CrmClueServiceImpl implements CrmClueService { |
| 44 | 49 | |
| 45 | 50 | @Override |
| 46 | 51 | public void updateClue(CrmClueUpdateReqVO updateReqVO) { |
| 47 | - // TODO @wanwan:校验客户是否存在;以及类似的逻辑哈;如果目前还缺对应的模块的 service,可以先给自己写 todo; | |
| 48 | 52 | // 校验存在 |
| 49 | 53 | validateClueExists(updateReqVO.getId()); |
| 54 | + // 校验客户是否存在 | |
| 55 | + validateCustomerExists(updateReqVO.getCustomerId()); | |
| 50 | 56 | |
| 51 | 57 | // 更新 |
| 52 | 58 | CrmClueDO updateObj = CrmClueConvert.INSTANCE.convert(updateReqVO); |
| ... | ... | @@ -90,4 +96,16 @@ public class CrmClueServiceImpl implements CrmClueService { |
| 90 | 96 | return clueMapper.selectList(exportReqVO); |
| 91 | 97 | } |
| 92 | 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 | + | |
| 93 | 111 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 9 | + | |
| 10 | +import javax.validation.Valid; | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 客户 Service 接口 | |
| 16 | + * | |
| 17 | + * @author Wanwan | |
| 18 | + */ | |
| 19 | +public interface CrmCustomerService { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 创建客户 | |
| 23 | + * | |
| 24 | + * @param createReqVO 创建信息 | |
| 25 | + * @return 编号 | |
| 26 | + */ | |
| 27 | + Long createCustomer(@Valid CrmCustomerCreateReqVO createReqVO); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 更新客户 | |
| 31 | + * | |
| 32 | + * @param updateReqVO 更新信息 | |
| 33 | + */ | |
| 34 | + void updateCustomer(@Valid CrmCustomerUpdateReqVO updateReqVO); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 删除客户 | |
| 38 | + * | |
| 39 | + * @param id 编号 | |
| 40 | + */ | |
| 41 | + void deleteCustomer(Long id); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 获得客户 | |
| 45 | + * | |
| 46 | + * @param id 编号 | |
| 47 | + * @return 客户 | |
| 48 | + */ | |
| 49 | + CrmCustomerDO getCustomer(Long id); | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 获得客户列表 | |
| 53 | + * | |
| 54 | + * @param ids 编号 | |
| 55 | + * @return 客户列表 | |
| 56 | + */ | |
| 57 | + List<CrmCustomerDO> getCustomerList(Collection<Long> ids); | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 获得客户分页 | |
| 61 | + * | |
| 62 | + * @param pageReqVO 分页查询 | |
| 63 | + * @return 客户分页 | |
| 64 | + */ | |
| 65 | + PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获得客户列表, 用于 Excel 导出 | |
| 69 | + * | |
| 70 | + * @param exportReqVO 查询条件 | |
| 71 | + * @return 客户列表 | |
| 72 | + */ | |
| 73 | + List<CrmCustomerDO> getCustomerList(CrmCustomerExportReqVO exportReqVO); | |
| 74 | + | |
| 75 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | + | |
| 3 | +import org.springframework.stereotype.Service; | |
| 4 | +import javax.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | + | |
| 7 | +import java.util.*; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 10 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 11 | + | |
| 12 | +import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | |
| 13 | +import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 16 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | |
| 17 | + | |
| 18 | +import cn.hutool.core.collection.CollUtil; | |
| 19 | +import cn.hutool.core.collection.ListUtil; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * 客户 Service 实现类 | |
| 23 | + * | |
| 24 | + * @author Wanwan | |
| 25 | + */ | |
| 26 | +@Service | |
| 27 | +@Validated | |
| 28 | +public class CrmCustomerServiceImpl implements CrmCustomerService { | |
| 29 | + | |
| 30 | + @Resource | |
| 31 | + private CrmCustomerMapper customerMapper; | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public Long createCustomer(CrmCustomerCreateReqVO createReqVO) { | |
| 35 | + // 插入 | |
| 36 | + CrmCustomerDO customer = CrmCustomerConvert.INSTANCE.convert(createReqVO); | |
| 37 | + customerMapper.insert(customer); | |
| 38 | + // 返回 | |
| 39 | + return customer.getId(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) { | |
| 44 | + // 校验存在 | |
| 45 | + validateCustomerExists(updateReqVO.getId()); | |
| 46 | + // 更新 | |
| 47 | + CrmCustomerDO updateObj = CrmCustomerConvert.INSTANCE.convert(updateReqVO); | |
| 48 | + customerMapper.updateById(updateObj); | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void deleteCustomer(Long id) { | |
| 53 | + // 校验存在 | |
| 54 | + validateCustomerExists(id); | |
| 55 | + // 删除 | |
| 56 | + customerMapper.deleteById(id); | |
| 57 | + } | |
| 58 | + | |
| 59 | + private void validateCustomerExists(Long id) { | |
| 60 | + if (customerMapper.selectById(id) == null) { | |
| 61 | + throw exception(CUSTOMER_NOT_EXISTS); | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + @Override | |
| 66 | + public CrmCustomerDO getCustomer(Long id) { | |
| 67 | + return customerMapper.selectById(id); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public List<CrmCustomerDO> getCustomerList(Collection<Long> ids) { | |
| 72 | + if (CollUtil.isEmpty(ids)) { | |
| 73 | + return ListUtil.empty(); | |
| 74 | + } | |
| 75 | + return customerMapper.selectBatchIds(ids); | |
| 76 | + } | |
| 77 | + | |
| 78 | + @Override | |
| 79 | + public PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO) { | |
| 80 | + return customerMapper.selectPage(pageReqVO); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @Override | |
| 84 | + public List<CrmCustomerDO> getCustomerList(CrmCustomerExportReqVO exportReqVO) { | |
| 85 | + return customerMapper.selectList(exportReqVO); | |
| 86 | + } | |
| 87 | + | |
| 88 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/businessstatustype/CrmBusinessStatusTypeMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper"> | |
| 4 | + | |
| 5 | + <!-- | |
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | + --> | |
| 11 | + | |
| 12 | +</mapper> | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/customer/CrmCustomerMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper"> | |
| 4 | + | |
| 5 | + <!-- | |
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | + --> | |
| 11 | + | |
| 12 | +</mapper> | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImplTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatus; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatus.CrmBusinessStatusMapper; | |
| 11 | +import org.junit.jupiter.api.Disabled; | |
| 12 | +import org.junit.jupiter.api.Test; | |
| 13 | +import org.springframework.context.annotation.Import; | |
| 14 | + | |
| 15 | +import javax.annotation.Resource; | |
| 16 | +import java.util.List; | |
| 17 | + | |
| 18 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 19 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 20 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 21 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | |
| 22 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | |
| 23 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_NOT_EXISTS; | |
| 24 | +import static org.junit.jupiter.api.Assertions.*; | |
| 25 | + | |
| 26 | +/** | |
| 27 | + * {@link CrmBusinessStatusServiceImpl} 的单元测试类 | |
| 28 | + * | |
| 29 | + * @author ljlleo | |
| 30 | + */ | |
| 31 | +@Import(CrmBusinessStatusServiceImpl.class) | |
| 32 | +public class CrmBusinessStatusServiceImplTest extends BaseDbUnitTest { | |
| 33 | + | |
| 34 | + @Resource | |
| 35 | + private CrmBusinessStatusServiceImpl businessStatusService; | |
| 36 | + | |
| 37 | + @Resource | |
| 38 | + private CrmBusinessStatusMapper businessStatusMapper; | |
| 39 | + | |
| 40 | + @Test | |
| 41 | + public void testCreateBusinessStatus_success() { | |
| 42 | + // 准备参数 | |
| 43 | + CrmBusinessStatusCreateReqVO reqVO = randomPojo(CrmBusinessStatusCreateReqVO.class); | |
| 44 | + | |
| 45 | + // 调用 | |
| 46 | + Long businessStatusId = businessStatusService.createBusinessStatus(reqVO); | |
| 47 | + // 断言 | |
| 48 | + assertNotNull(businessStatusId); | |
| 49 | + // 校验记录的属性是否正确 | |
| 50 | + CrmBusinessStatusDO businessStatus = businessStatusMapper.selectById(businessStatusId); | |
| 51 | + assertPojoEquals(reqVO, businessStatus); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Test | |
| 55 | + public void testUpdateBusinessStatus_success() { | |
| 56 | + // mock 数据 | |
| 57 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class); | |
| 58 | + businessStatusMapper.insert(dbBusinessStatus);// @Sql: 先插入出一条存在的数据 | |
| 59 | + // 准备参数 | |
| 60 | + CrmBusinessStatusUpdateReqVO reqVO = randomPojo(CrmBusinessStatusUpdateReqVO.class, o -> { | |
| 61 | + o.setId(dbBusinessStatus.getId()); // 设置更新的 ID | |
| 62 | + }); | |
| 63 | + | |
| 64 | + // 调用 | |
| 65 | + businessStatusService.updateBusinessStatus(reqVO); | |
| 66 | + // 校验是否更新正确 | |
| 67 | + CrmBusinessStatusDO businessStatus = businessStatusMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 68 | + assertPojoEquals(reqVO, businessStatus); | |
| 69 | + } | |
| 70 | + | |
| 71 | + @Test | |
| 72 | + public void testUpdateBusinessStatus_notExists() { | |
| 73 | + // 准备参数 | |
| 74 | + CrmBusinessStatusUpdateReqVO reqVO = randomPojo(CrmBusinessStatusUpdateReqVO.class); | |
| 75 | + | |
| 76 | + // 调用, 并断言异常 | |
| 77 | + assertServiceException(() -> businessStatusService.updateBusinessStatus(reqVO), BUSINESS_STATUS_NOT_EXISTS); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Test | |
| 81 | + public void testDeleteBusinessStatus_success() { | |
| 82 | + // mock 数据 | |
| 83 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class); | |
| 84 | + businessStatusMapper.insert(dbBusinessStatus);// @Sql: 先插入出一条存在的数据 | |
| 85 | + // 准备参数 | |
| 86 | + Long id = dbBusinessStatus.getId(); | |
| 87 | + | |
| 88 | + // 调用 | |
| 89 | + businessStatusService.deleteBusinessStatus(id); | |
| 90 | + // 校验数据不存在了 | |
| 91 | + assertNull(businessStatusMapper.selectById(id)); | |
| 92 | + } | |
| 93 | + | |
| 94 | + @Test | |
| 95 | + public void testDeleteBusinessStatus_notExists() { | |
| 96 | + // 准备参数 | |
| 97 | + Long id = randomLongId(); | |
| 98 | + | |
| 99 | + // 调用, 并断言异常 | |
| 100 | + assertServiceException(() -> businessStatusService.deleteBusinessStatus(id), BUSINESS_STATUS_NOT_EXISTS); | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Test | |
| 104 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 105 | + public void testGetBusinessStatusPage() { | |
| 106 | + // mock 数据 | |
| 107 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class, o -> { // 等会查询到 | |
| 108 | + o.setTypeId(null); | |
| 109 | + o.setName(null); | |
| 110 | + o.setPercent(null); | |
| 111 | + o.setSort(null); | |
| 112 | + }); | |
| 113 | + businessStatusMapper.insert(dbBusinessStatus); | |
| 114 | + // 测试 typeId 不匹配 | |
| 115 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setTypeId(null))); | |
| 116 | + // 测试 name 不匹配 | |
| 117 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setName(null))); | |
| 118 | + // 测试 percent 不匹配 | |
| 119 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setPercent(null))); | |
| 120 | + // 测试 sort 不匹配 | |
| 121 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setSort(null))); | |
| 122 | + // 准备参数 | |
| 123 | + CrmBusinessStatusPageReqVO reqVO = new CrmBusinessStatusPageReqVO(); | |
| 124 | + reqVO.setTypeId(null); | |
| 125 | + reqVO.setName(null); | |
| 126 | + reqVO.setPercent(null); | |
| 127 | + reqVO.setSort(null); | |
| 128 | + | |
| 129 | + // 调用 | |
| 130 | + PageResult<CrmBusinessStatusDO> pageResult = businessStatusService.getBusinessStatusPage(reqVO); | |
| 131 | + // 断言 | |
| 132 | + assertEquals(1, pageResult.getTotal()); | |
| 133 | + assertEquals(1, pageResult.getList().size()); | |
| 134 | + assertPojoEquals(dbBusinessStatus, pageResult.getList().get(0)); | |
| 135 | + } | |
| 136 | + | |
| 137 | + @Test | |
| 138 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 139 | + public void testGetBusinessStatusList() { | |
| 140 | + // mock 数据 | |
| 141 | + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class, o -> { // 等会查询到 | |
| 142 | + o.setTypeId(null); | |
| 143 | + o.setName(null); | |
| 144 | + o.setPercent(null); | |
| 145 | + o.setSort(null); | |
| 146 | + }); | |
| 147 | + businessStatusMapper.insert(dbBusinessStatus); | |
| 148 | + // 测试 typeId 不匹配 | |
| 149 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setTypeId(null))); | |
| 150 | + // 测试 name 不匹配 | |
| 151 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setName(null))); | |
| 152 | + // 测试 percent 不匹配 | |
| 153 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setPercent(null))); | |
| 154 | + // 测试 sort 不匹配 | |
| 155 | + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setSort(null))); | |
| 156 | + // 准备参数 | |
| 157 | + CrmBusinessStatusExportReqVO reqVO = new CrmBusinessStatusExportReqVO(); | |
| 158 | + reqVO.setTypeId(null); | |
| 159 | + reqVO.setName(null); | |
| 160 | + reqVO.setPercent(null); | |
| 161 | + reqVO.setSort(null); | |
| 162 | + | |
| 163 | + // 调用 | |
| 164 | + List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(reqVO); | |
| 165 | + // 断言 | |
| 166 | + assertEquals(1, list.size()); | |
| 167 | + assertPojoEquals(dbBusinessStatus, list.get(0)); | |
| 168 | + } | |
| 169 | + | |
| 170 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImplTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.businessstatustype; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper; | |
| 11 | +import org.junit.jupiter.api.Disabled; | |
| 12 | +import org.junit.jupiter.api.Test; | |
| 13 | +import org.springframework.context.annotation.Import; | |
| 14 | + | |
| 15 | +import javax.annotation.Resource; | |
| 16 | +import java.util.List; | |
| 17 | + | |
| 18 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | |
| 19 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 20 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 21 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 22 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | |
| 23 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | |
| 24 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; | |
| 25 | +import static org.junit.jupiter.api.Assertions.*; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * {@link CrmBusinessStatusTypeServiceImpl} 的单元测试类 | |
| 29 | + * | |
| 30 | + * @author ljlleo | |
| 31 | + */ | |
| 32 | +@Import(CrmBusinessStatusTypeServiceImpl.class) | |
| 33 | +public class CrmBusinessStatusTypeServiceImplTest extends BaseDbUnitTest { | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private CrmBusinessStatusTypeServiceImpl businessStatusTypeService; | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; | |
| 40 | + | |
| 41 | + @Test | |
| 42 | + public void testCreateBusinessStatusType_success() { | |
| 43 | + // 准备参数 | |
| 44 | + CrmBusinessStatusTypeCreateReqVO reqVO = randomPojo(CrmBusinessStatusTypeCreateReqVO.class); | |
| 45 | + | |
| 46 | + // 调用 | |
| 47 | + Long businessStatusTypeId = businessStatusTypeService.createBusinessStatusType(reqVO); | |
| 48 | + // 断言 | |
| 49 | + assertNotNull(businessStatusTypeId); | |
| 50 | + // 校验记录的属性是否正确 | |
| 51 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(businessStatusTypeId); | |
| 52 | + assertPojoEquals(reqVO, businessStatusType); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Test | |
| 56 | + public void testUpdateBusinessStatusType_success() { | |
| 57 | + // mock 数据 | |
| 58 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | |
| 59 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | |
| 60 | + // 准备参数 | |
| 61 | + CrmBusinessStatusTypeUpdateReqVO reqVO = randomPojo(CrmBusinessStatusTypeUpdateReqVO.class, o -> { | |
| 62 | + o.setId(dbBusinessStatusType.getId()); // 设置更新的 ID | |
| 63 | + }); | |
| 64 | + | |
| 65 | + // 调用 | |
| 66 | + businessStatusTypeService.updateBusinessStatusType(reqVO); | |
| 67 | + // 校验是否更新正确 | |
| 68 | + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 69 | + assertPojoEquals(reqVO, businessStatusType); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Test | |
| 73 | + public void testUpdateBusinessStatusType_notExists() { | |
| 74 | + // 准备参数 | |
| 75 | + CrmBusinessStatusTypeUpdateReqVO reqVO = randomPojo(CrmBusinessStatusTypeUpdateReqVO.class); | |
| 76 | + | |
| 77 | + // 调用, 并断言异常 | |
| 78 | + assertServiceException(() -> businessStatusTypeService.updateBusinessStatusType(reqVO), BUSINESS_STATUS_TYPE_NOT_EXISTS); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Test | |
| 82 | + public void testDeleteBusinessStatusType_success() { | |
| 83 | + // mock 数据 | |
| 84 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); | |
| 85 | + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 | |
| 86 | + // 准备参数 | |
| 87 | + Long id = dbBusinessStatusType.getId(); | |
| 88 | + | |
| 89 | + // 调用 | |
| 90 | + businessStatusTypeService.deleteBusinessStatusType(id); | |
| 91 | + // 校验数据不存在了 | |
| 92 | + assertNull(businessStatusTypeMapper.selectById(id)); | |
| 93 | + } | |
| 94 | + | |
| 95 | + @Test | |
| 96 | + public void testDeleteBusinessStatusType_notExists() { | |
| 97 | + // 准备参数 | |
| 98 | + Long id = randomLongId(); | |
| 99 | + | |
| 100 | + // 调用, 并断言异常 | |
| 101 | + assertServiceException(() -> businessStatusTypeService.deleteBusinessStatusType(id), BUSINESS_STATUS_TYPE_NOT_EXISTS); | |
| 102 | + } | |
| 103 | + | |
| 104 | + @Test | |
| 105 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 106 | + public void testGetBusinessStatusTypePage() { | |
| 107 | + // mock 数据 | |
| 108 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 | |
| 109 | + o.setName(null); | |
| 110 | + o.setDeptIds(null); | |
| 111 | + o.setStatus(null); | |
| 112 | + o.setCreateTime(null); | |
| 113 | + }); | |
| 114 | + businessStatusTypeMapper.insert(dbBusinessStatusType); | |
| 115 | + // 测试 name 不匹配 | |
| 116 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setName(null))); | |
| 117 | + // 测试 deptIds 不匹配 | |
| 118 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setDeptIds(null))); | |
| 119 | + // 测试 status 不匹配 | |
| 120 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setStatus(null))); | |
| 121 | + // 测试 createTime 不匹配 | |
| 122 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setCreateTime(null))); | |
| 123 | + // 准备参数 | |
| 124 | + CrmBusinessStatusTypePageReqVO reqVO = new CrmBusinessStatusTypePageReqVO(); | |
| 125 | + reqVO.setName(null); | |
| 126 | + reqVO.setDeptIds(null); | |
| 127 | + reqVO.setStatus(null); | |
| 128 | + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | |
| 129 | + | |
| 130 | + // 调用 | |
| 131 | + PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(reqVO); | |
| 132 | + // 断言 | |
| 133 | + assertEquals(1, pageResult.getTotal()); | |
| 134 | + assertEquals(1, pageResult.getList().size()); | |
| 135 | + assertPojoEquals(dbBusinessStatusType, pageResult.getList().get(0)); | |
| 136 | + } | |
| 137 | + | |
| 138 | + @Test | |
| 139 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 140 | + public void testGetBusinessStatusTypeList() { | |
| 141 | + // mock 数据 | |
| 142 | + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 | |
| 143 | + o.setName(null); | |
| 144 | + o.setDeptIds(null); | |
| 145 | + o.setStatus(null); | |
| 146 | + o.setCreateTime(null); | |
| 147 | + }); | |
| 148 | + businessStatusTypeMapper.insert(dbBusinessStatusType); | |
| 149 | + // 测试 name 不匹配 | |
| 150 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setName(null))); | |
| 151 | + // 测试 deptIds 不匹配 | |
| 152 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setDeptIds(null))); | |
| 153 | + // 测试 status 不匹配 | |
| 154 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setStatus(null))); | |
| 155 | + // 测试 createTime 不匹配 | |
| 156 | + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setCreateTime(null))); | |
| 157 | + // 准备参数 | |
| 158 | + CrmBusinessStatusTypeExportReqVO reqVO = new CrmBusinessStatusTypeExportReqVO(); | |
| 159 | + reqVO.setName(null); | |
| 160 | + reqVO.setDeptIds(null); | |
| 161 | + reqVO.setStatus(null); | |
| 162 | + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | |
| 163 | + | |
| 164 | + // 调用 | |
| 165 | + List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(reqVO); | |
| 166 | + // 断言 | |
| 167 | + assertEquals(1, list.size()); | |
| 168 | + assertPojoEquals(dbBusinessStatusType, list.get(0)); | |
| 169 | + } | |
| 170 | + | |
| 171 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImplTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerCreateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO; | |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerUpdateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | |
| 10 | +import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; | |
| 11 | +import org.junit.jupiter.api.Disabled; | |
| 12 | +import org.junit.jupiter.api.Test; | |
| 13 | +import org.springframework.context.annotation.Import; | |
| 14 | + | |
| 15 | +import javax.annotation.Resource; | |
| 16 | +import java.util.List; | |
| 17 | + | |
| 18 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 19 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 20 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 21 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | |
| 22 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | |
| 23 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS; | |
| 24 | +import static org.junit.jupiter.api.Assertions.*; | |
| 25 | + | |
| 26 | +// TODO 芋艿:单测后续补 | |
| 27 | +/** | |
| 28 | + * {@link CrmCustomerServiceImpl} 的单元测试类 | |
| 29 | + * | |
| 30 | + * @author Wanwan | |
| 31 | + */ | |
| 32 | +@Import(CrmCustomerServiceImpl.class) | |
| 33 | +public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private CrmCustomerServiceImpl customerService; | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private CrmCustomerMapper customerMapper; | |
| 40 | + | |
| 41 | + @Test | |
| 42 | + public void testCreateCustomer_success() { | |
| 43 | + // 准备参数 | |
| 44 | + CrmCustomerCreateReqVO reqVO = randomPojo(CrmCustomerCreateReqVO.class); | |
| 45 | + | |
| 46 | + // 调用 | |
| 47 | + Long customerId = customerService.createCustomer(reqVO); | |
| 48 | + // 断言 | |
| 49 | + assertNotNull(customerId); | |
| 50 | + // 校验记录的属性是否正确 | |
| 51 | + CrmCustomerDO customer = customerMapper.selectById(customerId); | |
| 52 | + assertPojoEquals(reqVO, customer); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Test | |
| 56 | + public void testUpdateCustomer_success() { | |
| 57 | + // mock 数据 | |
| 58 | + CrmCustomerDO dbCustomer = randomPojo(CrmCustomerDO.class); | |
| 59 | + customerMapper.insert(dbCustomer);// @Sql: 先插入出一条存在的数据 | |
| 60 | + // 准备参数 | |
| 61 | + CrmCustomerUpdateReqVO reqVO = randomPojo(CrmCustomerUpdateReqVO.class, o -> { | |
| 62 | + o.setId(dbCustomer.getId()); // 设置更新的 ID | |
| 63 | + }); | |
| 64 | + | |
| 65 | + // 调用 | |
| 66 | + customerService.updateCustomer(reqVO); | |
| 67 | + // 校验是否更新正确 | |
| 68 | + CrmCustomerDO customer = customerMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 69 | + assertPojoEquals(reqVO, customer); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Test | |
| 73 | + public void testUpdateCustomer_notExists() { | |
| 74 | + // 准备参数 | |
| 75 | + CrmCustomerUpdateReqVO reqVO = randomPojo(CrmCustomerUpdateReqVO.class); | |
| 76 | + | |
| 77 | + // 调用, 并断言异常 | |
| 78 | + assertServiceException(() -> customerService.updateCustomer(reqVO), CUSTOMER_NOT_EXISTS); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Test | |
| 82 | + public void testDeleteCustomer_success() { | |
| 83 | + // mock 数据 | |
| 84 | + CrmCustomerDO dbCustomer = randomPojo(CrmCustomerDO.class); | |
| 85 | + customerMapper.insert(dbCustomer);// @Sql: 先插入出一条存在的数据 | |
| 86 | + // 准备参数 | |
| 87 | + Long id = dbCustomer.getId(); | |
| 88 | + | |
| 89 | + // 调用 | |
| 90 | + customerService.deleteCustomer(id); | |
| 91 | + // 校验数据不存在了 | |
| 92 | + assertNull(customerMapper.selectById(id)); | |
| 93 | + } | |
| 94 | + | |
| 95 | + @Test | |
| 96 | + public void testDeleteCustomer_notExists() { | |
| 97 | + // 准备参数 | |
| 98 | + Long id = randomLongId(); | |
| 99 | + | |
| 100 | + // 调用, 并断言异常 | |
| 101 | + assertServiceException(() -> customerService.deleteCustomer(id), CUSTOMER_NOT_EXISTS); | |
| 102 | + } | |
| 103 | + | |
| 104 | + @Test | |
| 105 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 106 | + public void testGetCustomerPage() { | |
| 107 | + // mock 数据 | |
| 108 | + CrmCustomerDO dbCustomer = randomPojo(CrmCustomerDO.class, o -> { // 等会查询到 | |
| 109 | + o.setName(null); | |
| 110 | + o.setMobile(null); | |
| 111 | + o.setTelephone(null); | |
| 112 | + o.setWebsite(null); | |
| 113 | + }); | |
| 114 | + customerMapper.insert(dbCustomer); | |
| 115 | + // 测试 name 不匹配 | |
| 116 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setName(null))); | |
| 117 | + // 测试 mobile 不匹配 | |
| 118 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setMobile(null))); | |
| 119 | + // 测试 telephone 不匹配 | |
| 120 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setTelephone(null))); | |
| 121 | + // 测试 website 不匹配 | |
| 122 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setWebsite(null))); | |
| 123 | + // 准备参数 | |
| 124 | + CrmCustomerPageReqVO reqVO = new CrmCustomerPageReqVO(); | |
| 125 | + reqVO.setName(null); | |
| 126 | + reqVO.setMobile(null); | |
| 127 | + reqVO.setTelephone(null); | |
| 128 | + reqVO.setWebsite(null); | |
| 129 | + | |
| 130 | + // 调用 | |
| 131 | + PageResult<CrmCustomerDO> pageResult = customerService.getCustomerPage(reqVO); | |
| 132 | + // 断言 | |
| 133 | + assertEquals(1, pageResult.getTotal()); | |
| 134 | + assertEquals(1, pageResult.getList().size()); | |
| 135 | + assertPojoEquals(dbCustomer, pageResult.getList().get(0)); | |
| 136 | + } | |
| 137 | + | |
| 138 | + @Test | |
| 139 | + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 140 | + public void testGetCustomerList() { | |
| 141 | + // mock 数据 | |
| 142 | + CrmCustomerDO dbCustomer = randomPojo(CrmCustomerDO.class, o -> { // 等会查询到 | |
| 143 | + o.setName(null); | |
| 144 | + o.setMobile(null); | |
| 145 | + o.setTelephone(null); | |
| 146 | + o.setWebsite(null); | |
| 147 | + }); | |
| 148 | + customerMapper.insert(dbCustomer); | |
| 149 | + // 测试 name 不匹配 | |
| 150 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setName(null))); | |
| 151 | + // 测试 mobile 不匹配 | |
| 152 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setMobile(null))); | |
| 153 | + // 测试 telephone 不匹配 | |
| 154 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setTelephone(null))); | |
| 155 | + // 测试 website 不匹配 | |
| 156 | + customerMapper.insert(cloneIgnoreId(dbCustomer, o -> o.setWebsite(null))); | |
| 157 | + // 准备参数 | |
| 158 | + CrmCustomerExportReqVO reqVO = new CrmCustomerExportReqVO(); | |
| 159 | + reqVO.setName(null); | |
| 160 | + reqVO.setMobile(null); | |
| 161 | + reqVO.setTelephone(null); | |
| 162 | + reqVO.setWebsite(null); | |
| 163 | + | |
| 164 | + // 调用 | |
| 165 | + List<CrmCustomerDO> list = customerService.getCustomerList(reqVO); | |
| 166 | + // 断言 | |
| 167 | + assertEquals(1, list.size()); | |
| 168 | + assertPojoEquals(dbCustomer, list.get(0)); | |
| 169 | + } | |
| 170 | + | |
| 171 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/clean.sql
yudao-module-crm/yudao-module-crm-biz/src/test/resources/sql/create_tables.sql
| ... | ... | @@ -98,3 +98,30 @@ CREATE TABLE IF NOT EXISTS "crm_receivable_plan" ( |
| 98 | 98 | PRIMARY KEY ("id") |
| 99 | 99 | ) COMMENT '回款计划'; |
| 100 | 100 | |
| 101 | +CREATE TABLE IF NOT EXISTS "crm_customer" ( | |
| 102 | + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | |
| 103 | + "name" varchar, | |
| 104 | + "follow_up_status" bit NOT NULL, | |
| 105 | + "lock_status" bit NOT NULL, | |
| 106 | + "deal_status" bit NOT NULL, | |
| 107 | + "mobile" varchar, | |
| 108 | + "telephone" varchar, | |
| 109 | + "website" varchar, | |
| 110 | + "remark" varchar, | |
| 111 | + "owner_user_id" bigint, | |
| 112 | + "ro_user_ids" varchar, | |
| 113 | + "rw_user_ids" varchar, | |
| 114 | + "area_id" bigint, | |
| 115 | + "detail_address" varchar, | |
| 116 | + "longitude" varchar, | |
| 117 | + "latitude" varchar, | |
| 118 | + "contact_last_time" varchar, | |
| 119 | + "contact_next_time" varchar, | |
| 120 | + "creator" varchar DEFAULT '', | |
| 121 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| 122 | + "updater" varchar DEFAULT '', | |
| 123 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| 124 | + "deleted" bit NOT NULL DEFAULT FALSE, | |
| 125 | + "tenant_id" bigint NOT NULL, | |
| 126 | + PRIMARY KEY ("id") | |
| 127 | +) COMMENT '客户表'; | |
| 101 | 128 | \ No newline at end of file | ... | ... |
yudao-ui-admin/src/api/crm/business.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建商机 | |
| 4 | +export function createBusiness(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/crm/business/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新商机 | |
| 13 | +export function updateBusiness(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/crm/business/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +// 删除商机 | |
| 22 | +export function deleteBusiness(id) { | |
| 23 | + return request({ | |
| 24 | + url: '/crm/business/delete?id=' + id, | |
| 25 | + method: 'delete' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 获得商机 | |
| 30 | +export function getBusiness(id) { | |
| 31 | + return request({ | |
| 32 | + url: '/crm/business/get?id=' + id, | |
| 33 | + method: 'get' | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获得商机分页 | |
| 38 | +export function getBusinessPage(query) { | |
| 39 | + return request({ | |
| 40 | + url: '/crm/business/page', | |
| 41 | + method: 'get', | |
| 42 | + params: query | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 导出商机 Excel | |
| 47 | +export function exportBusinessExcel(query) { | |
| 48 | + return request({ | |
| 49 | + url: '/crm/business/export-excel', | |
| 50 | + method: 'get', | |
| 51 | + params: query, | |
| 52 | + responseType: 'blob' | |
| 53 | + }) | |
| 54 | +} | ... | ... |
yudao-ui-admin/src/api/crm/businessStatus.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建商机状态 | |
| 4 | +export function createBusinessStatus(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/crm/business-status/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新商机状态 | |
| 13 | +export function updateBusinessStatus(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/crm/business-status/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +// 删除商机状态 | |
| 22 | +export function deleteBusinessStatus(id) { | |
| 23 | + return request({ | |
| 24 | + url: '/crm/business-status/delete?id=' + id, | |
| 25 | + method: 'delete' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 获得商机状态 | |
| 30 | +export function getBusinessStatus(id) { | |
| 31 | + return request({ | |
| 32 | + url: '/crm/business-status/get?id=' + id, | |
| 33 | + method: 'get' | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获得商机状态分页 | |
| 38 | +export function getBusinessStatusPage(query) { | |
| 39 | + return request({ | |
| 40 | + url: '/crm/business-status/page', | |
| 41 | + method: 'get', | |
| 42 | + params: query | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 导出商机状态 Excel | |
| 47 | +export function exportBusinessStatusExcel(query) { | |
| 48 | + return request({ | |
| 49 | + url: '/crm/business-status/export-excel', | |
| 50 | + method: 'get', | |
| 51 | + params: query, | |
| 52 | + responseType: 'blob' | |
| 53 | + }) | |
| 54 | +} | |
| 55 | + | |
| 56 | +// 根据类型ID获取商机状态信息列表 | |
| 57 | +export function getBusinessStatusListByTypeId(typeId) { | |
| 58 | + return request({ | |
| 59 | + url: '/crm/business-status/get-simple-list?typeId=' + typeId, | |
| 60 | + method: 'get' | |
| 61 | + }) | |
| 62 | +} | |
| 63 | + | |
| 64 | +// 获取商机状态信息列表 | |
| 65 | +export function getBusinessStatusList() { | |
| 66 | + return request({ | |
| 67 | + url: '/crm/business-status/get-all-list', | |
| 68 | + method: 'get' | |
| 69 | + }) | |
| 70 | +} | ... | ... |
yudao-ui-admin/src/api/crm/businessStatusType.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建商机状态类型 | |
| 4 | +export function createBusinessStatusType(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/crm/business-status-type/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新商机状态类型 | |
| 13 | +export function updateBusinessStatusType(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/crm/business-status-type/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +// 删除商机状态类型 | |
| 22 | +export function deleteBusinessStatusType(id) { | |
| 23 | + return request({ | |
| 24 | + url: '/crm/business-status-type/delete?id=' + id, | |
| 25 | + method: 'delete' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 获得商机状态类型 | |
| 30 | +export function getBusinessStatusType(id) { | |
| 31 | + return request({ | |
| 32 | + url: '/crm/business-status-type/get?id=' + id, | |
| 33 | + method: 'get' | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获得商机状态类型分页 | |
| 38 | +export function getBusinessStatusTypePage(query) { | |
| 39 | + return request({ | |
| 40 | + url: '/crm/business-status-type/page', | |
| 41 | + method: 'get', | |
| 42 | + params: query | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 导出商机状态类型 Excel | |
| 47 | +export function exportBusinessStatusTypeExcel(query) { | |
| 48 | + return request({ | |
| 49 | + url: '/crm/business-status-type/export-excel', | |
| 50 | + method: 'get', | |
| 51 | + params: query, | |
| 52 | + responseType: 'blob' | |
| 53 | + }) | |
| 54 | +} | |
| 55 | + | |
| 56 | +// 获取商机状态类型信息列表 | |
| 57 | +export function getBusinessStatusTypeList() { | |
| 58 | + return request({ | |
| 59 | + url: '/crm/business-status-type/get-simple-list', | |
| 60 | + method: 'get' | |
| 61 | + }) | |
| 62 | +} | ... | ... |
yudao-ui-admin/src/api/crm/contact/contact.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建crm联系人 | |
| 4 | +export function createContact(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/crm/contact/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新crm联系人 | |
| 13 | +export function updateContact(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/crm/contact/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +// 删除crm联系人 | |
| 22 | +export function deleteContact(id) { | |
| 23 | + return request({ | |
| 24 | + url: '/crm/contact/delete?id=' + id, | |
| 25 | + method: 'delete' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 获得crm联系人 | |
| 30 | +export function getContact(id) { | |
| 31 | + return request({ | |
| 32 | + url: '/crm/contact/get?id=' + id, | |
| 33 | + method: 'get' | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获得crm联系人分页 | |
| 38 | +export function getContactPage(query) { | |
| 39 | + return request({ | |
| 40 | + url: '/crm/contact/page', | |
| 41 | + method: 'get', | |
| 42 | + params: query | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 导出crm联系人 Excel | |
| 47 | +export function exportContactExcel(query) { | |
| 48 | + return request({ | |
| 49 | + url: '/crm/contact/export-excel', | |
| 50 | + method: 'get', | |
| 51 | + params: query, | |
| 52 | + responseType: 'blob' | |
| 53 | + }) | |
| 54 | +} | ... | ... |
yudao-ui-admin/src/views/crm/business/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + | |
| 4 | + <!-- 搜索工作栏 --> | |
| 5 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | |
| 6 | + <el-form-item label="商机名称" prop="name"> | |
| 7 | + <el-input v-model="queryParams.name" placeholder="请输入商机名称" clearable @keyup.enter.native="handleQuery"/> | |
| 8 | + </el-form-item> | |
| 9 | + <el-form-item> | |
| 10 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | |
| 11 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | |
| 12 | + </el-form-item> | |
| 13 | + </el-form> | |
| 14 | + | |
| 15 | + <!-- 操作工具栏 --> | |
| 16 | + <el-row :gutter="10" class="mb8"> | |
| 17 | + <el-col :span="1.5"> | |
| 18 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | |
| 19 | + v-hasPermi="['crm:business:create']">新增</el-button> | |
| 20 | + </el-col> | |
| 21 | + <el-col :span="1.5"> | |
| 22 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | |
| 23 | + v-hasPermi="['crm:business:export']">导出</el-button> | |
| 24 | + </el-col> | |
| 25 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 26 | + </el-row> | |
| 27 | + | |
| 28 | + <!-- 列表 --> | |
| 29 | + <el-table v-loading="loading" :data="list"> | |
| 30 | + <el-table-column label="商机名称" align="center" prop="name" /> | |
| 31 | + <el-table-column label="客户名称" align="center" prop="customerId" /> | |
| 32 | + <el-table-column label="商机金额" align="center" prop="price" /> | |
| 33 | + <el-table-column label="预计成交日期" align="center" prop="dealTime" width="180"> | |
| 34 | + <template v-slot="scope"> | |
| 35 | + <span>{{ parseTime(scope.row.dealTime) }}</span> | |
| 36 | + </template> | |
| 37 | + </el-table-column> | |
| 38 | + <el-table-column label="备注" align="center" prop="remark" /> | |
| 39 | + <el-table-column label="商机状态类型" align="center" prop="statusTypeId" width="120"> | |
| 40 | + <template v-slot="scope"> | |
| 41 | + <el-tag> {{getBusinessStatusTypeName(scope.row.statusTypeId)}} </el-tag> | |
| 42 | + </template> | |
| 43 | + </el-table-column> | |
| 44 | + <el-table-column label="商机状态" align="center" prop="statusId" width="100"> | |
| 45 | + <template v-slot="scope"> | |
| 46 | + <el-tag> {{getBusinessStatusName(scope.row.statusId)}} </el-tag> | |
| 47 | + </template> | |
| 48 | + </el-table-column> | |
| 49 | + <el-table-column label="更新时间" align="center" prop="updateTime" width="180"> | |
| 50 | + <template v-slot="scope"> | |
| 51 | + <span>{{ parseTime(scope.row.updateTime) }}</span> | |
| 52 | + </template> | |
| 53 | + </el-table-column> | |
| 54 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | |
| 55 | + <template v-slot="scope"> | |
| 56 | + <span>{{ parseTime(scope.row.createTime) }}</span> | |
| 57 | + </template> | |
| 58 | + </el-table-column> | |
| 59 | + <el-table-column label="负责人" align="center" prop="ownerUserId" /> | |
| 60 | + <el-table-column label="创建人" align="center" prop="creator" /> | |
| 61 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 62 | + <template v-slot="scope"> | |
| 63 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | |
| 64 | + v-hasPermi="['crm:business:update']">修改</el-button> | |
| 65 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | |
| 66 | + v-hasPermi="['crm:business:delete']">删除</el-button> | |
| 67 | + </template> | |
| 68 | + </el-table-column> | |
| 69 | + </el-table> | |
| 70 | + <!-- 分页组件 --> | |
| 71 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 72 | + @pagination="getList"/> | |
| 73 | + | |
| 74 | + <!-- 对话框(添加 / 修改) --> | |
| 75 | + <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> | |
| 76 | + <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | |
| 77 | + <el-form-item label="商机名称" prop="name"> | |
| 78 | + <el-input v-model="form.name" placeholder="请输入商机名称" /> | |
| 79 | + </el-form-item> | |
| 80 | + <el-form-item label="客户编号" prop="customerId"> | |
| 81 | + <el-input v-model="form.customerId" placeholder="请输入客户编号" /> | |
| 82 | + </el-form-item> | |
| 83 | + <el-form-item label="商机状态类型" prop="statusTypeId"> | |
| 84 | + <el-select v-model="form.statusTypeId" placeholder="请选择商机状态类型" clearable size="small" @change="changeBusinessStatusType"> | |
| 85 | + <el-option v-for="item in businessStatusTypeList" :key="item.id" :label="item.name" :value="item.id"/> | |
| 86 | + </el-select> | |
| 87 | + </el-form-item> | |
| 88 | + <el-form-item label="商机状态" prop="statusId"> | |
| 89 | + <el-select v-model="form.statusId" placeholder="请选择商机状态" clearable size="small"> | |
| 90 | + <el-option v-for="item in businessStatusList" :key="item.id" :label="item.name" :value="item.id"/> | |
| 91 | + </el-select> | |
| 92 | + </el-form-item> | |
| 93 | + <el-form-item label="预计成交日期" prop="dealTime"> | |
| 94 | + <el-date-picker clearable v-model="form.dealTime" type="date" value-format="timestamp" placeholder="选择预计成交日期" /> | |
| 95 | + </el-form-item> | |
| 96 | + <el-form-item label="商机金额" prop="price"> | |
| 97 | + <el-input v-model="form.price" placeholder="请输入商机金额" /> | |
| 98 | + </el-form-item> | |
| 99 | + <el-form-item label="整单折扣(%)" prop="discountPercent"> | |
| 100 | + <el-input v-model="form.discountPercent" placeholder="请输入整单折扣" /> | |
| 101 | + </el-form-item> | |
| 102 | + <el-form-item label="产品总金额" prop="productPrice"> | |
| 103 | + <el-input v-model="form.productPrice" placeholder="请输入产品总金额" /> | |
| 104 | + </el-form-item> | |
| 105 | + <el-form-item label="备注" prop="remark"> | |
| 106 | + <el-input v-model="form.remark" placeholder="请输入备注" /> | |
| 107 | + </el-form-item> | |
| 108 | + </el-form> | |
| 109 | + <div slot="footer" class="dialog-footer"> | |
| 110 | + <el-button type="primary" @click="submitForm">确 定</el-button> | |
| 111 | + <el-button @click="cancel">取 消</el-button> | |
| 112 | + </div> | |
| 113 | + </el-dialog> | |
| 114 | + </div> | |
| 115 | +</template> | |
| 116 | + | |
| 117 | +<script> | |
| 118 | +import { createBusiness, updateBusiness, deleteBusiness, getBusiness, getBusinessPage, exportBusinessExcel } from "@/api/crm/business"; | |
| 119 | +import { getBusinessStatusListByTypeId, getBusinessStatusList } from "@/api/crm/businessStatus"; | |
| 120 | +import { getBusinessStatusTypeList } from "@/api/crm/businessStatusType"; | |
| 121 | + | |
| 122 | +export default { | |
| 123 | + name: "Business", | |
| 124 | + components: { | |
| 125 | + }, | |
| 126 | + data() { | |
| 127 | + return { | |
| 128 | + // 遮罩层 | |
| 129 | + loading: true, | |
| 130 | + // 导出遮罩层 | |
| 131 | + exportLoading: false, | |
| 132 | + // 显示搜索条件 | |
| 133 | + showSearch: true, | |
| 134 | + // 总条数 | |
| 135 | + total: 0, | |
| 136 | + // 商机列表 | |
| 137 | + list: [], | |
| 138 | + // 根据类型ID获取的商机状态列表 | |
| 139 | + businessStatusList: [], | |
| 140 | + // 所有商机状态列表 | |
| 141 | + businessStatusAllList: [], | |
| 142 | + // 商机状态类型列表 | |
| 143 | + businessStatusTypeList: [], | |
| 144 | + // 弹出层标题 | |
| 145 | + title: "", | |
| 146 | + // 是否显示弹出层 | |
| 147 | + open: false, | |
| 148 | + // 查询参数 | |
| 149 | + queryParams: { | |
| 150 | + pageNo: 1, | |
| 151 | + pageSize: 10, | |
| 152 | + name: null, | |
| 153 | + statusTypeId: null, | |
| 154 | + statusId: null, | |
| 155 | + contactNextTime: [], | |
| 156 | + customerId: null, | |
| 157 | + dealTime: [], | |
| 158 | + price: null, | |
| 159 | + discountPercent: null, | |
| 160 | + productPrice: null, | |
| 161 | + remark: null, | |
| 162 | + ownerUserId: null, | |
| 163 | + createTime: [], | |
| 164 | + roUserIds: null, | |
| 165 | + rwUserIds: null, | |
| 166 | + endStatus: null, | |
| 167 | + endRemark: null, | |
| 168 | + contactLastTime: [], | |
| 169 | + followUpStatus: null, | |
| 170 | + }, | |
| 171 | + // 表单参数 | |
| 172 | + form: {}, | |
| 173 | + // 表单校验 | |
| 174 | + rules: { | |
| 175 | + name: [{ required: true, message: "商机名称不能为空", trigger: "blur" }], | |
| 176 | + customerId: [{ required: true, message: "客户编号不能为空", trigger: "blur" }], | |
| 177 | + roUserIds: [{ required: true, message: "只读权限的用户编号数组不能为空", trigger: "blur" }], | |
| 178 | + rwUserIds: [{ required: true, message: "读写权限的用户编号数组不能为空", trigger: "blur" }], | |
| 179 | + endStatus: [{ required: true, message: "1赢单2输单3无效不能为空", trigger: "blur" }], | |
| 180 | + } | |
| 181 | + }; | |
| 182 | + }, | |
| 183 | + created() { | |
| 184 | + this.getList(); | |
| 185 | + }, | |
| 186 | + methods: { | |
| 187 | + /** 查询列表 */ | |
| 188 | + getList() { | |
| 189 | + this.loading = true; | |
| 190 | + // 执行查询 | |
| 191 | + getBusinessPage(this.queryParams).then(response => { | |
| 192 | + this.list = response.data.list; | |
| 193 | + this.total = response.data.total; | |
| 194 | + this.loading = false; | |
| 195 | + }); | |
| 196 | + //查询商机状态类型集合 | |
| 197 | + getBusinessStatusTypeList().then(response => { | |
| 198 | + this.businessStatusTypeList = response.data; | |
| 199 | + }); | |
| 200 | + //查询商机状态类型集合 | |
| 201 | + getBusinessStatusList().then(response => { | |
| 202 | + this.businessStatusAllList = response.data; | |
| 203 | + }); | |
| 204 | + | |
| 205 | + }, | |
| 206 | + /** 取消按钮 */ | |
| 207 | + cancel() { | |
| 208 | + this.open = false; | |
| 209 | + this.reset(); | |
| 210 | + }, | |
| 211 | + /** 表单重置 */ | |
| 212 | + reset() { | |
| 213 | + this.form = { | |
| 214 | + id: undefined, | |
| 215 | + name: undefined, | |
| 216 | + statusTypeId: undefined, | |
| 217 | + statusId: undefined, | |
| 218 | + contactNextTime: undefined, | |
| 219 | + customerId: undefined, | |
| 220 | + dealTime: undefined, | |
| 221 | + price: undefined, | |
| 222 | + discountPercent: undefined, | |
| 223 | + productPrice: undefined, | |
| 224 | + remark: undefined, | |
| 225 | + ownerUserId: undefined, | |
| 226 | + roUserIds: undefined, | |
| 227 | + rwUserIds: undefined, | |
| 228 | + endStatus: undefined, | |
| 229 | + endRemark: undefined, | |
| 230 | + contactLastTime: undefined, | |
| 231 | + followUpStatus: undefined, | |
| 232 | + }; | |
| 233 | + this.resetForm("form"); | |
| 234 | + }, | |
| 235 | + /** 搜索按钮操作 */ | |
| 236 | + handleQuery() { | |
| 237 | + this.queryParams.pageNo = 1; | |
| 238 | + this.getList(); | |
| 239 | + }, | |
| 240 | + /** 重置按钮操作 */ | |
| 241 | + resetQuery() { | |
| 242 | + this.resetForm("queryForm"); | |
| 243 | + this.handleQuery(); | |
| 244 | + }, | |
| 245 | + /** 新增按钮操作 */ | |
| 246 | + handleAdd() { | |
| 247 | + this.reset(); | |
| 248 | + this.open = true; | |
| 249 | + this.title = "添加商机"; | |
| 250 | + }, | |
| 251 | + /** 修改按钮操作 */ | |
| 252 | + handleUpdate(row) { | |
| 253 | + this.reset(); | |
| 254 | + const id = row.id; | |
| 255 | + getBusiness(id).then(response => { | |
| 256 | + this.form = response.data; | |
| 257 | + this.open = true; | |
| 258 | + this.title = "修改商机"; | |
| 259 | + }); | |
| 260 | + }, | |
| 261 | + /** 提交按钮 */ | |
| 262 | + submitForm() { | |
| 263 | + this.$refs["form"].validate(valid => { | |
| 264 | + if (!valid) { | |
| 265 | + return; | |
| 266 | + } | |
| 267 | + // 修改的提交 | |
| 268 | + if (this.form.id != null) { | |
| 269 | + updateBusiness(this.form).then(response => { | |
| 270 | + this.$modal.msgSuccess("修改成功"); | |
| 271 | + this.open = false; | |
| 272 | + this.getList(); | |
| 273 | + }); | |
| 274 | + return; | |
| 275 | + } | |
| 276 | + // 添加的提交 | |
| 277 | + createBusiness(this.form).then(response => { | |
| 278 | + this.$modal.msgSuccess("新增成功"); | |
| 279 | + this.open = false; | |
| 280 | + this.getList(); | |
| 281 | + }); | |
| 282 | + }); | |
| 283 | + }, | |
| 284 | + /** 删除按钮操作 */ | |
| 285 | + handleDelete(row) { | |
| 286 | + const id = row.id; | |
| 287 | + this.$modal.confirm('是否确认删除商机编号为"' + id + '"的数据项?').then(function() { | |
| 288 | + return deleteBusiness(id); | |
| 289 | + }).then(() => { | |
| 290 | + this.getList(); | |
| 291 | + this.$modal.msgSuccess("删除成功"); | |
| 292 | + }).catch(() => {}); | |
| 293 | + }, | |
| 294 | + /** 导出按钮操作 */ | |
| 295 | + handleExport() { | |
| 296 | + // 处理查询参数 | |
| 297 | + let params = {...this.queryParams}; | |
| 298 | + params.pageNo = undefined; | |
| 299 | + params.pageSize = undefined; | |
| 300 | + this.$modal.confirm('是否确认导出所有商机数据项?').then(() => { | |
| 301 | + this.exportLoading = true; | |
| 302 | + return exportBusinessExcel(params); | |
| 303 | + }).then(response => { | |
| 304 | + this.$download.excel(response, '商机.xls'); | |
| 305 | + this.exportLoading = false; | |
| 306 | + }).catch(() => {}); | |
| 307 | + }, | |
| 308 | + /** 选择商机状态类型事件 */ | |
| 309 | + changeBusinessStatusType (id) { | |
| 310 | + //查询商机状态集合 | |
| 311 | + getBusinessStatusListByTypeId(id).then(response => { | |
| 312 | + this.businessStatusList = response.data; | |
| 313 | + }); | |
| 314 | + }, | |
| 315 | + /** 商机状态类型名格式化 */ | |
| 316 | + getBusinessStatusTypeName(typeId) { | |
| 317 | + for (const item of this.businessStatusTypeList) { | |
| 318 | + if (item.id === typeId) { | |
| 319 | + return item.name; | |
| 320 | + } | |
| 321 | + } | |
| 322 | + return '未知'; | |
| 323 | + }, | |
| 324 | + /** 商机状态名格式化 */ | |
| 325 | + getBusinessStatusName(id) { | |
| 326 | + for (const item of this.businessStatusAllList) { | |
| 327 | + if (item.id === id) { | |
| 328 | + return item.name; | |
| 329 | + } | |
| 330 | + } | |
| 331 | + return '未知'; | |
| 332 | + } | |
| 333 | + } | |
| 334 | +}; | |
| 335 | +</script> | ... | ... |
yudao-ui-admin/src/views/crm/contact/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + | |
| 4 | + <!-- 搜索工作栏 --> | |
| 5 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px"> | |
| 6 | + <el-form-item label="姓名" prop="name"> | |
| 7 | + <el-input v-model="queryParams.name" placeholder="请输入联系人名称" clearable @keyup.enter.native="handleQuery"/> | |
| 8 | + </el-form-item> | |
| 9 | + <el-form-item label="下次联系时间" prop="nextTime"> | |
| 10 | + <el-date-picker v-model="queryParams.nextTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | |
| 11 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | |
| 12 | + </el-form-item> | |
| 13 | + <el-form-item label="手机号" prop="mobile"> | |
| 14 | + <el-input v-model="queryParams.mobile" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery"/> | |
| 15 | + </el-form-item> | |
| 16 | +<!-- <el-form-item label="电话" prop="telephone">--> | |
| 17 | +<!-- <el-input v-model="queryParams.telephone" placeholder="请输入电话" clearable @keyup.enter.native="handleQuery"/>--> | |
| 18 | +<!-- </el-form-item>--> | |
| 19 | +<!-- <el-form-item label="电子邮箱" prop="email">--> | |
| 20 | +<!-- <el-input v-model="queryParams.email" placeholder="请输入电子邮箱" clearable @keyup.enter.native="handleQuery"/>--> | |
| 21 | +<!-- </el-form-item>--> | |
| 22 | +<!-- <el-form-item label="职务" prop="post">--> | |
| 23 | +<!-- <el-input v-model="queryParams.post" placeholder="请输入职务" clearable @keyup.enter.native="handleQuery"/>--> | |
| 24 | +<!-- </el-form-item>--> | |
| 25 | + <el-form-item label="客户编号" prop="customerId"> | |
| 26 | + <el-input v-model="queryParams.customerId" placeholder="请输入客户编号" clearable @keyup.enter.native="handleQuery"/> | |
| 27 | + </el-form-item> | |
| 28 | +<!-- <el-form-item label="地址" prop="address">--> | |
| 29 | +<!-- <el-input v-model="queryParams.address" placeholder="请输入地址" clearable @keyup.enter.native="handleQuery"/>--> | |
| 30 | +<!-- </el-form-item>--> | |
| 31 | +<!-- <el-form-item label="备注" prop="remark">--> | |
| 32 | +<!-- <el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery"/>--> | |
| 33 | +<!-- </el-form-item>--> | |
| 34 | + <el-form-item label="负责人用户编号" prop="ownerUserId"> | |
| 35 | + <el-input v-model="queryParams.ownerUserId" placeholder="请输入负责人用户编号" clearable @keyup.enter.native="handleQuery"/> | |
| 36 | + </el-form-item> | |
| 37 | +<!-- <el-form-item label="创建时间" prop="createTime">--> | |
| 38 | +<!-- <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"--> | |
| 39 | +<!-- range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />--> | |
| 40 | +<!-- </el-form-item>--> | |
| 41 | +<!-- <el-form-item label="最后跟进时间" prop="lastTime">--> | |
| 42 | +<!-- <el-date-picker v-model="queryParams.lastTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"--> | |
| 43 | +<!-- range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />--> | |
| 44 | +<!-- </el-form-item>--> | |
| 45 | +<!-- <el-form-item label="更新人" prop="updator">--> | |
| 46 | +<!-- <el-input v-model="queryParams.updator" placeholder="请输入更新人" clearable @keyup.enter.native="handleQuery"/>--> | |
| 47 | +<!-- </el-form-item>--> | |
| 48 | + <el-form-item> | |
| 49 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | |
| 50 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | |
| 51 | + </el-form-item> | |
| 52 | + </el-form> | |
| 53 | + | |
| 54 | + <!-- 操作工具栏 --> | |
| 55 | + <el-row :gutter="10" class="mb8"> | |
| 56 | + <el-col :span="1.5"> | |
| 57 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | |
| 58 | + v-hasPermi="['crm:contact:create']">新增</el-button> | |
| 59 | + </el-col> | |
| 60 | + <el-col :span="1.5"> | |
| 61 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | |
| 62 | + v-hasPermi="['crm:contact:export']">导出</el-button> | |
| 63 | + </el-col> | |
| 64 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 65 | + </el-row> | |
| 66 | + | |
| 67 | + <!-- 列表 --> | |
| 68 | + <el-table v-loading="loading" :data="list"> | |
| 69 | + <el-table-column label="姓名" align="center" prop="name" /> | |
| 70 | + <el-table-column label="下次联系时间" align="center" prop="nextTime" > | |
| 71 | + <template v-slot="scope"> | |
| 72 | + <span>{{ parseTime(scope.row.nextTime) }}</span> | |
| 73 | + </template> | |
| 74 | + </el-table-column> | |
| 75 | + <el-table-column label="手机号" align="center" prop="mobile" /> | |
| 76 | + <el-table-column label="电话" align="center" prop="telephone" /> | |
| 77 | + <el-table-column label="电子邮箱" align="center" prop="email" /> | |
| 78 | + <el-table-column label="职务" align="center" prop="post" /> | |
| 79 | + <el-table-column label="客户编号" align="center" prop="customerId" /> | |
| 80 | + <el-table-column label="地址" align="center" prop="address" /> | |
| 81 | + <el-table-column label="备注" align="center" prop="remark" /> | |
| 82 | + <el-table-column label="负责人用户编号" align="center" prop="ownerUserId" /> | |
| 83 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | |
| 84 | + <template v-slot="scope"> | |
| 85 | + <span>{{ parseTime(scope.row.createTime) }}</span> | |
| 86 | + </template> | |
| 87 | + </el-table-column> | |
| 88 | + <el-table-column label="最后跟进时间" align="center" prop="lastTime" width="180"> | |
| 89 | + <template v-slot="scope"> | |
| 90 | + <span>{{ parseTime(scope.row.lastTime) }}</span> | |
| 91 | + </template> | |
| 92 | + </el-table-column> | |
| 93 | + <el-table-column label="更新人" align="center" prop="updator" /> | |
| 94 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 95 | + <template v-slot="scope"> | |
| 96 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | |
| 97 | + v-hasPermi="['crm:contact:update']">修改</el-button> | |
| 98 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | |
| 99 | + v-hasPermi="['crm:contact:delete']">删除</el-button> | |
| 100 | + </template> | |
| 101 | + </el-table-column> | |
| 102 | + </el-table> | |
| 103 | + <!-- 分页组件 --> | |
| 104 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 105 | + @pagination="getList"/> | |
| 106 | + | |
| 107 | + <!-- 对话框(添加 / 修改) --> | |
| 108 | + <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> | |
| 109 | + <el-form ref="form" :model="form" :rules="rules" label-width="110px"> | |
| 110 | + <el-form-item label="姓名" prop="name"> | |
| 111 | + <el-input v-model="form.name" placeholder="请输入联系人名称" /> | |
| 112 | + </el-form-item> | |
| 113 | + <el-form-item label="下次联系时间" prop="nextTime"> | |
| 114 | + <el-date-picker clearable v-model="form.nextTime" type="date" value-format="timestamp" placeholder="选择下次联系时间" /> | |
| 115 | + </el-form-item> | |
| 116 | + <el-form-item label="手机号" prop="mobile"> | |
| 117 | + <el-input v-model="form.mobile" placeholder="请输入手机号" /> | |
| 118 | + </el-form-item> | |
| 119 | + <el-form-item label="电话" prop="telephone"> | |
| 120 | + <el-input v-model="form.telephone" placeholder="请输入电话" /> | |
| 121 | + </el-form-item> | |
| 122 | + <el-form-item label="电子邮箱" prop="email"> | |
| 123 | + <el-input v-model="form.email" placeholder="请输入电子邮箱" /> | |
| 124 | + </el-form-item> | |
| 125 | + <el-form-item label="职务" prop="post"> | |
| 126 | + <el-input v-model="form.post" placeholder="请输入职务" /> | |
| 127 | + </el-form-item> | |
| 128 | + <el-form-item label="客户编号" prop="customerId"> | |
| 129 | + <el-input v-model="form.customerId" placeholder="请输入客户编号" /> | |
| 130 | + </el-form-item> | |
| 131 | + <el-form-item label="地址" prop="address"> | |
| 132 | + <el-input v-model="form.address" placeholder="请输入地址" /> | |
| 133 | + </el-form-item> | |
| 134 | + <el-form-item label="备注" prop="remark"> | |
| 135 | + <el-input v-model="form.remark" placeholder="请输入备注" /> | |
| 136 | + </el-form-item> | |
| 137 | + <el-form-item label="负责人用户编号" prop="ownerUserId"> | |
| 138 | + <el-input v-model="form.ownerUserId" placeholder="请输入负责人用户编号" /> | |
| 139 | + </el-form-item> | |
| 140 | + <el-form-item label="最后跟进时间" prop="lastTime"> | |
| 141 | + <el-date-picker clearable v-model="form.lastTime" type="date" value-format="timestamp" placeholder="选择最后跟进时间" /> | |
| 142 | + </el-form-item> | |
| 143 | + <el-form-item label="更新人" prop="updator"> | |
| 144 | + <el-input v-model="form.updator" placeholder="请输入更新人" /> | |
| 145 | + </el-form-item> | |
| 146 | + </el-form> | |
| 147 | + <div slot="footer" class="dialog-footer"> | |
| 148 | + <el-button type="primary" @click="submitForm">确 定</el-button> | |
| 149 | + <el-button @click="cancel">取 消</el-button> | |
| 150 | + </div> | |
| 151 | + </el-dialog> | |
| 152 | + </div> | |
| 153 | +</template> | |
| 154 | + | |
| 155 | +<script> | |
| 156 | +import { createContact, updateContact, deleteContact, getContact, getContactPage, exportContactExcel } from "@/api/crm/contact/contact"; | |
| 157 | + | |
| 158 | +export default { | |
| 159 | + name: "Contact", | |
| 160 | + components: { | |
| 161 | + }, | |
| 162 | + data() { | |
| 163 | + return { | |
| 164 | + // 遮罩层 | |
| 165 | + loading: true, | |
| 166 | + // 导出遮罩层 | |
| 167 | + exportLoading: false, | |
| 168 | + // 显示搜索条件 | |
| 169 | + showSearch: true, | |
| 170 | + // 总条数 | |
| 171 | + total: 0, | |
| 172 | + // crm联系人列表 | |
| 173 | + list: [], | |
| 174 | + // 弹出层标题 | |
| 175 | + title: "", | |
| 176 | + // 是否显示弹出层 | |
| 177 | + open: false, | |
| 178 | + // 查询参数 | |
| 179 | + queryParams: { | |
| 180 | + pageNo: 1, | |
| 181 | + pageSize: 10, | |
| 182 | + name: null, | |
| 183 | + nextTime: [], | |
| 184 | + mobile: null, | |
| 185 | + telephone: null, | |
| 186 | + email: null, | |
| 187 | + post: null, | |
| 188 | + customerId: null, | |
| 189 | + address: null, | |
| 190 | + remark: null, | |
| 191 | + ownerUserId: null, | |
| 192 | + createTime: [], | |
| 193 | + lastTime: [], | |
| 194 | + updator: null, | |
| 195 | + }, | |
| 196 | + // 表单参数 | |
| 197 | + form: {}, | |
| 198 | + // 表单校验 | |
| 199 | + rules: { | |
| 200 | + } | |
| 201 | + }; | |
| 202 | + }, | |
| 203 | + created() { | |
| 204 | + this.getList(); | |
| 205 | + }, | |
| 206 | + methods: { | |
| 207 | + /** 查询列表 */ | |
| 208 | + getList() { | |
| 209 | + this.loading = true; | |
| 210 | + // 执行查询 | |
| 211 | + getContactPage(this.queryParams).then(response => { | |
| 212 | + this.list = response.data.list; | |
| 213 | + this.total = response.data.total; | |
| 214 | + this.loading = false; | |
| 215 | + }); | |
| 216 | + }, | |
| 217 | + /** 取消按钮 */ | |
| 218 | + cancel() { | |
| 219 | + this.open = false; | |
| 220 | + this.reset(); | |
| 221 | + }, | |
| 222 | + /** 表单重置 */ | |
| 223 | + reset() { | |
| 224 | + this.form = { | |
| 225 | + id: undefined, | |
| 226 | + name: undefined, | |
| 227 | + nextTime: undefined, | |
| 228 | + mobile: undefined, | |
| 229 | + telephone: undefined, | |
| 230 | + email: undefined, | |
| 231 | + post: undefined, | |
| 232 | + customerId: undefined, | |
| 233 | + address: undefined, | |
| 234 | + remark: undefined, | |
| 235 | + ownerUserId: undefined, | |
| 236 | + lastTime: undefined, | |
| 237 | + updator: undefined, | |
| 238 | + }; | |
| 239 | + this.resetForm("form"); | |
| 240 | + }, | |
| 241 | + /** 搜索按钮操作 */ | |
| 242 | + handleQuery() { | |
| 243 | + this.queryParams.pageNo = 1; | |
| 244 | + this.getList(); | |
| 245 | + }, | |
| 246 | + /** 重置按钮操作 */ | |
| 247 | + resetQuery() { | |
| 248 | + this.resetForm("queryForm"); | |
| 249 | + this.handleQuery(); | |
| 250 | + }, | |
| 251 | + /** 新增按钮操作 */ | |
| 252 | + handleAdd() { | |
| 253 | + this.reset(); | |
| 254 | + this.open = true; | |
| 255 | + this.title = "添加联系人"; | |
| 256 | + }, | |
| 257 | + /** 修改按钮操作 */ | |
| 258 | + handleUpdate(row) { | |
| 259 | + this.reset(); | |
| 260 | + const id = row.id; | |
| 261 | + getContact(id).then(response => { | |
| 262 | + this.form = response.data; | |
| 263 | + this.open = true; | |
| 264 | + this.title = "修改联系人"; | |
| 265 | + }); | |
| 266 | + }, | |
| 267 | + /** 提交按钮 */ | |
| 268 | + submitForm() { | |
| 269 | + this.$refs["form"].validate(valid => { | |
| 270 | + if (!valid) { | |
| 271 | + return; | |
| 272 | + } | |
| 273 | + // 修改的提交 | |
| 274 | + if (this.form.id != null) { | |
| 275 | + updateContact(this.form).then(response => { | |
| 276 | + this.$modal.msgSuccess("修改成功"); | |
| 277 | + this.open = false; | |
| 278 | + this.getList(); | |
| 279 | + }); | |
| 280 | + return; | |
| 281 | + } | |
| 282 | + // 添加的提交 | |
| 283 | + createContact(this.form).then(response => { | |
| 284 | + this.$modal.msgSuccess("新增成功"); | |
| 285 | + this.open = false; | |
| 286 | + this.getList(); | |
| 287 | + }); | |
| 288 | + }); | |
| 289 | + }, | |
| 290 | + /** 删除按钮操作 */ | |
| 291 | + handleDelete(row) { | |
| 292 | + const id = row.id; | |
| 293 | + this.$modal.confirm('是否确认删除联系人编号为"' + id + '"的数据项?').then(function() { | |
| 294 | + return deleteContact(id); | |
| 295 | + }).then(() => { | |
| 296 | + this.getList(); | |
| 297 | + this.$modal.msgSuccess("删除成功"); | |
| 298 | + }).catch(() => {}); | |
| 299 | + }, | |
| 300 | + /** 导出按钮操作 */ | |
| 301 | + handleExport() { | |
| 302 | + // 处理查询参数 | |
| 303 | + let params = {...this.queryParams}; | |
| 304 | + params.pageNo = undefined; | |
| 305 | + params.pageSize = undefined; | |
| 306 | + this.$modal.confirm('是否确认导出所有联系人数据项?').then(() => { | |
| 307 | + this.exportLoading = true; | |
| 308 | + return exportContactExcel(params); | |
| 309 | + }).then(response => { | |
| 310 | + this.$download.excel(response, '联系人.xls'); | |
| 311 | + this.exportLoading = false; | |
| 312 | + }).catch(() => {}); | |
| 313 | + } | |
| 314 | + } | |
| 315 | +}; | |
| 316 | +</script> | ... | ... |