From a6ff41048bbdd5b8519a3e21e9232a152d179dfc Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期四, 30 四月 2026 10:43:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New

---
 src/main/java/com/ruoyi/account/pojo/AccountIncome.java                            |   25 +
 src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java |   15 
 src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java                             |    3 
 src/main/java/com/ruoyi/basic/pojo/Customer.java                                   |    5 
 src/main/resources/mapper/basic/CustomerMapper.xml                                 |   93 +++++
 src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java        |    2 
 src/main/resources/mapper/sales/ReceiptPaymentMapper.xml                           |   17 
 src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java            |   19 +
 src/main/resources/mapper/sales/SalesQuotationMapper.xml                           |    1 
 src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java                    |    7 
 src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java                |  178 +++++++++-
 src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java  |    3 
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml                       |    4 
 src/main/resources/mapper/sales/InvoiceLedgerMapper.xml                            |   49 +-
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java             |    7 
 src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java          |    4 
 src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java     |    6 
 src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java        |   30 +
 src/main/java/com/ruoyi/basic/pojo/CustomerUser.java                               |   43 ++
 src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java                           |    7 
 src/main/resources/mapper/account/AccountIncomeMapper.xml                          |   21 +
 src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java          |   13 
 src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java                    |    2 
 src/main/java/com/ruoyi/basic/vo/CustomerVo.java                                   |   28 +
 src/main/java/com/ruoyi/basic/service/ICustomerService.java                        |   23 +
 src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java                       |    2 
 src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java           |    2 
 /dev/null                                                                          |  100 ------
 src/main/java/com/ruoyi/basic/dto/CustomerDto.java                                 |    6 
 src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java                       |   15 
 src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java                           |    2 
 src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java                        |    2 
 src/main/java/com/ruoyi/basic/controller/CustomerController.java                   |   51 ++
 src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java            |    2 
 src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java         |   37 ++
 src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java          |    7 
 doc/create_table_customer_user.sql                                                 |   10 
 src/main/java/com/ruoyi/basic/service/CustomerUserService.java                     |   13 
 src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml                   |   76 ++-
 39 files changed, 658 insertions(+), 272 deletions(-)

diff --git a/doc/create_table_customer_user.sql b/doc/create_table_customer_user.sql
new file mode 100644
index 0000000..dacbfb4
--- /dev/null
+++ b/doc/create_table_customer_user.sql
@@ -0,0 +1,10 @@
+drop table if exists customer_user;
+create table customer_user
+(
+    id          bigint auto_increment
+        primary key,
+    customer_id bigint not null default 0 comment '瀹㈡埛id',
+    user_id     bigint not null default 0 comment '鐢ㄦ埛id',
+    create_time datetime null comment '褰曞叆鏃堕棿',
+    tenant_id   bigint not null default 0 comment '绉熸埛id'
+);
diff --git a/src/main/java/com/ruoyi/account/pojo/AccountIncome.java b/src/main/java/com/ruoyi/account/pojo/AccountIncome.java
index 7f5e317..750b86a 100644
--- a/src/main/java/com/ruoyi/account/pojo/AccountIncome.java
+++ b/src/main/java/com/ruoyi/account/pojo/AccountIncome.java
@@ -13,6 +13,7 @@
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 璐㈠姟绠$悊--鏀跺叆绠$悊
@@ -20,7 +21,7 @@
  */
 @TableName(value = "account_income")
 @Data
-public class AccountIncome extends DateQueryDto  implements Serializable {
+public class AccountIncome extends DateQueryDto implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
@@ -50,7 +51,7 @@
     /**
      * 鏀跺叆绫诲瀷(閿�鍞敹鍏ワ紝鏈嶅姟鏀跺叆锛屽叾浠栨敹鍏�)
      */
-    @Excel(name = "鏀跺叆绫诲瀷",readConverterExp = "0=閿�鍞敹鍏�,1=鏈嶅姟鏀跺叆,2=鍏朵粬鏀跺叆,3=鍥炴鏀跺叆")
+    @Excel(name = "鏀跺叆绫诲瀷", readConverterExp = "0=閿�鍞敹鍏�,1=鏈嶅姟鏀跺叆,2=鍏朵粬鏀跺叆,3=鍥炴鏀跺叆")
     @NotBlank(message = "鏀跺叆绫诲瀷涓嶈兘涓虹┖!!")
     private String incomeType;
 
@@ -75,10 +76,28 @@
     /**
      * 鏀舵鏂瑰紡(鐜伴噾锛屾敮绁紝閾惰杞处锛屽叾浠�)
      */
-    @Excel(name = "鏀舵鏂瑰紡",readConverterExp = "0=鐜伴噾,1=鏀エ,2=閾惰杞处,3=鍏朵粬")
+    @Excel(name = "鏀舵鏂瑰紡", readConverterExp = "0=鐜伴噾,1=鏀エ,2=閾惰杞处,3=鍏朵粬")
     private String incomeMethod;
 
     /**
+     * 鏀舵鏂瑰紡鏍囩
+     */
+    @TableField(exist = false)
+    private String incomeMethodLabel;
+
+    /**
+     * payment_methods 瀛楀吀缂栫爜闆嗗悎锛坆usiness_type 涓虹┖鏃讹級
+     */
+    @TableField(exist = false)
+    private List<String> paymentMethodList;
+
+    /**
+     * receipt_payment_type 瀛楀吀缂栫爜闆嗗悎锛坆usiness_type=1鏃讹級
+     */
+    @TableField(exist = false)
+    private List<String> receiptPaymentMethodList;
+
+    /**
      * 鍙戠エ鍙风爜
      */
     @Excel(name = "鍙戠エ鍙风爜")
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java
index 4a83ecb..1d197f1 100644
--- a/src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/AccountIncomeServiceImpl.java
@@ -5,13 +5,11 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.account.dto.AccountDto2;
 import com.ruoyi.account.dto.AccountDto3;
 import com.ruoyi.account.dto.ReportDateDto;
 import com.ruoyi.account.mapper.AccountIncomeMapper;
 import com.ruoyi.account.pojo.AccountIncome;
 import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.dto.DateQueryDto;
 import com.ruoyi.project.system.domain.SysDictData;
@@ -24,9 +22,9 @@
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.List;
-import java.util.Map;
+import java.util.stream.Collectors;
 
 @AllArgsConstructor
 @Service
@@ -40,9 +38,40 @@
     //鍒嗛〉鏌ヨ
     @Override
     public IPage<AccountIncome> accountIncomeListPage(Page page, AccountIncome accountIncome) {
+        resolveIncomeMethodLabelFilter(accountIncome);
         return accountIncomeMapper.accountIncomeListPage(page,accountIncome);
     }
 
+    private void resolveIncomeMethodLabelFilter(AccountIncome accountIncome) {
+        if (accountIncome == null) {
+            return;
+        }
+        if (accountIncome.getIncomeMethodLabel() == null || accountIncome.getIncomeMethodLabel().trim().isEmpty()) {
+            return;
+        }
+        String targetLabel = accountIncome.getIncomeMethodLabel().trim();
+        List<String> paymentMethodList = selectDictValuesByLabel("payment_methods", targetLabel);
+        List<String> receiptPaymentMethodList = selectDictValuesByLabel("receipt_payment_type", targetLabel);
+        if (paymentMethodList.isEmpty()) {
+            paymentMethodList = Collections.singletonList("__NO_MATCH__");
+        }
+        if (receiptPaymentMethodList.isEmpty()) {
+            receiptPaymentMethodList = Collections.singletonList("__NO_MATCH__");
+        }
+        accountIncome.setPaymentMethodList(paymentMethodList);
+        accountIncome.setReceiptPaymentMethodList(receiptPaymentMethodList);
+        accountIncome.setIncomeMethod(null);
+    }
+
+    private List<String> selectDictValuesByLabel(String dictType, String label) {
+        return sysDictDataMapper.selectDictDataByType(dictType).stream()
+                .filter(item -> label.equals(item.getDictLabel()))
+                .map(SysDictData::getDictValue)
+                .filter(v -> v != null && !v.trim().isEmpty())
+                .distinct()
+                .collect(Collectors.toList());
+    }
+
     //瀵煎嚭
     @Override
     public void accountIncomeExport(HttpServletResponse response, AccountIncome accountIncome) {
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
index 69e86ce..d13135b 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
@@ -10,9 +10,11 @@
 import com.ruoyi.approve.bean.vo.ApproveProcessConfigNodeVo;
 import com.ruoyi.approve.bean.vo.ApproveProcessVO;
 import com.ruoyi.approve.mapper.ApproveNodeMapper;
+import com.ruoyi.approve.mapper.ApproveProcessConfigNodeMapper;
 import com.ruoyi.approve.mapper.ApproveProcessMapper;
 import com.ruoyi.approve.pojo.ApproveNode;
 import com.ruoyi.approve.pojo.ApproveProcess;
+import com.ruoyi.approve.pojo.ApproveProcessConfigNode;
 import com.ruoyi.approve.service.ApproveProcessConfigNodeService;
 import com.ruoyi.approve.service.IApproveNodeService;
 import com.ruoyi.approve.service.IApproveProcessService;
@@ -63,6 +65,7 @@
     private final ShippingInfoMapper shippingInfoMapper;
     private final ApproveNodeMapper approveNodeMapper;
     private final ApproveProcessConfigNodeService approveProcessConfigNodeService;
+    private final ApproveProcessConfigNodeMapper approveProcessConfigNodeMapper;
 
     @Override
     public void addApprove(ApproveProcessVO approveProcessVO) throws Exception {
@@ -299,16 +302,18 @@
                 .last("limit 1");
         ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper);
         if (approveProcess == null) throw new RuntimeException("璇烽�夋嫨瀹℃壒浜�");
-        String[] split = approveGetAndUpdateVo.getApproveUserIds().split(",");
-        if (split.length == 0) {
-            throw new RuntimeException("璇烽�夋嫨瀹℃壒浜�");
-        }
-        List<SysUser> sysUsers = sysUserMapper.selectUserByIds(Arrays.asList(split).stream().map(Long::parseLong).collect(Collectors.toList()));
+        //鏌ヨ瀹℃壒閰嶇疆
+        List<ApproveProcessConfigNode> approveProcessConfig = approveProcessConfigNodeMapper.selectList(new LambdaQueryWrapper<ApproveProcessConfigNode>().eq(ApproveProcessConfigNode::getApproveType, approveGetAndUpdateVo.getApproveType()));
+        List<Long> configNodeIds = approveProcessConfig.stream()
+                .sorted(Comparator.comparing(ApproveProcessConfigNode::getNodeOrder))
+                .map(ApproveProcessConfigNode::getApproverId)
+                .collect(Collectors.toList());
+        List<SysUser> sysUsers = sysUserMapper.selectUserByIds(configNodeIds);
         if (CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("璇烽�夋嫨瀹℃壒浜�");
         //瀹℃牳涓笉鍙互缂栬緫瀹℃牳浜�
         if (approveProcess.getApproveStatus() != 1) {
-            approveProcess.setApproveUserCurrentId(Long.parseLong(split[0]));
-            approveProcess.setApproveUserCurrentName(sysUsers.stream().filter(user -> user.getUserId().equals(Long.parseLong(split[0]))).collect(Collectors.toList()).get(0).getNickName());
+            approveProcess.setApproveUserCurrentId(configNodeIds.get(0));
+            approveProcess.setApproveUserCurrentName(sysUsers.stream().filter(user -> user.getUserId().equals(configNodeIds.get(0))).collect(Collectors.toList()).get(0).getNickName());
         }
         if (approveGetAndUpdateVo.getApproveStatus() != null) {
             approveProcess.setApproveStatus(approveGetAndUpdateVo.getApproveStatus());
@@ -320,21 +325,24 @@
         LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
         approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveProcess.getApproveId())
                 .eq(ApproveNode::getDeleteFlag, 0)
-//                .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId())
                 .orderByAsc(ApproveNode::getApproveNodeOrder);
         approveNodeMapper.delete(approveNodeLambdaQueryWrapper);
+        //鏌ヨ瀹℃壒閰嶇疆
+        approveGetAndUpdateVo.setApproveUserIds(configNodeIds.stream()
+                .map(String::valueOf)
+                .collect(Collectors.joining(",")));
         approveNodeService.initApproveNodes(approveGetAndUpdateVo.getApproveUserIds(), approveProcess.getApproveId(), approveProcess.getTenantId());
         /*娑堟伅閫氱煡*/
-        String id = approveProcess.getApproveUserIds().split(",")[0];
+        Long id = configNodeIds.get(0);
         if (approveProcess.getApproveType()==8){
             sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()),
                     approveProcess.getApproveId() + "娴佺▼缂栧彿鐨勫鎵归渶瑕佹偍瀹℃牳!!!!!",
-                    Arrays.asList(Long.valueOf(id)),
+                    Collections.singletonList(id),
                     "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId());
         }else {
             sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()),
                     approveProcess.getApproveId() + "娴佺▼缂栧彿鐨勫鎵归渶瑕佹偍瀹℃牳!!!!!",
-                    Arrays.asList(Long.valueOf(id)),
+                    Collections.singletonList(id),
                     "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId());
         }
     }
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 7e931da..ec3fb1a 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -5,6 +5,7 @@
 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;
