From 09d4077e7343fa3105ae1bed901c0f10027f97b4 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 09 十月 2025 19:01:45 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/haizhentong

---
 /dev/null                                                                                 |   41 ---
 ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsBranchExport.java      |   36 ++
 ruoyi-system/src/main/java/com/ruoyi/system/service/TCrmChangePointsService.java          |   50 +++
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmChangePointsServiceImpl.java |  178 +++++++++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmChangePointsController.java    |  170 +++++++++++-
 ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsSalespersonExport.java |   36 ++
 ruoyi-system/src/main/resources/mapper/system/TCrmChangePointsMapper.xml                  |  157 ++++++++++++
 ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsClinicExport.java      |   32 ++
 ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCrmChangePointsMapper.java            |   49 +++
 ruoyi-system/src/main/java/com/ruoyi/system/vo/TCrmChangePointsVO.java                    |   16 +
 10 files changed, 703 insertions(+), 62 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmChangePointsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmChangePointsController.java
index bc9b9cb..6415c76 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmChangePointsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmChangePointsController.java
@@ -1,22 +1,42 @@
 package com.ruoyi.web.controller.api;
 
 
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.basic.PageInfo;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.WebUtils;
 import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.export.TCrmChangePointsBranchExport;
+import com.ruoyi.system.export.TCrmChangePointsClinicExport;
+import com.ruoyi.system.export.TCrmChangePointsSalespersonExport;
+import com.ruoyi.system.export.TCrmSalespersonExport;
+import com.ruoyi.system.model.TCrmBranch;
 import com.ruoyi.system.query.TCrmBranchQuery;
 import com.ruoyi.system.query.TCrmChangePointsQuery;
+import com.ruoyi.system.query.TCrmSalespersonQuery;
 import com.ruoyi.system.service.*;
 import com.ruoyi.system.vo.TCrmBranchVO;
 import com.ruoyi.system.vo.TCrmChangePointsVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * <p>
@@ -43,27 +63,135 @@
     /**
      * 分公司积分变更明细分页列表
      */
