|
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.nio.file.Paths;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -156,7 +157,7 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
|
|
List<ShhTicketRulesReqVO> list = calculateTotalPrices(pzRawDataMapper.selectPzRawDataList(pzRawData));
|
|
List<ShhTicketRulesReqVO> list = calculateTotalPrices(pzRawDataMapper.selectPzRawDataList(pzRawData));
|
|
// 创建
|
|
// 创建
|
|
Workbook workbook = new XSSFWorkbook();
|
|
Workbook workbook = new XSSFWorkbook();
|
|
- Sheet sheet = workbook.createSheet("票务数据");
|
|
|
|
|
|
+ Sheet sheet = workbook.createSheet("销售汇总表统计");
|
|
sheet.setColumnWidth(0, 20 * 260);//设置单元格宽度 ,X代表第几列
|
|
sheet.setColumnWidth(0, 20 * 260);//设置单元格宽度 ,X代表第几列
|
|
Row headerRow = sheet.createRow(0);
|
|
Row headerRow = sheet.createRow(0);
|
|
CellStyle style = workbook.createCellStyle(); // 创建单元格样式
|
|
CellStyle style = workbook.createCellStyle(); // 创建单元格样式
|
|
@@ -189,7 +190,8 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
|
|
dataRow.createCell(2).setCellValue(String.valueOf(data.getAmount()));
|
|
dataRow.createCell(2).setCellValue(String.valueOf(data.getAmount()));
|
|
}
|
|
}
|
|
// 写入
|
|
// 写入
|
|
- try (FileOutputStream fileOut = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\出票数据" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xlsx")) {
|
|
|
|
|
|
+ String desktopPath = Paths.get(System.getProperty("user.home"), "Desktop").toString();
|
|
|
|
+ try (FileOutputStream fileOut = new FileOutputStream(desktopPath + "\\销售汇总表统计" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xlsx")) {
|
|
workbook.write(fileOut);
|
|
workbook.write(fileOut);
|
|
log.info("Excel 文件已成功导出!");
|
|
log.info("Excel 文件已成功导出!");
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
@@ -205,7 +207,7 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 统计导出计算总价公式
|
|
|
|
|
|
+ * 统计导出计算总价公式(票种存在多个规则中)
|
|
*
|
|
*
|
|
* @param list
|
|
* @param list
|
|
* @return
|
|
* @return
|
|
@@ -236,6 +238,12 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 统计导出计算总价公式(票种只存在一个规则中)
|
|
|
|
+ *
|
|
|
|
+ * @param list
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
public List<ShhTicketRulesReqVO> calculateTotalPrice(List<PzRawDataVo> list) {
|
|
public List<ShhTicketRulesReqVO> calculateTotalPrice(List<PzRawDataVo> list) {
|
|
List<ShhTicketRulesReqVO> returnList = new ArrayList<>();
|
|
List<ShhTicketRulesReqVO> returnList = new ArrayList<>();
|
|
Map<String, PzRawDataVo> map = new HashMap<>();
|
|
Map<String, PzRawDataVo> map = new HashMap<>();
|