@@ -35,7 +36,7 @@
      */
     @GetMapping("/list")
     public R list(Page<CustomerDto> page, CustomerDto customer) {
-        IPage<CustomerDto> customerDtoIPage = customerService.selectCustomerList(page, customer);
+        IPage<CustomerVo> customerDtoIPage = customerService.selectCustomerList(page, customer);
         return R.ok(customerDtoIPage);
     }
 
@@ -44,16 +45,9 @@
      */
     @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);
-        }
-        ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
-        util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
+    public void export(HttpServletResponse response, CustomerDto customer) {
+        ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
+        util.exportExcel(response, customerService.selectCustomerLists(customer), "瀹㈡埛妗f鏁版嵁");
     }
 
     @PostMapping("/downloadTemplate")
@@ -69,9 +63,9 @@
      */
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
     @PostMapping("/importData")
-    public AjaxResult importData(MultipartFile file) throws Exception {
+    public AjaxResult importData(MultipartFile file, Integer type) throws Exception {
 
-        return customerService.importData(file);
+        return customerService.importData(file, type);
     }
 
     /**
@@ -121,4 +115,33 @@
     }
 
 
-}
+    /**
+     * 鍒嗛厤瀹㈡埛
+     */
+    @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
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
index d10e370..2b70438 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
@@ -46,7 +46,7 @@
     @ApiOperation("鏌ヨ瀹㈡埛璺熻繘鍒楄〃")
     public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) {
         LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(customerFollowUp.getCustomerPrivatePoolId() != null, CustomerFollowUp::getCustomerPrivatePoolId, customerFollowUp.getCustomerPrivatePoolId())
+        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);
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
deleted file mode 100644
index 1807ce7..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
+++ /dev/null
@@ -1,90 +0,0 @@
-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>
- * 瀹㈡埛妗f 鍓嶇鎺у埗鍣�
- * </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));
-    }
-
-
-    /**
-     * 瀵煎叆瀹㈡埛妗f
-     */
-    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
-    @PostMapping("/importData")
-    public R importData(MultipartFile file) throws Exception {
-
-        return customerPrivateService.importData(file);
-    }
-
-    /**
-     * 瀵煎嚭瀹㈡埛妗f鍒楄〃
-     */
-    @Log(title = "瀹㈡埛妗f", 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, "瀹㈡埛妗f鏁版嵁");
-    }
-
-    @PostMapping("/downloadTemplate")
-    @Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
-    public void downloadTemplate(HttpServletResponse response) {
-        ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
-        util.importTemplateExcel(response, "瀹㈡埛妗f妯℃澘");
-    }
-}
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
deleted file mode 100644
index 8b8edf7..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
+++ /dev/null
@@ -1,93 +0,0 @@
-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.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.basic.service.CustomerPrivatePoolService;
-import com.ruoyi.common.utils.SecurityUtils;
-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 io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * <p>
- *  鍓嶇鎺у埗鍣� 瀹㈡埛锛堢娴凤級
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@RestController
-@Api(tags = "瀹㈡埛锛堢娴凤級")
-@RequestMapping("/customerPrivatePool")
-public class CustomerPrivatePoolController {
-
-    @Autowired
-    private CustomerPrivatePoolService customerPrivatePoolService;
-
-
-    @GetMapping("/listPage")
-    @ApiOperation("瀹㈡埛锛堢娴凤級鍒楄〃")
-    public R listPage(CustomerPrivatePoolDto customerPrivatePoolDto, Page<CustomerPrivatePoolDto> page){
-        //鏌ヨ褰撳墠鐢ㄦ埛鐨勫鎴蜂俊鎭�
-        customerPrivatePoolDto.setBoundId(SecurityUtils.getUserId());
-        IPage<CustomerPrivatePoolDto> listPage = customerPrivatePoolService.listPage(page, customerPrivatePoolDto);
-        return R.ok(listPage);
-    }
-
-    @PostMapping("/add")
-    @ApiOperation("鍒嗛厤瀹㈡埛锛堢娴凤級")
-    public R add(@RequestBody CustomerPrivatePoolDto customerPrivatePool){
-        boolean result = customerPrivatePoolService.add(customerPrivatePool);
-        return R.ok(result);
-    }
-
-    @PutMapping("/update")
-    public R update(@RequestBody CustomerPrivatePoolDto customerPrivatePoolDto) {
-        return R.ok(customerPrivatePoolService.updateCustomerPrivatePoolDto(customerPrivatePoolDto));
-    }
-
-
-    @DeleteMapping("/delete/{id}")
-    @ApiOperation("鍒犻櫎瀹㈡埛锛堢娴凤級")
-    public R delete(@PathVariable Long id){
-        boolean result = customerPrivatePoolService.deleteCustomerPrivatePool(id);
-        return R.ok(result);
-    }
-
-    @PostMapping("/together")
-    @ApiOperation("鍏变韩")
-    public R together( @RequestBody CustomerPrivatePoolDto customerPrivatePool){
-        boolean result = customerPrivatePoolService.together(customerPrivatePool);
-        return R.ok(result);
-    }
-
-    @GetMapping("/info/{id}")
-    @ApiOperation("璇︽儏")
-    public R getInfo(@PathVariable Long id){
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getInfo(id);
-        return R.ok(customerPrivatePool);
-    }
-
-    @GetMapping("/getbyId/{id}")
-    @ApiOperation("璇︽儏")
-    public R getbyId(@PathVariable Long id){
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getbyId(id);
-        return R.ok(customerPrivatePool);
-    }
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
index 630119f..d75de55 100644
--- a/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
+++ b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
@@ -25,4 +25,8 @@
 
     private String togetherUserNames;
 
-}
+    /**
+     * 鍏变韩鐢ㄦ埛ID鍒楄〃
+     */
+    private List<Long> userIds;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
deleted file mode 100644
index c06ad62..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ruoyi.basic.dto;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class CustomerPrivateDto extends CustomerPrivate {
-
-    private List<CustomerFollowUpDto> followUpList;
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
deleted file mode 100644
index c06f542..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.ruoyi.basic.dto;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-@Data
-public class CustomerPrivatePoolDto extends CustomerPrivatePool {
-
-    /**
-     * 瀹㈡埛鍚嶇О
-     */
-    @Excel(name = "瀹㈡埛鍚嶇О")
-    private String customerName;
-    /** 瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴� */
-
-    @ApiModelProperty(value = "瀹㈡埛瑕乮d")
-    private Long customerId;
-
-    /**
-     * 璺熻繘绋嬪害
-     */
-//    @Excel(name = "璺熻繘绋嬪害")
-    @TableField(exist = false)
-    private String followUpLevel;
-
-    /**
-     * 璺熻繘鏃堕棿
-     */
-//    @Excel(name = "璺熻繘鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
-    @TableField(exist = false)
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date followUpTime;
-
-    @Excel(name = "瀹㈡埛鍒嗙被")
-    private String customerType;
-
-
-    private  String addressPhone;
-    /**
-     * 绾崇◣浜鸿瘑鍒彿
-     */
-    @Excel(name = "绾崇◣浜鸿瘑鍒彿")
-    private String taxpayerIdentificationNumber;
-
-    /**
-     * 鍏徃鍦板潃
-     */
-    @Excel(name = "鍏徃鍦板潃")
-    private String companyAddress;
-
-    /**
-     * 鍏徃鐢佃瘽
-     */
-    @Excel(name = "鍏徃鐢佃瘽")
-    private String companyPhone;
-
-    /**
-     * 鑱旂郴浜�
-     */
-    @Excel(name = "鑱旂郴浜�")
-    private String contactPerson;
-
-    /**
-     * 鑱旂郴鐢佃瘽
-     */
-    @Excel(name = "鑱旂郴鐢佃瘽",cellType = Excel.ColumnType.STRING)
-    private String contactPhone;
-
-    /**
-     * 缁存姢浜�
-     */
-    @Excel(name = "缁存姢浜�")
-    private String maintainer;
-
-    /**
-     * 缁存姢鏃堕棿
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "缁存姢鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
-    private Date maintenanceTime;
-
-    @TableField(fill = FieldFill.INSERT)
-    private Long tenantId;
-
-    @ApiModelProperty(value = "閾惰鍩烘湰鎴�")
-    @Excel(name = "閾惰鍩烘湰鎴�")
-    private String basicBankAccount;
-
-    @ApiModelProperty(value = "閾惰璐﹀彿")
-    @Excel(name = "閾惰璐﹀彿")
-    private String bankAccount;
-
-    @ApiModelProperty(value = "寮�鎴疯鍙�")
-    @Excel(name = "寮�鎴疯鍙�")
-    private String bankCode;
-    @ApiModelProperty(value = "鍒涘缓鐢ㄦ埛")
-    @TableField(fill = FieldFill.INSERT)
-    private Integer createUser;
-
-
-    @ApiModelProperty(value = "璺熻繘璁板綍")
-    private List<CustomerFollowUpDto> followUpList;
-
-    @ApiModelProperty(value = "缁戝畾浜篿ds")
-    private List< Long> boundIds;
-
-    @Excel(isExport = false)
-    private List<Long> ids;
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
index ac86398..2605737 100644
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.basic.dto.CustomerDto;
 import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.vo.CustomerVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -67,5 +68,7 @@
      */
     int deleteCustomerByIds(Long[] ids);
 
-    IPage<CustomerDto> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer);
-}
+    IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
+
+    List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
deleted file mode 100644
index 4f1bf6d..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * <p>
- * 瀹㈡埛妗f Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Mapper
-public interface CustomerPrivateMapper extends BaseMapper<CustomerPrivate> {
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
deleted file mode 100644
index 4c6f325..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * <p>
- *  Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Mapper
-public interface CustomerPrivatePoolMapper extends BaseMapper<CustomerPrivatePool> {
-
-    IPage<CustomerPrivatePoolDto> listPage(IPage<CustomerPrivatePoolDto> page, @Param("c") CustomerPrivatePoolDto customerPrivatePoolDto);
-
-    CustomerPrivatePoolDto selectInfo(Long id);
-
-    List<CustomerPrivatePoolDto> selectInfos();
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java
new file mode 100644
index 0000000..84aebac
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.CustomerUser;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 瀹㈡埛鍏变韩Mapper鎺ュ彛
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+@Mapper
+public interface CustomerUserMapper extends BaseMapper<CustomerUser> {
+}
diff --git a/src/main/java/com/ruoyi/basic/pojo/Customer.java b/src/main/java/com/ruoyi/basic/pojo/Customer.java
index e63c512..068dd4d 100644
--- a/src/main/java/com/ruoyi/basic/pojo/Customer.java
+++ b/src/main/java/com/ruoyi/basic/pojo/Customer.java
@@ -129,4 +129,9 @@
     @ApiModelProperty(value = "浣跨敤鐘舵��")
     private Long usageStatus;
 
+    @ApiModelProperty(value = "绫诲瀷 0 绉佹捣瀹㈡埛 1 鍏捣瀹㈡埛")
+    private Integer type;
+
+    @ApiModelProperty(value = "鏄惁琚垎閰嶏細0-鏈垎閰嶏紝1-宸插垎閰�")
+    private Integer isAssigned;
 }
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
index 5f174a5..a0e9cde 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
@@ -37,7 +37,7 @@
     /**
      * 鍏宠仈鐨勭娴穒d
      */
-    private Long customerPrivatePoolId;
+    private Long customerId;
 
     /**
      * 璺熻繘鏂瑰紡
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
deleted file mode 100644
index 85f49a5..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.ruoyi.basic.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * <p>
- * 瀹㈡埛妗f
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Getter
-@Setter
-@TableName("customer_private")
-@ApiModel(value = "CustomerPrivate瀵硅薄", description = "瀹㈡埛妗f")
-public class CustomerPrivate implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    @ApiModelProperty("瀹㈡埛鍚嶇О")
-    @Excel(name = "瀹㈡埛鍚嶇О")
-    private String customerName;
-
-    @ApiModelProperty("绾崇◣浜鸿瘑鍒彿")
-    @Excel(name = "绾崇◣浜鸿瘑鍒彿")
-    private String taxpayerIdentificationNumber;
-
-    @ApiModelProperty("鍏徃鍦板潃")
-    @Excel(name = "鍏徃鍦板潃")
-    private String companyAddress;
-
-    @ApiModelProperty("鍏徃鐢佃瘽")
-    @Excel(name = "鍏徃鐢佃瘽")
-    private String companyPhone;
-
-    @ApiModelProperty("鑱旂郴浜�")
-    @Excel(name = "鑱旂郴浜�")
-    private String contactPerson;
-
-    @ApiModelProperty("鑱旂郴鐢佃瘽")
-    @Excel(name = "鑱旂郴鐢佃瘽", cellType = Excel.ColumnType.STRING)
-    private String contactPhone;
-
-    @ApiModelProperty("缁存姢浜�")
-    @Excel(name = "缁存姢浜�")
-    private String maintainer;
-
-    @ApiModelProperty("缁存姢鏃堕棿")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "缁存姢鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date maintenanceTime;
-
-    @ApiModelProperty("绉熸埛ID")
-    @TableField(fill = FieldFill.INSERT)
-    private Long tenantId;
-
-    @ApiModelProperty("閾惰鍩烘湰鎴�")
-    @Excel(name = "閾惰鍩烘湰鎴�")
-    private String basicBankAccount;
-
-    @ApiModelProperty("閾惰璐﹀彿")
-    @Excel(name = "閾惰璐﹀彿")
-    private String bankAccount;
-
-    @ApiModelProperty("寮�鎴疯鍙�")
-    @Excel(name = "寮�鎴疯鍙�")
-    private String bankCode;
-
-    @ApiModelProperty("瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴�")
-    @Excel(name = "瀹㈡埛鍒嗙被")
-    private String customerType;
-
-    @ApiModelProperty("鍒涘缓浜篒D")
-    @TableField(fill = FieldFill.INSERT)
-    private Long createUser;
-
-    @ApiModelProperty("閮ㄩ棬ID")
-    @TableField(fill = FieldFill.INSERT)
-    private Long deptId;
-
-
-    @ApiModelProperty("璺熻繘绋嬪害")
-    @TableField(exist = false)
-    private String followUpLevel;
-
-    @ApiModelProperty("璺熻繘鏃堕棿")
-    @TableField(exist = false)
-    private Date followUpTime;
-
-
-    @TableField(exist = false)
-    private Long[] ids;
-
-    @TableField(exist = false)
-    private String addressPhone;
-
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
deleted file mode 100644
index edf88d7..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.ruoyi.basic.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Data
-@TableName("customer_private_pool")
-@ApiModel(value = "CustomerPrivatePool瀵硅薄", description = "")
-public class CustomerPrivatePool implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty("涓婚敭id")
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    @ApiModelProperty("瀹㈡埛id")
-    private Long customerId;
-
-    @ApiModelProperty("缁戝畾浜篿d")
-    private Long boundId;
-
-    @ApiModelProperty("鍒涘缓浜�")
-    @TableField(fill = FieldFill.INSERT)
-    private Integer createUser;
-
-    @ApiModelProperty("鏇存柊浜�")
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private Integer updateUser;
-
-    @ApiModelProperty("鍒涘缓鏃堕棿")
-    @TableField(fill = FieldFill.INSERT)
-    private LocalDateTime createTime;
-
-    @ApiModelProperty("鏇存柊鏃堕棿")
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private LocalDateTime updateTime;
-
-    @ApiModelProperty("绫诲瀷鍖哄垎鍏捣瀹㈡埛鍜岀娴峰鎴� 榛樿鏄娴峰鎴�0 鍏捣1")
-    private Long type;
-
-    @ApiModelProperty("閮ㄩ棬id")
-    @TableField(fill = FieldFill.INSERT)
-    private Long deptId;
-
-    @ApiModelProperty("鍒犻櫎鏍囪瘑 榛樿0 1宸茬粡鍒犻櫎")
-    private Integer DeleteFlag;
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
index f2edcc5..ddd3d4b 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
@@ -36,7 +36,7 @@
     /**
      * 鍏宠仈瀹㈡埛ID
      */
-    private Integer customerPrivatePoolId;
+    private Long customerId;
 
     /**
      * 鎻愰啋寮�鍏� (0:鍏抽棴, 1:寮�鍚�)
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java b/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java
new file mode 100644
index 0000000..901b0ce
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java
@@ -0,0 +1,43 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+@TableName(value = "customer_user")
+@Data
+public class CustomerUser implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 搴忓彿
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 瀹㈡埛id
+     */
+    private Long customerId;
+
+    /**
+     * 鐢ㄦ埛id
+     */
+    private Long userId;
+
+    /**
+     * 绉熸埛id
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private Long tenantId;
+
+    /**
+     * 褰曞叆鏃堕棿
+     */
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
deleted file mode 100644
index 18ca371..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-/**
- * <p>
- *  鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-public interface CustomerPrivatePoolService extends IService<CustomerPrivatePool> {
-
-    IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto);
-
-    boolean deleteCustomerPrivatePool(Long id);
-
-    boolean together(CustomerPrivatePoolDto customerPrivatePool);
-
-    boolean add(CustomerPrivatePoolDto customerPrivatePool);
-
-    CustomerPrivatePoolDto getInfo(Long id);
-
-    Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto);
-
-    CustomerPrivatePoolDto getbyId(Long id);
-
-    List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids);
-
-    List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
deleted file mode 100644
index e758157..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-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.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.domain.R;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-public interface CustomerPrivateService extends IService<CustomerPrivate> {
-
-
-    Boolean add(CustomerPrivateDto customerPrivateDto);
-
-
-    Integer delete(List<Long> id);
-
-    R importData(MultipartFile file);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerUserService.java b/src/main/java/com/ruoyi/basic/service/CustomerUserService.java
new file mode 100644
index 0000000..eda5f8e
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/CustomerUserService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.basic.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.pojo.CustomerUser;
+
+/**
+ * 瀹㈡埛鍏变韩Service鎺ュ彛
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+public interface CustomerUserService extends IService<CustomerUser> {
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/service/ICustomerService.java b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
index c27dd92..c120e72 100644
--- a/src/main/java/com/ruoyi/basic/service/ICustomerService.java
+++ b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
@@ -4,8 +4,8 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.basic.dto.CustomerDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
 import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.vo.CustomerVo;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -33,7 +33,7 @@
      * @param id 瀹㈡埛妗f涓婚敭
      * @return 瀹㈡埛璇︽儏DTO
      */
-    Customer selectCustomerDetailById(Long id);
+    CustomerVo selectCustomerDetailById(Long id);
 
     /**
      * 鏌ヨ瀹㈡埛妗f鍒楄〃
@@ -75,9 +75,20 @@
      */
     List<Map<String, Object>> customerList(Customer customer);
 
-    List<Customer> selectCustomerLists(Customer customer);
+    List<CustomerVo> selectCustomerLists(CustomerDto customer);
 
-    AjaxResult importData(MultipartFile file);
+    AjaxResult importData(MultipartFile file, Integer type);
 
-    IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer);
-}
+    IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer);
+
+    void assignCustomer(CustomerDto customer);
+
+    void recycleCustomer(CustomerDto customer);
+
+    /**
+     * 鍏变韩瀹㈡埛缁欏叾浠栫敤鎴�
+     *
+     * @param customerDto 瀹㈡埛DTO锛堝寘鍚鎴稩D鍜屽叡浜敤鎴稩D鍒楄〃锛�
+     */
+    void together(CustomerDto customerDto);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
index 12c7e06..5637307 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
@@ -132,7 +132,7 @@
         }
 
         List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>()
