ct查询ip接口
parent
1876740e27
commit
4cc086835a
|
@ -27,15 +27,15 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
register: true
|
register: true
|
||||||
enable: true
|
enable: true
|
||||||
instance-host: 10.40.20.48
|
instance-host: 127.0.0.1
|
||||||
instance-port: ${server.port}
|
instance-port: ${server.port}
|
||||||
root: ${spring.cloud.zookeeper.home}/services
|
root: ${spring.cloud.zookeeper.home}/services
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
dialect: mysql
|
dialect: dm
|
||||||
url: jdbc:mysql://10.20.12.56:3306/cmp?characterEncoding=utf8&useSSL=false
|
url: jdbc:dm://23.33.3.28:5236/cmp?characterEncoding=utf8&useSSL=false
|
||||||
username: cmp
|
username: cmp
|
||||||
password: Gy2VghUgWHszx8gLFT4etT9ZVOukJi73KoG1q3Oz/DAz5h2mFVVunjcyaaKT9tMPsBgoWBFRmrYbhgqJqT/Q8A==
|
password: BoYunCmp@v587
|
||||||
initialSize: '2'
|
initialSize: '2'
|
||||||
maxActive: '30'
|
maxActive: '30'
|
||||||
minIdle: '2'
|
minIdle: '2'
|
||||||
|
@ -54,12 +54,12 @@ spring:
|
||||||
timeBetweenEvictionRunsMillis: '10000'
|
timeBetweenEvictionRunsMillis: '10000'
|
||||||
minEvictableIdleTimeMillis: '30001'
|
minEvictableIdleTimeMillis: '30001'
|
||||||
asyncCloseConnectionEnable: 'true'
|
asyncCloseConnectionEnable: 'true'
|
||||||
filters: config,stat,wall,log4j
|
filters: config,stat,log4j
|
||||||
publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJfVJOpXYGy8aBCk3zEoKKQDTVCCvJwhhithfY/I5PUvzFBAYygunmuCtUhzPUZ+1RJQds0Q4fu07m5mr5kv5ocCAwEAAQ==
|
publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJfVJOpXYGy8aBCk3zEoKKQDTVCCvJwhhithfY/I5PUvzFBAYygunmuCtUhzPUZ+1RJQds0Q4fu07m5mr5kv5ocCAwEAAQ==
|
||||||
connectionProperties: config.decrypt=true;config.decrypt.key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJfVJOpXYGy8aBCk3zEoKKQDTVCCvJwhhithfY/I5PUvzFBAYygunmuCtUhzPUZ+1RJQds0Q4fu07m5mr5kv5ocCAwEAAQ==;druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
connectionProperties: config.decrypt=false;config.decrypt.key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJfVJOpXYGy8aBCk3zEoKKQDTVCCvJwhhithfY/I5PUvzFBAYygunmuCtUhzPUZ+1RJQds0Q4fu07m5mr5kv5ocCAwEAAQ==;druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||||
use-global-data-source-stat: 'true'
|
use-global-data-source-stat: 'true'
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: 10.20.12.56
|
host: 23.33.3.28
|
||||||
port: 5672
|
port: 5672
|
||||||
username: admin
|
username: admin
|
||||||
password: BOCLOUD@CoU6oY/zuAoBbu6cdgOKlA==
|
password: BOCLOUD@CoU6oY/zuAoBbu6cdgOKlA==
|
||||||
|
@ -71,7 +71,7 @@ spring:
|
||||||
checkTemplateLocation: 'false'
|
checkTemplateLocation: 'false'
|
||||||
redis:
|
redis:
|
||||||
# standalone
|
# standalone
|
||||||
host: 10.20.12.56
|
host: 23.33.3.28
|
||||||
port: 6379
|
port: 6379
|
||||||
timeout: 60000ms
|
timeout: 60000ms
|
||||||
password: BOCLOUD@CoU6oY/zuAoBbu6cdgOKlA==
|
password: BOCLOUD@CoU6oY/zuAoBbu6cdgOKlA==
|
||||||
|
@ -89,7 +89,7 @@ spring:
|
||||||
allow-circular-references: true
|
allow-circular-references: true
|
||||||
zk:
|
zk:
|
||||||
server:
|
server:
|
||||||
url: 10.20.12.56:2181
|
url: 127.0.0.1:2181
|
||||||
username: bocloud
|
username: bocloud
|
||||||
password: BOCLOUD@CoU6oY/zuAoBbu6cdgOKlA==
|
password: BOCLOUD@CoU6oY/zuAoBbu6cdgOKlA==
|
||||||
conn:
|
conn:
|
||||||
|
@ -98,7 +98,7 @@ zk:
|
||||||
timeout: '50000'
|
timeout: '50000'
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logback-spring.xml
|
config: classpath:logback-spring.xml
|
||||||
dir: /log/services
|
dir: /Users/guyuliang/project/EFC
|
||||||
level:
|
level:
|
||||||
root: info
|
root: info
|
||||||
com:
|
com:
|
||||||
|
@ -123,3 +123,6 @@ nim:
|
||||||
#Cmp Repo
|
#Cmp Repo
|
||||||
cmp:
|
cmp:
|
||||||
repo: http://192.168.6.209/yum
|
repo: http://192.168.6.209/yum
|
||||||
|
|
||||||
|
|
||||||
|
regex:
|
|
@ -8,15 +8,19 @@ import com.bocloud.common.utils.ListTool;
|
||||||
import com.bocloud.common.utils.MapTools;
|
import com.bocloud.common.utils.MapTools;
|
||||||
import com.bocloud.database.core.intf.impl.BasicGenericDao;
|
import com.bocloud.database.core.intf.impl.BasicGenericDao;
|
||||||
import com.bocloud.database.utils.QueryBuilder;
|
import com.bocloud.database.utils.QueryBuilder;
|
||||||
|
import com.bocloud.ims.entity.model.SimpleIpModel;
|
||||||
import com.bocloud.ims.entity.resource.Ip;
|
import com.bocloud.ims.entity.resource.Ip;
|
||||||
import com.bocloud.ims.entity.resource.Ip.IpStatus;
|
import com.bocloud.ims.entity.resource.Ip.IpStatus;
|
||||||
import com.bocloud.orm.OrmBasicDaoImpl;
|
import com.bocloud.orm.OrmBasicDaoImpl;
|
||||||
import com.bocloud.orm.OrmGenericDaoImpl;
|
import com.bocloud.orm.OrmGenericDaoImpl;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -179,6 +183,23 @@ public class IpRepository extends OrmGenericDaoImpl<Ip, Long> {
|
||||||
return this.list(Ip.class, sql, params);
|
return this.list(Ip.class, sql, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<SimpleIpModel> listByPool(Long poolId, String status) {
|
||||||
|
String sql = "select id,ip,mask,gateway,dns,vendor_id,target,catalog,pool_id,status from ip where pool_id = :poolId and status = :status";
|
||||||
|
Map<String, Object> params = MapTools.simpleMap("poolId", poolId);
|
||||||
|
params.put("status", status);
|
||||||
|
List<Ip> ips = this.list(Ip.class, sql, params);
|
||||||
|
List<SimpleIpModel> list = new ArrayList<>();
|
||||||
|
if (!ObjectUtils.isEmpty(ips)) {
|
||||||
|
for (Ip ip : ips) {
|
||||||
|
SimpleIpModel model = new SimpleIpModel();
|
||||||
|
BeanUtils.copyProperties(ip, model);
|
||||||
|
list.add(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean delete(Long target, String catalog, Long vendorId) {
|
public boolean delete(Long target, String catalog, Long vendorId) {
|
||||||
// 5.6版本IP池中的IP是不允许被删除掉的 #PBSM-13169 bug
|
// 5.6版本IP池中的IP是不允许被删除掉的 #PBSM-13169 bug
|
||||||
// 初步怀疑是调用delete方法将IP删除导致的,因为调用的地方有点多,版本今天要发布,所以直接修改源头,后续该部分逻辑需要移到相关业务层
|
// 初步怀疑是调用delete方法将IP删除导致的,因为调用的地方有点多,版本今天要发布,所以直接修改源头,后续该部分逻辑需要移到相关业务层
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.bocloud.common.utils.GridHelper;
|
||||||
import com.bocloud.common.utils.IDFactory;
|
import com.bocloud.common.utils.IDFactory;
|
||||||
import com.bocloud.common.utils.ListTool;
|
import com.bocloud.common.utils.ListTool;
|
||||||
import com.bocloud.entity.bean.GenericEntity;
|
import com.bocloud.entity.bean.GenericEntity;
|
||||||
|
import com.bocloud.ims.entity.model.SimpleIpModel;
|
||||||
import com.bocloud.ims.entity.params.IpPatchParams;
|
import com.bocloud.ims.entity.params.IpPatchParams;
|
||||||
import com.bocloud.ims.entity.resource.*;
|
import com.bocloud.ims.entity.resource.*;
|
||||||
import com.bocloud.ims.entity.resource.Ip.IpStatus;
|
import com.bocloud.ims.entity.resource.Ip.IpStatus;
|
||||||
|
@ -144,6 +145,11 @@ public class IpServiceImpl implements IpService {
|
||||||
} else if ("checkIp".equalsIgnoreCase(object.getString("condition"))) {
|
} else if ("checkIp".equalsIgnoreCase(object.getString("condition"))) {
|
||||||
List<String> ips = JSONArray.parseArray(object.getString("ips"), String.class);
|
List<String> ips = JSONArray.parseArray(object.getString("ips"), String.class);
|
||||||
return this.checkIp(object.getLong("poolId"), ips, context);
|
return this.checkIp(object.getLong("poolId"), ips, context);
|
||||||
|
}else if ("listByPoolAndStatus".equalsIgnoreCase(object.getString("condition"))) {
|
||||||
|
Long poolId = object.getLong("poolId");
|
||||||
|
String status = object.getString("status");
|
||||||
|
List<SimpleIpModel> ipList = ipRepository.listByPool(poolId, status);
|
||||||
|
return new BocloudResult<>(true, ipList, "查询成功");
|
||||||
}
|
}
|
||||||
return new BocloudResult<>(false, "参数格式错误");
|
return new BocloudResult<>(false, "参数格式错误");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue