Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
b05140b9
Commit
b05140b9
authored
Nov 09, 2018
by
Junling Bu
Browse files
litemall-core微调
parent
94463c26
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-core/src/main/java/org/linlinjava/litemall/core/storage/StorageService.java
View file @
b05140b9
...
@@ -54,8 +54,6 @@ public class StorageService {
...
@@ -54,8 +54,6 @@ public class StorageService {
storageInfo
.
setName
(
fileName
);
storageInfo
.
setName
(
fileName
);
storageInfo
.
setSize
((
int
)
contentLength
);
storageInfo
.
setSize
((
int
)
contentLength
);
storageInfo
.
setType
(
contentType
);
storageInfo
.
setType
(
contentType
);
storageInfo
.
setAddTime
(
LocalDateTime
.
now
());
storageInfo
.
setModified
(
LocalDateTime
.
now
());
storageInfo
.
setKey
(
key
);
storageInfo
.
setKey
(
key
);
storageInfo
.
setUrl
(
url
);
storageInfo
.
setUrl
(
url
);
litemallStorageService
.
add
(
storageInfo
);
litemallStorageService
.
add
(
storageInfo
);
...
...
litemall-core/src/main/java/org/linlinjava/litemall/core/util/JacksonUtil.java
View file @
b05140b9
...
@@ -24,6 +24,22 @@ public class JacksonUtil {
...
@@ -24,6 +24,22 @@ public class JacksonUtil {
return
null
;
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
)
{
public
static
Integer
parseInteger
(
String
body
,
String
field
)
{
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectMapper
mapper
=
new
ObjectMapper
();
JsonNode
node
=
null
;
JsonNode
node
=
null
;
...
@@ -46,7 +62,7 @@ public class JacksonUtil {
...
@@ -46,7 +62,7 @@ public class JacksonUtil {
JsonNode
leaf
=
node
.
get
(
field
);
JsonNode
leaf
=
node
.
get
(
field
);
if
(
leaf
!=
null
)
if
(
leaf
!=
null
)
return
mapper
.
convertValue
(
leaf
,
new
TypeReference
<
List
<
String
>>(){});
return
mapper
.
convertValue
(
leaf
,
new
TypeReference
<
List
<
Integer
>>(){});
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment