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; /** *
* 客户跟进控制层 *
* * @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 list(Page page, CustomerFollowUp customerFollowUp) { LambdaQueryWrapper 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 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(); } }