分组配置增加以ud_flag字段标识状态

This commit is contained in:
zhangwenqing
2019-06-05 17:49:39 +08:00
parent ad04b41d7a
commit f9768ab910
16 changed files with 86 additions and 37 deletions

View File

@@ -151,4 +151,30 @@ public class CommonGroupManageService extends BaseService{
return false;
}
/**
* 更新分组状态 policy_group_info ud_flag0无有效的域配置 1存在有效的域配置
* @param serviceGroupId
* @param groupType
*/
public void updateGroupStatus(String serviceGroupId, Integer groupType) {
/**
* void updateUdFlag(String groupIds, Integer udFlag, Integer groupType);
*/
Integer udFlag = 0;
if(groupType == 5) { // IP
List<IpCommCfg> list = ipCommGroupCfgDao.getCfgInfoByGroupIds(serviceGroupId);
if(list.size() > 0) {
udFlag = 1; // 可用
}
}else if(groupType == 7) { // URL
List<UrlCommCfg> list = urlCommGroupDao.getCfgInfoByGroupIds(serviceGroupId);
if(list.size() > 0) {
udFlag = 1;
}
}
commonGroupManageDao.updateGroupStatus(serviceGroupId, udFlag, groupType);
}
}

View File

@@ -33,6 +33,8 @@ public class IpCommGroupCfgService extends BaseService {
@Autowired
private IpCommGroupCfgDao ipCommGroupCfgDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
/**
* @param page
* @param entity
@@ -68,6 +70,10 @@ public class IpCommGroupCfgService extends BaseService {
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void update(IpCommCfg entity){
ipCommGroupCfgDao.update(entity);
// 更新分组状态
groupManageService.updateGroupStatus(entity.getUserRegion1(), 5); // old
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5); // new
}
@@ -106,16 +112,20 @@ public class IpCommGroupCfgService extends BaseService {
entity.getIpCommGroupCfgList().get(i).setGroupId(entity.getGroupId());
ipCommGroupCfgDao.insertForBatch(entity.getIpCommGroupCfgList().get(i));
}
// 更新分组状态
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5);
}
}
public void delete(String ids) {
// TODO 公共组配置删除时 需检索是否被其它业务配置引用,没被引用可删除
public void delete(String ids, String compileIds) {
if(ids==null) {
throw new RuntimeException("ids is null!");
}
ipCommGroupCfgDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(compileIds, 5);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)

View File

@@ -17,13 +17,16 @@ import com.nis.util.Constants;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.basics.UrlCommGroupDao;
import com.nis.web.service.CrudService;
import com.nis.web.service.SpringContextHolder;
@Service
public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCommCfg>{
@Autowired
private UrlCommGroupDao urlCommGroupDao;
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
public Page<UrlCommCfg> findPage(Page<UrlCommCfg> page, UrlCommCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
@@ -78,11 +81,9 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
urlCommGroupDao.insertUrlCommGroupCfg(entity.getUrlCommGroupList().get(i));
}
// //修改公共组的标识
// Integer udFlag=urlCommGroupDao.findUrlUdFlag(Integer.parseInt(entity.getUserRegion3()));
// if(udFlag == 0){
// urlCommGroupDao.updateUrlUdFlag(Integer.parseInt(entity.getUserRegion3()), 1);
// }
// 更新分组状态
groupManageService.updateGroupStatus(entity.getGroupId()+"", 7);
}
}
@@ -99,12 +100,18 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
entity.setExprType(0);
}
urlCommGroupDao.update(entity);
// 更新分组状态
groupManageService.updateGroupStatus(entity.getUserRegion1(), 7); // old
groupManageService.updateGroupStatus(entity.getGroupId()+"", 7); // new
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(String ids) {
public void delete(String ids, String groupIds) {
urlCommGroupDao.delete(ids);
// 更新分组状态
groupManageService.updateGroupStatus(groupIds, 7);
}
public List<UrlCommCfg> getByIds(String ids) {