From 5d4ebe6d0b7dda230b19f4913bdeb60556b46678 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 13 十月 2025 18:33:47 +0800
Subject: [PATCH] bug修改
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmChangePointsController.java | 170 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 149 insertions(+), 21 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();
+ }
+ }
+ }
}
--
Gitblit v1.7.1