修复bug,DNS欺骗ip删除传入fake id
This commit is contained in:
@@ -141,6 +141,7 @@ public class DnsIpCfg extends BaseEntity<DnsIpCfg> {
|
|||||||
private String lable;
|
private String lable;
|
||||||
|
|
||||||
private String cfgIds;
|
private String cfgIds;
|
||||||
|
private String fakeIds;
|
||||||
|
|
||||||
public String getCfgIds() {
|
public String getCfgIds() {
|
||||||
return cfgIds;
|
return cfgIds;
|
||||||
@@ -348,5 +349,19 @@ public class DnsIpCfg extends BaseEntity<DnsIpCfg> {
|
|||||||
public void setSearchAuditTimeEnd(Date searchAuditTimeEnd) {
|
public void setSearchAuditTimeEnd(Date searchAuditTimeEnd) {
|
||||||
this.searchAuditTimeEnd = searchAuditTimeEnd;
|
this.searchAuditTimeEnd = searchAuditTimeEnd;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* fakeIds
|
||||||
|
* @return fakeIds
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getFakeIds() {
|
||||||
|
return fakeIds;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param fakeIds the fakeIds to set
|
||||||
|
*/
|
||||||
|
public void setFakeIds(String fakeIds) {
|
||||||
|
this.fakeIds = fakeIds;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,10 +78,10 @@ public class DnsIpCfgController extends BaseController {
|
|||||||
@RequestMapping("delete")
|
@RequestMapping("delete")
|
||||||
public String delete(Model model, HttpServletRequest request,
|
public String delete(Model model, HttpServletRequest request,
|
||||||
HttpServletResponse response, DnsIpCfg dnsIpCfg) {
|
HttpServletResponse response, DnsIpCfg dnsIpCfg) {
|
||||||
String cfgIds = dnsIpCfg.getCfgIds();
|
String fakeIds = dnsIpCfg.getFakeIds();
|
||||||
if (!StringUtils.isEmpty(cfgIds)) {
|
if (!StringUtils.isEmpty(fakeIds)) {
|
||||||
try {
|
try {
|
||||||
dnsIpCfgService.delete(cfgIds);
|
dnsIpCfgService.delete(fakeIds);
|
||||||
addMessage(model, "delete_success");
|
addMessage(model, "delete_success");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("删除失败", e);
|
logger.error("删除失败", e);
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.nis.web.dao.configuration;
|
package com.nis.web.dao.configuration;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import com.nis.domain.configuration.DnsIpCfg;
|
import com.nis.domain.configuration.DnsIpCfg;
|
||||||
import com.nis.web.dao.CrudDao;
|
import com.nis.web.dao.CrudDao;
|
||||||
import com.nis.web.dao.MyBatisDao;
|
import com.nis.web.dao.MyBatisDao;
|
||||||
|
|
||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface DnsIpCfgDao extends CrudDao<DnsIpCfg> {
|
public interface DnsIpCfgDao extends CrudDao<DnsIpCfg> {
|
||||||
|
public int deleteByFakeId(@Param("fakeId") String fakeIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,5 +141,12 @@
|
|||||||
is_valid=0
|
is_valid=0
|
||||||
where cfg_id=#{cfgId}
|
where cfg_id=#{cfgId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="deleteByFakeId">
|
||||||
|
update
|
||||||
|
dns_ip_cfg
|
||||||
|
set
|
||||||
|
is_valid=0
|
||||||
|
where fake_id =#{fakeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -16,13 +17,13 @@ import com.nis.domain.maat.MaatDnsIpCfg;
|
|||||||
import com.nis.domain.maat.ToMaatDnsIpBean;
|
import com.nis.domain.maat.ToMaatDnsIpBean;
|
||||||
import com.nis.main.ConvertTool;
|
import com.nis.main.ConvertTool;
|
||||||
import com.nis.util.Collections3;
|
import com.nis.util.Collections3;
|
||||||
import com.nis.util.StringUtil;
|
|
||||||
import com.nis.web.dao.configuration.DnsIpCfgDao;
|
import com.nis.web.dao.configuration.DnsIpCfgDao;
|
||||||
import com.nis.web.service.CrudService;
|
import com.nis.web.service.CrudService;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DnsIpCfgService extends CrudService<DnsIpCfgDao, DnsIpCfg>{
|
public class DnsIpCfgService extends CrudService<DnsIpCfgDao, DnsIpCfg>{
|
||||||
|
@Autowired
|
||||||
|
private DnsIpCfgDao dnsIpCfgDao;
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||||
public void save(DnsIpCfg dnsIpCfg) {
|
public void save(DnsIpCfg dnsIpCfg) {
|
||||||
@@ -72,27 +73,24 @@ public class DnsIpCfgService extends CrudService<DnsIpCfgDao, DnsIpCfg>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(String cfgIds) {
|
public void delete(String fakeIds) {
|
||||||
if(cfgIds.endsWith(","))cfgIds=cfgIds.substring(0,cfgIds.lastIndexOf(","));
|
if(fakeIds.endsWith(","))fakeIds=fakeIds.substring(0,fakeIds.lastIndexOf(","));
|
||||||
String[] cfgIdsArr = cfgIds.split(",");
|
String[] fakeIdsArr = fakeIds.split(",");
|
||||||
for (String cfgId : cfgIdsArr) {
|
for (String fakeId : fakeIdsArr) {
|
||||||
DnsIpCfg d = new DnsIpCfg();
|
dnsIpCfgDao.deleteByFakeId(fakeId);
|
||||||
d.setCfgId(Long.valueOf(cfgId));
|
|
||||||
dao.delete(d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//给配置转换层发送、接收结果
|
//给配置转换层发送、接收结果
|
||||||
String sendJson = "{\"fakeId\":[" + cfgIds + "]}";
|
String sendJson = "{\"fakeId\":[" + fakeIds + "]}";
|
||||||
logger.info("准备下发配置:" + sendJson);
|
logger.info("准备下发配置:" + sendJson);
|
||||||
Boolean recv = true;
|
Boolean recv = true;
|
||||||
try {
|
try {
|
||||||
recv = new ConvertTool().invalidDNSIPConfig(sendJson);
|
recv = new ConvertTool().invalidDNSIPConfig(sendJson);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("欺骗ip配置删除失败:通讯异常,cfgIds:" + cfgIds, e);
|
logger.error("欺骗ip配置删除失败:通讯异常,fakeIds:" + fakeIds, e);
|
||||||
throw new RuntimeException("欺骗ip配置删除失败:通讯失败");
|
throw new RuntimeException("欺骗ip配置删除失败:通讯失败");
|
||||||
}
|
}
|
||||||
if (!recv) {
|
if (!recv) {
|
||||||
logger.error("欺骗ip配置删除失败,收到结果 " + recv + " ,cfgIds:" + cfgIds);
|
logger.error("欺骗ip配置删除失败,收到结果 " + recv + " ,fakeIds:" + fakeIds);
|
||||||
throw new RuntimeException("欺骗ip配置删除失败");
|
throw new RuntimeException("欺骗ip配置删除失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,8 +69,9 @@
|
|||||||
checkboxes.each(function(){
|
checkboxes.each(function(){
|
||||||
ids = ids + $(this).attr("id") + ",";
|
ids = ids + $(this).attr("id") + ",";
|
||||||
});
|
});
|
||||||
|
console.log(ids);
|
||||||
if (confirm("<spring:message code='confirm_message'/>")) {
|
if (confirm("<spring:message code='confirm_message'/>")) {
|
||||||
$("#cfgIds").val(ids);
|
$("#fakeIds").val(ids);
|
||||||
$("#searchForm").attr("action","${ctx}/cfg/dnsIp/delete");
|
$("#searchForm").attr("action","${ctx}/cfg/dnsIp/delete");
|
||||||
$("#searchForm").submit();
|
$("#searchForm").submit();
|
||||||
}
|
}
|
||||||
@@ -105,6 +106,7 @@
|
|||||||
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
||||||
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${dnsIpCfg.isFilterAction }"/>
|
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${dnsIpCfg.isFilterAction }"/>
|
||||||
<input id="cfgIds" name="cfgIds" type="hidden"/>
|
<input id="cfgIds" name="cfgIds" type="hidden"/>
|
||||||
|
<input id="fakeIds" name="fakeIds" type="hidden"/>
|
||||||
<!-- 搜索内容与操作按钮栏 -->
|
<!-- 搜索内容与操作按钮栏 -->
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
@@ -270,7 +272,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<c:forEach items="${page.list }" var="dnsIpCfg" varStatus="status" step="1">
|
<c:forEach items="${page.list }" var="dnsIpCfg" varStatus="status" step="1">
|
||||||
<td><input type="checkbox" class="i-checks child-checks" id="${dnsIpCfg.cfgId}" value="${dnsIpCfg.isAudit}"></td>
|
<td><input type="checkbox" class="i-checks child-checks" id="${dnsIpCfg.fakeId}" value="${dnsIpCfg.isAudit}"></td>
|
||||||
<td>${dnsIpCfg.cfgDesc }</td>
|
<td>${dnsIpCfg.cfgDesc }</td>
|
||||||
<td>V${dnsIpCfg.ipType }</td>
|
<td>V${dnsIpCfg.ipType }</td>
|
||||||
<td>${dnsIpCfg.srcIp }</td>
|
<td>${dnsIpCfg.srcIp }</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user