HTTP重定向业务增加自定义域信息

This commit is contained in:
zhangwei
2018-07-05 11:34:43 +08:00
parent 20e3c6a569
commit b2e04c317a
9 changed files with 201 additions and 48 deletions

View File

@@ -366,40 +366,19 @@ public class HttpRedirectCfgService extends CrudService<WebsiteCfgDao,CfgIndexIn
maatCfg.setIsValid(entity.getIsValid());
//判断http配置是否需要设置自定义域参数
String actionValue = DictUtils.getDictCode("SERVICE_ACTION", "action_monit");
String userRegion = "";
//只有监测业务,并且头域的匹配区域不匹配字典中的信息时需要设置
if(!actionValue.equals("默认") && entity.getAction().equals(Integer.parseInt(actionValue))){
//请求头域
if(entity.getHttpReqHdrList()!=null && entity.getHttpReqHdrList().size()>0){
for(ComplexkeywordCfg head:entity.getHttpReqHdrList()){
String dictValue = DictUtils.getDictCode("REQUEST_HEADER_DISTRICT", head.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
if(userRegion.equals("")){
userRegion += "HTTP_HEADER="+head.getDistrict();
}else{
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
}
}
}
if(!StringUtil.isEmpty(entity.getUserRegion1())){
if(entity.getUserRegion1().startsWith(Constants.REDIRECT_RESPONSE_CODE_STARTWITH)){
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1()+
Constants.USER_REGION_SPLIT+
Constants.REDIRECT_URL_KEY+"="+entity.getUserRegion2();
}else{
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+entity.getUserRegion1()+
Constants.USER_REGION_SPLIT+
Constants.REDIRECT_CONTENT_KEY+"="+entity.getUserRegion2();
}
//应答头域
if(entity.getHttpResHdrList()!=null && entity.getHttpResHdrList().size()>0){
for(ComplexkeywordCfg head:entity.getHttpResHdrList()){
String dictValue = DictUtils.getDictCode("RESPONSE_HEADER_DISTRICT", head.getDistrict());
if(StringUtil.isEmpty(dictValue) || dictValue.equals("默认")){
if(userRegion.equals("")){
userRegion += "HTTP_HEADER="+head.getDistrict();
}else{
userRegion += Constants.USER_REGION_SPLIT+"HTTP_HEADER="+head.getDistrict();
}
}
}
}
maatCfg.setUserRegion(userRegion);
}
maatCfg.setUserRegion(userRegion);
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(entity.getAuditTime());