zhangjinli 3 years ago
parent 9d2c2b2177
commit 2d2068ba1b

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zh.project0512.annotation.AdminCheckAuthorityAnnotation;
import com.zh.project0512.annotation.AdminTokenValid;
import com.zh.project0512.model.*;
import com.zh.project0512.model.vo.FileUploadParamVo;
import com.zh.project0512.service.IReferenceBrandService;
import com.zh.project0512.service.IReferenceService;
import com.zh.project0512.service.IReferenceTagService;
@ -62,7 +63,7 @@ public class ReferenceController {
private Integer groupId;
@Schema(title = "文件地址列表")
@NotEmpty(message = "fileUrl列表不能为空")
private List<String> fileUrlList;
private List<FileUploadParamVo> fileUrlList;
@Schema(title = "封面图片地址", description = "视频文件请上传封面图片")
private String coverUrl;
@Schema(title = "时长", description = "视频文件请上传时长")
@ -73,20 +74,28 @@ public class ReferenceController {
private List<Integer> brandList;
}
@Operation(summary = "添加素材",description = "可根据文件不同同时上传多个素材")
@Operation(summary = "添加素材", description = "可根据文件不同同时上传多个素材")
@PostMapping("/add")
@AdminTokenValid
@AdminCheckAuthorityAnnotation(jurisdictionId = "7")
public Result add(@Validated @RequestBody AddRParam param) {
List<String> list = param.getFileUrlList();
List<FileUploadParamVo> list = param.getFileUrlList();
List<Reference> l = new ArrayList<>();
// List<TopicActivity> ta = new ArrayList<>();
List<Integer> tagList = param.getTagList();
List<Integer> brandList = param.getBrandList();
for (String e : list) {
if (e.lastIndexOf(".") != -1) {
l.add(new Reference().setTitle(param.getTitle()).setGroupId(param.getGroupId()).setCoverUrl(param.getCoverUrl()).setCreatAt(LocalDateTime.now())
.setFileUrl(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))).setDuration(param.getDuration()));
for (FileUploadParamVo e : list) {
String url = e.getUrl();
if (url != null && url.lastIndexOf(".") != -1) {
l.add(new Reference()
.setTitle(param.getTitle())
.setGroupId(param.getGroupId())
.setCoverUrl(param.getCoverUrl())
.setCreatAt(LocalDateTime.now())
.setDuration(e.getDuration())
.setFileUrl(url)
.setType(FileTypeUtil.getcontentTypeNum(url.substring(url.lastIndexOf("."))))
);
// ta.add(new TopicActivity().setTitle(param.getTitle()).setCover(param.getCoverUrl()).setCreatAt(LocalDateTime.now())
// .setContent(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))));
}
@ -96,7 +105,7 @@ public class ReferenceController {
}
referenceService.saveBatch(l);
// topicActivityService.saveBatch(ta);
if (tagList !=null && tagList.size() > 0) {
if (tagList != null && tagList.size() > 0) {
List<JSONObject> tag = new ArrayList<>();
for (Reference r : l) {
for (Integer t : tagList) {
@ -106,7 +115,7 @@ public class ReferenceController {
referenceTagService.addGroup(tag);
}
List<JSONObject> brand = new ArrayList<>();
if (brandList !=null && brandList.size() > 0) {
if (brandList != null && brandList.size() > 0) {
for (Reference r : l) {
for (Integer t : brandList) {
brand.add(new JSONObject().fluentPut("referenceId", r.getId()).fluentPut("brandId", t));

@ -11,6 +11,7 @@ import com.zh.project0512.annotation.AdminTokenValid;
import com.zh.project0512.model.*;
import com.zh.project0512.model.validatedDemo.TaskValidGroup1;
import com.zh.project0512.model.validatedDemo.TaskValidGroup2;
import com.zh.project0512.model.vo.FileUploadParamVo;
import com.zh.project0512.service.*;
import com.zh.project0512.utils.CustomUtil;
import com.zh.project0512.utils.FileTypeUtil;
@ -102,14 +103,15 @@ public class TaskController {
taskDepartmentService.addGroup(departmentList, id);
}
// 上传任务时同时上传素材
List<String> referenceUrlList = task.getReferenceUrlList();
List<FileUploadParamVo> 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(".")))));
for (FileUploadParamVo e : referenceUrlList) {
String url = e.getUrl();
if (url != null && e.getUrl().lastIndexOf(".") != -1) {
l.add(new Reference().setTitle(task.getTitle()).setCoverUrl(task.getCoverUrl()).setDuration(e.getDuration()).setCreatAt(LocalDateTime.now())
.setFileUrl(url).setType(FileTypeUtil.getcontentTypeNum(url.substring(url.lastIndexOf(".")))));
// ta.add(new TopicActivity().setTitle(task.getTitle()).setCover(task.getCoverUrl()).setCreatAt(LocalDateTime.now())
// .setContent(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))));
}
@ -127,18 +129,19 @@ public class TaskController {
// 上传任务的通用教程
List<TaskTeachRefe> l2 = new ArrayList<>();
List<Integer> teachRefeList = task.getTeachRefeList();
if(teachRefeList!=null && teachRefeList.size()>0){
if (teachRefeList != null && teachRefeList.size() > 0) {
List<TeachingRefe> teachingRefes = (List<TeachingRefe>) teachingRefeService.listByIds(teachRefeList);
for (TeachingRefe e : teachingRefes) {
l2.add((new TaskTeachRefe().setTaskId(id).setCreatAt(LocalDateTime.now())
.setFileUrl(e.getFileUrl()).setType(FileTypeUtil.getcontentTypeNum(e.getFileUrl().substring(e.getFileUrl().lastIndexOf("."))))));
}
}
List<String> teachRefeUrlList = task.getTeachRefeUrlList();
for (String e : teachRefeUrlList) {
if (e.lastIndexOf(".") != -1) {
l2.add(new TaskTeachRefe().setTaskId(id).setCreatAt(LocalDateTime.now())
.setFileUrl(e).setType(FileTypeUtil.getcontentTypeNum(e.substring(e.lastIndexOf(".")))));
List<FileUploadParamVo> teachRefeUrlList = task.getTeachRefeUrlList();
for (FileUploadParamVo e : teachRefeUrlList) {
String url = e.getUrl();
if (url != null && url.lastIndexOf(".") != -1) {
l2.add(new TaskTeachRefe().setTaskId(id).setCreatAt(LocalDateTime.now()).setDuration(e.getDuration())
.setFileUrl(url).setType(FileTypeUtil.getcontentTypeNum(url.substring(url.lastIndexOf(".")))));
}
}
if (l2.size() > 0) {
@ -310,11 +313,11 @@ public class TaskController {
@AdminCheckAuthorityAnnotation(jurisdictionId = "3")
public Result del(@Validated @RequestBody DetTaskParam param) {
UpdateWrapper<Task> ew = new UpdateWrapper<>();
ew.eq("status",1).eq("id",param.getId())
.set("status",2).set("updateAt",LocalDateTime.now());
ew.eq("status", 1).eq("id", param.getId())
.set("status", 2).set("updateAt", LocalDateTime.now());
taskService.update(ew);
videoService.updStatusByTaskId(param.getId(),LocalDateTime.now());
return Result.success("","终止任务完成");
videoService.updStatusByTaskId(param.getId(), LocalDateTime.now());
return Result.success("", "终止任务完成");
}
@Data
@ -347,7 +350,7 @@ public class TaskController {
if (null != param.getKeyword()) {
qw.like("t1.title", param.getKeyword());
}
IPage iPage = taskService.idList(MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize()),null, param.getTagIdList(), param.getBrandIdList(), qw);
IPage iPage = taskService.idList(MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize()), null, param.getTagIdList(), param.getBrandIdList(), qw);
List list = iPage.getRecords();
if (list.size() > 0) {
iPage.setRecords(taskService.list(null, list, param.getTagIdList(), param.getBrandIdList(), qw));
@ -369,11 +372,11 @@ public class TaskController {
public Result det(@Validated @RequestBody DetTaskParam param) {
Task task = taskService.detailById(null, param.getId());
JSONObject res = (JSONObject) JSONObject.toJSON(task);
if(task!=null) {
if (task != null) {
List rewardRulesList = rewardRuleService.listByTemplateId(task.getRewardRuleTemplateId());
res.put("rewardRuleList", rewardRulesList);
List departmentList = taskService.taskDepartment(task.getId());
res.put("departmentList",departmentList);
res.put("departmentList", departmentList);
}
return Result.success(res);
}
@ -382,12 +385,12 @@ public class TaskController {
@PostMapping("taskEffect")
@AdminTokenValid
public Result taskEffect(@Validated @RequestBody DetTaskParam param) {
List<Map> maps = taskService.taskEffectData(new QueryWrapper<Task>().eq("t2.id",param.getId()));
List<Map> maps = taskService.taskEffectData(new QueryWrapper<Task>().eq("t2.id", param.getId()));
JSONObject obj = new JSONObject();
obj.put("taskEffect",maps.get(0));
if(maps!=null) {
obj.put("taskEffect", maps.get(0));
if (maps != null) {
QueryWrapper<Task> qw = new QueryWrapper<>();
qw.eq("t2.id",param.getId()).groupBy("t1.userId");
qw.eq("t2.id", param.getId()).groupBy("t1.userId");
obj.put("userEffectList", taskService.taskEffectData(qw));
}
return Result.success(obj);
@ -409,11 +412,11 @@ public class TaskController {
@AdminTokenValid
public Result taskUserEffect(@Validated @RequestBody TaskUserParam param) {
QueryWrapper<Task> qw = new QueryWrapper<>();
qw.eq("t2.id",param.getId()).eq("t1.userId",param.getUserId()).groupBy("t1.userId");
qw.eq("t2.id", param.getId()).eq("t1.userId", param.getUserId()).groupBy("t1.userId");
JSONObject taskEffect = taskService.taskEffect(qw);
if(taskEffect!=null) {
if (taskEffect != null) {
QueryWrapper<Video> qw2 = new QueryWrapper<>();
qw2.eq("taskId",param.getId()).eq("userId",param.getUserId());
qw2.eq("taskId", param.getId()).eq("userId", param.getUserId());
taskEffect.put("userEffectDetail", videoService.list(qw2));
}
return Result.success(taskEffect);
@ -440,11 +443,11 @@ public class TaskController {
@AdminTokenValid
public Result customerNote(@RequestBody CNListParam param) {
QueryWrapper<CustomerActionNote> qw = new QueryWrapper<>();
qw.like(param.getName()!=null,"t1.customerName" ,param.getName());
qw.like(param.getTel()!=null,"t1.tel" ,param.getTel());
qw.like(param.getBrand()!=null,"t1.brandList" ,param.getBrand());
qw.like(param.getProviderName()!=null,"t2.name" ,param.getProviderName());
qw.eq(param.getDepartmentId()!=null,"t4.departmentId" ,param.getDepartmentId());
qw.like(param.getName() != null, "t1.customerName", param.getName());
qw.like(param.getTel() != null, "t1.tel", param.getTel());
qw.like(param.getBrand() != null, "t1.brandList", param.getBrand());
qw.like(param.getProviderName() != null, "t2.name", param.getProviderName());
qw.eq(param.getDepartmentId() != null, "t4.departmentId", param.getDepartmentId());
IPage<Map> iPage = customerActionNoteService.pageList(MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize()), null, qw);
List<Map> records = iPage.getRecords();
for (Map m : records) {

@ -10,6 +10,7 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zh.project0512.model.validatedDemo.TaskValidGroup1;
import com.zh.project0512.model.validatedDemo.TaskValidGroup2;
import com.zh.project0512.model.vo.FileUploadParamVo;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Schema;
@ -53,6 +54,12 @@ public class Task extends Model {
@NotNull(message = "副标题不能为空",groups = {TaskValidGroup1.class})
private String subtitle;
/**
*
*/
@Schema(title="图文介绍")
private String imgText;
/**
*
*/
@ -112,7 +119,7 @@ public class Task extends Model {
@Schema(title="上传素材url列表")
@TableField(exist = false)
private List<String> referenceUrlList;
private List<FileUploadParamVo> referenceUrlList;
@Schema(title="选择教程id列表")
@TableField(exist = false)
@ -120,7 +127,7 @@ public class Task extends Model {
@Schema(title="上传教程url列表")
@TableField(exist = false)
private List<String> teachRefeUrlList;
private List<FileUploadParamVo> teachRefeUrlList;
@Schema(title="接受任务部门列表")
@TableField(exist = false)

@ -0,0 +1,25 @@
package com.zh.project0512.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FileUploadParamVo implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(title = "文件地址")
private String url;
@Schema(title = "时长(视频需要)")
private Integer duration;
@Schema(title = "封面地址(视频需要)")
private String cover;
}
Loading…
Cancel
Save