You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
3.8 KiB
80 lines
3.8 KiB
package com.crm.rule.controller;
|
|
|
|
import com.crm.base.domain.result.PageResult;
|
|
import com.crm.base.domain.result.Result;
|
|
import com.crm.base.domain.result.BatchResult;
|
|
import com.crm.rule.domain.dto.LeadPoolDTO;
|
|
import com.crm.rule.domain.dto.PoolBatchFailItem;
|
|
import com.crm.rule.domain.dto.PoolImportFailItem;
|
|
import com.crm.rule.domain.param.LeadPoolPageParam;
|
|
import com.crm.rule.service.ILeadPoolService;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 公海池配置接口(薄适配层,只调 {@link ILeadPoolService})
|
|
* <p>权限策略:不种子化 button 权限点(用户决策),ApiPermissionInterceptor 对未注册 URL fail-open,
|
|
* 数据隔离由 {@code @DataScope(module="lead", deptColumn="dept_id")} 在 Service 层自动注入。</p>
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/api/rule/pool")
|
|
@RequiredArgsConstructor
|
|
public class LeadPoolController {
|
|
|
|
private final ILeadPoolService leadPoolService;
|
|
|
|
@Operation(summary = "公海池分页列表", tags = {"A2 线索管理/线索设置", "A7 后台管理/业务规则/线索规则"})
|
|
@PostMapping("/page")
|
|
public Result<PageResult<LeadPoolDTO>> page(LeadPoolPageParam param) {
|
|
return Result.success(leadPoolService.pagePools(param));
|
|
}
|
|
|
|
@Operation(summary = "公海池详情(含省份/市/区/人员)", tags = {"A2 线索管理/线索设置", "A7 后台管理/业务规则/线索规则"})
|
|
@GetMapping("/detail")
|
|
public Result<LeadPoolDTO> detail(@RequestParam("id") Long id) {
|
|
return Result.success(leadPoolService.getPoolDetail(id));
|
|
}
|
|
|
|
@Operation(summary = "新建/编辑公海池", tags = {"A2 线索管理/线索设置", "A7 后台管理/业务规则/线索规则"})
|
|
@PostMapping("/saveOrUpdate")
|
|
public Result<Void> saveOrUpdate(LeadPoolDTO dto) {
|
|
leadPoolService.savePool(dto);
|
|
return Result.success();
|
|
}
|
|
|
|
@Operation(summary = "删除公海池(软删除,级联清关联表)", tags = {"A2 线索管理/线索设置", "A7 后台管理/业务规则/线索规则"})
|
|
@PostMapping("/delete")
|
|
public Result<Void> delete(@RequestParam("id") Long id) {
|
|
leadPoolService.deletePool(id);
|
|
return Result.success();
|
|
}
|
|
|
|
@Operation(summary = "批量删除公海池(非原子、逐条、部分成功)", tags = {"A2 线索管理/线索设置", "A7 后台管理/业务规则/线索规则"})
|
|
@PostMapping("/delete-batch")
|
|
public Result<BatchResult<PoolBatchFailItem>> deleteBatch(@RequestParam("ids") List<Long> ids) {
|
|
return Result.success(leadPoolService.deletePoolBatch(ids));
|
|
}
|
|
|
|
@Operation(summary = "导入公海池(Excel 模板批量,逐行独立事务、部分成功;文件级守门失败 64035)",
|
|
tags = {"A2 线索管理/线索设置", "A7 后台管理/业务规则/线索规则"})
|
|
@PostMapping("/import")
|
|
public Result<BatchResult<PoolImportFailItem>> importPools(@RequestParam("file") MultipartFile file) {
|
|
return Result.success(leadPoolService.importPools(file));
|
|
}
|
|
|
|
@Operation(summary = "导出公海池(按当前筛选条件全量导出 xlsx,列集与导入模板闭环)",
|
|
tags = {"A2 线索管理/线索设置", "A7 后台管理/业务规则/线索规则"})
|
|
@GetMapping("/export")
|
|
public void exportPools(LeadPoolPageParam param, HttpServletResponse response) {
|
|
leadPoolService.exportPools(param, response);
|
|
}
|
|
}
|
|
|