113 커밋 506cb737bd ... cb7ac92457

작성자 SHA1 메시지 날짜
  许家凯 cb7ac92457 Merge remote-tracking branch 'origin/master' 8 달 전
  许家凯 a272ec518d feat: 添加一些工具类、依赖 8 달 전
  许家凯 380aa470e9 feat: 添加lawyer_case、company_case、文书转换holo摘要函数 8 달 전
  xufei fadf3c186f add udf 11 달 전
  许家凯 ae101378fc Merge remote-tracking branch 'origin/master' 11 달 전
  许家凯 506e2d5df2 feat: party_summary添加第三人 11 달 전
  许家凯 cce0a6a669 feat: case_no_party_title_parse添加第三人 1 년 전
  许家凯 2ca05564a2 feat: update case_info.json 1 년 전
  许家凯 71da762c21 fix: party_summary函数 1 년 전
  许家凯 d76f641ef5 feat: party_summary函数 1 년 전
  xufei b0f272f18f add udf 1 년 전
  xufei 85416ab49f add udf 1 년 전
  xufei 684ab6846c add udf 1 년 전
  xufei 80318ec702 add udf 1 년 전
  xufei 0e6d82c6b2 add udf 1 년 전
  许家凯 f7632d93e8 Merge remote-tracking branch 'origin/master' 1 년 전
  许家凯 a2b63480dd fix: case_no_party_title_parse函数 1 년 전
  许家凯 c03b3e4aab Merge remote-tracking branch 'origin/master' 1 년 전
  许家凯 af65e68067 fix: case_no_party_title_parse函数 1 년 전
  许家凯 37c7724570 fix: case_no_party_title_parse函数 1 년 전
  许家凯 97fa34dbaa fix: 添加case_no_area_code函数 1 년 전
  许家凯 baafecdbf4 fix: 添加case_no_area_code函数 1 년 전
  许家凯 e343d49414 fix: 添加case_no_area_code函数 1 년 전
  许家凯 964632cbd7 fix: 添加case_no_party_title_parse函数 1 년 전
  许家凯 8c3744eef3 fix: 添加case_no_party_title_parse函数 1 년 전
  许家凯 972c5b8de0 Merge remote-tracking branch 'origin/master' 1 년 전
  许家凯 6e45fb67b4 fix: 添加case_no_party_title_parse函数 1 년 전
  许家凯 75ae988edb feat: 添加case_no_party_title_parse函数 1 년 전
  许家凯 5550426367 feat: 添加cleanup_sort函数 1 년 전
  许家凯 cf4cd06300 feat: 添加注册资本按汇率转换函数 1 년 전
  JimZhang 5b3d07bd49 feat: 公司类型、省市区代码、变更类型清洗 2 년 전
  xufei 119cbf1c29 add udf 2 년 전
  许家凯 e390fa82cc docs: 2 년 전
  许家凯 7c15c6a028 Merge remote-tracking branch 'origin/master' 2 년 전
  许家凯 2354463036 fix: 添加统一信用代码,工商注册号校验函数 2 년 전
  许家凯 ebc1ecdeeb feat: 添加统一信用代码,工商注册号校验函数 2 년 전
  xufei f4016e0cce add udf 2 년 전
  xufei 2d30ff5d0a add udf 2 년 전
  xufei 364fc6df6c add udf 2 년 전
  JimZhang a9de3e6a6a feat: 公司类型返回array 2 년 전
  JimZhang 52311ec3b6 Merge branch 'master' of http://139.224.213.4:3000/bigdata/UDF_Max 2 년 전
  JimZhang 3b8347bd94 feat: 公司类型 2 년 전
  JimZhang 00f940474a feat: 公司类型识别 2 년 전
  JimZhang 4c01e8d9bd Merge branch 'master' of http://139.224.213.4:3000/bigdata/UDF_Max 2 년 전
  JimZhang d87d02bc49 feat: add udf 2 년 전
  JimZhang 720123c4b6 feat: cleanup change info udf 2 년 전
  xufei 08f52b6a9d add udf 2 년 전
  xufei b4cd164df8 add udf 2 년 전
  许家凯 c81a31d40e feat: v7_tyc_company_compare 2 년 전
  许家凯 eeca233cb7 feat: amount_format 2 년 전
  xufei 76d51eab44 add udf 2 년 전
  xufei f2ca305b0b add udf 2 년 전
  xufei 272d573d49 add udf 3 년 전
  xufei 655b09a801 Merge remote-tracking branch 'origin/master' 3 년 전
  xufei 4276faf725 add udf 3 년 전
  xufei ba60a5b796 update 3 년 전
  许家凯 3eb88739dc feat: 添加查找繁体转简体异常问题 3 년 전
  xufei f903f5eb12 注册资本规整 3 년 전
  xufei f063ac3cb2 add udf 3 년 전
  许家凯 65a281eab1 feat: 添加注册资本格式化函数 3 년 전
  xufei 656cd385bb add udf 3 년 전
  xufei a54ecebc03 是否结案判断 3 년 전
  xufei 1fcd8ec891 udf add 3 년 전
  xufei d142c1d774 日期规整 3 년 전
  xufei 70bb4c7967 法人提取 3 년 전
  xufei 7c47868b84 注册资本修复 3 년 전
  xufei c614fad9d8 行业code转name 3 년 전
  许家凯 c0cf3f6dbf feat: add 3 년 전
  许家凯 6bc8605b24 feat: add 3 년 전
  xufei bc7128e507 兼容数值 3 년 전
  xufei 31a105193b url提取 3 년 전
  许家凯 cc0de7ac9b feat: add CompanyZxrRestrictPublishDate 3 년 전
  许家凯 8e92101c86 feat: add FieldsCompare 3 년 전
  xufei d681f21879 更新逻辑 3 년 전
  JimZhang dab2dd7c3e fix: 薪资转换优化特殊情况 3 년 전
  JimZhang d4475bdb2b feat: 薪资转换兼容更多情况 3 년 전
  JimZhang 4fc26d560d feat: 薪资转换 3 년 전
  xufei 081e319f2b 更新逻辑 3 년 전
  xufei d6df72c4c6 Merge remote-tracking branch 'origin/master' 3 년 전
  xufei 83d95e3210 更新逻辑 3 년 전
  xufei 7e542efc63 update 3 년 전
  xufei 5974bba2dc Merge remote-tracking branch 'origin/master' 3 년 전
  xufei d8e9b2799b 更新文书 3 년 전
  xufei f00fd9a773 add func 3 년 전
  xufei b749bbfc09 合并json 3 년 전
  许家凯 4f24d0b327 feat: add 3 년 전
  xufei ea9654db66 更新 3 년 전
  xufei 1f67fb532c 更新 3 년 전
  xufei db7b58a751 更新 3 년 전
  许家凯 f6138cb853 Merge remote-tracking branch 'origin/master' 3 년 전
  许家凯 94e3ab49c2 feat: add 3 년 전
  许家凯 6ba65c3092 feat: pom依赖排除其它包 3 년 전
  许家凯 123e64224a Merge remote-tracking branch 'origin/master' 3 년 전
  许家凯 b3fbe53244 feat: 添加依赖 3 년 전
  晏永年 2239c08589 concat_ws2 4 년 전
  xufei 8ea80cdd2b 添加函数 4 년 전
  许家凯 4b0345cb6e Merge remote-tracking branch 'origin/master' 4 년 전
  许家凯 bf41832bfd feat: 添加一系列函数 4 년 전
  许家凯 862942c7af Merge remote-tracking branch 'origin/master' 4 년 전
  许家凯 4a4fc0569c feat: 添加全角转半角函数 4 년 전
  xufei 1e3ffa72a7 udf更新 4 년 전
  xufei 36615f166c udf更新 4 년 전
  许家凯 d248596eec feat: 添加行业code函数 4 년 전
  许家凯 47a0709bab feat: 添加人名处理函数 4 년 전
  许家凯 8574333003 feat: 添加concat_cleanup函数 4 년 전
  许家凯 8bb16b840c feat: 添加身份证号提取、注册资本提取 4 년 전
  许家凯 83e6eb3f2e feat: 案号规整函数中文括号转英文 4 년 전
  许家凯 b64de49f0c Merge remote-tracking branch 'origin/master' 4 년 전
  许家凯 a87244ee81 feat: 添加案号规整函数 4 년 전
  许家凯 2b0136259b Merge branch 'master' of http://139.224.213.4:3000/bigdata/UDF_Max 4 년 전
  许家凯 329b2abbdc add company_split 4 년 전
  许家凯 b441632a77 添加币种提取udf 4 년 전
  许家凯 fab820d3ce init 4 년 전

