分组配置管理GroupName改为可手动输入
This commit is contained in:
@@ -69,6 +69,7 @@ public class CommonGroupManageService extends BaseService{
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(CommonGroupInfo entity) throws MaatConvertException{
|
||||
entity.setIsValid(1);
|
||||
entity.setGroupName(entity.getGroupName().toUpperCase());
|
||||
if(entity.getGroupId()==null){ // 新增
|
||||
Date createTime=new Date();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
@@ -84,7 +85,7 @@ public class CommonGroupManageService extends BaseService{
|
||||
}
|
||||
entity.setServiceGroupId(serviceGroupId);
|
||||
commonGroupManageDao.insert(entity);
|
||||
this.updatePolicyGroupDict(entity.getGroupType()+"");
|
||||
//this.updatePolicyGroupDict(entity.getGroupType()+"");
|
||||
}else{ // 修改
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
@@ -139,21 +140,23 @@ public class CommonGroupManageService extends BaseService{
|
||||
boolean update=false;
|
||||
Integer udFlag = 0;
|
||||
Integer size = 0;
|
||||
if(groupType == 5) { // IP
|
||||
if(groupType == Constants.IP_OBJ_GROUP_TYPE) { // IP
|
||||
size = ipCommGroupCfgDao.getCfgInfoByGroupIds(info.getServiceGroupId().toString());
|
||||
}else if(groupType == 7) { // URL
|
||||
}else if(groupType == Constants.URL_OBJ_GROUP_TYPE) { // URL
|
||||
size = urlCommGroupDao.getCfgInfoByGroupIds(info.getServiceGroupId().toString());
|
||||
}else if(groupType == 8) { // Domain
|
||||
}else if(groupType == Constants.DOMAIN_OBJ_GROUP_TYPE) { // Domain
|
||||
size = domainCommGroupDao.getCfgInfoByGroupIds(info.getServiceGroupId().toString());
|
||||
}else if(groupType == 9) { // ScriberId
|
||||
}else if(groupType == Constants.SUBID_OBJ_GROUP_TYPE) { // ScriberId
|
||||
size = scriberIdCommGroupDao.getCfgInfoByGroupIds(info.getServiceGroupId().toString());
|
||||
}
|
||||
|
||||
if(size > 0 && info.getUdFlag().equals(0)) {
|
||||
update=true;
|
||||
udFlag = 1;
|
||||
info.setUdFlag(udFlag);
|
||||
}else if(size == 0 /*&& !info.getUdFlag().equals(2)*/){
|
||||
update=true;
|
||||
info.setUdFlag(udFlag);
|
||||
}
|
||||
if(update){
|
||||
commonGroupManageDao.updateGroupStatus(info.getServiceGroupId().toString(), udFlag, groupType);
|
||||
@@ -171,7 +174,7 @@ public class CommonGroupManageService extends BaseService{
|
||||
* 更新字典缓存
|
||||
* @return
|
||||
*/
|
||||
private void updatePolicyGroupDict(String groupTypes) {
|
||||
/*private void updatePolicyGroupDict(String groupTypes) {
|
||||
String dictKey = Constants.CACHE_IPGROUP_DICT;
|
||||
if(groupTypes.contains(",")) {
|
||||
String[] split = groupTypes.split(",");
|
||||
@@ -204,7 +207,7 @@ public class CommonGroupManageService extends BaseService{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 校验执行删除操作后分组下域配置是否为空
|
||||
@@ -237,13 +240,13 @@ public class CommonGroupManageService extends BaseService{
|
||||
cfgIds += "," + cfgId;
|
||||
}
|
||||
Integer size = 0;
|
||||
if(groupType == 5) { // IP
|
||||
if(groupType == Constants.IP_OBJ_GROUP_TYPE) { // IP
|
||||
size = commonGroupManageDao.ajaxCheckIsLastOneCfg(groupId, cfgIds.substring(1), IpCommCfg.getIndexTable());
|
||||
}else if(groupType == 7) { // URL
|
||||
}else if(groupType == Constants.URL_OBJ_GROUP_TYPE) { // URL
|
||||
size = commonGroupManageDao.ajaxCheckIsLastOneCfg(groupId, cfgIds.substring(1), UrlCommCfg.getTablename());
|
||||
}else if(groupType == 8) { // Domain
|
||||
}else if(groupType == Constants.DOMAIN_OBJ_GROUP_TYPE) { // Domain
|
||||
size = commonGroupManageDao.ajaxCheckIsLastOneCfg(groupId, cfgIds.substring(1), DomainCommCfg.getTablename());
|
||||
}else if(groupType == 9) { // ScriberId
|
||||
}else if(groupType == Constants.SUBID_OBJ_GROUP_TYPE) { // ScriberId
|
||||
size = commonGroupManageDao.ajaxCheckIsLastOneCfg(groupId, cfgIds.substring(1), ScriberIdCommCfg.getTablename());
|
||||
}
|
||||
|
||||
@@ -256,5 +259,38 @@ public class CommonGroupManageService extends BaseService{
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分组域配置新增或修改时调用:获取service group id
|
||||
* @param cfg
|
||||
* @return
|
||||
*/
|
||||
public Integer getServiceGroupId(String groupName, Integer groupType) {
|
||||
CommonGroupInfo entity = new CommonGroupInfo();
|
||||
int serviceGroupId = 0;
|
||||
entity.setGroupType(groupType);
|
||||
entity.setGroupName(groupName);
|
||||
|
||||
CommonGroupInfo groupInfo = commonGroupManageDao.getGroupInfo(entity);
|
||||
if(groupInfo == null) {
|
||||
// 获取GroupId
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
serviceGroupId =groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get group id failed");
|
||||
}
|
||||
entity.setServiceGroupId(serviceGroupId);
|
||||
|
||||
Date createTime=new Date();
|
||||
entity.setIsValid(1);
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
commonGroupManageDao.insert(entity);
|
||||
}else {
|
||||
serviceGroupId = groupInfo.getServiceGroupId();
|
||||
}
|
||||
return serviceGroupId;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,14 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
public void saveCommGroupCfg(CfgIndexInfo entity) {
|
||||
Date createTime=new Date();
|
||||
if(entity.getDomainCommGroupList()!=null) {
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString());
|
||||
for (int i = 0; i < entity.getDomainCommGroupList().size(); i++) {
|
||||
BeanUtils.copyProperties(entity, entity.getDomainCommGroupList().get(i), new String[]{"cfgId"});
|
||||
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.DOMAIN_OBJ_GROUP_TYPE);
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupId+"");
|
||||
|
||||
for (DomainCommCfg cfg : entity.getDomainCommGroupList()) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
|
||||
Integer regionId = 0;
|
||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, 1);
|
||||
if(regionIds!=null && regionIds.size()>0){
|
||||
@@ -75,28 +80,28 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
}else {
|
||||
throw new MaatConvertException("Get region id failed");
|
||||
}
|
||||
entity.getDomainCommGroupList().get(i).setRegionId(regionId);
|
||||
entity.getDomainCommGroupList().get(i).setRequestId(0);
|
||||
entity.getDomainCommGroupList().get(i).setClassify("0");
|
||||
entity.getDomainCommGroupList().get(i).setAttribute("0");
|
||||
entity.getDomainCommGroupList().get(i).setLable("0");
|
||||
entity.getDomainCommGroupList().get(i).setIsHexbin(2);
|
||||
entity.getDomainCommGroupList().get(i).setCreateTime(createTime);
|
||||
entity.getDomainCommGroupList().get(i).setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.getDomainCommGroupList().get(i).setIsValid(Constants.VALID_NO);
|
||||
entity.getDomainCommGroupList().get(i).setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(entity.getDomainCommGroupList().get(i).getCfgKeywords().contains("***and***")){
|
||||
entity.getDomainCommGroupList().get(i).setExprType(1);
|
||||
}else{
|
||||
entity.getDomainCommGroupList().get(i).setExprType(0);
|
||||
}
|
||||
entity.getDomainCommGroupList().get(i).setGroupId(entity.getGroupId());
|
||||
cfg.setRegionId(regionId);
|
||||
|
||||
cfg.setRequestId(0);
|
||||
cfg.setClassify("0");
|
||||
cfg.setAttribute("0");
|
||||
cfg.setLable("0");
|
||||
cfg.setIsHexbin(2);
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgKeywords().contains("***and***")){
|
||||
cfg.setExprType(1);
|
||||
}else{
|
||||
cfg.setExprType(0);
|
||||
}
|
||||
cfg.setGroupId(serviceGroupId);
|
||||
domainCommGroupDao.insertCommGroupCfg(cfg);
|
||||
|
||||
domainCommGroupDao.insertCommGroupCfg(entity.getDomainCommGroupList().get(i));
|
||||
}
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 8);
|
||||
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
}
|
||||
@@ -113,15 +118,20 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
}else{
|
||||
entity.setExprType(0);
|
||||
}
|
||||
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.DOMAIN_OBJ_GROUP_TYPE);
|
||||
entity.setGroupId(serviceGroupId);
|
||||
domainCommGroupDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 8);
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1())); // old
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) { // 分组已修改
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString())); // new
|
||||
}
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
|
||||
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -131,7 +141,7 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
||||
domainCommGroupDao.delete(ids);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 8);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -153,19 +163,23 @@ public class DomainCommGroupService extends CrudService<CrudDao<DomainCommCfg>,
|
||||
String ids = "";
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(BaseStringCfg<?> cfg:cfgs) {
|
||||
if(!ids.contains(cfg.getGroupId()+"")) {
|
||||
ids += ","+cfg.getGroupId();
|
||||
DomainCommCfg domainCommCfg=new DomainCommCfg();
|
||||
BeanUtils.copyProperties(cfg, domainCommCfg);
|
||||
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(domainCommCfg.getGroupName(), Constants.DOMAIN_OBJ_GROUP_TYPE);
|
||||
if(!ids.contains(serviceGroupId+"")) {
|
||||
ids += ","+serviceGroupId;
|
||||
}
|
||||
DomainCommCfg DomainCommCfg=new DomainCommCfg();
|
||||
BeanUtils.copyProperties(cfg, DomainCommCfg);
|
||||
((DomainCommGroupDao) batchSqlSession.getMapper(DomainCommGroupDao.class)).insertCommGroupCfg(DomainCommCfg);
|
||||
domainCommCfg.setGroupId(serviceGroupId);
|
||||
|
||||
((DomainCommGroupDao) batchSqlSession.getMapper(DomainCommGroupDao.class)).insertCommGroupCfg(domainCommCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
|
||||
// 更新分组状态
|
||||
String serviceGroupIds = ids.substring(1);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 8);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.DOMAIN_OBJ_GROUP_TYPE);
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
|
||||
@@ -73,14 +73,19 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void update(IpCommCfg entity){
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.IP_OBJ_GROUP_TYPE);
|
||||
entity.setGroupId(serviceGroupId);
|
||||
ipCommGroupCfgDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 5);
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1())); // old
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId()+"")) { // 分组已修改
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId()+"")); // new
|
||||
}
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.IP_OBJ_GROUP_TYPE);
|
||||
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -95,12 +100,16 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
//新增
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveIpCommGroupCfg(CfgIndexInfo entity) {
|
||||
|
||||
Date createTime=new Date();
|
||||
if(CollectionUtils.isNotEmpty(entity.getIpCommGroupCfgList())) {
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString());
|
||||
for (int i = 0; i < entity.getIpCommGroupCfgList().size(); i++) {
|
||||
BeanUtils.copyProperties(entity, entity.getIpCommGroupCfgList().get(i), new String[]{"cfgId","userregion3"});
|
||||
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.IP_OBJ_GROUP_TYPE);
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupId+"");
|
||||
|
||||
for (IpCommCfg cfg : entity.getIpCommGroupCfgList()) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId","userregion3"});
|
||||
|
||||
Integer regionId = 0;
|
||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, 1);
|
||||
if(regionIds!=null && regionIds.size()>0){
|
||||
@@ -108,21 +117,22 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
}else {
|
||||
throw new MaatConvertException("Get region id failed");
|
||||
}
|
||||
entity.getIpCommGroupCfgList().get(i).setRegionId(regionId);
|
||||
entity.getIpCommGroupCfgList().get(i).setRequestId(0);
|
||||
entity.getIpCommGroupCfgList().get(i).setClassify("0");
|
||||
entity.getIpCommGroupCfgList().get(i).setAttribute("0");
|
||||
entity.getIpCommGroupCfgList().get(i).setLable("0");
|
||||
entity.getIpCommGroupCfgList().get(i).setCreateTime(createTime);
|
||||
entity.getIpCommGroupCfgList().get(i).setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.getIpCommGroupCfgList().get(i).setIsValid(Constants.VALID_NO);
|
||||
entity.getIpCommGroupCfgList().get(i).setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
entity.getIpCommGroupCfgList().get(i).setGroupId(entity.getGroupId());
|
||||
ipCommGroupCfgDao.insertForBatch(entity.getIpCommGroupCfgList().get(i));
|
||||
cfg.setRegionId(regionId);
|
||||
|
||||
cfg.setRequestId(0);
|
||||
cfg.setClassify("0");
|
||||
cfg.setAttribute("0");
|
||||
cfg.setLable("0");
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setGroupId(serviceGroupId);
|
||||
ipCommGroupCfgDao.insertForBatch(cfg);
|
||||
|
||||
}
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 5);
|
||||
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -150,11 +160,15 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
String ids = "";
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(BaseIpCfg cfg:cfgs) {
|
||||
if(!ids.contains(cfg.getGroupId()+"")) {
|
||||
ids += ","+cfg.getGroupId();
|
||||
}
|
||||
IpCommCfg ipCommCfg=new IpCommCfg();
|
||||
BeanUtils.copyProperties(cfg, ipCommCfg);
|
||||
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(ipCommCfg.getGroupName(), Constants.IP_OBJ_GROUP_TYPE);
|
||||
if(!ids.contains(serviceGroupId+"")) {
|
||||
ids += ","+serviceGroupId;
|
||||
}
|
||||
ipCommCfg.setGroupId(serviceGroupId);
|
||||
|
||||
((IpCommGroupCfgDao) batchSqlSession.getMapper(IpCommGroupCfgDao.class)).insertForBatch(ipCommCfg);
|
||||
|
||||
}
|
||||
@@ -163,7 +177,7 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
// 更新分组状态
|
||||
String serviceGroupIds = ids.substring(1);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 5);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.IP_OBJ_GROUP_TYPE);
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
|
||||
@@ -65,9 +65,14 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
public void saveCommGroupCfg(CfgIndexInfo entity) {
|
||||
Date createTime=new Date();
|
||||
if(entity.getScriberIdCommGroupList()!=null) {
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString());
|
||||
for (int i = 0; i < entity.getScriberIdCommGroupList().size(); i++) {
|
||||
BeanUtils.copyProperties(entity, entity.getScriberIdCommGroupList().get(i), new String[]{"cfgId"});
|
||||
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupId+"");
|
||||
|
||||
for (ScriberIdCommCfg cfg : entity.getScriberIdCommGroupList()) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
|
||||
Integer regionId = 0;
|
||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, 1);
|
||||
if(regionIds!=null && regionIds.size()>0){
|
||||
@@ -75,28 +80,27 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
}else {
|
||||
throw new MaatConvertException("Get region id failed");
|
||||
}
|
||||
entity.getScriberIdCommGroupList().get(i).setRegionId(regionId);
|
||||
entity.getScriberIdCommGroupList().get(i).setRequestId(0);
|
||||
entity.getScriberIdCommGroupList().get(i).setClassify("0");
|
||||
entity.getScriberIdCommGroupList().get(i).setAttribute("0");
|
||||
entity.getScriberIdCommGroupList().get(i).setLable("0");
|
||||
entity.getScriberIdCommGroupList().get(i).setIsHexbin(2);
|
||||
entity.getScriberIdCommGroupList().get(i).setCreateTime(createTime);
|
||||
entity.getScriberIdCommGroupList().get(i).setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.getScriberIdCommGroupList().get(i).setIsValid(Constants.VALID_NO);
|
||||
entity.getScriberIdCommGroupList().get(i).setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(entity.getScriberIdCommGroupList().get(i).getCfgKeywords().contains("***and***")){
|
||||
entity.getScriberIdCommGroupList().get(i).setExprType(1);
|
||||
}else{
|
||||
entity.getScriberIdCommGroupList().get(i).setExprType(0);
|
||||
}
|
||||
entity.getScriberIdCommGroupList().get(i).setGroupId(entity.getGroupId());
|
||||
cfg.setRegionId(regionId);
|
||||
|
||||
scriberIdCommGroupDao.insertCommGroupCfg(entity.getScriberIdCommGroupList().get(i));
|
||||
cfg.setRequestId(0);
|
||||
cfg.setClassify("0");
|
||||
cfg.setAttribute("0");
|
||||
cfg.setLable("0");
|
||||
cfg.setIsHexbin(2);
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgKeywords().contains("***and***")){
|
||||
cfg.setExprType(1);
|
||||
}else{
|
||||
cfg.setExprType(0);
|
||||
}
|
||||
cfg.setGroupId(serviceGroupId);
|
||||
scriberIdCommGroupDao.insertCommGroupCfg(cfg);
|
||||
}
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 9);
|
||||
//TODO 组配置更新时 需检索是否被其它配置引用,若被引用需调用相应服务接口更新配置
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
|
||||
}
|
||||
@@ -114,15 +118,20 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
}else{
|
||||
entity.setExprType(0);
|
||||
}
|
||||
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
entity.setGroupId(serviceGroupId);
|
||||
scriberIdCommGroupDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 9);
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1())); // old
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) { // 分组已修改
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString())); // new
|
||||
}
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -132,7 +141,7 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
||||
scriberIdCommGroupDao.delete(ids);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 9);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -154,11 +163,15 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
String ids = "";
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(BaseStringCfg<?> cfg:cfgs) {
|
||||
if(!ids.contains(cfg.getGroupId()+"")) {
|
||||
ids += ","+cfg.getGroupId();
|
||||
}
|
||||
ScriberIdCommCfg commCfg=new ScriberIdCommCfg();
|
||||
BeanUtils.copyProperties(cfg, commCfg);
|
||||
BeanUtils.copyProperties(cfg, commCfg);
|
||||
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(commCfg.getGroupName(), Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
if(!ids.contains(serviceGroupId+"")) {
|
||||
ids += ","+serviceGroupId;
|
||||
}
|
||||
commCfg.setGroupId(serviceGroupId);
|
||||
|
||||
((ScriberIdCommGroupDao) batchSqlSession.getMapper(ScriberIdCommGroupDao.class)).insertCommGroupCfg(commCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
@@ -166,7 +179,7 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
// 更新分组状态
|
||||
String serviceGroupIds = ids.substring(1);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 9);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
|
||||
@@ -64,9 +64,14 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
public void saveUrlCommGroupCfg(CfgIndexInfo entity) {
|
||||
Date createTime=new Date();
|
||||
if(entity.getUrlCommGroupList()!=null) {
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString());
|
||||
for (int i = 0; i < entity.getUrlCommGroupList().size(); i++) {
|
||||
BeanUtils.copyProperties(entity, entity.getUrlCommGroupList().get(i), new String[]{"cfgId"});
|
||||
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.URL_OBJ_GROUP_TYPE);
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupId+"");
|
||||
|
||||
for (UrlCommCfg cfg : entity.getUrlCommGroupList()) {
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
|
||||
Integer regionId = 0;
|
||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, 1);
|
||||
if(regionIds!=null && regionIds.size()>0){
|
||||
@@ -74,27 +79,28 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
}else {
|
||||
throw new MaatConvertException("Get region id failed");
|
||||
}
|
||||
entity.getUrlCommGroupList().get(i).setRegionId(regionId);
|
||||
entity.getUrlCommGroupList().get(i).setRequestId(0);
|
||||
entity.getUrlCommGroupList().get(i).setClassify("0");
|
||||
entity.getUrlCommGroupList().get(i).setAttribute("0");
|
||||
entity.getUrlCommGroupList().get(i).setLable("0");
|
||||
entity.getUrlCommGroupList().get(i).setIsHexbin(0);
|
||||
entity.getUrlCommGroupList().get(i).setCreateTime(createTime);
|
||||
entity.getUrlCommGroupList().get(i).setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.getUrlCommGroupList().get(i).setIsValid(Constants.VALID_NO);
|
||||
entity.getUrlCommGroupList().get(i).setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(entity.getUrlCommGroupList().get(i).getCfgKeywords().contains("***and***")){
|
||||
entity.getUrlCommGroupList().get(i).setExprType(1);
|
||||
}else{
|
||||
entity.getUrlCommGroupList().get(i).setExprType(0);
|
||||
}
|
||||
entity.getUrlCommGroupList().get(i).setGroupId(entity.getGroupId());
|
||||
cfg.setRegionId(regionId);
|
||||
|
||||
cfg.setRequestId(0);
|
||||
cfg.setClassify("0");
|
||||
cfg.setAttribute("0");
|
||||
cfg.setLable("0");
|
||||
cfg.setIsHexbin(0);
|
||||
cfg.setCreateTime(createTime);
|
||||
cfg.setCreatorId(entity.getCurrentUser().getId());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgKeywords().contains("***and***")){
|
||||
cfg.setExprType(1);
|
||||
}else{
|
||||
cfg.setExprType(0);
|
||||
}
|
||||
cfg.setGroupId(serviceGroupId);
|
||||
urlCommGroupDao.insertUrlCommGroupCfg(cfg);
|
||||
|
||||
urlCommGroupDao.insertUrlCommGroupCfg(entity.getUrlCommGroupList().get(i));
|
||||
}
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 7);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
}
|
||||
@@ -111,15 +117,20 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
}else{
|
||||
entity.setExprType(0);
|
||||
}
|
||||
|
||||
// 获取分组ID
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.URL_OBJ_GROUP_TYPE);
|
||||
entity.setGroupId(serviceGroupId);
|
||||
urlCommGroupDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) {
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 7);
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1()));
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1())); // old
|
||||
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) { // 分组已修改
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString())); // new
|
||||
}
|
||||
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString()));
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
|
||||
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -129,7 +140,7 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
urlCommGroupDao.delete(ids);
|
||||
// 更新分组状态
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 7);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
@@ -151,11 +162,15 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
String ids = "";
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(BaseStringCfg<?> cfg:cfgs) {
|
||||
if(!ids.contains(cfg.getGroupId()+"")) {
|
||||
ids += ","+cfg.getGroupId();
|
||||
}
|
||||
UrlCommCfg urlCommCfg=new UrlCommCfg();
|
||||
BeanUtils.copyProperties(cfg, urlCommCfg);
|
||||
BeanUtils.copyProperties(cfg, urlCommCfg);
|
||||
|
||||
Integer serviceGroupId = groupManageService.getServiceGroupId(urlCommCfg.getGroupName(), Constants.URL_OBJ_GROUP_TYPE);
|
||||
if(!ids.contains(serviceGroupId+"")) {
|
||||
ids += ","+serviceGroupId;
|
||||
}
|
||||
urlCommCfg.setGroupId(serviceGroupId);
|
||||
|
||||
((UrlCommGroupDao) batchSqlSession.getMapper(UrlCommGroupDao.class)).insertUrlCommGroupCfg(urlCommCfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
@@ -163,7 +178,7 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
// 更新分组状态
|
||||
String serviceGroupIds = ids.substring(1);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, 7);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.URL_OBJ_GROUP_TYPE);
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
|
||||
Reference in New Issue
Block a user