去掉分组管理无用代码
This commit is contained in:
@@ -34,7 +34,7 @@ public class CommonGroupManageController extends BaseController {
|
||||
@Autowired
|
||||
private CommonGroupManageService commonGroupManageService;
|
||||
|
||||
@RequestMapping(value = {"list", ""})
|
||||
@RequestMapping(value = {"list"})
|
||||
public String policyGroupList(CommonGroupInfo cfg, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
if(cfg == null)cfg=new CommonGroupInfo();
|
||||
Page<CommonGroupInfo> pageCondition = new Page<CommonGroupInfo>(request, response,"r");
|
||||
@@ -59,7 +59,6 @@ public class CommonGroupManageController extends BaseController {
|
||||
@RequestMapping(value = "saveOrUpdate")
|
||||
public String saveOrUpdate(CommonGroupInfo cfg, Model model, RedirectAttributes redirectAttributes,
|
||||
String itType,Integer groupType,HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
commonGroupManageService.saveOrUpdate(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
@@ -68,10 +67,7 @@ public class CommonGroupManageController extends BaseController {
|
||||
addMessage(redirectAttributes,"error","save_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/commonGroup/list";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value={"delete"})
|
||||
@@ -93,62 +89,63 @@ public class CommonGroupManageController extends BaseController {
|
||||
return commonGroupManageService.checkIsIssued(groupIds);
|
||||
}
|
||||
|
||||
//Group配置导出
|
||||
@RequestMapping(value = "exportGroup")
|
||||
public void exportGroup(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CommonGroupInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
entity.setMenuNameCode("common_group_manage");
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
List<CommonGroupInfo> list = new ArrayList<CommonGroupInfo>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = commonGroupManageService.findGroupInfoList(ids);
|
||||
} else {
|
||||
Page<CommonGroupInfo> pageInfo=new Page<CommonGroupInfo>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page page = commonGroupManageService.findCommonGroupInfoList(pageInfo,entity);
|
||||
list=page.getList();
|
||||
}
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), CommonGroupInfo.class);
|
||||
String cfgIndexInfoNoExport=",config_describe,cfg_id,block_type,do_log,action,valid_identifier,is_audit"
|
||||
+ ",auditor,audit_time,letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null ) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), list);
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Group export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
// 数据导出
|
||||
@RequestMapping(value = "exportGroup")
|
||||
public void exportGroup(Model model,@ModelAttribute("cfg")CommonGroupInfo entity,String ids,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request,HttpServletResponse response){
|
||||
try {
|
||||
entity.setMenuNameCode("common_group_manage");
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
List<CommonGroupInfo> list = new ArrayList<CommonGroupInfo>();
|
||||
if (!StringUtil.isEmpty(ids)) {
|
||||
list = commonGroupManageService.findGroupInfoList(ids);
|
||||
} else {
|
||||
Page<CommonGroupInfo> pageInfo=new Page<CommonGroupInfo>(request, response,"r");
|
||||
pageInfo.setPageNo(1);
|
||||
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
||||
Page page = commonGroupManageService.findCommonGroupInfoList(pageInfo,entity);
|
||||
list=page.getList();
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), CommonGroupInfo.class);
|
||||
String cfgIndexInfoNoExport=",config_describe,cfg_id,block_type,do_log,action,valid_identifier,is_audit"
|
||||
+ ",auditor,audit_time,letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,";
|
||||
// 时间过滤
|
||||
if (entity.getSearch_create_time_start() == null ) {
|
||||
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
if (entity.getSearch_edit_time_start() == null) {
|
||||
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(entity.gethColumns())) {
|
||||
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
|
||||
}
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
dataMap.put(entity.getMenuNameCode(), list);
|
||||
String timeRange = initTimeMap(entity);
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
|
||||
if ("csv".equals(entity.getExType())) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Group export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.concurrent.BlockingQueue;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -20,7 +19,6 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
@@ -30,12 +28,10 @@ import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.CommonGroupInfo;
|
||||
import com.nis.domain.basics.IpCommCfg;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.template.IpCommCfgTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -70,7 +66,6 @@ public class IpCommGroupController extends BaseController {
|
||||
@RequestMapping(value = { "/addForm" })
|
||||
public String addForm(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
// IP Group Tyep为5
|
||||
cfg.setGroupType(5);
|
||||
initFormCondition(model, cfg);
|
||||
|
||||
@@ -102,10 +97,10 @@ public class IpCommGroupController extends BaseController {
|
||||
public String updateForm(Model model, @ModelAttribute("cfg") IpCommCfg cfg, RedirectAttributes redirectAttributes, String ids,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
cfg = ipCommGroupCfgService.get(Long.parseLong(ids));
|
||||
// initUpdateFormCondition(model, cfg);
|
||||
cfg.setGroupType(5);
|
||||
|
||||
initUpdateFormCondition(model, cfg);
|
||||
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(5);
|
||||
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(5);
|
||||
model.addAttribute("policyGroupInfos", groupInfos);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/ipCommGroupFormUpdate";
|
||||
@@ -113,8 +108,8 @@ public class IpCommGroupController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/update" })
|
||||
@RequiresPermissions(value = { "ip:common:config" })
|
||||
public String update(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpCommCfg cfg, RedirectAttributes redirectAttributes) {
|
||||
public String update(Model model, @ModelAttribute("cfg") IpCommCfg cfg, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
ipCommGroupCfgService.update(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
@@ -126,47 +121,6 @@ public class IpCommGroupController extends BaseController {
|
||||
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId();
|
||||
}
|
||||
|
||||
// @RequestMapping(value = { "/audit" })
|
||||
// @RequiresPermissions(value = { "ip:common:config" })
|
||||
// public String audit(Model model, @ModelAttribute("cfg") IpCommCfg cfg, Integer isAudit, Integer isValid,
|
||||
// String ids, Integer functionId, HttpServletRequest request, HttpServletResponse response,
|
||||
// RedirectAttributes redirectAttributes) {
|
||||
// // 选中配置审核
|
||||
// if (!StringUtil.isEmpty(ids)) {
|
||||
// List<IpCommCfg> ipGroupCfgs = ipCommGroupCfgService.getByIds(ids);
|
||||
// List<IpCommCfg> temp = Lists.newArrayList();
|
||||
// try {
|
||||
// ipCommGroupCfgService.audit(ipGroupCfgs, isAudit, isValid);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("审核失败", e);
|
||||
// addMessage(redirectAttributes, "error", "audit_failed");
|
||||
// } finally {
|
||||
// temp.clear();
|
||||
// }
|
||||
// return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId();
|
||||
// } else {// 全部审核
|
||||
// // 条件下所有配置审核
|
||||
// Page<IpCommCfg> searchPage = new Page<IpCommCfg>(request, response, "a");
|
||||
// Page<IpCommCfg> auditPage = new Page<IpCommCfg>(request, response, "a");
|
||||
// BeanUtils.copyProperties(searchPage, auditPage);
|
||||
//
|
||||
// try {
|
||||
// auditAll(auditPage, isValid, cfg);
|
||||
// addMessage(redirectAttributes, "success", "audit_success");
|
||||
// } catch (Exception e) {
|
||||
// logger.error("配置下发失败:", e);
|
||||
// if (e instanceof MaatConvertException) {
|
||||
// addMessage(redirectAttributes, "error", "request_service_failed");
|
||||
// } else {
|
||||
// addMessage(redirectAttributes, "error", "audit_failed");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return list(model, request, response, cfg);
|
||||
// }
|
||||
// }
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ip:common:config" })
|
||||
public String delete(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
@@ -185,12 +139,11 @@ public class IpCommGroupController extends BaseController {
|
||||
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + functionId;
|
||||
}
|
||||
|
||||
// ipComm配置导出
|
||||
// 数据导出
|
||||
@RequestMapping(value = "/exportIpComm")
|
||||
public void exportIpCommonCfg(Model model, HttpServletRequest request, HttpServletResponse response,
|
||||
@ModelAttribute("cfg") IpCommCfg entity, String ids, RedirectAttributes redirectAttributes) {
|
||||
public void exportIpCommonCfg(Model model, @ModelAttribute("cfg") IpCommCfg entity, String ids, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
@@ -205,7 +158,6 @@ public class IpCommGroupController extends BaseController {
|
||||
Page<IpCommCfg> page = ipCommGroupCfgService.findPage(pageInfo, entity);
|
||||
list = page.getList();
|
||||
}
|
||||
//
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), IpPortCfg.class);
|
||||
String cfgIndexInfoNoExport = ",block_type,do_log,action"
|
||||
@@ -237,139 +189,15 @@ public class IpCommGroupController extends BaseController {
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("IpCommGroupCfg export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
|
||||
}
|
||||
// return "redirect:" + adminPath
|
||||
// +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量审核
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
// @Override
|
||||
// public void auditAll(Page page, Integer auditType, Object entity) throws Exception {
|
||||
// long start = System.currentTimeMillis();
|
||||
// page.setOrderBy("");
|
||||
// page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
// page.setPageNo(1);
|
||||
// page.setLastPage(false);
|
||||
// // 携带审核状态信息的BaseCfg
|
||||
// BaseCfg auditBatchCfg = new BaseCfg();
|
||||
// // 携带审核条件的BaseCfg
|
||||
// IpCommCfg searchIpCommGroupCfg = new IpCommCfg();
|
||||
// BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
// BeanUtils.copyProperties(entity, searchIpCommGroupCfg);
|
||||
//
|
||||
// auditType = (Integer) Reflections.invokeGetter(entity, "isAudit");
|
||||
//
|
||||
// // 全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过
|
||||
// if (auditType.equals(1) || auditType.equals(2)) {
|
||||
//
|
||||
// searchIpCommGroupCfg.setIsValid(0);
|
||||
// searchIpCommGroupCfg.setIsAudit(0);
|
||||
//
|
||||
// if (auditType.equals(1)) {
|
||||
// auditBatchCfg.setIsAudit(1);
|
||||
// auditBatchCfg.setIsValid(1);
|
||||
// } else {
|
||||
// auditBatchCfg.setIsAudit(2);
|
||||
// auditBatchCfg.setIsValid(0);
|
||||
// }
|
||||
// auditBatchCfg.setAuditTime(new Date());
|
||||
// auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
// } else {
|
||||
// // 全部取消通过,只查询当前条件下的所有审核通过的配置
|
||||
// searchIpCommGroupCfg.setIsValid(1);
|
||||
// searchIpCommGroupCfg.setIsAudit(1);
|
||||
//
|
||||
// auditBatchCfg.setIsAudit(3);
|
||||
// auditBatchCfg.setIsValid(0);
|
||||
// auditBatchCfg.setAuditTime(new Date());
|
||||
// auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
// }
|
||||
//
|
||||
// ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
// Integer functionId = 0;
|
||||
// if (auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) {
|
||||
// functionId = auditBatchCfg.getFunctionId();
|
||||
// }
|
||||
// List<Map<String, Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
|
||||
// for (Map<String, Object> service : serviceList) {
|
||||
// String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表
|
||||
// String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback
|
||||
// String classNameXml = service.get("className").toString(); // 主配置Java类
|
||||
// String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段
|
||||
// auditBatchCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
// auditBatchCfg.setTableName(tableNameXml);
|
||||
// searchIpCommGroupCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
// searchIpCommGroupCfg.setTableName(tableNameXml);
|
||||
//
|
||||
// if ("1".equals(serviceTypeXml)) {// maat类配置
|
||||
// // 存放域配置类型 及 对应表名
|
||||
// List<Map<String, Object>> cfgList = (List<Map<String, Object>>) service.get("cfgList");
|
||||
// List<Map<String, Object>> userRegionList = (List<Map<String, Object>>) service.get("userRegionList");
|
||||
// int cfgType = Integer.parseInt(service.get("cfgType").toString());
|
||||
// if (auditBatchCfg.getIsAudit() == 1) {
|
||||
// boolean hasData = true;
|
||||
//
|
||||
// while (hasData) {
|
||||
// page.setPageNo(1);
|
||||
// page.setLastPage(false);
|
||||
// List list = ipCommGroupCfgService.findPage(page, searchIpCommGroupCfg).getList();
|
||||
// if(CollectionUtils.isNotEmpty(list)){
|
||||
// Map<Integer,List> groupIdMap=new HashMap();
|
||||
// // 配置生效处理
|
||||
// if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
// hasData=commonPolicyService.auditReuseCommonConfigData(page, auditBatchCfg,groupIdMap,hasData);
|
||||
// Map<Integer,List> groupIpMap=new HashMap();
|
||||
// if(CollectionUtils.isNotEmpty(list)) {
|
||||
// for (IpCommCfg obj : (List<IpCommCfg>)list) {
|
||||
// BaseCfg baseCfg=(BaseCfg)obj;
|
||||
// if(!StringUtil.isEmpty(obj.getGroupId())) {
|
||||
// groupIdMap.get(obj.getGroupId()).add(baseCfg);
|
||||
// }else {
|
||||
// List newList=new ArrayList<>();
|
||||
// newList.add(baseCfg);
|
||||
// groupIdMap.put(obj.getGroupId(),newList);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// if(hasData) {
|
||||
// page.setPageNo(1);
|
||||
// page.setLastPage(false);
|
||||
// }
|
||||
// }else{
|
||||
// hasData = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// throw new RuntimeException("wrong service type " + serviceTypeXml);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 批量审核通过时,如果没有携带isValid检索条件,返回界面需要将isValid置为null
|
||||
// if (!StringUtil.isEmpty(entity)) {
|
||||
// BaseCfg base = (BaseCfg) entity;
|
||||
// if (!StringUtil.isEmpty(base.getSeltype()) && base.getSeltype().equals("isValid")) {
|
||||
// base.setIsValid(null);
|
||||
// BeanUtils.copyProperties(base, entity);
|
||||
// }
|
||||
// }
|
||||
// long end = System.currentTimeMillis();
|
||||
// logger.warn("配置批量生效/失效耗时:" + (end - start));
|
||||
// }
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
|
||||
@@ -464,8 +292,9 @@ public class IpCommGroupController extends BaseController {
|
||||
logger.warn("import finish,cost:"+(end-start));
|
||||
return "redirect:" + adminPath+ importPath;
|
||||
}
|
||||
|
||||
/*@ResponseBody
|
||||
@RequestMapping(value="ajaxGetGroups",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<Integer,String> ajaxGetGroups(Model model,@RequestParam(required=true,value="groupIds")String groupIds){
|
||||
Map<Integer,String> groupIdList=new HashMap<Integer,String>();
|
||||
if(StringUtils.isNotBlank(groupIds)) {
|
||||
@@ -475,5 +304,5 @@ public class IpCommGroupController extends BaseController {
|
||||
}
|
||||
}
|
||||
return groupIdList;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -41,7 +40,7 @@ public class UrlCommGroupController extends BaseController{
|
||||
Page<UrlCommCfg> page = urlCommGroupService.findPage(new Page<UrlCommCfg>(request, response,"r"), entity);
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(7);
|
||||
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(7);
|
||||
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("regionList", regionList);
|
||||
@@ -53,14 +52,6 @@ public class UrlCommGroupController extends BaseController{
|
||||
@RequestMapping(value = {"/addForm"})
|
||||
public String addForm(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request, HttpServletResponse response){
|
||||
|
||||
// UrlCommGroupCfg urlCfg = new UrlCommGroupCfg();
|
||||
// urlCfg.setCfgType("NTC_URL_REGION");
|
||||
// cfg.setUrlCommGroupCfg(urlCfg);
|
||||
// List<UrlCommGroupCfg> urlList = new ArrayList<UrlCommGroupCfg>();
|
||||
// urlList.add(urlCfg);
|
||||
// cfg.setUrlCommGroupList(urlList);
|
||||
// initFormCondition(model, entity);
|
||||
cfg.setGroupType(11);
|
||||
initFormCondition(model,cfg);
|
||||
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(7);
|
||||
@@ -73,7 +64,6 @@ public class UrlCommGroupController extends BaseController{
|
||||
@RequestMapping(value = {"/save"})
|
||||
public String save(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request,HttpServletResponse response){
|
||||
|
||||
try{
|
||||
urlCommGroupService.saveUrlCommGroupCfg(cfg);
|
||||
}catch(Exception e){
|
||||
@@ -93,7 +83,6 @@ public class UrlCommGroupController extends BaseController{
|
||||
,HttpServletResponse response,String ids,@ModelAttribute("cfg")UrlCommCfg cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
cfg = urlCommGroupService.get(Long.parseLong(ids));
|
||||
// initUpdateFormCondition(model, cfg);
|
||||
cfg.setGroupType(11);
|
||||
initUpdateFormCondition(model,cfg);
|
||||
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(7);
|
||||
@@ -101,6 +90,7 @@ public class UrlCommGroupController extends BaseController{
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/basics/urlCommGroupFormUpdate";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/update"})
|
||||
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")UrlCommCfg cfg,RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
@@ -114,59 +104,6 @@ public class UrlCommGroupController extends BaseController{
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
public String audit(Model model,@ModelAttribute("cfg")UrlCommCfg cfg
|
||||
,Integer isAudit
|
||||
,Integer isValid
|
||||
,String ids
|
||||
,Integer functionId
|
||||
, HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes) {
|
||||
//选中配置审核
|
||||
if(!StringUtil.isEmpty(ids)) {
|
||||
List<UrlCommCfg> urlGroupCfgs=urlCommGroupService.getByIds(ids);
|
||||
// Map<Long,List<UrlCommGroupCfg>> urlcfgMap=Maps.newHashMap();
|
||||
// for(UrlCommGroupCfg urlCommCfg:urlGroupCfgs) {
|
||||
// urlCommCfg.setIsAudit(isAudit);
|
||||
// urlCommCfg.setIsValid(isValid);
|
||||
// urlCommCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
// urlCommCfg.setAuditTime(new Date());
|
||||
// urlCommCfg.setFunctionId(functionId);
|
||||
// if(urlcfgMap.containsKey(Long.parseLong(urlCommCfg.getUserRegion3()))) {
|
||||
// urlcfgMap.get(Long.parseLong(urlCommCfg.getUserRegion3())).add(urlCommCfg);
|
||||
// }else {
|
||||
// List<UrlCommGroupCfg> _urlCfgs=Lists.newArrayList();
|
||||
// _urlCfgs.add(urlCommCfg);
|
||||
// urlcfgMap.put(Long.parseLong(urlCommCfg.getUserRegion3()), _urlCfgs);
|
||||
// }
|
||||
// }
|
||||
/********************每次下发一个组的region,保证事物********************/
|
||||
// for (Long groupId : urlcfgMap.keySet()) {
|
||||
// try {
|
||||
// urlCommGroupService.audit(urlcfgMap.get(groupId),groupId,isValid);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("配置下发失败:",e);
|
||||
// if(e instanceof MaatConvertException) {
|
||||
// addMessage(redirectAttributes,"error", "request_service_failed");
|
||||
// }else {
|
||||
// addMessage(redirectAttributes,"error", "audit_failed");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
for (UrlCommCfg urlCommGroup : urlGroupCfgs) {
|
||||
try {
|
||||
urlCommGroupService.audit(urlCommGroup,isAudit,isValid);
|
||||
} catch (Exception e) {
|
||||
logger.error("审核失败",e);
|
||||
addMessage(redirectAttributes,"error","audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
@@ -185,12 +122,12 @@ public class UrlCommGroupController extends BaseController{
|
||||
|
||||
return "redirect:" + adminPath +"/basics/url/list?functionId="+functionId;
|
||||
}
|
||||
//urlComm配置导出
|
||||
|
||||
// 数据导出
|
||||
@RequestMapping(value = "/exportUrlComm")
|
||||
public void exportAsnIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
public void exportUrlComm(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")UrlCommCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
@@ -205,7 +142,7 @@ public class UrlCommGroupController extends BaseController{
|
||||
Page<UrlCommCfg> page = urlCommGroupService.findPage(pageInfo, entity);
|
||||
list=page.getList();
|
||||
}
|
||||
//
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
classMap.put(entity.getMenuNameCode(), UrlCommCfg.class);
|
||||
String cfgIndexInfoNoExport=",block_type,do_log,action"
|
||||
@@ -237,10 +174,12 @@ public class UrlCommGroupController extends BaseController{
|
||||
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
|
||||
classMap, dataMap, noExportMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("urlGroupConfig export failed",e);
|
||||
addMessage(redirectAttributes,"error","export_failed");
|
||||
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.CommonGroupInfo;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@@ -19,17 +18,4 @@ public interface CommonGroupManageDao extends CrudDao<CommonGroupInfo> {
|
||||
|
||||
List<CommonGroupInfo> findGroupInfoList(@Param("ids")String ids);
|
||||
|
||||
/*List<PolicyGroupInfo> findPolicyGroupInfos();
|
||||
List<PolicyGroupInfo> findHasIPPolicyGroupInfosByType(int groupType);
|
||||
List<PolicyGroupInfo> findPolicyGroupInfosHasIpRegionByType(int groupType);
|
||||
List<PolicyGroupInfo> findNatPolicyGroups();
|
||||
|
||||
PolicyGroupInfo getInfoByAsnNo(PolicyGroupInfo policyGroupInfo);
|
||||
List<PolicyGroupInfo> getHasAreaPolicyGroups(int groupType);
|
||||
int insertBatch(List<PolicyGroupInfo> list);
|
||||
|
||||
Integer getGroupIdByGroupName(String groupName);
|
||||
PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo);
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -2,25 +2,25 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.basics.CommonGroupManageDao" >
|
||||
|
||||
<resultMap id="CommonGroupInfoMap" type="com.nis.domain.basics.CommonGroupInfo" >
|
||||
<id column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
|
||||
<result column="group_type" property="groupType" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="CommonGroupInfoMap" type="com.nis.domain.basics.CommonGroupInfo" >
|
||||
<id column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
|
||||
<result column="group_type" property="groupType" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="CommonGroupInfoColumns">
|
||||
r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time,
|
||||
r.creator_id,r.editor_id,r.service_group_id,r.description
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findCommonGroupInfoList" resultMap="CommonGroupInfoMap">
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findCommonGroupInfoList" resultMap="CommonGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="CommonGroupInfoColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
@@ -30,7 +30,6 @@
|
||||
FROM policy_group_info r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
@@ -42,7 +41,7 @@
|
||||
AND r.group_type =#{groupType }
|
||||
</if>
|
||||
<if test="groupType == null">
|
||||
AND r.group_type NOT IN(1,2,3,4)
|
||||
AND r.group_type IN(5,7,8,9)
|
||||
</if>
|
||||
AND r.IS_VALID =1
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
@@ -62,7 +61,6 @@
|
||||
ORDER BY r.group_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getById" resultType="com.nis.domain.basics.CommonGroupInfo">
|
||||
@@ -174,99 +172,4 @@
|
||||
r.group_id IN (${ids})
|
||||
</select>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<!-- <select id="findPolicyGroupInfos" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM policy_group_info r
|
||||
where r.is_valid=1
|
||||
</select>
|
||||
<select id="findNatPolicyGroups" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM policy_group_info r
|
||||
where r.is_valid=1 AND r.group_type = 2 OR r.group_type = 3
|
||||
</select>
|
||||
<select id="findHasIPPolicyGroupInfosByType" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM (
|
||||
SELECT DISTINCT dns_strategy_id FROM dns_ip_cfg WHERE is_valid=1 AND is_audit=1
|
||||
) a
|
||||
LEFT JOIN policy_group_info r ON a.dns_strategy_id=r.group_id
|
||||
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getInfoByAsnNo" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="groupId != null" >
|
||||
AND group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="asnNo != null" >
|
||||
AND asn_no = #{asnNo,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
AND is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null" >
|
||||
AND is_valid != -1
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="getHasAreaPolicyGroups" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
WHERE
|
||||
r.is_valid = 1 AND
|
||||
r.group_type = #{groupType,jdbcType=INTEGER} AND
|
||||
r.group_id IN (
|
||||
SELECT ga.group_id FROM group_area_info ga WHERE ga.is_valid != -1
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getGroupIdByGroupName" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
r.group_id
|
||||
FROM
|
||||
policy_group_info r
|
||||
WHERE
|
||||
r.group_name = #{groupName}
|
||||
</select>
|
||||
|
||||
<select id="getGroupInfo" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="groupName != null and groupName != ''" >
|
||||
AND group_name = #{groupName,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="groupType != null" >
|
||||
AND group_type = #{groupType,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="asnNo != null" >
|
||||
AND asn_no = #{asnNo,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
AND is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null" >
|
||||
AND is_valid != -1
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -178,7 +178,9 @@
|
||||
<if test="userRegion3 != null">
|
||||
AND r.user_region3 like concat(concat('%',#{userRegion3,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
|
||||
<if test="groupId != null">
|
||||
AND r.group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
@@ -309,46 +311,46 @@
|
||||
</insert>
|
||||
<insert id="insertForBatch" parameterType="com.nis.domain.basics.IpCommCfg" >
|
||||
insert into ip_comm_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
REGION_ID,
|
||||
GROUP_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
FUNCTION_ID,
|
||||
IP_TYPE,
|
||||
SRC_IP_ADDRESS,
|
||||
SRC_IP_PATTERN,
|
||||
DEST_IP_PATTERN,
|
||||
SRC_PORT_PATTERN,
|
||||
DEST_PORT_PATTERN,
|
||||
SRC_PORT,
|
||||
PROTOCOL,
|
||||
PROTOCOL_ID,
|
||||
DIRECTION,
|
||||
DEST_PORT,
|
||||
DEST_IP_ADDRESS,
|
||||
CFG_TYPE,
|
||||
CFG_REGION_CODE,
|
||||
USER_REGION1,
|
||||
USER_REGION2,
|
||||
USER_REGION3,
|
||||
USER_REGION4,
|
||||
USER_REGION5
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
REGION_ID,
|
||||
GROUP_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
FUNCTION_ID,
|
||||
IP_TYPE,
|
||||
SRC_IP_ADDRESS,
|
||||
SRC_IP_PATTERN,
|
||||
DEST_IP_PATTERN,
|
||||
SRC_PORT_PATTERN,
|
||||
DEST_PORT_PATTERN,
|
||||
SRC_PORT,
|
||||
PROTOCOL,
|
||||
PROTOCOL_ID,
|
||||
DIRECTION,
|
||||
DEST_PORT,
|
||||
DEST_IP_ADDRESS,
|
||||
CFG_TYPE,
|
||||
CFG_REGION_CODE,
|
||||
USER_REGION1,
|
||||
USER_REGION2,
|
||||
USER_REGION3,
|
||||
USER_REGION4,
|
||||
USER_REGION5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -502,10 +504,10 @@
|
||||
<if test="userRegion5 != null and userRegion5 != ''" >
|
||||
USER_REGION5 = #{userRegion5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="groupId != null and groupId != ''" >
|
||||
<if test="groupId != null" >
|
||||
GROUP_ID = #{groupId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="regionId != null and regionId != ''" >
|
||||
<if test="regionId != null" >
|
||||
REGION_ID = #{regionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.IpCommCfg;
|
||||
import com.nis.domain.basics.UrlCommCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
@@ -43,7 +45,7 @@
|
||||
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
|
||||
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
|
||||
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit,r.user_region1,r.user_region2,
|
||||
r.cfg_region_code,r.cfg_type,r.ratelimit, r.region_id, r.group_id,r.user_region1,r.user_region2,
|
||||
r.user_region3,r.user_region4,r.user_region5
|
||||
</sql>
|
||||
|
||||
@@ -54,7 +56,7 @@
|
||||
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
|
||||
</trim>
|
||||
FROM
|
||||
http_url_cfg r
|
||||
url_comm_cfg r
|
||||
LEFT JOIN sys_user s ON r.creator_id = s.id
|
||||
LEFT JOIN sys_user e ON r.editor_id = e.id
|
||||
LEFT JOIN sys_user u ON r.auditor_id = u.id
|
||||
@@ -132,7 +134,9 @@
|
||||
<if test="functionId != null">
|
||||
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
|
||||
<if test="groupId != null">
|
||||
AND r.group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
@@ -156,7 +160,7 @@
|
||||
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
|
||||
</trim>
|
||||
FROM
|
||||
http_url_cfg r
|
||||
url_comm_cfg r
|
||||
LEFT JOIN sys_user s ON r.creator_id = s.id
|
||||
LEFT JOIN sys_user e ON r.editor_id = e.id
|
||||
LEFT JOIN sys_user u ON r.auditor_id = u.id
|
||||
@@ -167,7 +171,7 @@
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
http_url_cfg r
|
||||
url_comm_cfg r
|
||||
where r.CFG_ID =#{cfgId}
|
||||
|
||||
</select>
|
||||
@@ -177,7 +181,7 @@
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
http_url_cfg r
|
||||
url_comm_cfg r
|
||||
WHERE
|
||||
r.cfg_id = #{ids} AND r.is_valid != -1
|
||||
</select>
|
||||
@@ -186,44 +190,46 @@
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
http_url_cfg r
|
||||
url_comm_cfg r
|
||||
WHERE
|
||||
r.user_region3 IN(${ids}) AND r.is_valid != -1
|
||||
</select>
|
||||
|
||||
<insert id="insertUrlCommGroupCfg" parameterType="com.nis.domain.basics.UrlCommCfg">
|
||||
insert into http_url_cfg (
|
||||
CFG_DESC,
|
||||
cfg_keywords,
|
||||
action,
|
||||
is_valid,
|
||||
is_audit,
|
||||
creator_id,
|
||||
create_time,
|
||||
editor_id,
|
||||
edit_time,
|
||||
auditor_id,
|
||||
audit_time,
|
||||
service_id,
|
||||
request_id,
|
||||
compile_id,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin,
|
||||
area_effective_ids,
|
||||
function_id,
|
||||
cfg_region_code,
|
||||
cfg_type,
|
||||
ratelimit,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
insert into url_comm_cfg (
|
||||
CFG_DESC,
|
||||
cfg_keywords,
|
||||
action,
|
||||
is_valid,
|
||||
is_audit,
|
||||
creator_id,
|
||||
create_time,
|
||||
editor_id,
|
||||
edit_time,
|
||||
auditor_id,
|
||||
audit_time,
|
||||
service_id,
|
||||
request_id,
|
||||
compile_id,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin,
|
||||
area_effective_ids,
|
||||
function_id,
|
||||
cfg_region_code,
|
||||
cfg_type,
|
||||
ratelimit,
|
||||
region_id,
|
||||
group_id,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{cfgKeywords,jdbcType=VARCHAR},
|
||||
@@ -251,6 +257,8 @@
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{ratelimit,jdbcType=VARCHAR},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{groupId,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
@@ -272,7 +280,7 @@
|
||||
</update>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.UrlCommCfg" >
|
||||
update http_url_cfg
|
||||
update url_comm_cfg
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
@@ -347,6 +355,9 @@
|
||||
<if test="ratelimit != null and ratelimit != ''" >
|
||||
ratelimit = #{ratelimit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="groupId != null">
|
||||
group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
user_region1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -370,18 +381,18 @@
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="java.lang.String" >
|
||||
delete from http_url_cfg where cfg_id in (${ids})
|
||||
delete from url_comm_cfg where cfg_id in (${ids})
|
||||
</delete>
|
||||
|
||||
<select id="getByIds" resultMap="urlCommGroupCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
from http_url_cfg r
|
||||
from url_comm_cfg r
|
||||
where r.cfg_id in (${ids}) and is_valid !=-1
|
||||
</select>
|
||||
|
||||
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
|
||||
SELECT COUNT(cfg_id) groupCount from http_url_cfg
|
||||
SELECT COUNT(cfg_id) groupCount from url_comm_cfg
|
||||
WHERE user_region3= #{groupId}
|
||||
and is_valid=1
|
||||
</select>
|
||||
|
||||
@@ -16,15 +16,13 @@ import com.nis.domain.basics.CommonGroupInfo;
|
||||
import com.nis.domain.basics.IpCommCfg;
|
||||
import com.nis.domain.basics.UrlCommCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.basics.CommonGroupManageDao;
|
||||
import com.nis.web.dao.basics.IpCommGroupCfgDao;
|
||||
import com.nis.web.dao.basics.UrlCommGroupDao;
|
||||
import com.nis.web.dao.specific.ConfigGroupInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
@Service
|
||||
public class CommonGroupManageService extends BaseService{
|
||||
@@ -33,17 +31,11 @@ public class CommonGroupManageService extends BaseService{
|
||||
private CommonGroupManageDao commonGroupManageDao;
|
||||
|
||||
@Autowired
|
||||
private ConfigGroupInfoDao configGroupInfoDao;
|
||||
|
||||
@Autowired
|
||||
private IpCommGroupCfgDao ipCommGroupCfgDao;
|
||||
private IpCommGroupCfgDao ipCommGroupCfgDao; // 校验分组时使用
|
||||
|
||||
@Autowired
|
||||
private UrlCommGroupDao urlCommGroupDao;
|
||||
|
||||
@Autowired
|
||||
private AsnIpCfgDao asnIpCfgDao;
|
||||
|
||||
public Page<CommonGroupInfo> findCommonGroupInfoList(Page<CommonGroupInfo> page, CommonGroupInfo entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
@@ -60,52 +52,34 @@ public class CommonGroupManageService extends BaseService{
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(CommonGroupInfo entity) throws MaatConvertException{
|
||||
entity.setIsValid(1);
|
||||
//新增
|
||||
if(entity.getGroupId()==null){
|
||||
if(entity.getGroupId()==null){ // 新增
|
||||
Date createTime=new Date();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
//asn类型从综合服务获取groupId 非ASN组 不对config_group_info表添加数据
|
||||
/*if(4==entity.getGroupType().intValue()) {
|
||||
int serviceGroupId=0;
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
serviceGroupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
entity.setServiceGroupId(serviceGroupId);
|
||||
//新增协议分组
|
||||
ConfigGroupInfo group = configGroupInfoDao.getConfigGroupInfoByGroupId(serviceGroupId);
|
||||
if(group==null){
|
||||
group = new ConfigGroupInfo();
|
||||
group.setGroupId(serviceGroupId);
|
||||
group.setGroupName(entity.getGroupName());
|
||||
group.setIsIssued(0);
|
||||
group.setGroupType(entity.getGroupType());
|
||||
group.setAsnId(entity.getAsnNo());
|
||||
configGroupInfoDao.insertConfigGroupInfo(group);
|
||||
// if(group.getGroupType().intValue()==4) {
|
||||
// AsnCacheUtils.put(entity.getAsnNo(), group);
|
||||
// }
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
// 获取GroupId
|
||||
int serviceGroupId=0;
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
serviceGroupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get group id failed");
|
||||
}
|
||||
entity.setServiceGroupId(serviceGroupId);
|
||||
commonGroupManageDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
|
||||
}else{ // 修改
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
commonGroupManageDao.update(entity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deldete(String ids, int isValid){
|
||||
//TODO 公共组删除时需检索是否有被对应公共组配置引用,被引用的公共组无法删除
|
||||
IpCommGroupCfgService ipGroupCfgService = SpringContextHolder.getBean(IpCommGroupCfgService.class);
|
||||
|
||||
CommonGroupInfo entity=new CommonGroupInfo();
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
@@ -119,14 +93,16 @@ public class CommonGroupManageService extends BaseService{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 查询指定类型的分组信息
|
||||
// 分组配置界面使用
|
||||
public List<CommonGroupInfo> findCommonGroupInfosByType(int type) {
|
||||
List<CommonGroupInfo> list=commonGroupManageDao.findCommonGroupInfosByType(type);
|
||||
return list;
|
||||
}
|
||||
|
||||
// 导出时使用
|
||||
public List<CommonGroupInfo> findGroupInfoList(String ids) {
|
||||
List<CommonGroupInfo> list=commonGroupManageDao.findGroupInfoList(ids);
|
||||
return list;
|
||||
@@ -175,58 +151,4 @@ public class CommonGroupManageService extends BaseService{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
public List<PolicyGroupInfo> findPolicyGroupInfos() {
|
||||
List<PolicyGroupInfo> list=commonGroupManageDao.findPolicyGroupInfos();
|
||||
return list;
|
||||
}
|
||||
public List<PolicyGroupInfo> findNatPolicyGroups() {
|
||||
List<PolicyGroupInfo> list=commonGroupManageDao.findNatPolicyGroups();
|
||||
return list;
|
||||
}
|
||||
public List<PolicyGroupInfo> findPolicyGroupInfosByType(int type) {
|
||||
List<PolicyGroupInfo> list=commonGroupManageDao.findPolicyGroupInfosByType(type);
|
||||
return list;
|
||||
}
|
||||
public List<PolicyGroupInfo> findHasIpPolicyGroupInfosByType(int type) {
|
||||
List<PolicyGroupInfo> list=commonGroupManageDao.findHasIPPolicyGroupInfosByType(type);
|
||||
return list;
|
||||
}
|
||||
public List<PolicyGroupInfo> findPolicyGroupInfosHasIpRegionByType(int type) {
|
||||
List<PolicyGroupInfo> list=commonGroupManageDao.findPolicyGroupInfosByType(type);
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean checkIps(String groupIds) {
|
||||
for(String groupId:groupIds.split(",")) {
|
||||
Integer.parseInt(groupId);
|
||||
}
|
||||
List<Integer> hasIpList=asnIpCfgDao.hasGroupIds(groupIds);
|
||||
if(hasIpList!=null&&hasIpList.size()>0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public PolicyGroupInfo getInfoByAsnNo(PolicyGroupInfo policyGroupInfo){
|
||||
return commonGroupManageDao.getInfoByAsnNo(policyGroupInfo);
|
||||
}
|
||||
|
||||
*//**
|
||||
* IP复用配置表单-获取拥有区域信息的策略分组
|
||||
* @param groupType
|
||||
* @return
|
||||
*//*
|
||||
public List<PolicyGroupInfo> getHasAreaPolicyGroups(int groupType) {
|
||||
return commonGroupManageDao.getHasAreaPolicyGroups(groupType);
|
||||
}
|
||||
|
||||
public Integer getGroupIdByGroupName(String groupName){
|
||||
return commonGroupManageDao.getGroupIdByGroupName(groupName);
|
||||
}
|
||||
|
||||
public PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo){
|
||||
return commonGroupManageDao.getGroupInfo(policyGroupInfo);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
@@ -17,42 +15,24 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.beust.jcommander.internal.Maps;
|
||||
import com.beust.jcommander.internal.Sets;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.IpCommCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnGroupInfoDao;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.basics.IpCommGroupCfgDao;
|
||||
import com.nis.web.dao.basics.PolicyGroupInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
@Service
|
||||
public class IpCommGroupCfgService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
private IpCommGroupCfgDao ipCommGroupCfgDao;
|
||||
@Autowired
|
||||
private PolicyGroupInfoDao policyGroupInfoDao;
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* @param entity
|
||||
@@ -107,6 +87,14 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
if(CollectionUtils.isNotEmpty(entity.getIpCommGroupCfgList())) {
|
||||
for (int i = 0; i < entity.getIpCommGroupCfgList().size(); i++) {
|
||||
BeanUtils.copyProperties(entity, entity.getIpCommGroupCfgList().get(i), new String[]{"cfgId","userregion3"});
|
||||
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");
|
||||
}
|
||||
entity.getIpCommGroupCfgList().get(i).setRegionId(regionId);
|
||||
entity.getIpCommGroupCfgList().get(i).setRequestId(0);
|
||||
entity.getIpCommGroupCfgList().get(i).setClassify("0");
|
||||
entity.getIpCommGroupCfgList().get(i).setAttribute("0");
|
||||
@@ -115,86 +103,12 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
entity.getIpCommGroupCfgList().get(i).setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.getIpCommGroupCfgList().get(i).setIsValid(Constants.VALID_NO);
|
||||
entity.getIpCommGroupCfgList().get(i).setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
entity.getIpCommGroupCfgList().get(i).setGroupId(Integer.parseInt(entity.getUserRegion3()));
|
||||
entity.getIpCommGroupCfgList().get(i).setGroupId(entity.getGroupId());
|
||||
ipCommGroupCfgDao.insertForBatch(entity.getIpCommGroupCfgList().get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
// public void audit(List<IpCommCfg> ipCommGroupCfgs, Integer isAudit, Integer isValid) {
|
||||
// // TODO Auto-generated method stub
|
||||
// Set<Integer> groupIds=Sets.newHashSet();
|
||||
// if(!StringUtil.isEmpty(ipCommGroupCfgs)){
|
||||
// for(IpCommCfg cfg:ipCommGroupCfgs) {
|
||||
// cfg.setIsValid(isValid);
|
||||
// cfg.setIsAudit(isAudit);
|
||||
// cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
// cfg.setAuditTime(new Date());
|
||||
// groupIds.add(cfg.getGroupId());
|
||||
// ipCommGroupCfgDao.update(cfg);
|
||||
// }
|
||||
// }
|
||||
// //查询有效的Ip配置个数
|
||||
// for(Integer groupId:groupIds) {
|
||||
// Integer groupCount=ipCommGroupCfgDao.getGroupIdCount(groupId);
|
||||
// if(groupCount>0){//udFlag 设置为1
|
||||
// policyGroupInfoDao.updateUdFlag(groupId, 1,5);
|
||||
// }else{//udFlag 设置为0
|
||||
// policyGroupInfoDao.updateUdFlag(groupId, 0,5);
|
||||
// }
|
||||
// }
|
||||
// //下发配置时改变公共组udFlag标识
|
||||
// send2Maat(ipCommGroupCfgs,isValid);
|
||||
// }
|
||||
// public void send2Maat(List<IpCommCfg> ipCommGroupCfgs,int isValid) {
|
||||
// GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
// List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
// GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
// List<IpCfg> ipRegionList = groupReuseCfgAddRemoveConvert(ipCommGroupCfgs,isValid,null);
|
||||
// List<StringCfg> strRegionList = new ArrayList<>();
|
||||
// List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||
// groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
// groupReuseCfg.setStrRegionList(strRegionList);
|
||||
// groupReuseCfg.setNumRegionList(numRegionList);
|
||||
// groupReuseList.add(groupReuseCfg);
|
||||
// maatBean.setGroupReuseCfgList(groupReuseList);
|
||||
// maatBean.setAuditTime(new Date());
|
||||
// maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
// maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
// logger.warn("IP Common Region Send To Maat start");
|
||||
// long start=System.currentTimeMillis();
|
||||
// if(isValid==Constants.VALID_YES) {
|
||||
// maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
// //调用服务接口下发配置数据
|
||||
// String json=gsonToJson(maatBean);
|
||||
// if(ipCommGroupCfgs.size()<=100) {
|
||||
// logger.info("ip 公共组域新增配置下发配置参数:"+json);
|
||||
// }else {
|
||||
// logger.info("ip 公共组域新增配置下发region条数:"+ipCommGroupCfgs.size());
|
||||
// }
|
||||
// //调用服务接口下发配置
|
||||
// ToMaatResult result =ConfigServiceUtil.postGroupReuseSources(json);
|
||||
// logger.info("ip 公共组域新增配置响应信息:"+result.getMsg());
|
||||
// }else {
|
||||
// maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
// //调用服务接口下发配置数据
|
||||
// String json=gsonToJson(maatBean);
|
||||
// if(ipCommGroupCfgs.size()<=100) {
|
||||
// logger.info("ip 公共组域删除配置下发配置参数:"+json);
|
||||
// }else {
|
||||
// logger.info("ip 公共组域删除配置下发region条数:"+ipCommGroupCfgs.size());
|
||||
//
|
||||
// }
|
||||
// //调用服务接口下发配置
|
||||
// ToMaatResult result = ConfigServiceUtil.put(json,3);
|
||||
// logger.info("asn ip复用域删除配置响应信息:"+result.getMsg());
|
||||
// }
|
||||
// long end=System.currentTimeMillis();
|
||||
// logger.warn("IP Common Region Send To Maat finish,cost:"+(end-start));
|
||||
// }
|
||||
public void delete(String ids) {
|
||||
// TODO 公共组配置删除时 需检索是否被其它业务配置引用,没被引用可删除
|
||||
|
||||
@@ -203,6 +117,7 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
}
|
||||
ipCommGroupCfgDao.delete(ids);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAndSend(FunctionRegionDict regionDict, FunctionServiceDict serviceDict, List<BaseIpCfg> cfgs,boolean send) {
|
||||
logger.warn("Start to save IP,size:"+cfgs.size());
|
||||
|
||||
@@ -1,49 +1,28 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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.Page;
|
||||
import com.nis.domain.basics.AsnGroupInfo;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.basics.UrlCommCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.UrlCommGroupDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
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 UrlCommGroupDao urlCommGroupDao;
|
||||
|
||||
public Page<UrlCommCfg> findPage(Page<UrlCommCfg> page, UrlCommCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
@@ -57,14 +36,11 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public List<UrlCommCfg> findByPage(String ids) {
|
||||
List<UrlCommCfg> list=urlCommGroupDao.findByPage(ids);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public UrlCommCfg get(Long id ) {
|
||||
return urlCommGroupDao.get(id);
|
||||
}
|
||||
@@ -76,6 +52,14 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
if(entity.getUrlCommGroupList()!=null) {
|
||||
for (int i = 0; i < entity.getUrlCommGroupList().size(); i++) {
|
||||
BeanUtils.copyProperties(entity, entity.getUrlCommGroupList().get(i), new String[]{"cfgId"});
|
||||
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");
|
||||
}
|
||||
entity.getUrlCommGroupList().get(i).setRegionId(regionId);
|
||||
entity.getUrlCommGroupList().get(i).setRequestId(0);
|
||||
entity.getUrlCommGroupList().get(i).setClassify("0");
|
||||
entity.getUrlCommGroupList().get(i).setAttribute("0");
|
||||
@@ -90,6 +74,8 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
}else{
|
||||
entity.getUrlCommGroupList().get(i).setExprType(0);
|
||||
}
|
||||
entity.getUrlCommGroupList().get(i).setGroupId(entity.getGroupId());
|
||||
|
||||
urlCommGroupDao.insertUrlCommGroupCfg(entity.getUrlCommGroupList().get(i));
|
||||
}
|
||||
// //修改公共组的标识
|
||||
@@ -118,7 +104,6 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids) {
|
||||
|
||||
urlCommGroupDao.delete(ids);
|
||||
}
|
||||
|
||||
@@ -129,7 +114,7 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
return urlCommGroupDao.getByIds(ids);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
/*@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(UrlCommCfg urlGroupCfg,Integer isAudit,Integer isValid) {
|
||||
|
||||
if(!StringUtil.isEmpty(urlGroupCfg)){
|
||||
@@ -148,6 +133,6 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
}else{//udFlag 设置为0
|
||||
urlCommGroupDao.updateUrlUdFlag(Integer.parseInt(urlGroupCfg.getUserRegion3()), 0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user