Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop

This commit is contained in:
fangshunjian
2018-08-23 15:39:34 +08:00
42 changed files with 1490 additions and 699 deletions

View File

@@ -107,7 +107,7 @@ public class AvContentCfgService extends BaseService{
* @return
*/
public List<NtcSubscribeIdCfg> getSubscribeIdCfgList(CfgIndexInfo entity) {
return avContentCfgDao.findSubscribeIdCfgList(entity);
return stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
}
/**
* 根据索引表信息获取voipAccountCfg信息
@@ -198,7 +198,7 @@ public class AvContentCfgService extends BaseService{
avContentCfgDao.updateCfgIndexInfo(entity);
//无效子配置后,再新增子配置
avContentCfgDao.deleteAvVoipIp(entity);
avContentCfgDao.deleteAvVoipKeywordCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
@@ -280,7 +280,7 @@ public class AvContentCfgService extends BaseService{
entity.setEditorId(entity.getCurrentUser().getId());
avContentCfgDao.updateCfgIndexInfo(entity);
//无效子配置后,再新增子配置
avContentCfgDao.deleteAvVoipKeywordCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
avContentCfgDao.deleteAvVoipAccountCfg(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
@@ -398,7 +398,7 @@ public class AvContentCfgService extends BaseService{
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
ntcList=avContentCfgDao.findSubscribeIdCfgList(entity);
ntcList=stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
ToMaatBean maatBean = new ToMaatBean();
@@ -511,7 +511,7 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
ntcList=avContentCfgDao.findSubscribeIdCfgList(entity);
ntcList=stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
accountList=avContentCfgDao.findVoipAccountCfgList(entity);
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());

View File

@@ -402,12 +402,16 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
}
entity.setCompileId(compileId);
entity.setCreatorId(entity.getCurrentUser().getId());
if(result!=null && result.getData()!=null){
entity.setRawLen(result.getData().getRawLen());
entity.setDigest(result.getData().getDigest());
Long rawLen = result.getData().getRawLen();
String digest = result.getData().getDigest();
if((result!=null && result.getData()!=null) && (rawLen != null && digest!= null)){
entity.setRawLen(rawLen);
entity.setDigest(digest);
entity.setFileUrl(result.getData().getAccessUrl());
}
}else {
logger.info("获取文件摘要属性有误");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+null);
}
mailCfgDao.saveMailFileDigestCfg(entity);
//保存区域IP信息
@@ -619,11 +623,16 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
// 设置区域运营商信息
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);
Integer compileId = 0;
try {
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
@@ -674,11 +683,7 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}else{
// 审核未通过状态的配置 修改后状态改为未审核

View File

@@ -1,40 +1,21 @@
package com.nis.web.service.configuration;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvFileSampleCfg;
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;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.InterceptPktBin;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.SslKeywordCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
import com.nis.domain.maat.ToMaatBean;
@@ -46,13 +27,9 @@ import com.nis.domain.maat.MaatCfg.StringCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.IpUtil;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.InterceptCfgDao;
import com.nis.web.dao.configuration.IpCfgDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.dao.configuration.WebsiteCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
@@ -72,12 +49,14 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
public CfgIndexInfo getInterceptIpCfg(Long cfgId){
public CfgIndexInfo getInterceptCfg(Long cfgId){
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
List<IpPortCfg> ipPortList = websiteCfgDao.getIpPortList(entity);
List<InterceptPktBin> pktBinList = interceptCfgDao.getInterceptPktBin(entity);
List<HttpUrlCfg> httpUrlList = websiteCfgDao.getHttpUrlList(entity);
entity.setIpPortList(ipPortList);
entity.setInterceptPktBinList(pktBinList);
entity.setHttpUrlList(httpUrlList);
return entity;
}
public Page<CfgIndexInfo> getWebsiteList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
@@ -93,7 +72,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
* @param entity
*/
public void saveInterceptIpCfg(CfgIndexInfo entity){
public void saveInterceptCfg(CfgIndexInfo entity){
if(!entity.getAction().equals(Constants.REPLACE_ACTION)){
entity.setInterceptPktBinList(null);
}
@@ -115,33 +94,41 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
websiteCfgDao.saveCfgIndex(entity);
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
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.getInterceptPktBinList()!=null ){
for(InterceptPktBin cfg:entity.getInterceptPktBinList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveIpPortCfg(cfg);
interceptCfgDao.saveInterceptPktBin(cfg);
}
}
if(entity.getInterceptPktBinList()!=null ){
for(InterceptPktBin cfg:entity.getInterceptPktBinList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
interceptCfgDao.saveInterceptPktBin(cfg);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
}
if(entity.getHttpUrlList()!=null ){
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
websiteCfgDao.saveHttpUrlCfg(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{
@@ -153,6 +140,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
//无效子配置后,再新增子配置
interceptCfgDao.deleteInterceptIpCfg(entity);
interceptCfgDao.deleteInterceptPktBin(entity);
websiteCfgDao.deleteHttpUrlCfg(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
@@ -173,6 +161,14 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
}
}
}
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);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
@@ -201,7 +197,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
entity.setFunctionId(functionId);
websiteCfgDao.updateCfgValid(entity);
//查询子配置
entity = this.getInterceptIpCfg(Long.parseLong(id));
entity = this.getInterceptCfg(Long.parseLong(id));
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
@@ -215,6 +211,13 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
cfg.setTableName(InterceptPktBin.getTablename());
websiteCfgDao.updateCfgValid(cfg);
}
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);
}
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();
@@ -227,7 +230,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
}
/**
* dns配置审核
* 配置审核
* @param entity
* @param isAudit
* @throws MaatConvertException
@@ -248,7 +251,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
List<IpCfg> areaIpRegionList = new ArrayList();
//查询子配置并修改审核状态
entity = this.getInterceptIpCfg(entity.getCfgId());
entity = this.getInterceptCfg(entity.getCfgId());
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
@@ -274,6 +277,17 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
strRegionList=map.get("dstList");
}
}
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");
}
}
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
@@ -345,10 +359,10 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("intercept IP 配置下发配置参数:"+json);
logger.info("intercept IP/DNS 配置下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("intercept IP 配置下发响应信息:"+result.getMsg());
logger.info("intercept IP/DNS 配置下发响应信息:"+result.getMsg());
}else if(isAudit==3){
maatCfg.setCompileId(entity.getCompileId());
@@ -362,10 +376,10 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
maatBean.setOpAction(Constants.UPDATE_ACTION);
//调用服务接口取消配置
String json=gsonToJson(maatBean);
logger.info("intercept IP 配置下发配置参数:"+json);
logger.info("intercept IP/DNS 配置下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("intercept IP 配置取消配置响应信息:"+result.getMsg());
logger.info("intercept IP/DNS 配置取消配置响应信息:"+result.getMsg());
}
}
}

View File

@@ -22,6 +22,7 @@ import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.FileDigestCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.MailKeywordCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.maat.ToMaatResult;
@@ -37,6 +38,7 @@ import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.MailCfgDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.CrudService;
@@ -51,6 +53,10 @@ public class MailCfgService extends CrudService<MailCfgDao,CfgIndexInfo> {
protected MailCfgDao mailCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
@Autowired
protected StringCfgDao stringCfgDao;
public Page<CfgIndexInfo> getMailList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
// 生成数据权限过滤条件dsf为dataScopeFilter的简写在xml中使用 ${sqlMap.dsf}调用权限SQL
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
@@ -65,9 +71,11 @@ public class MailCfgService extends CrudService<MailCfgDao,CfgIndexInfo> {
List<ComplexkeywordCfg> keywordList = mailCfgDao.getMailKeywordList(entity);
List<FileDigestCfg> digestList = mailCfgDao.getMailFileDigestList(entity);
List<AreaIpCfg> areaCfg = areaIpCfgDao.getByCompileId(entity.getCompileId());
List<NtcSubscribeIdCfg> ntcSubscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
entity.setIpPortList(ipPortList);
entity.setComplexList(keywordList);
entity.setDigestList(digestList);
entity.setNtcSubscribeIdCfgList(ntcSubscribeIdList);
entity.setAreaCfg(areaCfg);
return entity;
}
@@ -79,6 +87,10 @@ public class MailCfgService extends CrudService<MailCfgDao,CfgIndexInfo> {
public void saveMailCfg(CfgIndexInfo entity,ToMaatResult result){
//设置区域运营商信息
setAreaEffectiveIds(entity);
entity.setIsValid(0);
entity.setIsAudit(0);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
@@ -86,58 +98,67 @@ public class MailCfgService extends CrudService<MailCfgDao,CfgIndexInfo> {
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
mailCfgDao.saveCfgIndex(entity);
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
mailCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getComplexList()!=null){
for(ComplexkeywordCfg cfg:entity.getComplexList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
mailCfgDao.saveMailKeywordCfg(cfg);
}
}
}
if(entity.getDigestList()!=null){
for(FileDigestCfg cfg:entity.getDigestList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(result!=null && result.getData()!=null){
cfg.setRawLen(result.getData().getRawLen());
cfg.setDigest(result.getData().getDigest());
cfg.setFileUrl(result.getData().getAccessUrl());
}
mailCfgDao.saveMailFileDigestCfg(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();
} catch (MaatConvertException e) {
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
mailCfgDao.saveCfgIndex(entity);
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
mailCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getComplexList()!=null){
for(ComplexkeywordCfg cfg:entity.getComplexList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
mailCfgDao.saveMailKeywordCfg(cfg);
}
}
}
if(entity.getDigestList()!=null){
for(FileDigestCfg cfg:entity.getDigestList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(result!=null && result.getData()!=null){
cfg.setRawLen(result.getData().getRawLen());
cfg.setDigest(result.getData().getDigest());
cfg.setFileUrl(result.getData().getAccessUrl());
}
mailCfgDao.saveMailFileDigestCfg(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{
mailCfgDao.updateCfgIndex(entity);
//无效子配置后,再新增子配置
mailCfgDao.deleteMailIpCfg(entity);
mailCfgDao.deleteMailKeywordCfg(entity);
mailCfgDao.deleteMailFileDigestCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
@@ -172,6 +193,14 @@ public class MailCfgService extends CrudService<MailCfgDao,CfgIndexInfo> {
mailCfgDao.saveMailFileDigestCfg(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()){
@@ -208,6 +237,13 @@ public class MailCfgService extends CrudService<MailCfgDao,CfgIndexInfo> {
cfg.setTableName(MailKeywordCfg.getTablename());
mailCfgDao.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());
mailCfgDao.updateCfgValid(cfg);
}
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();
@@ -272,6 +308,19 @@ public class MailCfgService extends CrudService<MailCfgDao,CfgIndexInfo> {
digestRegionList=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());
mailCfgDao.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信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();

View File

@@ -1,29 +1,17 @@
package com.nis.web.service.configuration;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvFileSampleCfg;
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;
@@ -33,6 +21,7 @@ import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.configuration.SslKeywordCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
@@ -46,14 +35,11 @@ import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.IpUtil;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.IpCfgDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.dao.configuration.WebsiteCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
import com.nis.web.service.CrudService;
/**
@@ -67,6 +53,8 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
protected WebsiteCfgDao websiteCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
@Autowired
protected StringCfgDao stringCfgDao;
public CfgIndexInfo getHttpCfg(Long cfgId){
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
@@ -74,6 +62,7 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
List<HttpUrlCfg> httpUrlList = websiteCfgDao.getHttpUrlList(entity);
List<HttpReqHeadCfg> httpReqHdrList = websiteCfgDao.getHttpReqHdrList(entity);
List<HttpResHeadCfg> httpResHdrList = websiteCfgDao.getHttpResHdrList(entity);
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
entity.setCfgType(Constants.HTTP_REQ_BODY_REGION);
List<HttpBodyCfg> httpReqBodyList = websiteCfgDao.getHttpReqBodyList(entity);
entity.setCfgType(Constants.HTTP_RES_BODY_REGION);
@@ -84,13 +73,16 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
entity.setHttpResBodyList(httpResBodyList);
entity.setHttpResHdrList(httpResHdrList);
entity.setHttpUrlList(httpUrlList);
entity.setNtcSubscribeIdCfgList(subscribeIdList);
return entity;
}
public CfgIndexInfo getSslCfg(Long cfgId){
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
List<IpPortCfg> ipPortList = websiteCfgDao.getIpPortList(entity);
List<BaseStringCfg> sslList = websiteCfgDao.getSslKewordList(entity);
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
entity.setIpPortList(ipPortList);
entity.setNtcSubscribeIdCfgList(subscribeIdList);
entity.setSslList(sslList);
return entity;
}
@@ -98,8 +90,10 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
List<IpPortCfg> ipPortList = websiteCfgDao.getIpPortList(entity);
List<ComplexkeywordCfg> domainList = websiteCfgDao.getDnsDomainList(entity);
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
entity.setIpPortList(ipPortList);
entity.setDomainList(domainList);
entity.setNtcSubscribeIdCfgList(subscribeIdList);
return entity;
}
public Page<CfgIndexInfo> getWebsiteList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
@@ -113,6 +107,10 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
public void saveHttpCfg(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
entity.setIsValid(0);
entity.setIsAudit(0);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
@@ -120,64 +118,69 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
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.getHttpUrlList()!=null){
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpUrlCfg(cfg);
}
}
if(entity.getHttpReqHdrList()!=null){
for(HttpReqHeadCfg cfg:entity.getHttpReqHdrList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
websiteCfgDao.saveHttpReqHdrCfg(cfg);
}
}
if(entity.getHttpResHdrList()!=null){
for(HttpResHeadCfg cfg:entity.getHttpResHdrList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
websiteCfgDao.saveHttpResHdrCfg(cfg);
}
}
if(entity.getHttpReqBodyList()!=null){
for(HttpBodyCfg cfg:entity.getHttpReqBodyList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpBodyCfg(cfg);
}
}
if(entity.getHttpResBodyList()!=null){
for(HttpBodyCfg cfg:entity.getHttpResBodyList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpBodyCfg(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();
} catch (MaatConvertException e) {
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
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.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getHttpUrlList()!=null){
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpUrlCfg(cfg);
}
}
if(entity.getHttpReqHdrList()!=null){
for(HttpReqHeadCfg cfg:entity.getHttpReqHdrList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
websiteCfgDao.saveHttpReqHdrCfg(cfg);
}
}
if(entity.getHttpResHdrList()!=null){
for(HttpResHeadCfg cfg:entity.getHttpResHdrList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
websiteCfgDao.saveHttpResHdrCfg(cfg);
}
}
if(entity.getHttpReqBodyList()!=null){
for(HttpBodyCfg cfg:entity.getHttpReqBodyList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpBodyCfg(cfg);
}
}
if(entity.getHttpResBodyList()!=null){
for(HttpBodyCfg cfg:entity.getHttpResBodyList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveHttpBodyCfg(cfg);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
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{
@@ -188,6 +191,7 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
websiteCfgDao.deleteHttpReqHdrCfg(entity);
websiteCfgDao.deleteHttpResHdrCfg(entity);
websiteCfgDao.deleteHttpBodyCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
@@ -236,6 +240,12 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
websiteCfgDao.saveHttpBodyCfg(cfg);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
stringCfgDao.saveSubscribeIdCfg(cfg);
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
@@ -290,6 +300,12 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
cfg.setTableName(HttpBodyCfg.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();
@@ -384,6 +400,17 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
}
}
}
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)){
@@ -482,6 +509,10 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
public void saveSslCfg(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
entity.setIsValid(0);
entity.setIsAudit(0);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
@@ -489,36 +520,43 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
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.getSslList()!=null){
for(BaseStringCfg cfg:entity.getSslList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveSslKeywordCfg(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();
} catch (MaatConvertException e) {
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
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.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getSslList()!=null){
for(BaseStringCfg cfg:entity.getSslList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
websiteCfgDao.saveSslKeywordCfg(cfg);
}
}
}
if(entity.getSslList()!=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{
@@ -526,6 +564,7 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
//无效子配置后,再新增子配置
websiteCfgDao.deleteSslIpCfg(entity);
websiteCfgDao.deleteSslKeywordCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
@@ -546,6 +585,14 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
}
}
}
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()){
@@ -582,6 +629,13 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
cfg.setTableName(SslKeywordCfg.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();
@@ -635,6 +689,17 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
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)){
@@ -703,6 +768,10 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
public void saveDnsCfg(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
entity.setIsValid(0);
entity.setIsAudit(0);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
@@ -710,39 +779,46 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
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"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
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();
} catch (MaatConvertException e) {
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
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.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"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
websiteCfgDao.saveDnsDomainCfg(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{
@@ -750,6 +826,7 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
//无效子配置后,再新增子配置
websiteCfgDao.deleteDnsIpCfg(entity);
websiteCfgDao.deleteDnsDomainCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
@@ -773,6 +850,14 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
}
}
}
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()){
@@ -810,11 +895,18 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
}
if(entity.getDomainList()!=null && entity.getDomainList().size()>0)
{
SslKeywordCfg cfg = new SslKeywordCfg();
DnsDomainCfg cfg = new DnsDomainCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(DnsDomainCfg.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();
@@ -874,6 +966,17 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
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)){