上报库导出明细,带历史Log-处理空指针。
This commit is contained in:
+40
-32
@@ -675,7 +675,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
}
|
||||
|
||||
// 导出参数明细历史
|
||||
this.exportParamsReportDetailLog(paramsReportDetailVO.getCut(), workbook, sheetHistoryName, allParamsInfoList,cellStyle1,cellStyle);
|
||||
if(CollectionUtils.isNotEmpty(allParamsInfoList)){
|
||||
this.exportParamsReportDetailLog(paramsReportDetailVO.getCut(), workbook, sheetHistoryName, allParamsInfoList,cellStyle1,cellStyle);
|
||||
}
|
||||
//下载关联文件内容
|
||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
||||
@@ -770,41 +772,47 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
sheetHistory.setColumnWidth(i, 20 * 256);
|
||||
}
|
||||
}
|
||||
// 查询历史log信息
|
||||
List<String> detailIdList = allParamsInfoList.stream().map(e -> e.get("id").toString()).distinct().collect(Collectors.toList());
|
||||
QueryWrapper<ParamsReportDetailLogEO> detailLogQueryWrap = new QueryWrapper<>();
|
||||
detailLogQueryWrap.lambda().in(ParamsReportDetailLogEO::getParamsReportDetailId,detailIdList);
|
||||
detailLogQueryWrap.orderByDesc("params_report_detail_id");
|
||||
List<ParamsReportDetailLogEO> detailLogList = this.paramsReportDetailLogEOService.list(detailLogQueryWrap);
|
||||
if (CollectionUtils.isNotEmpty(detailLogList)) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
int historyRowNumber = 1;
|
||||
for (int i = 0; i < detailLogList.size(); i++) {
|
||||
String paramsReportDetailId = detailLogList.get(i).getParamsReportDetailId();
|
||||
if (CollectionUtils.isNotEmpty(allParamsInfoList)) {
|
||||
// 查询历史log信息
|
||||
List<String> detailIdList = allParamsInfoList.stream().map(e -> e.get("id").toString()).distinct().collect(Collectors.toList());
|
||||
|
||||
String nioNumber = allParamsInfoList.stream().filter(paramsInfo -> {
|
||||
boolean flag = false;
|
||||
if(StringUtils.equals(paramsInfo.get("id").toString(),paramsReportDetailId)){
|
||||
flag = true;
|
||||
if(CollectionUtils.isNotEmpty(detailIdList)){
|
||||
QueryWrapper<ParamsReportDetailLogEO> detailLogQueryWrap = new QueryWrapper<>();
|
||||
detailLogQueryWrap.lambda().in(ParamsReportDetailLogEO::getParamsReportDetailId,detailIdList);
|
||||
detailLogQueryWrap.orderByDesc("params_report_detail_id");
|
||||
List<ParamsReportDetailLogEO> detailLogList = this.paramsReportDetailLogEOService.list(detailLogQueryWrap);
|
||||
if (CollectionUtils.isNotEmpty(detailLogList)) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
int historyRowNumber = 1;
|
||||
for (int i = 0; i < detailLogList.size(); i++) {
|
||||
String paramsReportDetailId = detailLogList.get(i).getParamsReportDetailId();
|
||||
|
||||
String nioNumber = allParamsInfoList.stream().filter(paramsInfo -> {
|
||||
boolean flag = false;
|
||||
if(StringUtils.equals(paramsInfo.get("id").toString(),paramsReportDetailId)){
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).map(e -> e.get("nio_number").toString()).distinct().collect(Collectors.toList()).get(0);
|
||||
String operatorDetails = detailLogList.get(i).getLogCnContent();
|
||||
String operatorTime = sdf.format(detailLogList.get(i).getCreateTime());
|
||||
if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||
operatorDetails = detailLogList.get(i).getLogEnContent();
|
||||
}
|
||||
|
||||
XSSFRow row1 = sheetHistory.createRow(historyRowNumber);
|
||||
row1.createCell(0).setCellValue(nioNumber);
|
||||
row1.createCell(1).setCellValue(operatorDetails);
|
||||
row1.createCell(2).setCellValue(detailLogList.get(i).getRemarks());
|
||||
row1.createCell(3).setCellValue(operatorTime);
|
||||
for (int j = 0; j < 4; j++) {
|
||||
row1.getCell(j).setCellStyle(bodyCellStyle);
|
||||
}
|
||||
historyRowNumber ++;
|
||||
}
|
||||
return flag;
|
||||
}).map(e -> e.get("nio_number").toString()).distinct().collect(Collectors.toList()).get(0);
|
||||
String operatorDetails = detailLogList.get(i).getLogCnContent();
|
||||
String operatorTime = sdf.format(detailLogList.get(i).getCreateTime());
|
||||
if(StringUtils.equals(cut,CutEnum.EN.getValue())){
|
||||
operatorDetails = detailLogList.get(i).getLogEnContent();
|
||||
}
|
||||
|
||||
XSSFRow row1 = sheetHistory.createRow(historyRowNumber);
|
||||
row1.createCell(0).setCellValue(nioNumber);
|
||||
row1.createCell(1).setCellValue(operatorDetails);
|
||||
row1.createCell(2).setCellValue(detailLogList.get(i).getRemarks());
|
||||
row1.createCell(3).setCellValue(operatorTime);
|
||||
for (int j = 0; j < 4; j++) {
|
||||
row1.getCell(j).setCellStyle(bodyCellStyle);
|
||||
}
|
||||
historyRowNumber ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user