REM:
1. 修改停止清洗任务接口
2. 修改通过任务Id和设备Id获取的任务信息类型
3. 修改数据库测试用例
This commit is contained in:
chenlinghy 2020-07-02 11:15:49 +08:00
parent 82b391b77a
commit b36835cc48
4 changed files with 22 additions and 33 deletions

View File

@ -112,11 +112,6 @@ public class HaoHanImpl implements DisposeEntryManager {
return new MulReturnType<>(ErrorCode.ERR_HAOHAN_ERROR, null); return new MulReturnType<>(ErrorCode.ERR_HAOHAN_ERROR, null);
} }
if (rsp.getState() != ErrorCode.ERR_OK.getCode()) {
log.error("----Error Haohan stop task {} return error: {}, {}", devTaskId, rsp.getState(), rsp.getMsg());
return new MulReturnType<>(ErrorCode.ERR_HAOHAN_ERROR, null);
}
log.info("----Finish Haohan Stop Cleanup Task: {}", devTaskId); log.info("----Finish Haohan Stop Cleanup Task: {}", devTaskId);
return new MulReturnType<>(ErrorCode.ERR_OK, null); return new MulReturnType<>(ErrorCode.ERR_OK, null);
}catch (JsonProcessingException e) { }catch (JsonProcessingException e) {

View File

@ -34,7 +34,7 @@ public interface TaskInfoMapper extends Mapper<TaskInfo>, MySqlMapper<TaskInfo>
* @param deviceId the device id * @param deviceId the device id
* @return the task info * @return the task info
*/ */
List<TaskInfo> getTaskInfo(@Param("taskId") Long taskId, TaskInfo getTaskInfo(@Param("taskId") Long taskId,
@Param("deviceId") Long deviceId); @Param("deviceId") Long deviceId);
/** /**

View File

@ -254,15 +254,10 @@ public class TaskServiceImpl implements TaskService {
dev.forEach(k -> { dev.forEach(k -> {
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(k.getType(), k.getIpAddr()); DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(k.getType(), k.getIpAddr());
List<TaskInfo> taskInfoList = taskInfoMapper.getTaskInfo(taskId, k.getId()); TaskInfo taskInfo = taskInfoMapper.getTaskInfo(taskId, k.getId());
taskInfoList.forEach(t -> {
if (t.getExternId() == null) {
t.setExternId(-1L);
}
// 异步启动处置任务 // 异步启动处置任务
CompletableFuture.supplyAsync(() -> dp.stopDispose(task.getDisposeIp(), DeviceCapacity.values()[task.getType()], t.getExternId())) CompletableFuture.supplyAsync(() -> dp.stopDispose(task.getDisposeIp(), DeviceCapacity.values()[task.getType()], taskInfo.getExternId()))
.whenComplete((v, ex) -> { .whenComplete((v, ex) -> {
if (ex != null) { if (ex != null) {
// 恢复缓存中任务状态到先前状态 // 恢复缓存中任务状态到先前状态
@ -282,7 +277,6 @@ public class TaskServiceImpl implements TaskService {
} }
}); });
}); });
});
} else { } else {
log.error("No such task: taskId:{}", taskId); log.error("No such task: taskId:{}", taskId);
return ErrorCode.ERR_NOSUCHTASK; return ErrorCode.ERR_NOSUCHTASK;

View File

@ -133,10 +133,10 @@ public class TaskInfoMapperTest extends InitTestEnvironment {
for (TaskInfoDetail task : taskInfoDetailList for (TaskInfoDetail task : taskInfoDetailList
) { ) {
log.info("taskId-->{}, deviceId-->{}", task.getId(), task.getDeviceId()); log.info("taskId-->{}, deviceId-->{}", task.getId(), task.getDeviceId());
List<TaskInfo> taskInfoList = taskInfoMapper.getTaskInfo(task.getId(), task.getDeviceId()); TaskInfo taskInfo = taskInfoMapper.getTaskInfo(task.getId(), task.getDeviceId());
if (taskInfoList.size() > 0) { if (taskInfo != null) {
Assert.assertNotEquals(taskInfoList.size(), 0); Assert.assertNotNull(taskInfo);
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(taskInfoList)); log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(taskInfo));
} }
} }
} }