2018-02-27 15:31:30 +08:00
|
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
|
2018-04-11 16:44:45 +08:00
|
|
|
|
import java.util.ArrayList;
|
2018-05-24 19:33:59 +08:00
|
|
|
|
import java.util.Date;
|
2018-04-09 16:38:45 +08:00
|
|
|
|
import java.util.List;
|
2018-05-30 10:50:22 +08:00
|
|
|
|
import java.util.Map;
|
2018-04-09 16:38:45 +08:00
|
|
|
|
|
2018-05-24 19:33:59 +08:00
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2018-05-30 10:50:22 +08:00
|
|
|
|
import org.springframework.beans.BeanUtils;
|
2018-02-27 15:31:30 +08:00
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
2018-08-25 01:55:10 +08:00
|
|
|
|
import com.nis.domain.Page;
|
2018-06-22 16:30:59 +08:00
|
|
|
|
import com.nis.domain.configuration.AreaIpCfg;
|
2018-04-11 16:44:45 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-08-25 01:55:10 +08:00
|
|
|
|
import com.nis.domain.configuration.CfgIndexInfo;
|
2018-05-24 19:33:59 +08:00
|
|
|
|
import com.nis.domain.configuration.HttpUrlCfg;
|
2018-10-18 11:24:12 +08:00
|
|
|
|
import com.nis.domain.configuration.IpPortCfg;
|
2018-08-25 01:55:10 +08:00
|
|
|
|
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
2018-05-30 10:50:22 +08:00
|
|
|
|
import com.nis.domain.maat.MaatCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.IpCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.StringCfg;
|
2018-10-18 11:24:12 +08:00
|
|
|
|
import com.nis.domain.specific.ConfigGroupInfo;
|
2018-06-04 14:42:52 +08:00
|
|
|
|
import com.nis.domain.maat.ToMaatBean;
|
|
|
|
|
|
import com.nis.domain.maat.ToMaatResult;
|
2018-05-24 19:33:59 +08:00
|
|
|
|
import com.nis.exceptions.MaatConvertException;
|
|
|
|
|
|
import com.nis.util.ConfigServiceUtil;
|
2018-03-26 14:43:58 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-05-24 19:33:59 +08:00
|
|
|
|
import com.nis.util.StringUtil;
|
2018-06-22 16:30:59 +08:00
|
|
|
|
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
2018-06-29 12:44:33 +08:00
|
|
|
|
import com.nis.web.dao.configuration.DomainDao;
|
2018-02-27 15:31:30 +08:00
|
|
|
|
import com.nis.web.dao.configuration.StringCfgDao;
|
2018-08-25 01:55:10 +08:00
|
|
|
|
import com.nis.web.dao.configuration.WebsiteCfgDao;
|
|
|
|
|
|
import com.nis.web.security.UserUtils;
|
2018-02-27 15:31:30 +08:00
|
|
|
|
import com.nis.web.service.CrudService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* String相关配置事务类
|
|
|
|
|
|
* @author dell
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Service
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
DomainDao domainDao;
|
2018-02-27 15:31:30 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
protected StringCfgDao stringCfgDao;
|
2018-06-22 16:30:59 +08:00
|
|
|
|
@Autowired
|
2018-08-25 01:55:10 +08:00
|
|
|
|
protected WebsiteCfgDao websiteCfgDao;
|
|
|
|
|
|
@Autowired
|
2018-06-22 16:30:59 +08:00
|
|
|
|
protected AreaIpCfgDao areaIpCfgDao;
|
2018-06-29 12:44:33 +08:00
|
|
|
|
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public void addStringCfg(HttpUrlCfg cfg){
|
2018-06-22 16:30:59 +08:00
|
|
|
|
//调用服务接口获取compileId
|
|
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> compileIds = ConfigServiceUtil.getId(1,1);
|
|
|
|
|
|
if(!StringUtil.isEmpty(compileIds)){
|
|
|
|
|
|
compileId = compileIds.get(0);
|
|
|
|
|
|
}
|
2018-08-22 15:07:13 +08:00
|
|
|
|
} catch (MaatConvertException e) {
|
2018-06-22 16:30:59 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
if(compileId!=0){
|
|
|
|
|
|
cfg.setCompileId(compileId);
|
|
|
|
|
|
setAreaEffectiveIds(cfg);
|
|
|
|
|
|
if(cfg.getAreaCfg()!=null&&cfg.getAreaCfg().size()>0){
|
|
|
|
|
|
for(AreaIpCfg c:cfg.getAreaCfg()){
|
|
|
|
|
|
c.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
|
|
|
|
|
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
|
|
|
|
|
|
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
|
|
|
|
|
|
c.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
}
|
|
|
|
|
|
this.saveIpBatch(cfg.getAreaCfg());
|
|
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
if(cfg instanceof HttpUrlCfg){
|
|
|
|
|
|
domainDao.insert((HttpUrlCfg)cfg);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
stringCfgDao.insert(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 16:30:59 +08:00
|
|
|
|
}else{
|
2018-08-22 15:07:13 +08:00
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>: compileId is 0");
|
2018-06-22 16:30:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-06-22 16:30:59 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public void updateStringCfg(HttpUrlCfg cfg){
|
2018-06-22 16:30:59 +08:00
|
|
|
|
AreaIpCfg area=new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(cfg.getCompileId());
|
|
|
|
|
|
area.setFunctionId(cfg.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
//区域IPsetAreaEffectiveIds设置
|
|
|
|
|
|
setAreaEffectiveIds(cfg);
|
|
|
|
|
|
Date date=new Date();
|
|
|
|
|
|
if(cfg.getAreaCfg()!=null&&cfg.getAreaCfg().size()>0){
|
|
|
|
|
|
for(AreaIpCfg c:cfg.getAreaCfg()){
|
|
|
|
|
|
c.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
|
|
|
|
|
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
|
|
|
|
|
|
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
|
|
|
|
|
|
c.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
c.setCreatorId(cfg.getCurrentUser().getId());
|
|
|
|
|
|
c.setCreateTime(date);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.saveIpBatch(cfg.getAreaCfg());
|
|
|
|
|
|
}
|
2018-08-08 17:45:14 +08:00
|
|
|
|
if(cfg instanceof HttpUrlCfg && cfg.getCfgId() == null){
|
2018-06-29 12:44:33 +08:00
|
|
|
|
domainDao.insert((HttpUrlCfg)cfg);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
stringCfgDao.update(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 16:30:59 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public void auditWhiteDomain(HttpUrlCfg cfg) throws Exception{
|
|
|
|
|
|
List<HttpUrlCfg> beans=new ArrayList<>();
|
2018-05-28 10:18:03 +08:00
|
|
|
|
beans.add(cfg);
|
2018-07-03 15:54:14 +08:00
|
|
|
|
domainDao.audit(cfg);
|
2018-06-04 14:42:52 +08:00
|
|
|
|
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<>();
|
2018-05-30 10:50:22 +08:00
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
MaatCfg maatCfg = new MaatCfg();
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(cfg, maatCfg);
|
2018-06-29 12:44:33 +08:00
|
|
|
|
if(cfg.getIsAudit()==Constants.AUDIT_YES){
|
2018-05-30 10:50:22 +08:00
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
Map<String,List> map = cfgConvert(strRegionList,beans,2,cfg,groupRelationList);
|
|
|
|
|
|
groupRelationList=map.get("groupList");
|
2018-06-04 14:42:52 +08:00
|
|
|
|
strRegionList=map.get("dstList");
|
2018-05-30 10:50:22 +08:00
|
|
|
|
maatCfg.setAreaEffectiveIds("0");
|
|
|
|
|
|
maatCfg.setAction(cfg.getAction());
|
|
|
|
|
|
maatCfg.setAuditTime(cfg.getAuditTime());
|
|
|
|
|
|
maatCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
maatCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
maatCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
maatCfg.setDigestRegionList(digestRegionList);
|
|
|
|
|
|
maatCfg.setGroupRelationList(groupRelationList);
|
|
|
|
|
|
maatCfg.setGroupNum(groupRelationList.size());
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
|
|
|
|
|
maatBean.setAuditTime(cfg.getAuditTime());
|
|
|
|
|
|
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
2018-05-28 10:18:03 +08:00
|
|
|
|
//调用服务接口下发配置数据
|
2018-05-30 10:50:22 +08:00
|
|
|
|
String json=gsonToJson(maatBean);
|
2018-06-06 11:00:33 +08:00
|
|
|
|
logger.info("域名白名单配置:"+json);
|
2018-05-28 10:18:03 +08:00
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
try {
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-06-04 14:42:52 +08:00
|
|
|
|
logger.info("域名白名单配置下发响应信息:"+result.getMsg());
|
2018-05-28 10:18:03 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-06-04 14:42:52 +08:00
|
|
|
|
logger.info("域名白名单配置下发失败");
|
2018-06-25 11:10:55 +08:00
|
|
|
|
throw e;
|
2018-05-28 10:18:03 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
}else if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){
|
2018-05-30 10:50:22 +08:00
|
|
|
|
maatCfg.setCompileId(cfg.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(cfg.getServiceId());
|
2018-06-29 12:44:33 +08:00
|
|
|
|
maatCfg.setIsValid(Constants.VALID_NO);//无效
|
2018-05-30 10:50:22 +08:00
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
|
|
|
|
|
maatBean.setAuditTime(cfg.getAuditTime());
|
|
|
|
|
|
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
2018-05-28 10:18:03 +08:00
|
|
|
|
//调用服务接口取消配置
|
2018-06-04 14:42:52 +08:00
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("域名白名单配置参数:"+json);
|
2018-05-24 19:33:59 +08:00
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
try {
|
2018-06-04 14:42:52 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("域名白名单取消配置响应信息:"+result.getMsg());
|
2018-05-24 19:33:59 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-06-04 14:42:52 +08:00
|
|
|
|
logger.info("域名白名单取消配置失败");
|
2018-06-25 11:10:55 +08:00
|
|
|
|
throw e;
|
2018-05-24 19:33:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public void auditDomain(HttpUrlCfg cfg) throws Exception{
|
|
|
|
|
|
List<HttpUrlCfg> beans=new ArrayList<>();
|
2018-06-22 16:30:59 +08:00
|
|
|
|
beans.add(cfg);
|
2018-07-03 15:54:14 +08:00
|
|
|
|
domainDao.audit(cfg);
|
2018-06-22 16:30:59 +08:00
|
|
|
|
List<BaseIpCfg> beans1=new ArrayList<>();
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(cfg.getCompileId());
|
|
|
|
|
|
for(AreaIpCfg area:areaIpCfgList){
|
|
|
|
|
|
BeanUtils.copyProperties(cfg,area ,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
|
|
|
|
|
beans1.add(area);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.auditIpBatch(beans1);
|
|
|
|
|
|
|
|
|
|
|
|
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<>();
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
MaatCfg maatCfg = new MaatCfg();
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(cfg, maatCfg);
|
2018-06-29 12:44:33 +08:00
|
|
|
|
if(cfg.getIsAudit()==Constants.AUDIT_YES){
|
2018-06-22 16:30:59 +08:00
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
Map<String,List> map = cfgConvert(strRegionList,beans,2,cfg,groupRelationList);
|
|
|
|
|
|
groupRelationList=map.get("groupList");
|
|
|
|
|
|
strRegionList=map.get("dstList");
|
|
|
|
|
|
numRegionList=map.get("numRegionList")==null?new ArrayList<>():map.get("numRegionList");
|
|
|
|
|
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,beans1,1,cfg,groupRelationList);
|
|
|
|
|
|
groupRelationList=areaMap.get("groupList");
|
|
|
|
|
|
areaIpRegionList=areaMap.get("dstList");
|
|
|
|
|
|
maatCfg.setAreaEffectiveIds(StringUtils.isBlank(cfg.getAreaEffectiveIds())?"0":cfg.getAreaEffectiveIds());
|
2018-06-23 14:34:27 +08:00
|
|
|
|
if(cfg.getServiceId().intValue()==Constants.SERVICE_PXY_DOMAIN_INTERCEPT){
|
2018-07-20 16:18:22 +08:00
|
|
|
|
String region=Constants.USERREGION_DOMAIN_ID+"="+cfg.getCompileId().intValue()+
|
|
|
|
|
|
Constants.USER_REGION_SPLIT+Constants.USERREGION_DOMAIN_STR+"="+this.keywordsEscape(cfg.getCfgKeywords());
|
2018-06-29 12:44:33 +08:00
|
|
|
|
maatCfg.setUserRegion(region);
|
|
|
|
|
|
}else if(Constants.SERVICE_DOMAIN_RATELIMIT==cfg.getServiceId().intValue()){
|
|
|
|
|
|
String region=Constants.USERREGION_RATE_LIMIT+"="+cfg.getRatelimit()+
|
2018-07-20 16:18:22 +08:00
|
|
|
|
Constants.USER_REGION_SPLIT+Constants.USERREGION_DOMAIN_ID+"="+cfg.getCompileId().intValue()+
|
|
|
|
|
|
Constants.USER_REGION_SPLIT+Constants.USERREGION_DOMAIN_STR+"="+this.keywordsEscape(cfg.getCfgKeywords());
|
2018-06-29 12:44:33 +08:00
|
|
|
|
maatCfg.setUserRegion(region);
|
2018-06-23 14:34:27 +08:00
|
|
|
|
}
|
2018-06-22 16:30:59 +08:00
|
|
|
|
maatCfg.setAction(cfg.getAction());
|
|
|
|
|
|
maatCfg.setAuditTime(cfg.getAuditTime());
|
|
|
|
|
|
maatCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
maatCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
maatCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
maatCfg.setDigestRegionList(digestRegionList);
|
|
|
|
|
|
maatCfg.setGroupRelationList(groupRelationList);
|
|
|
|
|
|
maatCfg.setGroupNum(groupRelationList.size());
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
|
|
|
|
|
maatBean.setAuditTime(cfg.getAuditTime());
|
|
|
|
|
|
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
//调用服务接口下发配置数据
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("域名配置:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
try {
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("域名配置下发响应信息:"+result.getMsg());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("域名配置下发失败");
|
2018-06-25 11:10:55 +08:00
|
|
|
|
throw e;
|
2018-06-22 16:30:59 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
}else if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){
|
2018-06-22 16:30:59 +08:00
|
|
|
|
maatCfg.setCompileId(cfg.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(cfg.getServiceId());
|
2018-06-29 12:44:33 +08:00
|
|
|
|
maatCfg.setIsValid(Constants.VALID_NO);//无效
|
2018-06-22 16:30:59 +08:00
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
|
|
|
|
|
maatBean.setAuditTime(cfg.getAuditTime());
|
|
|
|
|
|
maatBean.setCreatorName(cfg.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("域名配置参数:"+json);
|
|
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
try {
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("域名取消配置响应信息:"+result.getMsg());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("域名取消配置失败");
|
2018-06-25 11:10:55 +08:00
|
|
|
|
throw e;
|
2018-06-22 16:30:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-06-07 13:27:57 +08:00
|
|
|
|
|
2018-05-24 19:33:59 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void deleteWhiteDomain(String ids){
|
2018-06-29 12:44:33 +08:00
|
|
|
|
List<HttpUrlCfg> cfgs=new ArrayList<HttpUrlCfg>();
|
2018-05-24 19:33:59 +08:00
|
|
|
|
Date date =new Date();
|
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
|
for(String idStr:ids.split(",")){
|
|
|
|
|
|
if(StringUtils.isNotBlank(idStr)){
|
2018-06-29 12:44:33 +08:00
|
|
|
|
HttpUrlCfg cfg=new HttpUrlCfg();
|
2018-05-24 19:33:59 +08:00
|
|
|
|
cfg.setCfgId(Long.parseLong(idStr));
|
|
|
|
|
|
cfg.setTableName(HttpUrlCfg.getTablename());
|
|
|
|
|
|
cfg.setEditorId(cfg.getCurrentUser().getId());
|
|
|
|
|
|
cfg.setEditTime(date);
|
|
|
|
|
|
cfg.setIsValid(Constants.VALID_DEL);
|
|
|
|
|
|
cfgs.add(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
this.deleteBatch(cfgs, DomainDao.class);
|
2018-05-24 19:33:59 +08:00
|
|
|
|
}
|
2018-06-22 16:30:59 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void deleteDomain(String ids,String compileIds,int functionId){
|
|
|
|
|
|
if(StringUtils.isNotBlank(compileIds)){
|
|
|
|
|
|
for(String compileId:compileIds.split(",")){//强转数字,防止注入
|
|
|
|
|
|
Integer.parseInt(compileId);
|
|
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
stringCfgDao.deleteByCompileIds(new HttpUrlCfg().getCurrentUser().getId(),AreaIpCfg.getTablename(),compileIds);
|
2018-06-22 16:30:59 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
List<HttpUrlCfg> stringCfgs=new ArrayList<HttpUrlCfg>();
|
2018-06-22 16:30:59 +08:00
|
|
|
|
Date date =new Date();
|
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
|
for(String idStr:ids.split(",")){
|
|
|
|
|
|
if(StringUtils.isNotBlank(idStr)){
|
2018-06-29 12:44:33 +08:00
|
|
|
|
HttpUrlCfg cfg=new HttpUrlCfg();
|
2018-06-22 16:30:59 +08:00
|
|
|
|
cfg.setCfgId(Long.parseLong(idStr));
|
|
|
|
|
|
cfg.setTableName(HttpUrlCfg.getTablename());
|
|
|
|
|
|
cfg.setEditorId(cfg.getCurrentUser().getId());
|
|
|
|
|
|
cfg.setEditTime(date);
|
|
|
|
|
|
cfg.setIsValid(Constants.VALID_DEL);
|
|
|
|
|
|
stringCfgs.add(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.deleteBatch(stringCfgs, StringCfgDao.class);
|
|
|
|
|
|
}
|
2018-02-27 15:31:30 +08:00
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* deleteStringCfg(删除IP类配置)
|
|
|
|
|
|
* (继承BaseStringCfg这个类方可使用)
|
|
|
|
|
|
* @param baseStringCfg
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*int
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public void deleteStringCfg(List<HttpUrlCfg> stringCfg,List<BaseIpCfg> areaCfg){
|
2018-04-10 10:42:24 +08:00
|
|
|
|
if(areaCfg!=null&&areaCfg.size()>0){
|
|
|
|
|
|
this.deleteIpBatch(areaCfg);
|
|
|
|
|
|
}
|
2018-04-11 16:44:45 +08:00
|
|
|
|
this.deleteBatch(stringCfg, StringCfgDao.class);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* getStringCfg(根据IP与类名获取IP配置)
|
|
|
|
|
|
* (继承BaseStringCfg这个类方可使用)
|
|
|
|
|
|
* @param clazz
|
|
|
|
|
|
* @param id
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*BaseStringCfg
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public HttpUrlCfg getStringCfgById(HttpUrlCfg baseStringCfg){
|
|
|
|
|
|
return domainDao.getById(baseStringCfg.getCfgId());
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public HttpUrlCfg getStringCfgById(long id){
|
|
|
|
|
|
return domainDao.getById(id);
|
2018-05-22 18:59:19 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public Integer getIsValid(HttpUrlCfg baseStringCfg){
|
|
|
|
|
|
return domainDao.getIsValid(baseStringCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public Integer getIsValid(long id){
|
|
|
|
|
|
return domainDao.getIsValid(id);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public Integer getIsAudit(HttpUrlCfg baseStringCfg){
|
|
|
|
|
|
return domainDao.getIsAudit(baseStringCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public Integer getIsAudit(long id){
|
|
|
|
|
|
return domainDao.getIsAudit(id);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
2018-04-11 16:44:45 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* getList(这里用一句话描述这个方法的作用)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @param tableName
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<BaseStringCfg>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public List<HttpUrlCfg> getListByCompileId(String ids) {
|
2018-04-11 16:44:45 +08:00
|
|
|
|
// TODO Auto-generated method stub
|
2018-06-29 12:44:33 +08:00
|
|
|
|
return domainDao.getListByCompileId(ids);
|
2018-04-11 16:44:45 +08:00
|
|
|
|
}
|
2018-05-28 10:18:03 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* getListByCfgId(这里用一句话描述这个方法的作用)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @param tablename
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<BaseStringCfg>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public List<HttpUrlCfg> getListByCfgId(String ids) {
|
2018-05-28 10:18:03 +08:00
|
|
|
|
// TODO Auto-generated method stub
|
2018-06-29 12:44:33 +08:00
|
|
|
|
return domainDao.getListByCfgId(ids);
|
2018-05-28 10:18:03 +08:00
|
|
|
|
}
|
2018-11-28 19:23:38 +08:00
|
|
|
|
public CfgIndexInfo getDomainCfg(Long cfgId,Integer compileId) {
|
|
|
|
|
|
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId,compileId);
|
2018-08-25 01:55:10 +08:00
|
|
|
|
List<HttpUrlCfg> httpUrlList = websiteCfgDao.getHttpUrlList(entity);
|
|
|
|
|
|
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
|
|
|
|
|
|
entity.setHttpUrlList(httpUrlList);
|
|
|
|
|
|
entity.setNtcSubscribeIdCfgList(subscribeIdList);
|
|
|
|
|
|
return entity;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void saveDomainCfg(CfgIndexInfo entity){
|
2019-01-26 11:23:38 +00:00
|
|
|
|
/*if(entity.getAction()==128){
|
2018-10-11 15:02:24 +08:00
|
|
|
|
entity.setCfgType("WHITE_LIST_DOMAIN");
|
|
|
|
|
|
if(entity.getHttpUrlList().size()>0){
|
|
|
|
|
|
for (int i = 0; i < entity.getHttpUrlList().size(); i++) {
|
|
|
|
|
|
entity.getHttpUrlList().get(i).setCfgType("WHITE_LIST_DOMAIN");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-01-26 11:23:38 +00:00
|
|
|
|
}*/
|
2018-08-25 01:55:10 +08:00
|
|
|
|
//设置区域运营商信息
|
|
|
|
|
|
setAreaEffectiveIds(entity);
|
|
|
|
|
|
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (MaatConvertException e) {
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
websiteCfgDao.saveCfgIndex(entity);
|
|
|
|
|
|
|
|
|
|
|
|
if(entity.getHttpUrlList()!=null){
|
|
|
|
|
|
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
|
|
|
|
|
|
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
|
|
|
|
|
websiteCfgDao.saveHttpUrlCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(entity.getNtcSubscribeIdCfgList()!=null){
|
|
|
|
|
|
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
|
|
|
|
|
|
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
|
|
|
|
|
stringCfgDao.saveSubscribeIdCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//保存区域IP信息
|
|
|
|
|
|
if(entity.getAreaCfg()!=null){
|
|
|
|
|
|
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
|
|
|
|
|
cfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
2018-08-25 11:55:40 +08:00
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
2018-08-25 01:55:10 +08:00
|
|
|
|
websiteCfgDao.updateCfgIndex(entity);
|
|
|
|
|
|
//无效子配置后,再新增子配置
|
|
|
|
|
|
websiteCfgDao.deleteHttpUrlCfg(entity);
|
|
|
|
|
|
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(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.getHttpUrlList()!=null){
|
|
|
|
|
|
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
|
|
|
|
|
|
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
|
|
|
|
|
websiteCfgDao.saveHttpUrlCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(entity.getNtcSubscribeIdCfgList()!=null){
|
|
|
|
|
|
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
|
|
|
|
|
|
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
|
|
|
|
|
stringCfgDao.saveSubscribeIdCfg(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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void updateDomainCfgValid(Integer isValid,String ids,Integer functionId){
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
2018-08-31 16:08:17 +08:00
|
|
|
|
CfgIndexInfo entity = new CfgIndexInfo();
|
2018-08-25 01:55:10 +08:00
|
|
|
|
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);
|
|
|
|
|
|
//查询子配置
|
2018-11-28 19:23:38 +08:00
|
|
|
|
entity = this.getDomainCfg(Long.parseLong(id),entity.getCompileId());
|
2018-08-25 01:55:10 +08:00
|
|
|
|
|
|
|
|
|
|
if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0)
|
|
|
|
|
|
{
|
|
|
|
|
|
HttpUrlCfg cfg = new HttpUrlCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
|
|
|
|
|
cfg.setTableName(HttpUrlCfg.getTablename());
|
|
|
|
|
|
websiteCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0)
|
|
|
|
|
|
{
|
|
|
|
|
|
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
|
|
|
|
|
cfg.setTableName(NtcSubscribeIdCfg.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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public void auditDomainCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
//修改数据库审核状态信息
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
//查询子配置并修改审核状态
|
2018-11-28 19:23:38 +08:00
|
|
|
|
entity = this.getDomainCfg(entity.getCfgId(),entity.getCompileId());
|
2018-08-25 01:55:10 +08:00
|
|
|
|
|
|
|
|
|
|
if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){
|
|
|
|
|
|
HttpUrlCfg cfg = new HttpUrlCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
|
|
|
|
|
cfg.setTableName(HttpUrlCfg.getTablename());
|
|
|
|
|
|
websiteCfgDao.auditCfg(cfg);
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
Map<String,List> map = cfgConvert(strRegionList,entity.getHttpUrlList(),2,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=map.get("groupList");
|
|
|
|
|
|
strRegionList=map.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){
|
|
|
|
|
|
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
|
|
|
|
|
cfg.setTableName(NtcSubscribeIdCfg.getTablename());
|
|
|
|
|
|
websiteCfgDao.auditCfg(cfg);
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
Map<String,List> map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=map.get("groupList");
|
|
|
|
|
|
strRegionList=map.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfgList)){
|
|
|
|
|
|
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,areaIpCfgList,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("domain配置下发配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("domain配置下发响应信息:"+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("domain配置下发配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
|
|
|
|
|
logger.info("domain配置取消配置响应信息:"+result.getMsg());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public Page<CfgIndexInfo> getDomainList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
|
|
|
|
|
|
// 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL)
|
|
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
|
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<CfgIndexInfo> list = websiteCfgDao.getWebsiteList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-10-18 11:24:12 +08:00
|
|
|
|
|
|
|
|
|
|
public CfgIndexInfo exportDomainInfo(CfgIndexInfo entity){
|
|
|
|
|
|
List<HttpUrlCfg> httpUrlList = websiteCfgDao.getHttpUrlList(entity);
|
|
|
|
|
|
entity.setHttpUrlList(httpUrlList);
|
|
|
|
|
|
return entity;
|
|
|
|
|
|
}
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|