@@ -43,6 +43,7 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
private List<HttpBodyCfg> httpResBodyList;
|
||||
private SslKeywordCfg sslCfg;
|
||||
private List<BaseStringCfg> sslList;
|
||||
private List<ComplexkeywordCfg> domainList;
|
||||
|
||||
public AvVoipAccountCfg getVoipAccount() {
|
||||
return voipAccount;
|
||||
@@ -152,6 +153,12 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
|
||||
public void setHttpResBodyList(List<HttpBodyCfg> httpResBodyList) {
|
||||
this.httpResBodyList = httpResBodyList;
|
||||
}
|
||||
public List<ComplexkeywordCfg> getDomainList() {
|
||||
return domainList;
|
||||
}
|
||||
public void setDomainList(List<ComplexkeywordCfg> domainList) {
|
||||
this.domainList = domainList;
|
||||
}
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ package com.nis.domain.maat;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
* @ClassName: ToMaatResult.java
|
||||
* @Description: TODO
|
||||
@@ -20,7 +18,6 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
* @date 2018年3月27日 下午5:10:01
|
||||
* @version V1.0
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
public class ToMaatResult implements Serializable{
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
@@ -35,7 +32,6 @@ public class ToMaatResult implements Serializable{
|
||||
private String msg;
|
||||
private String fromuri;
|
||||
private ResponseData data;
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
public static class ResponseData{
|
||||
private String sourceName;
|
||||
private Integer num;
|
||||
@@ -44,6 +40,13 @@ public class ToMaatResult implements Serializable{
|
||||
private Long rawLen;
|
||||
private String digest;
|
||||
private List configCompileList;
|
||||
private List updateStatCfgList;
|
||||
public List getUpdateStatCfgList() {
|
||||
return updateStatCfgList;
|
||||
}
|
||||
public void setUpdateStatCfgList(List updateStatCfgList) {
|
||||
this.updateStatCfgList = updateStatCfgList;
|
||||
}
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsDomainCfg;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
@@ -58,7 +60,7 @@ public class WebsiteController extends BaseController{
|
||||
@RequiresPermissions(value={"website:dns:config"})
|
||||
public String dnsList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> page = websiteCfgService.findPage(searchPage, cfg);
|
||||
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/website/dnsList";
|
||||
@@ -278,4 +280,77 @@ public class WebsiteController extends BaseController{
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"dnsForm"})
|
||||
@RequiresPermissions(value={"website:dns:config"})
|
||||
public String dnsForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = websiteCfgService.getDnsCfg(Long.parseLong(ids));
|
||||
model.addAttribute("areaCfgs", entity.getAreaCfg());
|
||||
}
|
||||
initFormCondition(model,entity);
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/website/dnsForm";
|
||||
}
|
||||
@RequestMapping(value = {"saveDnsCfg"})
|
||||
@RequiresPermissions(value={"website:dns:config"})
|
||||
public String saveDnsCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
websiteCfgService.saveDnsCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"ajaxDnsSubList"})
|
||||
public String ajaxDnsSubList(Model model,Long cfgId,Integer index) {
|
||||
CfgIndexInfo cfg = websiteCfgService.getDnsCfg(cfgId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getDomainList()!=null){
|
||||
String cfgType = null;
|
||||
for(ComplexkeywordCfg keyword:cfg.getDomainList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"3",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/website/dnsSubList";
|
||||
}
|
||||
@RequestMapping(value = {"updateDnsCfgValid"})
|
||||
@RequiresPermissions(value={"website:dns:config"})
|
||||
public String updateDnsCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
websiteCfgService.updateDnsCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"auditDnsCfg"})
|
||||
@RequiresPermissions(value={"website:dns:audit"})
|
||||
public String auditDnsCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = websiteCfgService.getDnsCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
websiteCfgService.auditDnsCfg(entity,isAudit);
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("dns配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+functionId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsDomainCfg;
|
||||
import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
@@ -51,11 +52,11 @@ public interface WebsiteCfgDao extends CrudDao<CfgIndexInfo>{
|
||||
public void updateCfgValid(BaseCfg entity);
|
||||
public void auditCfg(BaseCfg entity);
|
||||
|
||||
public List<CfgIndexInfo> getDnsList(CfgIndexInfo entity);
|
||||
public List<DnsIpCfg> getDnsIp(CfgIndexInfo entity);
|
||||
public List<DnsDomainCfg> getDnsDomain(CfgIndexInfo entity);
|
||||
public void saveDnsIpCfg(DnsIpCfg entity);
|
||||
public void saveDnsDomainCfg(DnsDomainCfg entity);
|
||||
// public List<CfgIndexInfo> getDnsList(CfgIndexInfo entity);
|
||||
// public List<DnsIpCfg> getDnsIp(CfgIndexInfo entity);
|
||||
public List<ComplexkeywordCfg> getDnsDomainList(CfgIndexInfo entity);
|
||||
// public void saveDnsIpCfg(DnsIpCfg entity);
|
||||
public void saveDnsDomainCfg(ComplexkeywordCfg entity);
|
||||
public void deleteDnsIpCfg(CfgIndexInfo entity);
|
||||
public void deleteDnsDomainCfg(CfgIndexInfo entity);
|
||||
|
||||
|
||||
@@ -346,6 +346,7 @@
|
||||
<include refid="ComplexCfg_Column" />
|
||||
FROM http_res_head_cfg a where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</select>
|
||||
<!-- ssl关键字查询 -->
|
||||
<select id="getSslKewordList" resultMap="stringCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="StrCfg_Column" />
|
||||
@@ -353,6 +354,15 @@
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
and a.cfg_type =#{cfgType,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</select>
|
||||
<!-- dns域名查询 -->
|
||||
<select id="getDnsDomainList" resultMap="complexCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
|
||||
SELECT
|
||||
<include refid="ComplexCfg_Column" />
|
||||
FROM dns_domain_cfg a where compile_id=#{compileId} and function_id=#{functionId}
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
and a.cfg_type =#{cfgType,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</select>
|
||||
<!-- insert cfgIndexInfox -->
|
||||
<insert id="saveCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
@@ -883,4 +893,74 @@
|
||||
<delete id="deleteSslKeywordCfg">
|
||||
delete from ssl_keyword_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
|
||||
<!-- insert dns_domain_cfg表信息 -->
|
||||
<insert id="saveDnsDomainCfg" parameterType="com.nis.domain.configuration.DnsDomainCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into dns_domain_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
district,
|
||||
cfg_keywords,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{district,jdbcType=VARCHAR},
|
||||
#{cfgKeywords,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<!-- 删除dns ip子配置 -->
|
||||
<delete id="deleteDnsIpCfg" >
|
||||
delete from ip_port_cfg where compile_id=#{compileId} and protocol_id=6 and function_id=#{functionId}
|
||||
</delete>
|
||||
<!-- 删除dns域名配置 -->
|
||||
<delete id="deleteDnsDomainCfg">
|
||||
delete from dns_domain_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -26,6 +26,8 @@ import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsDomainCfg;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
@@ -92,6 +94,16 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
|
||||
entity.setAreaCfg(areaCfg);
|
||||
return entity;
|
||||
}
|
||||
public CfgIndexInfo getDnsCfg(Long cfgId){
|
||||
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
|
||||
List<IpPortCfg> ipPortList = websiteCfgDao.getIpPortList(entity);
|
||||
List<ComplexkeywordCfg> domainList = websiteCfgDao.getDnsDomainList(entity);
|
||||
List<AreaIpCfg> areaCfg = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||
entity.setIpPortList(ipPortList);
|
||||
entity.setDomainList(domainList);
|
||||
entity.setAreaCfg(areaCfg);
|
||||
return entity;
|
||||
}
|
||||
public Page<CfgIndexInfo> getWebsiteList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
|
||||
// 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL)
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
@@ -104,7 +116,7 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
|
||||
// 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL)
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
List<CfgIndexInfo> list = websiteCfgDao.getDnsList(entity);
|
||||
List<CfgIndexInfo> list = websiteCfgDao.getWebsiteList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
@@ -642,4 +654,235 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
|
||||
logger.info("ssl配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 保存dns配置
|
||||
* @param entity
|
||||
*/
|
||||
|
||||
public void saveDnsCfg(CfgIndexInfo entity){
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
if(entity.getCfgId()==null){
|
||||
Integer compileId = 0;
|
||||
try {
|
||||
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
||||
if(idList!=null && idList.size()>0){
|
||||
compileId = idList.get(0);
|
||||
}
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
websiteCfgDao.saveCfgIndex(entity);
|
||||
if(entity.getIpPortList()!=null){
|
||||
for(IpPortCfg cfg:entity.getIpPortList()){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
websiteCfgDao.saveIpPortCfg(cfg);
|
||||
}
|
||||
}
|
||||
if(entity.getDomainList()!=null){
|
||||
for(ComplexkeywordCfg cfg:entity.getDomainList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
websiteCfgDao.saveDnsDomainCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null){
|
||||
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
||||
cfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
|
||||
}else{
|
||||
websiteCfgDao.updateCfgIndex(entity);
|
||||
//无效子配置后,再新增子配置
|
||||
websiteCfgDao.deleteDnsIpCfg(entity);
|
||||
websiteCfgDao.deleteDnsDomainCfg(entity);
|
||||
AreaIpCfg area = new AreaIpCfg();
|
||||
area.setCompileId(entity.getCompileId());
|
||||
area.setFunctionId(entity.getFunctionId());
|
||||
areaIpCfgDao.deleteAreaIpCfg(area);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
if(entity.getIpPortList()!=null){
|
||||
for(IpPortCfg cfg:entity.getIpPortList()){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
websiteCfgDao.saveIpPortCfg(cfg);
|
||||
}
|
||||
}
|
||||
if(entity.getDomainList()!=null){
|
||||
for(ComplexkeywordCfg cfg:entity.getDomainList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
websiteCfgDao.saveDnsDomainCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null){
|
||||
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
||||
cfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* dns配置删除
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
*/
|
||||
public void updateDnsCfgValid(Integer isValid,String ids,Integer functionId){
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
entity.setFunctionId(functionId);
|
||||
websiteCfgDao.updateCfgValid(entity);
|
||||
//查询子配置
|
||||
entity = this.getSslCfg(Long.parseLong(id));
|
||||
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
|
||||
IpPortCfg cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
websiteCfgDao.updateCfgValid(cfg);
|
||||
}
|
||||
if(entity.getSslList()!=null && entity.getSslList().size()>0)
|
||||
{
|
||||
SslKeywordCfg cfg = new SslKeywordCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(DnsDomainCfg.getTablename());
|
||||
websiteCfgDao.updateCfgValid(cfg);
|
||||
}
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
|
||||
AreaIpCfg cfg = new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(AreaIpCfg.getTablename());
|
||||
websiteCfgDao.updateCfgValid(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* dns配置审核
|
||||
* @param entity
|
||||
* @param isAudit
|
||||
* @throws MaatConvertException
|
||||
*/
|
||||
public void auditDnsCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||
//修改数据库审核状态信息
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
websiteCfgDao.auditCfg(entity);
|
||||
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
//查询子配置并修改审核状态
|
||||
entity = this.getDnsCfg(entity.getCfgId());
|
||||
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
|
||||
IpPortCfg cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
websiteCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
ipRegionList=map.get("dstList");
|
||||
if(map.get("numRegionList")!=null){
|
||||
numRegionList.addAll(map.get("numRegionList"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entity.getDomainList()!=null && entity.getDomainList().size()>0){
|
||||
DnsDomainCfg cfg = new DnsDomainCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(DnsDomainCfg.getTablename());
|
||||
websiteCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(strRegionList,entity.getSslList(),2,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
|
||||
AreaIpCfg cfg = new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(AreaIpCfg.getTablename());
|
||||
websiteCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(areaIpRegionList,entity.getAreaCfg(),1,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
areaIpRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
|
||||
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
||||
if(isAudit==1){
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("dns配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
logger.info("dns配置下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("dns配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("dns配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user