2018-01-09 16:50:39 +08:00
|
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
|
2018-11-12 17:26:44 +08:00
|
|
|
|
import java.nio.charset.Charset;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
import java.util.List;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import java.util.Map;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
|
2018-09-07 20:18:59 +08:00
|
|
|
|
import org.apache.ibatis.session.ExecutorType;
|
|
|
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import org.springframework.beans.BeanUtils;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2018-01-09 16:50:39 +08:00
|
|
|
|
import org.springframework.stereotype.Service;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
2018-11-12 17:26:44 +08:00
|
|
|
|
import com.google.common.collect.Lists;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import com.nis.domain.Page;
|
2018-11-12 17:26:44 +08:00
|
|
|
|
import com.nis.domain.basics.AsnIpCfg;
|
|
|
|
|
|
import com.nis.domain.basics.Varibles;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.domain.configuration.AppByteCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.AppDomainCfg;
|
2018-08-21 19:03:31 +08:00
|
|
|
|
import com.nis.domain.configuration.AppHeaderCfg;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.domain.configuration.AppHttpCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.AppIpCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.AppPolicyCfg;
|
2018-08-20 21:01:58 +08:00
|
|
|
|
import com.nis.domain.configuration.AppSslCertCfg;
|
2018-08-24 10:25:01 +08:00
|
|
|
|
import com.nis.domain.configuration.AppTcpCfg;
|
2018-08-23 17:07:09 +08:00
|
|
|
|
import com.nis.domain.configuration.AppTopicDomainCfg;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.domain.configuration.AreaIpCfg;
|
2018-11-02 16:59:03 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-11-05 16:26:02 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseStringCfg;
|
2018-12-17 03:30:34 +08:00
|
|
|
|
import com.nis.domain.configuration.CfgIndexInfo;
|
2018-11-02 20:36:51 +08:00
|
|
|
|
import com.nis.domain.configuration.ComplexkeywordCfg;
|
2018-07-04 16:03:07 +08:00
|
|
|
|
import com.nis.domain.configuration.IpPortCfg;
|
2018-08-21 18:00:20 +08:00
|
|
|
|
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
2018-08-29 22:46:49 +08:00
|
|
|
|
import com.nis.domain.configuration.WebsiteDomainTopic;
|
2018-09-07 20:18:59 +08:00
|
|
|
|
import com.nis.domain.maat.GroupReuseAddBean;
|
|
|
|
|
|
import com.nis.domain.maat.GroupReuseCfg;
|
2018-06-22 18:46:01 +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-07-24 18:45:27 +08:00
|
|
|
|
import com.nis.domain.maat.ToMaatBean;
|
|
|
|
|
|
import com.nis.domain.maat.ToMaatResult;
|
2018-09-07 20:18:59 +08:00
|
|
|
|
import com.nis.domain.specific.ConfigGroupInfo;
|
|
|
|
|
|
import com.nis.domain.specific.SpecificServiceCfg;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.exceptions.MaatConvertException;
|
|
|
|
|
|
import com.nis.util.ConfigServiceUtil;
|
2018-04-03 11:12:49 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-06-28 17:16:58 +08:00
|
|
|
|
import com.nis.util.DictUtils;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import com.nis.util.StringUtil;
|
2018-08-22 15:20:14 +08:00
|
|
|
|
import com.nis.util.StringUtils;
|
2018-11-12 17:26:44 +08:00
|
|
|
|
import com.nis.web.dao.basics.AsnIpCfgDao;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import com.nis.web.dao.configuration.AppCfgDao;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
2018-10-17 10:36:38 +08:00
|
|
|
|
import com.nis.web.dao.configuration.IpCfgDao;
|
2018-08-21 18:00:20 +08:00
|
|
|
|
import com.nis.web.dao.configuration.StringCfgDao;
|
2018-11-11 19:36:53 +08:00
|
|
|
|
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
2018-09-07 20:18:59 +08:00
|
|
|
|
import com.nis.web.dao.specific.SpecificServiceCfgDao;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.web.security.UserUtils;
|
|
|
|
|
|
import com.nis.web.service.BaseService;
|
2018-09-07 20:18:59 +08:00
|
|
|
|
import com.nis.web.service.SpringContextHolder;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
|
2018-01-09 16:50:39 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 特定协议相关配置事务类
|
2018-08-24 15:32:11 +08:00
|
|
|
|
*
|
2018-01-09 16:50:39 +08:00
|
|
|
|
* @author dell
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Service
|
2018-06-22 18:46:01 +08:00
|
|
|
|
public class AppCfgService extends BaseService {
|
2018-03-29 17:24:21 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
protected AppCfgDao appCfgDao;
|
|
|
|
|
|
@Autowired
|
2018-06-22 18:46:01 +08:00
|
|
|
|
protected AreaIpCfgDao areaIpCfgDao;
|
2018-08-21 18:00:20 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
protected StringCfgDao stringcfgDao;
|
2018-09-07 20:18:59 +08:00
|
|
|
|
@Autowired
|
2018-10-17 10:36:38 +08:00
|
|
|
|
protected IpCfgDao ipCfgDao;
|
|
|
|
|
|
@Autowired
|
2018-09-07 20:18:59 +08:00
|
|
|
|
protected SpecificServiceCfgDao specificServiceCfgDao;
|
2018-11-11 19:36:53 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
protected ConfigGroupInfoDao configGroupInfoDao;
|
2018-11-12 17:26:44 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
protected AsnIpCfgDao asnIpCfgDao;
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
public Page<AppPolicyCfg> findAppPolicyList(Page<AppPolicyCfg> page, AppPolicyCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-03-29 17:24:21 +08:00
|
|
|
|
entity.setPage(page);
|
2018-06-22 18:46:01 +08:00
|
|
|
|
List<AppPolicyCfg> list = appCfgDao.findAppPolicyList(entity);
|
2018-03-29 17:24:21 +08:00
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-12-17 03:30:34 +08:00
|
|
|
|
public List<AppPolicyCfg> findAppByPolicyList(String ids) {
|
|
|
|
|
|
List<AppPolicyCfg> list = appCfgDao.findAppByPolicyList(ids);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
public Page<AppIpCfg> findAppIpList(Page<AppIpCfg> page, AppIpCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppIpCfg> list = appCfgDao.findAppIpList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-12-17 03:30:34 +08:00
|
|
|
|
|
|
|
|
|
|
public List<AppIpCfg> findAppByIpList(String ids) {
|
|
|
|
|
|
List<AppIpCfg> list = appCfgDao.findAppByIpList(ids);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
public Page<AppHttpCfg> findAppHttpList(Page<AppHttpCfg> page, AppHttpCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppHttpCfg> list = appCfgDao.findAppHttpList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-12-17 03:30:34 +08:00
|
|
|
|
|
|
|
|
|
|
public List<AppHttpCfg> findAppByHttpList(String ids ) {
|
|
|
|
|
|
List<AppHttpCfg> list = appCfgDao.findAppByHttpList(ids);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
public Page<AppDomainCfg> findAppDomainList(Page<AppDomainCfg> page, AppDomainCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppDomainCfg> list = appCfgDao.findAppDomainList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-10-17 10:36:38 +08:00
|
|
|
|
|
2018-12-17 03:30:34 +08:00
|
|
|
|
public List<AppDomainCfg> findAppByDomainList(String ids) {
|
|
|
|
|
|
List<AppDomainCfg> list = appCfgDao.findAppByDomainList(ids);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-10-17 10:36:38 +08:00
|
|
|
|
public AppPolicyCfg exportIpInfo(AppPolicyCfg policy){
|
|
|
|
|
|
List<IpPortCfg> ipPortList = appCfgDao.getAppPolicyIpList(policy);
|
|
|
|
|
|
policy.setIpPortList(ipPortList);
|
|
|
|
|
|
NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg();
|
|
|
|
|
|
ntcSubscribeIdCfg.setCompileId(policy.getCompileId());
|
|
|
|
|
|
List<NtcSubscribeIdCfg> ntcList = stringcfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg);
|
|
|
|
|
|
policy.setNtcSubscribeIdCfgList(ntcList);
|
|
|
|
|
|
return policy;
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 主题网站列表
|
2018-08-23 17:07:09 +08:00
|
|
|
|
public Page<AppTopicDomainCfg> findAppTopicDomainList(Page<AppTopicDomainCfg> page, AppTopicDomainCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-08-23 17:07:09 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppTopicDomainCfg> list = appCfgDao.findAppTopicDomainList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-12-17 03:30:34 +08:00
|
|
|
|
|
|
|
|
|
|
// 主题网站列表
|
|
|
|
|
|
public List<AppTopicDomainCfg> findAppByTopicDomainList(String ids) {
|
|
|
|
|
|
List<AppTopicDomainCfg> list = appCfgDao.findAppByTopicDomainList(ids);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
public Page<AppByteCfg> findAppByteList(Page<AppByteCfg> page, AppByteCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppByteCfg> list = appCfgDao.findAppByteList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-20 21:01:58 +08:00
|
|
|
|
public Page<AppSslCertCfg> findAppSslList(Page<AppSslCertCfg> page, AppSslCertCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-08-20 21:01:58 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppSslCertCfg> list = appCfgDao.findAppSslList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-12-17 03:30:34 +08:00
|
|
|
|
|
|
|
|
|
|
public List<AppSslCertCfg> findAppBySslList(String ids) {
|
|
|
|
|
|
List<AppSslCertCfg> list = appCfgDao.findAppBySslList(ids);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
2018-08-24 10:25:01 +08:00
|
|
|
|
|
|
|
|
|
|
public Page<AppTcpCfg> findAppTcpList(Page<AppTcpCfg> page, AppTcpCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-08-24 10:25:01 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppTcpCfg> list = appCfgDao.findAppTcpList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
public AppTcpCfg getAppTcpCfg(Long cfgId) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
return appCfgDao.getAppTcpCfg(cfgId);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-11-28 19:23:38 +08:00
|
|
|
|
public AppPolicyCfg getAppPolicyCfg(Long cfgId,Integer compileId) {
|
|
|
|
|
|
AppPolicyCfg policy = appCfgDao.getAppPolicyCfg(cfgId,compileId);
|
2018-07-04 16:03:07 +08:00
|
|
|
|
List<IpPortCfg> ipPortList = appCfgDao.getAppPolicyIpList(policy);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 查询关键字
|
|
|
|
|
|
if (policy.getCompileId() != null) {
|
2018-08-21 18:00:20 +08:00
|
|
|
|
NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg();
|
|
|
|
|
|
ntcSubscribeIdCfg.setCompileId(policy.getCompileId());
|
|
|
|
|
|
List<NtcSubscribeIdCfg> ntcList = stringcfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg);
|
|
|
|
|
|
policy.setNtcSubscribeIdCfgList(ntcList);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-07-04 16:03:07 +08:00
|
|
|
|
policy.setIpPortList(ipPortList);
|
|
|
|
|
|
return policy;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public AppIpCfg getAppIpCfg(Long cfgId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
return appCfgDao.getAppIpCfg(cfgId);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public AppHttpCfg getAppHttpCfg(Long cfgId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
return appCfgDao.getAppHttpCfg(cfgId);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public AppDomainCfg getAppDomainCfg(Long cfgId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
return appCfgDao.getAppDomainCfg(cfgId);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 主题网站form
|
|
|
|
|
|
public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
return appCfgDao.getAppTopicDomainCfg(cfgId);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public AppByteCfg getAppByteCfg(Long cfgId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
return appCfgDao.getAppByteCfg(cfgId);
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public AppSslCertCfg getAppSslCfg(Long cfgId) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
return appCfgDao.getAppSslCfg(cfgId);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-06-22 18:46:01 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
compileId = idList.get(0);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
// 设置SubscribeID域配置参数
|
2018-09-26 16:00:45 +08:00
|
|
|
|
// if (entity != null && entity.getNtcSubscribeIdCfgList() != null) {
|
|
|
|
|
|
// for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) {
|
|
|
|
|
|
// entity.setExprType(cfg.getExprType());
|
|
|
|
|
|
// entity.setIsHexbin(cfg.getIsHexbin());
|
|
|
|
|
|
// entity.setMatchMethod(cfg.getMatchMethod());
|
|
|
|
|
|
// entity.setCfgKeywords(cfg.getCfgKeywords());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// entity.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
appCfgDao.insertAppPolicyCfg(entity);
|
|
|
|
|
|
// 保存策略IP配置
|
|
|
|
|
|
if (entity != null && entity.getIpPortList() != null) {
|
|
|
|
|
|
for (IpPortCfg cfg : entity.getIpPortList()) {
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" });
|
|
|
|
|
|
appCfgDao.insertAppPolicyIpCfg(cfg);
|
2018-08-22 15:20:14 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 保存关键字配置
|
|
|
|
|
|
if (entity != null && entity.getNtcSubscribeIdCfgList() != null) {
|
|
|
|
|
|
for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(cfg.getCfgKeywords())) {
|
|
|
|
|
|
entity.setCfgKeywords(cfg.getCfgKeywords());
|
2018-09-26 16:00:45 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType", "exprType", "matchMethod", "isHexbin" });
|
2018-08-24 15:32:11 +08:00
|
|
|
|
stringcfgDao.saveSubscribeIdCfg(cfg);
|
2018-06-25 10:44:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
|
|
|
|
|
cfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置SubscribeID域配置参数
|
2018-09-26 16:00:45 +08:00
|
|
|
|
// if (entity != null && entity.getNtcSubscribeIdCfgList() != null) {
|
|
|
|
|
|
// for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) {
|
|
|
|
|
|
// entity.setExprType(cfg.getExprType());
|
|
|
|
|
|
// entity.setIsHexbin(cfg.getIsHexbin());
|
|
|
|
|
|
// entity.setMatchMethod(cfg.getMatchMethod());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2018-08-24 15:32:11 +08:00
|
|
|
|
appCfgDao.updateAppPolicyCfg(entity);
|
2018-08-25 17:07:34 +08:00
|
|
|
|
|
|
|
|
|
|
// 先删后加 各域配置
|
2018-07-04 16:03:07 +08:00
|
|
|
|
appCfgDao.deleteAppPolicyIpCfg(entity);
|
2018-08-25 17:07:34 +08:00
|
|
|
|
appCfgDao.deleteSubscribeIdCfg(entity);
|
|
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-06-25 10:44:38 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-25 10:44:38 +08:00
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存策略IP配置
|
|
|
|
|
|
if (entity.getIpPortList() != null) {
|
|
|
|
|
|
for (IpPortCfg cfg : entity.getIpPortList()) {
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" });
|
2018-07-04 16:03:07 +08:00
|
|
|
|
appCfgDao.insertAppPolicyIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity != null && entity.getNtcSubscribeIdCfgList() != null) {
|
|
|
|
|
|
for (NtcSubscribeIdCfg cfg : entity.getNtcSubscribeIdCfgList()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(cfg.getCfgKeywords())) {
|
|
|
|
|
|
entity.setCfgKeywords(cfg.getCfgKeywords());
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg,
|
|
|
|
|
|
new String[] { "cfgRegionCode", "cfgType", "exprType", "matchMethod", "isHexbin" });
|
|
|
|
|
|
stringcfgDao.saveSubscribeIdCfg(cfg);
|
2018-08-22 15:20:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
}
|
2018-11-21 11:19:40 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-06-22 18:46:01 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-09-07 20:18:59 +08:00
|
|
|
|
|
|
|
|
|
|
SpecificServiceCfg specificServiceCfg=specificServiceCfgDao.getBySpecServiceId(entity.getSpecServiceId());
|
2018-11-11 19:36:53 +08:00
|
|
|
|
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getConfigGroupInfoByGroupId(specificServiceCfg.getGroupId());
|
2018-09-07 20:18:59 +08:00
|
|
|
|
if(configGroupInfo==null) {//一般特定服务的组号是新增之后就有的,不会进入这一步。
|
|
|
|
|
|
Integer groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
2018-11-02 16:59:03 +08:00
|
|
|
|
Integer compileId=ConfigServiceUtil.getId(1, 1).get(0);
|
2018-09-07 20:18:59 +08:00
|
|
|
|
specificServiceCfg.setGroupId(groupId);
|
|
|
|
|
|
configGroupInfo = new ConfigGroupInfo();
|
|
|
|
|
|
configGroupInfo.setGroupId(specificServiceCfg.getGroupId());
|
|
|
|
|
|
configGroupInfo.setGroupName(specificServiceCfg.getSpecServiceName());
|
|
|
|
|
|
configGroupInfo.setIsIssued(0);
|
2019-02-18 02:39:49 +00:00
|
|
|
|
configGroupInfo.setInsertTime(new Date());
|
2018-09-07 20:18:59 +08:00
|
|
|
|
configGroupInfo.setGroupType(1);
|
2018-11-02 16:59:03 +08:00
|
|
|
|
configGroupInfo.setCompileId(compileId);
|
2018-11-11 19:36:53 +08:00
|
|
|
|
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
2018-09-07 20:18:59 +08:00
|
|
|
|
//更新group_id
|
|
|
|
|
|
specificServiceCfg.setOpTime(new Date());
|
|
|
|
|
|
specificServiceCfgDao.update(specificServiceCfg);
|
|
|
|
|
|
}
|
2018-11-02 16:59:03 +08:00
|
|
|
|
Integer compileId = configGroupInfo.getCompileId();
|
|
|
|
|
|
/*if(configGroupInfo.getIsIssued().intValue()==0) {//没有下发过
|
2018-09-07 20:18:59 +08:00
|
|
|
|
//查询AppIpCfg对应 的未下发IP的编译ID
|
|
|
|
|
|
List<AppIpCfg> beforeCfg=appCfgDao.getAppIpCfgBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
if(beforeCfg==null||beforeCfg.size()==0) {//第一条,获取编译id
|
|
|
|
|
|
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(e.getMessage());
|
2018-06-25 10:44:38 +08:00
|
|
|
|
}
|
2018-09-07 20:18:59 +08:00
|
|
|
|
}else {
|
|
|
|
|
|
compileId=beforeCfg.get(0).getCompileId();
|
|
|
|
|
|
}
|
|
|
|
|
|
}else if(configGroupInfo.getIsIssued().intValue()==1){//下发过了
|
2018-09-26 17:43:50 +08:00
|
|
|
|
// List<AppIpCfg> beforeCfg=appCfgDao.getAppIpCfgBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
// if(beforeCfg==null||beforeCfg.size()==0) {
|
|
|
|
|
|
// throw new RuntimeException("Can't get compileId, there is not app ip in an issued group");
|
|
|
|
|
|
// }
|
|
|
|
|
|
compileId=configGroupInfo.getCompileId();
|
2018-09-07 20:18:59 +08:00
|
|
|
|
}else {
|
|
|
|
|
|
throw new RuntimeException("Unknown configGroupInfo isIssued value");
|
2018-11-02 16:59:03 +08:00
|
|
|
|
}*/
|
2018-09-07 20:18:59 +08:00
|
|
|
|
entity.setUserRegion1(String.valueOf(ConfigServiceUtil.getId(3, 1).get(0)));
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
appCfgDao.insertAppIpCfg(entity);
|
2018-09-26 17:43:50 +08:00
|
|
|
|
//app ip的编译ID存于configGroupInfo中
|
|
|
|
|
|
if((configGroupInfo.getCompileId()==null)||(compileId.intValue()!=configGroupInfo.getCompileId().intValue())) {
|
|
|
|
|
|
configGroupInfo.setCompileId(entity.getCompileId());
|
2018-11-11 19:36:53 +08:00
|
|
|
|
configGroupInfoDao.updateConfigGroupInfobyGroupId(configGroupInfo);
|
2018-09-26 17:43:50 +08:00
|
|
|
|
}
|
2018-09-07 20:18:59 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
|
|
|
|
|
cfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg,
|
|
|
|
|
|
new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective",
|
|
|
|
|
|
"areaEffectiveIds", "protocol", "portPattern", "srcPort", "destPort",
|
|
|
|
|
|
"direction", "destIpAddress", "srcIpAddress", "ipPattern" });
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
2018-06-25 10:44:38 +08:00
|
|
|
|
}
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-06-25 10:44:38 +08:00
|
|
|
|
appCfgDao.updateAppIpCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-06-25 10:44:38 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg,
|
|
|
|
|
|
new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective", "areaEffectiveIds",
|
|
|
|
|
|
"protocol", "portPattern", "srcPort", "destPort", "direction", "destIpAddress",
|
|
|
|
|
|
"srcIpAddress", "ipPattern" });
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
}
|
2018-11-02 20:36:51 +08:00
|
|
|
|
public void saveAppHttpCfg(List<ComplexkeywordCfg> cfgs) {
|
|
|
|
|
|
for(ComplexkeywordCfg cfg:cfgs) {
|
|
|
|
|
|
AppHttpCfg appHttpCfg=new AppHttpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(cfg, appHttpCfg);
|
|
|
|
|
|
appCfgDao.insertAppHttpCfg(appHttpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppHttpCfg(AppHttpCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-06-22 18:46:01 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
compileId = idList.get(0);
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-06-25 10:44:38 +08:00
|
|
|
|
appCfgDao.insertAppHttpCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" });
|
|
|
|
|
|
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
2018-06-28 17:16:58 +08:00
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-06-25 10:44:38 +08:00
|
|
|
|
appCfgDao.updateAppHttpCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-06-25 10:44:38 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-11-05 16:26:02 +08:00
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
2018-11-11 19:36:53 +08:00
|
|
|
|
public void saveAppDomainCfg(List<BaseStringCfg<?>> cfgs){
|
2018-11-05 16:26:02 +08:00
|
|
|
|
for(BaseStringCfg cfg:cfgs) {
|
|
|
|
|
|
AppDomainCfg entity=new AppDomainCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(cfg, entity);
|
|
|
|
|
|
appCfgDao.insertAppDomainCfg(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-06-22 18:46:01 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
compileId = idList.get(0);
|
2018-04-03 11:12:49 +08:00
|
|
|
|
}
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
appCfgDao.insertAppDomainCfg(entity);
|
|
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} catch (Exception e) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
2018-06-28 17:16:58 +08:00
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
2018-04-03 11:12:49 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-06-25 10:44:38 +08:00
|
|
|
|
appCfgDao.updateAppDomainCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-06-25 10:44:38 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-04-03 11:12:49 +08:00
|
|
|
|
}
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 主题网站新增 修改
|
|
|
|
|
|
public void saveOrUpdateAppTopicDomainCfg(AppTopicDomainCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-08-23 17:07:09 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
compileId = idList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
appCfgDao.insertAppTopicDomainCfg(entity);
|
|
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-08-23 17:07:09 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} catch (Exception e) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
appCfgDao.updateAppTopicDomainCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-08-23 17:07:09 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-08-23 17:07:09 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppByteCfg(AppByteCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-06-22 18:46:01 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
compileId = idList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
appCfgDao.insertAppByteCfg(entity);
|
|
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} catch (Exception e) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
2018-06-28 17:16:58 +08:00
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-04-08 17:19:43 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-06-25 10:44:38 +08:00
|
|
|
|
appCfgDao.updateAppByteCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-06-25 10:44:38 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-06-25 10:44:38 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-06-25 10:44:38 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppSslCfg(AppSslCertCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-08-20 21:01:58 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
compileId = idList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
appCfgDao.insertAppSslCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" });
|
2018-08-20 21:01:58 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
appCfgDao.updateAppSslCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-08-20 21:01:58 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-08-20 21:01:58 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppTcpeCfg(AppTcpCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-08-24 10:25:01 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
compileId = idList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
appCfgDao.insertAppTcpCfg(entity);
|
|
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-08-24 10:25:01 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} catch (Exception e) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
appCfgDao.updateAppTcpCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-08-24 10:25:01 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-08-24 10:25:01 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppTcpCfg(AppTcpCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-08-24 10:25:01 +08:00
|
|
|
|
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.setTableName(AppTcpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
List<AppTcpCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(numRegionList, list, 4, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
numRegionList = map.get("dstList");
|
2018-08-24 10:25:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
/*
|
|
|
|
|
|
* //保存区域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()); appCfgDao.auditCfg(cfg);
|
|
|
|
|
|
* if(isAudit==1){ Map<String,List> map =
|
|
|
|
|
|
* cfgConvert(areaIpRegionList,areaIpCfgList,4,entity,groupRelationList);
|
|
|
|
|
|
* groupRelationList=map.get("groupList"); areaIpRegionList=map.get("dstList");
|
|
|
|
|
|
* } }
|
|
|
|
|
|
*/
|
|
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entity.getAppCode();
|
2018-08-24 10:25:01 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app SSL配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-08-24 10:25:01 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app TCP配置下发响应信息:" + result.getMsg());
|
2018-08-24 10:25:01 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-08-24 10:25:01 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app TCP配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app TCP配置取消配置响应信息:" + result.getMsg());
|
2018-08-24 10:25:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppPolicyCfg(AppPolicyCfg entity, Integer isAudit) {
|
|
|
|
|
|
String configType = entity.getConfigType();
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
List<IpCfg> areaIpRegionList = new ArrayList();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setTableName(AppPolicyCfg.getTablename());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
List<NtcSubscribeIdCfg> ntcList = new ArrayList();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 更新关键字表状态
|
|
|
|
|
|
if (entity.getCompileId() != null) {
|
2018-08-22 15:20:14 +08:00
|
|
|
|
NtcSubscribeIdCfg ntc = new NtcSubscribeIdCfg();
|
|
|
|
|
|
ntc.setCompileId(entity.getCompileId());
|
|
|
|
|
|
ntc.setIsAudit(entity.getIsAudit());
|
|
|
|
|
|
ntc.setIsValid(entity.getIsValid());
|
|
|
|
|
|
ntc.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
ntc.setAuditTime(entity.getAuditTime());
|
|
|
|
|
|
stringcfgDao.updateSubscribeIdCfg(ntc);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
StringBuffer cfgKeywords = new StringBuffer();
|
|
|
|
|
|
if (entity.getBehavCode() != null) {
|
|
|
|
|
|
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) {
|
|
|
|
|
|
cfgKeywords.append(Constants.APP_ID_REGION + "=" + entity.getAppCode());
|
|
|
|
|
|
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)
|
|
|
|
|
|
|| Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) {
|
|
|
|
|
|
cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + entity.getAppCode());
|
2018-08-06 15:09:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
cfgKeywords.append(Constants.KEYWORD_EXPR);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
cfgKeywords.append(Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode());
|
|
|
|
|
|
// entity.setCfgKeywords(entity.getAppCode()+Constants.KEYWORD_EXPR+entity.getBehavCode());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) {
|
|
|
|
|
|
cfgKeywords.append(Constants.APP_ID_REGION + "=" + entity.getAppCode());
|
|
|
|
|
|
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)
|
|
|
|
|
|
|| Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) {
|
|
|
|
|
|
cfgKeywords.append(Constants.PROTO_ID_REGION + "=" + entity.getAppCode());
|
2018-08-06 15:09:12 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// entity.setCfgKeywords(entity.getAppCode()+"");
|
2018-06-28 17:16:58 +08:00
|
|
|
|
}
|
2018-08-06 15:09:12 +08:00
|
|
|
|
entity.setCfgKeywords(cfgKeywords.toString());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
List<AppPolicyCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(strRegionList, list, 2, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
strRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 查询子配置并修改审核状态
|
2018-11-28 19:23:38 +08:00
|
|
|
|
entity = this.getAppPolicyCfg(entity.getCfgId(),entity.getCompileId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getIpPortList() != null && entity.getIpPortList().size() > 0) {
|
2018-07-04 16:03:07 +08:00
|
|
|
|
IpPortCfg cfg = new IpPortCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-07-04 16:03:07 +08:00
|
|
|
|
cfg.setTableName(IpPortCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
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"));
|
2018-07-04 16:03:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getNtcSubscribeIdCfgList() != null && entity.getNtcSubscribeIdCfgList().size() > 0) {
|
|
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> ntcMap = cfgConvert(strRegionList, entity.getNtcSubscribeIdCfgList(), 2, entity,
|
|
|
|
|
|
groupRelationList);
|
|
|
|
|
|
groupRelationList = ntcMap.get("groupList");
|
|
|
|
|
|
strRegionList = ntcMap.get("dstList");
|
2018-08-22 15:20:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
String userRegion = null;
|
|
|
|
|
|
if (Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equalsIgnoreCase(configType)) {
|
|
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
userRegion = Constants.APP_ID_REGION + "=" + entity.getAppCode();
|
|
|
|
|
|
if (entity.getBehavCode() != null) {
|
|
|
|
|
|
userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode();
|
2018-07-24 18:45:27 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) {
|
|
|
|
|
|
userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode();
|
|
|
|
|
|
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) {
|
|
|
|
|
|
userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode();
|
|
|
|
|
|
if (entity.getBehavCode() != null) {
|
|
|
|
|
|
userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode();
|
2018-08-06 15:09:12 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-06 15:09:12 +08:00
|
|
|
|
}
|
2018-11-29 16:22:28 +08:00
|
|
|
|
|
|
|
|
|
|
// 限速业务需要设置
|
|
|
|
|
|
if (Constants.RATELIMIT_ACTION.equals(entity.getAction())) {
|
|
|
|
|
|
entity.setUserRegion1(StringUtil.isEmpty(entity.getUserRegion1()) ? "0":entity.getUserRegion1());
|
|
|
|
|
|
//限速 需要发Droprate=0.001 ,暂不支持Bandwidth=200kbps
|
|
|
|
|
|
if(entity.getUserRegion1().equals("0")){//丢包率
|
|
|
|
|
|
entity.setUserRegion2(StringUtil.isEmpty(entity.getUserRegion2()) ? "":entity.getUserRegion2());
|
|
|
|
|
|
userRegion+=Constants.USER_REGION_SPLIT +Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+entity.getUserRegion2();
|
|
|
|
|
|
}else if(entity.getUserRegion1().equals("1")){//带宽
|
|
|
|
|
|
entity.setUserRegion3(StringUtil.isEmpty(entity.getUserRegion3()) ? "":entity.getUserRegion3());
|
|
|
|
|
|
userRegion+=Constants.USER_REGION_SPLIT +Constants.INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY+"="+entity.getUserRegion3();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-01-10 15:47:52 +06:00
|
|
|
|
//DKC=8
|
|
|
|
|
|
if(!StringUtil.isEmpty(entity.getUserRegion4())){
|
2019-01-11 11:36:04 +06:00
|
|
|
|
userRegion+=Constants.USER_REGION_SPLIT +Constants.APP_VIGNORE_USER_REGION_KEY+"="+entity.getUserRegion4();
|
2018-11-29 16:22:28 +08:00
|
|
|
|
}
|
2018-12-29 14:53:57 +06:00
|
|
|
|
userRegion+=Constants.USER_REGION_SPLIT+"config_id="+entity.getCompileId();
|
2018-08-06 15:09:12 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app策略配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-06-22 18:46:01 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app策略配置下发响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app策略配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app策略配置取消配置响应信息:" + result.getMsg());
|
2018-04-03 11:12:49 +08:00
|
|
|
|
}
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppIpCfg(AppIpCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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-06-23 17:29:14 +08:00
|
|
|
|
entity.setTableName(AppIpCfg.getTablename());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
List<AppIpCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(ipRegionList, list, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
ipRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entity.getAppCode();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app协议IP配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-06-22 18:46:01 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app协议IP配置下发响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app协议IP配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app协议IP配置取消配置响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-09-07 20:18:59 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* ip复用批量审核
|
|
|
|
|
|
* @param data
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void auditAppIpCfg(List<AppIpCfg> data) {
|
|
|
|
|
|
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
|
|
|
|
|
SqlSession batchSqlSession = null;
|
|
|
|
|
|
try{
|
|
|
|
|
|
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
|
|
|
|
|
for(int index = 0; index < data.size();index++){
|
|
|
|
|
|
AppIpCfg t = data.get(index);
|
|
|
|
|
|
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).auditCfg(t);
|
|
|
|
|
|
}
|
|
|
|
|
|
batchSqlSession.commit();
|
|
|
|
|
|
}finally {
|
|
|
|
|
|
if(batchSqlSession != null){
|
|
|
|
|
|
batchSqlSession.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void auditAppIpCfg(List<AppIpCfg> entitys, Integer isAudit) {
|
|
|
|
|
|
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();
|
2019-01-18 11:14:05 +06:00
|
|
|
|
Integer serviceId=0;
|
2018-09-07 20:18:59 +08:00
|
|
|
|
this.auditAppIpCfg(entitys);
|
2019-01-18 11:14:05 +06:00
|
|
|
|
serviceId=entitys.get(0).getServiceId();
|
2018-09-07 20:18:59 +08:00
|
|
|
|
// for(AppIpCfg entity:entitys) {
|
|
|
|
|
|
// // 保存区域IP信息
|
|
|
|
|
|
// List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entitys.get(0).getCompileId());
|
|
|
|
|
|
// if (!StringUtil.isEmpty(areaIpCfgList)) {
|
|
|
|
|
|
// AreaIpCfg cfg = new AreaIpCfg();
|
|
|
|
|
|
// BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
|
|
|
|
|
// cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
// appCfgDao.auditCfg(cfg);
|
|
|
|
|
|
// if (isAudit == 1) {
|
|
|
|
|
|
// Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
// groupRelationList = map.get("groupList");
|
|
|
|
|
|
// areaIpRegionList = map.get("dstList");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
Integer specServiceId= entitys.get(0).getSpecServiceId();
|
|
|
|
|
|
SpecificServiceCfg specificServiceCfg=specificServiceCfgDao.getBySpecServiceId(specServiceId);
|
|
|
|
|
|
//String businessType=specificServiceCfg.getBusinessType();
|
2018-11-11 19:36:53 +08:00
|
|
|
|
ConfigGroupInfo configGroupInfo=configGroupInfoDao.getConfigGroupInfoByGroupId(specificServiceCfg.getGroupId());
|
2018-09-07 20:18:59 +08:00
|
|
|
|
if(configGroupInfo==null) {
|
|
|
|
|
|
Integer groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
|
|
|
|
|
specificServiceCfg.setGroupId(groupId);
|
|
|
|
|
|
configGroupInfo = new ConfigGroupInfo();
|
|
|
|
|
|
configGroupInfo.setGroupId(specificServiceCfg.getGroupId());
|
|
|
|
|
|
configGroupInfo.setGroupName(specificServiceCfg.getSpecServiceName());
|
|
|
|
|
|
configGroupInfo.setIsIssued(0);
|
2018-09-26 17:43:50 +08:00
|
|
|
|
configGroupInfo.setCompileId(entitys.get(0).getCompileId());
|
2018-09-07 20:18:59 +08:00
|
|
|
|
configGroupInfo.setGroupType(1);
|
2018-11-11 19:36:53 +08:00
|
|
|
|
configGroupInfoDao.insertConfigGroupInfo(configGroupInfo);
|
2018-09-07 20:18:59 +08:00
|
|
|
|
//更新group_id
|
|
|
|
|
|
specificServiceCfg.setOpTime(new Date());
|
|
|
|
|
|
specificServiceCfgDao.update(specificServiceCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
Integer groupId=configGroupInfo.getGroupId();
|
|
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
if(configGroupInfo.getIsIssued()==0) {//未下发,下发region compile,group.
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
//group
|
|
|
|
|
|
GroupCfg groupCfg=new GroupCfg();
|
|
|
|
|
|
groupCfg.setCompileId(entitys.get(0).getCompileId());
|
|
|
|
|
|
groupCfg.setGroupId(groupId);
|
2019-01-16 14:33:29 +06:00
|
|
|
|
groupCfg.setIsCommonGroup(1);
|
2018-09-07 20:18:59 +08:00
|
|
|
|
groupCfg.setIsValid(Constants.VALID_YES);
|
|
|
|
|
|
groupCfg.setAuditTime(entitys.get(0).getAuditTime());
|
|
|
|
|
|
groupRelationList.add(groupCfg);
|
|
|
|
|
|
BeanUtils.copyProperties(entitys.get(0), maatCfg);
|
|
|
|
|
|
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(entitys,Constants.VALID_YES,groupId));
|
|
|
|
|
|
maatCfg.setAction(entitys.get(0).getAction());
|
|
|
|
|
|
maatCfg.setAuditTime(entitys.get(0).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(entitys.get(0).getIsValid());
|
|
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entitys.get(0).getAppCode()/*+Constants.USER_REGION_SPLIT+"ASEV_ID="+businessType*/;
|
|
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
|
|
|
|
|
maatBean.setAuditTime(entitys.get(0).getAuditTime());
|
|
|
|
|
|
maatBean.setCreatorName(entitys.get(0).getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app协议IP配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("app协议IP配置下发响应信息:" + result.getMsg());
|
|
|
|
|
|
configGroupInfo.setIsIssued(1);
|
|
|
|
|
|
configGroupInfo.setUpdateTime(new Date());
|
2018-11-11 19:36:53 +08:00
|
|
|
|
configGroupInfoDao.updateConfigGroupInfobyGroupId(configGroupInfo);
|
2018-09-07 20:18:59 +08:00
|
|
|
|
}else if(configGroupInfo.getIsIssued()==1) {//已经下发,分组复用下发
|
|
|
|
|
|
GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
|
|
|
|
|
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
|
|
|
|
|
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
2018-10-16 19:32:30 +08:00
|
|
|
|
/*groupReuseCfg.setUserRegion(userRegion);*/
|
2019-01-16 14:33:29 +06:00
|
|
|
|
/*groupReuseCfg.setServiceId(entitys.get(0).getServiceId());*/
|
2018-09-07 20:18:59 +08:00
|
|
|
|
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(entitys,Constants.VALID_YES,groupId));
|
|
|
|
|
|
groupReuseCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
groupReuseCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
groupReuseCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
groupReuseList.add(groupReuseCfg);
|
|
|
|
|
|
maatBean.setGroupReuseCfgList(groupReuseList);
|
|
|
|
|
|
maatBean.setAuditTime(entitys.get(0).getAuditTime());
|
|
|
|
|
|
maatBean.setCreatorName(entitys.get(0).getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
//调用服务接口下发配置数据
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app协议IP域新增配置下发配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
2019-01-16 14:33:29 +06:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,1);
|
2018-09-07 20:18:59 +08:00
|
|
|
|
logger.info("app协议IP域新增配置响应信息:"+result.getMsg());
|
|
|
|
|
|
}else {
|
|
|
|
|
|
throw new RuntimeException("Unknown configGroupInfo isIssued value");
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (isAudit == 3) {
|
2019-01-18 11:14:05 +06:00
|
|
|
|
//判断配置取消之后,是否还有有效的配置
|
|
|
|
|
|
if(hasValidAppIp(configGroupInfo.getCompileId())){
|
|
|
|
|
|
//已经下发过的,调用分组复用配置删除接口
|
|
|
|
|
|
GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
|
|
|
|
|
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
|
|
|
|
|
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
|
|
|
|
|
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(entitys,Constants.VALID_NO,groupId));
|
|
|
|
|
|
groupReuseCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
groupReuseCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
groupReuseCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
groupReuseList.add(groupReuseCfg);
|
|
|
|
|
|
maatBean.setGroupReuseCfgList(groupReuseList);
|
|
|
|
|
|
maatBean.setAuditTime(entitys.get(0).getAuditTime());
|
|
|
|
|
|
maatBean.setCreatorName(entitys.get(0).getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
|
|
|
|
//调用服务接口下发配置数据
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app协议IP域删除配置下发配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.auditCommonGroupRegionSources(json,3);
|
|
|
|
|
|
logger.info("app协议IP域删除配置响应信息:"+result.getMsg());
|
|
|
|
|
|
}else{
|
|
|
|
|
|
//修改组的有效状态为无效。并发送compileid 配置取消 此后组的app ip不再自动下发。
|
|
|
|
|
|
ConfigGroupInfo appConfigGroup=new ConfigGroupInfo();
|
|
|
|
|
|
appConfigGroup.setIsIssued(0);
|
|
|
|
|
|
appConfigGroup.setUpdateTime(new Date());
|
|
|
|
|
|
appConfigGroup.setGroupId(configGroupInfo.getGroupId());
|
|
|
|
|
|
configGroupInfoDao.updateConfigGroupInfobyGroupId(appConfigGroup);
|
|
|
|
|
|
//asn group下没有asn ip之后,需要失效整个compileId,并且不保留公共组信息
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
maatCfg.setCompileId(configGroupInfo.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(serviceId);
|
|
|
|
|
|
maatCfg.setIsValid(0);//无效
|
|
|
|
|
|
//configCompileList.add(addKeepGroupList(maatCfg,entity));
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
|
|
|
|
|
maatBean.setAuditTime(new Date());
|
|
|
|
|
|
maatBean.setCreatorName(UserUtils.getUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app Ip 取消配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
|
|
|
|
|
logger.info("app Ip 取消配置响应信息:"+result.getMsg());
|
|
|
|
|
|
}
|
2018-09-07 20:18:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppHttpCfg(AppHttpCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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-06-23 17:29:14 +08:00
|
|
|
|
entity.setTableName(AppHttpCfg.getTablename());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
List<AppHttpCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(strRegionList, list, 2, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
strRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entity.getAppCode();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app HTTP配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-06-22 18:46:01 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app HTTP配置下发响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app HTTP配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app HTTP配置取消配置响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppDomainCfg(AppDomainCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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-06-23 17:29:14 +08:00
|
|
|
|
entity.setTableName(AppDomainCfg.getTablename());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
2018-12-05 17:56:41 +08:00
|
|
|
|
entity.setCfgKeywords(entity.getCfgKeywords());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
List<AppDomainCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(strRegionList, list, 2, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
strRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entity.getAppCode() + Constants.USER_REGION_SPLIT + "DOMAIN_ID="
|
|
|
|
|
|
+ entity.getCompileId() + Constants.USER_REGION_SPLIT + "DOMAIN_STR="
|
2018-12-05 17:56:41 +08:00
|
|
|
|
+ keywordsEscape(entity.getCfgKeywords());
|
2019-01-23 10:33:55 +00:00
|
|
|
|
if(!StringUtil.isEmpty(entity.getUserRegion5())){
|
|
|
|
|
|
userRegion+=";"+Constants.INTERCEPT_DOMAN_INTENSITY_USER_REGION_KEY+"="+entity.getUserRegion5();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app域名配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-06-22 18:46:01 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app域名配置下发响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app域名配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app域名配置取消配置响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// app主题网站配置审核
|
|
|
|
|
|
public void auditAppTopicDomainCfg(AppTopicDomainCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-08-23 17:07:09 +08:00
|
|
|
|
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.setTableName(AppTopicDomainCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 域名为关键字
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-12-05 17:56:41 +08:00
|
|
|
|
entity.setCfgKeywords(entity.getCfgKeywords());
|
2018-08-23 17:07:09 +08:00
|
|
|
|
List<AppTopicDomainCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(strRegionList, list, 2, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
strRegionList = map.get("dstList");
|
2018-08-23 17:07:09 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-08-23 17:07:09 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-08-23 17:07:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-29 22:46:49 +08:00
|
|
|
|
// 设置APP自定义域
|
2018-12-05 17:56:41 +08:00
|
|
|
|
String domain = entity.getCfgKeywords();
|
2018-08-29 22:46:49 +08:00
|
|
|
|
WebsiteDomainTopic websiteDomainTopic = new WebsiteDomainTopic();
|
|
|
|
|
|
websiteDomainTopic.setDomain(domain);
|
|
|
|
|
|
//查询domainId
|
|
|
|
|
|
List<WebsiteDomainTopic> domainDict = appCfgDao.getDomainDict(websiteDomainTopic);
|
|
|
|
|
|
Long domainId = domainDict.get(0).getId();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// "APP_ID="+entity.getAppCode()+Constants.USER_REGION_SPLIT+
|
2018-12-08 18:37:14 +08:00
|
|
|
|
String userRegion = "WEB_ID=" + domainId /*+ Constants.USER_REGION_SPLIT + "DOMAIN_STR="
|
2018-09-03 17:28:25 +08:00
|
|
|
|
+ keywordsEscape(entity.getDomain())*/;
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-23 20:53:04 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-23 17:07:09 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app主题网站配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-08-23 17:07:09 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app主题网站配置下发响应信息:" + result.getMsg());
|
2018-08-23 17:07:09 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-08-23 17:07:09 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-08-23 17:07:09 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app主题网站配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app主题网站配置取消配置响应信息:" + result.getMsg());
|
2018-08-23 17:07:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppByteCfg(AppByteCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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-06-23 17:29:14 +08:00
|
|
|
|
entity.setTableName(AppByteCfg.getTablename());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-06-23 17:29:14 +08:00
|
|
|
|
entity.setCfgKeywords(entity.getBytes());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
List<AppByteCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(strRegionList, list, 2, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
strRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置用户自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entity.getAppCode();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app字节配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-06-22 18:46:01 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app字节配置下发响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-06-22 18:46:01 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app字节配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app字节配置取消配置响应信息:" + result.getMsg());
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppSslCfg(AppSslCertCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-08-20 21:01:58 +08:00
|
|
|
|
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.setTableName(AppSslCertCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
List<AppSslCertCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(strRegionList, list, 3, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
strRegionList = map.get("dstList");
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-08-20 21:01:58 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entity.getAppCode();
|
2018-08-20 21:01:58 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app SSL配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-08-21 19:03:31 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app SSL配置下发响应信息:" + result.getMsg());
|
2018-08-20 21:01:58 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-08-20 21:01:58 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app SSL配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app SSL配置取消配置响应信息:" + result.getMsg());
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void updateAppPolicyCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppPolicyCfg entity = new AppPolicyCfg();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppPolicyCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 查询子配置
|
2018-11-28 19:23:38 +08:00
|
|
|
|
entity = this.getAppPolicyCfg(Long.parseLong(id),entity.getCompileId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getIpPortList() != null && entity.getIpPortList().size() > 0) {
|
2018-07-04 16:03:07 +08:00
|
|
|
|
IpPortCfg cfg = new IpPortCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-07-04 16:03:07 +08:00
|
|
|
|
cfg.setTableName(IpPortCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 删除关键字
|
|
|
|
|
|
if (entity.getNtcSubscribeIdCfgList() != null && entity.getNtcSubscribeIdCfgList().size() > 0) {
|
2018-08-25 17:07:34 +08:00
|
|
|
|
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
|
|
|
|
|
stringcfgDao.updateSubscribeIdCfg(cfg);
|
2018-08-22 15:20:14 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void updateAppIpCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppIpCfg entity = new AppIpCfg();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppIpCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void updateAppTcpCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppTcpCfg entity = new AppTcpCfg();
|
2018-08-24 10:25:01 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppTcpCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-08-24 10:25:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-08-24 10:25:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-24 10:25:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-24 10:25:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void updateAppHttpCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppHttpCfg entity = new AppHttpCfg();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppHttpCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-04-03 11:12:49 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppDomainCfg entity = new AppDomainCfg();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppDomainCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 主题网站配置删除
|
|
|
|
|
|
public void updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId) {
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppTopicDomainCfg entity = new AppTopicDomainCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppTopicDomainCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
|
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
|
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
|
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
2018-08-23 17:07:09 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-23 17:07:09 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void updateAppByteCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppByteCfg entity = new AppByteCfg();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppByteCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-06-22 18:46:01 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-06-22 18:46:01 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-04-03 11:12:49 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void updateAppSslCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppSslCertCfg entity = new AppSslCertCfg();
|
2018-08-20 21:01:58 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppSslCertCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-08-20 21:01:58 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-08-20 21:01:58 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-20 21:01:58 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void updateAppHeaderCfgValid(Integer isValid, String ids, Integer functionId) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
String[] idArray = ids.split(",");
|
2018-08-24 15:32:11 +08:00
|
|
|
|
for (String id : idArray) {
|
2018-08-31 16:08:17 +08:00
|
|
|
|
AppHeaderCfg entity = new AppHeaderCfg();
|
2018-08-21 19:03:31 +08:00
|
|
|
|
entity.setCfgId(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setTableName(AppHeaderCfg.getTablename());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
appCfgDao.updateCfgValid(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null && entity.getAreaCfg().size() > 0) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-08-21 19:03:31 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.updateCfgValid(cfg);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-21 19:03:31 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-21 19:03:31 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-21 19:03:31 +08:00
|
|
|
|
public Page<AppHeaderCfg> findAppHeaderList(Page<AppHeaderCfg> page, AppHeaderCfg entity) {
|
2018-08-24 15:32:11 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
2018-08-21 19:03:31 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<AppHeaderCfg> list = appCfgDao.findAppHeaderList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public AppHeaderCfg getAppHeaderCfg(Long cfgId) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
return appCfgDao.getAppHeaderCfg(cfgId);
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdateAppHeaderCfg(AppHeaderCfg entity) throws Exception {
|
|
|
|
|
|
// 设置区域运营商信息
|
2018-08-21 19:03:31 +08:00
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (entity.getCfgId() == null) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
Integer compileId = 0;
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (idList != null && idList.size() > 0) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
compileId = idList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
entity.setCompileId(compileId);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
appCfgDao.insertAppHeaderCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgRegionCode", "cfgType" });
|
2018-08-21 19:03:31 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException(e.getMessage());
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
appCfgDao.updateAppHeaderCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 删除旧的区域IP,新增新的区域IP
|
2018-08-21 19:03:31 +08:00
|
|
|
|
AreaIpCfg area = new AreaIpCfg();
|
|
|
|
|
|
area.setCompileId(entity.getCompileId());
|
|
|
|
|
|
area.setFunctionId(entity.getFunctionId());
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfg(area);
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
entity.setCreatorId(entity.getCurrentUser().getId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
if (entity.getAreaCfg() != null) {
|
|
|
|
|
|
for (AreaIpCfg cfg : entity.getAreaCfg()) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
cfg.initDefaultValue();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgDesc", "cfgRegionCode", "cfgType" });
|
2018-08-21 19:03:31 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(cfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-21 19:03:31 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
2018-08-21 19:03:31 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
public void auditAppHeaderCfg(AppHeaderCfg entity, Integer isAudit) {
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
2018-08-21 19:03:31 +08:00
|
|
|
|
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.setTableName(AppHeaderCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
List<AppHeaderCfg> list = new ArrayList();
|
|
|
|
|
|
list.add(entity);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
Map<String, List> map = cfgConvert(strRegionList, list, 3, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
strRegionList = map.get("dstList");
|
2018-08-21 19:03:31 +08:00
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 保存区域IP信息
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
if (!StringUtil.isEmpty(areaIpCfgList)) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
AreaIpCfg cfg = new AreaIpCfg();
|
2018-08-24 15:32:11 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
|
2018-08-21 19:03:31 +08:00
|
|
|
|
cfg.setTableName(AreaIpCfg.getTablename());
|
|
|
|
|
|
appCfgDao.auditCfg(cfg);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
if (isAudit == 1) {
|
|
|
|
|
|
Map<String, List> map = cfgConvert(areaIpRegionList, areaIpCfgList, 1, entity, groupRelationList);
|
|
|
|
|
|
groupRelationList = map.get("groupList");
|
|
|
|
|
|
areaIpRegionList = map.get("dstList");
|
2018-08-21 19:03:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if (isAudit == 1) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
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());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 设置APP自定义域
|
|
|
|
|
|
String userRegion = "APP_ID=" + entity.getAppCode();
|
2018-08-21 19:03:31 +08:00
|
|
|
|
maatCfg.setUserRegion(userRegion);
|
|
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口下发配置数据
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app Header配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
2018-08-21 19:03:31 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
logger.info("app Header配置下发响应信息:" + result.getMsg());
|
2018-08-21 19:03:31 +08:00
|
|
|
|
|
2018-08-24 15:32:11 +08:00
|
|
|
|
} else if (isAudit == 3) {
|
2018-08-21 19:03:31 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
2018-08-24 15:32:11 +08:00
|
|
|
|
maatCfg.setIsValid(0);// 无效
|
2018-08-21 19:03:31 +08:00
|
|
|
|
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);
|
2018-08-24 15:32:11 +08:00
|
|
|
|
// 调用服务接口取消配置
|
|
|
|
|
|
String json = gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("app Header配置下发配置参数:" + json);
|
|
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
|
|
|
|
|
logger.info("app Header配置取消配置响应信息:" + result.getMsg());
|
2018-08-21 19:03:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-29 22:46:49 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取主题跟服务表中的域名
|
|
|
|
|
|
* @param websiteDomainTopic
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<WebsiteDomainTopic> getDomainDict(WebsiteDomainTopic websiteDomainTopic) {
|
|
|
|
|
|
return appCfgDao.getDomainDict(websiteDomainTopic);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 保存自定义的域名
|
|
|
|
|
|
* @param websiteDomainTopic
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
|
|
|
|
|
public void saveDomainDict(WebsiteDomainTopic websiteDomainTopic) {
|
|
|
|
|
|
|
|
|
|
|
|
appCfgDao.saveDomainDict(websiteDomainTopic);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2018-11-17 23:59:50 +08:00
|
|
|
|
|
2019-01-18 11:14:05 +06:00
|
|
|
|
public boolean hasValidAppIp(Integer compileId){
|
|
|
|
|
|
List<AppIpCfg> appIps=appCfgDao.findAppIpByCompileId(compileId);
|
|
|
|
|
|
if(!StringUtil.isEmpty(appIps)){
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-09 16:50:39 +08:00
|
|
|
|
}
|