feat: CRM 客户公海配置
parent
4235beec3b
commit
71574da2cf
@ -1,4 +0,0 @@
|
|||||||
### 请求 /crm/customer/test 接口 => 成功
|
|
||||||
GET {{baseUrl}}/crm/customer/test
|
|
||||||
tenant-id: 1
|
|
||||||
Authorization: Bearer {{token}}
|
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.customer;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigRespVO;
|
||||||
|
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.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
||||||
|
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
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.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - CRM 客户公海配置")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/crm/customer-pool-config")
|
||||||
|
@Validated
|
||||||
|
public class CrmCustomerPoolConfigController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CrmCustomerPoolConfigService customerPoolConfigService;
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获取客户公海规则设置")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:customer-pool-config:query')")
|
||||||
|
public CommonResult<CrmCustomerPoolConfigRespVO> getCustomerPoolConfig() {
|
||||||
|
CrmCustomerPoolConfigDO customerPoolConfig = customerPoolConfigService.getCustomerPoolConfig();
|
||||||
|
return success(CrmCustomerConvert.INSTANCE.convert(customerPoolConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新客户公海规则设置")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:customer-pool-config:update')")
|
||||||
|
public CommonResult<Boolean> updateCustomerPoolConfig(@Valid @RequestBody CrmCustomerPoolConfigUpdateReqVO updateReqVO) {
|
||||||
|
customerPoolConfigService.updateCustomerPoolConfig(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.customer.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户公海规则 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class CrmCustomerPoolConfigRespVO extends CrmCustomerPoolConfigBaseVO {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.customer.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - CRM 客户更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class CrmCustomerPoolConfigUpdateReqVO extends CrmCustomerPoolConfigBaseVO {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.dal.dataobject.customer;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户公海配置 DO
|
||||||
|
*
|
||||||
|
* @author Wanwan
|
||||||
|
*/
|
||||||
|
@TableName(value = "crm_customer_pool_config")
|
||||||
|
@KeySequence("crm_customer_pool_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CrmCustomerPoolConfigDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 是否启用客户公海
|
||||||
|
*/
|
||||||
|
private Boolean enabled;
|
||||||
|
/**
|
||||||
|
* 未跟进放入公海天数
|
||||||
|
*/
|
||||||
|
private Integer contactExpireDays;
|
||||||
|
/**
|
||||||
|
* 未成交放入公海天数
|
||||||
|
*/
|
||||||
|
private Integer dealExpireDays;
|
||||||
|
/**
|
||||||
|
* 是否开启提前提醒
|
||||||
|
*/
|
||||||
|
private Boolean notifyEnabled;
|
||||||
|
/**
|
||||||
|
* 提前提醒天数
|
||||||
|
*/
|
||||||
|
private Integer notifyDays;
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.dal.mysql.customer;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户公海配置 Mapper
|
||||||
|
*
|
||||||
|
* @author Wanwan
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CrmCustomerPoolConfigMapper extends BaseMapperX<CrmCustomerPoolConfigDO> {
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.service.customer;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPoolConfigUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户公海配置 Service 接口
|
||||||
|
*
|
||||||
|
* @author Wanwan
|
||||||
|
*/
|
||||||
|
public interface CrmCustomerPoolConfigService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客户公海配置
|
||||||
|
*
|
||||||
|
* @return 客户公海配置
|
||||||
|
*/
|
||||||
|
CrmCustomerPoolConfigDO getCustomerPoolConfig();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存客户公海配置
|
||||||
|
*
|
||||||
|
* @param saveReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateCustomerPoolConfig(@Valid CrmCustomerPoolConfigUpdateReqVO saveReqVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.service.customer;
|
||||||
|
|
||||||
|
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.convert.customer.CrmCustomerConvert;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerPoolConfigMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户公海配置 Service 实现类
|
||||||
|
*
|
||||||
|
* @author Wanwan
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class CrmCustomerPoolConfigServiceImpl implements CrmCustomerPoolConfigService {
|
||||||
|
@Resource
|
||||||
|
private CrmCustomerPoolConfigMapper customerPoolConfigMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客户公海配置
|
||||||
|
*
|
||||||
|
* @return 客户公海配置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CrmCustomerPoolConfigDO getCustomerPoolConfig() {
|
||||||
|
return customerPoolConfigMapper.selectOne(new LambdaQueryWrapperX<CrmCustomerPoolConfigDO>().last("LIMIT 1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存客户公海配置
|
||||||
|
*
|
||||||
|
* @param saveReqVO 更新信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateCustomerPoolConfig(CrmCustomerPoolConfigUpdateReqVO saveReqVO) {
|
||||||
|
// 存在,则进行更新
|
||||||
|
CrmCustomerPoolConfigDO dbConfig = getCustomerPoolConfig();
|
||||||
|
if (Objects.nonNull(dbConfig)) {
|
||||||
|
customerPoolConfigMapper.updateById(CrmCustomerConvert.INSTANCE.convert(saveReqVO).setId(dbConfig.getId()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 不存在,则进行插入
|
||||||
|
customerPoolConfigMapper.insert(CrmCustomerConvert.INSTANCE.convert(saveReqVO));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue