|
|
|
@ -23,7 +23,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import lombok.Data;
|
|
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -39,6 +38,7 @@ import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <p>
|
|
|
|
@ -116,7 +116,7 @@ public class TaskController {
|
|
|
|
|
}
|
|
|
|
|
List departmentGroupList = task.getDepartmentGroupList();
|
|
|
|
|
if (departmentGroupList != null && departmentGroupList.size() > 0) {
|
|
|
|
|
List departmentIdList = qywxDepartmentGroupLinkService.departmentIdList(null,departmentGroupList);
|
|
|
|
|
List departmentIdList = qywxDepartmentGroupLinkService.departmentIdList(null, departmentGroupList);
|
|
|
|
|
taskDepartmentService.addGroup(departmentIdList, id);
|
|
|
|
|
}
|
|
|
|
|
// 上传任务时同时上传素材
|
|
|
|
@ -317,17 +317,87 @@ public class TaskController {
|
|
|
|
|
@PostMapping("/upd")
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public Result upd(@Validated(TaskValidGroup2.class) @RequestBody Task task) {
|
|
|
|
|
if (LocalDateTime.now().isAfter(task.getStart())) {
|
|
|
|
|
if (task.getStart() != null && LocalDateTime.now().isAfter(task.getStart())) {
|
|
|
|
|
task.setStatus(1);
|
|
|
|
|
}
|
|
|
|
|
int id = task.getId();
|
|
|
|
|
List tagList = task.getTagList();
|
|
|
|
|
// List<Map> tagList = taskTagService.selByTaskId(id);
|
|
|
|
|
|
|
|
|
|
// 添加任务标签
|
|
|
|
|
List tagIdList = task.getTagList();
|
|
|
|
|
if(tagIdList !=null){
|
|
|
|
|
if(tagIdList.size()== 0){
|
|
|
|
|
taskTagService.remove(new QueryWrapper<TaskTag>().eq("taskId", id));
|
|
|
|
|
}else{
|
|
|
|
|
List<Map> tagListOri = taskTagService.selByTaskId(id);
|
|
|
|
|
taskTagService.remove(new QueryWrapper<TaskTag>().eq("taskId", id).notIn((tagIdList!=null&&tagIdList.size()!=0),"tagId", tagIdList));
|
|
|
|
|
List tagIdListOri = new ArrayList();
|
|
|
|
|
for (Map map : tagListOri) {
|
|
|
|
|
tagIdListOri.add(map.get("id"));
|
|
|
|
|
}
|
|
|
|
|
List collect = (List) tagIdList.stream().filter(item -> !tagIdListOri.contains(item)).collect(Collectors.toList());
|
|
|
|
|
if (collect != null && collect.size() != 0) {
|
|
|
|
|
taskTagService.addGroup(collect, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加任务品牌
|
|
|
|
|
List brandIdList = task.getBrandList();
|
|
|
|
|
if(brandIdList !=null){
|
|
|
|
|
if(brandIdList.size()== 0){
|
|
|
|
|
taskBrandService.remove(new QueryWrapper<TaskBrand>().eq("taskId", id));
|
|
|
|
|
}else{
|
|
|
|
|
List<Map> brandListOri = taskBrandService.selByTaskId(id);
|
|
|
|
|
taskBrandService.remove(new QueryWrapper<TaskBrand>().eq("taskId", id).notIn((brandIdList!=null&&brandIdList.size()!=0),"brandId", brandIdList));
|
|
|
|
|
List brandIdListOri = new ArrayList();
|
|
|
|
|
for (Map map : brandListOri) {
|
|
|
|
|
brandIdListOri.add(map.get("id"));
|
|
|
|
|
}
|
|
|
|
|
List collect = (List) brandIdList.stream().filter(item -> !brandIdListOri.contains(item)).collect(Collectors.toList());
|
|
|
|
|
if (collect != null && collect.size() != 0) {
|
|
|
|
|
taskBrandService.addGroup(collect, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List dpIdList = new ArrayList();
|
|
|
|
|
List<Integer> departmentIdList = task.getDepartmentList();
|
|
|
|
|
if (departmentIdList != null && departmentIdList.size() > 0) {
|
|
|
|
|
for (Integer e : departmentIdList) {
|
|
|
|
|
dpIdList.add(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List departmentGroupList = task.getDepartmentGroupList();
|
|
|
|
|
if (departmentGroupList != null && departmentGroupList.size() > 0) {
|
|
|
|
|
List<Integer> departmentIdList1 = qywxDepartmentGroupLinkService.departmentIdList(null, departmentGroupList);
|
|
|
|
|
if (departmentIdList != null && departmentIdList.size() > 0) {
|
|
|
|
|
for (Integer e : departmentIdList1) {
|
|
|
|
|
dpIdList.add(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(dpIdList !=null){
|
|
|
|
|
if(dpIdList.size()== 0){
|
|
|
|
|
taskDepartmentService.remove(new QueryWrapper<TaskDepartment>().eq("taskId", id));
|
|
|
|
|
}else{
|
|
|
|
|
List<TaskDepartment> departmentListOri = taskDepartmentService.list(new QueryWrapper<TaskDepartment>().eq("taskId",task.getId()));
|
|
|
|
|
taskDepartmentService.remove(new QueryWrapper<TaskDepartment>().eq("taskId", id).notIn((dpIdList!=null&&dpIdList.size()!=0),"brandId", departmentIdList));
|
|
|
|
|
List departmentIdListOri = new ArrayList();
|
|
|
|
|
for (TaskDepartment taskDepartment : departmentListOri) {
|
|
|
|
|
departmentIdListOri.add(taskDepartment.getDepartmentId());
|
|
|
|
|
}
|
|
|
|
|
List collect = (List) dpIdList.stream().filter(item -> !departmentIdListOri.contains(item)).collect(Collectors.toList());
|
|
|
|
|
if (collect != null && collect.size() != 0) {
|
|
|
|
|
taskDepartmentService.addGroup(collect, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Result.success();
|
|
|
|
|
// if (tagList != null && tagList.size() > 0) {
|
|
|
|
|
// taskTagService.addGroup(tagList, id);
|
|
|
|
|
// }
|
|
|
|
|
task.setUpdateAt(LocalDateTime.now());
|
|
|
|
|
return MybatisPlusUtil.sqlResult(taskService.updateById(task), "修改");
|
|
|
|
|
// task.setUpdateAt(LocalDateTime.now());
|
|
|
|
|
// return MybatisPlusUtil.sqlResult(taskService.updateById(task), "修改");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @Operation(summary = "删除")
|
|
|
|
@ -467,10 +537,10 @@ public class TaskController {
|
|
|
|
|
@AdminTokenValid
|
|
|
|
|
public void excel(HttpServletResponse response, @Validated @RequestBody DetTaskParam param) throws IOException {
|
|
|
|
|
//这是表头及格式
|
|
|
|
|
String[][] array ={
|
|
|
|
|
{"任务名称", "员工姓名","部门","播放数","点赞数","收藏数","评论数","转发数","推荐数","传播值"},
|
|
|
|
|
{"taskTitle", "userName","departmentName","playNumSum","commendNumSum","collectionNumSum","commentNumSum","reSendNumSum","recommendNumSum","effectResultSum"},
|
|
|
|
|
{"String", "String","String","int","int","int","int","int","int","int"}
|
|
|
|
|
String[][] array = {
|
|
|
|
|
{"任务名称", "员工姓名", "部门", "播放数", "点赞数", "收藏数", "评论数", "转发数", "推荐数", "传播值"},
|
|
|
|
|
{"taskTitle", "userName", "departmentName", "playNumSum", "commendNumSum", "collectionNumSum", "commentNumSum", "reSendNumSum", "recommendNumSum", "effectResultSum"},
|
|
|
|
|
{"String", "String", "String", "int", "int", "int", "int", "int", "int", "int"}
|
|
|
|
|
};
|
|
|
|
|
QueryWrapper<Task> qw = new QueryWrapper<>();
|
|
|
|
|
qw.eq("t2.id", param.getId()).groupBy("t1.userId");
|
|
|
|
@ -528,12 +598,12 @@ public class TaskController {
|
|
|
|
|
@Operation(summary = "导出用户线索excel", description = "用户线索")
|
|
|
|
|
@PostMapping("/cnExcel")
|
|
|
|
|
// @AdminTokenValid
|
|
|
|
|
public void cnExcel(HttpServletResponse response,@RequestBody CNListParam param) throws IOException {
|
|
|
|
|
public void cnExcel(HttpServletResponse response, @RequestBody CNListParam param) throws IOException {
|
|
|
|
|
//这是表头及格式
|
|
|
|
|
String[][] array ={
|
|
|
|
|
{"姓名", "手机号","地区","关注车型","备注","关联任务","提交人","部门"},
|
|
|
|
|
{"customerName", "tel","area","brandList","remarks","taskTitle","provideName","departmentName"},
|
|
|
|
|
{"String", "String","String","String","String","String","String","String","String","String"}
|
|
|
|
|
String[][] array = {
|
|
|
|
|
{"姓名", "手机号", "地区", "关注车型", "备注", "关联任务", "提交人", "部门"},
|
|
|
|
|
{"customerName", "tel", "area", "brandList", "remarks", "taskTitle", "provideName", "departmentName"},
|
|
|
|
|
{"String", "String", "String", "String", "String", "String", "String", "String", "String", "String"}
|
|
|
|
|
};
|
|
|
|
|
QueryWrapper<CustomerActionNote> qw = new QueryWrapper<>();
|
|
|
|
|
qw.like(param.getName() != null, "t1.customerName", param.getName());
|
|
|
|
@ -541,7 +611,7 @@ public class TaskController {
|
|
|
|
|
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(1,10000), null, qw);
|
|
|
|
|
IPage<Map> iPage = customerActionNoteService.pageList(MybatisPlusUtil.SetNumPage(1, 10000), null, qw);
|
|
|
|
|
List<Map> records = iPage.getRecords();
|
|
|
|
|
Workbook wb = ExcelUtil.writeToExcelByList(array, records);
|
|
|
|
|
OutputStream output = response.getOutputStream();
|
|
|
|
|