-                .eq(CustomerFollowUp::getCustomerPrivatePoolId, customerId));
+                .eq(CustomerFollowUp::getCustomerId, customerId));
 
         if (followUps != null && !followUps.isEmpty()) {
             for (CustomerFollowUp followUp : followUps) {
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
deleted file mode 100644
index 0586c9b..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerDto;
-import com.ruoyi.basic.dto.CustomerFollowUpDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.pojo.*;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.service.*;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.pojo.SalesLedger;
-import org.checkerframework.checker.units.qual.A;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.time.ZoneId;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-public class CustomerPrivatePoolServiceImpl extends ServiceImpl<CustomerPrivatePoolMapper, CustomerPrivatePool> implements CustomerPrivatePoolService {
-
-    @Autowired
-    private CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
-    @Autowired
-    private CustomerFollowUpService customerFollowUpService;
-
-    @Autowired
-    private CustomerReturnVisitService customerReturnVisitService;
-
-    @Autowired
-    private ICustomerService customerService;
-
-    @Autowired
-    private CustomerFollowUpFileService customerFollowUpFileService;
-    @Autowired
-    private CustomerPrivateMapper customerPrivateMapper;
-
-
-    @Override
-    public IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto) {
-        IPage<CustomerPrivatePoolDto> customerPrivatePoolDtoIPage = customerPrivatePoolMapper.listPage(page, customerPrivatePoolDto);
-        List<Long> customerIds = customerPrivatePoolDtoIPage.getRecords().stream()
-                .map(CustomerPrivatePoolDto::getId )
-                .filter(Objects::nonNull)
-                .collect(Collectors.toList());
-
-        if (!org.springframework.util.CollectionUtils.isEmpty(customerIds)) {
-            Map<Long, CustomerFollowUp> latestFollowUpMap = getLatestFollowUpMap(customerIds);
-
-            customerPrivatePoolDtoIPage.getRecords().forEach(c -> {
-                String address = StringUtils.defaultString(c.getCompanyAddress(), "");
-                String phone = StringUtils.defaultString(c.getCompanyPhone(), "");
-                c.setAddressPhone(address + "(" + phone + ")");
-
-                CustomerFollowUp followUp = latestFollowUpMap.get(c.getId());
-                if (followUp != null) {
-                    c.setFollowUpLevel(followUp.getFollowUpLevel());
-                    c.setFollowUpTime(Date.from(
-                            followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
-                    ));
-                }
-            });
-
-        }
-        return customerPrivatePoolDtoIPage;
-    }
-
-
-    private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
-        List<CustomerFollowUp> followUps = customerFollowUpService.list(
-                new LambdaQueryWrapper<CustomerFollowUp>()
-                        .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
-                        .orderByDesc(CustomerFollowUp::getFollowUpTime)
-        );
-
-        return followUps.stream()
-                .collect(Collectors.toMap(
-                        CustomerFollowUp::getCustomerPrivatePoolId,
-                        followUp -> followUp,
-                        (existing, replacement) -> existing
-                ));
-    }
-
-    @Override
-    public boolean deleteCustomerPrivatePool(Long id) {
-        List<CustomerPrivatePool> list = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, id));
-
-        for (CustomerPrivatePool customerPrivatePool : list) {
-            customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().eq(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePool.getId()));
-            customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePool.getId()));
-        }
-        Customer byId = customerService.getById(id);
-        byId.setUsageStatus(0L);
-        byId.setUsageUser(0L);
-        customerService.updateById(byId);
-        list.stream().forEach(customerPrivatePool -> {
-            customerPrivatePool.setDeleteFlag(1);
-            customerPrivatePoolMapper.updateById(customerPrivatePool);
-        });
-        return true;
-    }
-
-    @Override
-    public boolean together(CustomerPrivatePoolDto customerPrivatePoolDto) {
-        List<CustomerPrivatePool> existingPools = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, customerPrivatePoolDto.getCustomerId()));
-
-        List<Long> existingBoundIds = existingPools.stream()
-                .map(CustomerPrivatePool::getBoundId)
-                .collect(Collectors.toList());
-
-        List<Long> newBoundIds = customerPrivatePoolDto.getBoundIds().stream()
-                .filter(boundId -> !existingBoundIds.contains(boundId))
-                .collect(Collectors.toList());
-
-        if (CollectionUtils.isEmpty(newBoundIds)) {
-            return true;
-        }
-        for (Long id : customerPrivatePoolDto.getBoundIds()) {
-            CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
-            customerPrivatePool.setCustomerId(customerPrivatePoolDto.getCustomerId());
-            customerPrivatePool.setBoundId(id);
-            customerPrivatePool.setType(1L);
-            this.save(customerPrivatePool);
-        }
-        return true;
-    }
-
-    @Override
-    public boolean add(CustomerPrivatePoolDto customerPrivatePool) {
-        customerPrivatePool.setType(1L);
-        this.save(customerPrivatePool);
-        Customer byId = customerService.getById(customerPrivatePool.getCustomerId());
-        if (byId != null) {
-            byId.setUsageStatus(1L);
-            byId.setUsageUser(customerPrivatePool.getBoundId());
-            return customerService.updateById(byId);
-        }
-        throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
-
-    }
-
-    @Override
-    public CustomerPrivatePoolDto getInfo(Long id) {
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
-        if (customerPrivatePool == null) {
-            return null;
-        }
-
-        // 鏌ヨ璺熻繘璁板綍
-        List<CustomerFollowUp> followUpList = customerFollowUpService.list(
-                new LambdaQueryWrapper<CustomerFollowUp>()
-                        .eq(CustomerFollowUp::getCustomerPrivatePoolId, id)
-                        .orderByDesc(CustomerFollowUp::getFollowUpTime)
-        );
-        if (!CollectionUtils.isEmpty(followUpList)) {
-            List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> {
-                CustomerFollowUpDto followUpDto = new CustomerFollowUpDto();
-                BeanUtils.copyProperties(followUp, followUpDto);
-
-                // 鏌ヨ闄勪欢
-                List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(
-                        new LambdaQueryWrapper<CustomerFollowUpFile>()
-                                .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId())
-                );
-                followUpDto.setFileList(fileList);
-
-                return followUpDto;
-            }).collect(Collectors.toList());
-
-            customerPrivatePool.setFollowUpList(followUpDtoList);
-        }
-
-        return customerPrivatePool;
-    }
-
-    @Override
-    public Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto) {
-        if (customerPrivatePoolDto.getType() == 0L) {
-            CustomerPrivate byId = customerPrivateMapper.selectById(customerPrivatePoolDto.getCustomerId());
-            BeanUtils.copyProperties(customerPrivatePoolDto, byId);
-            byId.setId(customerPrivatePoolDto.getCustomerId());
-            customerPrivateMapper.updateById(byId);
-        } else if (customerPrivatePoolDto.getType() == 1L) {
-            Customer customer = customerService.getById(customerPrivatePoolDto.getCustomerId());
-            BeanUtils.copyProperties(customerPrivatePoolDto, customer);
-            customer.setId(customerPrivatePoolDto.getCustomerId());
-            customerService.updateById(customer);
-        }
-        return true;
-    }
-
-    @Override
-    public CustomerPrivatePoolDto getbyId(Long id) {
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
-        return customerPrivatePool;
-    }
-
-    @Override
-    public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids) {
-        ArrayList<CustomerPrivatePoolDto> customerPrivatePoolDtos = new ArrayList<>();
-        for (Long id : ids) {
-            CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(id);
-            customerPrivatePoolDtos.add(customerPrivatePoolDto);
-        }
-        return customerPrivatePoolDtos;
-    }
-
-    @Override
-    public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto) {
-
-        return customerPrivatePoolMapper.selectInfos();
-    }
-}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
deleted file mode 100644
index 95f6193..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.*;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.service.CustomerFollowUpService;
-import com.ruoyi.basic.service.CustomerPrivateService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.service.CustomerReturnVisitService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.pojo.SalesLedger;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-public class CustomerPrivateServiceImpl extends ServiceImpl<CustomerPrivateMapper, CustomerPrivate> implements CustomerPrivateService {
-
-
-    @Autowired
-    private CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
-    @Autowired
-    private CustomerFollowUpService customerFollowUpService;
-
-    @Autowired
-    private CustomerReturnVisitService customerReturnVisitService;
-    @Autowired
-    private SalesLedgerMapper salesLedgerMapper;
-
-    @Autowired
-    private  CustomerPrivateMapper customerPrivateMapper;
-    @Autowired
-    private CustomerPrivateService customerPrivateService;
-
-
-    @Override
-    public Boolean add(CustomerPrivateDto customerPrivateDto) {
-        //鏂板绉佹捣 瀹㈡埛
-        this.save(customerPrivateDto);
-        //鏂板绉佹捣璁板綍
-        CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
-        customerPrivatePool.setCustomerId(customerPrivateDto.getId());
-        customerPrivatePool.setType(0L);
-        customerPrivatePool.setBoundId(SecurityUtils.getLoginUser().getUserId());
-        customerPrivatePoolMapper.insert(customerPrivatePool);
-        return true;
-    }
-
-
-    @Override
-    public Integer delete(List<Long> ids) {
-        List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getId, ids));
-        List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
-        if (!CollectionUtils.isEmpty(salesLedgers)) {
-            throw new RuntimeException("瀹㈡埛鏈夐攢鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
-        }
-        if (CollectionUtils.isEmpty(customerPrivatePools)) {
-            throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
-        }
-        customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().in(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
-        customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().in(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
-        customerPrivatePools.stream().forEach(customerPrivatePool -> {
-            customerPrivatePool.setDeleteFlag(1);
-            customerPrivatePoolMapper.updateById(customerPrivatePool);
-        });
-        return 1;
-
-    }
-
-    @Override
-    public R importData(MultipartFile file) {
-        try {
-            List<CustomerPrivate> existingList = customerPrivateService.list();
-            java.util.Set<String> existingCustomerNames = existingList.stream()
-                    .map(CustomerPrivate::getCustomerName)
-                    .collect(Collectors.toSet());
-
-            ExcelUtil<CustomerPrivate> util = new ExcelUtil<CustomerPrivate>(CustomerPrivate.class);
-            List<CustomerPrivate> userList = util.importExcel(file.getInputStream());
-            if (CollectionUtils.isEmpty(userList)) {
-                return R.fail("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
-            }
-
-            int successCount = 0;
-            int skipCount = 0;
-            for (CustomerPrivate user : userList) {
-                if (existingCustomerNames.contains(user.getCustomerName())) {
-                    skipCount++;
-                    continue;
-                }
-                CustomerPrivateDto customerPrivateDto = new CustomerPrivateDto();
-                BeanUtils.copyProperties(user, customerPrivateDto);
-                this.add(customerPrivateDto);
-                existingCustomerNames.add(user.getCustomerName());
-                successCount++;
-            }
-            return R.ok("瀵煎叆瀹屾垚锛屾垚鍔�" + successCount + "鏉★紝璺宠繃閲嶅" + skipCount + "鏉�");
-        } catch (Exception e) {
-            e.printStackTrace();
-            return R.fail("瀵煎叆澶辫触锛�" + e.getMessage());
-        }
-    }
-}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
index 58bc422..0186349 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
@@ -75,7 +75,7 @@
             throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
         }
         LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId);
