|
@@ -1,5 +1,6 @@
|
|
|
package com.happy.action;
|
|
package com.happy.action;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baidubce.model.User;
|
|
import com.baidubce.model.User;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
@@ -92,6 +93,9 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //推文发布参数
|
|
|
|
|
+ System.out.println("推文发布参数:"+ JSON.toJSON(articleTweetDto));
|
|
|
|
|
+
|
|
|
//查询当前用户
|
|
//查询当前用户
|
|
|
Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getCreateId()));
|
|
Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getCreateId()));
|
|
|
if (user == null) {
|
|
if (user == null) {
|
|
@@ -129,7 +133,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
|
|
|
|
|
//添加附件
|
|
//添加附件
|
|
|
List<String> fileStr = new ArrayList<>();
|
|
List<String> fileStr = new ArrayList<>();
|
|
|
- if (articleTweetDto.getImages() != null) {
|
|
|
|
|
|
|
+ if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0) {
|
|
|
fileStr = articleTweetDto.getImages();
|
|
fileStr = articleTweetDto.getImages();
|
|
|
} else {
|
|
} else {
|
|
|
fileStr.add(articleTweetDto.getVideo());
|
|
fileStr.add(articleTweetDto.getVideo());
|
|
@@ -150,7 +154,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
int length = articleTweetService.insertArticleFileBatch(afis);
|
|
int length = articleTweetService.insertArticleFileBatch(afis);
|
|
|
if (length <= 0) {
|
|
if (length <= 0) {
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
- put("message", "推文发布失败");
|
|
|
|
|
|
|
+ put("message", "推文附件新增失败");
|
|
|
put("code", 500);
|
|
put("code", 500);
|
|
|
}}.toString());
|
|
}}.toString());
|
|
|
return null;
|
|
return null;
|
|
@@ -166,18 +170,19 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
workflow.setId(id);
|
|
workflow.setId(id);
|
|
|
workflow.setStatus(1);//1是正在审批
|
|
workflow.setStatus(1);//1是正在审批
|
|
|
workflow.setType(3);//3是推文
|
|
workflow.setType(3);//3是推文
|
|
|
- workflow.setCoverImg(articleTweetDto.getImages() != null ? articleTweetDto.getImages().get(0) : articleTweetDto.getVideo());
|
|
|
|
|
|
|
+ workflow.setCoverImg(articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0 ? articleTweetDto.getImages().get(0) : articleTweetDto.getVideo());
|
|
|
int i = workflowService.insert(workflow);
|
|
int i = workflowService.insert(workflow);
|
|
|
if (i <= 0) {
|
|
if (i <= 0) {
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
- put("message", "推文发布失败");
|
|
|
|
|
|
|
+ put("message", "推文流程发布失败");
|
|
|
put("code", 500);
|
|
put("code", 500);
|
|
|
}}.toString());
|
|
}}.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
+ System.out.println("推文发布异常:"+e.getMessage());
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
|
|
|
- put("message", "推文发布失败");
|
|
|
|
|
|
|
+ put("message", "推文发布异常");
|
|
|
put("code", 500);
|
|
put("code", 500);
|
|
|
}}.toString());
|
|
}}.toString());
|
|
|
return null;
|
|
return null;
|
|
@@ -659,7 +664,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
|
|
|
List<FileInfo> fileInfos = articleTweetService.queryList("and link_id in (" + articleIds + ")");
|
|
List<FileInfo> fileInfos = articleTweetService.queryList("and link_id in (" + articleIds + ")");
|
|
|
|
|
|
|
|
for (OwnerArticleVo data : result.getPageList()) {
|
|
for (OwnerArticleVo data : result.getPageList()) {
|
|
|
- List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<FileInfo> fileInfoList = fileInfos == null ? null : fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
|
|
|
if (fileInfoList != null) {
|
|
if (fileInfoList != null) {
|
|
|
if (fileInfoList.size() > 1) {
|
|
if (fileInfoList.size() > 1) {
|
|
|
data.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
|
|
data.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
|