zss
2026-04-23 5033c375a3ee6a63bcb600d5b9f4b8d549d089e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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;
 
/**
 * <p>
 * 客户档案 前端控制器
 * </p>
 *
 * @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<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, "客户档案模板");
    }
}