From 52123c927f77f41f71461ef0d422525656bd7b6f Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 07 五月 2026 11:53:26 +0800
Subject: [PATCH] 优化营销客户相关
---
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 75 ++++++++++++++++++++++++++++++-------
1 files changed, 61 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index be5f92a..866153b 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -2,17 +2,21 @@
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.pojo.Customer;
import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.basic.vo.CustomerVo;
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.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -31,8 +35,9 @@
* 鏌ヨ瀹㈡埛妗f鍒楄〃
*/
@GetMapping("/list")
- public IPage<Customer> list(Page page, Customer customer) {
- return customerService.selectCustomerList(page, customer);
+ public R list(Page<CustomerDto> page, CustomerDto customer) {
+ IPage<CustomerVo> customerDtoIPage = customerService.selectCustomerList(page, customer);
+ return R.ok(customerDtoIPage);
}
/**
@@ -40,16 +45,27 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, Customer customer) {
- Long[] ids = customer.getIds();
- List<Customer> list;
- if (ids != null && ids.length > 0) {
- list = customerService.selectCustomerListByIds(ids);
- } else {
- list = customerService.selectCustomerLists(customer);
- }
+ public void export(HttpServletResponse response, CustomerDto customer) {
+ ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
+ util.exportExcel(response, customerService.selectCustomerLists(customer), "瀹㈡埛妗f鏁版嵁");
+ }
+
+ @PostMapping("/downloadTemplate")
+ @Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
+ public void downloadTemplate(HttpServletResponse response) {
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
- util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
+ util.importTemplateExcel(response, "瀹㈡埛妗f妯℃澘");
+ }
+
+
+ /**
+ * 瀵煎叆瀹㈡埛妗f
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
+ @PostMapping("/importData")
+ public AjaxResult importData(MultipartFile file, Integer type) throws Exception {
+
+ return customerService.importData(file, type);
}
/**
@@ -57,7 +73,7 @@
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(customerService.selectCustomerById(id));
+ return success(customerService.selectCustomerDetailById(id));
}
/**
@@ -97,4 +113,35 @@
public List customerList(Customer customer) {
return customerService.customerList(customer);
}
-}
+
+
+ /**
+ * 鍒嗛厤瀹㈡埛
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+ @PostMapping("/assignCustomer")
+ public AjaxResult assignCustomer(@RequestBody CustomerDto customer) {
+ customerService.assignCustomer(customer);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 鍥炴敹瀹㈡埛
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+ @PostMapping("/recycleCustomer")
+ public AjaxResult recycleCustomer(@RequestBody CustomerDto customer) {
+ customerService.recycleCustomer(customer);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 鍏变韩瀹㈡埛
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+ @PostMapping("/together")
+ public AjaxResult together(@RequestBody CustomerDto customer) {
+ customerService.together(customer);
+ return AjaxResult.success();
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.3