+ 8 - 0
pom.xml

@@ -87,6 +87,14 @@
             <version>3.7</version>
         </dependency>
 
+        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.20</version>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 136 - 0
src/main/java/com/winhc/bigdata/bean/Tuple2.java

@@ -0,0 +1,136 @@
+package com.winhc.bigdata.bean;
+
+/**
+ * @Author: XuJiakai
+ * 2024/6/5 10:36
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// --------------------------------------------------------------
+//  THIS IS A GENERATED SOURCE FILE. DO NOT EDIT!
+//  GENERATED FROM org.apache.flink.api.java.tuple.TupleGenerator.
+// --------------------------------------------------------------
+
+
+import com.winhc.bigdata.utils.BaseUtils;
+
+/**
+ * A tuple with 2 fields. Tuples are strongly typed; each field may be of a separate type. The
+ * fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
+ * through the {@link #getField(int)} method. The tuple field positions start at zero.
+ *
+ * <p>Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions
+ * that work with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * <p>Warning: If you subclass Tuple2, then be sure to either
+ *
+ * <ul>
+ *   <li>not add any new fields, or
+ *   <li>make it a POJO, and always declare the element type of your DataStreams/DataSets to your
+ *       descendant type. (That is, if you have a "class Foo extends Tuple2", then don't use
+ *       instances of Foo in a DataStream&lt;Tuple2&gt; / DataSet&lt;Tuple2&gt;, but declare it as
+ *       DataStream&lt;Foo&gt; / DataSet&lt;Foo&gt;.)
+ * </ul>
+ *
+ * @see Tuple
+ * @param <T0> The type of field 0
+ * @param <T1> The type of field 1
+ */
+public class Tuple2<T0, T1> {
+
+    private static final long serialVersionUID = 1L;
+
+    /** Field 0 of the tuple. */
+    public T0 f0;
+    /** Field 1 of the tuple. */
+    public T1 f1;
+
+    /** Creates a new tuple where all fields are null. */
+    public Tuple2() {}
+
+    /**
+     * Creates a new tuple and assigns the given values to the tuple's fields.
+     *
+     * @param f0 The value for field 0
+     * @param f1 The value for field 1
+     */
+    public Tuple2(T0 f0, T1 f1) {
+        this.f0 = f0;
+        this.f1 = f1;
+    }
+
+
+    // -------------------------------------------------------------------------------------------------
+    // standard utilities
+    // -------------------------------------------------------------------------------------------------
+
+    /**
+     * Creates a string representation of the tuple in the form (f0, f1), where the individual
+     * fields are the value returned by calling {@link Object#toString} on that field.
+     *
+     * @return The string representation of the tuple.
+     */
+    @Override
+    public String toString() {
+        return BaseUtils.toString(this);
+    }
+
+    /**
+     * Deep equality for tuples by calling equals() on the tuple members.
+     *
+     * @param o the object checked for equality
+     * @return true if this is equal to o.
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof Tuple2)) {
+            return false;
+        }
+        @SuppressWarnings("rawtypes")
+        Tuple2 tuple = (Tuple2) o;
+        if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) {
+            return false;
+        }
+        if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = f0 != null ? f0.hashCode() : 0;
+        result = 31 * result + (f1 != null ? f1.hashCode() : 0);
+        return result;
+    }
+
+
+    /**
+     * Creates a new tuple and assigns the given values to the tuple's fields. This is more
+     * convenient than using the constructor, because the compiler can infer the generic type
+     * arguments implicitly. For example: {@code Tuple3.of(n, x, s)} instead of {@code new
+     * Tuple3<Integer, Double, String>(n, x, s)}
+     */
+    public static <T0, T1> Tuple2<T0, T1> of(T0 f0, T1 f1) {
+        return new Tuple2<>(f0, f1);
+    }
+}

+ 97 - 0
src/main/java/com/winhc/bigdata/bean/Tuple3.java

@@ -0,0 +1,97 @@
+package com.winhc.bigdata.bean;
+
+import com.winhc.bigdata.utils.BaseUtils;
+
+/**
+ * @Author: XuJiakai
+ * 2024/6/5 10:37
+ */
+public class Tuple3<T0, T1, T2> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Field 0 of the tuple.
+     */
+    public T0 f0;
+    /**
+     * Field 1 of the tuple.
+     */
+    public T1 f1;
+    /**
+     * Field 2 of the tuple.
+     */
+    public T2 f2;
+
+    /**
+     * Creates a new tuple where all fields are null.
+     */
+    public Tuple3() {
+    }
+
+    /**
+     * Creates a new tuple and assigns the given values to the tuple's fields.
+     *
+     * @param f0 The value for field 0
+     * @param f1 The value for field 1
+     * @param f2 The value for field 2
+     */
+    public Tuple3(T0 f0, T1 f1, T2 f2) {
+        this.f0 = f0;
+        this.f1 = f1;
+        this.f2 = f2;
+    }
+
+
+    @Override
+    public String toString() {
+        return BaseUtils.toString(this);
+    }
+
+    /**
+     * Deep equality for tuples by calling equals() on the tuple members.
+     *
+     * @param o the object checked for equality
+     * @return true if this is equal to o.
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof Tuple3)) {
+            return false;
+        }
+        @SuppressWarnings("rawtypes")
+        Tuple3 tuple = (Tuple3) o;
+        if (f0 != null ? !f0.equals(tuple.f0) : tuple.f0 != null) {
+            return false;
+        }
+        if (f1 != null ? !f1.equals(tuple.f1) : tuple.f1 != null) {
+            return false;
+        }
+        if (f2 != null ? !f2.equals(tuple.f2) : tuple.f2 != null) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = f0 != null ? f0.hashCode() : 0;
+        result = 31 * result + (f1 != null ? f1.hashCode() : 0);
+        result = 31 * result + (f2 != null ? f2.hashCode() : 0);
+        return result;
+    }
+
+
+    /**
+     * Creates a new tuple and assigns the given values to the tuple's fields. This is more
+     * convenient than using the constructor, because the compiler can infer the generic type
+     * arguments implicitly. For example: {@code Tuple3.of(n, x, s)} instead of {@code new
+     * Tuple3<Integer, Double, String>(n, x, s)}
+     */
+    public static <T0, T1, T2> Tuple3<T0, T1, T2> of(T0 f0, T1 f1, T2 f2) {
+        return new Tuple3<>(f0, f1, f2);
+    }
+}

