litemall-core微调

This commit is contained in:
Junling Bu
2018-11-09 19:51:42 +08:00
parent 94463c2681
commit b05140b928
2 changed files with 17 additions and 3 deletions

View File

@@ -54,8 +54,6 @@ public class StorageService {
storageInfo.setName(fileName);
storageInfo.setSize((int) contentLength);
storageInfo.setType(contentType);
storageInfo.setAddTime(LocalDateTime.now());
storageInfo.setModified(LocalDateTime.now());
storageInfo.setKey(key);
storageInfo.setUrl(url);
litemallStorageService.add(storageInfo);

View File

@@ -24,6 +24,22 @@ public class JacksonUtil {
return null;
}
public static List<String> parseStringList(String body, String field) {
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
try {
node = mapper.readTree(body);
JsonNode leaf = node.get(field);
if(leaf != null)
return mapper.convertValue(leaf, new TypeReference<List<String>>(){});
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static Integer parseInteger(String body, String field) {
ObjectMapper mapper = new ObjectMapper();
JsonNode node = null;
@@ -46,7 +62,7 @@ public class JacksonUtil {
JsonNode leaf = node.get(field);
if(leaf != null)
return mapper.convertValue(leaf, new TypeReference<List<String>>(){});
return mapper.convertValue(leaf, new TypeReference<List<Integer>>(){});
} catch (IOException e) {
e.printStackTrace();
}