+        queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
         CustomerReturnVisit returnVisit = baseMapper.selectOne(queryWrapper);
 
         if (returnVisit == null) {
@@ -94,7 +94,7 @@
             throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
         }
         LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId);
+        queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
         List<CustomerReturnVisit> returnVisits = baseMapper.selectList(queryWrapper);
 
         for (CustomerReturnVisit returnVisit : returnVisits) {
@@ -124,7 +124,7 @@
         if (returnVisit == null) {
             throw new ServiceException("鍥炶鎻愰啋鏁版嵁涓嶈兘涓虹┖");
         }
-        if (returnVisit.getCustomerPrivatePoolId() == null) {
+        if (returnVisit.getCustomerId() == null) {
             throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
         }
         if (returnVisit.getReminderTime() == null) {
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
index e5f31ff..d826a94 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -9,23 +9,19 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.basic.dto.CustomerDto;
 import com.ruoyi.basic.dto.CustomerFollowUpDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
 import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerFollowUpFile;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
+import com.ruoyi.basic.pojo.*;
 import com.ruoyi.basic.service.CustomerFollowUpFileService;
 import com.ruoyi.basic.service.CustomerFollowUpService;
 import com.ruoyi.basic.service.CustomerReturnVisitService;
+import com.ruoyi.basic.service.CustomerUserService;
 import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.basic.vo.CustomerVo;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.security.LoginUser;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.sales.mapper.SalesLedgerMapper;
 import com.ruoyi.sales.pojo.SalesLedger;
 import lombok.AllArgsConstructor;
@@ -37,7 +33,6 @@
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.time.LocalDate;
 import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -56,8 +51,6 @@
     @Autowired
     private  SalesLedgerMapper salesLedgerMapper;
     @Autowired
-    private CustomerPrivatePoolMapper customerPrivatePoolMapper;
-    @Autowired
     private CustomerMapper customerMapper;
 
     @Autowired
@@ -66,6 +59,8 @@
     private CustomerFollowUpFileService customerFollowUpFileService;
     @Autowired
     private CustomerReturnVisitService customerReturnVisitService;
+    @Autowired
+    private CustomerUserService customerUserService;
 
     /**
      * 鏌ヨ瀹㈡埛妗f
@@ -85,8 +80,35 @@
      * @return 瀹㈡埛璇︽儏DTO
      */
     @Override
-    public Customer selectCustomerDetailById(Long id) {
-        return this.getById( id);
+    public CustomerVo selectCustomerDetailById(Long id) {
+        CustomerVo customerVo = new CustomerVo();
+        BeanUtils.copyProperties(this.getById(id), customerVo);
+
+        // 鏌ヨ璺熻繘璁板綍
+        List<CustomerFollowUp> followUpList = customerFollowUpService.list(
+                new LambdaQueryWrapper<CustomerFollowUp>()
+                        .eq(CustomerFollowUp::getCustomerId, id)
+                        .orderByDesc(CustomerFollowUp::getFollowUpTime)
+        );
+        if (!com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(followUpList)) {
+            List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> {
+                CustomerFollowUpDto followUpDto = new CustomerFollowUpDto();
+                BeanUtils.copyProperties(followUp, followUpDto);
+
+                // 鏌ヨ闄勪欢
+                List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(
+                        new LambdaQueryWrapper<CustomerFollowUpFile>()
+                                .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId())
+                );
+                followUpDto.setFileList(fileList);
+
+                return followUpDto;
+            }).collect(Collectors.toList());
+
+            customerVo.setFollowUpList(followUpDtoList);
+        }
+
+        return customerVo;
     }
 
     /**
@@ -96,16 +118,18 @@
      * @return 瀹㈡埛妗f
      */
     @Override
-    public IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) {
-        IPage<CustomerDto> customerPage = customerMapper.listPage(page, customer);
+    public IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long loginUserId = loginUser.getUserId();
+        IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId);
 
-        List<CustomerDto> records = customerPage.getRecords();
+        List<CustomerVo> records = customerPage.getRecords();
         if (CollectionUtils.isEmpty(records)) {
             return customerPage;
         }
 
         List<Long> customerIds = records.stream()
-                .map(CustomerDto::getId)
+                .map(CustomerVo::getId)
                 .filter(Objects::nonNull)
                 .collect(Collectors.toList());
 
@@ -124,6 +148,16 @@
                             followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
                     ));
                 }
