package com.ruoyi.basic.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.basic.dto.CustomerDto;
|
import com.ruoyi.basic.dto.CustomerPrivateDto;
|
import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
|
import com.ruoyi.basic.pojo.Customer;
|
import com.ruoyi.basic.pojo.CustomerPrivate;
|
import com.ruoyi.basic.service.CustomerPrivatePoolService;
|
import com.ruoyi.basic.service.CustomerPrivateService;
|
import com.ruoyi.basic.service.ICustomerService;
|
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.AjaxResult;
|
import com.ruoyi.framework.web.domain.R;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
import static com.ruoyi.framework.web.domain.AjaxResult.success;
|
|
/**
|
* <p>
|
* 客户档案 前端控制器
|
* </p>
|
*
|
* @author 芯导软件(江苏)有限公司
|
* @since 2026-04-17 10:39:09
|
*/
|
@RestController
|
@RequestMapping("/customerPrivate")
|
public class CustomerPrivateController {
|
@Autowired
|
private CustomerPrivateService customerPrivateService;
|
|
@Autowired
|
private CustomerPrivatePoolService customerPrivatePoolService;
|
|
|
@PostMapping("/add")
|
public R add(@RequestBody CustomerPrivateDto customerPrivateDto) {
|
return R.ok(customerPrivateService.add(customerPrivateDto));
|
}
|
|
|
@DeleteMapping("/delete")
|
public R delete(@RequestBody List<Long> 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<Long> ids = customerPrivatePoolDto.getIds();
|
List<CustomerPrivatePoolDto> list;
|
if (ids != null && ids.size() > 0) {
|
list = customerPrivatePoolService.selectCustomerPrivatePoolDtoListByIds(ids);
|
} else {
|
list = customerPrivatePoolService.selectCustomerPrivatePoolDtoLists(customerPrivatePoolDto);
|
}
|
ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
|
util.exportExcel(response, list, "客户档案数据");
|
}
|
|
@PostMapping("/downloadTemplate")
|
@Log(title = "客户档案-下载模板", businessType = BusinessType.EXPORT)
|
public void downloadTemplate(HttpServletResponse response) {
|
ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
|
util.importTemplateExcel(response, "客户档案模板");
|
}
|
}
|