Browse Source

FastjsonUtils改为直接用JSONObject

sunyj 9 years ago
parent
commit
7c040e97c5

+ 1 - 3
search-console/src/main/java/com/uas/search/console/jms/QueueMessageParser.java

@@ -6,7 +6,6 @@ import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONException;
 import com.alibaba.fastjson.JSONObject;
-import com.uas.search.console.core.util.FastjsonUtils;
 import com.uas.search.console.dao.BrandSimpleInfoDao;
 import com.uas.search.console.dao.ComponentSimpleInfoDao;
 import com.uas.search.console.dao.KindSimpleInfoDao;
@@ -16,7 +15,6 @@ import com.uas.search.console.model.KindSimpleInfo;
 import com.uas.search.console.model.ParsedQueueMessage;
 import com.uas.search.console.util.SearchConstants;
 
-
 /**
  * 对得到的队列消息进行解析的工具
  * 
@@ -48,7 +46,7 @@ public class QueueMessageParser {
 			return null;
 		}
 		ParsedQueueMessage parsedQueueMessage = new ParsedQueueMessage();
-		JSONObject jsonObject = FastjsonUtils.parseObject(message);
+		JSONObject jsonObject = JSONObject.parseObject(message);
 
 		// 解析数据库表的更改类型
 		String method = jsonObject.getString("method");

+ 5 - 5
search-console/src/main/java/com/uas/search/console/util/MergeComponentData.java

@@ -11,7 +11,6 @@ import java.util.Set;
 import org.springframework.util.StringUtils;
 
 import com.alibaba.fastjson.JSONObject;
-import com.uas.search.console.core.util.FastjsonUtils;
 import com.uas.search.console.model.ComponentSimpleInfo;
 import com.uas.search.console.model.PropertyValue;
 
@@ -73,7 +72,7 @@ public class MergeComponentData {
 		try {
 			componentReader = new BufferedReader(new FileReader(DATA_DIR + "\\Component.txt"));
 			propertyValueReader = new BufferedReader(new FileReader(DATA_DIR + "\\PropertyValue.txt"));
-			printWriter = new PrintWriter(DATA_DIR + "\\merged\\ComponentWithProperty_" + fileIndex + ".txt");
+			printWriter = new PrintWriter(DATA_DIR + "\\components\\ComponentWithProperty_" + fileIndex + ".txt");
 			// 第一行内容为列名,不做解析
 			componentReader.readLine();
 			propertyValueReader.readLine();
@@ -91,7 +90,8 @@ public class MergeComponentData {
 					printWriter.flush();
 					printWriter.close();
 					fileIndex++;
-					printWriter = new PrintWriter(DATA_DIR + "\\merged\\ComponentWithProperty_" + fileIndex + ".txt");
+					printWriter = new PrintWriter(
+							DATA_DIR + "\\components\\ComponentWithProperty_" + fileIndex + ".txt");
 				}
 
 				ComponentSimpleInfo component = parseComponent(componentLine);
@@ -110,7 +110,7 @@ public class MergeComponentData {
 				}
 				component.setProperties(properties);
 				System.out.println(component);
-				printWriter.println(FastjsonUtils.toJson(component));
+				printWriter.println(JSONObject.toJSONString(component));
 			}
 			printWriter.flush();
 		} catch (FileNotFoundException e) {
@@ -135,7 +135,7 @@ public class MergeComponentData {
 	private static void readData() {
 		BufferedReader br = null;
 		try {
-			br = new BufferedReader(new FileReader(DATA_DIR + "\\merged\\ComponentWithProperty_1.txt"));
+			br = new BufferedReader(new FileReader(DATA_DIR + "\\components\\ComponentWithProperty_1.txt"));
 			String line = br.readLine();
 			System.out.println(JSONObject.parseObject(line, ComponentSimpleInfo.class));
 		} catch (FileNotFoundException e) {