+
+                // 杞崲鍏变韩鐢ㄦ埛ID瀛楃涓蹭负List<Long>
+                String userIdsStr = c.getUserIdsStr();
+                if (StringUtils.isNotEmpty(userIdsStr)) {
+                    List<Long> userIds = Arrays.stream(userIdsStr.split(","))
+                            .map(String::trim)
+                            .map(Long::parseLong)
+                            .collect(Collectors.toList());
+                    c.setUserIds(userIds);
+                }
             });
         }
 
@@ -133,13 +167,13 @@
     private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
         List<CustomerFollowUp> followUps = customerFollowUpService.list(
                 new LambdaQueryWrapper<CustomerFollowUp>()
-                        .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
+                        .in(CustomerFollowUp::getCustomerId, customerIds)
                         .orderByDesc(CustomerFollowUp::getFollowUpTime)
         );
 
         return followUps.stream()
                 .collect(Collectors.toMap(
-                        CustomerFollowUp::getCustomerPrivatePoolId,
+                        CustomerFollowUp::getCustomerId,
                         followUp -> followUp,
                         (existing, replacement) -> existing
                 ));
@@ -187,16 +221,28 @@
         if (!salesLedgers.isEmpty()) {
             throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
         }
-        List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getCustomerId, idList));
-        if (!customerPrivatePools.isEmpty()) {
-            throw new RuntimeException("瀹㈡埛妗f涓嬫湁瀹㈡埛绉佹捣锛岃鍏堟敹鍥炵娴锋暟鎹�");
+        // 鏌ヨ鏄惁鏈夊凡鍒嗛厤鐨勫叕娴峰鎴�
+        List<Customer> assignedPools = customerMapper.selectList(
+                new QueryWrapper<Customer>().lambda()
+                        .in(Customer::getId, idList)
+                        .eq(Customer::getType, 1).
+                        eq(Customer::getIsAssigned, 1)  // 鍏捣瀹㈡埛
+        );
+        if (!assignedPools.isEmpty()) {
+            throw new RuntimeException("瀹㈡埛妗f涓嬫湁宸插垎閰嶇殑鍏捣瀹㈡埛锛岃鍏堟敹鍥�");
         }
-        //  鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
+        // 鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
         for (Long id : ids) {
             customerFollowUpService.deleteByCustomerId(id);
             customerReturnVisitService.deleteByCustomerId(id);
+            // 鍒犻櫎瀹㈡埛鐨勫叡浜叧绯�
+            customerUserService.remove(
+                new QueryWrapper<CustomerUser>().lambda()
+                    .eq(CustomerUser::getCustomerId, id)
+            );
         }
 
+        // 鍒犻櫎瀹㈡埛涓昏〃鏁版嵁
         return customerMapper.deleteBatchIds(idList);
     }
 
@@ -208,17 +254,26 @@
     }
 
     @Override
-    public List<Customer> selectCustomerLists(Customer customer) {
-        return customerMapper.selectList(null);
+    public List<CustomerVo> selectCustomerLists(CustomerDto customer) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long loginUserId = loginUser.getUserId();
+        return customerMapper.list(customer, loginUserId);
     }
 
     @Override
