|
|
|
@ -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) {
|
|
|
|
|