Prechádzať zdrojové kódy

处理 json 转义字符

liuam 7 rokov pred
rodič
commit
a2ba7f60fc

+ 7 - 0
pom.xml

@@ -28,6 +28,13 @@
             <version>3.7</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-text</artifactId>
+            <version>1.3</version>
+        </dependency>
+
+
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>

+ 7 - 7
src/main/java/com/uas/credit/controller/ErpQueryController.java

@@ -3,7 +3,7 @@ package com.uas.credit.controller;
 import com.uas.credit.model.*;
 import com.uas.credit.service.*;
 import com.uas.credit.util.FlexJsonUtils;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -59,13 +59,13 @@ public class ErpQueryController {
         }
         if (erpQuery != null) {
             // 查询企业债务信息
-            String endeptinfoRoot = StringEscapeUtils.unescapeJava(enterpriseDeptService.queryEnterpriseDept(erpQuery));
+            String endeptinfoRoot = StringEscapeUtils.unescapeJson(enterpriseDeptService.queryEnterpriseDept(erpQuery));
             // 查询企业经营异常信息
-            String abnormalRoot = StringEscapeUtils.unescapeJava(enexceptionService.queryEnexception(erpQuery));
+            String abnormalRoot = StringEscapeUtils.unescapeJson(enexceptionService.queryEnexception(erpQuery));
             // 查询企业信用信息
-            String encreditinfoRoot = StringEscapeUtils.unescapeJava(creditInfoService.queryEnCreditInfo(erpQuery));
+            String encreditinfoRoot = StringEscapeUtils.unescapeJson(creditInfoService.queryEnCreditInfo(erpQuery));
             // 查询企业风险信息
-            String enRiskInfoRoot = StringEscapeUtils.unescapeJava(enRiskInfoService.queryEnRiskInfo(erpQuery));
+            String enRiskInfoRoot = StringEscapeUtils.unescapeJson(enRiskInfoService.queryEnRiskInfo(erpQuery));
             enterpriseJson = new EnterpriseJson(endeptinfoRoot, abnormalRoot, encreditinfoRoot, enRiskInfoRoot);
 
             enterpriseJsonService.save(enterpriseJson);
@@ -86,9 +86,9 @@ public class ErpQueryController {
         }
         if (erpQuery != null) {
             // 查询个人身份信息
-            String policeCheckRoot = StringEscapeUtils.unescapeJava(personalService.queryPoliceCheck(erpQuery));
+            String policeCheckRoot = StringEscapeUtils.unescapeJson(personalService.queryPoliceCheck(erpQuery));
             // 查询个人股东信息
-            String personCorporationRoot = StringEscapeUtils.unescapeJava(personCorporationService.queryPersonCorporation(erpQuery));
+            String personCorporationRoot = StringEscapeUtils.unescapeJson(personCorporationService.queryPersonCorporation(erpQuery));
 
 
             personJson = new PersonJson(policeCheckRoot, personCorporationRoot);