|
|
@ -27,6 +27,7 @@ import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
@ -43,6 +44,8 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
|
|
|
|
private static final ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
|
|
@Value("${file.upload.url}") |
|
|
|
private String uploadUrl; |
|
|
|
//注入AiEmotionService |
|
|
|
@Autowired |
|
|
|
private AiEmotionService aiEmotionService; |
|
|
@ -132,7 +135,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
// 7. 分页查询并写入数据 |
|
|
|
Page page = new Page(); |
|
|
|
page.setPageNum(1); |
|
|
|
page.setPageSize(1000); |
|
|
|
page.setPageSize(5000); |
|
|
|
Integer totalCount = 0; |
|
|
|
page.setGoldDetail(goldDetail); |
|
|
|
boolean hasMore = true; |
|
|
@ -184,7 +187,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
if (tempFile != null && tempFile.exists() && tempFile.length() > 0) { |
|
|
|
// 8. 上传到OSS(读取本地临时文件) |
|
|
|
// 获取接口的基础 URL |
|
|
|
String uploadUrl = "http://39.101.133.168:8828/hljw/api/aws/upload"; |
|
|
|
String uploadUrl = this.uploadUrl; |
|
|
|
try { |
|
|
|
// 1. 创建上传工具实例 |
|
|
|
ExcelUploadUtil uploadUtil = new ExcelUploadUtil(uploadUrl); |
|
|
@ -337,7 +340,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
// 7. 分页查询并写入数据 |
|
|
|
Page page = new Page(); |
|
|
|
page.setPageNum(1); |
|
|
|
page.setPageSize(1000); |
|
|
|
page.setPageSize(5000); |
|
|
|
page.setUser(user); |
|
|
|
Integer totalCount = 0; |
|
|
|
boolean hasMore = true; |
|
|
@ -389,7 +392,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
if (tempFile != null && tempFile.exists() && tempFile.length() > 0) { |
|
|
|
// 8. 上传到OSS(读取本地临时文件) |
|
|
|
// 获取接口的基础 URL |
|
|
|
String uploadUrl = "http://39.101.133.168:8828/hljw/api/aws/upload"; |
|
|
|
String uploadUrl = this.uploadUrl; |
|
|
|
try { |
|
|
|
// 1. 创建上传工具实例 |
|
|
|
ExcelUploadUtil uploadUtil = new ExcelUploadUtil(uploadUrl); |
|
|
@ -534,12 +537,17 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
|
|
|
|
try { |
|
|
|
// 6. 初始化Excel写入器(指向本地文件流) |
|
|
|
excelWriter = RechargeExcelWriter(outputStream, "user"); |
|
|
|
try { |
|
|
|
excelWriter = EasyExcel.write(outputStream, GoldDetail.class).build(); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("Excel 写入器初始化失败", e); |
|
|
|
throw new RuntimeException("Excel 写入器初始化失败", e); |
|
|
|
} |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build(); |
|
|
|
// 7. 分页查询并写入数据 |
|
|
|
Page page = new Page(); |
|
|
|
page.setPageNum(1); |
|
|
|
page.setPageSize(1000); |
|
|
|
page.setPageSize(5000); |
|
|
|
Integer totalCount = 0; |
|
|
|
page.setRechargeUser(rechargeUser); |
|
|
|
boolean hasMore = true; |
|
|
@ -591,7 +599,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
if (tempFile != null && tempFile.exists() && tempFile.length() > 0) { |
|
|
|
// 8. 上传到OSS(读取本地临时文件) |
|
|
|
// 获取接口的基础 URL |
|
|
|
String uploadUrl = "http://39.101.133.168:8828/hljw/api/aws/upload"; |
|
|
|
String uploadUrl = this.uploadUrl; |
|
|
|
try { |
|
|
|
// 1. 创建上传工具实例 |
|
|
|
ExcelUploadUtil uploadUtil = new ExcelUploadUtil(uploadUrl); |
|
|
@ -725,14 +733,12 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
aiEmotionService.updateStatus(recordId, 1, "", "", 0); |
|
|
|
// 5. 准备Excel文件 |
|
|
|
fileName = record.getFileName(); |
|
|
|
log.info("到这了---------------------------------------------"); |
|
|
|
// 初始化临时文件(保存到本地临时目录) |
|
|
|
tempFile = File.createTempFile("export_", ".xlsx"); |
|
|
|
outputStream = new FileOutputStream(tempFile); // 使用文件输出流 |
|
|
|
// 从JSON中提取单个值 |
|
|
|
String text = requestDataNode.has("text") ? requestDataNode.get("text").asText() : null; |
|
|
|
Integer sort = requestDataNode.has("sort") ? requestDataNode.get("sort").asInt() : null; |
|
|
|
String field = requestDataNode.has("field") ? requestDataNode.get("field").asText() : null; |
|
|
|
String deptId = requestDataNode.has("deptId") ? requestDataNode.get("deptId").asText() : null; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
// 6. 初始化Excel写入器(指向本地文件流) |
|
|
@ -741,7 +747,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
// 7. 分页查询并写入数据 |
|
|
|
Page page = new Page(); |
|
|
|
page.setPageNum(1); |
|
|
|
page.setPageSize(1000); |
|
|
|
page.setPageSize(5000); |
|
|
|
page.setConsumeUser(consumeUser); |
|
|
|
Integer totalCount = 0; |
|
|
|
boolean hasMore = true; |
|
|
@ -793,7 +799,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
if (tempFile != null && tempFile.exists() && tempFile.length() > 0) { |
|
|
|
// 8. 上传到OSS(读取本地临时文件) |
|
|
|
// 获取接口的基础 URL |
|
|
|
String uploadUrl = "http://39.101.133.168:8828/hljw/api/aws/upload"; |
|
|
|
String uploadUrl = this.uploadUrl; |
|
|
|
try { |
|
|
|
// 1. 创建上传工具实例 |
|
|
|
ExcelUploadUtil uploadUtil = new ExcelUploadUtil(uploadUrl); |
|
|
@ -943,7 +949,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
// 7. 分页查询并写入数据 |
|
|
|
Page page = new Page(); |
|
|
|
page.setPageNum(1); |
|
|
|
page.setPageSize(1000); |
|
|
|
page.setPageSize(5000); |
|
|
|
page.setRefundUser(refundUser); |
|
|
|
Integer totalCount = 0; |
|
|
|
boolean hasMore = true; |
|
|
@ -995,7 +1001,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
if (tempFile != null && tempFile.exists() && tempFile.length() > 0) { |
|
|
|
// 8. 上传到OSS(读取本地临时文件) |
|
|
|
// 获取接口的基础 URL |
|
|
|
String uploadUrl = "http://39.101.133.168:8828/hljw/api/aws/upload"; |
|
|
|
String uploadUrl = this.uploadUrl; |
|
|
|
try { |
|
|
|
// 1. 创建上传工具实例 |
|
|
|
ExcelUploadUtil uploadUtil = new ExcelUploadUtil(uploadUrl); |
|
|
@ -1106,7 +1112,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Export> getExcel(Export export) { |
|
|
|
List<Export> list = exportMapper.getExportRecord(export.getAccount()); |
|
|
|
List<Export> list = exportMapper.getExportRecord(export.getAccount(),export.getType()); |
|
|
|
System.out.println(list+"-------------------------------"); |
|
|
|
return list; |
|
|
|
} |
|
|
|