修正ObjectList管理域配置批量删除时 错误取消策略配置bug
This commit is contained in:
@@ -29,6 +29,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.configuration.ObjectGroupController;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
@@ -154,90 +155,95 @@ public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdComm
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids, String groupIds, ScriberIdCommCfg cfg, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
if(ids == null) {
|
||||
groupIds = "";
|
||||
String cfgIds = "";
|
||||
String serviceGroupIds = "";
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
// 删除操作后获取 ①需配置更新的分组(存在域配置)②需配置取消的分组(无域配置) -> 配置分别操作更新或取消
|
||||
List<ScriberIdCommCfg> set = scriberIdCommGroupDao.getGroupIds(cfg);
|
||||
if(set.size() == 0) { // 无可删除配置
|
||||
return;
|
||||
}else {
|
||||
for (ScriberIdCommCfg scriberIdCommCfg : set) {
|
||||
Integer groupId = scriberIdCommCfg.getGroupId();
|
||||
cfgIds += ","+scriberIdCommCfg.getCfgId();
|
||||
if(!serviceGroupIds.contains(groupId+"")) {
|
||||
serviceGroupIds += ","+groupId;
|
||||
}
|
||||
}
|
||||
cfgIds = cfgIds.substring(1);
|
||||
serviceGroupIds = serviceGroupIds.substring(1);
|
||||
}
|
||||
scriberIdCommGroupDao.delete(cfgIds);
|
||||
|
||||
String[] strings = serviceGroupIds.split(",");
|
||||
serviceGroupIds = "";
|
||||
for (String groupId : strings) {
|
||||
Integer size = scriberIdCommGroupDao.getCfgInfoByGroupIds(groupId);
|
||||
if(size == 0) { // 需配置取消
|
||||
serviceGroupIds += ","+groupId;
|
||||
}else { // 需配置更新
|
||||
groupIds += ","+groupId;
|
||||
}
|
||||
}
|
||||
|
||||
// 配置取消
|
||||
if(StringUtils.isNotBlank(serviceGroupIds)) {
|
||||
serviceGroupIds = serviceGroupIds.substring(1);
|
||||
ObjectGroupController groupController = SpringContextHolder.getBean(ObjectGroupController.class);
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request,response,"r");
|
||||
Properties props = groupController.getMsgProp();
|
||||
|
||||
// 配置未生效
|
||||
/*String updateStatusGroupIds = "";
|
||||
for (String groupId : serviceGroupIds.split(",")) {
|
||||
List<CfgIndexInfo> list = commonPolicyDao.getObjGroupListByGroupIds(groupId, 888, Constants.VALID_NO);
|
||||
if(list.size() > 0) {
|
||||
updateStatusGroupIds += ","+groupId;
|
||||
}
|
||||
Page<ScriberIdCommCfg> page = new Page<ScriberIdCommCfg>(request, response, "r");
|
||||
page.setOrderBy("");
|
||||
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
cfg.setIsValid(null);
|
||||
|
||||
List<ScriberIdCommCfg> list = this.findPage(page, cfg).getList();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
groupIds = "";
|
||||
String cfgIds = "";
|
||||
String serviceGroupIds = "";
|
||||
|
||||
for (ScriberIdCommCfg scriberIdCommCfg : list) {
|
||||
Integer groupId = scriberIdCommCfg.getGroupId();
|
||||
cfgIds += ","+scriberIdCommCfg.getCfgId();
|
||||
if(!serviceGroupIds.contains(groupId+"")) {
|
||||
serviceGroupIds += ","+groupId;
|
||||
}
|
||||
}
|
||||
cfgIds = cfgIds.substring(1);
|
||||
serviceGroupIds = serviceGroupIds.substring(1);
|
||||
scriberIdCommGroupDao.delete(cfgIds);
|
||||
|
||||
// 删除操作后获取 ①需配置更新的分组(存在域配置)②需配置取消的分组(无域配置) -> 配置分别操作更新或取消
|
||||
String[] strings = serviceGroupIds.split(",");
|
||||
serviceGroupIds = "";
|
||||
for (String groupId : strings) {
|
||||
Integer size = scriberIdCommGroupDao.getCfgInfoByGroupIds(groupId);
|
||||
if(size == 0) { // 需配置取消
|
||||
boolean flag = groupManageService.checkCancelCfg(groupId, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
if(flag) { // 需配置更新
|
||||
serviceGroupIds += ","+groupId;
|
||||
}else {
|
||||
groupIds += ","+groupId;
|
||||
}
|
||||
}else { // 需配置更新
|
||||
groupIds += ","+groupId;
|
||||
}
|
||||
}
|
||||
|
||||
// 配置取消
|
||||
if(StringUtils.isNotBlank(serviceGroupIds)) {
|
||||
serviceGroupIds = serviceGroupIds.substring(1);
|
||||
ObjectGroupController groupController = SpringContextHolder.getBean(ObjectGroupController.class);
|
||||
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request,response,"r");
|
||||
Properties props = groupController.getMsgProp();
|
||||
|
||||
// 组下无域配置common_group_ids -> "",ud_flag -> 0
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
entity.setUserRegion5(serviceGroupIds);
|
||||
entity.setFunctionId(888);
|
||||
entity.setCommonGroupIds("");
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
|
||||
entity.setServiceId(0);
|
||||
entity.setIsValid(Constants.VALID_NO);
|
||||
entity.setIsAudit(Constants.AUDIT_NOT_YES);
|
||||
entity.setBatchAuditValue("1");
|
||||
entity.setBatchValidValue("1,0");
|
||||
groupController.auditAll(auditPage, Constants.AUDIT_NOT_YES, entity, props);
|
||||
}
|
||||
// 配置更新
|
||||
if(StringUtils.isNotBlank(groupIds)) {
|
||||
groupIds = groupIds.substring(1);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
}else {
|
||||
hasData = false;
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(updateStatusGroupIds)) {
|
||||
updateStatusGroupIds = updateStatusGroupIds.substring(1);
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
entity.setUserRegion5(updateStatusGroupIds);
|
||||
entity.setFunctionId(888);
|
||||
entity.setCommonGroupIds("");
|
||||
entity.setIsValid(Constants.VALID_NO);
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
|
||||
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(updateStatusGroupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
}*/
|
||||
|
||||
// 配置已生效×
|
||||
// 组下无域配置common_group_ids -> "",ud_flag -> 0
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
entity.setUserRegion5(serviceGroupIds);
|
||||
entity.setFunctionId(888);
|
||||
entity.setCommonGroupIds("");
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
||||
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
||||
|
||||
entity.setServiceId(0);
|
||||
entity.setIsValid(Constants.VALID_NO);
|
||||
entity.setIsAudit(Constants.AUDIT_NOT_YES);
|
||||
entity.setBatchAuditValue("1");
|
||||
entity.setBatchValidValue("1,0");
|
||||
groupController.auditAll(auditPage, Constants.AUDIT_NOT_YES, entity, props);
|
||||
}
|
||||
// 配置更新
|
||||
if(StringUtils.isNotBlank(groupIds)) {
|
||||
groupIds = groupIds.substring(1);
|
||||
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
||||
transObjGroupToMaat(policyGroupInfos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
logger.warn("账号组域配置,批量删除耗时:"+(end-start));
|
||||
|
||||
}else {
|
||||
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
||||
scriberIdCommGroupDao.delete(ids);
|
||||
|
||||
Reference in New Issue
Block a user