package com.ruoyi.basic.controller; import com.ruoyi.basic.dto.CustomerPrivateDto; import com.ruoyi.basic.dto.CustomerPrivatePoolDto; import com.ruoyi.basic.service.CustomerPrivatePoolService; import com.ruoyi.basic.service.CustomerPrivateService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.domain.R; import jakarta.servlet.http.HttpServletResponse; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.List; /** *

* 客户档案 前端控制器 *

* * @author 芯导软件(江苏)有限公司 * @since 2026-04-17 10:39:09 */ @RestController @RequestMapping("/customerPrivate") @AllArgsConstructor public class CustomerPrivateController { private final CustomerPrivateService customerPrivateService; private final CustomerPrivatePoolService customerPrivatePoolService; @PostMapping("/add") public R add(@RequestBody CustomerPrivateDto customerPrivateDto) { return R.ok(customerPrivateService.add(customerPrivateDto)); } @DeleteMapping("/delete") public R delete(@RequestBody List ids) { return R.ok(customerPrivateService.delete(ids)); } /** * 导入客户档案 */ @Log(title = "客户档案", businessType = BusinessType.IMPORT) @PostMapping("/importData") public R importData(MultipartFile file) throws Exception { return customerPrivateService.importData(file); } /** * 导出客户档案列表 */ @Log(title = "客户档案", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CustomerPrivatePoolDto customerPrivatePoolDto) { List ids = customerPrivatePoolDto.getIds(); List list; if (ids != null && ids.size() > 0) { list = customerPrivatePoolService.selectCustomerPrivatePoolDtoListByIds(ids); } else { list = customerPrivatePoolService.selectCustomerPrivatePoolDtoLists(customerPrivatePoolDto); } ExcelUtil util = new ExcelUtil(CustomerPrivatePoolDto.class); util.exportExcel(response, list, "客户档案数据"); } @PostMapping("/downloadTemplate") @Log(title = "客户档案-下载模板", businessType = BusinessType.EXPORT) public void downloadTemplate(HttpServletResponse response) { ExcelUtil util = new ExcelUtil(CustomerPrivatePoolDto.class); util.importTemplateExcel(response, "客户档案模板"); } }