类目树相关修改

20230922-ljl-fixBug
cxxxxxxx详 1 year ago
parent 6d640e132d
commit 6a12388ce3

@ -46,20 +46,21 @@ public class SearchDSProductCatTreeService extends SPIBaseService implements Ext
// ----业务处理---- // ----业务处理----
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
String res = null; String res = null;
String strList = null; String strList = "";
JSONObject str = null;
JSONObject data = null; JSONObject data = null;
List<Object> arrayData = null;
try { try {
String resourceFileName = "/getSimpleProductCatTree.txt"; // 注意路径的开头是一个斜杠 String resourceFileName = "/getSimpleProductCatTree.txt"; // 注意路径的开头是一个斜杠
try (InputStream is = InputStream.class.getResourceAsStream(resourceFileName); try (InputStream is = InputStream.class.getResourceAsStream(resourceFileName);
BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
strList = strList + line; strList = strList + line;
} }
JSONObject str = JSONObject.parseObject(strList); str = JSONObject.parseObject(strList);
data = str.getJSONObject("data"); data = str.getJSONObject("data");
log.info("str" + data); arrayData = new ArrayList<>(data.values());
} catch (IOException e) { } catch (IOException e) {
log.error("strerror:" + e.getMessage()); log.error("strerror:" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
@ -68,10 +69,10 @@ public class SearchDSProductCatTreeService extends SPIBaseService implements Ext
e.printStackTrace(); e.printStackTrace();
log.error(e.getMessage()); log.error(e.getMessage());
} }
// Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
// result.put("data", data); result.put("data", arrayData);
// ----结果返回---- // ----结果返回----
return R.ok(Ret.success()); return R.ok(Ret.success(result));
} }
} }

Loading…
Cancel
Save