增加APP特征配置功能
This commit is contained in:
@@ -267,6 +267,8 @@ public abstract class BaseService {
|
||||
}
|
||||
/**
|
||||
* 界面配置list转换为服务接口端的list
|
||||
* @param <T>
|
||||
* @param <T>
|
||||
* @param dstList
|
||||
* @param srcList
|
||||
* @param cfgType,1为IP类型,2为字符串类型,3为增强字符串,4数值类型,5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
|
||||
@@ -274,13 +276,14 @@ public abstract class BaseService {
|
||||
* @param groupRelationList 配置分组列表
|
||||
* @return
|
||||
*/
|
||||
public static Map<String,List> cfgConvert(List dstList,List srcList,Integer cfgType,BaseCfg baseCfg,List groupRelationList){
|
||||
public static <T> Map<String,List> cfgConvert(List dstList,List<T> srcList,Integer cfgType,BaseCfg baseCfg,List groupRelationList){
|
||||
Map<String,List> map = new HashMap();
|
||||
if(cfgType==1){
|
||||
List numRegionList = new ArrayList();
|
||||
Integer groupId = 0;
|
||||
for(int i=0;i<srcList.size();i++){
|
||||
BaseIpCfg baseIpCfg = (BaseIpCfg) srcList.get(i);
|
||||
for(T srcCfg:srcList){
|
||||
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
||||
BeanUtils.copyProperties(srcCfg, baseIpCfg);
|
||||
IpCfg cfg = new IpCfg();
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
//区域IP配置,多条IP配置属于同一个分组,其他业务配置IP,一条配置一个分组
|
||||
|
||||
@@ -122,6 +122,8 @@ public class AppCfgService extends BaseService {
|
||||
}else{
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.updateAppPolicyCfg(entity);
|
||||
}
|
||||
}
|
||||
@@ -139,6 +141,8 @@ public class AppCfgService extends BaseService {
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.insertAppIpCfg(entity);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -148,6 +152,8 @@ public class AppCfgService extends BaseService {
|
||||
}else{
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.updateAppIpCfg(entity);
|
||||
}
|
||||
}
|
||||
@@ -165,6 +171,8 @@ public class AppCfgService extends BaseService {
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.insertAppHttpCfg(entity);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -174,6 +182,8 @@ public class AppCfgService extends BaseService {
|
||||
}else{
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.updateAppHttpCfg(entity);
|
||||
}
|
||||
}
|
||||
@@ -191,6 +201,8 @@ public class AppCfgService extends BaseService {
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.insertAppDomainCfg(entity);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -200,6 +212,8 @@ public class AppCfgService extends BaseService {
|
||||
}else{
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.updateAppDomainCfg(entity);
|
||||
}
|
||||
}
|
||||
@@ -217,6 +231,8 @@ public class AppCfgService extends BaseService {
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.insertAppByteCfg(entity);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -226,6 +242,8 @@ public class AppCfgService extends BaseService {
|
||||
}else{
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
return appCfgDao.updateAppByteCfg(entity);
|
||||
}
|
||||
}
|
||||
@@ -238,11 +256,9 @@ public class AppCfgService extends BaseService {
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
entity.setTableName(AppPolicyCfg.getTablename());
|
||||
appCfgDao.auditCfg(entity);
|
||||
entity = this.getAppPolicyCfg(entity.getCfgId());
|
||||
if(isAudit==1){
|
||||
entity.setCfgKeywords(entity.getAppCode());
|
||||
List<AppPolicyCfg> list = new ArrayList();
|
||||
@@ -332,15 +348,14 @@ public class AppCfgService extends BaseService {
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
entity = this.getAppIpCfg(entity.getCfgId());
|
||||
entity.setTableName(AppPolicyCfg.getTablename());
|
||||
entity.setTableName(AppIpCfg.getTablename());
|
||||
appCfgDao.auditCfg(entity);
|
||||
if(isAudit==1){
|
||||
List<AppIpCfg> list = new ArrayList();
|
||||
list.add(entity);
|
||||
Map<String,List> map = cfgConvert(strRegionList,list,2,entity,groupRelationList);
|
||||
Map<String,List> map = cfgConvert(ipRegionList,list,1,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
ipRegionList=map.get("dstList");
|
||||
}
|
||||
//保存区域IP信息
|
||||
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||
@@ -373,9 +388,13 @@ public class AppCfgService extends BaseService {
|
||||
String userRegion = "";
|
||||
if(!StringUtil.isEmpty(entity.getAppCode())){
|
||||
userRegion = userRegion+entity.getAppCode()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
if(entity.getRatelimit()!=null){
|
||||
userRegion = userRegion+entity.getRatelimit()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
@@ -419,9 +438,9 @@ public class AppCfgService extends BaseService {
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
entity = this.getAppHttpCfg(entity.getCfgId());
|
||||
entity.setTableName(AppPolicyCfg.getTablename());
|
||||
entity.setTableName(AppHttpCfg.getTablename());
|
||||
appCfgDao.auditCfg(entity);
|
||||
|
||||
if(isAudit==1){
|
||||
List<AppHttpCfg> list = new ArrayList();
|
||||
list.add(entity);
|
||||
@@ -460,9 +479,13 @@ public class AppCfgService extends BaseService {
|
||||
String userRegion = "";
|
||||
if(!StringUtil.isEmpty(entity.getAppCode())){
|
||||
userRegion = userRegion+entity.getAppCode()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
if(entity.getRatelimit()!=null){
|
||||
userRegion = userRegion+entity.getRatelimit()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
@@ -506,10 +529,10 @@ public class AppCfgService extends BaseService {
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
entity = this.getAppDomainCfg(entity.getCfgId());
|
||||
entity.setTableName(AppPolicyCfg.getTablename());
|
||||
entity.setTableName(AppDomainCfg.getTablename());
|
||||
appCfgDao.auditCfg(entity);
|
||||
if(isAudit==1){
|
||||
entity.setCfgKeywords(entity.getDomain());
|
||||
List<AppDomainCfg> list = new ArrayList();
|
||||
list.add(entity);
|
||||
Map<String,List> map = cfgConvert(strRegionList,list,2,entity,groupRelationList);
|
||||
@@ -547,9 +570,13 @@ public class AppCfgService extends BaseService {
|
||||
String userRegion = "";
|
||||
if(!StringUtil.isEmpty(entity.getAppCode())){
|
||||
userRegion = userRegion+entity.getAppCode()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
if(entity.getRatelimit()!=null){
|
||||
userRegion = userRegion+entity.getRatelimit()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
@@ -593,10 +620,11 @@ public class AppCfgService extends BaseService {
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
entity = this.getAppByteCfg(entity.getCfgId());
|
||||
entity.setTableName(AppPolicyCfg.getTablename());
|
||||
entity.setTableName(AppByteCfg.getTablename());
|
||||
appCfgDao.auditCfg(entity);
|
||||
|
||||
if(isAudit==1){
|
||||
entity.setCfgKeywords(entity.getBytes());
|
||||
List<AppByteCfg> list = new ArrayList();
|
||||
list.add(entity);
|
||||
Map<String,List> map = cfgConvert(strRegionList,list,2,entity,groupRelationList);
|
||||
@@ -634,9 +662,13 @@ public class AppCfgService extends BaseService {
|
||||
String userRegion = "";
|
||||
if(!StringUtil.isEmpty(entity.getAppCode())){
|
||||
userRegion = userRegion+entity.getAppCode()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
if(entity.getRatelimit()!=null){
|
||||
userRegion = userRegion+entity.getRatelimit()+Constants.USER_REGION_SPLIT;
|
||||
}else{
|
||||
userRegion = userRegion+Constants.USER_REGION_SPLIT;
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
configCompileList.add(maatCfg);
|
||||
|
||||
Reference in New Issue
Block a user