TASK:mixi;

This commit is contained in:
shahaibo
2024-09-14 21:30:42 +08:00
parent b080b47644
commit cf0b45ae7f

View File

@@ -76,9 +76,9 @@ public class MiTuExportScheduledTask {
public void executeWeeklyHeavyStockReport() {
// customerPurchaseReport();
// NewJoinVIPReport();
// weeklySellThrReport();
// WeeklyHeavyStockReport();
// QuarterlyProductGroupingReport();
weeklySellThrReport();
WeeklyHeavyStockReport();
QuarterlyProductGroupingReport();
// customerTypeAnalysis();
// getBestSell30Days();
// getData();
@@ -655,8 +655,10 @@ public class MiTuExportScheduledTask {
}
// 处理最后一个PLU_CODE的数据
if (startRow < rowNum) {
mergeCells(sheet, startRow, rowNum - 1);
linkImageToCell(workbook, sheet, startRow, rowNum - 1, headers.length - 1, imagePath, channelSftp);
String currentPluCode = transactionSummaryList.get(transactionSummaryList.size() - 1).getPLU_CODE();
imagePath = getImagePath(currentPluCode);
mergeCells(sheet, startRow, rowNum);
linkImageToCell(workbook, sheet, startRow, rowNum, headers.length - 1, imagePath, channelSftp);
}
}
@@ -719,7 +721,6 @@ public class MiTuExportScheduledTask {
int rowNum = 1;
int startRow = rowNum;
String previousPluCode = "";
String imagePath = "";
// 创建并配置SFTP连接
@@ -737,16 +738,21 @@ public class MiTuExportScheduledTask {
channelSftp = (ChannelSftp) session.openChannel("sftp");
channelSftp.connect();
if (weeklyHeavyStockList.size() > 0) {
String previousPluCode = weeklyHeavyStockList.get(0).getPLU_CODE();
for (WeeklyHeavyStock weeklyHeavyStock : weeklyHeavyStockList) {
String currentPluCode = weeklyHeavyStock.getPLU_CODE();
// 当 PLU_CODE 改变时处理图片和单元格合并
if (!currentPluCode.equals(previousPluCode)) {
imagePath = getImagePath(currentPluCode);
imagePath = getImagePath(previousPluCode);
// 合并单元格并插入图片
if (startRow < rowNum - 1) {
mergeCells(sheet, startRow, rowNum - 1);
if (imagePath != null && !imagePath.isEmpty()) {
linkImageToCell(workbook, sheet, startRow, rowNum - 1, headers.length - 1, imagePath, channelSftp);
}
}
startRow = rowNum;
previousPluCode = currentPluCode;
}
@@ -777,13 +783,15 @@ public class MiTuExportScheduledTask {
rowNum++;
}
if (startRow < rowNum - 1) {
mergeCells(sheet, startRow, rowNum - 1);
if (startRow < rowNum) {
String currentPluCode = weeklyHeavyStockList.get(weeklyHeavyStockList.size() - 1).getPLU_CODE();
imagePath = getImagePath(currentPluCode);
mergeCells(sheet, startRow, rowNum);
if (imagePath != null && !imagePath.isEmpty()) {
linkImageToCell(workbook, sheet, startRow, rowNum - 1, headers.length - 1, imagePath, channelSftp);
linkImageToCell(workbook, sheet, startRow, rowNum, headers.length - 1, imagePath, channelSftp);
}
}
}
} catch (Exception e) {
log.info(imagePath);
throw new RuntimeException("Error while processing the report", e);
@@ -898,7 +906,6 @@ public class MiTuExportScheduledTask {
int rowNum = 3; // 数据从第四行开始
int startRow = rowNum;
String previousPluCode = "";
String imagePath = "";
// 创建并配置SFTP连接
@@ -916,15 +923,16 @@ public class MiTuExportScheduledTask {
channelSftp = (ChannelSftp) session.openChannel("sftp");
channelSftp.connect();
if (weeklyHeavyStockList.size() > 0) {
String previousPluCode = weeklyHeavyStockList.get(0).getPLU_CODE();
for (WeeklyHeavyStock weeklyHeavyStock : weeklyHeavyStockList) {
if (!weeklyHeavyStock.getPLU_CODE().equals(previousPluCode)) {
imagePath = getImagePath(weeklyHeavyStock.getPLU_CODE());
String currentPluCode = weeklyHeavyStock.getPLU_CODE();
if (!currentPluCode.equals(previousPluCode)) {
imagePath = getImagePath(previousPluCode);
// 新的PLU_CODE合并之前的单元格并插入图片
if (startRow < rowNum - 1) {
mergeCells(sheet, startRow, rowNum - 1);
if (imagePath != null && !imagePath.isEmpty()) {
linkImageToCell(workbook, sheet, startRow, rowNum - 1, 0, imagePath, channelSftp); // 插入图片到合并单元格
}
linkImageToCell(workbook, sheet, startRow, rowNum - 1, 0, imagePath, channelSftp);
}
startRow = rowNum;
previousPluCode = weeklyHeavyStock.getPLU_CODE();
@@ -978,13 +986,14 @@ public class MiTuExportScheduledTask {
}
// 确保处理最后一个Plu Code
if (startRow < rowNum - 1 || previousPluCode != null) {
mergeCells(sheet, startRow, rowNum - 1);
if (imagePath != null && !imagePath.isEmpty()) {
linkImageToCell(workbook, sheet, startRow, rowNum - 1, 0, imagePath, channelSftp); // 插入图片到合并单元格
}
if (startRow < rowNum) {
String currentPluCode = weeklyHeavyStockList.get(weeklyHeavyStockList.size() - 1).getPLU_CODE();
imagePath = getImagePath(currentPluCode);
mergeCells(sheet, startRow, rowNum);
linkImageToCell(workbook, sheet, startRow, rowNum, 0, imagePath, channelSftp);
}
}
} catch (Exception e) {
throw new RuntimeException("Error while processing the report", e);
} finally {