文件上传websocket成功通知

master
yqy 2 years ago
parent bffa6c7fa6
commit ea74814822

@ -410,15 +410,20 @@ public class TaskServiceImpl implements TaskService {
@Override
public void sendMessage(String message, Long userId, String type) {
Map<String, Object> map = new HashMap<>();
map.put("message", message);
map.put("code", 500);
if (type.equals("create")) map.put("code", 200);
map.put("type", type);
map.put("code", 500);
String messageJSON;
if (type.equals("create")){
map.put("code", 200);
messageJSON = JSONUtil.toJsonStr(map);
} else {
JSONObject jsonData = new JSONObject();
jsonData.putOpt("data", map);
String messageJSON = JSONUtil.toJsonStr(jsonData);
messageJSON = JSONUtil.toJsonStr(jsonData);
}
webSocketServer.sendMessage(messageJSON, userId);
}

@ -96,7 +96,7 @@ public class FileAnalysisTask {
taskClient.updateTask(task);
// 任务自动分配(未开启就不分配)
clueService.dynamicTaskDistribution(taskId, uploadType);
taskClient.sendMessage("上传成功", clueRecords.get(0).getCreateBy(), "create");
taskClient.sendMessage("文件上传成功", clueRecords.get(0).getCreateBy(), "create");
return;
}
//创建任务
@ -106,7 +106,7 @@ public class FileAnalysisTask {
BaseExcelListenerDto baseExcelListenerDto = new BaseExcelListenerDto(userId, uploadType, taskId, oneFileName);
clueService.saveTask(baseExcelListenerDto);
}
taskClient.sendMessage("上传成功", clueRecords.get(0).getCreateBy(), "create");
taskClient.sendMessage("文件上传成功", clueRecords.get(0).getCreateBy(), "create");
}
}

Loading…
Cancel
Save