xiexiang 1 年之前
父節點
當前提交
08fb393bfb

二進制
a8c0ca9fa41341cc9a46440025b63b63.xls


+ 51 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetClassifyValue.java

@@ -0,0 +1,51 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import cn.cslg.pas.domain.es.PatentClassify;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/6/6
+ */
+@Component
+public class GetClassifyValue implements GetValueImp {
+
+    @Override
+    public String getValue(Object value) {
+        try {
+            String classifyStr = JSONObject.toJSONString(value);
+            PatentClassify patentClassify = JSONObject.parseObject(classifyStr, PatentClassify.class);
+            if (patentClassify != null) {
+                String objectString = getObjectAsString(patentClassify);
+                return objectString;
+            } else {
+                return "";
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return "";
+        }
+    }
+
+
+    public static String getObjectAsString(Object obj) {
+        Class<?> clazz = obj.getClass();
+        StringBuilder result = new StringBuilder();
+        for (Field field : clazz.getDeclaredFields()) {
+            field.setAccessible(true); // 设置为可访问,即便是私有字段也可以访问到
+            try {
+                result.append(field.getName())
+                        .append("=")
+                        .append(field.get(obj))
+                        .append(", ");
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        return result.toString();
+    }
+}

+ 9 - 1
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetDateValue.java

@@ -11,9 +11,17 @@ import java.util.Date;
  * @Date 2024/1/11
  */
 @Component
-public class GetDateValue implements GetValueImp{
+public class GetDateValue implements GetValueImp {
     @Override
     public String getValue(Object value) {
+        if (value == null) {
+            return "null";
+        }
+        if (!(value instanceof Date)) {
+            // 处理不合适的输入类型,比如字符串等
+            // 例如,如果输入是字符串,可以尝试将其解析为日期,或者直接返回错误提示
+            return "null"; // 这里根据实际情况返回相应的值
+        }
         Date inputDate = (Date)value;
         String reValue;
         // 创建SimpleDateFormat对象,指定输出日期的格式

+ 1 - 0
src/main/java/cn/cslg/pas/service/business/PatentExportService.java

@@ -120,6 +120,7 @@ public class PatentExportService {
                 Map<String, Object> map = new LinkedHashMap<>();
                 PatentNoVO patentNoVO = new PatentNoVO();
                 patentNoVO.setPatentNo(patentNos.get(i));
+                patentNoVO.setProjectId(exportTask.getProjectId());
                 PatentColumnDTO patent = patentService.selectPatentDetail(patentNoVO);
                 if (patent == null) {
                     defaultNum++;

+ 6 - 5
src/main/resources/jsons/patent.json

@@ -263,7 +263,8 @@
     "ifStats": "true",
     "ifAsCondition": "true",
     "groupBy": "company",
-    "ifSort": "false"
+    "ifSort": "false",
+    "exportClass": "getNameValue"
   },
   {
     "name": "合并发明人1",
@@ -670,7 +671,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
-    "exportClass": "getCommonValue",
+    "exportClass": "getClassifyValue",
     "children": [
       {
         "label": "IPC部",
@@ -788,7 +789,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
-    "exportClass": "getCommonValue",
+    "exportClass": "getClassifyValue",
     "children": [
       {
         "label": "CPC部",
@@ -906,7 +907,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
-    "exportClass": "getCommonValue",
+    "exportClass": "getClassifyValue",
     "children": [
       {
         "label": "UPC大类",
@@ -964,7 +965,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
-    "exportClass": "getCommonValue",
+    "exportClass": "getClassifyValue",
     "children": [
       {
         "label": "LOC大类",