2019-06-10 18:31:52 +08:00
|
|
|
|
package com.nis.web.service.basics;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.Date;
|
2019-06-25 17:47:47 +08:00
|
|
|
|
import java.util.HashMap;
|
2019-06-10 18:31:52 +08:00
|
|
|
|
import java.util.List;
|
2019-06-24 17:10:35 +08:00
|
|
|
|
import java.util.Map;
|
2019-06-19 16:15:21 +08:00
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
2019-06-10 18:31:52 +08:00
|
|
|
|
|
|
|
|
|
|
import org.apache.ibatis.session.ExecutorType;
|
|
|
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
import com.nis.domain.FunctionRegionDict;
|
|
|
|
|
|
import com.nis.domain.FunctionServiceDict;
|
|
|
|
|
|
import com.nis.domain.Page;
|
2019-06-20 18:06:38 +08:00
|
|
|
|
import com.nis.domain.basics.CommonGroupInfo;
|
2019-06-10 18:31:52 +08:00
|
|
|
|
import com.nis.domain.basics.PolicyGroupInfo;
|
|
|
|
|
|
import com.nis.domain.basics.ScriberIdCommCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.BaseStringCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.CfgIndexInfo;
|
|
|
|
|
|
import com.nis.exceptions.MaatConvertException;
|
|
|
|
|
|
import com.nis.util.ConfigServiceUtil;
|
|
|
|
|
|
import com.nis.util.Constants;
|
2019-06-19 16:15:21 +08:00
|
|
|
|
import com.nis.util.StringUtils;
|
|
|
|
|
|
import com.nis.web.controller.configuration.ObjectGroupController;
|
2019-06-10 18:31:52 +08:00
|
|
|
|
import com.nis.web.dao.CrudDao;
|
2019-06-20 18:06:38 +08:00
|
|
|
|
import com.nis.web.dao.basics.CommonGroupManageDao;
|
2019-06-10 18:31:52 +08:00
|
|
|
|
import com.nis.web.dao.basics.PolicyGroupInfoDao;
|
|
|
|
|
|
import com.nis.web.dao.basics.ScriberIdCommGroupDao;
|
2019-06-19 16:15:21 +08:00
|
|
|
|
import com.nis.web.dao.configuration.CommonPolicyDao;
|
2019-06-24 17:10:35 +08:00
|
|
|
|
import com.nis.web.security.UserUtils;
|
2019-06-10 18:31:52 +08:00
|
|
|
|
import com.nis.web.service.CrudService;
|
|
|
|
|
|
import com.nis.web.service.SpringContextHolder;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class ScriberIdCommGroupService extends CrudService<CrudDao<ScriberIdCommCfg>, ScriberIdCommCfg>{
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private ScriberIdCommGroupDao scriberIdCommGroupDao;
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private PolicyGroupInfoDao policyGroupInfoDao;
|
2019-06-19 16:15:21 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private CommonPolicyDao commonPolicyDao;
|
2019-06-20 18:06:38 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private CommonGroupManageDao commonGroupManageDao;
|
2019-06-10 18:31:52 +08:00
|
|
|
|
|
|
|
|
|
|
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
|
|
|
|
|
|
|
|
|
|
|
|
public Page<ScriberIdCommCfg> findPage(Page<ScriberIdCommCfg> page, ScriberIdCommCfg entity) {
|
|
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
|
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<ScriberIdCommCfg> list=scriberIdCommGroupDao.findAllPageList(entity);
|
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
|
String key=list.get(i).getCfgKeywords().replace("***and***", " ");
|
|
|
|
|
|
list.get(i).setCfgKeywords(key);
|
|
|
|
|
|
}
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<ScriberIdCommCfg> findByPage(String ids) {
|
|
|
|
|
|
List<ScriberIdCommCfg> list=scriberIdCommGroupDao.findByPage(ids);
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ScriberIdCommCfg get(Long id ) {
|
|
|
|
|
|
return scriberIdCommGroupDao.get(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 新增
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void saveCommGroupCfg(CfgIndexInfo entity) {
|
|
|
|
|
|
Date createTime=new Date();
|
|
|
|
|
|
if(entity.getScriberIdCommGroupList()!=null) {
|
2019-06-14 17:12:41 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取分组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"});
|
|
|
|
|
|
|
2019-06-10 18:31:52 +08:00
|
|
|
|
Integer regionId = 0;
|
|
|
|
|
|
List<Integer> regionIds = ConfigServiceUtil.getId(3, 1);
|
|
|
|
|
|
if(regionIds!=null && regionIds.size()>0){
|
|
|
|
|
|
regionId = regionIds.get(0);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
throw new MaatConvertException("Get region id failed");
|
|
|
|
|
|
}
|
2019-06-14 17:12:41 +08:00
|
|
|
|
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);
|
2019-06-10 18:31:52 +08:00
|
|
|
|
}else{
|
2019-06-14 17:12:41 +08:00
|
|
|
|
cfg.setExprType(0);
|
2019-06-10 18:31:52 +08:00
|
|
|
|
}
|
2019-06-14 17:12:41 +08:00
|
|
|
|
cfg.setGroupId(serviceGroupId);
|
|
|
|
|
|
scriberIdCommGroupDao.insertCommGroupCfg(cfg);
|
2019-06-10 18:31:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 更新分组状态
|
2019-06-14 17:12:41 +08:00
|
|
|
|
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
2019-06-13 20:57:29 +08:00
|
|
|
|
transObjGroupToMaat(policyGroupInfos);
|
2019-06-10 18:31:52 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void update(ScriberIdCommCfg entity){
|
|
|
|
|
|
Date editTime=new Date();
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
entity.setEditorId(entity.getCurrentUser().getId());
|
|
|
|
|
|
if(entity.getCfgKeywords().contains("***and***")){
|
|
|
|
|
|
entity.setExprType(1);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
entity.setExprType(0);
|
|
|
|
|
|
}
|
2019-06-14 17:12:41 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取分组ID
|
|
|
|
|
|
Integer serviceGroupId = groupManageService.getServiceGroupId(entity.getGroupName(), Constants.SUBID_OBJ_GROUP_TYPE);
|
|
|
|
|
|
entity.setGroupId(serviceGroupId);
|
2019-06-10 18:31:52 +08:00
|
|
|
|
scriberIdCommGroupDao.update(entity);
|
|
|
|
|
|
|
|
|
|
|
|
// 更新分组状态
|
2019-06-13 20:57:29 +08:00
|
|
|
|
List<PolicyGroupInfo> policyGroupInfos = new ArrayList<PolicyGroupInfo>();
|
2019-06-14 17:12:41 +08:00
|
|
|
|
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getUserRegion1())); // old
|
|
|
|
|
|
if(!entity.getUserRegion1().equals(entity.getGroupId().toString())) { // 分组已修改
|
|
|
|
|
|
policyGroupInfos.addAll(policyGroupInfoDao.findPolicyByServiceGroupInfoList(entity.getGroupId().toString())); // new
|
2019-06-10 18:31:52 +08:00
|
|
|
|
}
|
2019-06-14 17:12:41 +08:00
|
|
|
|
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
|
|
|
|
|
|
2019-06-13 20:57:29 +08:00
|
|
|
|
transObjGroupToMaat(policyGroupInfos);
|
2019-06-10 18:31:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2019-06-19 16:15:21 +08:00
|
|
|
|
public void delete(String ids, String groupIds, ScriberIdCommCfg cfg, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
if(ids == null) {
|
|
|
|
|
|
groupIds = "";
|
|
|
|
|
|
String cfgIds = "";
|
|
|
|
|
|
String serviceGroupIds = "";
|
|
|
|
|
|
|
|
|
|
|
|
// 删除操作后获取 ①需配置更新的分组(存在域配置)②需配置取消的分组(无域配置) -> 配置分别操作更新或取消
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
// 配置未生效
|
2019-06-21 15:59:18 +08:00
|
|
|
|
/*String updateStatusGroupIds = "";
|
2019-06-19 16:15:21 +08:00
|
|
|
|
for (String groupId : serviceGroupIds.split(",")) {
|
|
|
|
|
|
List<CfgIndexInfo> list = commonPolicyDao.getObjGroupListByGroupIds(groupId, 888, Constants.VALID_NO);
|
|
|
|
|
|
if(list.size() > 0) {
|
|
|
|
|
|
updateStatusGroupIds += ","+groupId;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
2019-06-21 15:59:18 +08:00
|
|
|
|
}*/
|
2019-06-19 16:15:21 +08:00
|
|
|
|
|
2019-06-21 15:59:18 +08:00
|
|
|
|
// 配置已生效×
|
|
|
|
|
|
// 组下无域配置common_group_ids -> "",ud_flag -> 0
|
2019-06-19 16:15:21 +08:00
|
|
|
|
CfgIndexInfo entity = new CfgIndexInfo();
|
|
|
|
|
|
entity.setUserRegion5(serviceGroupIds);
|
|
|
|
|
|
entity.setFunctionId(888);
|
2019-06-21 15:59:18 +08:00
|
|
|
|
entity.setCommonGroupIds("");
|
|
|
|
|
|
commonPolicyDao.updateCfgIndexCommonGroupIdsBatch(entity);
|
|
|
|
|
|
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
|
|
|
|
|
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
|
|
|
|
|
|
|
|
|
|
|
entity.setServiceId(0);
|
2019-06-19 16:15:21 +08:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
List<PolicyGroupInfo> policyGroupInfos=policyGroupInfoDao.findPolicyByServiceGroupInfoList(groupIds);
|
|
|
|
|
|
scriberIdCommGroupDao.delete(ids);
|
|
|
|
|
|
// 更新分组状态
|
|
|
|
|
|
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
|
|
|
|
|
transObjGroupToMaat(policyGroupInfos);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-10 18:31:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<ScriberIdCommCfg> getByIds(String ids) {
|
|
|
|
|
|
if(ids==null) {
|
|
|
|
|
|
throw new RuntimeException("ids is null!");
|
|
|
|
|
|
}
|
|
|
|
|
|
return scriberIdCommGroupDao.getByIds(ids);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2019-06-24 17:10:35 +08:00
|
|
|
|
public void saveAndSend(FunctionRegionDict regionDict, FunctionServiceDict serviceDict, List<BaseStringCfg<?>> cfgs, Map<String, Integer> groupIdMap) {
|
2019-06-10 18:31:52 +08:00
|
|
|
|
logger.warn("Start to save ScriberId,size:"+cfgs.size());
|
|
|
|
|
|
long start=System.currentTimeMillis();
|
|
|
|
|
|
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
|
|
|
|
|
SqlSession batchSqlSession = null;
|
2019-06-19 16:15:21 +08:00
|
|
|
|
// 导入域配置 -> ①分组不存在,新增分组并返回groupId ②分组存在,获取groupId -> 数据 入库 -> 更新分组状态 -> 判断是否配置下发
|
2019-06-10 18:31:52 +08:00
|
|
|
|
try{
|
|
|
|
|
|
String ids = "";
|
|
|
|
|
|
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
|
|
|
|
|
for(BaseStringCfg<?> cfg:cfgs) {
|
|
|
|
|
|
ScriberIdCommCfg commCfg=new ScriberIdCommCfg();
|
2019-06-14 17:12:41 +08:00
|
|
|
|
BeanUtils.copyProperties(cfg, commCfg);
|
|
|
|
|
|
|
2019-06-20 18:06:38 +08:00
|
|
|
|
Integer groupId = commonGroupManageDao.getGroupIdByGroupName(commCfg.getGroupName(), Constants.SUBID_OBJ_GROUP_TYPE);
|
|
|
|
|
|
if(groupId == null) {
|
2019-06-24 17:10:35 +08:00
|
|
|
|
groupId = groupIdMap.get(commCfg.getGroupName());
|
2019-06-20 18:06:38 +08:00
|
|
|
|
}else {
|
|
|
|
|
|
if(!ids.contains(groupId+"")) {
|
|
|
|
|
|
ids += ","+groupId;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
commCfg.setGroupId(groupId);
|
2019-06-10 18:31:52 +08:00
|
|
|
|
((ScriberIdCommGroupDao) batchSqlSession.getMapper(ScriberIdCommGroupDao.class)).insertCommGroupCfg(commCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
batchSqlSession.commit();
|
2019-06-24 17:10:35 +08:00
|
|
|
|
|
|
|
|
|
|
if(groupIdMap.size() > 0) {
|
|
|
|
|
|
Long creatorId = UserUtils.getUser().getId();
|
|
|
|
|
|
Date createTime = new Date();
|
|
|
|
|
|
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
|
|
|
|
|
|
for (String groupName : groupIdMap.keySet()) {
|
|
|
|
|
|
CommonGroupInfo groupInfo = new CommonGroupInfo();
|
|
|
|
|
|
groupInfo.setCreatorId(creatorId);
|
|
|
|
|
|
groupInfo.setCreateTime(createTime);
|
|
|
|
|
|
groupInfo.setGroupName(groupName);
|
|
|
|
|
|
groupInfo.setGroupType(Constants.SUBID_OBJ_GROUP_TYPE);
|
|
|
|
|
|
groupInfo.setServiceGroupId(groupIdMap.get(groupName));
|
|
|
|
|
|
groupInfo.setUdFlag(1);
|
|
|
|
|
|
insertGroupList.add(groupInfo);
|
|
|
|
|
|
}
|
2019-06-20 18:06:38 +08:00
|
|
|
|
commonGroupManageDao.insertBatch(insertGroupList);
|
|
|
|
|
|
}
|
2019-06-10 18:31:52 +08:00
|
|
|
|
|
2019-06-20 18:06:38 +08:00
|
|
|
|
if(StringUtils.isNotBlank(ids)) {
|
|
|
|
|
|
// 更新分组状态
|
|
|
|
|
|
String serviceGroupIds = ids.substring(1);
|
|
|
|
|
|
List<PolicyGroupInfo> policyGroupInfos = policyGroupInfoDao.findPolicyByServiceGroupInfoList(serviceGroupIds);
|
|
|
|
|
|
groupManageService.updateGroupStatus(policyGroupInfos, Constants.SUBID_OBJ_GROUP_TYPE);
|
|
|
|
|
|
// 判断是否配置下发
|
|
|
|
|
|
transObjGroupToMaat(policyGroupInfos);
|
|
|
|
|
|
}
|
2019-06-10 18:31:52 +08:00
|
|
|
|
|
|
|
|
|
|
}finally {
|
|
|
|
|
|
if(batchSqlSession != null){
|
|
|
|
|
|
batchSqlSession.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
long end=System.currentTimeMillis();
|
|
|
|
|
|
logger.warn("Save ScriberId finish,cost:"+(end-start));
|
|
|
|
|
|
cfgs.clear();
|
|
|
|
|
|
cfgs=null;
|
|
|
|
|
|
}
|
2019-06-25 17:47:47 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取会配置取消的CompileId
|
|
|
|
|
|
* @param searchCfg 携带列表检索条件
|
|
|
|
|
|
* @return List<Integer> CompileId集合
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<Integer> ajaxCheckIsLastOneCfgBatch(ScriberIdCommCfg searchCfg) {
|
|
|
|
|
|
List<Integer> resultList = new ArrayList<Integer>();
|
|
|
|
|
|
|
|
|
|
|
|
// 获取所有准备删除的数据,并组织格式 {"groupId1":[cfgId1, cfgId2, ...], ...}
|
|
|
|
|
|
Map<Integer, String> map = new HashMap<Integer, String>();
|
|
|
|
|
|
List<ScriberIdCommCfg> cfgList = scriberIdCommGroupDao.findAllPageList(searchCfg);
|
|
|
|
|
|
for (ScriberIdCommCfg cfg : cfgList) {
|
|
|
|
|
|
Integer groupId = cfg.getGroupId();
|
|
|
|
|
|
String value = "";
|
|
|
|
|
|
if(map.containsKey(groupId)) {
|
|
|
|
|
|
value = map.get(groupId);
|
|
|
|
|
|
}
|
|
|
|
|
|
value += ","+cfg.getCfgId();
|
|
|
|
|
|
map.put(groupId, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 校验执行删除后分组下是否还有域配置,若没有则获取引用该分组的CompileId
|
|
|
|
|
|
for (Integer groupId : map.keySet()) {
|
|
|
|
|
|
String cfgIds = map.get(groupId).substring(1);
|
|
|
|
|
|
Integer size = commonGroupManageDao.ajaxCheckIsLastOneCfg(groupId, cfgIds, ScriberIdCommCfg.getTablename());
|
|
|
|
|
|
if(size == 0) { // 0为分组下的最后一条配置,获取配置ID提示
|
|
|
|
|
|
Map<String,String> searchMap = new HashMap<String,String>();
|
|
|
|
|
|
searchMap.put("subscribeIdGroup", ","+groupId+",");
|
|
|
|
|
|
Integer compileId = commonGroupManageDao.getCompileIdByGroupId(gsonToJson(searchMap));
|
|
|
|
|
|
if(compileId != null) {
|
|
|
|
|
|
resultList.add(compileId);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2019-06-10 18:31:52 +08:00
|
|
|
|
|
|
|
|
|
|
}
|