+ 30 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/CompanyCaseUDTF.java

@@ -0,0 +1,30 @@
+package com.winhc.bigdata.udtf.judgment_doc;
+
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.odps.udf.UDFException;
+import com.aliyun.odps.udf.UDTF;
+import com.aliyun.odps.udf.annotation.Resolve;
+import com.winhc.bigdata.udtf.judgment_doc.entity.EsCompanyBaseCaseEntity;
+import com.winhc.bigdata.udtf.judgment_doc.utils.JudgmentDocumentUtils;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2024/6/5 11:02
+ */
+@Resolve(value = "*->string")
+public class CompanyCaseUDTF  extends UDTF {
+    @Override
+    public void process(Object[] objects) throws UDFException, IOException {
+        String str = (String) objects[0];
+
+        JSONObject jsonObject = JSONObject.parseObject(str);
+        List<EsCompanyBaseCaseEntity> esCompanyCaseData = JudgmentDocumentUtils.getEsCompanyCaseData(jsonObject);
+
+        for (EsCompanyBaseCaseEntity esCompanyCaseDatum : esCompanyCaseData) {
+            forward(esCompanyCaseDatum.toEsIndexJsonStr());
+        }
+    }
+}

+ 47 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/JudgmentDocumentSummaryUDTF.java

@@ -0,0 +1,47 @@
+package com.winhc.bigdata.udtf.judgment_doc;
+
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.odps.udf.UDFException;
+import com.aliyun.odps.udf.UDTF;
+import com.aliyun.odps.udf.annotation.Resolve;
+import com.winhc.bigdata.udtf.judgment_doc.entity.JudgmentDocumentSummaryEntity;
+import com.winhc.bigdata.udtf.judgment_doc.utils.JudgmentDocumentUtils;
+import com.winhc.bigdata.utils.BaseUtils;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/23 9:41
+ * 根据odps文书表,生成hologres的摘要
+ *
+ * input args:  rowkey,court_name,case_amt,case_reason_level_1,case_reason_level_2,case_reason_level_3,case_reason_level_4,case_reason,yg_lawyer,plaintiff_info,bg_lawyer,defendant_info
+ * output args: base_lawyer_id,rowkey,case_reason_std,court_name,case_amt,company_id
+ */
+@Resolve(value="*->string,string,array<string>,string,string,array<string>")
+public class JudgmentDocumentSummaryUDTF extends UDTF{
+    @Override
+    public void process(Object[] objects) throws UDFException, IOException {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("rowkey", objects[0]);
+        jsonObject.put("court_name", objects[1]);
+        jsonObject.put("case_amt", objects[2]);
+        jsonObject.put("case_reason_level1", objects[3]);
+        jsonObject.put("case_reason_level2", objects[4]);
+        jsonObject.put("case_reason_level3", objects[5]);
+        jsonObject.put("case_reason_level4", objects[6]);
+        jsonObject.put("case_reason", objects[7]);
+        jsonObject.put("yg_lawyer", objects[8]);
+        jsonObject.put("plaintiff_info", objects[9]);
+        jsonObject.put("bg_lawyer", objects[10]);
+        jsonObject.put("defendant_info", objects[11]);
+        jsonObject.put("party_info_new", objects[12]);
+
+        List<JudgmentDocumentSummaryEntity> hologresData = JudgmentDocumentUtils.getHologresData(jsonObject);
+
+        for (JudgmentDocumentSummaryEntity item : hologresData) {
+            forward(item.getBase_lawyer_id(),item.getRowkey(), item.getCase_reason_std(),item.getCourt_name(),item.getCase_amt(),item.getCompany_id());
+        }
+    }
+}

+ 32 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/LawyerCaseUDTF.java

@@ -0,0 +1,32 @@
+package com.winhc.bigdata.udtf.judgment_doc;
+
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.odps.data.SimpleStruct;
+import com.aliyun.odps.data.Struct;
+import com.aliyun.odps.udf.UDFException;
+import com.aliyun.odps.udf.UDTF;
+import com.aliyun.odps.udf.annotation.Resolve;
+import com.winhc.bigdata.udtf.judgment_doc.entity.EsLawyerBaseCaseEntity;
+import com.winhc.bigdata.udtf.judgment_doc.utils.JudgmentDocumentUtils;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2024/6/5 11:02
+ */
+@Resolve(value = "*->string")
+public class LawyerCaseUDTF extends UDTF {
+    @Override
+    public void process(Object[] objects) throws UDFException, IOException {
+        String str = (String) objects[0];
+
+        JSONObject jsonObject = JSONObject.parseObject(str);
+        List<EsLawyerBaseCaseEntity> esLawyerCaseData = JudgmentDocumentUtils.getEsLawyerCaseData(jsonObject);
+
+        for (EsLawyerBaseCaseEntity esLawyerCaseDatum : esLawyerCaseData) {
+            forward(esLawyerCaseDatum.toEsIndexJsonStr());
+        }
+    }
+}

+ 104 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/entity/BaseCaseInfo.java

@@ -0,0 +1,104 @@
+package com.winhc.bigdata.udtf.judgment_doc.entity;
+
+import cn.hutool.core.bean.DynaBean;
+import cn.hutool.core.util.ReflectUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.SneakyThrows;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.List;
+
+import com.winhc.bigdata.utils.BaseUtils;
+/**
+ * @Author: XuJiakai
+ * 2024/5/22 16:28
+ * company_case和lawyer_case抽象出案件的通用信息
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+public class BaseCaseInfo implements Serializable {
+    private String case_id;
+    private String case_type;
+    private String case_reason_level1;
+    private String case_reason_level2;
+    private String case_reason_level3;
+    private String case_reason_level4;
+    private String case_reason;
+    private String case_reason_levelnum;
+    private String case_stage;
+    private BigDecimal case_amt;
+    private BigDecimal judge_amt;
+    private BigDecimal accept_amt;
+    private String province_court_name;
+    private String city_court_name;
+    private String court_name;
+    private String court_province_code;
+    private String court_city_code;
+
+    private String court_level;
+    private List<String> judge_name;
+
+    private String judge_date;
+
+    private String create_time;
+    private String update_time;
+    private Integer deleted;
+
+
+    @Override
+    public String toString() {
+        return BaseUtils.toString(this, SerializerFeature.WriteDateUseDateFormat);
+    }
+
+
+    @SneakyThrows
+    public EsCompanyBaseCaseEntity toEsCompanyCaseEntity() {
+        EsCompanyBaseCaseEntity entity = new EsCompanyBaseCaseEntity();
+        DynaBean target = DynaBean.create(entity);
+        Field[] fields = ReflectUtil.getFields(BaseCaseInfo.class);
+        for (Field field : fields) {
+            String field_name = field.getName();
+            Object value = field.get(this);
+            target.set(field_name, value);
+        }
+        return entity;
+    }
+
+
+    @SneakyThrows
+    public EsLawyerBaseCaseEntity toEsLawyerCaseEntity() {
+        EsLawyerBaseCaseEntity entity = new EsLawyerBaseCaseEntity();
+        DynaBean target = DynaBean.create(entity);
+        Field[] fields = ReflectUtil.getFields(BaseCaseInfo.class);
+        for (Field field : fields) {
+            String field_name = field.getName();
+            Object value = field.get(this);
+            target.set(field_name, value);
+        }
+        return entity;
+    }
+
+
+    public String getIndexName() {
+        throw new RuntimeException("Method not implemented! ");
+    }
+
+
+    public String get_id() {
+        throw new RuntimeException("Method not implemented! ");
+    }
+
+
+    public String toEsIndexJsonStr() {
+        JSONObject jsonObject = ((JSONObject) JSONObject.toJSON(this));
+
+        return BaseUtils.toString(jsonObject);
+    }
+}

+ 50 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/entity/EsCompanyBaseCaseEntity.java

@@ -0,0 +1,50 @@
+package com.winhc.bigdata.udtf.judgment_doc.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/22 16:31
+ */
+@Getter
+@Setter
+@AllArgsConstructor(staticName = "of")
+@NoArgsConstructor
+public class EsCompanyBaseCaseEntity extends BaseCaseInfo implements Serializable {
+
+    private String company_id;
+    private String company_name;
+    private String industry_level1;
+    private String industry_level2;
+    private String industry_level3;
+    private String industry_level4;
+    private String company_province_code;
+    private String company_city_code;
+    private String company_district_code;
+    private Double reg_capital;
+    private String company_state;
+    private String open_date;
+    private List<String> company_type;
+
+    private String is_success;
+    private String case_role;
+
+    private List<LawyerInfoEntity> lawyer_info;
+
+
+    @Override
+    public String getIndexName() {
+        return "";
+    }
+
+    @Override
+    public String get_id() {
+        return getCompany_id() + "_" + getCase_id();
+    }
+}

