APP SSL配置提交以及相关表结构、字典sql.
This commit is contained in:
@@ -16,6 +16,7 @@ import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppHttpCfg;
|
||||
import com.nis.domain.configuration.AppIpCfg;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppSslCertCfg;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
@@ -84,6 +85,13 @@ public class AppCfgService extends BaseService {
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public Page<AppSslCertCfg> findAppSslList(Page<AppSslCertCfg> page, AppSslCertCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<AppSslCertCfg> list = appCfgDao.findAppSslList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public AppPolicyCfg getAppPolicyCfg(Long cfgId){
|
||||
AppPolicyCfg policy = appCfgDao.getAppPolicyCfg(cfgId);
|
||||
List<IpPortCfg> ipPortList = appCfgDao.getAppPolicyIpList(policy);
|
||||
@@ -102,6 +110,9 @@ public class AppCfgService extends BaseService {
|
||||
public AppByteCfg getAppByteCfg(Long cfgId){
|
||||
return appCfgDao.getAppByteCfg(cfgId);
|
||||
}
|
||||
public AppSslCertCfg getAppSslCfg(Long cfgId){
|
||||
return appCfgDao.getAppSslCfg(cfgId);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception{
|
||||
//设置区域运营商信息
|
||||
@@ -398,7 +409,65 @@ public class AppCfgService extends BaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdateAppSslCfg(AppSslCertCfg entity) throws Exception{
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
if(entity.getCfgId()==null){
|
||||
Integer compileId = 0;
|
||||
try {
|
||||
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
||||
if(idList!=null && idList.size()>0){
|
||||
compileId = idList.get(0);
|
||||
}
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
appCfgDao.insertAppSslCfg(entity);
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null){
|
||||
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
||||
cfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException(e.getMessage());
|
||||
}
|
||||
}else{
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
appCfgDao.updateAppSslCfg(entity);
|
||||
|
||||
//删除旧的区域IP,新增新的区域IP
|
||||
AreaIpCfg area = new AreaIpCfg();
|
||||
area.setCompileId(entity.getCompileId());
|
||||
area.setFunctionId(entity.getFunctionId());
|
||||
areaIpCfgDao.deleteAreaIpCfg(area);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null){
|
||||
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
||||
cfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void auditAppPolicyCfg(AppPolicyCfg entity,Integer isAudit){
|
||||
String configType=entity.getConfigType();
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
@@ -864,6 +933,87 @@ public class AppCfgService extends BaseService {
|
||||
logger.info("app字节配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
public void auditAppSslCfg(AppSslCertCfg entity,Integer isAudit){
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
entity.setTableName(AppSslCertCfg.getTablename());
|
||||
appCfgDao.auditCfg(entity);
|
||||
|
||||
if(isAudit==1){
|
||||
List<AppSslCertCfg> list = new ArrayList();
|
||||
list.add(entity);
|
||||
Map<String,List> map = cfgConvert(strRegionList,list,3,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
//保存区域IP信息
|
||||
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
AreaIpCfg cfg = new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(AreaIpCfg.getTablename());
|
||||
appCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
areaIpRegionList=map.get("dstList");
|
||||
}
|
||||
}
|
||||
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
||||
if(isAudit==1){
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
//设置APP自定义域
|
||||
String userRegion = "APP_ID="+entity.getAppCode();
|
||||
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);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("app SSL配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
//logger.info("app SSL配置下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("app SSL配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
//logger.info("app SSL配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
public void updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId){
|
||||
AppPolicyCfg entity = new AppPolicyCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
@@ -983,4 +1133,26 @@ public class AppCfgService extends BaseService {
|
||||
}
|
||||
|
||||
}
|
||||
public void updateAppSslCfgValid(Integer isValid,String ids,Integer functionId){
|
||||
AppSslCertCfg entity = new AppSslCertCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setTableName(AppSslCertCfg.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user