...
|
...
|
@@ -123,4 +123,54 @@ public class HostInfoServiceImpl implements IHostInfoService { |
|
|
return hostInfoMapper.selectHostInfosByIps(ips);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 将tag更新为空
|
|
|
* @param
|
|
|
*/
|
|
|
@Override
|
|
|
public BaseResponse updateTagByIps(List<HostInfo> hostInfoList){
|
|
|
BaseResponse resp = new BaseResponse();
|
|
|
String message = "";
|
|
|
if(hostInfoList != null && hostInfoList.size() > 0){
|
|
|
for(HostInfo host : hostInfoList){
|
|
|
try{
|
|
|
hostInfoMapper.updateHostInfoByIp(host);
|
|
|
}catch(Exception e){
|
|
|
logger.error("updateTagByIps error: ",e);
|
|
|
message = message + "updateTagByIps error --ip:" + host.getHostIp() + ";";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(!"".equals(message)){
|
|
|
resp.setCode(201);
|
|
|
resp.setMessage(message);
|
|
|
}
|
|
|
return resp;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public BaseResponse saveHostListInfo(List<HostInfo> hostInfos) {
|
|
|
BaseResponse resp = new BaseResponse();
|
|
|
String message = "";
|
|
|
for(HostInfo host : hostInfos){
|
|
|
HostInfo h = hostInfoMapper.selectByHostIp(host.getHostIp());
|
|
|
try{
|
|
|
if(h != null){//存在则更新
|
|
|
hostInfoMapper.updateHostInfoByIp(host);
|
|
|
}else{
|
|
|
hostInfoMapper.insert(host);
|
|
|
}
|
|
|
}catch(Exception e){
|
|
|
logger.error("saveHostListInfo error: ",e);
|
|
|
message = message + "saveHostListInfo error --ip:" + host.getHostIp() + ";";
|
|
|
}
|
|
|
}
|
|
|
if(!"".equals(message)){
|
|
|
resp.setCode(201);
|
|
|
resp.setMessage(message);
|
|
|
}
|
|
|
return new BaseResponse();
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|