清空配置增加策略分组处理

This commit is contained in:
zhangwenqing
2019-06-27 16:27:56 +08:00
parent 06221477a5
commit 7080e65671
4 changed files with 42 additions and 2 deletions

View File

@@ -33,4 +33,8 @@ public interface CommonGroupManageDao extends CrudDao<CommonGroupInfo> {
Integer getGroupIdByGroupName(@Param("groupName")String groupName, @Param("groupType")Integer groupType);
int insertBatch(List<CommonGroupInfo> list);
void reLoadGroupInfo(@Param("groupType")String groupType);
void deleteGroupRegionInfo(@Param("tableName")String tableName);
}

View File

@@ -258,4 +258,17 @@
</trim>
</select>
<update id="reLoadGroupInfo" parameterType="java.lang.String">
UPDATE
policy_group_info
SET
ud_flag = 0
WHERE
is_valid != 0 AND group_type IN(${groupType})
</update>
<delete id="deleteGroupRegionInfo" parameterType="java.lang.String">
DELETE FROM ${tableName}
</delete>
</mapper>

View File

@@ -44,6 +44,7 @@ import com.nis.web.security.CacheSessionDAO;
import com.nis.web.security.Servlets;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.AsnGroupInfoService;
import com.nis.web.service.basics.CommonGroupManageService;
@Service
public class SystemService extends BaseService{
@@ -61,6 +62,9 @@ public class SystemService extends BaseService{
@Autowired
private AsnGroupInfoService asnGroupInfoService;
@Autowired
private CommonGroupManageService commonGroupManageService;
@Autowired
private CommonPolicyDao commonPolicyDao;
@@ -198,7 +202,9 @@ public class SystemService extends BaseService{
for (String tableName : tableNameSet) {
commonPolicyDao.clearPolicies(tableName);
}
// 初始化分组
// 初始化策略分组
commonGroupManageService.reLoadGroupInfo();
// 初始化ASN分组
asnGroupInfoService.reLoadGroupInfo();
// 失效定时任务
schedulerDao.inValidAllSchedule();

View File

@@ -347,6 +347,23 @@ public class CommonGroupManageService extends BaseService{
return flag;
}
public void reLoadGroupInfo() {
// 初始化策略分组信息
String groupType = Constants.IP_OBJ_GROUP_TYPE + "," + Constants.URL_OBJ_GROUP_TYPE + ","
+ Constants.DOMAIN_OBJ_GROUP_TYPE + "," + Constants.SUBID_OBJ_GROUP_TYPE;
commonGroupManageDao.reLoadGroupInfo(groupType);
// 清空分组域配置信息
List<String> tableList = new ArrayList<String>();
tableList.add(IpCommCfg.getIndexTable());
tableList.add(UrlCommCfg.getTablename());
tableList.add(DomainCommCfg.getTablename());
tableList.add(ScriberIdCommCfg.getTablename());
for (String tableName : tableList) {
commonGroupManageDao.deleteGroupRegionInfo(tableName);
}
}
}