|
|
|
@ -2,6 +2,7 @@ package com.baiye.modules.platform.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
@ -377,20 +378,23 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
@Transactional(rollbackOn = Exception.class)
|
|
|
|
|
public void updateTask(Task task) {
|
|
|
|
|
if (task.getId() != null) {
|
|
|
|
|
log.info("==================== task id {} date time {} ====================", task.getId(), DateUtil.date());
|
|
|
|
|
Task updateTask = taskRepository.findById(task.getId()).orElseGet(Task::new);
|
|
|
|
|
if (task.getRemark() != null) {
|
|
|
|
|
updateTask.setRemark(task.getRemark());
|
|
|
|
|
}
|
|
|
|
|
if (task.getTotalNumber() != null) {
|
|
|
|
|
updateTask.setTotalNumber(task.getTotalNumber());
|
|
|
|
|
}
|
|
|
|
|
if (task.getIsDistribution() != null) {
|
|
|
|
|
updateTask.setIsDistribution(task.getIsDistribution());
|
|
|
|
|
}
|
|
|
|
|
if (task.getLabelOrganizeId() != null) {
|
|
|
|
|
updateTask.setLabelOrganizeId(task.getLabelOrganizeId());
|
|
|
|
|
if (ObjectUtil.isNotNull(updateTask) && updateTask.getId() != null) {
|
|
|
|
|
if (task.getRemark() != null) {
|
|
|
|
|
updateTask.setRemark(task.getRemark());
|
|
|
|
|
}
|
|
|
|
|
if (task.getTotalNumber() != null) {
|
|
|
|
|
updateTask.setTotalNumber(task.getTotalNumber());
|
|
|
|
|
}
|
|
|
|
|
if (task.getIsDistribution() != null) {
|
|
|
|
|
updateTask.setIsDistribution(task.getIsDistribution());
|
|
|
|
|
}
|
|
|
|
|
if (task.getLabelOrganizeId() != null) {
|
|
|
|
|
updateTask.setLabelOrganizeId(task.getLabelOrganizeId());
|
|
|
|
|
}
|
|
|
|
|
taskRepository.save(updateTask);
|
|
|
|
|
}
|
|
|
|
|
taskRepository.save(updateTask);
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException("任务id不能为空");
|
|
|
|
|
}
|
|
|
|
@ -405,6 +409,11 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
taskOrganizeRepository.deleteByTaskId(taskId);
|
|
|
|
|
//3、删除任务分配比率关系
|
|
|
|
|
taskUserDistributionRepository.deleteByTaskId(taskId);
|
|
|
|
|
|
|
|
|
|
Task task = taskRepository.findById(taskId).orElseGet(Task::new);
|
|
|
|
|
if (ObjectUtil.isNotNull(task)) {
|
|
|
|
|
adBackRequestApi.delTag(taskId);
|
|
|
|
|
}
|
|
|
|
|
//4、删除资源
|
|
|
|
|
ResponseEntity<Object> response = sourceClueClient.delClueAll(new HashSet<>(Collections.singleton(taskId)));
|
|
|
|
|
if (response.getStatusCode().value() != 200) throw new BadRequestException("操作失败");
|
|
|
|
@ -418,7 +427,7 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
map.put("type", type);
|
|
|
|
|
map.put("code", 500);
|
|
|
|
|
String messageJSON;
|
|
|
|
|
if (type.equals("create")){
|
|
|
|
|
if (type.equals("create")) {
|
|
|
|
|
map.put("code", 200);
|
|
|
|
|
messageJSON = JSONUtil.toJsonStr(map);
|
|
|
|
|
} else {
|
|
|
|
@ -440,7 +449,7 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
taskRepository.save(task);
|
|
|
|
|
String key = "task:encryption:" + taskId;
|
|
|
|
|
if (!redisUtils.hasKey(key)) {
|
|
|
|
|
redisUtils.set(key, task.getIsEncryption() + "", 2592000);
|
|
|
|
|
redisUtils.set(key, String.valueOf(task.getIsEncryption()), 2592000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -457,7 +466,7 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
Map<Long, List<Organize>> map = organizeList.stream().collect(Collectors.groupingBy(Organize::getId));
|
|
|
|
|
if (CollUtil.isNotEmpty(taskOrganizeList)) {
|
|
|
|
|
for (TaskOrganize taskOrganize : taskOrganizeList) {
|
|
|
|
|
if (map.containsKey(taskOrganize.getOrganizeId())){
|
|
|
|
|
if (map.containsKey(taskOrganize.getOrganizeId())) {
|
|
|
|
|
List<Organize> organizes = map.get(taskOrganize.getOrganizeId());
|
|
|
|
|
taskOrganize.setOrganizeName(organizes.get(0).getOrganizeName());
|
|
|
|
|
}
|
|
|
|
|