+ 46 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/entity/EsLawyerBaseCaseEntity.java

@@ -0,0 +1,46 @@
+package com.winhc.bigdata.udtf.judgment_doc.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/22 15:44
+ */
+@Getter
+@Setter
+@AllArgsConstructor(staticName = "of")
+@NoArgsConstructor
+public class EsLawyerBaseCaseEntity extends BaseCaseInfo implements Serializable {
+
+    private String lawyer_name;
+    private String base_lawyer_id;
+    private String lawfirm;
+    private String lawfirm_id;
+    /**
+     * 有后端lawyer_id用后端lawyer_id,无则用base_lawyer_id
+     */
+    private String lawyer_entity_id;
+    private String province_code;
+    private String city_code;
+    private String district_code;
+    private Integer first_career_year;
+
+    private String is_success;
+    private String is_credit;
+
+    @Override
+    public String getIndexName() {
+        return "";
+    }
+
+    @Override
+    public String get_id() {
+        return getBase_lawyer_id() + "_" + getCase_id();
+    }
+}
+

+ 62 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/entity/JudgmentDocumentSummaryEntity.java

@@ -0,0 +1,62 @@
+package com.winhc.bigdata.udtf.judgment_doc.entity;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.winhc.bigdata.utils.BaseUtils;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/22 10:24
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor(staticName = "of")
+public class JudgmentDocumentSummaryEntity {
+
+    private String base_lawyer_id;
+    private String rowkey;
+    private List<String> case_reason_std;
+
+    private String court_name;
+    private String case_amt;
+    private List<String> company_id;
+
+    public String getPrimaryKey() {
+        return base_lawyer_id + "_" + rowkey;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+
+        if (o == null || getClass() != o.getClass()) return false;
+
+        JudgmentDocumentSummaryEntity that = (JudgmentDocumentSummaryEntity) o;
+
+        return new EqualsBuilder().append(base_lawyer_id, that.base_lawyer_id).append(rowkey, that.rowkey).append(case_reason_std, that.case_reason_std).append(court_name, that.court_name).append(case_amt, that.case_amt).append(company_id, that.company_id).isEquals();
+    }
+
+    @Override
+    public int hashCode() {
+        return new HashCodeBuilder(17, 37).append(base_lawyer_id).append(rowkey).append(case_reason_std).append(court_name).append(case_amt).append(company_id).toHashCode();
+    }
+
+    @Override
+    public String toString() {
+        return BaseUtils.toString(this);
+    }
+
+    public JSONObject toJSONObject() {
+        return ((JSONObject) JSONObject.toJSON(this));
+    }
+}

+ 19 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/entity/LawyerInfoEntity.java

@@ -0,0 +1,19 @@
+package com.winhc.bigdata.udtf.judgment_doc.entity;
+
+import lombok.*;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/22 9:43
+ */
+@Getter
+@Setter
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor(staticName = "of")
+public class LawyerInfoEntity {
+    private String base_lawyer_id;
+    private String lawyer_name;
+    private String lawfirm_name;
+    private String lawfirm_id;
+}

+ 41 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/entity/LitigantInfoEntity.java

@@ -0,0 +1,41 @@
+package com.winhc.bigdata.udtf.judgment_doc.entity;
+
+import lombok.*;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/22 9:52
+ */
+@Getter
+@Setter
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor(staticName = "of")
+public class LitigantInfoEntity {
+
+    private String litigant_id;
+    private String judge_tendency;
+    private String name;
+    private List<LawyerInfoEntity> lawyer_info;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+
+        if (o == null || getClass() != o.getClass()) return false;
+
+        LitigantInfoEntity that = (LitigantInfoEntity) o;
+
+        return new EqualsBuilder().append(litigant_id, that.litigant_id).append(judge_tendency, that.judge_tendency).append(name, that.name).append(lawyer_info, that.lawyer_info).isEquals();
+    }
+
+    @Override
+    public int hashCode() {
+        return new HashCodeBuilder(17, 37).append(litigant_id).append(judge_tendency).append(name).append(lawyer_info).toHashCode();
+    }
+
+}

+ 41 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/entity/PartyInfoEntity.java

@@ -0,0 +1,41 @@
+package com.winhc.bigdata.udtf.judgment_doc.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2023/10/25 18:02
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public class PartyInfoEntity {
+    private String title_original;
+    private String title_std;
+    private Integer show_level;
+    private List<LitigantInfoEntity> party_info;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+
+        if (o == null || getClass() != o.getClass()) return false;
+
+        PartyInfoEntity partyInfoEntity = (PartyInfoEntity) o;
+
+        return new EqualsBuilder().append(title_original, partyInfoEntity.title_original).append(title_std, partyInfoEntity.title_std).isEquals();
+    }
+
+    @Override
+    public int hashCode() {
+        return new HashCodeBuilder(17, 37).append(title_original).append(title_std).toHashCode();
+    }
+}

+ 553 - 0
src/main/java/com/winhc/bigdata/udtf/judgment_doc/utils/JudgmentDocumentUtils.java

