diff --git a/sql/mysql/crm.sql b/sql/mysql/crm.sql index fc819787a..95a81df8e 100644 --- a/sql/mysql/crm.sql +++ b/sql/mysql/crm.sql @@ -62,6 +62,10 @@ CREATE TABLE `crm_clue` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB COMMENT = '线索表' ; +-- ---------------------------- +-- 商机表 +-- ---------------------------- + DROP TABLE IF EXISTS `crm_business`; CREATE TABLE `crm_business` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', @@ -211,4 +215,33 @@ CREATE TABLE `crm_customer` ( `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', PRIMARY KEY (`id`), KEY `owner_user_id` (`owner_user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户表'; +-- ---------------------------- +-- 商机状态表 +-- ---------------------------- +DROP TABLE IF EXISTS `crm_business_status`; +CREATE TABLE `crm_business_status` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `type_id` bigint NOT NULL COMMENT '状态类型编号', + `name` varchar(100) NOT NULL COMMENT '状态名', + `percent` varchar(20) DEFAULT NULL COMMENT '赢单率', + `sort` int DEFAULT NULL COMMENT '排序', + `tenant_id` bigint DEFAULT '1' COMMENT '租户ID', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商机状态表' + +-- ---------------------------- +-- 商机状态类型表 +-- ---------------------------- +DROP TABLE IF EXISTS `crm_business_status_type`; +CREATE TABLE `crm_business_status_type` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `name` varchar(100) NOT NULL COMMENT '状态类型名', + `dept_ids` varchar(200) NOT NULL COMMENT '使用的部门编号', + `status` bit(1) NOT NULL DEFAULT b'0' COMMENT '开启状态', + `creator` varchar(64) NOT NULL COMMENT '创建人', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `tenant_id` bigint DEFAULT '1' COMMENT '租户ID', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商机状态类型表' diff --git a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java index 37443fbc8..374687e5e 100644 --- a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java +++ b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java @@ -17,6 +17,8 @@ public interface ErrorCodeConstants { // ========== 商机管理 1-020-002-000 ========== ErrorCode BUSINESS_NOT_EXISTS = new ErrorCode(1_020_002_000, "商机不存在"); + ErrorCode BUSINESS_STATUS_TYPE_NOT_EXISTS = new ErrorCode(1_020_002_001, "商机状态类型不存在"); + ErrorCode BUSINESS_STATUS_NOT_EXISTS = new ErrorCode(1_020_002_002, "商机状态不存在"); // ========== 联系人管理 1-020-003-000 ========== ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_020_003_000, "联系人不存在"); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java index b622f23c3..d517a9f91 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java +++ b/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 { @PreAuthorize("@ss.hasPermission('crm:business:query')") public CommonResult> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) { PageResult pageResult = businessService.getBusinessPage(pageVO); + return success(CrmBusinessConvert.INSTANCE.convertPage(pageResult)); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessBaseVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessBaseVO.java index 061929ae6..9bcffb117 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessBaseVO.java +++ b/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 { @NotNull(message = "商机名称不能为空") private String name; - // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED - @Schema(description = "商机状态类型编号", example = "25714") + @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714") @NotNull(message = "商机状态类型不能为空") private Long statusTypeId; - // TODO @ljileo:要写 requiredMode = Schema.RequiredMode.REQUIRED - @Schema(description = "商机状态编号", example = "30320") + @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") @NotNull(message = "商机状态不能为空") private Long statusId; @@ -43,13 +41,12 @@ public class CrmBusinessBaseVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime dealTime; - // TODO @ljileo:金额使用 Integer 类型,转换成分 @Schema(description = "商机金额", example = "12371") - private BigDecimal price; + private Integer price; // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 @Schema(description = "整单折扣") - private BigDecimal discountPercent; + private Integer discountPercent; @Schema(description = "产品总金额", example = "12025") private BigDecimal productPrice; @@ -57,33 +54,4 @@ public class CrmBusinessBaseVO { @Schema(description = "备注", example = "随便") private String remark; - // TODO @ljileo:这个新建和修改的时候,应该不传递哈;应该新建的人,就是它的负责人 - @Schema(description = "负责人的用户编号", example = "25562") - private Long ownerUserId; - - // TODO @ljileo:这个新建和修改的时候,应该不传递哈 - @Schema(description = "只读权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) - private String roUserIds; - - // TODO @ljileo:这个新建和修改的时候,应该不传递哈 - @Schema(description = "读写权限的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED) - private String rwUserIds; - - // TODO @lijieo:新建的时候,不传递这个字段哈; - @Schema(description = "1赢单2输单3无效", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - private Integer endStatus; - - // TODO @lijieo:新建的时候,不传递这个字段哈; - @Schema(description = "结束时的备注", example = "你说的对") - private String endRemark; - - // TODO @lijieo:新建的时候,不传递这个字段哈; - @Schema(description = "最后跟进时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime contactLastTime; - - // TODO @lijieo:新建的时候,不传递这个字段哈; - @Schema(description = "跟进状态", example = "1") - private Integer followUpStatus; - } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessPageReqVO.java index 99a41d597..c8368cce7 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/CrmBusinessPageReqVO.java +++ b/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; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import org.springframework.format.annotation.DateTimeFormat; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @Schema(description = "管理后台 - 商机分页 Request VO") @Data @@ -18,64 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class CrmBusinessPageReqVO extends PageParam { - // TODO @ljileo:目前就使用 name 检索即可; - @Schema(description = "商机名称", example = "李四") private String name; - @Schema(description = "商机状态类型编号", example = "25714") - private Long statusTypeId; - - @Schema(description = "商机状态编号", example = "30320") - private Long statusId; - - @Schema(description = "下次联系时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] contactNextTime; - - @Schema(description = "客户编号", example = "10299") - private Long customerId; - - @Schema(description = "预计成交日期") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] dealTime; - - @Schema(description = "商机金额", example = "12371") - private BigDecimal price; - - @Schema(description = "整单折扣") - private BigDecimal discountPercent; - - @Schema(description = "产品总金额", example = "12025") - private BigDecimal productPrice; - - @Schema(description = "备注", example = "随便") - private String remark; - - @Schema(description = "负责人的用户编号", example = "25562") - private Long ownerUserId; - - @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; - - @Schema(description = "只读权限的用户编号数组") - private String roUserIds; - - @Schema(description = "读写权限的用户编号数组") - private String rwUserIds; - - @Schema(description = "1赢单2输单3无效", example = "1") - private Integer endStatus; - - @Schema(description = "结束时的备注", example = "你说的对") - private String endRemark; - - @Schema(description = "最后跟进时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] contactLastTime; - - @Schema(description = "跟进状态", example = "1") - private Integer followUpStatus; - } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/CrmBusinessStatusController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/CrmBusinessStatusController.java new file mode 100644 index 000000000..fddec8d8d --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/CrmBusinessStatusController.java @@ -0,0 +1,115 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; +import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; +import cn.iocoder.yudao.module.crm.service.businessstatus.CrmBusinessStatusService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 商机状态") +@RestController +@RequestMapping("/crm/business-status") +@Validated +public class CrmBusinessStatusController { + + @Resource + private CrmBusinessStatusService businessStatusService; + + @PostMapping("/create") + @Operation(summary = "创建商机状态") + @PreAuthorize("@ss.hasPermission('crm:business-status:create')") + public CommonResult createBusinessStatus(@Valid @RequestBody CrmBusinessStatusCreateReqVO createReqVO) { + return success(businessStatusService.createBusinessStatus(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新商机状态") + @PreAuthorize("@ss.hasPermission('crm:business-status:update')") + public CommonResult updateBusinessStatus(@Valid @RequestBody CrmBusinessStatusUpdateReqVO updateReqVO) { + businessStatusService.updateBusinessStatus(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除商机状态") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('crm:business-status:delete')") + public CommonResult deleteBusinessStatus(@RequestParam("id") Long id) { + businessStatusService.deleteBusinessStatus(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得商机状态") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") + public CommonResult getBusinessStatus(@RequestParam("id") Long id) { + CrmBusinessStatusDO businessStatus = businessStatusService.getBusinessStatus(id); + return success(CrmBusinessStatusConvert.INSTANCE.convert(businessStatus)); + } + + @GetMapping("/list") + @Operation(summary = "获得商机状态列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") + public CommonResult> getBusinessStatusList(@RequestParam("ids") Collection ids) { + List list = businessStatusService.getBusinessStatusList(ids); + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得商机状态分页") + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") + public CommonResult> getBusinessStatusPage(@Valid CrmBusinessStatusPageReqVO pageVO) { + PageResult pageResult = businessStatusService.getBusinessStatusPage(pageVO); + return success(CrmBusinessStatusConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出商机状态 Excel") + @PreAuthorize("@ss.hasPermission('crm:business-status:export')") + @OperateLog(type = EXPORT) + public void exportBusinessStatusExcel(@Valid CrmBusinessStatusExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = businessStatusService.getBusinessStatusList(exportReqVO); + // 导出 Excel + List datas = CrmBusinessStatusConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "商机状态.xls", "数据", CrmBusinessStatusExcelVO.class, datas); + } + + @GetMapping("/get-simple-list") + @Operation(summary = "获得商机状态列表") + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") + public CommonResult> getBusinessStatusListByTypeId(@RequestParam("typeId") Integer typeId) { + List list = businessStatusService.getBusinessStatusListByTypeId(typeId); + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/get-all-list") + @Operation(summary = "获得商机状态列表") + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") + public CommonResult> getBusinessStatusList() { + List list = businessStatusService.getBusinessStatusList(); + return success(CrmBusinessStatusConvert.INSTANCE.convertList(list)); + } + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusBaseVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusBaseVO.java new file mode 100644 index 000000000..eec9de8b0 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusBaseVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 商机状态 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class CrmBusinessStatusBaseVO { + + @Schema(description = "状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22882") + @NotNull(message = "状态类型编号不能为空") + private Long typeId; + + @Schema(description = "状态名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @NotNull(message = "状态名不能为空") + private String name; + + @Schema(description = "赢单率") + private String percent; + + @Schema(description = "排序") + private Integer sort; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusCreateReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusCreateReqVO.java new file mode 100644 index 000000000..04e999474 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 商机状态创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusCreateReqVO extends CrmBusinessStatusBaseVO { + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExcelVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExcelVO.java new file mode 100644 index 000000000..83002469e --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExcelVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 商机状态 Excel VO + * + * @author ljlleo + */ +@Data +public class CrmBusinessStatusExcelVO { + + @ExcelProperty("主键") + private Long id; + + @ExcelProperty("状态类型编号") + private Long typeId; + + @ExcelProperty("状态名") + private String name; + + @ExcelProperty("赢单率") + private String percent; + + @ExcelProperty("排序") + private Integer sort; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExportReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExportReqVO.java new file mode 100644 index 000000000..3fecb03ee --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusExportReqVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 商机状态 Excel 导出 Request VO,参数和 CrmBusinessStatusPageReqVO 是一致的") +@Data +public class CrmBusinessStatusExportReqVO { + + @Schema(description = "状态类型编号", example = "22882") + private Long typeId; + + @Schema(description = "状态名", example = "李四") + private String name; + + @Schema(description = "赢单率") + private String percent; + + @Schema(description = "排序") + private Integer sort; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusPageReqVO.java new file mode 100644 index 000000000..af03512af --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusPageReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 商机状态分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusPageReqVO extends PageParam { + + @Schema(description = "状态类型编号", example = "22882") + private Long typeId; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusRespVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusRespVO.java new file mode 100644 index 000000000..2a0fa07a4 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusRespVO.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Schema(description = "管理后台 - 商机状态 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusRespVO extends CrmBusinessStatusBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") + private Long id; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusUpdateReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusUpdateReqVO.java new file mode 100644 index 000000000..11f403330 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatus/vo/CrmBusinessStatusUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 商机状态更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusUpdateReqVO extends CrmBusinessStatusBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6802") + @NotNull(message = "主键不能为空") + private Long id; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/CrmBusinessStatusTypeController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/CrmBusinessStatusTypeController.java new file mode 100644 index 000000000..ae0c55d62 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/CrmBusinessStatusTypeController.java @@ -0,0 +1,108 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; +import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; +import cn.iocoder.yudao.module.crm.service.businessstatustype.CrmBusinessStatusTypeService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 商机状态类型") +@RestController +@RequestMapping("/crm/business-status-type") +@Validated +public class CrmBusinessStatusTypeController { + + @Resource + private CrmBusinessStatusTypeService businessStatusTypeService; + + @PostMapping("/create") + @Operation(summary = "创建商机状态类型") + @PreAuthorize("@ss.hasPermission('crm:business-status-type:create')") + public CommonResult createBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeCreateReqVO createReqVO) { + return success(businessStatusTypeService.createBusinessStatusType(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新商机状态类型") + @PreAuthorize("@ss.hasPermission('crm:business-status-type:update')") + public CommonResult updateBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeUpdateReqVO updateReqVO) { + businessStatusTypeService.updateBusinessStatusType(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除商机状态类型") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('crm:business-status-type:delete')") + public CommonResult deleteBusinessStatusType(@RequestParam("id") Long id) { + businessStatusTypeService.deleteBusinessStatusType(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得商机状态类型") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") + public CommonResult getBusinessStatusType(@RequestParam("id") Long id) { + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); + return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(businessStatusType)); + } + + @GetMapping("/list") + @Operation(summary = "获得商机状态类型列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") + public CommonResult> getBusinessStatusTypeList(@RequestParam("ids") Collection ids) { + List list = businessStatusTypeService.getBusinessStatusTypeList(ids); + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得商机状态类型分页") + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") + public CommonResult> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageVO) { + PageResult pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageVO); + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出商机状态类型 Excel") + @PreAuthorize("@ss.hasPermission('crm:business-status-type:export')") + @OperateLog(type = EXPORT) + public void exportBusinessStatusTypeExcel(@Valid CrmBusinessStatusTypeExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = businessStatusTypeService.getBusinessStatusTypeList(exportReqVO); + // 导出 Excel + List datas = CrmBusinessStatusTypeConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "商机状态类型.xls", "数据", CrmBusinessStatusTypeExcelVO.class, datas); + } + + @GetMapping("/get-simple-list") + @Operation(summary = "获得商机状态类型列表") + @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") + public CommonResult> getBusinessStatusTypeList() { + List list = businessStatusTypeService.getBusinessStatusTypeListByStatus(CommonStatusEnum.ENABLE.getStatus()); + return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list)); + } + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeBaseVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeBaseVO.java new file mode 100644 index 000000000..c472a3471 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeBaseVO.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 商机状态类型 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class CrmBusinessStatusTypeBaseVO { + + @Schema(description = "状态类型名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotNull(message = "状态类型名不能为空") + private String name; + + @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "使用的部门编号不能为空") + private String deptIds; + + @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "开启状态不能为空") + private Boolean status; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeCreateReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeCreateReqVO.java new file mode 100644 index 000000000..e9f958a6c --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 商机状态类型创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusTypeCreateReqVO extends CrmBusinessStatusTypeBaseVO { + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExcelVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExcelVO.java new file mode 100644 index 000000000..ea82616de --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExcelVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 商机状态类型 Excel VO + * + * @author ljlleo + */ +@Data +public class CrmBusinessStatusTypeExcelVO { + + @ExcelProperty("主键") + private Long id; + + @ExcelProperty("状态类型名") + private String name; + + @ExcelProperty("使用的部门编号") + private String deptIds; + + @ExcelProperty("开启状态") + private Boolean status; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExportReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExportReqVO.java new file mode 100644 index 000000000..48d5bc7ed --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeExportReqVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 商机状态类型 Excel 导出 Request VO,参数和 CrmBusinessStatusTypePageReqVO 是一致的") +@Data +public class CrmBusinessStatusTypeExportReqVO { + + @Schema(description = "状态类型名", example = "芋艿") + private String name; + + @Schema(description = "使用的部门编号") + private String deptIds; + + @Schema(description = "开启状态", example = "1") + private Boolean status; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypePageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypePageReqVO.java new file mode 100644 index 000000000..4b15210ac --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypePageReqVO.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 商机状态类型分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusTypePageReqVO extends PageParam { + + @Schema(description = "状态类型名", example = "芋艿") + private String name; + + @Schema(description = "开启状态", example = "1") + private Boolean status; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeRespVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeRespVO.java new file mode 100644 index 000000000..a4e21c58e --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 商机状态类型 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusTypeRespVO extends CrmBusinessStatusTypeBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") + private Long id; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeUpdateReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeUpdateReqVO.java new file mode 100644 index 000000000..5fab5fc2f --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/businessstatustype/vo/CrmBusinessStatusTypeUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 商机状态类型更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CrmBusinessStatusTypeUpdateReqVO extends CrmBusinessStatusTypeBaseVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24019") + @NotNull(message = "主键不能为空") + private Long id; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java new file mode 100644 index 000000000..c8b854144 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.crm.convert.businessstatus; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.*; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; + +/** + * 商机状态 Convert + * + * @author ljlleo + */ +@Mapper +public interface CrmBusinessStatusConvert { + + CrmBusinessStatusConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusConvert.class); + + CrmBusinessStatusDO convert(CrmBusinessStatusCreateReqVO bean); + + CrmBusinessStatusDO convert(CrmBusinessStatusUpdateReqVO bean); + + CrmBusinessStatusRespVO convert(CrmBusinessStatusDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java new file mode 100644 index 000000000..75f1aed4c --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.crm.convert.businessstatustype; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.*; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; + +/** + * 商机状态类型 Convert + * + * @author ljlleo + */ +@Mapper +public interface CrmBusinessStatusTypeConvert { + + CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); + + CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeCreateReqVO bean); + + CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeUpdateReqVO bean); + + CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java index 795ddad39..2d6454838 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java @@ -1,12 +1,13 @@ package cn.iocoder.yudao.module.crm.dal.dataobject.business; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; -import java.math.BigDecimal; import java.time.LocalDateTime; /** @@ -36,13 +37,13 @@ public class CrmBusinessDO extends BaseDO { /** * 商机状态类型编号 * - * TODO @ljileo:这个字段,后续要写下关联的实体哈 + * 关联 {@link CrmBusinessStatusTypeDO#getId()} */ private Long statusTypeId; /** * 商机状态编号 * - * TODO @ljileo:这个字段,后续要写下关联的实体哈 + * 关联 {@link CrmBusinessStatusDO#getId()} */ private Long statusId; /** @@ -62,21 +63,18 @@ public class CrmBusinessDO extends BaseDO { /** * 商机金额 * - * TODO @lijie:Integer */ - private BigDecimal price; + private Integer price; /** * 整单折扣 * - * TODO @lijie:Integer */ - private BigDecimal discountPercent; + private Integer discountPercent; /** * 产品总金额 * - * TODO @lijie:Integer */ - private BigDecimal productPrice; + private Integer productPrice; /** * 备注 */ diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatus/CrmBusinessStatusDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatus/CrmBusinessStatusDO.java new file mode 100644 index 000000000..a60c6e40d --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatus/CrmBusinessStatusDO.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus; + +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 商机状态 DO + * + * @author ljlleo + */ +@TableName("crm_business_status") +@KeySequence("crm_business_status_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CrmBusinessStatusDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 状态类型编号 + */ + private Long typeId; + /** + * 状态名 + */ + private String name; + /** + * 赢单率 + */ + private String percent; + /** + * 排序 + */ + private Integer sort; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatustype/CrmBusinessStatusTypeDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatustype/CrmBusinessStatusTypeDO.java new file mode 100644 index 000000000..4a2005e49 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/businessstatustype/CrmBusinessStatusTypeDO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype; + +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 商机状态类型 DO + * + * @author ljlleo + */ +@TableName("crm_business_status_type") +@KeySequence("crm_business_status_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CrmBusinessStatusTypeDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 状态类型名 + */ + private String name; + /** + * 使用的部门编号 + */ + private String deptIds; + /** + * 开启状态 + */ + private Boolean status; + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java index aadec8517..1429c0794 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessMapper.java +++ b/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 { default PageResult selectPage(CrmBusinessPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(CrmBusinessDO::getName, reqVO.getName()) - .eqIfPresent(CrmBusinessDO::getStatusTypeId, reqVO.getStatusTypeId()) - .eqIfPresent(CrmBusinessDO::getStatusId, reqVO.getStatusId()) - .betweenIfPresent(CrmBusinessDO::getContactNextTime, reqVO.getContactNextTime()) - .eqIfPresent(CrmBusinessDO::getCustomerId, reqVO.getCustomerId()) - .betweenIfPresent(CrmBusinessDO::getDealTime, reqVO.getDealTime()) - .eqIfPresent(CrmBusinessDO::getPrice, reqVO.getPrice()) - .eqIfPresent(CrmBusinessDO::getDiscountPercent, reqVO.getDiscountPercent()) - .eqIfPresent(CrmBusinessDO::getProductPrice, reqVO.getProductPrice()) - .eqIfPresent(CrmBusinessDO::getRemark, reqVO.getRemark()) - .eqIfPresent(CrmBusinessDO::getOwnerUserId, reqVO.getOwnerUserId()) - .betweenIfPresent(CrmBusinessDO::getCreateTime, reqVO.getCreateTime()) - .eqIfPresent(CrmBusinessDO::getRoUserIds, reqVO.getRoUserIds()) - .eqIfPresent(CrmBusinessDO::getRwUserIds, reqVO.getRwUserIds()) - .eqIfPresent(CrmBusinessDO::getEndStatus, reqVO.getEndStatus()) - .eqIfPresent(CrmBusinessDO::getEndRemark, reqVO.getEndRemark()) - .betweenIfPresent(CrmBusinessDO::getContactLastTime, reqVO.getContactLastTime()) - .eqIfPresent(CrmBusinessDO::getFollowUpStatus, reqVO.getFollowUpStatus()) .orderByDesc(CrmBusinessDO::getId)); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatus/CrmBusinessStatusMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatus/CrmBusinessStatusMapper.java new file mode 100644 index 000000000..2b9eeb4ae --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatus/CrmBusinessStatusMapper.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.crm.dal.mysql.businessstatus; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 商机状态 Mapper + * + * @author ljlleo + */ +@Mapper +public interface CrmBusinessStatusMapper extends BaseMapperX { + + default PageResult selectPage(CrmBusinessStatusPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) + .orderByDesc(CrmBusinessStatusDO::getId)); + } + + default List selectList(CrmBusinessStatusExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId()) + .likeIfPresent(CrmBusinessStatusDO::getName, reqVO.getName()) + .eqIfPresent(CrmBusinessStatusDO::getPercent, reqVO.getPercent()) + .eqIfPresent(CrmBusinessStatusDO::getSort, reqVO.getSort()) + .orderByDesc(CrmBusinessStatusDO::getId)); + } + + default List getBusinessStatusListByTypeId(Integer typeId) { + return selectList(CrmBusinessStatusDO::getTypeId, typeId); + } + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatustype/CrmBusinessStatusTypeMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatustype/CrmBusinessStatusTypeMapper.java new file mode 100644 index 000000000..bc23b2e8b --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/businessstatustype/CrmBusinessStatusTypeMapper.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 商机状态类型 Mapper + * + * @author ljlleo + */ +@Mapper +public interface CrmBusinessStatusTypeMapper extends BaseMapperX { + + default PageResult selectPage(CrmBusinessStatusTypePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) + .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) + .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) + .orderByDesc(CrmBusinessStatusTypeDO::getId)); + } + + default List selectList(CrmBusinessStatusTypeExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName()) + .eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds()) + .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus()) + .orderByDesc(CrmBusinessStatusTypeDO::getId)); + } + + default List getBusinessStatusTypeListByStatus(Integer status) { + return selectList(CrmBusinessStatusTypeDO::getStatus, status.byteValue()); + } + + + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusService.java new file mode 100644 index 000000000..a0dadcd17 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusService.java @@ -0,0 +1,90 @@ +package cn.iocoder.yudao.module.crm.service.businessstatus; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 商机状态 Service 接口 + * + * @author ljlleo + */ +public interface CrmBusinessStatusService { + + /** + * 创建商机状态 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createBusinessStatus(@Valid CrmBusinessStatusCreateReqVO createReqVO); + + /** + * 更新商机状态 + * + * @param updateReqVO 更新信息 + */ + void updateBusinessStatus(@Valid CrmBusinessStatusUpdateReqVO updateReqVO); + + /** + * 删除商机状态 + * + * @param id 编号 + */ + void deleteBusinessStatus(Long id); + + /** + * 获得商机状态 + * + * @param id 编号 + * @return 商机状态 + */ + CrmBusinessStatusDO getBusinessStatus(Long id); + + /** + * 获得商机状态列表 + * + * @param ids 编号 + * @return 商机状态列表 + */ + List getBusinessStatusList(Collection ids); + + /** + * 获得商机状态分页 + * + * @param pageReqVO 分页查询 + * @return 商机状态分页 + */ + PageResult getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO); + + /** + * 获得商机状态列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 商机状态列表 + */ + List getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO); + + /** + * 根据类型ID获得商机状态列表 + * + * @param typeId 商机状态类型ID + * @return 商机状态列表 + */ + List getBusinessStatusListByTypeId(Integer typeId); + + /** + * 获得商机状态列表 + * + * @return 商机状态列表 + */ + List getBusinessStatusList(); + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImpl.java new file mode 100644 index 000000000..e927fac74 --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImpl.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.crm.service.businessstatus; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; +import cn.iocoder.yudao.module.crm.convert.businessstatus.CrmBusinessStatusConvert; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatus.CrmBusinessStatusMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_NOT_EXISTS; + +/** + * 商机状态 Service 实现类 + * + * @author ljlleo + */ +@Service +@Validated +public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { + + @Resource + private CrmBusinessStatusMapper businessStatusMapper; + + @Override + public Long createBusinessStatus(CrmBusinessStatusCreateReqVO createReqVO) { + // 插入 + CrmBusinessStatusDO businessStatus = CrmBusinessStatusConvert.INSTANCE.convert(createReqVO); + businessStatusMapper.insert(businessStatus); + // 返回 + return businessStatus.getId(); + } + + @Override + public void updateBusinessStatus(CrmBusinessStatusUpdateReqVO updateReqVO) { + // 校验存在 + validateBusinessStatusExists(updateReqVO.getId()); + // 更新 + CrmBusinessStatusDO updateObj = CrmBusinessStatusConvert.INSTANCE.convert(updateReqVO); + businessStatusMapper.updateById(updateObj); + } + + @Override + public void deleteBusinessStatus(Long id) { + // 校验存在 + validateBusinessStatusExists(id); + // 删除 + businessStatusMapper.deleteById(id); + } + + private void validateBusinessStatusExists(Long id) { + if (businessStatusMapper.selectById(id) == null) { + throw exception(BUSINESS_STATUS_NOT_EXISTS); + } + } + + @Override + public CrmBusinessStatusDO getBusinessStatus(Long id) { + return businessStatusMapper.selectById(id); + } + + @Override + public List getBusinessStatusList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return ListUtil.empty(); + } + return businessStatusMapper.selectBatchIds(ids); + } + + @Override + public PageResult getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO) { + return businessStatusMapper.selectPage(pageReqVO); + } + + @Override + public List getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO) { + return businessStatusMapper.selectList(exportReqVO); + } + + @Override + public List getBusinessStatusListByTypeId(Integer typeId) { + return businessStatusMapper.getBusinessStatusListByTypeId(typeId); + } + + @Override + public List getBusinessStatusList() { + return businessStatusMapper.selectList(); + } +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeService.java new file mode 100644 index 000000000..3c473f62b --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeService.java @@ -0,0 +1,83 @@ +package cn.iocoder.yudao.module.crm.service.businessstatustype; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 商机状态类型 Service 接口 + * + * @author ljlleo + */ +public interface CrmBusinessStatusTypeService { + + /** + * 创建商机状态类型 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createBusinessStatusType(@Valid CrmBusinessStatusTypeCreateReqVO createReqVO); + + /** + * 更新商机状态类型 + * + * @param updateReqVO 更新信息 + */ + void updateBusinessStatusType(@Valid CrmBusinessStatusTypeUpdateReqVO updateReqVO); + + /** + * 删除商机状态类型 + * + * @param id 编号 + */ + void deleteBusinessStatusType(Long id); + + /** + * 获得商机状态类型 + * + * @param id 编号 + * @return 商机状态类型 + */ + CrmBusinessStatusTypeDO getBusinessStatusType(Long id); + + /** + * 获得商机状态类型列表 + * + * @param ids 编号 + * @return 商机状态类型列表 + */ + List getBusinessStatusTypeList(Collection ids); + + /** + * 获得商机状态类型分页 + * + * @param pageReqVO 分页查询 + * @return 商机状态类型分页 + */ + PageResult getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO); + + /** + * 获得商机状态类型列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 商机状态类型列表 + */ + List getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO); + + /** + * 获得商机状态类型列表 + * + * @param status 状态 + * @return 商机状态类型列表 + */ + List getBusinessStatusTypeListByStatus(Integer status); + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImpl.java new file mode 100644 index 000000000..88b25ad1e --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImpl.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.crm.service.businessstatustype; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; +import cn.iocoder.yudao.module.crm.convert.businessstatustype.CrmBusinessStatusTypeConvert; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; + +/** + * 商机状态类型 Service 实现类 + * + * @author ljlleo + */ +@Service +@Validated +public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeService { + + @Resource + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; + + @Override + public Long createBusinessStatusType(CrmBusinessStatusTypeCreateReqVO createReqVO) { + // 插入 + CrmBusinessStatusTypeDO businessStatusType = CrmBusinessStatusTypeConvert.INSTANCE.convert(createReqVO); + businessStatusTypeMapper.insert(businessStatusType); + // 返回 + return businessStatusType.getId(); + } + + @Override + public void updateBusinessStatusType(CrmBusinessStatusTypeUpdateReqVO updateReqVO) { + // 校验存在 + validateBusinessStatusTypeExists(updateReqVO.getId()); + // 更新 + CrmBusinessStatusTypeDO updateObj = CrmBusinessStatusTypeConvert.INSTANCE.convert(updateReqVO); + businessStatusTypeMapper.updateById(updateObj); + } + + @Override + public void deleteBusinessStatusType(Long id) { + // 校验存在 + validateBusinessStatusTypeExists(id); + // 删除 + businessStatusTypeMapper.deleteById(id); + } + + private void validateBusinessStatusTypeExists(Long id) { + if (businessStatusTypeMapper.selectById(id) == null) { + throw exception(BUSINESS_STATUS_TYPE_NOT_EXISTS); + } + } + + @Override + public CrmBusinessStatusTypeDO getBusinessStatusType(Long id) { + return businessStatusTypeMapper.selectById(id); + } + + @Override + public List getBusinessStatusTypeList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return ListUtil.empty(); + } + return businessStatusTypeMapper.selectBatchIds(ids); + } + + @Override + public PageResult getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO) { + return businessStatusTypeMapper.selectPage(pageReqVO); + } + + @Override + public List getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO) { + return businessStatusTypeMapper.selectList(exportReqVO); + } + + @Override + public List getBusinessStatusTypeListByStatus(Integer status) { + return businessStatusTypeMapper.getBusinessStatusTypeListByStatus(status); + } + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/businessstatustype/CrmBusinessStatusTypeMapper.xml b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/businessstatustype/CrmBusinessStatusTypeMapper.xml new file mode 100644 index 000000000..44fbd07ec --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/businessstatustype/CrmBusinessStatusTypeMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImplTest.java b/yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImplTest.java new file mode 100644 index 000000000..44030db3b --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatus/CrmBusinessStatusServiceImplTest.java @@ -0,0 +1,170 @@ +package cn.iocoder.yudao.module.crm.service.businessstatus; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusCreateReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusPageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatus.vo.CrmBusinessStatusUpdateReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO; +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatus.CrmBusinessStatusMapper; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_NOT_EXISTS; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link CrmBusinessStatusServiceImpl} 的单元测试类 + * + * @author ljlleo + */ +@Import(CrmBusinessStatusServiceImpl.class) +public class CrmBusinessStatusServiceImplTest extends BaseDbUnitTest { + + @Resource + private CrmBusinessStatusServiceImpl businessStatusService; + + @Resource + private CrmBusinessStatusMapper businessStatusMapper; + + @Test + public void testCreateBusinessStatus_success() { + // 准备参数 + CrmBusinessStatusCreateReqVO reqVO = randomPojo(CrmBusinessStatusCreateReqVO.class); + + // 调用 + Long businessStatusId = businessStatusService.createBusinessStatus(reqVO); + // 断言 + assertNotNull(businessStatusId); + // 校验记录的属性是否正确 + CrmBusinessStatusDO businessStatus = businessStatusMapper.selectById(businessStatusId); + assertPojoEquals(reqVO, businessStatus); + } + + @Test + public void testUpdateBusinessStatus_success() { + // mock 数据 + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class); + businessStatusMapper.insert(dbBusinessStatus);// @Sql: 先插入出一条存在的数据 + // 准备参数 + CrmBusinessStatusUpdateReqVO reqVO = randomPojo(CrmBusinessStatusUpdateReqVO.class, o -> { + o.setId(dbBusinessStatus.getId()); // 设置更新的 ID + }); + + // 调用 + businessStatusService.updateBusinessStatus(reqVO); + // 校验是否更新正确 + CrmBusinessStatusDO businessStatus = businessStatusMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, businessStatus); + } + + @Test + public void testUpdateBusinessStatus_notExists() { + // 准备参数 + CrmBusinessStatusUpdateReqVO reqVO = randomPojo(CrmBusinessStatusUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> businessStatusService.updateBusinessStatus(reqVO), BUSINESS_STATUS_NOT_EXISTS); + } + + @Test + public void testDeleteBusinessStatus_success() { + // mock 数据 + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class); + businessStatusMapper.insert(dbBusinessStatus);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbBusinessStatus.getId(); + + // 调用 + businessStatusService.deleteBusinessStatus(id); + // 校验数据不存在了 + assertNull(businessStatusMapper.selectById(id)); + } + + @Test + public void testDeleteBusinessStatus_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> businessStatusService.deleteBusinessStatus(id), BUSINESS_STATUS_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetBusinessStatusPage() { + // mock 数据 + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class, o -> { // 等会查询到 + o.setTypeId(null); + o.setName(null); + o.setPercent(null); + o.setSort(null); + }); + businessStatusMapper.insert(dbBusinessStatus); + // 测试 typeId 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setTypeId(null))); + // 测试 name 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setName(null))); + // 测试 percent 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setPercent(null))); + // 测试 sort 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setSort(null))); + // 准备参数 + CrmBusinessStatusPageReqVO reqVO = new CrmBusinessStatusPageReqVO(); + reqVO.setTypeId(null); + reqVO.setName(null); + reqVO.setPercent(null); + reqVO.setSort(null); + + // 调用 + PageResult pageResult = businessStatusService.getBusinessStatusPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbBusinessStatus, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetBusinessStatusList() { + // mock 数据 + CrmBusinessStatusDO dbBusinessStatus = randomPojo(CrmBusinessStatusDO.class, o -> { // 等会查询到 + o.setTypeId(null); + o.setName(null); + o.setPercent(null); + o.setSort(null); + }); + businessStatusMapper.insert(dbBusinessStatus); + // 测试 typeId 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setTypeId(null))); + // 测试 name 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setName(null))); + // 测试 percent 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setPercent(null))); + // 测试 sort 不匹配 + businessStatusMapper.insert(cloneIgnoreId(dbBusinessStatus, o -> o.setSort(null))); + // 准备参数 + CrmBusinessStatusExportReqVO reqVO = new CrmBusinessStatusExportReqVO(); + reqVO.setTypeId(null); + reqVO.setName(null); + reqVO.setPercent(null); + reqVO.setSort(null); + + // 调用 + List list = businessStatusService.getBusinessStatusList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbBusinessStatus, list.get(0)); + } + +} diff --git a/yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImplTest.java b/yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImplTest.java new file mode 100644 index 000000000..58f054b1c --- /dev/null +++ b/yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/businessstatustype/CrmBusinessStatusTypeServiceImplTest.java @@ -0,0 +1,171 @@ +package cn.iocoder.yudao.module.crm.service.businessstatustype; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeCreateReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeExportReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypePageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.businessstatustype.vo.CrmBusinessStatusTypeUpdateReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO; +import cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_STATUS_TYPE_NOT_EXISTS; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link CrmBusinessStatusTypeServiceImpl} 的单元测试类 + * + * @author ljlleo + */ +@Import(CrmBusinessStatusTypeServiceImpl.class) +public class CrmBusinessStatusTypeServiceImplTest extends BaseDbUnitTest { + + @Resource + private CrmBusinessStatusTypeServiceImpl businessStatusTypeService; + + @Resource + private CrmBusinessStatusTypeMapper businessStatusTypeMapper; + + @Test + public void testCreateBusinessStatusType_success() { + // 准备参数 + CrmBusinessStatusTypeCreateReqVO reqVO = randomPojo(CrmBusinessStatusTypeCreateReqVO.class); + + // 调用 + Long businessStatusTypeId = businessStatusTypeService.createBusinessStatusType(reqVO); + // 断言 + assertNotNull(businessStatusTypeId); + // 校验记录的属性是否正确 + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(businessStatusTypeId); + assertPojoEquals(reqVO, businessStatusType); + } + + @Test + public void testUpdateBusinessStatusType_success() { + // mock 数据 + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 + // 准备参数 + CrmBusinessStatusTypeUpdateReqVO reqVO = randomPojo(CrmBusinessStatusTypeUpdateReqVO.class, o -> { + o.setId(dbBusinessStatusType.getId()); // 设置更新的 ID + }); + + // 调用 + businessStatusTypeService.updateBusinessStatusType(reqVO); + // 校验是否更新正确 + CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, businessStatusType); + } + + @Test + public void testUpdateBusinessStatusType_notExists() { + // 准备参数 + CrmBusinessStatusTypeUpdateReqVO reqVO = randomPojo(CrmBusinessStatusTypeUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> businessStatusTypeService.updateBusinessStatusType(reqVO), BUSINESS_STATUS_TYPE_NOT_EXISTS); + } + + @Test + public void testDeleteBusinessStatusType_success() { + // mock 数据 + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class); + businessStatusTypeMapper.insert(dbBusinessStatusType);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbBusinessStatusType.getId(); + + // 调用 + businessStatusTypeService.deleteBusinessStatusType(id); + // 校验数据不存在了 + assertNull(businessStatusTypeMapper.selectById(id)); + } + + @Test + public void testDeleteBusinessStatusType_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> businessStatusTypeService.deleteBusinessStatusType(id), BUSINESS_STATUS_TYPE_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetBusinessStatusTypePage() { + // mock 数据 + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 + o.setName(null); + o.setDeptIds(null); + o.setStatus(null); + o.setCreateTime(null); + }); + businessStatusTypeMapper.insert(dbBusinessStatusType); + // 测试 name 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setName(null))); + // 测试 deptIds 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setDeptIds(null))); + // 测试 status 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setStatus(null))); + // 测试 createTime 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setCreateTime(null))); + // 准备参数 + CrmBusinessStatusTypePageReqVO reqVO = new CrmBusinessStatusTypePageReqVO(); + reqVO.setName(null); + reqVO.setDeptIds(null); + reqVO.setStatus(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + PageResult pageResult = businessStatusTypeService.getBusinessStatusTypePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbBusinessStatusType, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetBusinessStatusTypeList() { + // mock 数据 + CrmBusinessStatusTypeDO dbBusinessStatusType = randomPojo(CrmBusinessStatusTypeDO.class, o -> { // 等会查询到 + o.setName(null); + o.setDeptIds(null); + o.setStatus(null); + o.setCreateTime(null); + }); + businessStatusTypeMapper.insert(dbBusinessStatusType); + // 测试 name 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setName(null))); + // 测试 deptIds 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setDeptIds(null))); + // 测试 status 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setStatus(null))); + // 测试 createTime 不匹配 + businessStatusTypeMapper.insert(cloneIgnoreId(dbBusinessStatusType, o -> o.setCreateTime(null))); + // 准备参数 + CrmBusinessStatusTypeExportReqVO reqVO = new CrmBusinessStatusTypeExportReqVO(); + reqVO.setName(null); + reqVO.setDeptIds(null); + reqVO.setStatus(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + List list = businessStatusTypeService.getBusinessStatusTypeList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbBusinessStatusType, list.get(0)); + } + +} diff --git a/yudao-ui-admin/src/api/crm/business.js b/yudao-ui-admin/src/api/crm/business.js new file mode 100644 index 000000000..24789df72 --- /dev/null +++ b/yudao-ui-admin/src/api/crm/business.js @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// 创建商机 +export function createBusiness(data) { + return request({ + url: '/crm/business/create', + method: 'post', + data: data + }) +} + +// 更新商机 +export function updateBusiness(data) { + return request({ + url: '/crm/business/update', + method: 'put', + data: data + }) +} + +// 删除商机 +export function deleteBusiness(id) { + return request({ + url: '/crm/business/delete?id=' + id, + method: 'delete' + }) +} + +// 获得商机 +export function getBusiness(id) { + return request({ + url: '/crm/business/get?id=' + id, + method: 'get' + }) +} + +// 获得商机分页 +export function getBusinessPage(query) { + return request({ + url: '/crm/business/page', + method: 'get', + params: query + }) +} + +// 导出商机 Excel +export function exportBusinessExcel(query) { + return request({ + url: '/crm/business/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} diff --git a/yudao-ui-admin/src/api/crm/businessStatus.js b/yudao-ui-admin/src/api/crm/businessStatus.js new file mode 100644 index 000000000..d4249d7ac --- /dev/null +++ b/yudao-ui-admin/src/api/crm/businessStatus.js @@ -0,0 +1,70 @@ +import request from '@/utils/request' + +// 创建商机状态 +export function createBusinessStatus(data) { + return request({ + url: '/crm/business-status/create', + method: 'post', + data: data + }) +} + +// 更新商机状态 +export function updateBusinessStatus(data) { + return request({ + url: '/crm/business-status/update', + method: 'put', + data: data + }) +} + +// 删除商机状态 +export function deleteBusinessStatus(id) { + return request({ + url: '/crm/business-status/delete?id=' + id, + method: 'delete' + }) +} + +// 获得商机状态 +export function getBusinessStatus(id) { + return request({ + url: '/crm/business-status/get?id=' + id, + method: 'get' + }) +} + +// 获得商机状态分页 +export function getBusinessStatusPage(query) { + return request({ + url: '/crm/business-status/page', + method: 'get', + params: query + }) +} + +// 导出商机状态 Excel +export function exportBusinessStatusExcel(query) { + return request({ + url: '/crm/business-status/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} + +// 根据类型ID获取商机状态信息列表 +export function getBusinessStatusListByTypeId(typeId) { + return request({ + url: '/crm/business-status/get-simple-list?typeId=' + typeId, + method: 'get' + }) +} + +// 获取商机状态信息列表 +export function getBusinessStatusList() { + return request({ + url: '/crm/business-status/get-all-list', + method: 'get' + }) +} diff --git a/yudao-ui-admin/src/api/crm/businessStatusType.js b/yudao-ui-admin/src/api/crm/businessStatusType.js new file mode 100644 index 000000000..5df0aff6c --- /dev/null +++ b/yudao-ui-admin/src/api/crm/businessStatusType.js @@ -0,0 +1,62 @@ +import request from '@/utils/request' + +// 创建商机状态类型 +export function createBusinessStatusType(data) { + return request({ + url: '/crm/business-status-type/create', + method: 'post', + data: data + }) +} + +// 更新商机状态类型 +export function updateBusinessStatusType(data) { + return request({ + url: '/crm/business-status-type/update', + method: 'put', + data: data + }) +} + +// 删除商机状态类型 +export function deleteBusinessStatusType(id) { + return request({ + url: '/crm/business-status-type/delete?id=' + id, + method: 'delete' + }) +} + +// 获得商机状态类型 +export function getBusinessStatusType(id) { + return request({ + url: '/crm/business-status-type/get?id=' + id, + method: 'get' + }) +} + +// 获得商机状态类型分页 +export function getBusinessStatusTypePage(query) { + return request({ + url: '/crm/business-status-type/page', + method: 'get', + params: query + }) +} + +// 导出商机状态类型 Excel +export function exportBusinessStatusTypeExcel(query) { + return request({ + url: '/crm/business-status-type/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} + +// 获取商机状态类型信息列表 +export function getBusinessStatusTypeList() { + return request({ + url: '/crm/business-status-type/get-simple-list', + method: 'get' + }) +} diff --git a/yudao-ui-admin/src/views/crm/business/index.vue b/yudao-ui-admin/src/views/crm/business/index.vue new file mode 100644 index 000000000..b877a33af --- /dev/null +++ b/yudao-ui-admin/src/views/crm/business/index.vue @@ -0,0 +1,335 @@ + + +