From 8e6f6217e52a635d1dfd4ccbb549b0427d3f9fa6 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 27 Apr 2022 15:55:17 +0800
Subject: [PATCH] 新增保安员新增审查
---
src/main/java/org/springblade/modules/FTP/OutJson.java | 48 +++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/springblade/modules/FTP/OutJson.java b/src/main/java/org/springblade/modules/FTP/OutJson.java
index 5b99711..d0a1af1 100644
--- a/src/main/java/org/springblade/modules/FTP/OutJson.java
+++ b/src/main/java/org/springblade/modules/FTP/OutJson.java
@@ -1,5 +1,8 @@
package org.springblade.modules.FTP;
+
+import org.springblade.common.config.FtpConfig;
+
import java.io.*;
public class OutJson {
@@ -136,7 +139,7 @@
return result.toString();
}
/**
- * 删除文件
+ * 去除空格 \ 等
* @param str
* @return
*/
@@ -151,8 +154,47 @@
* 读取json文件并解析
* @return
*/
- public static String TestJson(){
- File file = new File("D:\\anbao\\sql.json");
+ public static String TestJson(String fileName){
+ //File file = new File(FtpConstant.jsonUrl+fileName);
+ File file = new File(FtpConfig.jsonUrl+fileName);
+ StringBuilder localStrBulider = new StringBuilder();
+ if(file.isFile() && file.exists()) {
+ try {
+ InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "utf-8");
+ BufferedReader bufferReader = new BufferedReader(inputStreamReader);
+ String lineStr = null;
+ try {
+ while((lineStr = bufferReader.readLine()) != null) {
+ localStrBulider.append(lineStr);
+ }
+ bufferReader.close();
+ inputStreamReader.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ System.out.println("file read error!");
+ e.printStackTrace();
+ }
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ System.out.println("file catch unsupported encoding!");
+ e.printStackTrace();
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ System.out.println("file not found!");
+ e.printStackTrace();
+ }
+ }else {
+ System.out.println("file is not a file or file is not existing!");
+ }
+ return localStrBulider.toString();
+ }
+
+ /**
+ * 读取json文件并解析
+ * @return
+ */
+ public static String TestJsons(String urls){
+ File file = new File(urls);
StringBuilder localStrBulider = new StringBuilder();
if(file.isFile() && file.exists()) {
try {
--
Gitblit v1.9.3