|
|
|
@ -71,24 +71,6 @@ public class TaskController {
|
|
|
|
|
if (LocalDateTime.now().isAfter(task.getStart())) {
|
|
|
|
|
task.setStatus(1);
|
|
|
|
|
}
|
|
|
|
|
List<String> referenceUrlList = task.getReferenceUrlList();
|
|
|
|
|
if (referenceUrlList != null && referenceUrlList.size() > 0) {
|
|
|
|
|
List<Reference> l = new ArrayList<>();
|
|
|
|
|
List<TopicActivity> ta = new ArrayList<>();
|
|
|
|
|
for (String e : referenceUrlList) {
|
|
|
|
|
if (e.lastIndexOf(".") != -1) {
|
|
|
|
|
// l.add(new Reference().setTitle(task.getTitle()).setGroupId(param.getGroupId()).setCoverUrl(param.getCoverUrl()).setCreatAt(LocalDateTime.now())
|
|
|
|
|
// .setFileUrl(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))));
|
|
|
|
|
// ta.add(new TopicActivity().setTitle(param.getTitle()).setCover(param.getCoverUrl()).setCreatAt(LocalDateTime.now())
|
|
|
|
|
// .setContent(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (l.size() < 1) {
|
|
|
|
|
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "无有效数据");
|
|
|
|
|
}
|
|
|
|
|
referenceService.saveBatch(l);
|
|
|
|
|
topicActivityService.saveBatch(ta);
|
|
|
|
|
}
|
|
|
|
|
taskService.save(task);
|
|
|
|
|
int id = task.getId();
|
|
|
|
|
List tagList = task.getTagList();
|
|
|
|
@ -103,6 +85,30 @@ public class TaskController {
|
|
|
|
|
if (referenceList != null && referenceList.size() > 0) {
|
|
|
|
|
taskReferenceService.addGroup(referenceList, id);
|
|
|
|
|
}
|
|
|
|
|
// 上传任务时同时上传素材
|
|
|
|
|
List<String> referenceUrlList = task.getReferenceUrlList();
|
|
|
|
|
if (referenceUrlList != null && referenceUrlList.size() > 0) {
|
|
|
|
|
List<Reference> l = new ArrayList<>();
|
|
|
|
|
List<TopicActivity> ta = new ArrayList<>();
|
|
|
|
|
for (String e : referenceUrlList) {
|
|
|
|
|
if (e.lastIndexOf(".") != -1) {
|
|
|
|
|
l.add(new Reference().setTitle(task.getTitle()).setCoverUrl(task.getCoverUrl()).setCreatAt(LocalDateTime.now())
|
|
|
|
|
.setFileUrl(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))));
|
|
|
|
|
ta.add(new TopicActivity().setTitle(task.getTitle()).setCover(task.getCoverUrl()).setCreatAt(LocalDateTime.now())
|
|
|
|
|
.setContent(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (l.size() >0 ) {
|
|
|
|
|
referenceService.saveBatch(l);
|
|
|
|
|
topicActivityService.saveBatch(ta);
|
|
|
|
|
List<Integer> reference = new ArrayList<>();
|
|
|
|
|
for (Reference r : l) {
|
|
|
|
|
reference.add(r.getId());
|
|
|
|
|
}
|
|
|
|
|
System.out.println(reference);
|
|
|
|
|
taskReferenceService.addGroup(reference, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Result.success("添加完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|