From ab07d98b559a6e1e202b3b054c915966b21c5a2f Mon Sep 17 00:00:00 2001 From: zhangwenqing Date: Sat, 18 Aug 2018 19:05:12 +0800 Subject: [PATCH] =?UTF-8?q?p2p=E9=85=8D=E7=BD=AE=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/nis/util/Constants.java | 2 +- .../ntc/FileTransferCfgController.java | 154 ++++++ .../dao/configuration/FileTransferCfgDao.java | 18 + .../dao/configuration/FileTransferCfgDao.xml | 397 +++++++++++++++- .../configuration/FileTransferCfgService.java | 347 ++++++++++++++ .../resources/messages/message_en.properties | 6 +- .../messages/message_zh_CN.properties | 6 +- .../views/cfg/fileTransfer/p2pForm.jsp | 378 +++++++++++++++ .../views/cfg/fileTransfer/p2pList.jsp | 439 ++++++++++++++++++ .../views/cfg/fileTransfer/p2pSubList.jsp | 305 ++++++++++++ .../webapp/WEB-INF/views/cfg/ipCfgForm.jsp | 17 + .../WEB-INF/views/cfg/stringCfgForm.jsp | 28 +- 12 files changed, 2085 insertions(+), 12 deletions(-) create mode 100644 src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp create mode 100644 src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp create mode 100644 src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pSubList.jsp diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 1e142fe40..ab7c702b4 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -485,7 +485,7 @@ public final class Constants { //P2P配置域 public static final String P2P_HASH_BIN_REGION = Configurations.getStringProperty("p2p_hash_bin_region","NTC_P2P_HASH_BIN"); public static final String P2P_KEYWORDS_REGION = Configurations.getStringProperty("p2p_keywords_region","NTC_P2P_KEYWORDS"); - + public static final String NTC_SUBSCRIBE_ID_REGION = Configurations.getStringProperty("ntc_subscribe_id_region","NTC_SUBSCRIBE_ID"); /** * 样例文件URL关键字 */ diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java b/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java index 649dd4730..328afda87 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/FileTransferCfgController.java @@ -29,9 +29,13 @@ import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.FileDigestCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; +import com.nis.domain.configuration.P2pHashCfg; +import com.nis.domain.configuration.P2pKeywordCfg; import com.nis.domain.maat.ToMaatResult; import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; +import com.nis.util.Constants; import com.nis.util.FileUtils; import com.nis.util.JsonMapper; import com.nis.util.StringUtil; @@ -226,4 +230,154 @@ public class FileTransferCfgController extends BaseController{ } return "redirect:" + adminPath +"/ntc/fileTransfer/fileDigestList?functionId="+functionId; } + + @RequestMapping(value = {"p2pList"}) + public String p2pList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { + Page searchPage=new Page(request,response,"a"); + Page page = fileTransferCfgService.getP2pList(searchPage, cfg); + model.addAttribute("page", page); + initPageCondition(model,cfg); + return "/cfg/fileTransfer/p2pList"; + } + + @RequestMapping(value = {"p2pForm"}) + @RequiresPermissions(value={"fileTransfer:p2p:config"}) + public String p2pForm(Model model,String ids,CfgIndexInfo entity) { + // 跳转操作页面(根据ids判断是新增 or 修改) + if(StringUtils.isNotBlank(ids)){ + entity = fileTransferCfgService.getP2pCfg(Long.parseLong(ids)); + + // 添加配置域Key,用于新增页面判断 + P2pHashCfg hashCfg = new P2pHashCfg(); + hashCfg.setCfgType(Constants.P2P_HASH_BIN_REGION); + entity.setP2pHash(hashCfg); + P2pKeywordCfg keywordCfg = new P2pKeywordCfg(); + keywordCfg.setCfgType(Constants.P2P_KEYWORDS_REGION); + entity.setP2pKeyword(keywordCfg); + NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); + subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID_REGION); + entity.setNtcSubscribeIdCfg(subscribeIdCfg); + + if(entity.getP2pHashList().size() == 0) { + entity.getP2pHashList().add(hashCfg); + } + if(entity.getP2pKeywordList().size() == 0) { + entity.getP2pKeywordList().add(keywordCfg); + } + if(entity.getNtcSubscribeIdCfgList().size() == 0) { + entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg); + } + + initUpdateFormCondition(model,entity); + }else{ + // 添加配置域Key,用于修改页面判断 + P2pHashCfg hashCfg = new P2pHashCfg(); + hashCfg.setCfgType(Constants.P2P_HASH_BIN_REGION); + entity.setP2pHash(hashCfg); + P2pKeywordCfg keywordCfg = new P2pKeywordCfg(); + keywordCfg.setCfgType(Constants.P2P_KEYWORDS_REGION); + entity.setP2pKeyword(keywordCfg); + NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg(); + subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID_REGION); + entity.setNtcSubscribeIdCfg(subscribeIdCfg); + + List hashList = new ArrayList(); + hashList.add(hashCfg); + entity.setP2pHashList(hashList); + List keywordList = new ArrayList(); + keywordList.add(keywordCfg); + entity.setP2pKeywordList(keywordList); + ArrayList subscribeIdList = new ArrayList(); + subscribeIdList.add(subscribeIdCfg); + entity.setNtcSubscribeIdCfgList(subscribeIdList); + + initFormCondition(model,entity); + } + + model.addAttribute("_cfg", entity); + return "/cfg/fileTransfer/p2pForm"; + } + + @RequestMapping(value = {"saveP2pCfg"}) + @RequiresPermissions(value={"fileTransfer:p2p:config"}) + public String saveP2pCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) { + fileTransferCfgService.saveP2pCfg(entity); + return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+entity.getFunctionId(); + } + + @RequestMapping(value = {"updateP2pCfgValid"}) + @RequiresPermissions(value={"fileTransfer:p2p:config"}) + public String updateP2pCfgValid(Integer isValid,String ids,Integer functionId) { + fileTransferCfgService.updateP2pCfgValid(isValid,ids,functionId); + return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+functionId; + } + + @RequestMapping(value = {"ajaxP2pSubList"}) + public String ajaxP2pSubList(Model model,Long cfgId,Integer index) { + CfgIndexInfo cfg = fileTransferCfgService.getP2pCfg(cfgId); + List tabList = new ArrayList(); + if(cfg.getIpPortList()!=null){ + String cfgType = null; + for(IpPortCfg ip:cfg.getIpPortList()){ + if(!ip.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"1",ip.getCfgType()}); + cfgType = ip.getCfgType(); + } + } + } + if(cfg.getP2pHashList()!=null){ + String cfgType = null; + for(BaseStringCfg hash:cfg.getP2pHashList()){ + if(!hash.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",hash.getCfgType()}); + cfgType = hash.getCfgType(); + } + } + } + if(cfg.getP2pKeywordList()!=null){ + String cfgType = null; + for(BaseStringCfg keyword:cfg.getP2pKeywordList()){ + if(!keyword.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",keyword.getCfgType()}); + cfgType = keyword.getCfgType(); + } + } + } + if(cfg.getNtcSubscribeIdCfgList()!=null){ + String cfgType = null; + for(BaseStringCfg subscribeId:cfg.getNtcSubscribeIdCfgList()){ + if(!subscribeId.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",subscribeId.getCfgType()}); + cfgType = subscribeId.getCfgType(); + } + } + } + model.addAttribute("_cfg", cfg); + model.addAttribute("index", index); + model.addAttribute("tabList", tabList); + return "/cfg/fileTransfer/p2pSubList"; + } + + @RequestMapping(value = {"auditP2pCfg"}) + @RequiresPermissions(value={"fileTransfer:p2p:confirm"}) + public String auditP2pCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + CfgIndexInfo entity = new CfgIndexInfo(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity = fileTransferCfgService.getP2pCfg(Long.parseLong(id)); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(new Date()); + entity.setFunctionId(functionId); + try { + fileTransferCfgService.auditP2pCfg(entity,isAudit); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("p2p配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); + } + } + return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+functionId; + } } diff --git a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java index d10ef53c4..e43bc8ca3 100644 --- a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.java @@ -8,6 +8,9 @@ import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.FileDigestCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; +import com.nis.domain.configuration.P2pHashCfg; +import com.nis.domain.configuration.P2pKeywordCfg; import com.nis.web.dao.CrudDao; import com.nis.web.dao.MyBatisDao; @@ -35,4 +38,19 @@ public interface FileTransferCfgDao extends CrudDao { public void auditCfg(BaseCfg entity); public FileDigestCfg getFileDigest(Long id); public void updateFileDigestCfg(FileDigestCfg entity); + + // P2P域配置新增 + public void saveP2pHashCfg(BaseStringCfg cfg); + public void saveP2pKeywordCfg(BaseStringCfg cfg); + public void saveP2pSubscribeIdCfg(NtcSubscribeIdCfg cfg); + // 获取P2P域配置信息 + public List getP2pList(CfgIndexInfo entity); + public List getP2pHashList(CfgIndexInfo entity); + public List getP2pKeywordList(CfgIndexInfo entity); + public List getP2pSubscribeidList(CfgIndexInfo entity); + // P2P修改配置操作时,先删除旧域配置信息 + public void deleteP2pIpCfg(CfgIndexInfo entity); + public void deleteP2pHashCfg(CfgIndexInfo entity); + public void deleteP2pKeywordCfg(CfgIndexInfo entity); + public void deleteP2pSubscribeIdCfg(CfgIndexInfo entity); } diff --git a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml index f08e8248a..5ded7c176 100644 --- a/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/FileTransferCfgDao.xml @@ -57,6 +57,11 @@ + + + + + @@ -144,6 +149,11 @@ + + + + + a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT, @@ -157,13 +167,15 @@ ,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id ,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id, a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable - ,a.area_effective_ids,a.function_id,a.cfg_region_code + ,a.area_effective_ids,a.function_id,a.cfg_region_code, + a.user_region1,a.user_region2,a.user_region3,a.user_region4,a.user_region5 a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type, a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id, a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable, - a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code + a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code, + a.user_region1,a.user_region2,a.user_region3,a.user_region4,a.user_region5 a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,a.district, @@ -393,7 +405,12 @@ dest_port, dest_ip_address, cfg_type, - cfg_region_code + cfg_region_code, + user_region1, + user_region2, + user_region3, + user_region4, + user_region5 )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -425,7 +442,12 @@ #{destPort,jdbcType=VARCHAR}, #{destIpAddress,jdbcType=VARCHAR}, #{cfgType,jdbcType=VARCHAR}, - #{cfgRegionCode,jdbcType=INTEGER} + #{cfgRegionCode,jdbcType=INTEGER}, + #{userRegion1,jdbcType=VARCHAR}, + #{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR}, + #{userRegion4,jdbcType=VARCHAR}, + #{userRegion5,jdbcType=VARCHAR} ) @@ -575,6 +597,357 @@ #{isHexbin,jdbcType=INTEGER} ) + + + + + + + + + + + + + SELECT LAST_INSERT_ID() + + insert into p2p_hash_cfg ( + CFG_DESC, + 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, + AREA_EFFECTIVE_IDS, + function_id, + cfg_keywords, + cfg_type, + cfg_region_code, + expr_type, + match_method, + is_hexbin, + user_region1, + user_region2, + user_region3, + user_region4, + user_region5 + )values ( + #{cfgDesc,jdbcType=VARCHAR}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{functionId,jdbcType=INTEGER}, + #{cfgKeywords,jdbcType=VARCHAR}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{exprType,jdbcType=INTEGER}, + #{matchMethod,jdbcType=INTEGER}, + #{isHexbin,jdbcType=INTEGER}, + #{userRegion1,jdbcType=VARCHAR}, + #{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR}, + #{userRegion4,jdbcType=VARCHAR}, + #{userRegion5,jdbcType=VARCHAR} + ) + + + + + + SELECT LAST_INSERT_ID() + + insert into p2p_keyword_cfg ( + CFG_DESC, + 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, + AREA_EFFECTIVE_IDS, + function_id, + cfg_keywords, + cfg_type, + cfg_region_code, + expr_type, + match_method, + is_hexbin + )values ( + #{cfgDesc,jdbcType=VARCHAR}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{functionId,jdbcType=INTEGER}, + #{cfgKeywords,jdbcType=VARCHAR}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{exprType,jdbcType=INTEGER}, + #{matchMethod,jdbcType=INTEGER}, + #{isHexbin,jdbcType=INTEGER} + ) + + + + + + SELECT LAST_INSERT_ID() + + insert into ntc_subscribe_id_cfg ( + CFG_DESC, + 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, + AREA_EFFECTIVE_IDS, + function_id, + cfg_keywords, + cfg_type, + cfg_region_code, + expr_type, + match_method, + is_hexbin + )values ( + #{cfgDesc,jdbcType=VARCHAR}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{functionId,jdbcType=INTEGER}, + #{cfgKeywords,jdbcType=VARCHAR}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{exprType,jdbcType=INTEGER}, + #{matchMethod,jdbcType=INTEGER}, + #{isHexbin,jdbcType=INTEGER} + ) + + @@ -647,6 +1020,22 @@ delete from file_digest_cfg where compile_id=#{compileId} and function_id=#{functionId} + + + delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId} + + + + delete from p2p_hash_cfg where compile_id=#{compileId} and function_id=#{functionId} + + + + delete from p2p_keyword_cfg where compile_id=#{compileId} and function_id=#{functionId} + + + + delete from ntc_subscribe_id_cfg where compile_id=#{compileId} and function_id=#{functionId} + diff --git a/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java b/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java index 726ffb3ef..723943a81 100644 --- a/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/FileTransferCfgService.java @@ -22,6 +22,9 @@ import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.FileDigestCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.NtcSubscribeIdCfg; +import com.nis.domain.configuration.P2pHashCfg; +import com.nis.domain.configuration.P2pKeywordCfg; import com.nis.domain.configuration.FtpKeywordCfg; import com.nis.domain.maat.MaatCfg; import com.nis.domain.maat.ToMaatBean; @@ -527,4 +530,348 @@ public class FileTransferCfgService extends CrudService getP2pList(Page page, CfgIndexInfo entity){ + // 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL) + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a")); + entity.setPage(page); + List list = fileTransferCfgDao.getP2pList(entity); + page.setList(list); + return page; + } + + public CfgIndexInfo getP2pCfg(Long cfgId){ + // 查询各域配置信息 + CfgIndexInfo entity = fileTransferCfgDao.getCfgIndexInfo(cfgId); + List ipPortList = fileTransferCfgDao.getIpPortList(entity); + List hashList = fileTransferCfgDao.getP2pHashList(entity); + List keywordList = fileTransferCfgDao.getP2pKeywordList(entity); + List subscribeIdList = fileTransferCfgDao.getP2pSubscribeidList(entity); + entity.setIpPortList(ipPortList); + entity.setP2pHashList(hashList); + entity.setP2pKeywordList(keywordList); + entity.setNtcSubscribeIdCfgList(subscribeIdList); + return entity; + } + + /** + * 保存p2p配置 + * @param entity + */ + public void saveP2pCfg(CfgIndexInfo entity){ + //设置区域运营商信息 + setAreaEffectiveIds(entity); + if(entity.getCfgId()==null){ + Integer compileId = 0; + try { + List idList = ConfigServiceUtil.getId(1, 1); + if(idList!=null && idList.size()>0){ + compileId = idList.get(0); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + fileTransferCfgDao.saveCfgIndex(entity); + // 保存IP域配置信息 + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setUserRegion2(null); + fileTransferCfgDao.saveIpPortCfg(cfg); + } + } + // 保存Hash类型域配置信息 + if(entity.getP2pHashList()!=null){ + for(BaseStringCfg cfg:entity.getP2pHashList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setUserRegion1(cfg.getUserRegion2()); + cfg.setUserRegion2(null); + fileTransferCfgDao.saveP2pHashCfg(cfg); + } + } + } + // 保存关键字域配置信息 + if(entity.getP2pKeywordList()!=null){ + for(P2pKeywordCfg cfg:entity.getP2pKeywordList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + fileTransferCfgDao.saveP2pKeywordCfg(cfg); + } + } + } + // 保存SubscribeId域配置信息 + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + fileTransferCfgDao.saveP2pSubscribeIdCfg(cfg); + } + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+e.getMessage()); + } + + }else{ + fileTransferCfgDao.updateCfgIndex(entity); + //无效子配置后,再新增子配置 + fileTransferCfgDao.deleteP2pIpCfg(entity); + fileTransferCfgDao.deleteP2pHashCfg(entity); + fileTransferCfgDao.deleteP2pKeywordCfg(entity); + fileTransferCfgDao.deleteP2pSubscribeIdCfg(entity); + AreaIpCfg area = new AreaIpCfg(); + area.setCompileId(entity.getCompileId()); + area.setFunctionId(entity.getFunctionId()); + areaIpCfgDao.deleteAreaIpCfg(area); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setUserRegion2(null); + fileTransferCfgDao.saveIpPortCfg(cfg); + } + } + if(entity.getP2pHashList()!=null){ + for(BaseStringCfg cfg:entity.getP2pHashList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setUserRegion1(cfg.getUserRegion2()); + cfg.setUserRegion2(null); + fileTransferCfgDao.saveP2pHashCfg(cfg); + } + } + } + if(entity.getP2pKeywordList()!=null){ + for(P2pKeywordCfg cfg:entity.getP2pKeywordList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + fileTransferCfgDao.saveP2pKeywordCfg(cfg); + } + } + } + if(entity.getNtcSubscribeIdCfgList()!=null){ + for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + fileTransferCfgDao.saveP2pSubscribeIdCfg(cfg); + } + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } + } + + public void updateP2pCfgValid(Integer isValid, String ids, Integer functionId) { + CfgIndexInfo entity = new CfgIndexInfo(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity.setCfgId(Long.parseLong(id)); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + entity.setTableName(CfgIndexInfo.getTablename()); + entity.setFunctionId(functionId); + fileTransferCfgDao.updateCfgValid(entity); + //查询子配置 + entity = this.getP2pCfg(Long.parseLong(id)); + if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ + IpPortCfg cfg = new IpPortCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(IpPortCfg.getTablename()); + cfg.setUserRegion2(null); + fileTransferCfgDao.updateCfgValid(cfg); + } + if(entity.getP2pHashList()!=null && entity.getP2pHashList().size()>0){ + P2pHashCfg cfg = new P2pHashCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(P2pHashCfg.getTablename()); + cfg.setUserRegion1(cfg.getUserRegion2()); + cfg.setUserRegion2(null); + fileTransferCfgDao.updateCfgValid(cfg); + } + if(entity.getP2pKeywordList()!=null && entity.getP2pKeywordList().size()>0){ + P2pKeywordCfg cfg = new P2pKeywordCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(P2pKeywordCfg.getTablename()); + fileTransferCfgDao.updateCfgValid(cfg); + } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + fileTransferCfgDao.updateCfgValid(cfg); + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(AreaIpCfg.getTablename()); + fileTransferCfgDao.updateCfgValid(cfg); + } + } + + } + + public void auditP2pCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{ + //修改数据库审核状态信息 + entity.setTableName(CfgIndexInfo.getTablename()); + fileTransferCfgDao.auditCfg(entity); + + ToMaatBean maatBean = new ToMaatBean(); + MaatCfg maatCfg = new MaatCfg(); + List configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + + //查询子配置并修改审核状态 + entity = this.getP2pCfg(entity.getCfgId()); + if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ + IpPortCfg cfg = new IpPortCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(IpPortCfg.getTablename()); + fileTransferCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList); + groupRelationList=map.get("groupList"); + ipRegionList=map.get("dstList"); + if(map.get("numRegionList")!=null){ + numRegionList.addAll(map.get("numRegionList")); + } + } + } + if(entity.getP2pHashList()!=null && entity.getP2pHashList().size()>0){ + P2pHashCfg cfg = new P2pHashCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(P2pHashCfg.getTablename()); + fileTransferCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getP2pHashList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } + if(entity.getP2pKeywordList()!=null && entity.getP2pKeywordList().size()>0){ + P2pKeywordCfg cfg = new P2pKeywordCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(P2pKeywordCfg.getTablename()); + fileTransferCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getP2pKeywordList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } + if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){ + NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(NtcSubscribeIdCfg.getTablename()); + fileTransferCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } + + + //保存区域IP信息 + List areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId()); + if(!StringUtil.isEmpty(areaIpCfgList)){ + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(AreaIpCfg.getTablename()); + fileTransferCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList); + groupRelationList=map.get("groupList"); + areaIpRegionList=map.get("dstList"); + } + } + + //构造提交综合服务参数格式,一条配置提交一次综合服务 + if(isAudit==1){ + maatCfg.initDefaultValue(); + BeanUtils.copyProperties(entity, maatCfg); + maatCfg.setAction(entity.getAction()); + maatCfg.setAuditTime(entity.getAuditTime()); + maatCfg.setIpRegionList(ipRegionList); + maatCfg.setStrRegionList(strRegionList); + maatCfg.setNumRegionList(numRegionList); + maatCfg.setDigestRegionList(digestRegionList); + maatCfg.setGroupRelationList(groupRelationList); + maatCfg.setGroupNum(groupRelationList.size()); + maatCfg.setAreaIpRegionList(areaIpRegionList); + maatCfg.setIsValid(entity.getIsValid()); + + //设置自定义域参数 + String userRegion = ""; + for (IpPortCfg ipPortCfg : entity.getIpPortList()) { + if(!ipPortCfg.getUserRegion1().equals("")) { + userRegion += Constants.P2P_IP_TYPE_USER_REGION_KEY+"="+ipPortCfg.getUserRegion1(); + } + for (BaseStringCfg p2pHashCfg : entity.getP2pHashList()) { + if(!p2pHashCfg.getUserRegion1().equals("")) { + userRegion += Constants.USER_REGION_SPLIT+Constants.P2P_HASH_TYPE_USER_REGION_KEY+"="+p2pHashCfg.getUserRegion1(); + }else { + userRegion += Constants.USER_REGION_SPLIT+Constants.P2P_HASH_TYPE_USER_REGION_KEY+"="; + } + } + } + maatCfg.setUserRegion(userRegion); + + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + + //调用服务接口下发配置数据 + String json=gsonToJson(maatBean); + logger.info("p2p配置下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postMaatCfg(json); + logger.info("p2p配置下发响应信息:"+result.getMsg()); + + }else if(isAudit==3){ + maatCfg.setCompileId(entity.getCompileId()); + maatCfg.setServiceId(entity.getServiceId()); + maatCfg.setIsValid(0);//无效 + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.UPDATE_ACTION); + //调用服务接口取消配置 + String json=gsonToJson(maatBean); + logger.info("p2p配置下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json,1); + logger.info("p2p配置取消配置响应信息:"+result.getMsg()); + } + } + } diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index d887e2f47..ab77dd1e5 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1064,4 +1064,8 @@ req_hdr_key=Request Header File Key req_body_key=Request Body File Key res_hdr_key=Response Header File Key res_body_key=Response Body File Key -website=Website \ No newline at end of file +website=Website + +p2p_ip_config_type=IP Config Type +p2p_hash_type=Hash Type +NTC_SUBSCRIBE_ID=Certification Mark Configuration \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index f657f666a..533b7590a 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1062,4 +1062,8 @@ req_hdr_key=\u8BF7\u6C42\u5934\u8F6C\u50A8\u6587\u4EF6KEY req_body_key=\u8BF7\u6C42\u4F53\u8F6C\u50A8\u6587\u4EF6KEY res_hdr_key=\u5E94\u7B54\u5934\u8F6C\u50A8\u6587\u4EF6KEY res_body_key=\u5E94\u7B54\u4F53\u8F6C\u50A8\u6587\u4EF6KEY -website=\u7F51\u7AD9\u57DF\u540D \ No newline at end of file +website=\u7F51\u7AD9\u57DF\u540D + +p2p_ip_config_type=IP\u914D\u7F6E\u7C7B\u578B +p2p_hash_type=HASH\u7C7B\u578B +NTC_SUBSCRIBE_ID=\u8BA4\u8BC1\u6807\u8BC6\u914D\u7F6E \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp new file mode 100644 index 000000000..8a2edc1f3 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pForm.jsp @@ -0,0 +1,378 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + + + + +
+

+ +

+
+
+
+
+
+ + + + + + + +
+
+
+ +
+ + + + + +
+ + +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + +
+
+
+
+
+ + + + + + + + +

+ + +

+ + + + + + +
+ <%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%> +
+ +
+
+
+ + + + +
+ +
+ + + + + +

+ + +

+ + + + + + + + +
+ <%@include file="/WEB-INF/views/cfg/stringCfgForm.jsp"%> +
+ + +
+
+
+ + + + +
+ + + + +
+
+ + + +

+ + +

+ + + + + + + + +
+ <%@include file="/WEB-INF/views/cfg/stringCfgForm.jsp"%> +
+ + +
+
+
+ + + + +
+ + + + +
+
+ + + +

+ + +

+ + + + + + + + +
+ <%@include file="/WEB-INF/views/cfg/stringCfgForm.jsp"%> +
+ + +
+
+
+ + + + +
+ + + + +
+
+
+
+
+ <%@include file="/WEB-INF/include/form/areaInfo.jsp"%> +
+ <%@include file="/WEB-INF/include/form/basicInfo.jsp"%> +
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp new file mode 100644 index 000000000..b69a6f248 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pList.jsp @@ -0,0 +1,439 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + + + +
+ + +

+ + +

+ +
+
+
+
+ + + + + + + + + + +
+
+ + + + + + + + +
+ +
+ +
+
+ + + + <%-- + + + --%> + + +
+ + + +
+
+
+ + + +
+
+ + + + + +
+ + +
+
+ href="javascript:;"> + + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+ + +
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + ${indexCfg.cfgDesc } + + + + + + + + + + + + + ${indexCfg.requestName } + + + + + + + + + + + + + + + ${fns:abbr(classify,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(attribute,20)} + + + + + + + + + + + + + + + + + + ${fns:abbr(lableInfo,20)} + + + + + + + + + + + + +
${indexCfg.creatorName }${indexCfg.editorName }${indexCfg.auditorName }
+
${page}
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pSubList.jsp new file mode 100644 index 000000000..b3e025f00 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/fileTransfer/p2pSubList.jsp @@ -0,0 +1,305 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + +
+ + +
+
+ +
+ + + + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp index c818ccd38..923690421 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp @@ -38,6 +38,22 @@
+ +
+
+ +
+ +
+
+
+
+
@@ -155,6 +171,7 @@
+
+ +
+
+ +
+ +
+
+
+
+
- +
@@ -82,13 +98,14 @@ $(function(){
@@ -132,5 +149,6 @@ $(function(){
+ \ No newline at end of file