-    public AjaxResult importData(MultipartFile file) {
+    public AjaxResult importData(MultipartFile file, Integer type) {
         try {
             ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
             List<Customer> userList = util.importExcel(file.getInputStream());
             if (CollectionUtils.isEmpty(userList)) {
                 return AjaxResult.warn("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
+            }
+
+            // 鏍规嵁 type 鍙傛暟璁剧疆瀹㈡埛绫诲瀷锛堢娴�/鍏捣锛�
+            if (type != null) {
+                userList.forEach(customer -> {
+                    customer.setType(type);
+                });
             }
             this.saveOrUpdateBatch(userList);
             return AjaxResult.success(true);
@@ -245,6 +300,77 @@
         ).collect(Collectors.toList());
     }
 
+    // 鍒嗛厤鍏捣瀹㈡埛缁欑娴�
+    @Override
+    public void assignCustomer(CustomerDto customerDto) {
+        Customer customer = customerMapper.selectById(customerDto.getId());
+        if (customer.getType() == 1 && customer.getIsAssigned() == 0) {  // 鍏捣涓斿彲鍒嗛厤
+            customer.setIsAssigned(1);
+            customer.setUsageStatus(1L);
+            customer.setUsageUser(customerDto.getUsageUser());
+            customerMapper.updateById(customer);
+        }
+    }
+
+    // 鍥炴敹绉佹捣瀹㈡埛鍒板叕娴�
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void recycleCustomer(CustomerDto customerDto) {
+        Customer customer = customerMapper.selectById(customerDto.getId());
+        if (customer.getType() == 1 && customer.getIsAssigned() == 1) {  // 鍏捣涓斿凡鍒嗛厤
+            customer.setIsAssigned(0);
+            customer.setUsageStatus(0L);
+            customer.setUsageUser(0L);
+            customerMapper.updateById(customer);
+            
+            // 鍒犻櫎璇ュ鎴风殑鎵�鏈夊叡浜叧绯�
+            customerUserService.remove(
+                new QueryWrapper<CustomerUser>().lambda()
+                    .eq(CustomerUser::getCustomerId, customerDto.getId())
+            );
+        }
+    }
+
+    // 瀹㈡埛鍏变韩
+    @Override
+    public void together(CustomerDto customerDto) {
+        // 鏌ヨ鐜版湁鐨勫叡浜褰�
+        List<CustomerUser> existingUsers = customerUserService.list(
+                new QueryWrapper<CustomerUser>().lambda().eq(CustomerUser::getCustomerId, customerDto.getId())
+        );
+
+        // 鑾峰彇宸插瓨鍦ㄧ殑鐢ㄦ埛ID鍒楄〃
+        List<Long> existingUserIds = existingUsers.stream()
+                .map(CustomerUser::getUserId)
+                .collect(Collectors.toList());
+
+        // 杩囨护鎺夊凡瀛樺湪鐨勭敤鎴凤紝鍙繚鐣欐柊鐢ㄦ埛
+        List<Long> newUserIds = customerDto.getUserIds().stream()
+                .filter(userId -> !existingUserIds.contains(userId))
+                .collect(Collectors.toList());
+
+        if (CollectionUtils.isEmpty(newUserIds)) {
+            return;
+        }
+
+        // 鑾峰彇褰撳墠绉熸埛ID
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long tenantId = loginUser.getTenantId();
+
+        // 鎵归噺淇濆瓨鏂扮殑鍏变韩璁板綍
+        List<CustomerUser> customerUsers = newUserIds.stream()
+                .map(userId -> {
+                    CustomerUser customerUser = new CustomerUser();
+                    customerUser.setCustomerId(customerDto.getId());
+                    customerUser.setUserId(userId);
+                    customerUser.setTenantId(tenantId);
+                    return customerUser;
+                })
+                .collect(Collectors.toList());
+
+        customerUserService.saveBatch(customerUsers);
+    }
+
     /**
      * 涓嬪垝绾垮懡鍚嶈浆椹煎嘲鍛藉悕
      */
@@ -266,4 +392,4 @@
         }
         return sb.toString();
     }
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java
new file mode 100644
index 0000000..5829e8a
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.basic.service.impl;
+
+import com.ruoyi.basic.mapper.CustomerUserMapper;
+import com.ruoyi.basic.pojo.CustomerUser;
+import com.ruoyi.basic.service.CustomerUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 瀹㈡埛鍏变韩Service瀹炵幇绫�
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class CustomerUserServiceImpl extends ServiceImpl<CustomerUserMapper, CustomerUser> implements CustomerUserService {
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
index 2b57ee7..245acda 100644
--- a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
+++ b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
@@ -76,7 +76,7 @@
         }
 
         try {
-            unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerPrivatePoolId());
+            unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerId());
             CustomerReturnVisit updateObj = new CustomerReturnVisit();
             updateObj.setId(returnVisitId);
             updateObj.setIsCompleted(1);
diff --git a/src/main/java/com/ruoyi/basic/vo/CustomerVo.java b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
new file mode 100644
index 0000000..3d4c8cb
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
@@ -0,0 +1,28 @@
+package com.ruoyi.basic.vo;
+
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
+import com.ruoyi.basic.pojo.Customer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CustomerVo extends Customer {
+    @ApiModelProperty(value = "璺熻繘璁板綍")
+    private List<CustomerFollowUpDto> followUpList;
+
+    private String usageUserName;
+
+    private String togetherUserNames;
+
+    /**
+     * 鍏变韩鐢ㄦ埛ID鍒楄〃
+     */
+    private List<Long> userIds;
+
+    /**
+     * 鍏变韩鐢ㄦ埛ID瀛楃涓诧紙SQL鏌ヨ杩斿洖锛岀敤浜庤浆鎹负List锛�
+     */
+    private String userIdsStr;
+}
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
index 8c30cb3..ab68adc 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
@@ -162,9 +162,18 @@
             dto.setDateStr(inspectionTask.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
 
             // 鍒濆鍖栦笁涓檮浠跺垪琛�
-            dto.setCommonFileList(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION.getValue())).collect(Collectors.toList()));
-            dto.setCommonFileListAfter(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())).collect(Collectors.toList()));
-            dto.setCommonFileListBefore(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue())).collect(Collectors.toList()));
+            List<CommonFile> taskFiles = finalCommonFiles.stream()
+                    .filter(commonFile -> Objects.equals(commonFile.getCommonId(), inspectionTask.getId()))
+                    .collect(Collectors.toList());
+            dto.setCommonFileList(taskFiles.stream()
+                    .filter(commonFile -> Objects.equals(commonFile.getType(), FileNameType.INSPECTION.getValue()))
+                    .collect(Collectors.toList()));
+            dto.setCommonFileListAfter(taskFiles.stream()
+                    .filter(commonFile -> Objects.equals(commonFile.getType(), FileNameType.INSPECTION_PRODUCTION_AFTER.getValue()))
+                    .collect(Collectors.toList()));
+            dto.setCommonFileListBefore(taskFiles.stream()
+                    .filter(commonFile -> Objects.equals(commonFile.getType(), FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue()))
+                    .collect(Collectors.toList()));
 
 
             return dto;
diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index 5c4f384..189e18f 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -4,7 +4,6 @@
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
 import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
-import com.ruoyi.stock.dto.StockInRecordDto;
 import com.ruoyi.stock.dto.StockInventoryDto;
 import com.ruoyi.stock.dto.StockUninventoryDto;
 import com.ruoyi.stock.mapper.StockInventoryMapper;
@@ -14,21 +13,15 @@
 import com.ruoyi.stock.service.StockInventoryService;
 import com.ruoyi.stock.service.StockOutRecordService;
 import com.ruoyi.stock.service.StockUninventoryService;
-import com.ruoyi.stock.service.impl.StockInRecordServiceImpl;
-import com.ruoyi.stock.service.impl.StockOutRecordServiceImpl;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 
 @Component
 @RequiredArgsConstructor
 public class StockUtils {
-    private final ProcurementRecordOutMapper procurementRecordOutMapper;
-    private final ProcurementRecordMapper procurementRecordMapper;
     private final StockUninventoryService stockUninventoryService;
     private final StockInventoryService stockInventoryService;
     private final StockInRecordService stockInRecordService;
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
index a6e97f4..c73e40a 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
@@ -140,7 +140,7 @@
     /**
      * 鍙戦�佸洖璁挎彁閱�
      */
-    public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Integer customerId) {
+    public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Long customerId) {
         String targetPath = "pages/cooperativeOffice/customerManage/detail?customerId=" + customerId;
         sendRoutingPush(returnVisitId, cid, "瀹㈡埛鍥炶鎻愰啋", content, targetPath, false);
     }
diff --git a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java b/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
index 55aea8f..ce21a49 100644
--- a/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
+++ b/src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -131,7 +131,8 @@
             accountExpense.setSupplierName(purchaseLedger.getSupplierName());
             accountExpense.setExpenseMoney(paymentRegistration.getCurrentPaymentAmount());
             accountExpense.setExpenseDescribed("浠樻鏀嚭");
-            accountExpense.setExpenseMethod("0");
+
+            accountExpense.setExpenseMethod(paymentRegistration.getPaymentMethod());
             accountExpense.setBusinessId(paymentRegistration.getId());
             accountExpense.setBusinessType(1);
             accountExpense.setInputTime(new Date());
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java
index 666ccf4..1b94fe0 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java
@@ -65,4 +65,6 @@
     @ApiModelProperty(value = "閫�璐ф�绘暟")
     private BigDecimal totalReturnNum;
 
+    private String supplierNameOrContractNo;
+
 }
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
index 2761fd7..b72b3af 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
@@ -23,6 +23,9 @@
     @Excel(name = "瀹㈡埛鍚嶇О")
     private String customer;
 
+    @ApiModelProperty(value = "瀹㈡埛id")
+    private Long customerId;
+
     @ApiModelProperty(value = "涓氬姟鍛�")
     @Excel(name = "涓氬姟鍛�")
     private String salesperson;
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
index b667be2..56c8372 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -8,7 +8,6 @@
 import com.ruoyi.account.service.AccountIncomeService;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.sales.dto.CustomerInteractionDto;
 import com.ruoyi.sales.dto.InvoiceLedgerDto;
 import com.ruoyi.sales.dto.ReceiptPaymentDto;
 import com.ruoyi.sales.dto.ReceiptPaymentExeclDto;
@@ -16,7 +15,6 @@
 import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
 import com.ruoyi.sales.mapper.SalesLedgerMapper;
 import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
-import com.ruoyi.sales.pojo.InvoiceLedger;
 import com.ruoyi.sales.pojo.ReceiptPayment;
 import com.ruoyi.sales.pojo.SalesLedger;
 import com.ruoyi.sales.pojo.SalesLedgerProduct;