@@ -0,0 +1,553 @@
+package com.winhc.bigdata.udtf.judgment_doc.utils;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.winhc.bigdata.bean.Tuple2;
+import com.winhc.bigdata.bean.Tuple3;
+import com.winhc.bigdata.udtf.judgment_doc.entity.*;
+import com.winhc.bigdata.utils.BaseUtils;
+import com.winhc.bigdata.utils.JsonObjectUtils;
+import lombok.experimental.ExtensionMethod;
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/21 14:41
+ */
+@SuppressWarnings("all")
+@ExtensionMethod({
+        JsonObjectUtils.class
+})
+public class JudgmentDocumentUtils {
+
+    private static Map<String, String> CASE_REASON_MAP = new HashMap<String, String>() {
+        {
+            put("合同纠纷_3", "合同纠纷");
+            put("民间借贷纠纷_5", "民间借贷");
+            put("建设工程合同纠纷_4", "建设工程");
+            put("机动车交通事故责任纠纷_4", "交通事故");
+            put("婚姻家庭、继承纠纷_2", "婚姻家庭");
+            put("劳动争议、人事争议_2", "劳动人事");
+            put("金融借款合同纠纷_5", "金融借款");
+            put("房屋买卖合同纠纷_4", "房屋买卖");
+            put("知识产权与竞争纠纷_2", "知识产权");
+            put("医疗损害责任纠纷_4", "医疗纠纷");
+            put("侵权责任纠纷_2", "侵权损害");
+            put("海事海商纠纷_2", "海事海商");
+            put("人格权纠纷_2", "人格权纠纷");
+            put("物权纠纷_2", "物权纠纷");
+            put("与企业有关的纠纷_3", "股权纠纷");
+            put("证券纠纷_3", "证券纠纷");
+            put("保险纠纷_3", "保险纠纷");
+            put("票据纠纷_3", "票据纠纷");
+            put("刑事案由_1", "刑事辩护");
+            put("行政案由_1", "行政诉讼");
+            put("执行案由_1", "案件执行");
+            put("其他_1", "综合");
+        }
+    };
+    private static Map<String, Map<String, String>> CASE_REASON_GROUP_MAP;
+
+    static {
+        CASE_REASON_GROUP_MAP = CASE_REASON_MAP.entrySet().stream().collect(Collectors.groupingBy(
+                e -> e.getKey().split("_")[1],
+                Collectors.toMap(e -> e.getKey().split("_")[0], e -> e.getValue())
+        ));
+    }
+
+    private static final BigDecimal value_50 = new BigDecimal(50);
+    private static final BigDecimal value_200 = new BigDecimal(200);
+    private static final BigDecimal value_500 = new BigDecimal(500);
+    private static final BigDecimal value_2000 = new BigDecimal(2000);
+
+    public static String getCaseAmtStd(BigDecimal case_amt) {
+        if (case_amt == null) {
+            return "0-50万";
+        } else if (case_amt.compareTo(value_50) < 0) {
+            return "0-50万";
+        } else if (case_amt.compareTo(value_200) < 0) {
+            return "50-200万";
+        } else if (case_amt.compareTo(value_500) < 0) {
+            return "200-500万";
+        } else if (case_amt.compareTo(value_2000) < 0) {
+            return "500-2000万";
+        } else {
+            return "2000万以上";
+        }
+    }
+
+    public static List<String> getCaseReasonStd(String caseReasonLevel_1, String caseReasonLevel_2, String caseReasonLevel_3, String caseReasonLevel_4, String caseReason) {
+        List<String> list = new ArrayList<>();
+
+        Map<String, String> level_5 = CASE_REASON_GROUP_MAP.getOrDefault("5", new HashMap<>());
+        if (level_5.containsKey(caseReason)) {
+            list.add(level_5.get(caseReason));
+        }
+
+        Map<String, String> level_4 = CASE_REASON_GROUP_MAP.getOrDefault("4", new HashMap<>());
+        if (level_4.containsKey(caseReasonLevel_4)) {
+            list.add(level_4.get(caseReasonLevel_4));
+        }
+
+        Map<String, String> level_3 = CASE_REASON_GROUP_MAP.getOrDefault("3", new HashMap<>());
+        if (level_3.containsKey(caseReasonLevel_3)) {
+            list.add(level_3.get(caseReasonLevel_3));
+        }
+
+        Map<String, String> level_2 = CASE_REASON_GROUP_MAP.getOrDefault("2", new HashMap<>());
+        if (level_2.containsKey(caseReasonLevel_2)) {
+            list.add(level_2.get(caseReasonLevel_2));
+        }
+
+        Map<String, String> level_1 = CASE_REASON_GROUP_MAP.getOrDefault("1", new HashMap<>());
+        if (level_1.containsKey(caseReasonLevel_1)) {
+            list.add(level_1.get(caseReasonLevel_1));
+        }
+        if (list.isEmpty()) {
+            list.add("综合");
+        }
+        return list;
+
+    }
+
+
+    public static List<String> getBaseLawyerIdFromLawyerInfo(String lawyerInfo) {
+        try {
+            if (StringUtils.isNotBlank(lawyerInfo)) {
+                List<LawyerInfoEntity> lawyerInfoEntities = JSONArray.parseArray(lawyerInfo, LawyerInfoEntity.class);
+                List<String> collect = lawyerInfoEntities.stream()
+                        .map(LawyerInfoEntity::getBase_lawyer_id)
+                        .filter(StringUtils::isNotBlank)
+                        .collect(Collectors.toList());
+                return collect;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Arrays.asList();
+    }
+
+    public static List<String> getLitigantIdFromLitigantInfo(String litigantInfo) {
+        try {
+            if (StringUtils.isNotBlank(litigantInfo)) {
+                List<LitigantInfoEntity> litigantInfoEntities = JSONArray.parseArray(litigantInfo, LitigantInfoEntity.class);
+                List<String> collect = litigantInfoEntities.stream()
+                        .map(LitigantInfoEntity::getLitigant_id)
+                        .filter(StringUtils::isNotBlank)
+                        .collect(Collectors.toList());
+                return collect;
+            }
+        } catch (Exception e) {
+
+        }
+        return Arrays.asList();
+    }
+
+
+    /**
+     * 获取律师和公司的映射
+     * 目前只有原告和原告的映射,被告和被告的映射
+     * <p/>
+     * 下阶段需要迭代需要获取具体映射
+     * <p/>
+     *
+     * @param data
+     * @return Map&lt;base_lawyer_id, List&lt;company_id&gt;&gt;
+     */
+    @Deprecated
+    private static Map<String, List<String>> getLawyerCompanyMapping(JSONObject data, String lawyer_info_key, String litigant_info_key) {
+        List<String> base_lawyer_id = getBaseLawyerIdFromLawyerInfo(data.getStringOrNull(lawyer_info_key));
+        List<String> litigant_id = getLitigantIdFromLitigantInfo(data.getStringOrNull(litigant_info_key));
+
+        Map<String, List<String>> map = new HashMap<>();
+        for (String s : base_lawyer_id) {
+            map.put(s, litigant_id.stream().filter(e -> e.length() == 32).collect(Collectors.toList()));
+        }
+
+        return map;
+    }
+
+    /**
+     * 获取律师和公司的映射
+     * 目前只有原告和原告的映射,被告和被告的映射
+     * <p/>
+     *
+     * @param data
+     * @return Map&lt;base_lawyer_id, List&lt;company_id&gt;&gt;
+     */
+    public static Map<String, List<String>> getLawyerCompanyMapping(JSONObject data) {
+
+        Map<String, List<String>> result = new HashMap<>();
+
+        List<PartyInfoEntity> partyInfoEntityNew = data.getListOrEmpty("party_info_new", PartyInfoEntity.class);
+
+        for (PartyInfoEntity entity : partyInfoEntityNew) {
+            String titleStd = entity.getTitle_std();
+            String caseRoleStd = getCaseRoleStd(titleStd);
+            List<LitigantInfoEntity> partyInfo = entity.getParty_info();
+            for (LitigantInfoEntity litigantInfoEntity : partyInfo) {
+                String litigantId = litigantInfoEntity.getLitigant_id();
+
+
+                List<LawyerInfoEntity> lawyerInfo = litigantInfoEntity.getLawyer_info();
+                if (lawyerInfo == null || lawyerInfo.isEmpty()) {
+                    //依据yg_lawyer和bg_lawyer填充映射
+                   /*if ("Y".equals(caseRoleStd)) {
+                        List<String> base_lawyer_id_list = getBaseLawyerIdFromLawyerInfo(data.getStringOrNull("yg_lawyer"));
+                        if (base_lawyer_id_list != null && !base_lawyer_id_list.isEmpty()) {
+                            for (String base_lawyer_id : base_lawyer_id_list) {
+                                List<String> orDefault = result.getOrDefault(base_lawyer_id, new ArrayList<>());
+                                if (StringUtils.isNotEmpty(litigantId) && litigantId.length() == 32) {
+                                    orDefault.add(litigantId);
+                                }
+                                result.put(base_lawyer_id, orDefault);
+                            }
+                        }
+                    } else if ("B".equals(caseRoleStd)) {
+                        List<String> base_lawyer_id_list = getBaseLawyerIdFromLawyerInfo(data.getStringOrNull("bg_lawyer"));
+                        if (base_lawyer_id_list != null && !base_lawyer_id_list.isEmpty()) {
+                            for (String base_lawyer_id : base_lawyer_id_list) {
+                                List<String> orDefault = result.getOrDefault(base_lawyer_id, new ArrayList<>());
+                                if (StringUtils.isNotEmpty(litigantId) && litigantId.length() == 32) {
+                                    orDefault.add(litigantId);
+                                }
+                                result.put(base_lawyer_id, orDefault);
+                            }
+                        }
+                    }*/
+                } else {
+                    for (LawyerInfoEntity lawyerInfoEntity : lawyerInfo) {
+                        String baseLawyerId = lawyerInfoEntity.getBase_lawyer_id();
+                        if(StringUtils.isBlank(baseLawyerId)){
+                            continue;
+                        }
+                        List<String> orDefault = result.getOrDefault(baseLawyerId, new ArrayList<>());
+
+                        if (StringUtils.isNotEmpty(litigantId) && litigantId.length() == 32) {
+                            orDefault.add(litigantId);
+                        }
+                        result.put(baseLawyerId, orDefault);
+                    }
+                }
+
+            }
+        }
+        return result;
+
+//        Map<String, List<String>> plaintiffLawyerCompanyMapping = getLawyerCompanyMapping(data, "yg_lawyer", "plaintiff_info");
+//        Map<String, List<String>> defendantLawyerCompanyMapping = getLawyerCompanyMapping(data, "bg_lawyer", "defendant_info");
+//
+//
+//        plaintiffLawyerCompanyMapping.putAll(defendantLawyerCompanyMapping);
+//        return plaintiffLawyerCompanyMapping;
+    }
+
+    public static List<JudgmentDocumentSummaryEntity> getHologresData(JSONObject jsonObject) {
+        String rowkey = jsonObject.getString("rowkey");
+        String court_name = jsonObject.getString("court_name");
+        BigDecimal case_amt = jsonObject.getBigDecimal("case_amt");
+        List<String> caseReasonStd = getCaseReasonStd(jsonObject.getString("case_reason_level1"), jsonObject.getString("case_reason_level2"), jsonObject.getString("case_reason_level3"), jsonObject.getString("case_reason_level4"), jsonObject.getString("case_reason"));
+
+        Map<String, List<String>> lawyerCompanyMapping = getLawyerCompanyMapping(jsonObject);
+
+        List<JudgmentDocumentSummaryEntity> list = new ArrayList<>();
+
+        for (Map.Entry<String, List<String>> entry : lawyerCompanyMapping.entrySet()) {
+            String baseLawyer_id = entry.getKey();
+            List<String> company_id = entry.getValue();
+
+            JudgmentDocumentSummaryEntity entity = JudgmentDocumentSummaryEntity.of(baseLawyer_id, rowkey, caseReasonStd, court_name, getCaseAmtStd(case_amt), company_id);
+            list.add(entity);
+        }
+        return list;
+    }
+
+    /**
+     * @param old_data
+     * @param new_data
+     * @return delete_data, insert_data, update_data
+     */
+    public static Tuple3<List<JudgmentDocumentSummaryEntity>, List<JudgmentDocumentSummaryEntity>, List<JudgmentDocumentSummaryEntity>> getJudgmentDocSummaryClassify(List<JudgmentDocumentSummaryEntity> old_data, List<JudgmentDocumentSummaryEntity> new_data) {
+        Tuple3<List<JudgmentDocumentSummaryEntity>, List<JudgmentDocumentSummaryEntity>, List<Tuple2<JudgmentDocumentSummaryEntity, JudgmentDocumentSummaryEntity>>> classify =
+                getClassify(old_data, new_data, JudgmentDocumentSummaryEntity::getPrimaryKey);
+        List<JudgmentDocumentSummaryEntity> collect = classify.f2.stream().map(e -> e.f1).collect(Collectors.toList());
+
+        return Tuple3.of(classify.f0, classify.f1, collect);
+//        Set<String> old_primary_key_set = old_data.stream().map(JudgmentDocumentSummaryEntity::getPrimaryKey).collect(Collectors.toSet());
+//        Set<String> new_primary_key_set = new_data.stream().map(JudgmentDocumentSummaryEntity::getPrimaryKey).collect(Collectors.toSet());
+//
+//        List<JudgmentDocumentSummaryEntity> delete_data = old_data.stream().filter(e -> !new_primary_key_set.contains(e.getPrimaryKey())).collect(Collectors.toList());
+//        List<JudgmentDocumentSummaryEntity> insert_data = new_data.stream().filter(e -> !old_primary_key_set.contains(e.getPrimaryKey())).collect(Collectors.toList());
+//
+//        Set<String> intersectionSet = new HashSet<>(old_primary_key_set);
+//        intersectionSet.retainAll(new_primary_key_set);
+//
+//        if (intersectionSet.isEmpty()) {
+//            return Tuple3.of(delete_data, insert_data, Arrays.asList());
+//        }
+//
+//        Map<String, JudgmentDocumentSummaryEntity> old_data_map = old_data.stream().filter(e -> intersectionSet.contains(e.getPrimaryKey())).collect(Collectors.toMap(e -> e.getPrimaryKey(), e -> e));
+//        Map<String, JudgmentDocumentSummaryEntity> new_data_map = new_data.stream().filter(e -> intersectionSet.contains(e.getPrimaryKey())).collect(Collectors.toMap(e -> e.getPrimaryKey(), e -> e));
+//
+//        List<JudgmentDocumentSummaryEntity> update_data = new ArrayList<>();
+//        for (String key : intersectionSet) {
+//            JudgmentDocumentSummaryEntity old_entity = old_data_map.get(key);
+//            JudgmentDocumentSummaryEntity new_entity = new_data_map.get(key);
+//            if (old_entity.equals(new_entity)) {
+//                continue;
+//            }
+//
+//            update_data.add(new_entity);
+//        }
+//        return Tuple3.of(delete_data, insert_data, update_data);
+    }
+
+
+    /**
+     * @param old_data
+     * @param new_data
+     * @param primaryKeyFunction
+     * @return delete_data, insert_data, update_data《old_data,new_data》
+     */
+    public static <T> Tuple3<List<T>, List<T>, List<Tuple2<T, T>>> getClassify(List<T> old_data, List<T> new_data, Function<? super T, String> primaryKeyFunction) {
+        Set<String> old_primary_key_set = old_data.stream().map(primaryKeyFunction::apply).collect(Collectors.toSet());
+        Set<String> new_primary_key_set = new_data.stream().map(primaryKeyFunction::apply).collect(Collectors.toSet());
+
+        List<T> delete_data = old_data.stream().filter(e -> !new_primary_key_set.contains(primaryKeyFunction.apply(e))).collect(Collectors.toList());
+        List<T> insert_data = new_data.stream().filter(e -> !old_primary_key_set.contains(primaryKeyFunction.apply(e))).collect(Collectors.toList());
+
+        Set<String> intersectionSet = new HashSet<>(old_primary_key_set);
+        intersectionSet.retainAll(new_primary_key_set);
+
+        if (intersectionSet.isEmpty()) {
+            return Tuple3.of(delete_data, insert_data, Arrays.asList());
+        }
+
+        Map<String, T> old_data_map = old_data.stream().filter(e -> intersectionSet.contains(primaryKeyFunction.apply(e))).collect(Collectors.toMap(primaryKeyFunction::apply, e -> e));
+        Map<String, T> new_data_map = new_data.stream().filter(e -> intersectionSet.contains(primaryKeyFunction.apply(e))).collect(Collectors.toMap(primaryKeyFunction::apply, e -> e));
+
+        List<Tuple2<T, T>> update_data = new ArrayList<>();
+        for (String key : intersectionSet) {
+            T old_entity = old_data_map.get(key);
+            T new_entity = new_data_map.get(key);
+            if (old_entity.equals(new_entity)) {
+                continue;
+            }
+
+            update_data.add(Tuple2.of(old_entity, new_entity));
+        }
+        return Tuple3.of(delete_data, insert_data, update_data);
+    }
+
+
+    private static BaseCaseInfo getCaseInfo(JSONObject jsonObject) {
+        BaseCaseInfo baseCaseInfo = new BaseCaseInfo();
+        baseCaseInfo.setCase_id(jsonObject.getString("rowkey"));
+        baseCaseInfo.setCase_type(jsonObject.getString("case_type"));
+        baseCaseInfo.setCase_reason_level1(jsonObject.getString("case_reason_level1"));
+        baseCaseInfo.setCase_reason_level2(jsonObject.getString("case_reason_level2"));
+        baseCaseInfo.setCase_reason_level3(jsonObject.getString("case_reason_level3"));
+        baseCaseInfo.setCase_reason_level4(jsonObject.getString("case_reason_level4"));
+        baseCaseInfo.setCase_reason(jsonObject.getString("case_reason"));
+        baseCaseInfo.setCase_reason_levelnum(jsonObject.getString("case_reason_levelnum"));
+        baseCaseInfo.setCase_stage(jsonObject.getString("case_stage"));
+        baseCaseInfo.setCase_amt(jsonObject.getBigDecimal("case_amt"));
+        baseCaseInfo.setJudge_amt(jsonObject.getBigDecimal("judge_amt"));
+        baseCaseInfo.setAccept_amt(jsonObject.getBigDecimal("accept_amt"));
+        baseCaseInfo.setCity_court_name(jsonObject.getString("city_court_name"));
+        baseCaseInfo.setCourt_name(jsonObject.getString("court_name"));
+        baseCaseInfo.setProvince_court_name(jsonObject.getString("province_court_name"));
+        baseCaseInfo.setCity_court_name(jsonObject.getString("city_court_name"));
+        baseCaseInfo.setCourt_city_code(jsonObject.getString("court_city_code"));
+        baseCaseInfo.setCourt_province_code(jsonObject.getString("court_province_code"));
+        baseCaseInfo.setCourt_level(jsonObject.getString("court_level"));
+        baseCaseInfo.setJudge_name(jsonObject.getListOrNull("judge_name",String.class));
+        baseCaseInfo.setJudge_date(BaseUtils.dateTime2DateStr(jsonObject.getString("judge_date")));
+        baseCaseInfo.setUpdate_time(jsonObject.getString("update_time"));
+        baseCaseInfo.setCreate_time(jsonObject.getString("create_time"));
+        baseCaseInfo.setDeleted(jsonObject.getInteger("deleted"));
+
+        return baseCaseInfo;
+
+    }
+
+    private static final Set<String> plaintiff_title_set = new HashSet<String>() {
+        {
+            add("原告");
+            add("上诉人");
+            add("申请人");
+            add("再审申请人");
+            add("申请执行人");
+            add("异议人");
+            add("保全申请人");
+            add("复议申请人");
+            add("抗诉机关");
+            add("自诉人");
+            add("申诉人");
+            add("申请复议人");
+            add("救助申请人");
+            add("赔偿请求人");
+            add("申请机关");
+            add("上诉单位");
+            add("公诉人");
+        }
+    };
+    private static final Set<String> defendant_title_set = new HashSet<String>() {
+        {
+            add("被告");
+            add("被上诉人");
+            add("被申请人");
+            add("被执行人");
+            add("被告人");
+            add("罪犯");
+            add("被拘留人");
+            add("被申诉人");
+            add("被告单位");
+            add("被罚款人");
+            add("赔偿义务机关");
+            add("复议被申请人");
+            add("被强制医疗人");
+
+        }
+    };
+
+    private static String getCaseRoleStd(String caseRole) {
+        if (plaintiff_title_set.contains(caseRole)) {
+            return "Y";
+        }
+        if (defendant_title_set.contains(caseRole)) {
+            return "B";
+        }
+        return "T";
+    }
+
+    public static String getIs_success(String judgment_doc_is_success, String title_std) {
+        if (plaintiff_title_set.contains(title_std)) {
+            return judgment_doc_is_success;
+        }
+        if (defendant_title_set.contains(title_std)) {
+            if ("胜".equals(judgment_doc_is_success)) {
+                return "负";
+            }
+            if ("负".equals(judgment_doc_is_success)) {
+                return "胜";
+            }
+            if ("平".equals(judgment_doc_is_success)) {
+                return "平";
+            }
+        }
+        return "其他";
+    }
+
+    public static List<EsLawyerBaseCaseEntity> getEsLawyerCaseData(JSONObject jsonObject) {
+        List<EsLawyerBaseCaseEntity> resultList = new ArrayList<>();
+        BaseCaseInfo baseCaseInfo = getCaseInfo(jsonObject);
+        EsLawyerBaseCaseEntity esLawyerCaseEntity = baseCaseInfo.toEsLawyerCaseEntity();
+        String judgment_doc_is_success = jsonObject.getString("is_success");
+
+        List<LawyerInfoEntity> tmpYgLawyerInfoList = jsonObject.getListOrNull("yg_lawyer", LawyerInfoEntity.class);
+        List<LawyerInfoEntity> tmpBgLawyerInfoList = jsonObject.getListOrNull("bg_lawyer", LawyerInfoEntity.class);
+
+        List<PartyInfoEntity> partyInfoEntityNew = jsonObject.getListOrEmpty("party_info_new", PartyInfoEntity.class);
+
+        for (PartyInfoEntity item : partyInfoEntityNew) {
+            String titleStd = item.getTitle_std();
+            List<LitigantInfoEntity> partyInfo = item.getParty_info();
+            for (LitigantInfoEntity litigantInfo : partyInfo) {
+                String judgeTendency = litigantInfo.getJudge_tendency();
+                List<LawyerInfoEntity> lawyerInfo = litigantInfo.getLawyer_info();
+
+                if (lawyerInfo == null) {
+                    //兼容party_info_new中暂未设置lawyer_info的问题
+                    /*String caseRoleStd = getCaseRoleStd(titleStd);
+                    if ("Y".equals(caseRoleStd)) {
+                        deploy_lawyer_info_mapping(tmpYgLawyerInfoList, esLawyerCaseEntity, judgment_doc_is_success, titleStd, resultList);
+
+                    } else if ("B".equals(caseRoleStd)) {
+                        deploy_lawyer_info_mapping(tmpBgLawyerInfoList, esLawyerCaseEntity, judgment_doc_is_success, titleStd, resultList);
+                    } else {
+                    }*/
+                } else {
+                    deploy_lawyer_info_mapping(lawyerInfo, esLawyerCaseEntity, judgment_doc_is_success, titleStd, resultList);
+                }
+            }
+        }
+
+        return resultList;
+    }
+
+    /**
+     * 将某个当事人与委托的律师生成映射
+     *
+     * @param lawyerInfo
+     * @param esLawyerCaseEntity
+     * @param judgment_doc_is_success
+     * @param titleStd
+     * @param resultList
+     */
+    private static void deploy_lawyer_info_mapping(List<LawyerInfoEntity> lawyerInfo, EsLawyerBaseCaseEntity esLawyerCaseEntity, String judgment_doc_is_success, String titleStd, List<EsLawyerBaseCaseEntity> resultList) {
+        if (lawyerInfo == null) {
+            return;
+        }
+        for (LawyerInfoEntity lawyer : lawyerInfo) {
+            EsLawyerBaseCaseEntity entity = ObjectUtil.cloneByStream(esLawyerCaseEntity);
+            if (StringUtils.isNotBlank(lawyer.getBase_lawyer_id())) {
+                entity.setBase_lawyer_id(lawyer.getBase_lawyer_id());
+                entity.setLawfirm(lawyer.getLawfirm_name());
+                entity.setLawyer_name(lawyer.getLawyer_name());
+                entity.setLawfirm_id(lawyer.getLawfirm_id());
+
+                entity.setIs_success(getIs_success(judgment_doc_is_success, titleStd));
+                entity.setIs_credit(getCaseRoleStd(titleStd));
+
+                resultList.add(entity);
+            }
+        }
+    }
+
+
+    public static List<EsCompanyBaseCaseEntity> getEsCompanyCaseData(JSONObject jsonObject) {
+        List<EsCompanyBaseCaseEntity> resultList = new ArrayList<>();
+        BaseCaseInfo baseCaseInfo = getCaseInfo(jsonObject);
+        EsCompanyBaseCaseEntity esCompanyCaseEntity = baseCaseInfo.toEsCompanyCaseEntity();
+        String judgment_doc_is_success = jsonObject.getString("is_success");
+
+
+        List<PartyInfoEntity> partyInfoEntityNew = jsonObject.getListOrEmpty("party_info_new", PartyInfoEntity.class);
+        for (PartyInfoEntity item : partyInfoEntityNew) {
+            String titleStd = item.getTitle_std();
+            for (LitigantInfoEntity litigantInfo : item.getParty_info()) {
+                String litigantId = litigantInfo.getLitigant_id();
+                String name = litigantInfo.getName();
+                String judgeTendency = litigantInfo.getJudge_tendency();
+                List<LawyerInfoEntity> lawyerInfo = litigantInfo.getLawyer_info();
+                if (lawyerInfo == null) {
+                    //兼容party_info_new中暂未设置lawyer_info的问题
+                    String caseRoleStd = getCaseRoleStd(titleStd);
+                    if ("Y".equals(caseRoleStd)) {
+                        lawyerInfo = jsonObject.getListOrNull("yg_lawyer", LawyerInfoEntity.class);
+                    } else if ("B".equals(caseRoleStd)) {
+                        lawyerInfo = jsonObject.getListOrNull("bg_lawyer", LawyerInfoEntity.class);
+                    }
+                }
+                if (StringUtils.isNotBlank(litigantId) && litigantId.length() == 32) {
+                    EsCompanyBaseCaseEntity entity = ObjectUtil.cloneByStream(esCompanyCaseEntity);
+                    entity.setCompany_id(litigantId);
+                    entity.setCompany_name(name);
+                    entity.setCase_role(getCaseRoleStd(titleStd));
+                    entity.setIs_success(getIs_success(judgment_doc_is_success, titleStd));
+                    entity.setLawyer_info(lawyerInfo);
+                    resultList.add(entity);
+                }
+            }
+        }
+        return resultList;
+    }
+
+}

+ 16 - 0
src/main/java/com/winhc/bigdata/utils/BaseUtils.java

@@ -4,6 +4,7 @@ import cn.hutool.core.io.file.FileReader;
 import cn.hutool.core.io.resource.ResourceUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
+import org.apache.commons.lang3.StringUtils;
 
 /**
  * @Author: XuJiakai
@@ -23,6 +24,21 @@ public class BaseUtils {
 
     }
 
+    public static String toString(Object o, SerializerFeature... features) {
+        SerializerFeature[] args = new SerializerFeature[features.length + 1];
+        args[0] = SerializerFeature.WriteMapNullValue;
+        System.arraycopy(features, 0, args, 1, features.length);
+        return JSONObject.toJSONString(o, args);
+    }
+    public static String dateTime2DateStr(String datetime){
+        if (StringUtils.isEmpty(datetime)) {
+            return null;
+        }
+        if(datetime.length()==19){
+            return datetime.substring(0, 10);
+        }
+        return datetime;
+    }
     public static void main(String[] args) {
         System.out.println(readeResourceFile("case_info.json"));
     }

+ 39 - 0
src/main/java/com/winhc/bigdata/utils/JsonObjectUtils.java

@@ -0,0 +1,39 @@
+package com.winhc.bigdata.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @Author: XuJiakai
+ * 2024/5/22 9:38
+ */
+public class JsonObjectUtils {
+    public static String getStringOrNull(JSONObject jsonObject, String key) {
+        if (jsonObject.containsKey(key)) {
+            return jsonObject.getString(key);
+        }
+        return null;
+    }
+
+    public static <T> List<T> getListOrNull(JSONObject jsonObject, String key, Class<T> type) {
+        if (jsonObject.containsKey(key) && jsonObject.getJSONArray(key) != null) {
+            List<T> javaList = jsonObject.getJSONArray(key).toJavaList(type);
+            if (javaList == null || javaList.isEmpty()) {
+                return null;
+            }
+            return javaList;
+        }
+        return null;
+    }
+
+    public static <T> List<T> getListOrEmpty(JSONObject jsonObject, String key, Class<T> type) {
+        if (jsonObject.containsKey(key) && jsonObject.getJSONArray(key) != null) {
+            return jsonObject.getJSONArray(key).toJavaList(type);
+        }
+        return Collections.emptyList();
+    }
+}