maven
2 天以前 9af5090f5d4597fbcfdf53a71189175892d29109
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package com.ruoyi.basic.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.CustomerFollowUp;
import com.ruoyi.basic.pojo.CustomerReturnVisit;
import com.ruoyi.basic.service.CustomerFollowUpService;
import com.ruoyi.basic.service.CustomerReturnVisitService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import java.util.List;
 
/**
 * <br>
 * 客户跟进控制层
 * </br>
 *
 * @author deslrey
 * @version 1.0
 * @since 2026/03/04 14:45
 */
@RestController
@RequestMapping("/basic/customer-follow")
public class CustomerFollowUpController extends BaseController {
 
    @Autowired
    private CustomerFollowUpService customerFollowUpService;
 
    @Autowired
    private CustomerReturnVisitService customerReturnVisitService;
 
    /**
     * 查询客户跟进列表
     */
    @GetMapping("/list")
    @ApiOperation("查询客户跟进列表")
    public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) {
        LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(customerFollowUp.getCustomerId() != null, CustomerFollowUp::getCustomerId, customerFollowUp.getCustomerId())
                .like(customerFollowUp.getFollowerUserName() != null, CustomerFollowUp::getFollowerUserName, customerFollowUp.getFollowerUserName())
                .orderByDesc(CustomerFollowUp::getFollowUpTime);
        return customerFollowUpService.page(page, queryWrapper);
    }
 
    /**
     * 获取客户跟进详细信息
     */
    @ApiOperation("获取客户跟进详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        return AjaxResult.success(customerFollowUpService.getFollowUpWithFiles(id));
    }
 
    /**
     * 新增客户跟进
     */
    @PostMapping("/add")
    @ApiOperation("新增客户跟进")
    @Log(title = "客户跟进-新增", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody CustomerFollowUp customerFollowUp) {
        return toAjax(customerFollowUpService.insertCustomerFollowUp(customerFollowUp));
    }
 
    /**
     * 修改客户跟进
     */
    @PutMapping("/edit")
    @ApiOperation("修改客户跟进")
    @Log(title = "客户跟进-修改", businessType = BusinessType.UPDATE)
    public AjaxResult edit(@RequestBody CustomerFollowUp customerFollowUp) {
        return toAjax(customerFollowUpService.updateCustomerFollowUp(customerFollowUp));
    }
 
    /**
     * 上传跟进附件
     */
    @ApiOperation("上传跟进附件")
    @PostMapping("/upload/{followUpId}")
    @Log(title = "客户跟进-上传附件", businessType = BusinessType.INSERT)
    public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) {
        customerFollowUpService.addFollowUpFiles(files, followUpId);
        return AjaxResult.success();
    }
 
    /**
     * 删除跟进附件
     */
    @ApiOperation("删除跟进附件")
    @DeleteMapping("/file/{fileId}")
    @Log(title = "客户跟进-删除附件", businessType = BusinessType.DELETE)
    public AjaxResult deleteFile(@PathVariable Integer fileId) {
        customerFollowUpService.deleteFollowUpFile(fileId);
        return AjaxResult.success();
    }
 
    /**
     * 删除客户跟进
     */
    @ApiOperation("删除客户跟进")
    @DeleteMapping("/{id}")
    @Log(title = "客户跟进-删除", businessType = BusinessType.DELETE)
    public AjaxResult remove(@PathVariable Integer id) {
        return toAjax(customerFollowUpService.deleteCustomerFollowUpById(id));
    }
 
    /**
     * 新增/更新回访提醒
     */
    @ApiOperation("新增/更新回访提醒")
    @PostMapping("/return-visit")
    @Log(title = "回访提醒-新增/更新", businessType = BusinessType.UPDATE)
    public AjaxResult saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) {
        return toAjax(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit));
    }
 
    /**
     * 获取回访提醒详情
     */
    @ApiOperation("获取回访提醒详情")
    @GetMapping("/return-visit/{customerId}")
    public AjaxResult getReturnVisit(@PathVariable Integer customerId) {
        return AjaxResult.success(customerReturnVisitService.getByCustomerId(customerId));
    }
 
    /**
     * 标记回访提醒已读
     */
    @ApiOperation("标记回访提醒已读")
    @PutMapping("/return-visit/read/{id}")
    @Log(title = "回访提醒-标记已读", businessType = BusinessType.UPDATE)
    public AjaxResult markAsRead(@PathVariable Long id) {
        customerReturnVisitService.markAsRead(id);
        return AjaxResult.success();
    }
 
}