|
@@ -275,11 +275,6 @@ public class ApiController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void combo(Sheet sheet, AtomicInteger rowNum, CellStyle p2, Map<String, List<FormulaDetail>> map, boolean flag) {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
@ApiOperation("平方米克重")
|
|
@ApiOperation("平方米克重")
|
|
@GetMapping("/gram-mass/total")
|
|
@GetMapping("/gram-mass/total")
|
|
@@ -530,16 +525,27 @@ public class ApiController extends BaseController {
|
|
percentStyle.setDataFormat(creationHelper.createDataFormat().getFormat("0.00%"));
|
|
percentStyle.setDataFormat(creationHelper.createDataFormat().getFormat("0.00%"));
|
|
CellStyle timeStyle = wb.createCellStyle();
|
|
CellStyle timeStyle = wb.createCellStyle();
|
|
timeStyle.setDataFormat(creationHelper.createDataFormat().getFormat(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
timeStyle.setDataFormat(creationHelper.createDataFormat().getFormat(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
|
+ CellStyle rightStyle = wb.createCellStyle();
|
|
|
|
+ rightStyle.setAlignment(HorizontalAlignment.RIGHT);
|
|
Sheet sheetAt = wb.getSheetAt(0);
|
|
Sheet sheetAt = wb.getSheetAt(0);
|
|
|
|
+ Row title = sheetAt.getRow(0);
|
|
|
|
+ Cell cell = title.getCell(0);
|
|
|
|
+ cell.setCellValue("停机原因分析(" + start + "至" + end + ")");
|
|
for (int i = 0; i < stopStr.length; i++) {
|
|
for (int i = 0; i < stopStr.length; i++) {
|
|
- Row row = sheetAt.createRow(i + 1);
|
|
|
|
|
|
+ Row row = sheetAt.createRow(i + 2);
|
|
Cell[] cells = new Cell[5];
|
|
Cell[] cells = new Cell[5];
|
|
for (int j = 0; j < cells.length; j++) {
|
|
for (int j = 0; j < cells.length; j++) {
|
|
cells[j] = row.createCell(j);
|
|
cells[j] = row.createCell(j);
|
|
}
|
|
}
|
|
cells[0].setCellValue(stopStr[i]);
|
|
cells[0].setCellValue(stopStr[i]);
|
|
cells[1].setCellValue(stopNum[i]);
|
|
cells[1].setCellValue(stopNum[i]);
|
|
- cells[2].setCellValue(stopTime[i]);
|
|
|
|
|
|
+ long minutes = stopTime[i] / 60;
|
|
|
|
+ // 分钟差
|
|
|
|
+ long seconds = stopTime[i] % 60;
|
|
|
|
+ // 秒数差,不包括分钟的秒数
|
|
|
|
+ String vv = minutes + "分" + (seconds > 10 ? seconds : "0" + seconds) + "秒";
|
|
|
|
+ cells[2].setCellValue(vv);
|
|
|
|
+ cells[2].setCellStyle(rightStyle);
|
|
float percentNum = BigDecimal.valueOf(stopNum[i]).divide(BigDecimal.valueOf(totalNum), 4, RoundingMode.HALF_UP).floatValue();
|
|
float percentNum = BigDecimal.valueOf(stopNum[i]).divide(BigDecimal.valueOf(totalNum), 4, RoundingMode.HALF_UP).floatValue();
|
|
float percentTimes = BigDecimal.valueOf(stopTime[i]).divide(BigDecimal.valueOf(totalTime.get()), 4, RoundingMode.HALF_UP).floatValue();
|
|
float percentTimes = BigDecimal.valueOf(stopTime[i]).divide(BigDecimal.valueOf(totalTime.get()), 4, RoundingMode.HALF_UP).floatValue();
|
|
cells[3].setCellValue(percentNum);
|
|
cells[3].setCellValue(percentNum);
|
|
@@ -552,7 +558,7 @@ public class ApiController extends BaseController {
|
|
AtomicInteger rowNum = new AtomicInteger(1);
|
|
AtomicInteger rowNum = new AtomicInteger(1);
|
|
list.forEach(stop -> {
|
|
list.forEach(stop -> {
|
|
Row row = sheet.createRow(rowNum.get());
|
|
Row row = sheet.createRow(rowNum.get());
|
|
- Cell[] cells = new Cell[4];
|
|
|
|
|
|
+ Cell[] cells = new Cell[5];
|
|
for (int j = 0; j < cells.length; j++) {
|
|
for (int j = 0; j < cells.length; j++) {
|
|
cells[j] = row.createCell(j);
|
|
cells[j] = row.createCell(j);
|
|
}
|
|
}
|
|
@@ -563,6 +569,12 @@ public class ApiController extends BaseController {
|
|
cells[2].setCellStyle(timeStyle);
|
|
cells[2].setCellStyle(timeStyle);
|
|
cells[3].setCellValue(stop.getEndTime());
|
|
cells[3].setCellValue(stop.getEndTime());
|
|
cells[3].setCellStyle(timeStyle);
|
|
cells[3].setCellStyle(timeStyle);
|
|
|
|
+ Duration duration = Duration.between(stop.getStartTime().toInstant(), stop.getEndTime().toInstant());
|
|
|
|
+ long minutes = duration.toMinutes(); // 分钟差
|
|
|
|
+ long seconds = duration.getSeconds() % 60; // 秒数差,不包括分钟的秒数
|
|
|
|
+ String vv = minutes + "分" + (seconds > 10 ? seconds : "0" + seconds) + "秒";
|
|
|
|
+ cells[4].setCellValue(vv);
|
|
|
|
+ cells[4].setCellStyle(rightStyle);
|
|
rowNum.getAndIncrement();
|
|
rowNum.getAndIncrement();
|
|
});
|
|
});
|
|
|
|
|
|
@@ -681,7 +693,7 @@ public class ApiController extends BaseController {
|
|
//Content-Disposition的作用:告知浏览器以何种方式显示响应返回的文件,用浏览器打开还是以附件的形式下载到本地保存
|
|
//Content-Disposition的作用:告知浏览器以何种方式显示响应返回的文件,用浏览器打开还是以附件的形式下载到本地保存
|
|
//attachment表示以附件方式下载 inline表示在线打开 "Content-Disposition: inline; filename=文件名.mp3"
|
|
//attachment表示以附件方式下载 inline表示在线打开 "Content-Disposition: inline; filename=文件名.mp3"
|
|
// filename表示文件的默认名称,因为网络传输只支持URL编码的相关支付,因此需要将文件名URL编码后进行传输,前端收到后需要反编码才能获取到真正的名称
|
|
// filename表示文件的默认名称,因为网络传输只支持URL编码的相关支付,因此需要将文件名URL编码后进行传输,前端收到后需要反编码才能获取到真正的名称
|
|
- response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(stopStr[type - 1] + "分析" + DateUtils.dateTimeNow() + ".xlsx", "UTF-8"));
|
|
|
|
|
|
+ response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("并发" + stopStr[type - 1] + "分析" + DateUtils.dateTimeNow() + ".xlsx", "UTF-8"));
|
|
response.setContentType("application/octet-stream");
|
|
response.setContentType("application/octet-stream");
|
|
wb.write(outputStream);
|
|
wb.write(outputStream);
|
|
outputStream.flush();
|
|
outputStream.flush();
|