-//    @ApiOperation(value = "分公司积分变更明细分页列表")
-//    @PostMapping(value = "/pageListBranch")
-//    public R<PageInfo<TCrmChangePointsVO>> pageListBranch(@RequestBody TCrmChangePointsQuery query) {
-//        return R.ok(crmChangePointsService.pageListBranch(query));
-//    }
-//    /**
-//     * 业务员积分变更明细分页列表
-//     */
-//    @ApiOperation(value = "业务员积分变更明细分页列表")
-//    @PostMapping(value = "/pageListBranch")
-//    public R<PageInfo<TCrmChangePointsVO>> pageListSalesperson(@RequestBody TCrmChangePointsQuery query) {
-//        return R.ok(crmChangePointsService.pageListSalesperson(query));
-//    }
-//    /**
-//     * 诊所积分变更明细分页列表
-//     */
-//    @ApiOperation(value = "诊所积分变更明细分页列表")
-//    @PostMapping(value = "/pageListClinic")
-//    public R<PageInfo<TCrmChangePointsVO>> pageListClinic(@RequestBody TCrmChangePointsQuery query) {
-//        return R.ok(crmChangePointsService.pageListClinic(query));
-//    }
+    @ApiOperation(value = "分公司积分变更明细分页列表")
+    @PostMapping(value = "/pageListBranch")
+    public R<PageInfo<TCrmChangePointsVO>> pageListBranch(@RequestBody TCrmChangePointsQuery query) {
+        return R.ok(crmChangePointsService.pageListBranch(query));
+    }
+    /**
+     * 业务员积分变更明细分页列表
+     */
+    @ApiOperation(value = "业务员积分变更明细分页列表")
+    @PostMapping(value = "/pageListSalesperson")
+    public R<PageInfo<TCrmChangePointsVO>> pageListSalesperson(@RequestBody TCrmChangePointsQuery query) {
+        return R.ok(crmChangePointsService.pageListSalesperson(query));
+    }
+    /**
+     * 诊所积分变更明细分页列表
+     */
+    @ApiOperation(value = "诊所积分变更明细分页列表")
+    @PostMapping(value = "/pageListClinic")
+    public R<PageInfo<TCrmChangePointsVO>> pageListClinic(@RequestBody TCrmChangePointsQuery query) {
+        return R.ok(crmChangePointsService.pageListClinic(query));
+    }
+
+    @Log(title = "修改积分记录-分公司积分变更明细导出", businessType = BusinessType.EXPORT)
+    @ApiOperation(value = "分公司积分变更明细导出")
+    @PostMapping("/exportBranch")
+    public void listExportBranch(@RequestBody TCrmChangePointsQuery query){
+        List<TCrmChangePointsBranchExport> crmChangePointsBranchExports = crmChangePointsService.pageListBranchExport(query);
+        for (TCrmChangePointsBranchExport crmChangePointsBranchExport : crmChangePointsBranchExports) {
+            if(Objects.nonNull(crmChangePointsBranchExport.getPayMoney())){
+                crmChangePointsBranchExport.setPayMoneyStr("¥"+crmChangePointsBranchExport.getPayMoney());
+            }
+            crmChangePointsBranchExport.setCreateTimeStr(crmChangePointsBranchExport.getCreateTime().toLocalDate().toString());
+        }
+        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TCrmChangePointsBranchExport.class, crmChangePointsBranchExports);
+        HttpServletResponse response = WebUtils.response();
+        assert response != null;
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        ServletOutputStream outputStream = null;
+        try {
+            String fileName = URLEncoder.encode("分公司积分变更明细.xls", "utf-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                outputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @Log(title = "修改积分记录-业务员积分变更明细导出", businessType = BusinessType.EXPORT)
+    @ApiOperation(value = "业务员积分变更明细导出")
+    @PostMapping("/exportSalesperson")
+    public void listExportSalesperson(@RequestBody TCrmChangePointsQuery query){
+        List<TCrmChangePointsSalespersonExport> crmChangePointsSalespersonExports = crmChangePointsService.pageListSalespersonExport(query);
+        for (TCrmChangePointsSalespersonExport crmChangePointsSalespersonExport : crmChangePointsSalespersonExports) {
+            if(Objects.nonNull(crmChangePointsSalespersonExport.getPayMoney())){
+                crmChangePointsSalespersonExport.setPayMoneyStr("¥"+crmChangePointsSalespersonExport.getPayMoney());
+            }
+            crmChangePointsSalespersonExport.setCreateTimeStr(crmChangePointsSalespersonExport.getCreateTime().toLocalDate().toString());
+        }
+        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TCrmChangePointsSalespersonExport.class, crmChangePointsSalespersonExports);
+        HttpServletResponse response = WebUtils.response();
+        assert response != null;
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        ServletOutputStream outputStream = null;
+        try {
+            String fileName = URLEncoder.encode("业务员积分变更明细.xls", "utf-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                outputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @Log(title = "修改积分记录-诊所积分变更明细导出", businessType = BusinessType.EXPORT)
+    @ApiOperation(value = "诊所积分变更明细导出")
+    @PostMapping("/exportClinic")
+    public void listExportClinic(@RequestBody TCrmChangePointsQuery query){
+        List<TCrmChangePointsClinicExport> crmChangePointsClinicExports = crmChangePointsService.pageListClinicExport(query);
+        for (TCrmChangePointsClinicExport crmChangePointsClinicExport : crmChangePointsClinicExports) {
+            if(Objects.nonNull(crmChangePointsClinicExport.getPayMoney())){
+                crmChangePointsClinicExport.setPayMoneyStr("¥"+crmChangePointsClinicExport.getPayMoney());
+            }
+            crmChangePointsClinicExport.setCreateTimeStr(crmChangePointsClinicExport.getCreateTime().toLocalDate().toString());
+        }
+        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TCrmChangePointsClinicExport.class, crmChangePointsClinicExports);
+        HttpServletResponse response = WebUtils.response();
+        assert response != null;
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        ServletOutputStream outputStream = null;
+        try {
+            String fileName = URLEncoder.encode("诊所积分变更明细.xls", "utf-8");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                outputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 
 }
 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/export/OpticalInspectionExport.java b/ruoyi-system/src/main/java/com/ruoyi/system/export/OpticalInspectionExport.java
deleted file mode 100644
index b197df9..0000000
--- a/ruoyi-system/src/main/java/com/ruoyi/system/export/OpticalInspectionExport.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.ruoyi.system.export;
-
-import cn.afterturn.easypoi.excel.annotation.Excel;
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.Date;
-
-@Data
-@ApiModel(value = "光缆巡检导出excel")
-public class OpticalInspectionExport implements Serializable {
-
-    @Excel(name = "工单号",width = 20)
-    private Integer id;
-
-    @Excel(name = "工单名称",width = 30)
-    private String inspectionName;
-
-    @Excel(name = "开始时间",width = 30,exportFormat = "yyyy-MM-dd HH:mm")
-    private Date startTime;
-
-    @Excel(name = "截止时间",width = 30,exportFormat = "yyyy-MM-dd HH:mm")
-    private Date endTime;
-
-    @Excel(name = "计划周期",width = 30,replace = {"周计划_1","月计划_2"})
-    private Integer planCycle;
-
-    @Excel(name = "路线",width = 30)
-    private String address;
-
-    @Excel(name = "巡检点位",width = 30)
-    private Integer inspectionCount;
-
-    @Excel(name = "提交人",width = 30)
-    private String createBy;
-
-    @Excel(name = "巡检状态",width = 30,replace = {"待巡检_1","未完成_2","已完成_3"})
-    private Integer state;
-
-}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsBranchExport.java b/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsBranchExport.java
new file mode 100644
index 0000000..0f673ee
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsBranchExport.java
@@ -0,0 +1,36 @@
+package com.ruoyi.system.export;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel(value = "分公司积分变更明细导出TCrmChangePointsBranchExport")
+public class TCrmChangePointsBranchExport implements Serializable {
+
+    @Excel(name = "分公司名称",width = 20)
+    private String branchName;
+    @Excel(name = "变更类型",width = 20,replace = {"增加_1","减少_2"})
+    private Integer changeType;
+    @Excel(name = "变更原因",width = 20,replace = {"诊所采购_1","商城兑换_2","管理员修改_3"})
+    private Integer changeReason;
+    @Excel(name = "变更数量",width = 20)
+    private Integer changeValue;
+    @Excel(name = "采购单号",width = 20)
+    private String procurementCode;
+    @Excel(name = "采购诊所",width = 20)
+    private String clinicName;
+    @Excel(name = "采购金额",width = 20)
+    private String payMoneyStr;
+    private BigDecimal payMoney;
+    @Excel(name = "变更时间",width = 20)
+    private String createTimeStr;
+    private LocalDateTime createTime;
+    @Excel(name = "备注",width = 20)
+    private String remarks;
+    private String procurementId;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsClinicExport.java b/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsClinicExport.java
new file mode 100644
index 0000000..1f92ee2
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsClinicExport.java
@@ -0,0 +1,32 @@
+package com.ruoyi.system.export;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel(value = "诊所积分变更明细导出TCrmChangePointsClinicExport")
+public class TCrmChangePointsClinicExport implements Serializable {
+
+    @Excel(name = "诊所名称",width = 20)
+    private String clinicName;
+    @Excel(name = "变更类型",width = 20,replace = {"增加_1","减少_2"})
+    private Integer changeType;
+    @Excel(name = "变更原因",width = 20,replace = {"诊所采购_1","商城兑换_2","管理员修改_3"})
+    private Integer changeReason;
+    @Excel(name = "变更数量",width = 20)
+    private Integer changeValue;
+    @Excel(name = "采购单号",width = 20)
+    private String procurementCode;
+    @Excel(name = "采购金额",width = 20)
+    private String payMoneyStr;
+    private BigDecimal payMoney;
+    @Excel(name = "变更时间",width = 20)
+    private String createTimeStr;
+    private LocalDateTime createTime;
+    private String procurementId;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsSalespersonExport.java b/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsSalespersonExport.java
new file mode 100644
index 0000000..8e1056b
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/export/TCrmChangePointsSalespersonExport.java
@@ -0,0 +1,36 @@
+package com.ruoyi.system.export;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel(value = "业务员积分变更明细导出TCrmChangePointsSalespersonExport")
+public class TCrmChangePointsSalespersonExport implements Serializable {
+
+    @Excel(name = "业务员名称",width = 20)
+    private String salespersonName;
+    @Excel(name = "变更类型",width = 20,replace = {"增加_1","减少_2"})
+    private Integer changeType;
+    @Excel(name = "变更原因",width = 20,replace = {"诊所采购_1","商城兑换_2","管理员修改_3"})
+    private Integer changeReason;
+    @Excel(name = "变更数量",width = 20)
+    private Integer changeValue;
+    @Excel(name = "采购单号",width = 20)
+    private String procurementCode;
+    @Excel(name = "采购诊所",width = 20)
+    private String clinicName;
+    @Excel(name = "采购金额",width = 20)
+    private String payMoneyStr;
+    private BigDecimal payMoney;
+    @Excel(name = "变更时间",width = 20)
+    private String createTimeStr;
+    private LocalDateTime createTime;
+    @Excel(name = "备注",width = 20)
+    private String remarks;
+    private String procurementId;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCrmChangePointsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCrmChangePointsMapper.java
index e9c9a41..79c3d34 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCrmChangePointsMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TCrmChangePointsMapper.java
@@ -1,7 +1,16 @@
 package com.ruoyi.system.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.system.export.TCrmChangePointsBranchExport;
+import com.ruoyi.system.export.TCrmChangePointsClinicExport;
+import com.ruoyi.system.export.TCrmChangePointsSalespersonExport;
 import com.ruoyi.system.model.TCrmChangePoints;
+import com.ruoyi.system.query.TCrmChangePointsQuery;
+import com.ruoyi.system.vo.TCrmChangePointsVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +21,45 @@
  * @since 2025-09-02
  */
 public interface TCrmChangePointsMapper extends BaseMapper<TCrmChangePoints> {
+    /**
+     * 分公司积分变更明细分页列表
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsVO> pageListBranch(@Param("query") TCrmChangePointsQuery query, @Param("pageInfo")PageInfo<TCrmChangePointsVO> pageInfo);
 
+    /**
+     * 业务员积分变更明细分页列表
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsVO> pageListSalesperson(@Param("query") TCrmChangePointsQuery query, @Param("pageInfo")PageInfo<TCrmChangePointsVO> pageInfo);
+
+    /**
+     * 诊所积分变更明细分页列表
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsVO> pageListClinic(@Param("query") TCrmChangePointsQuery query, @Param("pageInfo")PageInfo<TCrmChangePointsVO> pageInfo);
+
+    /**
+     * 分公司积分变更明细导出列表
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsBranchExport> pageListBranchExport(@Param("query")TCrmChangePointsQuery query);
+
+    /**
+     * 业务员积分变更明细导出列表
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsSalespersonExport> pageListSalespersonExport(@Param("query")TCrmChangePointsQuery query);
+
+    /**
+     * 诊所积分变更明细导出列表
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsClinicExport> pageListClinicExport(@Param("query")TCrmChangePointsQuery query);
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/TCrmChangePointsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/TCrmChangePointsService.java
index bd6fafb..e2828d8 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/TCrmChangePointsService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/TCrmChangePointsService.java
@@ -1,7 +1,16 @@
 package com.ruoyi.system.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.system.export.TCrmChangePointsBranchExport;
+import com.ruoyi.system.export.TCrmChangePointsClinicExport;
+import com.ruoyi.system.export.TCrmChangePointsSalespersonExport;
 import com.ruoyi.system.model.TCrmChangePoints;
+import com.ruoyi.system.query.TCrmChangePointsQuery;
+import com.ruoyi.system.query.TCrmSalespersonQuery;
+import com.ruoyi.system.vo.TCrmChangePointsVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +22,45 @@
  */
 public interface TCrmChangePointsService extends IService<TCrmChangePoints> {
 
+    /**
+     * 分公司积分变更明细分页列表
+     * @param query
+     * @return
+     */
+    PageInfo<TCrmChangePointsVO> pageListBranch(TCrmChangePointsQuery query);
+
+    /**
+     * 业务员积分变更明细分页列表
+     * @param query
+     * @return
+     */
+    PageInfo<TCrmChangePointsVO> pageListSalesperson(TCrmChangePointsQuery query);
+
+    /**
+     * 诊所积分变更明细分页列表
+     * @param query
+     * @return
+     */
+    PageInfo<TCrmChangePointsVO> pageListClinic(TCrmChangePointsQuery query);
+
+    /**
+     * 分公司积分变更明细导出
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsBranchExport> pageListBranchExport(TCrmChangePointsQuery query);
+
+    /**
+     * 业务员积分变更明细导出
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsSalespersonExport> pageListSalespersonExport(TCrmChangePointsQuery query);
+
+    /**
+     * 诊所积分变更明细导出
+     * @param query
+     * @return
+     */
+    List<TCrmChangePointsClinicExport> pageListClinicExport(TCrmChangePointsQuery query);
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmChangePointsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmChangePointsServiceImpl.java
index 2046ce9..945b23b 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmChangePointsServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmChangePointsServiceImpl.java
@@ -1,10 +1,28 @@
 package com.ruoyi.system.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.system.export.TCrmChangePointsBranchExport;
+import com.ruoyi.system.export.TCrmChangePointsClinicExport;
+import com.ruoyi.system.export.TCrmChangePointsSalespersonExport;
 import com.ruoyi.system.mapper.TCrmChangePointsMapper;
+import com.ruoyi.system.mapper.TCrmClinicMapper;
+import com.ruoyi.system.mapper.TErpProcurementMapper;
 import com.ruoyi.system.model.TCrmChangePoints;
+import com.ruoyi.system.model.TCrmClinic;
+import com.ruoyi.system.model.TErpProcurement;
+import com.ruoyi.system.model.TSysActivity;
+import com.ruoyi.system.query.TCrmChangePointsQuery;
 import com.ruoyi.system.service.TCrmChangePointsService;
+import com.ruoyi.system.vo.TCrmChangePointsVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -17,4 +35,164 @@
 @Service
 public class TCrmChangePointsServiceImpl extends ServiceImpl<TCrmChangePointsMapper, TCrmChangePoints> implements TCrmChangePointsService {
 
+    @Autowired
+    private TErpProcurementMapper erpProcurementMapper;
+    @Autowired
+    private TCrmClinicMapper crmClinicMapper;
+
+    @Override
+    public PageInfo<TCrmChangePointsVO> pageListBranch(TCrmChangePointsQuery query) {
+        PageInfo<TCrmChangePointsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+        List<TCrmChangePointsVO> list = this.baseMapper.pageListBranch(query,pageInfo);
+        if(CollectionUtils.isEmpty(list)){
+            return pageInfo;
+        }
+        List<String> procurementIds = list.stream().map(TCrmChangePointsVO::getProcurementId)
+                .filter(Objects::nonNull).collect(Collectors.toList());
+        // 查询诊所
+        List<TCrmClinic> crmClinics = crmClinicMapper.selectList(Wrappers.lambdaQuery(TCrmClinic.class));
+        if(!CollectionUtils.isEmpty(procurementIds)){
+            List<TErpProcurement> erpProcurements = erpProcurementMapper.selectList(Wrappers.lambdaQuery(TErpProcurement.class).in(TErpProcurement::getId, procurementIds));
+            for (TCrmChangePointsVO tCrmChangePointsVO : list) {
+                List<TErpProcurement> collect = erpProcurements.stream().filter(tErpProcurement -> tErpProcurement.getId().equals(tCrmChangePointsVO.getProcurementId())).collect(Collectors.toList());
+                if(!CollectionUtils.isEmpty(collect)){
+                    tCrmChangePointsVO.setProcurementCode(collect.get(0).getProcurementCode());
+                    tCrmChangePointsVO.setPayMoney(collect.get(0).getPayMoney());
+                    List<TCrmClinic> clinics = crmClinics.stream().filter(tCrmClinic -> tCrmClinic.getId().equals(collect.get(0).getClinicId())).collect(Collectors.toList());
+                    if(!CollectionUtils.isEmpty(clinics)){
+                        tCrmChangePointsVO.setClinicName(clinics.get(0).getClinicName());
+                    }
+                }
+            }
+        }
+        pageInfo.setRecords(list);
+        return pageInfo;
+    }
+
+    @Override
+    public PageInfo<TCrmChangePointsVO> pageListSalesperson(TCrmChangePointsQuery query) {
+        PageInfo<TCrmChangePointsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+        List<TCrmChangePointsVO> list = this.baseMapper.pageListSalesperson(query,pageInfo);
+        if(CollectionUtils.isEmpty(list)){
+            return pageInfo;
+        }
+        List<String> procurementIds = list.stream().map(TCrmChangePointsVO::getProcurementId)
+                .filter(Objects::nonNull).collect(Collectors.toList());
+        // 查询诊所
+        List<TCrmClinic> crmClinics = crmClinicMapper.selectList(Wrappers.lambdaQuery(TCrmClinic.class));
+        if(!CollectionUtils.isEmpty(procurementIds)){
+            List<TErpProcurement> erpProcurements = erpProcurementMapper.selectList(Wrappers.lambdaQuery(TErpProcurement.class).in(TErpProcurement::getId, procurementIds));
+            for (TCrmChangePointsVO tCrmChangePointsVO : list) {
+                List<TErpProcurement> collect = erpProcurements.stream().filter(tErpProcurement -> tErpProcurement.getId().equals(tCrmChangePointsVO.getProcurementId())).collect(Collectors.toList());
+                if(!CollectionUtils.isEmpty(collect)){
+                    tCrmChangePointsVO.setProcurementCode(collect.get(0).getProcurementCode());
+                    tCrmChangePointsVO.setPayMoney(collect.get(0).getPayMoney());
+                    List<TCrmClinic> clinics = crmClinics.stream().filter(tCrmClinic -> tCrmClinic.getId().equals(collect.get(0).getClinicId())).collect(Collectors.toList());
+                    if(!CollectionUtils.isEmpty(clinics)){
+                        tCrmChangePointsVO.setClinicName(clinics.get(0).getClinicName());
+                    }
+                }
+            }
+        }
+        pageInfo.setRecords(list);
+        return pageInfo;
+    }
+
+    @Override
+    public PageInfo<TCrmChangePointsVO> pageListClinic(TCrmChangePointsQuery query) {
+        PageInfo<TCrmChangePointsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+        List<TCrmChangePointsVO> list = this.baseMapper.pageListClinic(query,pageInfo);
+        if(CollectionUtils.isEmpty(list)){
+            return pageInfo;
+        }
+        List<String> procurementIds = list.stream().map(TCrmChangePointsVO::getProcurementId)
+                .filter(Objects::nonNull).collect(Collectors.toList());
+        if(!CollectionUtils.isEmpty(procurementIds)){
+            List<TErpProcurement> erpProcurements = erpProcurementMapper.selectList(Wrappers.lambdaQuery(TErpProcurement.class).in(TErpProcurement::getId, procurementIds));
+            for (TCrmChangePointsVO tCrmChangePointsVO : list) {
+                List<TErpProcurement> collect = erpProcurements.stream().filter(tErpProcurement -> tErpProcurement.getId().equals(tCrmChangePointsVO.getProcurementId())).collect(Collectors.toList());
+                if(!CollectionUtils.isEmpty(collect)){
+                    tCrmChangePointsVO.setProcurementCode(collect.get(0).getProcurementCode());
+                    tCrmChangePointsVO.setPayMoney(collect.get(0).getPayMoney());
+                }
+            }
+        }
+        pageInfo.setRecords(list);
+        return pageInfo;
+    }
+
+    @Override
+    public List<TCrmChangePointsBranchExport> pageListBranchExport(TCrmChangePointsQuery query) {
+        List<TCrmChangePointsBranchExport> list = this.baseMapper.pageListBranchExport(query);
+        if(CollectionUtils.isEmpty(list)){
+            return list;
+        }
+        List<String> procurementIds = list.stream().map(TCrmChangePointsBranchExport::getProcurementId)
+                .filter(Objects::nonNull).collect(Collectors.toList());
+        // 查询诊所
+        List<TCrmClinic> crmClinics = crmClinicMapper.selectList(Wrappers.lambdaQuery(TCrmClinic.class));
+        if(!CollectionUtils.isEmpty(procurementIds)){
+            List<TErpProcurement> erpProcurements = erpProcurementMapper.selectList(Wrappers.lambdaQuery(TErpProcurement.class).in(TErpProcurement::getId, procurementIds));
+            for (TCrmChangePointsBranchExport crmChangePointsBranchExport : list) {
+                List<TErpProcurement> collect = erpProcurements.stream().filter(tErpProcurement -> tErpProcurement.getId().equals(crmChangePointsBranchExport.getProcurementId())).collect(Collectors.toList());
+                if(!CollectionUtils.isEmpty(collect)){
+                    crmChangePointsBranchExport.setProcurementCode(collect.get(0).getProcurementCode());
+                    crmChangePointsBranchExport.setPayMoney(collect.get(0).getPayMoney());
+                    List<TCrmClinic> clinics = crmClinics.stream().filter(tCrmClinic -> tCrmClinic.getId().equals(collect.get(0).getClinicId())).collect(Collectors.toList());
+                    if(!CollectionUtils.isEmpty(clinics)){
+                        crmChangePointsBranchExport.setClinicName(clinics.get(0).getClinicName());
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public List<TCrmChangePointsSalespersonExport> pageListSalespersonExport(TCrmChangePointsQuery query) {
+        List<TCrmChangePointsSalespersonExport> list = this.baseMapper.pageListSalespersonExport(query);
+        if(CollectionUtils.isEmpty(list)){
+            return list;
+        }
+        List<String> procurementIds = list.stream().map(TCrmChangePointsSalespersonExport::getProcurementId)
+                .filter(Objects::nonNull).collect(Collectors.toList());
+        // 查询诊所
+        List<TCrmClinic> crmClinics = crmClinicMapper.selectList(Wrappers.lambdaQuery(TCrmClinic.class));
+        if(!CollectionUtils.isEmpty(procurementIds)){
+            List<TErpProcurement> erpProcurements = erpProcurementMapper.selectList(Wrappers.lambdaQuery(TErpProcurement.class).in(TErpProcurement::getId, procurementIds));
+            for (TCrmChangePointsSalespersonExport crmChangePointsSalespersonExport : list) {
+                List<TErpProcurement> collect = erpProcurements.stream().filter(tErpProcurement -> tErpProcurement.getId().equals(crmChangePointsSalespersonExport.getProcurementId())).collect(Collectors.toList());
+                if(!CollectionUtils.isEmpty(collect)){
+                    crmChangePointsSalespersonExport.setProcurementCode(collect.get(0).getProcurementCode());
+                    crmChangePointsSalespersonExport.setPayMoney(collect.get(0).getPayMoney());
+                    List<TCrmClinic> clinics = crmClinics.stream().filter(tCrmClinic -> tCrmClinic.getId().equals(collect.get(0).getClinicId())).collect(Collectors.toList());
+                    if(!CollectionUtils.isEmpty(clinics)){
+                        crmChangePointsSalespersonExport.setClinicName(clinics.get(0).getClinicName());
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public List<TCrmChangePointsClinicExport> pageListClinicExport(TCrmChangePointsQuery query) {
+        List<TCrmChangePointsClinicExport> list = this.baseMapper.pageListClinicExport(query);
+        if(CollectionUtils.isEmpty(list)){
+            return list;
+        }
+        List<String> procurementIds = list.stream().map(TCrmChangePointsClinicExport::getProcurementId)
+                .filter(Objects::nonNull).collect(Collectors.toList());
+        if(!CollectionUtils.isEmpty(procurementIds)){
+            List<TErpProcurement> erpProcurements = erpProcurementMapper.selectList(Wrappers.lambdaQuery(TErpProcurement.class).in(TErpProcurement::getId, procurementIds));
+            for (TCrmChangePointsClinicExport crmChangePointsClinicExport : list) {
+                List<TErpProcurement> collect = erpProcurements.stream().filter(tErpProcurement -> tErpProcurement.getId().equals(crmChangePointsClinicExport.getProcurementId())).collect(Collectors.toList());
+                if(!CollectionUtils.isEmpty(collect)){
+                    crmChangePointsClinicExport.setProcurementCode(collect.get(0).getProcurementCode());
+                    crmChangePointsClinicExport.setPayMoney(collect.get(0).getPayMoney());
+                }
+            }
+        }
+        return list;
+    }
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/TCrmChangePointsVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/TCrmChangePointsVO.java
index 7cc6f6f..45ed7d1 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/TCrmChangePointsVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/TCrmChangePointsVO.java
@@ -2,12 +2,28 @@
 
 import com.ruoyi.system.model.TCrmChangePoints;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import java.math.BigDecimal;
 
 @Data
 @ApiModel(value = "修改积分记录视图对象TCrmChangePointsVO")
 public class TCrmChangePointsVO extends TCrmChangePoints {
 
+    @ApiModelProperty(value = "业务员名称")
+    private String salespersonName;
 
+    @ApiModelProperty(value = " 诊所名称")
+    private String clinicName;
+
+    @ApiModelProperty(value = " 分公司名称")
+    private String branchName;
+
+    @ApiModelProperty(value = "采购单号")
+    private String procurementCode;
+
+    @ApiModelProperty(value = "支付金额")
+    private BigDecimal payMoney;
 
 }
diff --git a/ruoyi-system/src/main/resources/mapper/system/TCrmChangePointsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TCrmChangePointsMapper.xml
index 44b0213..54c0162 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TCrmChangePointsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TCrmChangePointsMapper.xml
@@ -24,5 +24,162 @@
     <sql id="Base_Column_List">
         id, branch_salesperson_id,procurement_id,exchange_id, user_type, change_type,change_reason, change_value, remarks, create_time, update_time, create_by, update_by, disabled
     </sql>
+    <select id="pageListBranch" resultType="com.ruoyi.system.vo.TCrmChangePointsVO">
+        select
+            tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
+            tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
+            tccp.update_by, tccp.disabled,tcb.branch_name as branchName
+        from t_crm_change_points tccp
+        left join t_crm_branch tcb on tcb.id = tccp.branch_salesperson_id
+        <where>
+            <if test="query.branchName != null and query.branchName != ''">
+                and tcb.branch_name like concat('%',#{query.branchName},'%')
+            </if>
+            <if test="query.changeType != null">
+                and tccp.change_type = #{query.changeType}
+            </if>
+            <if test="query.changeReason != null">
+                and tccp.change_reason = #{query.changeReason}
+            </if>
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                AND tccp.create_time &gt;= #{query.startTime}
+                AND tccp.create_time &lt;= #{query.endTime}
+            </if>
+            AND tccp.user_type = 1
+            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tccp.create_time DESC
+    </select>
+    <select id="pageListSalesperson" resultType="com.ruoyi.system.vo.TCrmChangePointsVO">
+        select
+            tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
+            tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
+            tccp.update_by, tccp.disabled,tcs.salesperson_name as salespersonName
+        from t_crm_change_points tccp
+        left join t_crm_salesperson tcs on tcs.id = tccp.branch_salesperson_id
+        <where>
+            <if test="query.salespersonName != null and query.salespersonName != ''">
+                and tcs.salesperson_name like concat('%',#{query.salespersonName},'%')
+            </if>
+            <if test="query.changeType != null">
+                and tccp.change_type = #{query.changeType}
+            </if>
+            <if test="query.changeReason != null">
+                and tccp.change_reason = #{query.changeReason}
+            </if>
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                AND tccp.create_time &gt;= #{query.startTime}
+                AND tccp.create_time &lt;= #{query.endTime}
+            </if>
+            AND tccp.user_type = 2
+            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tccp.create_time DESC
+    </select>
+    <select id="pageListClinic" resultType="com.ruoyi.system.vo.TCrmChangePointsVO">
+        select
+            tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
+            tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
+            tccp.update_by, tccp.disabled,tcc.clinic_name as clinicName
+        from t_crm_change_points tccp
+        left join t_crm_clinic tcc on tcc.id = tccp.branch_salesperson_id
+        <where>
+            <if test="query.clinicName != null and query.clinicName != ''">
+                and tcc.clinic_name like concat('%',#{query.clinicName},'%')
+            </if>
+            <if test="query.changeType != null">
+                and tccp.change_type = #{query.changeType}
+            </if>
+            <if test="query.changeReason != null">
+                and tccp.change_reason = #{query.changeReason}
+            </if>
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                AND tccp.create_time &gt;= #{query.startTime}
+                AND tccp.create_time &lt;= #{query.endTime}
+            </if>
+            AND tccp.user_type = 3
+            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tccp.create_time DESC
+    </select>
+    <select id="pageListBranchExport" resultType="com.ruoyi.system.export.TCrmChangePointsBranchExport">
+        select
+        tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
+        tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
+        tccp.update_by, tccp.disabled,tcb.branch_name as branchName
+        from t_crm_change_points tccp
+        left join t_crm_branch tcb on tcb.id = tccp.branch_salesperson_id
+        <where>
+            <if test="query.branchName != null and query.branchName != ''">
+                and tcb.branch_name like concat('%',#{query.branchName},'%')
+            </if>
+            <if test="query.changeType != null">
+                and tccp.change_type = #{query.changeType}
+            </if>
+            <if test="query.changeReason != null">
+                and tccp.change_reason = #{query.changeReason}
+            </if>
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                AND tccp.create_time &gt;= #{query.startTime}
+                AND tccp.create_time &lt;= #{query.endTime}
+            </if>
+            AND tccp.user_type = 1
+            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tccp.create_time DESC
+    </select>
+    <select id="pageListSalespersonExport"
+            resultType="com.ruoyi.system.export.TCrmChangePointsSalespersonExport">
+        select
+        tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
+        tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
+        tccp.update_by, tccp.disabled,tcs.salesperson_name as salespersonName
+        from t_crm_change_points tccp
+        left join t_crm_salesperson tcs on tcs.id = tccp.branch_salesperson_id
+        <where>
+            <if test="query.salespersonName != null and query.salespersonName != ''">
+                and tcs.salesperson_name like concat('%',#{query.salespersonName},'%')
+            </if>
+            <if test="query.changeType != null">
+                and tccp.change_type = #{query.changeType}
+            </if>
+            <if test="query.changeReason != null">
+                and tccp.change_reason = #{query.changeReason}
+            </if>
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                AND tccp.create_time &gt;= #{query.startTime}
+                AND tccp.create_time &lt;= #{query.endTime}
+            </if>
+            AND tccp.user_type = 2
+            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tccp.create_time DESC
+    </select>
+    <select id="pageListClinicExport" resultType="com.ruoyi.system.export.TCrmChangePointsClinicExport">
+        select
+        tccp.id, tccp.branch_salesperson_id,tccp.procurement_id,tccp.exchange_id, tccp.user_type, tccp.change_type,
+        tccp.change_reason, tccp.change_value, tccp.remarks, tccp.create_time, tccp.update_time, tccp.create_by,
+        tccp.update_by, tccp.disabled,tcc.clinic_name as clinicName
+        from t_crm_change_points tccp
+        left join t_crm_clinic tcc on tcc.id = tccp.branch_salesperson_id
+        <where>
+            <if test="query.clinicName != null and query.clinicName != ''">
+                and tcc.clinic_name like concat('%',#{query.clinicName},'%')
+            </if>
+            <if test="query.changeType != null">
+                and tccp.change_type = #{query.changeType}
+            </if>
+            <if test="query.changeReason != null">
+                and tccp.change_reason = #{query.changeReason}
+            </if>
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                AND tccp.create_time &gt;= #{query.startTime}
+                AND tccp.create_time &lt;= #{query.endTime}
+            </if>
+            AND tccp.user_type = 3
+            AND tccp.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tccp.create_time DESC
+    </select>
 
 </mapper>

--
Gitblit v1.7.1