(1)IP配置审核提交

(2)域名白名单审核修改
This commit is contained in:
wangxin
2018-06-04 14:42:52 +08:00
parent 50e1b73d44
commit d640e81439
7 changed files with 241 additions and 356 deletions

View File

@@ -397,152 +397,7 @@ public class BaseController {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(cfg.getFunctionId());
model.addAttribute("serviceList", serviceList);
}
@Deprecated
protected void setSaveOrUpdateProps(Model model,BaseCfg cfg,String areaCfgIds) throws Exception{
String tableName=cfg.getTableName();
List<BaseIpCfg> areaCfg=cfg.getAreaCfg();
List<AreaBean> areaIsps=cfg.getAreaIsp();
if(Constants.IS_AREA_EFFECTIVE_NO==cfg.getIsAreaEffective()){
cfg.setAreaEffectiveIds("");
cfg.setAreaType(null);
}else if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()){
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==cfg.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
StringBuffer areaEffectiveIds=new StringBuffer();
for(int i=0;i<areaIsps.size();i++){
if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
}else{
areaEffectiveIds.append(areaIsps.get(i).getArea());
}
if(i!=areaIsps.size()-1){
areaEffectiveIds.append(",");
}
}
if(StringUtils.isBlank(areaEffectiveIds.toString())){
logger.error("区域管控,且按照地域运营商管控,但是地域运营商为空!");
addMessage(model,"save_failed");
return ;
}
cfg.setAreaEffectiveIds(areaEffectiveIds.toString());
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==cfg.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
cfg.setAreaEffectiveIds("");
}else{
logger.error("区域管控,但是地域+ISP以及地域IP全部为空");
addMessage(model,"save_failed");
return ;
}
}
int serviceId=cfg.getServiceId();
if(StringUtils.isBlank(tableName)){
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
if(serviceConfigInfo!=null){
tableName=serviceConfigInfo.getTableName();
cfg.setTableName(tableName);
}
}
if(cfg.getCompileId()==null){
int compileId=0;
cfg.setCompileId(compileId);
}
Date date=new Date();
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
if(cfg.getCfgId()==null){//新增
cfg.setCreatorId(cfg.getCurrentUser().getId());
cfg.setCreateTime(date);
if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()&&areaCfg!=null){
for(BaseIpCfg area:areaCfg){
area.setTableName(AreaIpCfg.getTablename());
area.setServiceId(serviceId);
area.setCompileId(cfg.getCompileId());
area.setAction(cfg.getAction());
area.setIsValid(Constants.VALID_NO);
area.setIsAudit(Constants.AUDIT_NOT_YET);
area.setRequestId(cfg.getRequestId());
area.setClassify(cfg.getClassify());
area.setAttribute(cfg.getAttribute());
area.setLable(cfg.getLable());
area.setCreatorId(cfg.getCurrentUser().getId());
area.setCreateTime(date);
}
}
if(cfg instanceof BaseIpCfg){
ipCfgService.addIpCfg((BaseIpCfg)cfg,areaCfg);
}else if(cfg instanceof BaseStringCfg){
stringCfgService.addStringCfg((BaseStringCfg)cfg,areaCfg);
}else if(cfg instanceof NumBoundaryCfg){
numCfgService.addNumCfg((NumBoundaryCfg)cfg,areaCfg);
}else if(cfg instanceof ComplexkeywordCfg){
complexStringCfgService.addStringCfg((ComplexkeywordCfg)cfg,areaCfg);
}
}else{//修改
cfg.setEditorId(cfg.getCurrentUser().getId());
cfg.setEditTime(new Date());
List<BaseIpCfg> updateAreaCfg=new ArrayList<>();
List<BaseIpCfg> deleteAreaCfg=new ArrayList<>();
List<BaseIpCfg> addAreaCfg=new ArrayList<>();
String[] cfgIds=null;
if(!StringUtils.isBlank(areaCfgIds)){
cfgIds=areaCfgIds.split(",");
}
if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()&&areaCfg!=null){
for(BaseIpCfg area:areaCfg){
area.setTableName(AreaIpCfg.getTablename());
area.setServiceId(serviceId);
area.setCompileId(cfg.getCompileId());
area.setAction(cfg.getAction());
area.setIsValid(Constants.VALID_NO);
area.setIsAudit(Constants.AUDIT_NOT_YET);
area.setRequestId(cfg.getRequestId());
area.setClassify(cfg.getClassify());
area.setAttribute(cfg.getAttribute());
area.setLable(cfg.getLable());
if(area.getCfgId()==null){
area.setCreatorId(cfg.getCurrentUser().getId());
area.setCreateTime(date);
addAreaCfg.add(area);
}else if(cfgIds!=null){
area.setEditorId(cfg.getCurrentUser().getId());
area.setEditTime(date);
boolean contains=false;
for(String cfgId:cfgIds){
if(!StringUtils.isBlank(cfgId)&&area.getCfgId().longValue()==Long.parseLong(cfgId)){
contains=true;
break;
}
}
if(contains){
updateAreaCfg.add(area);
}else{
deleteAreaCfg.add(area);
}
}
}
}else{
if(cfgIds!=null){
for(String cfgId:cfgIds){
if(!StringUtils.isBlank(cfgId)){
AreaIpCfg area=new AreaIpCfg();
area.setTableName(AreaIpCfg.getTablename());
area.setIsValid(Constants.VALID_DEL);
area.setCfgId(Long.parseLong(cfgId));
area.setEditorId(cfg.getCurrentUser().getId());
area.setEditTime(date);
deleteAreaCfg.add(area);
}
}
}
}
if(cfg instanceof BaseIpCfg){
ipCfgService.updateIpCfg((BaseIpCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
}else if(cfg instanceof BaseStringCfg){
stringCfgService.updateStringCfg((BaseStringCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
}else if(cfg instanceof NumBoundaryCfg){
numCfgService.updateNumCfg((NumBoundaryCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
}else if(cfg instanceof ComplexkeywordCfg){
complexStringCfgService.updateStringCfg((ComplexkeywordCfg)cfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
}
}
addMessage(model,"save_success");
}
}