|
|
@@ -47,20 +47,20 @@ public class AdminArticleController {
|
|
|
Article article = new Article();
|
|
|
article.setTitle((String) body.get("title"));
|
|
|
article.setContent((String) body.get("content"));
|
|
|
- if (body.get("categoryId") != null) {
|
|
|
+ if (body.get("categoryId") != null && !body.get("categoryId").toString().trim().isEmpty()) {
|
|
|
article.setCategoryId(Long.valueOf(body.get("categoryId").toString()));
|
|
|
}
|
|
|
article.setSummary((String) body.get("summary"));
|
|
|
article.setCoverImage((String) body.get("coverImage"));
|
|
|
article.setTags((String) body.get("tags"));
|
|
|
article.setAuthor((String) body.get("author"));
|
|
|
- if (body.get("readTime") != null) {
|
|
|
+ if (body.get("readTime") != null && !body.get("readTime").toString().trim().isEmpty()) {
|
|
|
article.setReadTime(Integer.valueOf(body.get("readTime").toString()));
|
|
|
}
|
|
|
if (body.get("contentType") != null) {
|
|
|
article.setContentType((String) body.get("contentType"));
|
|
|
}
|
|
|
- if (body.get("difficultyLevel") != null) {
|
|
|
+ if (body.get("difficultyLevel") != null && !body.get("difficultyLevel").toString().trim().isEmpty()) {
|
|
|
article.setDifficultyLevel(Integer.valueOf(body.get("difficultyLevel").toString()));
|
|
|
}
|
|
|
// relatedDimensions may come as array from frontend
|
|
|
@@ -96,20 +96,20 @@ public class AdminArticleController {
|
|
|
article.setId(articleId);
|
|
|
article.setTitle((String) body.get("title"));
|
|
|
article.setContent((String) body.get("content"));
|
|
|
- if (body.get("categoryId") != null) {
|
|
|
+ if (body.get("categoryId") != null && !body.get("categoryId").toString().trim().isEmpty()) {
|
|
|
article.setCategoryId(Long.valueOf(body.get("categoryId").toString()));
|
|
|
}
|
|
|
article.setSummary((String) body.get("summary"));
|
|
|
article.setCoverImage((String) body.get("coverImage"));
|
|
|
article.setTags((String) body.get("tags"));
|
|
|
article.setAuthor((String) body.get("author"));
|
|
|
- if (body.get("readTime") != null) {
|
|
|
+ if (body.get("readTime") != null && !body.get("readTime").toString().trim().isEmpty()) {
|
|
|
article.setReadTime(Integer.valueOf(body.get("readTime").toString()));
|
|
|
}
|
|
|
if (body.get("contentType") != null) {
|
|
|
article.setContentType((String) body.get("contentType"));
|
|
|
}
|
|
|
- if (body.get("difficultyLevel") != null) {
|
|
|
+ if (body.get("difficultyLevel") != null && !body.get("difficultyLevel").toString().trim().isEmpty()) {
|
|
|
article.setDifficultyLevel(Integer.valueOf(body.get("difficultyLevel").toString()));
|
|
|
}
|
|
|
Object rd = body.get("relatedDimensions");
|