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.
65 lines
2.5 KiB
65 lines
2.5 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.param.LeadPoolPageParam;
|
|
import com.crm.rule.service.ILeadPoolService;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
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 java.util.List;
|
|
|
|
/**
|
|
* 公海池配置接口(薄适配层,只调 {@link ILeadPoolService})
|
|
* <p>权限策略:不种子化 button 权限点(用户决策),ApiPermissionInterceptor 对未注册 URL fail-open,
|
|
* 数据隔离由 {@code @DataScope(module="lead", deptColumn="dept_id")} 在 Service 层自动注入。</p>
|
|
*/
|
|
@Tag(name = "线索管理/线索设置")
|
|
@RestController
|
|
@RequestMapping("/api/rule/pool")
|
|
@RequiredArgsConstructor
|
|
public class LeadPoolController {
|
|
|
|
private final ILeadPoolService leadPoolService;
|
|
|
|
@Operation(summary = "公海池分页列表")
|
|
@PostMapping("/page")
|
|
public Result<PageResult<LeadPoolDTO>> page(LeadPoolPageParam param) {
|
|
return Result.success(leadPoolService.pagePools(param));
|
|
}
|
|
|
|
@Operation(summary = "公海池详情(含省份/市/区/人员)")
|
|
@GetMapping("/detail")
|
|
public Result<LeadPoolDTO> detail(@RequestParam("id") Long id) {
|
|
return Result.success(leadPoolService.getPoolDetail(id));
|
|
}
|
|
|
|
@Operation(summary = "新建/编辑公海池")
|
|
@PostMapping("/saveOrUpdate")
|
|
public Result<Void> saveOrUpdate(LeadPoolDTO dto) {
|
|
leadPoolService.savePool(dto);
|
|
return Result.success();
|
|
}
|
|
|
|
@Operation(summary = "删除公海池(软删除,级联清关联表)")
|
|
@PostMapping("/delete")
|
|
public Result<Void> delete(@RequestParam("id") Long id) {
|
|
leadPoolService.deletePool(id);
|
|
return Result.success();
|
|
}
|
|
|
|
@Operation(summary = "批量删除公海池(非原子、逐条、部分成功)")
|
|
@PostMapping("/delete-batch")
|
|
public Result<BatchResult<PoolBatchFailItem>> deleteBatch(@RequestParam("ids") List<Long> ids) {
|
|
return Result.success(leadPoolService.deletePoolBatch(ids));
|
|
}
|
|
}
|
|
|