feat: CRM 客户公海配置

This commit is contained in:
Wanwan 2023-11-09 00:01:43 +08:00
parent 9abff2c7ad
commit 2915b46fa5
2 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,7 @@ public interface ErrorCodeConstants {
// ========== 客户管理 1_020_006_000 ========== // ========== 客户管理 1_020_006_000 ==========
ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(1_020_006_000, "客户不存在"); ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(1_020_006_000, "客户不存在");
ErrorCode CUSTOMER_POOL_CONFIG_ERROR = new ErrorCode(1_020_006_001, "客户公海规则设置不正确");
// ========== 权限管理 1_020_007_000 ========== // ========== 权限管理 1_020_007_000 ==========
ErrorCode CRM_PERMISSION_NOT_EXISTS = new ErrorCode(1_020_007_000, "数据权限不存在"); ErrorCode CRM_PERMISSION_NOT_EXISTS = new ErrorCode(1_020_007_000, "数据权限不存在");

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.crm.service.customer; package cn.iocoder.yudao.module.crm.service.customer;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO;
import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
@ -11,6 +13,9 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Objects; import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_POOL_CONFIG_ERROR;
/** /**
* 客户公海配置 Service 实现类 * 客户公海配置 Service 实现类
* *
@ -39,6 +44,13 @@ public class CrmCustomerPoolConfigServiceImpl implements CrmCustomerPoolConfigSe
*/ */
@Override @Override
public void updateCustomerPoolConfig(CrmCustomerPoolConfigUpdateReqVO saveReqVO) { public void updateCustomerPoolConfig(CrmCustomerPoolConfigUpdateReqVO saveReqVO) {
if (BooleanUtil.isTrue(saveReqVO.getEnabled()) && (ObjectUtil.hasNull(saveReqVO.getContactExpireDays(), saveReqVO.getDealExpireDays()))) {
throw exception(CUSTOMER_POOL_CONFIG_ERROR);
}
if (BooleanUtil.isTrue(saveReqVO.getNotifyEnabled()) && (Objects.isNull(saveReqVO.getNotifyDays()))) {
throw exception(CUSTOMER_POOL_CONFIG_ERROR);
}
// 存在则进行更新 // 存在则进行更新
CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig(); CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig();
if (Objects.nonNull(dbConfig)) { if (Objects.nonNull(dbConfig)) {