REM:
1. 修改删除节点接口
2. 增加数据库中根据设备ID删除任务的方法
This commit is contained in:
chenlinghy 2020-07-07 16:13:05 +08:00
parent 3e06e8c776
commit 499ea8f733
3 changed files with 21 additions and 1 deletions

View File

@ -61,4 +61,11 @@ public interface TaskInfoMapper extends Mapper<TaskInfo>, MySqlMapper<TaskInfo>
* @return the task info current status
*/
int getTaskInfoCurrentStatus(Long id);
/**
* Remove task by id.
*
* @param id the id
*/
void removeTaskInfoById(Long id);
}

View File

@ -6,6 +6,7 @@ import com.dispose.common.IPAddrType;
import com.dispose.dispose.DeviceRouter;
import com.dispose.dispose.DisposeEntryManager;
import com.dispose.mapper.DisposeDeviceMapper;
import com.dispose.mapper.TaskInfoMapper;
import com.dispose.pojo.entity.DisposeDevice;
import com.dispose.pojo.po.DisposeDeviceCapacity;
import com.dispose.pojo.po.MulReturnType;
@ -35,6 +36,8 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
private DisposeDeviceMapper disposeDeviceMapper;
@Resource
private UserAccountService userAccountService;
@Resource
private TaskInfoMapper taskInfoMapper;
/**
* Cleanup dispose node cache.
@ -120,6 +123,9 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
return ErrorCode.ERR_NOSUCHDEVICE;
}
//删除task info表中的任务
taskInfoMapper.removeTaskInfoById(dev.getId());
// 删除数据库和缓存中内容
disposeDeviceMapper.delDisposeDeviceByIp(ipAddr);
disposeDevMap.remove(ipAddr);
@ -146,7 +152,7 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
try {
// 获取处置设备硬件访问接口
dp = DeviceRouter.getDeviceRouterFactory(dev.getType(), dev.getIpAddr());
dp = DeviceRouter.deviceRouterFactory(dev);
// 判断设备是否在线
if (!dp.getDeviceLinkStatus()) {

View File

@ -34,4 +34,11 @@
WHERE id = #{id, jdbcType=INTEGER}
</select>
<delete id="removeTaskInfoById" parameterType="java.lang.Long">
DELETE
task_info
FROM task_info
WHERE task_info.deviceId = #{deviceId}
</delete>
</mapper>