浏览代码

fix: qcc info npe

shc 9 月之前
父节点
当前提交
7cf5e1f0a4

+ 99 - 6
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmQccInfoServiceImpl.java

@@ -1,5 +1,6 @@
 package com.qunzhixinxi.hnqz.admin.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONNull;
@@ -20,6 +21,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 /**
@@ -90,7 +92,7 @@ public class WmQccInfoServiceImpl extends ServiceImpl<WmQccInfoMapper, WmQccInfo
             Object revokeInfo2 = resp.get("RevokeInfo");
 
             Map<String, Object> revokeInfo;
-            if (revokeInfo2 instanceof JSONNull){
+            if (revokeInfo2 instanceof JSONNull) {
                 revokeInfo = Collections.emptyMap();
             } else {
                 JSONObject revokeInfo1 = (JSONObject) revokeInfo2;
@@ -379,7 +381,28 @@ public class WmQccInfoServiceImpl extends ServiceImpl<WmQccInfoMapper, WmQccInfo
             if (QccUtils.ok(adminPenaltyList)) {
                 JSONObject result1 = QccUtils.getResult(adminPenaltyList);
                 Object data = result1.get("Data");
-                qccInfo.setAdminPenalty((List<Map<String, Object>>) data);
+                List<Map<String, Object>> collect;
+                if (data instanceof JSONNull) {
+                    collect = Collections.emptyList();
+                } else {
+                    JSONArray data1 = (JSONArray) data;
+                    collect = data1.stream().map(sx -> {
+                        JSONObject sxInfo = (JSONObject) sx;
+                        Map<String, Object> sxInfoMap = new HashMap<>(9);
+                        sxInfoMap.put("Id", sxInfo.getStr("Id"));
+                        sxInfoMap.put("DocNo", sxInfo.getStr("DocNo"));
+                        sxInfoMap.put("PunishReason", sxInfo.getStr("PunishReason"));
+                        sxInfoMap.put("PunishResult", sxInfo.getStr("PunishResult"));
+                        sxInfoMap.put("PunishOffice", sxInfo.getStr("PunishOffice"));
+                        sxInfoMap.put("PunishDate", sxInfo.getStr("PunishDate"));
+                        sxInfoMap.put("Source", sxInfo.getStr("Source"));
+                        sxInfoMap.put("SourceCode", sxInfo.getStr("SourceCode"));
+                        sxInfoMap.put("PunishAmt", sxInfo.getStr("PunishAmt"));
+                        return sxInfoMap;
+                    }).collect(Collectors.toList());
+                }
+
+                qccInfo.setAdminPenalty(collect);
             }
 
             // 限制高消费
@@ -418,8 +441,29 @@ public class WmQccInfoServiceImpl extends ServiceImpl<WmQccInfoMapper, WmQccInfo
             JSONObject adminLicenseList = QccUtils.getAdminLicenseList(regCode);
             if (QccUtils.ok(adminLicenseList)) {
                 JSONObject result1 = QccUtils.getResult(adminLicenseList);
-                Object data = result1.get("Data");
-                qccInfo.setAdminLicenseList((List<Map<String, Object>>) data);
+                Object data1 = result1.get("Data");
+                List<Map<String, Object>> collect;
+                if (data1 instanceof JSONNull) {
+                    collect = Collections.emptyList();
+                } else {
+                    JSONArray data = (JSONArray) data1;
+                    collect = data.stream().map(item -> {
+                        JSONObject itemInfo = (JSONObject) item;
+                        Map<String, Object> itemInfoMap = new HashMap<>(10);
+                        itemInfoMap.put("LicenseNo", itemInfo.getStr("LicenseNo"));
+                        itemInfoMap.put("LicenseName", itemInfo.getStr("LicenseName"));
+                        itemInfoMap.put("ValidityFrom", itemInfo.getStr("ValidityFrom"));
+                        itemInfoMap.put("ValidityTo", itemInfo.getStr("ValidityTo"));
+                        itemInfoMap.put("LicensOffice", itemInfo.getStr("LicensOffice"));
+                        itemInfoMap.put("LicensContent", itemInfo.getStr("LicensContent"));
+                        itemInfoMap.put("Id", itemInfo.getStr("Id"));
+                        itemInfoMap.put("Source", itemInfo.getStr("Source"));
+                        itemInfoMap.put("DocumentNo", itemInfo.getStr("DocumentNo"));
+                        itemInfoMap.put("PermissionNo", itemInfo.getStr("PermissionNo"));
+                        return itemInfoMap;
+                    }).collect(Collectors.toList());
+                }
+                qccInfo.setAdminLicenseList(collect);
             }
 
 
@@ -428,8 +472,57 @@ public class WmQccInfoServiceImpl extends ServiceImpl<WmQccInfoMapper, WmQccInfo
             JSONObject creditRatingReportGrade = QccUtils.getCreditRatingReportGrade(regCode);
             if (QccUtils.ok(creditRatingReportGrade)) {
                 JSONObject result1 = QccUtils.getResult(creditRatingReportGrade);
-                Object data = result1.get("Data");
-                qccInfo.setCreditRatingReportGrade((Map<String, Object>) data);
+                Object data1 = result1.get("Data");
+                Map<String, Object> collect;
+                if (data1 instanceof JSONNull) {
+                    collect = Collections.emptyMap();
+                } else {
+                    JSONObject data = (JSONObject) data1;
+                    collect = new HashMap<>(4);
+                    collect.put("Level", data.getStr("data"));
+                    collect.put("Score", data.getStr("Score"));
+
+                    JSONObject rm = data.getJSONObject("RatingModule");
+                    Map<String, Object> RatingModule = new HashMap<>(18);
+                    RatingModule.put("RatingScore", rm.get("RatingScore"));
+                    RatingModule.put("ShiXinScore", rm.get("ShiXinScore"));
+                    RatingModule.put("ZhiXingScore", rm.get("ZhiXingScore"));
+                    RatingModule.put("BlacklistScore", rm.get("BlacklistScore"));
+                    RatingModule.put("SevereAdminPenaltyScore", rm.get("SevereAdminPenaltyScore"));
+                    RatingModule.put("SafetyHazardScore", rm.get("SafetyHazardScore"));
+                    RatingModule.put("BreakOrderScore", rm.get("BreakOrderScore"));
+                    RatingModule.put("GeneralAdminPenaltyScore", rm.get("GeneralAdminPenaltyScore"));
+                    RatingModule.put("AdminEnforceScore", rm.get("AdminEnforceScore"));
+                    RatingModule.put("OtherShiXinScore", rm.get("OtherShiXinScore"));
+                    RatingModule.put("AbnormalOperationScore", rm.get("AbnormalOperationScore"));
+                    RatingModule.put("EndLevelEvaluationScore", rm.get("EndLevelEvaluationScore"));
+                    RatingModule.put("ContractSXScore", rm.get("ContractSXScore"));
+                    RatingModule.put("BusinessSXScore", rm.get("BusinessSXScore"));
+                    RatingModule.put("NegativeOpinionScore", rm.get("NegativeOpinionScore"));
+                    RatingModule.put("SeniorStaffSXScore", rm.get("SeniorStaffSXScore"));
+                    RatingModule.put("OperCriminalJudgmentScore", rm.get("OperCriminalJudgmentScore"));
+                    RatingModule.put("BranchCreditScore", rm.get("BranchCreditScore"));
+                    collect.put("RatingModule", RatingModule);
+
+
+                    JSONObject am = data.getJSONObject("AdjustModule");
+                    Map<String, Object> AdjustModule = new HashMap<>(13);
+                    AdjustModule.put("AdjustScore", am.get("AdjustScore") );
+                    AdjustModule.put("RegistcapiScore", am.get("RegistcapiScore"));
+                    AdjustModule.put("OperationTimeScore", am.get("OperationTimeScore"));
+                    AdjustModule.put("EciChangeScore", am.get("EciChangeScore"));
+                    AdjustModule.put("BusinessDevelop", am.get("BusinessDevelop"));
+                    AdjustModule.put("MarketActivity", am.get("MarketActivity"));
+                    AdjustModule.put("IntellectualProperty", am.get("IntellectualProperty"));
+                    AdjustModule.put("QLicensingScore", am.get("QLicensingScore"));
+                    AdjustModule.put("HonourScore", am.get("HonourScore"));
+                    AdjustModule.put("RedListScore", am.get("RedListScore"));
+                    AdjustModule.put("CommunityActivity", am.get("AdjustScore"));
+                    AdjustModule.put("PovertyRelief", am.get("AdjustScore"));
+                    AdjustModule.put("TirdEvaluation", am.get("AdjustScore"));
+                    collect.put("AdjustModule", AdjustModule);
+                }
+                qccInfo.setCreditRatingReportGrade(collect);
             }