Skip to content

Commit bc42b2f

Browse files
committed
解决其它类型转为String
1 parent 7a25c60 commit bc42b2f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

  • APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/RequestParser.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,24 +366,26 @@ private JSONObject getObject(String parentPath, final QueryConfig parentConfig,
366366
Set<String> set = request.keySet();
367367
JSONObject transferredRequest = new JSONObject(true);
368368
if (set != null) {
369-
String value;
369+
Object value;
370+
String valueString;
370371
JSONObject child;
371372
JSONObject result;
372373
boolean isFirst = true;
373374
for (String key : set) {
374-
value = transferredRequest.containsKey(key) ? transferredRequest.getString(key) : request.getString(key);
375-
child = JSON.parseObject(value);
375+
value = transferredRequest.containsKey(key) ? transferredRequest.get(key) : request.get(key);
376+
valueString = value == null ? null : String.valueOf(value);
377+
child = JSON.parseObject(valueString);
376378
if (child == null) {//key - value
377379
transferredRequest.put(key, value);
378-
if (StringUtil.isPath(value)) {
380+
if (StringUtil.isPath(valueString)) {
379381
System.out.println("getObject StringUtil.isPath(value) >> parseRelation = " + parseRelation);
380382
if (parseRelation) {
381383
transferredRequest.put(key, getValueByPath(relationMap.get(getPath(path, key))));
382384
// relationMap.remove(path + SEPARATOR + key);
383385
} else {
384386
containRelation = true;
385387
relationMap.put(getPath(path, key)//value.contains(parentPath)会因为结构变化而改变
386-
, getPath((value.startsWith(SEPARATOR) ? parentPath : ""), value));
388+
, getPath((valueString.startsWith(SEPARATOR) ? parentPath : ""), valueString));
387389
}
388390
}
389391
} else {
@@ -463,7 +465,7 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
463465
int totalCount = 0;
464466
for (String key : set) {
465467
if (isTableKey(key)) {
466-
object = request.getJSONObject(key);
468+
object = getJSONObject(request, key);
467469
if (object != null) {// && object.isEmpty() == false) {
468470
totalCount = QueryHelper.getInstance().getCount(key);
469471
break;

0 commit comments

Comments
 (0)