|
@@ -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<base_lawyer_id, List<company_id>>
|
|
|
|
+ */
|
|
|
|
+ @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<base_lawyer_id, List<company_id>>
|
|
|
|
+ */
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|