|
@@ -85,9 +85,25 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
@Resource
|
|
@Resource
|
|
private TaskLogService taskLogService;
|
|
private TaskLogService taskLogService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private CustomMapper customMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private BusinessOpportunityMapper businessOpportunityMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private OrderMapper orderMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ClueMapper clueMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ContactsMapper contactsMapper;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Transactional
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public HttpRespMsg addTask(TaskDto taskDto, HttpServletRequest request) {
|
|
public HttpRespMsg addTask(TaskDto taskDto, HttpServletRequest request) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
|
|
@@ -180,7 +196,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Transactional
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public HttpRespMsg updateTask(TaskDto taskDto, HttpServletRequest request) {
|
|
public HttpRespMsg updateTask(TaskDto taskDto, HttpServletRequest request) {
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
String token = String.valueOf(request.getHeader("Token"));
|
|
String token = String.valueOf(request.getHeader("Token"));
|
|
@@ -234,7 +250,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Transactional
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public HttpRespMsg deleteTasks(List<Integer> taskIds) {
|
|
public HttpRespMsg deleteTasks(List<Integer> taskIds) {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
List<Task> taskList = taskMapper.selectList(new QueryWrapper<Task>().in("id", taskIds));
|
|
List<Task> taskList = taskMapper.selectList(new QueryWrapper<Task>().in("id", taskIds));
|
|
@@ -481,11 +497,37 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(modelName.equals("customId")){
|
|
|
|
+ if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
+ String customName = cell.getStringCellValue();
|
|
|
|
+ List<Custom> customList = customMapper.selectList(new LambdaQueryWrapper<Custom>().eq(Custom::getCustomName, customName).eq(Custom::getCompanyId, user.getCompanyId()));
|
|
|
|
+ if (customList.size()>1){
|
|
|
|
+ throw new Exception("["+customName+"]对应的客户存在多个");
|
|
|
|
+ }
|
|
|
|
+ Custom custom = customList.get(0);
|
|
|
|
+ task.setCustomId(custom.getId());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
importTaskList.add(task);
|
|
importTaskList.add(task);
|
|
}
|
|
}
|
|
|
|
|
|
if(importTaskList.size()>0){
|
|
if(importTaskList.size()>0){
|
|
|
|
+ for (Task task : importTaskList) {
|
|
|
|
+ if (task.getClueId()!=null &&(task.getCustomId()!=null||task.getBusinessOpportunityId()!=null||task.getOrderId()!=null)){
|
|
|
|
+ msg.setError("任务:"+task.getTaskName()+"中线索不应与客户/商机/销售订单一同存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if ((task.getCustomId()!=null&&task.getBusinessOpportunityId()!=null)
|
|
|
|
+ ||(task.getCustomId()!=null&&task.getOrderId()!=null)
|
|
|
|
+ ||(task.getOrderId()!=null&&task.getBusinessOpportunityId()!=null)
|
|
|
|
+ ||(task.getCustomId()!=null&&task.getBusinessOpportunityId()!=null&&task.getOrderId()!=null)){
|
|
|
|
+ msg.setError("任务:"+task.getTaskName()+"中不应客户/商机/销售订单一同存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if(saveOrUpdateBatch(importTaskList)){
|
|
if(saveOrUpdateBatch(importTaskList)){
|
|
ArrayList<TaskExecutor> taskExecutors = new ArrayList<>();
|
|
ArrayList<TaskExecutor> taskExecutors = new ArrayList<>();
|
|
ArrayList<TaskLog> taskLogs = new ArrayList<>();
|
|
ArrayList<TaskLog> taskLogs = new ArrayList<>();
|
|
@@ -620,6 +662,24 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName,dataList,path);
|
|
return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName,dataList,path);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public HttpRespMsg updateTaskStatus(TaskDto taskDto, HttpServletRequest request) {
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ if (taskDto==null||taskDto.getId()==null){
|
|
|
|
+ msg.setError("缺少用户的关键信息");
|
|
|
|
+ }
|
|
|
|
+ LambdaUpdateWrapper<Task> luw = new LambdaUpdateWrapper<>();
|
|
|
|
+ luw.set(Task::getStatus,taskDto.getStatus()).eq(Task::getId,taskDto.getStatus());
|
|
|
|
+ taskMapper.update(null,luw);
|
|
|
|
+ TaskLog taskLog = new TaskLog();
|
|
|
|
+ taskLog.setUserId(user.getId()).setTaskId(taskDto.getId()).setUserName(user.getName())
|
|
|
|
+ .setContent("修改任务状态").setModTime(LocalDateTime.now());
|
|
|
|
+ taskLogMapper.insert(taskLog);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
public void updateTaskRepeatConfigure(Task task){
|
|
public void updateTaskRepeatConfigure(Task task){
|
|
task.setRepeatType(null).setRepeatEndNever(null).setRepeatEndCount(null)
|
|
task.setRepeatType(null).setRepeatEndNever(null).setRepeatEndCount(null)
|
|
.setRepeatEndDate(null).setRepeatDesignDay(null).setRepeatDesignSameday(null);
|
|
.setRepeatEndDate(null).setRepeatDesignDay(null).setRepeatDesignSameday(null);
|