@@ -32,7 +30,6 @@
 import java.time.LocalDate;
 import java.time.YearMonth;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @Service
 public class ReceiptPaymentServiceImpl extends ServiceImpl<ReceiptPaymentMapper,ReceiptPayment> implements ReceiptPaymentService {
@@ -82,9 +79,9 @@
                 accountIncome.setIncomeType("3");
                 accountIncome.setCustomerName(salesLedger.getCustomerName());
                 accountIncome.setIncomeMoney(receiptPayment.getReceiptPaymentAmount());
-                accountIncome.setIncomeMethod("0");
+                accountIncome.setIncomeMethod(receiptPayment.getReceiptPaymentType());
                 accountIncome.setInputTime(new Date());
-                accountIncome.setInputUser(salesLedger.getEntryPerson());
+                accountIncome.setInputUser(SecurityUtils.getLoginUser().getNickName());
                 accountIncome.setIncomeDescribed("鍥炴鏀跺叆");
                 accountIncome.setBusinessId(Long.parseLong(receiptPayment.getId().toString()));
                 accountIncome.setBusinessType(1);
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index e2c11cf..3b0cc55 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -9,13 +9,10 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
 import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
 import com.ruoyi.basic.mapper.ProductMapper;
 import com.ruoyi.basic.mapper.ProductModelMapper;
 import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
 import com.ruoyi.common.enums.FileNameType;
 import com.ruoyi.common.enums.SaleEnum;
 import com.ruoyi.common.exception.base.BaseException;
@@ -131,8 +128,6 @@
     ;
     @Autowired
     private SysUserMapper sysUserMapper;
-    @Autowired
-    private CustomerPrivatePoolMapper customerPrivatePoolMapper;
 
     @Override
     public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) {
@@ -599,7 +594,7 @@
     public int addOrUpdateSalesLedger(SalesLedgerDto salesLedgerDto) {
         try {
             // 1. 鏍¢獙瀹㈡埛淇℃伅
-            CustomerPrivatePoolDto customer = customerPrivatePoolMapper.selectInfo(salesLedgerDto.getCustomerId());
+            Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId());
             if (customer == null) {
                 throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
             }
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
index f5ea4e4..1d81401 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -7,16 +7,12 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
 import com.ruoyi.approve.pojo.ApproveProcess;
-import com.ruoyi.approve.service.IApproveProcessService;
 import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
 import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo;
 import com.ruoyi.approve.bean.vo.ApproveProcessVO;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
 import com.ruoyi.common.utils.OrderUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.common.utils.uuid.UUID;
 import com.ruoyi.framework.security.LoginUser;
 import com.ruoyi.sales.dto.SalesQuotationDto;
 import com.ruoyi.sales.mapper.SalesQuotationMapper;
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
index 0345f28..04df9d0 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
@@ -6,8 +6,8 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.EnumUtil;
 import com.ruoyi.common.utils.OrderUtils;
@@ -15,7 +15,6 @@
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.sales.mapper.ShippingInfoMapper;
 import com.ruoyi.sales.pojo.ShippingInfo;
-import com.ruoyi.sales.service.ShippingInfoService;
 import com.ruoyi.stock.dto.StockInventoryDto;
 import com.ruoyi.stock.dto.StockOutRecordDto;
 import com.ruoyi.stock.dto.StockUninventoryDto;
@@ -45,10 +44,10 @@
 @Service
 @AllArgsConstructor
 public class StockOutRecordServiceImpl extends ServiceImpl<StockOutRecordMapper, StockOutRecord> implements StockOutRecordService {
-    private StockOutRecordMapper stockOutRecordMapper;
-    private StockInventoryMapper stockInventoryMapper;
-    private StockUninventoryMapper stockUninventoryMapper;
-    private final ShippingInfoService shippingInfoService;
+    private final StockOutRecordMapper stockOutRecordMapper;
+    private final StockInventoryMapper stockInventoryMapper;
+    private final StockUninventoryMapper stockUninventoryMapper;
+    private final ShippingInfoMapper shippingInfoMapper;
 
     @Override
     public IPage<StockOutRecordDto> listPage(Page page, StockOutRecordDto stockOutRecordDto) {
@@ -105,7 +104,7 @@
             if ("13".equals(stockOutRecord.getRecordType())){
                 // 姝や负 閿�鍞�-鍙戣揣鍑哄簱 娌℃湁鍏宠仈璁板綍鎵嶈兘鎴愬姛鍒犻櫎
                 // 鏌ヨ瀵瑰簲鏄惁鍚湁閿�鍞嚭璐ц褰�
-                ShippingInfo byId = shippingInfoService.getById(stockOutRecord.getRecordId());
+                ShippingInfo byId = shippingInfoMapper.selectById(stockOutRecord.getRecordId());
                 Assert.isNull(byId, StrUtil.format("{}瀛樺湪閿�鍞嚭璐ц褰�,鏃犳硶鍒犻櫎!!!",stockOutRecord.getOutboundBatches()));
 
             }
diff --git a/src/main/resources/mapper/account/AccountIncomeMapper.xml b/src/main/resources/mapper/account/AccountIncomeMapper.xml
index 53c8cf3..9becd41 100644
--- a/src/main/resources/mapper/account/AccountIncomeMapper.xml
+++ b/src/main/resources/mapper/account/AccountIncomeMapper.xml
@@ -24,7 +24,26 @@
         <if test="accountIncome.incomeType != null and accountIncome.incomeType != '' ">
             AND income_type = #{accountIncome.incomeType}
         </if>
-        <if test="accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
+        <if test="accountIncome.incomeMethodLabel != null and accountIncome.incomeMethodLabel != ''">
+            AND (
+            (
+            business_type = 1
+            AND income_method in
+            <foreach collection="accountIncome.receiptPaymentMethodList" item="method" open="(" separator="," close=")">
+                #{method}
+            </foreach>
+            )
+            OR
+            (
+            business_type is null
+            AND income_method in
+            <foreach collection="accountIncome.paymentMethodList" item="method" open="(" separator="," close=")">
+                #{method}
+            </foreach>
+            )
+            )
+        </if>
+        <if test="(accountIncome.incomeMethodLabel == null or accountIncome.incomeMethodLabel == '') and accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
             AND income_method = #{accountIncome.incomeMethod}
         </if>
     </select>
diff --git a/src/main/resources/mapper/basic/CustomerMapper.xml b/src/main/resources/mapper/basic/CustomerMapper.xml
index 3b42238..57dea6c 100644
--- a/src/main/resources/mapper/basic/CustomerMapper.xml
+++ b/src/main/resources/mapper/basic/CustomerMapper.xml
@@ -6,17 +6,23 @@
     <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.Customer">
         <id column="id" property="id" />
     </resultMap>
-    <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerDto">
+    <select id="listPage" resultType="com.ruoyi.basic.vo.CustomerVo">
         select
         c.*,
         u.user_name usage_user_name,
         (
         select group_concat(u2.user_name separator ', ')
-        from customer_private_pool cpp2
-        left join sys_user u2 on cpp2.bound_id = u2.user_id
-        where cpp2.customer_id = c.id and cpp2.delete_flag = 0
-        and cpp2.bound_id != c.usage_user
-        ) as together_user_names
+        from customer_user cu
+        left join sys_user u2 on cu.user_id = u2.user_id
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as together_user_names,
+        (
+        select group_concat(cu.user_id separator ',')
+        from customer_user cu
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as user_ids_str
         from customer c
         left join sys_user u on c.usage_user = u.user_id
         <where>
@@ -26,8 +32,79 @@
             <if test="c.customerType != null and c.customerType != ''">
                 and customer_type = #{c.customerType}
             </if>
+            <!-- 鍏捣鏌ヨ锛歵ype = 1锛堝叕娴峰鎴凤級-->
+            <if test="c.type != null and c.type == 1">
+                and type = #{c.type}
+            </if>
+            <!-- 绉佹捣鏌ヨ锛歵ype = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴� -->
+            <if test="c.type != null and c.type == 0">
+                and (
+                    (type = #{c.type} or (type = 1 and is_assigned = 1))
+                    and (
+                        c.usage_user = #{loginUserId}
+                        or c.create_user = #{loginUserId}
+                        or exists (
+                            select 1 from customer_user cu
+                            where cu.customer_id = c.id
+                            and cu.user_id = #{loginUserId}
+                        )
+                    )
+                )
+            </if>
         </where>
     </select>
 
-
-</mapper>
+    <select id="list" resultType="com.ruoyi.basic.vo.CustomerVo">
+        select
+        c.*,
+        u.user_name usage_user_name,
+        (
+        select group_concat(u2.user_name separator ', ')
+        from customer_user cu
+        left join sys_user u2 on cu.user_id = u2.user_id
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as together_user_names,
+        (
+        select group_concat(cu.user_id separator ',')
+        from customer_user cu
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as user_ids_str
+        from customer c
+        left join sys_user u on c.usage_user = u.user_id
+        <where>
+            <if test="c.ids != null and c.ids.length > 0">
+                and c.id in
+                <foreach collection="c.ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="c.customerName != null and c.customerName != ''">
+                and customer_name like concat('%', #{c.customerName}, '%')
+            </if>
+            <if test="c.customerType != null and c.customerType != ''">
+                and customer_type = #{c.customerType}
+            </if>
+            <!-- 鍏捣鏌ヨ锛歵ype = 1锛堝叕娴峰鎴凤級-->
+            <if test="c.type != null and c.type == 1">
+                and type = #{c.type}
+            </if>
+            <!-- 绉佹捣鏌ヨ锛歵ype = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴� -->
+            <if test="c.type != null and c.type == 0">
+                and (
+                    (type = #{c.type} or (type = 1 and is_assigned = 1))
+                    and (
+                        c.usage_user = #{loginUserId}
+                        or c.create_user = #{loginUserId}
+                        or exists (
+                            select 1 from customer_user cu
+                            where cu.customer_id = c.id
+                            and cu.user_id = #{loginUserId}
+                        )
+                    )
+                )
+            </if>
+        </where>
+    </select>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml b/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
deleted file mode 100644
index 9a8d68c..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.basic.mapper.CustomerPrivateMapper">
-
-    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
-    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivate">
-        <id column="id" property="id" />
-        <result column="customer_name" property="customerName" />
-        <result column="taxpayer_identification_number" property="taxpayerIdentificationNumber" />
-        <result column="company_address" property="companyAddress" />
-        <result column="company_phone" property="companyPhone" />
-        <result column="contact_person" property="contactPerson" />
-        <result column="contact_phone" property="contactPhone" />
-        <result column="maintainer" property="maintainer" />
-        <result column="maintenance_time" property="maintenanceTime" />
-        <result column="tenant_id" property="tenantId" />
-        <result column="basic_bank_account" property="basicBankAccount" />
-        <result column="bank_account" property="bankAccount" />
-        <result column="bank_code" property="bankCode" />
-        <result column="customer_type" property="customerType" />
-        <result column="create_user" property="createUser" />
-        <result column="dept_id" property="deptId" />
-    </resultMap>
-
-</mapper>
diff --git a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml b/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
deleted file mode 100644
index 12c2fc6..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.basic.mapper.CustomerPrivatePoolMapper">
-
-    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
-    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivatePool">
-        <id column="id" property="id" />
-        <result column="customer_id" property="customerId" />
-        <result column="bound_id" property="boundId" />
-        <result column="create_user" property="createUser" />
-        <result column="update_user" property="updateUser" />
-        <result column="create_time" property="createTime" />
-        <result column="update_time" property="updateTime" />
-    </resultMap>
-    <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
-        select cpp.id,
-        cpp.bound_id,
-        cpp.type,
-        coalesce(c.id, cp.id) as customer_id,
-        coalesce(c.customer_name, cp.customer_name) as customer_name,
-        coalesce(c.customer_type, cp.customer_type) as customer_type,
-        coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
-        coalesce(c.company_address, cp.company_address) as company_address,
-        coalesce(c.company_phone, cp.company_phone) as company_phone,
-        coalesce(c.contact_person, cp.contact_person) as contact_person,
-        coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
-        coalesce(c.maintainer, cp.maintainer) as maintainer,
-        coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
-        coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
-        coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
-        coalesce(c.bank_account, cp.bank_account) as bank_account,
-        coalesce(c.bank_code, cp.bank_code) as bank_code
-        from customer_private_pool cpp
-        left join customer c on c.id = cpp.customer_id and cpp.type = 1
-        left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
-        <where>
-            cpp.delete_flag = 0
-            <if test="c.customerName != null and c.customerName != ''">
-                and (c.customer_name like concat('%', #{c.customerName}, '%') or cp.customer_name like concat('%', #{c.customerName}, '%'))
-            </if>
-            <if test="c.customerType != null">
-                and c.customer_type = #{c.customerType}
-            </if>
-            <if test="c.boundId != null">
-                and cpp.bound_id = #{c.boundId}
-            </if>
-        </where>
-        order by cpp.id desc
-    </select>
-    <select id="selectInfo" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
-        select cpp.id,
-               cpp.bound_id,
-               cpp.type,
-               coalesce(c.id, cp.id) as customer_id,
-               coalesce(c.customer_name, cp.customer_name) as customer_name,
-               coalesce(c.customer_type, cp.customer_type) as customer_type,
-               coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
-               coalesce(c.company_address, cp.company_address) as company_address,
-               coalesce(c.company_phone, cp.company_phone) as company_phone,
-               coalesce(c.contact_person, cp.contact_person) as contact_person,
-               coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
-               coalesce(c.maintainer, cp.maintainer) as maintainer,
-               coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
-               coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
-               coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
-               coalesce(c.bank_account, cp.bank_account) as bank_account,
-               coalesce(c.bank_code, cp.bank_code) as bank_code
-        from customer_private_pool cpp
-                 left join customer c on c.id = cpp.customer_id and cpp.type = 1
-                 left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
-        <where>
-            <if test="id != null">
-                and cpp.id = #{id}
-            </if>
-        </where>
-    </select>
-    <select id="selectInfos" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
-        select cpp.id,
-               cpp.bound_id,
-               cpp.type,
-               coalesce(c.id, cp.id) as customer_id,
-               coalesce(c.customer_name, cp.customer_name) as customer_name,
-               coalesce(c.customer_type, cp.customer_type) as customer_type,
-               coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
-               coalesce(c.company_address, cp.company_address) as company_address,
-               coalesce(c.company_phone, cp.company_phone) as company_phone,
-               coalesce(c.contact_person, cp.contact_person) as contact_person,
-               coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
-               coalesce(c.maintainer, cp.maintainer) as maintainer,
-               coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
-               coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
-               coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
-               coalesce(c.bank_account, cp.bank_account) as bank_account,
-               coalesce(c.bank_code, cp.bank_code) as bank_code
-        from customer_private_pool cpp
-                 left join customer c on c.id = cpp.customer_id and cpp.type = 1
-                 left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
-    </select>
-
-</mapper>
diff --git a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml b/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
index 247d7bb..1a38815 100644
--- a/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
+++ b/src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
@@ -183,47 +183,65 @@
         </where>
         ORDER BY T1.payment_date,T1.create_time DESC
     </select>
+
     <select id="supplierNameListPage" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
         SELECT
-        T1.supplier_id ,
+        T1.supplier_id,
         T1.supplier_name,
-        SUM(T1.contract_amount) AS invoiceAmount,
-        IFNULL(SUM(T2.current_payment_amount), 0) AS paymentAmount,
-        IFNULL(SUM(T1.contract_amount) - IFNULL(SUM(T2.current_payment_amount), 0), 0) AS payableAmount
+        T1.invoiceAmount,
+        IFNULL(T2.paymentAmount, 0) AS paymentAmount,
+        (T1.invoiceAmount - IFNULL(T2.paymentAmount, 0)) AS payableAmount
         FROM (
-        SELECT id,supplier_id, supplier_name, SUM(contract_amount) contract_amount
+        SELECT
+        supplier_id,
+        supplier_name,
+        SUM(contract_amount) AS invoiceAmount
         FROM purchase_ledger
-        GROUP BY supplier_id, supplier_name,id
-        ) T1
-        LEFT JOIN (
-        SELECT purchase_ledger_id, SUM(current_payment_amount) current_payment_amount
-        FROM payment_registration
-        GROUP BY purchase_ledger_id
-        ) T2 ON T1.id = T2.purchase_ledger_id
         <where>
             <if test="req.supplierName != null and req.supplierName != '' ">
-                T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
+                AND supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
             </if>
         </where>
-        GROUP BY T1.supplier_id, T1.supplier_name
+        GROUP BY supplier_id, supplier_name
+        ) T1
+        LEFT JOIN (
+        SELECT
+        supplier_id,
+        SUM(current_payment_amount) AS paymentAmount
+        FROM payment_registration
+        GROUP BY supplier_id
+        ) T2 ON T1.supplier_id = T2.supplier_id
     </select>
 
+
     <select id="supplierNameListPageDetails" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto">
-         SELECT
-    T1.purchase_contract_number,
-    T1.contract_amount AS invoiceAmount,
-    IFNULL(SUM(T2.current_payment_amount), 0) AS paymentAmount,
-    IFNULL((T1.contract_amount - IFNULL(SUM(T2.current_payment_amount), 0)), 0) AS payableAmount,
-    T2.payment_date
-    FROM purchase_ledger T1
-    INNER JOIN payment_registration T2 ON T1.id = T2.purchase_ledger_id
-    <where>
-        T1.supplier_id = #{req.supplierId}
-        <if test="req.supplierName != null and req.supplierName != '' ">
-            AND T1.supplier_name LIKE CONCAT ('%', #{req.supplierName}, '%')
-        </if>
-    </where>
-    GROUP BY T1.id, T1.purchase_contract_number, T1.contract_amount, T2.payment_date
+        SELECT
+        T2.id,
+        T1.purchase_contract_number,
+        T1.contract_amount AS invoiceAmount,
+        IFNULL(T2.current_payment_amount, 0) AS paymentAmount,
+        IFNULL((
+        T1.contract_amount - IFNULL((
+        SELECT SUM(T3.current_payment_amount)
+        FROM payment_registration T3
+        WHERE T3.purchase_ledger_id = T1.id
+        AND (
+        T3.payment_date &lt; T2.payment_date
+        OR (T3.payment_date = T2.payment_date AND T3.id &lt;= T2.id)
+        )
+        ), 0)
+        ), 0) AS payableAmount,
+        T2.payment_date
+        FROM purchase_ledger T1
+        INNER JOIN payment_registration T2 ON T1.id = T2.purchase_ledger_id
+        <where>
+            T1.supplier_id = #{req.supplierId}
+            <if test="req.supplierName != null and req.supplierName != '' ">
+                AND T1.supplier_name LIKE CONCAT ('%', #{req.supplierName}, '%')
+            </if>
+        </where>
+        ORDER BY T2.payment_date ASC, T2.id ASC
+
     </select>
 
 </mapper>
diff --git a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
index 8dd95e2..61cc18b 100644
--- a/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
@@ -110,28 +110,33 @@
     </select>
 
     <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
-         SELECT
-    T1.customer_id AS id,
-    T1.customer_name,
-    SUM(T1.contract_amount) AS invoice_total,
-    IFNULL(SUM(T2.receipt_payment_amount), 0) AS receipt_payment_amount,
-    IFNULL(SUM(T1.contract_amount) - IFNULL(SUM(T2.receipt_payment_amount), 0), 0) AS unReceipt_payment_amount
-FROM (
-    SELECT id,customer_id, customer_name, SUM(contract_amount) contract_amount
-    FROM sales_ledger
-    GROUP BY customer_id, customer_name
-) T1
-LEFT JOIN (
-    SELECT sales_ledger_id, SUM(receipt_payment_amount) receipt_payment_amount
-    FROM receipt_payment
-    GROUP BY sales_ledger_id
-) T2 ON T1.id  = T2.sales_ledger_id
-<where>
-    <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' ">
-        T1.customer_name LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%')
-    </if>
-</where>
-GROUP BY T1.customer_id, T1.customer_name
+        SELECT
+        T1.customer_id AS id,
+        T1.customer_name,
+        T1.invoice_total,
+        IFNULL(T2.receipt_payment_amount, 0) AS receipt_payment_amount,
+        IFNULL(T1.invoice_total - IFNULL(T2.receipt_payment_amount, 0), 0) AS unReceipt_payment_amount
+        FROM (
+        SELECT
+        customer_id,
+        customer_name,
+        SUM(contract_amount) AS invoice_total
+        FROM sales_ledger
+        GROUP BY customer_id, customer_name
+        ) T1
+        LEFT JOIN (
+        SELECT
+        T3.customer_id,
+        SUM(T2.receipt_payment_amount) AS receipt_payment_amount
+        FROM receipt_payment T2
+        LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id
+        GROUP BY T3.customer_id
+        ) T2 ON T1.customer_id = T2.customer_id
+        <where>
+            <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' ">
+                T1.customer_name LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%')
+            </if>
+        </where>
     </select>
 
     <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
diff --git a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
index 975d120..46e524a 100644
--- a/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
+++ b/src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
@@ -435,10 +435,21 @@
 
     <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
         SELECT
+        T2.id,
         T1.sales_contract_no,
         T1.contract_amount AS invoice_total,
-        IFNULL(SUM(T2.receipt_payment_amount), 0) AS receipt_payment_amount,
-        IFNULL((T1.contract_amount - IFNULL(SUM(T2.receipt_payment_amount), 0)), 0) AS unReceipt_payment_amount,
+        IFNULL(T2.receipt_payment_amount, 0) AS receipt_payment_amount,
+        IFNULL((
+        T1.contract_amount - IFNULL((
+        SELECT SUM(T3.receipt_payment_amount)
+        FROM receipt_payment T3
+        WHERE T3.sales_ledger_id = T1.id
+        AND (
+        T3.receipt_payment_date &lt; T2.receipt_payment_date
+        OR (T3.receipt_payment_date = T2.receipt_payment_date AND T3.id &lt;= T2.id)
+        )
+        ), 0)
+        ), 0) AS unReceipt_payment_amount,
         T2.receipt_payment_date
         FROM sales_ledger T1
         INNER JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id
@@ -448,7 +459,7 @@
                 AND T1.customer_name LIKE CONCAT ('%', #{invoiceLedgerDto.searchText}, '%')
             </if>
         </where>
-        GROUP BY T1.id, T1.sales_contract_no, T1.contract_amount, T2.receipt_payment_date
+        ORDER BY T2.receipt_payment_date ASC, T2.id ASC
     </select>
 
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index d19895b..0f014e9 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -99,6 +99,10 @@
             <if test="req.status != null and req.status ">
                 AND slp.pending_tickets_total &gt; 0
             </if>
+            <if test="req.supplierNameOrContractNo != null and req.supplierNameOrContractNo != ''">
+                AND (sl.supplier_name like concat('%',#{req.supplierNameOrContractNo},'%') or
+                sl.purchase_contract_number like concat('%',#{req.supplierNameOrContractNo},'%'))
+            </if>
         </where>
         order by slp.register_date desc
     </select>
diff --git a/src/main/resources/mapper/sales/SalesQuotationMapper.xml b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
index 1e358ca..cf15b63 100644
--- a/src/main/resources/mapper/sales/SalesQuotationMapper.xml
+++ b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
@@ -9,6 +9,7 @@
         FROM sales_quotation t1
         LEFT JOIN approve_process t2 ON t1.quotation_no = t2.approve_reason and t2.approve_type = 6
         WHERE 1=1
+          and t2.approve_deleted = 0
         <if test="salesQuotationDto.quotationNo != null and salesQuotationDto.quotationNo != '' ">
             AND t1.quotation_no LIKE CONCAT('%',#{salesQuotationDto.quotationNo},'%')
         </if>

--
Gitblit v1.9.3