zero hace 1 año
padre
commit
a0fca53e2c

+ 4 - 0
src/main/java/cn/cslg/pas/common/dto/ExportDTO.java

@@ -11,4 +11,8 @@ public class ExportDTO {
     private String estimatedQuery;
     private String actualQuery;
     private String queryFlag;
+    private String outCondition;
+    private String estimatedOutQuery;
+    private String actualOutQuery;
+    private String outQueryFlag;
 }

+ 46 - 1
src/main/java/cn/cslg/pas/service/business/es/EsExportService.java

@@ -52,14 +52,20 @@ public class EsExportService {
             String condition = patentDataMap.get("检索条件").toString();
             String estimatedTree = patentDataMap.get("预期二叉树").toString();
             String estimatedQuery = patentDataMap.get("预期Query").toString();
+            String outCondition = patentDataMap.get("外部检索条件").toString();
+            String estimatedOutQuery = patentDataMap.get("预期外部检索式").toString();
             ExportDTO exportDTO = new ExportDTO();
             exportDTO.setCondition(condition);
+            exportDTO.setOutCondition(outCondition);
             if (StringUtils.isNotEmpty(estimatedTree)) {
                 exportDTO.setEstimatedTree(estimatedTree);
             }
             if (StringUtils.isNotEmpty(estimatedQuery)) {
                 exportDTO.setEstimatedQuery(estimatedQuery);
             }
+            if (StringUtils.isNotEmpty(estimatedOutQuery)) {
+                exportDTO.setEstimatedOutQuery(estimatedOutQuery);
+            }
             list.add(exportDTO);
         }
         for (ExportDTO exportDTO : list) {
@@ -91,6 +97,20 @@ public class EsExportService {
                     exportDTO.setQueryFlag("T");
                 }
             }
+            if (StringUtils.isNotEmpty(exportDTO.getOutCondition()) && !exportDTO.getOutCondition().contains("+")) {
+                String outQueryStr = null;
+                try {
+                    outQueryStr = formatQueryService.reQuery(exportDTO.getOutCondition(), "webSearchConfig");
+                } catch (Exception e) {
+                    System.out.println(exportDTO.getOutCondition() + "转换外部接口检索表达式错误");
+                }
+                exportDTO.setActualOutQuery(outQueryStr);
+                if (outQueryStr == null || exportDTO.getEstimatedOutQuery() == null || !outQueryStr.equalsIgnoreCase(exportDTO.getEstimatedOutQuery().trim())) {
+                    exportDTO.setOutQueryFlag("F");
+                } else {
+                    exportDTO.setOutQueryFlag("T");
+                }
+            }
         }
         if (!CollectionUtils.isEmpty(list)) {
             this.loadExportTree(list);
@@ -99,7 +119,8 @@ public class EsExportService {
 
     public void loadExportTree(List<ExportDTO> list) throws FileNotFoundException {
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
-            List<String> headers = Arrays.asList("检索条件", "预期二叉树", "实际二叉树", "二叉树是否一致", "预期Query", "实际Query","Query是否一致 ");
+            List<String> headers = Arrays.asList("检索条件", "预期二叉树", "实际二叉树", "二叉树是否一致", "预期Query", "实际Query","Query是否一致",
+                    "外部检索条件","预期外部检索式", "实际外部检索式","外部检索式是否一致");
             HSSFWorkbook hssfWorkbook = new HSSFWorkbook();//新建工作簿
             HSSFSheet sheet = hssfWorkbook.createSheet();//新建sheet页
             sheet.setDefaultColumnWidth(30);
@@ -164,6 +185,30 @@ public class EsExportService {
                 commonCellStyle.setWrapText(true);
                 cell6.setCellStyle(commonCellStyle);
                 cell6.setCellValue(exportDTO.getQueryFlag());
+                HSSFCell cell7 = row.createCell(7);
+                ExcelUtils.setExcelCellStyle(commonCellStyle);
+                commonCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
+                commonCellStyle.setWrapText(true);
+                cell7.setCellStyle(commonCellStyle);
+                cell7.setCellValue(exportDTO.getOutCondition());
+                HSSFCell cell8 = row.createCell(8);
+                ExcelUtils.setExcelCellStyle(commonCellStyle);
+                commonCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
+                commonCellStyle.setWrapText(true);
+                cell8.setCellStyle(commonCellStyle);
+                cell8.setCellValue(exportDTO.getEstimatedOutQuery());
+                HSSFCell cell9 = row.createCell(9);
+                ExcelUtils.setExcelCellStyle(commonCellStyle);
+                commonCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
+                commonCellStyle.setWrapText(true);
+                cell9.setCellStyle(commonCellStyle);
+                cell9.setCellValue(exportDTO.getActualOutQuery());
+                HSSFCell cell10 = row.createCell(10);
+                ExcelUtils.setExcelCellStyle(commonCellStyle);
+                commonCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
+                commonCellStyle.setWrapText(true);
+                cell10.setCellStyle(commonCellStyle);
+                cell10.setCellValue(exportDTO.getOutQueryFlag());
             }
             hssfWorkbook.write(out);
             byte[] bytes = out.toByteArray();