分组配置管理GroupName改为可手动输入

This commit is contained in:
zhangwenqing
2019-06-14 17:12:41 +08:00
parent 3aebe7d905
commit d245ef7dc4
33 changed files with 2384 additions and 357 deletions

View File

@@ -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){