mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
Merge branch 'feature/crm' of https://gitee.com/ljlleo/ruoyi-vue-pro into feature/crm
# Conflicts: # sql/mysql/crm.sql
This commit is contained in:
commit
bf247a6626
@ -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='客户表';
|
||||
) 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='商机状态类型表'
|
||||
|
@ -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, "联系人不存在");
|
||||
|
@ -71,6 +71,7 @@ public class CrmBusinessController {
|
||||
@PreAuthorize("@ss.hasPermission('crm:business:query')")
|
||||
public CommonResult<PageResult<CrmBusinessRespVO>> getBusinessPage(@Valid CrmBusinessPageReqVO pageVO) {
|
||||
PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(pageVO);
|
||||
|
||||
return success(CrmBusinessConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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<Long> createBusinessStatus(@Valid @RequestBody CrmBusinessStatusCreateReqVO createReqVO) {
|
||||
return success(businessStatusService.createBusinessStatus(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新商机状态")
|
||||
@PreAuthorize("@ss.hasPermission('crm:business-status:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<CrmBusinessStatusRespVO> 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<List<CrmBusinessStatusRespVO>> getBusinessStatusList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(ids);
|
||||
return success(CrmBusinessStatusConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得商机状态分页")
|
||||
@PreAuthorize("@ss.hasPermission('crm:business-status:query')")
|
||||
public CommonResult<PageResult<CrmBusinessStatusRespVO>> getBusinessStatusPage(@Valid CrmBusinessStatusPageReqVO pageVO) {
|
||||
PageResult<CrmBusinessStatusDO> 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<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<CrmBusinessStatusExcelVO> 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<List<CrmBusinessStatusRespVO>> getBusinessStatusListByTypeId(@RequestParam("typeId") Integer typeId) {
|
||||
List<CrmBusinessStatusDO> 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<List<CrmBusinessStatusRespVO>> getBusinessStatusList() {
|
||||
List<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList();
|
||||
return success(CrmBusinessStatusConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<Long> createBusinessStatusType(@Valid @RequestBody CrmBusinessStatusTypeCreateReqVO createReqVO) {
|
||||
return success(businessStatusTypeService.createBusinessStatusType(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新商机状态类型")
|
||||
@PreAuthorize("@ss.hasPermission('crm:business-status-type:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<CrmBusinessStatusTypeRespVO> 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<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(ids);
|
||||
return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得商机状态类型分页")
|
||||
@PreAuthorize("@ss.hasPermission('crm:business-status-type:query')")
|
||||
public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageVO) {
|
||||
PageResult<CrmBusinessStatusTypeDO> 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<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<CrmBusinessStatusTypeExcelVO> 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<List<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypeList() {
|
||||
List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
return success(CrmBusinessStatusTypeConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<CrmBusinessStatusRespVO> convertList(List<CrmBusinessStatusDO> list);
|
||||
|
||||
PageResult<CrmBusinessStatusRespVO> convertPage(PageResult<CrmBusinessStatusDO> page);
|
||||
|
||||
List<CrmBusinessStatusExcelVO> convertList02(List<CrmBusinessStatusDO> list);
|
||||
|
||||
}
|
@ -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<CrmBusinessStatusTypeRespVO> convertList(List<CrmBusinessStatusTypeDO> list);
|
||||
|
||||
PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page);
|
||||
|
||||
List<CrmBusinessStatusTypeExcelVO> convertList02(List<CrmBusinessStatusTypeDO> list);
|
||||
|
||||
}
|
@ -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;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -21,23 +21,6 @@ public interface CrmBusinessMapper extends BaseMapperX<CrmBusinessDO> {
|
||||
default PageResult<CrmBusinessDO> selectPage(CrmBusinessPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
|
@ -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<CrmBusinessStatusDO> {
|
||||
|
||||
default PageResult<CrmBusinessStatusDO> selectPage(CrmBusinessStatusPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusDO>()
|
||||
.eqIfPresent(CrmBusinessStatusDO::getTypeId, reqVO.getTypeId())
|
||||
.orderByDesc(CrmBusinessStatusDO::getId));
|
||||
}
|
||||
|
||||
default List<CrmBusinessStatusDO> selectList(CrmBusinessStatusExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<CrmBusinessStatusDO>()
|
||||
.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<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) {
|
||||
return selectList(CrmBusinessStatusDO::getTypeId, typeId);
|
||||
}
|
||||
|
||||
}
|
@ -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<CrmBusinessStatusTypeDO> {
|
||||
|
||||
default PageResult<CrmBusinessStatusTypeDO> selectPage(CrmBusinessStatusTypePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>()
|
||||
.likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds())
|
||||
.eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(CrmBusinessStatusTypeDO::getId));
|
||||
}
|
||||
|
||||
default List<CrmBusinessStatusTypeDO> selectList(CrmBusinessStatusTypeExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<CrmBusinessStatusTypeDO>()
|
||||
.likeIfPresent(CrmBusinessStatusTypeDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CrmBusinessStatusTypeDO::getDeptIds, reqVO.getDeptIds())
|
||||
.eqIfPresent(CrmBusinessStatusTypeDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(CrmBusinessStatusTypeDO::getId));
|
||||
}
|
||||
|
||||
default List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) {
|
||||
return selectList(CrmBusinessStatusTypeDO::getStatus, status.byteValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -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<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得商机状态分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 商机状态分页
|
||||
*/
|
||||
PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得商机状态列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 商机状态列表
|
||||
*/
|
||||
List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 根据类型ID获得商机状态列表
|
||||
*
|
||||
* @param typeId 商机状态类型ID
|
||||
* @return 商机状态列表
|
||||
*/
|
||||
List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId);
|
||||
|
||||
/**
|
||||
* 获得商机状态列表
|
||||
*
|
||||
* @return 商机状态列表
|
||||
*/
|
||||
List<CrmBusinessStatusDO> getBusinessStatusList();
|
||||
|
||||
}
|
@ -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<CrmBusinessStatusDO> getBusinessStatusList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return businessStatusMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CrmBusinessStatusDO> getBusinessStatusPage(CrmBusinessStatusPageReqVO pageReqVO) {
|
||||
return businessStatusMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CrmBusinessStatusDO> getBusinessStatusList(CrmBusinessStatusExportReqVO exportReqVO) {
|
||||
return businessStatusMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CrmBusinessStatusDO> getBusinessStatusListByTypeId(Integer typeId) {
|
||||
return businessStatusMapper.getBusinessStatusListByTypeId(typeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CrmBusinessStatusDO> getBusinessStatusList() {
|
||||
return businessStatusMapper.selectList();
|
||||
}
|
||||
}
|
@ -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<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得商机状态类型分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 商机状态类型分页
|
||||
*/
|
||||
PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得商机状态类型列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 商机状态类型列表
|
||||
*/
|
||||
List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 获得商机状态类型列表
|
||||
*
|
||||
* @param status 状态
|
||||
* @return 商机状态类型列表
|
||||
*/
|
||||
List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status);
|
||||
|
||||
}
|
@ -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<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
return businessStatusTypeMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(CrmBusinessStatusTypePageReqVO pageReqVO) {
|
||||
return businessStatusTypeMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList(CrmBusinessStatusTypeExportReqVO exportReqVO) {
|
||||
return businessStatusTypeMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeListByStatus(Integer status) {
|
||||
return businessStatusTypeMapper.getBusinessStatusTypeListByStatus(status);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.businessstatustype.CrmBusinessStatusTypeMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -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<CrmBusinessStatusDO> 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<CrmBusinessStatusDO> list = businessStatusService.getBusinessStatusList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbBusinessStatus, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -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<CrmBusinessStatusTypeDO> 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<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbBusinessStatusType, list.get(0));
|
||||
}
|
||||
|
||||
}
|
54
yudao-ui-admin/src/api/crm/business.js
Normal file
54
yudao-ui-admin/src/api/crm/business.js
Normal file
@ -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'
|
||||
})
|
||||
}
|
70
yudao-ui-admin/src/api/crm/businessStatus.js
Normal file
70
yudao-ui-admin/src/api/crm/businessStatus.js
Normal file
@ -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'
|
||||
})
|
||||
}
|
62
yudao-ui-admin/src/api/crm/businessStatusType.js
Normal file
62
yudao-ui-admin/src/api/crm/businessStatusType.js
Normal file
@ -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'
|
||||
})
|
||||
}
|
335
yudao-ui-admin/src/views/crm/business/index.vue
Normal file
335
yudao-ui-admin/src/views/crm/business/index.vue
Normal file
@ -0,0 +1,335 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="商机名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入商机名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['crm:business:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['crm:business:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="商机名称" align="center" prop="name" />
|
||||
<el-table-column label="客户名称" align="center" prop="customerId" />
|
||||
<el-table-column label="商机金额" align="center" prop="price" />
|
||||
<el-table-column label="预计成交日期" align="center" prop="dealTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.dealTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="商机状态类型" align="center" prop="statusTypeId" width="120">
|
||||
<template v-slot="scope">
|
||||
<el-tag> {{getBusinessStatusTypeName(scope.row.statusTypeId)}} </el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商机状态" align="center" prop="statusId" width="100">
|
||||
<template v-slot="scope">
|
||||
<el-tag> {{getBusinessStatusName(scope.row.statusId)}} </el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.updateTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="负责人" align="center" prop="ownerUserId" />
|
||||
<el-table-column label="创建人" align="center" prop="creator" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['crm:business:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['crm:business:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="商机名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入商机名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户编号" prop="customerId">
|
||||
<el-input v-model="form.customerId" placeholder="请输入客户编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商机状态类型" prop="statusTypeId">
|
||||
<el-select v-model="form.statusTypeId" placeholder="请选择商机状态类型" clearable size="small" @change="changeBusinessStatusType">
|
||||
<el-option v-for="item in businessStatusTypeList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商机状态" prop="statusId">
|
||||
<el-select v-model="form.statusId" placeholder="请选择商机状态" clearable size="small">
|
||||
<el-option v-for="item in businessStatusList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="预计成交日期" prop="dealTime">
|
||||
<el-date-picker clearable v-model="form.dealTime" type="date" value-format="timestamp" placeholder="选择预计成交日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商机金额" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入商机金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="整单折扣(%)" prop="discountPercent">
|
||||
<el-input v-model="form.discountPercent" placeholder="请输入整单折扣" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品总金额" prop="productPrice">
|
||||
<el-input v-model="form.productPrice" placeholder="请输入产品总金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createBusiness, updateBusiness, deleteBusiness, getBusiness, getBusinessPage, exportBusinessExcel } from "@/api/crm/business";
|
||||
import { getBusinessStatusListByTypeId, getBusinessStatusList } from "@/api/crm/businessStatus";
|
||||
import { getBusinessStatusTypeList } from "@/api/crm/businessStatusType";
|
||||
|
||||
export default {
|
||||
name: "Business",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商机列表
|
||||
list: [],
|
||||
// 根据类型ID获取的商机状态列表
|
||||
businessStatusList: [],
|
||||
// 所有商机状态列表
|
||||
businessStatusAllList: [],
|
||||
// 商机状态类型列表
|
||||
businessStatusTypeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
statusTypeId: null,
|
||||
statusId: null,
|
||||
contactNextTime: [],
|
||||
customerId: null,
|
||||
dealTime: [],
|
||||
price: null,
|
||||
discountPercent: null,
|
||||
productPrice: null,
|
||||
remark: null,
|
||||
ownerUserId: null,
|
||||
createTime: [],
|
||||
roUserIds: null,
|
||||
rwUserIds: null,
|
||||
endStatus: null,
|
||||
endRemark: null,
|
||||
contactLastTime: [],
|
||||
followUpStatus: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "商机名称不能为空", trigger: "blur" }],
|
||||
customerId: [{ required: true, message: "客户编号不能为空", trigger: "blur" }],
|
||||
roUserIds: [{ required: true, message: "只读权限的用户编号数组不能为空", trigger: "blur" }],
|
||||
rwUserIds: [{ required: true, message: "读写权限的用户编号数组不能为空", trigger: "blur" }],
|
||||
endStatus: [{ required: true, message: "1赢单2输单3无效不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getBusinessPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
//查询商机状态类型集合
|
||||
getBusinessStatusTypeList().then(response => {
|
||||
this.businessStatusTypeList = response.data;
|
||||
});
|
||||
//查询商机状态类型集合
|
||||
getBusinessStatusList().then(response => {
|
||||
this.businessStatusAllList = response.data;
|
||||
});
|
||||
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
statusTypeId: undefined,
|
||||
statusId: undefined,
|
||||
contactNextTime: undefined,
|
||||
customerId: undefined,
|
||||
dealTime: undefined,
|
||||
price: undefined,
|
||||
discountPercent: undefined,
|
||||
productPrice: undefined,
|
||||
remark: undefined,
|
||||
ownerUserId: undefined,
|
||||
roUserIds: undefined,
|
||||
rwUserIds: undefined,
|
||||
endStatus: undefined,
|
||||
endRemark: undefined,
|
||||
contactLastTime: undefined,
|
||||
followUpStatus: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商机";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getBusiness(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商机";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateBusiness(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createBusiness(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除商机编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteBusiness(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有商机数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportBusinessExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '商机.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 选择商机状态类型事件 */
|
||||
changeBusinessStatusType (id) {
|
||||
//查询商机状态集合
|
||||
getBusinessStatusListByTypeId(id).then(response => {
|
||||
this.businessStatusList = response.data;
|
||||
});
|
||||
},
|
||||
/** 商机状态类型名格式化 */
|
||||
getBusinessStatusTypeName(typeId) {
|
||||
for (const item of this.businessStatusTypeList) {
|
||||
if (item.id === typeId) {
|
||||
return item.name;
|
||||
}
|
||||
}
|
||||
return '未知';
|
||||
},
|
||||
/** 商机状态名格式化 */
|
||||
getBusinessStatusName(id) {
|
||||
for (const item of this.businessStatusAllList) {
|
||||
if (item.id === id) {
|
||||
return item.name;
|
||||
}
|
||||
}
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user