Commit 71574da2cf0319fb47f39443e4cd2cc82fd4a3ed
1 parent
4235beec
feat: CRM 客户公海配置
Showing
13 changed files
with
262 additions
and
9 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.http deleted
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerPoolConfigController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigRespVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | |
| 8 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 12 | +import org.springframework.validation.annotation.Validated; | |
| 13 | +import org.springframework.web.bind.annotation.*; | |
| 14 | + | |
| 15 | +import javax.annotation.Resource; | |
| 16 | +import javax.validation.Valid; | |
| 17 | + | |
| 18 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 19 | + | |
| 20 | +@Tag(name = "管理后台 - CRM 客户公海配置") | |
| 21 | +@RestController | |
| 22 | +@RequestMapping("/crm/customer-pool-config") | |
| 23 | +@Validated | |
| 24 | +public class CrmCustomerPoolConfigController { | |
| 25 | + | |
| 26 | + @Resource | |
| 27 | + private CrmCustomerPoolConfigService customerPoolConfigService; | |
| 28 | + | |
| 29 | + @GetMapping("/get") | |
| 30 | + @Operation(summary = "获取客户公海规则设置") | |
| 31 | + @PreAuthorize("@ss.hasPermission('crm:customer-pool-config:query')") | |
| 32 | + public CommonResult<CrmCustomerPoolConfigRespVO> getCustomerPoolConfig() { | |
| 33 | + CrmCustomerPoolConfigDO customerPoolConfig = customerPoolConfigService.getCustomerPoolConfig(); | |
| 34 | + return success(CrmCustomerConvert.INSTANCE.convert(customerPoolConfig)); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @PutMapping("/update") | |
| 38 | + @Operation(summary = "更新客户公海规则设置") | |
| 39 | + @PreAuthorize("@ss.hasPermission('crm:customer-pool-config:update')") | |
| 40 | + public CommonResult<Boolean> updateCustomerPoolConfig(@Valid @RequestBody CrmCustomerPoolConfigUpdateReqVO updateReqVO) { | |
| 41 | + customerPoolConfigService.updateCustomerPoolConfig(updateReqVO); | |
| 42 | + return success(true); | |
| 43 | + } | |
| 44 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPoolConfigBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 客户公海配置 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 10 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 11 | + */ | |
| 12 | +@Data | |
| 13 | +public class CrmCustomerPoolConfigBaseVO { | |
| 14 | + | |
| 15 | + @Schema(description = "是否启用客户公海", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 16 | + @NotNull(message = "是否启用客户公海不能为空") | |
| 17 | + private Boolean enabled; | |
| 18 | + | |
| 19 | + @Schema(description = "未跟进放入公海天数", example = "2") | |
| 20 | + private Integer contactExpireDays; | |
| 21 | + | |
| 22 | + @Schema(description = "未成交放入公海天数", example = "2") | |
| 23 | + private Integer dealExpireDays; | |
| 24 | + | |
| 25 | + @Schema(description = "是否开启提前提醒", example = "true") | |
| 26 | + private Boolean notifyEnabled; | |
| 27 | + | |
| 28 | + @Schema(description = "提前提醒天数", example = "2") | |
| 29 | + private Integer notifyDays; | |
| 30 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPoolConfigRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - CRM 客户公海规则 Response VO") | |
| 9 | +@Data | |
| 10 | +@EqualsAndHashCode(callSuper = true) | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class CrmCustomerPoolConfigRespVO extends CrmCustomerPoolConfigBaseVO { | |
| 13 | + | |
| 14 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerPoolConfigUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - CRM 客户更新 Request VO") | |
| 9 | +@Data | |
| 10 | +@EqualsAndHashCode(callSuper = true) | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class CrmCustomerPoolConfigUpdateReqVO extends CrmCustomerPoolConfigBaseVO { | |
| 13 | + | |
| 14 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.convert.customer; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.lang.tree.Node; | |
| 3 | 4 | import cn.hutool.core.util.NumberUtil; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 6 | 7 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 7 | 8 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| 8 | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | |
| 9 | 11 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmTransferPermissionReqBO; |
| 10 | 12 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| 11 | 13 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| ... | ... | @@ -60,4 +62,7 @@ public interface CrmCustomerConvert { |
| 60 | 62 | }) |
| 61 | 63 | CrmTransferPermissionReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId); |
| 62 | 64 | |
| 65 | + CrmCustomerPoolConfigRespVO convert(CrmCustomerPoolConfigDO customerPoolConfig); | |
| 66 | + | |
| 67 | + CrmCustomerPoolConfigDO convert(CrmCustomerPoolConfigUpdateReqVO updateReqVO); | |
| 63 | 68 | } | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerDO.java
| ... | ... | @@ -15,7 +15,7 @@ import java.time.LocalDateTime; |
| 15 | 15 | * |
| 16 | 16 | * @author Wanwan |
| 17 | 17 | */ |
| 18 | -@TableName(value = "crm_customer", autoResultMap = true) | |
| 18 | +@TableName(value = "crm_customer") | |
| 19 | 19 | @KeySequence("crm_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 20 | 20 | @Data |
| 21 | 21 | @EqualsAndHashCode(callSuper = true) | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/customer/CrmCustomerPoolConfigDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 客户公海配置 DO | |
| 11 | + * | |
| 12 | + * @author Wanwan | |
| 13 | + */ | |
| 14 | +@TableName(value = "crm_customer_pool_config") | |
| 15 | +@KeySequence("crm_customer_pool_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 16 | +@Data | |
| 17 | +@EqualsAndHashCode(callSuper = true) | |
| 18 | +@ToString(callSuper = true) | |
| 19 | +@Builder | |
| 20 | +@NoArgsConstructor | |
| 21 | +@AllArgsConstructor | |
| 22 | +public class CrmCustomerPoolConfigDO extends BaseDO { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 编号 | |
| 26 | + */ | |
| 27 | + @TableId | |
| 28 | + private Long id; | |
| 29 | + /** | |
| 30 | + * 是否启用客户公海 | |
| 31 | + */ | |
| 32 | + private Boolean enabled; | |
| 33 | + /** | |
| 34 | + * 未跟进放入公海天数 | |
| 35 | + */ | |
| 36 | + private Integer contactExpireDays; | |
| 37 | + /** | |
| 38 | + * 未成交放入公海天数 | |
| 39 | + */ | |
| 40 | + private Integer dealExpireDays; | |
| 41 | + /** | |
| 42 | + * 是否开启提前提醒 | |
| 43 | + */ | |
| 44 | + private Boolean notifyEnabled; | |
| 45 | + /** | |
| 46 | + * 提前提醒天数 | |
| 47 | + */ | |
| 48 | + private Integer notifyDays; | |
| 49 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerPoolConfigMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | |
| 5 | +import org.apache.ibatis.annotations.Mapper; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 客户公海配置 Mapper | |
| 9 | + * | |
| 10 | + * @author Wanwan | |
| 11 | + */ | |
| 12 | +@Mapper | |
| 13 | +public interface CrmCustomerPoolConfigMapper extends BaseMapperX<CrmCustomerPoolConfigDO> { | |
| 14 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO; | |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | |
| 5 | + | |
| 6 | +import javax.validation.Valid; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 客户公海配置 Service 接口 | |
| 10 | + * | |
| 11 | + * @author Wanwan | |
| 12 | + */ | |
| 13 | +public interface CrmCustomerPoolConfigService { | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 获得客户公海配置 | |
| 17 | + * | |
| 18 | + * @return 客户公海配置 | |
| 19 | + */ | |
| 20 | + CrmCustomerPoolConfigDO getCustomerPoolConfig(); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 保存客户公海配置 | |
| 24 | + * | |
| 25 | + * @param saveReqVO 更新信息 | |
| 26 | + */ | |
| 27 | + void updateCustomerPoolConfig(@Valid CrmCustomerPoolConfigUpdateReqVO saveReqVO); | |
| 28 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerPoolConfigServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.customer; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | |
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; | |
| 7 | +import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerPoolConfigMapper; | |
| 8 | +import org.springframework.stereotype.Service; | |
| 9 | +import org.springframework.validation.annotation.Validated; | |
| 10 | + | |
| 11 | +import javax.annotation.Resource; | |
| 12 | +import java.util.Objects; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 客户公海配置 Service 实现类 | |
| 16 | + * | |
| 17 | + * @author Wanwan | |
| 18 | + */ | |
| 19 | +@Service | |
| 20 | +@Validated | |
| 21 | +public class CrmCustomerPoolConfigServiceImpl implements CrmCustomerPoolConfigService { | |
| 22 | + @Resource | |
| 23 | + private CrmCustomerPoolConfigMapper customerPoolConfigMapper; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 获得客户公海配置 | |
| 27 | + * | |
| 28 | + * @return 客户公海配置 | |
| 29 | + */ | |
| 30 | + @Override | |
| 31 | + public CrmCustomerPoolConfigDO getCustomerPoolConfig() { | |
| 32 | + return customerPoolConfigMapper.selectOne(new LambdaQueryWrapperX<CrmCustomerPoolConfigDO>().last("LIMIT 1")); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 保存客户公海配置 | |
| 37 | + * | |
| 38 | + * @param saveReqVO 更新信息 | |
| 39 | + */ | |
| 40 | + @Override | |
| 41 | + public void updateCustomerPoolConfig(CrmCustomerPoolConfigUpdateReqVO saveReqVO) { | |
| 42 | + // 存在,则进行更新 | |
| 43 | + CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig(); | |
| 44 | + if (Objects.nonNull(dbConfig)) { | |
| 45 | + customerPoolConfigMapper.updateById(CrmCustomerConvert.INSTANCE.convert(saveReqVO).setId(dbConfig.getId())); | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + // 不存在,则进行插入 | |
| 49 | + customerPoolConfigMapper.insert(CrmCustomerConvert.INSTANCE.convert(saveReqVO)); | |
| 50 | + } | |
| 51 | +} | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.customer; |
| 2 | 2 | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.collection.ListUtil; | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| 7 | 5 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; |
| ... | ... | @@ -12,13 +10,11 @@ import cn.iocoder.yudao.module.crm.framework.enums.CrmBizTypeEnum; |
| 12 | 10 | import cn.iocoder.yudao.module.crm.framework.enums.CrmPermissionLevelEnum; |
| 13 | 11 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 14 | 12 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 15 | -import cn.iocoder.yudao.module.system.api.dept.DeptApi; | |
| 16 | 13 | import org.springframework.stereotype.Service; |
| 17 | 14 | import org.springframework.transaction.annotation.Transactional; |
| 18 | 15 | import org.springframework.validation.annotation.Validated; |
| 19 | 16 | |
| 20 | 17 | import javax.annotation.Resource; |
| 21 | -import java.util.Collection; | |
| 22 | 18 | import java.util.List; |
| 23 | 19 | import java.util.Objects; |
| 24 | 20 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/resources/mapper/customer/CrmCustomerPoolConfigMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerPoolConfigMapper"> | |
| 4 | + | |
| 5 | + <!-- | |
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | + --> | |
| 11 | + | |
| 12 | +</mapper> | ... | ... |