diff --git a/src/main/java/com/nis/domain/configuration/AppIdCfg.java b/src/main/java/com/nis/domain/configuration/AppIdCfg.java index 20281e980..3d3a64483 100644 --- a/src/main/java/com/nis/domain/configuration/AppIdCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppIdCfg.java @@ -8,6 +8,8 @@ */ package com.nis.domain.configuration; +import java.util.List; + /** * @ClassName: AppIdConfig.java * @Description: TODO @@ -30,8 +32,64 @@ public class AppIdCfg extends BaseCfg { /** * 应用协议id */ - private String appId; + private Long appId; + /** + * 编译id + */ + private Integer compileId; + + /** + * 协议字符串特征表信息列表 + */ + private List complexFeaturesList; + + /** + * 协议增强字符串特征配置信息列表 + */ + private List strFeaturesCfgList; + + private List featuresList; + + public static class AppFeaturesIndex{ + private Long indexId; + private Integer appCompileId; + private String featuresTable; + private Integer featuresCompileId; + private Integer featuresTableType; + public Long getIndexId() { + return indexId; + } + public void setIndexId(Long indexId) { + this.indexId = indexId; + } + public String getFeaturesTable() { + return featuresTable; + } + public void setFeaturesTable(String featuresTable) { + this.featuresTable = featuresTable; + } + + public Integer getFeaturesTableType() { + return featuresTableType; + } + public void setFeaturesTableType(Integer featuresTableType) { + this.featuresTableType = featuresTableType; + } + public Integer getAppCompileId() { + return appCompileId; + } + public void setAppCompileId(Integer appCompileId) { + this.appCompileId = appCompileId; + } + public Integer getFeaturesCompileId() { + return featuresCompileId; + } + public void setFeaturesCompileId(Integer featuresCompileId) { + this.featuresCompileId = featuresCompileId; + } + + } /** * appName * @return appName @@ -53,17 +111,34 @@ public class AppIdCfg extends BaseCfg { * @return appId */ - public String getAppId() { + public Long getAppId() { return appId; } /** * @param appId the appId to set */ - public void setAppId(String appId) { + public void setAppId(Long appId) { this.appId = appId; } + /** + * compileId + * @return compileId + */ + + public Integer getCompileId() { + return compileId; + } + + /** + * @param compileId the compileId to set + */ + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + + /* (non-Javadoc) * @see com.nis.domain.configuration.BaseCfg#initDefaultValue() */ @@ -73,5 +148,29 @@ public class AppIdCfg extends BaseCfg { super.initDefaultValue(); } + + public List getComplexFeaturesList() { + return complexFeaturesList; + } + + public void setComplexFeaturesList(List complexFeaturesList) { + this.complexFeaturesList = complexFeaturesList; + } + + public List getStrFeaturesCfgList() { + return strFeaturesCfgList; + } + + public void setStrFeaturesCfgList(List strFeaturesCfgList) { + this.strFeaturesCfgList = strFeaturesCfgList; + } + + public List getFeaturesList() { + return featuresList; + } + + public void setFeaturesList(List featuresList) { + this.featuresList = featuresList; + } } diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index ccf3c5578..f8145f9d9 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -22,6 +22,10 @@ public final class Constants { * 词典数据key */ public static final String CACHE_DICT_MAP = "dictMap"; + /** + * 特征域字典key + */ + public static final String CACHE_FEATURES_DICT_MAP = "featuresDictMap"; /** * 词典数据分类 */ diff --git a/src/main/java/com/nis/util/DictUtils.java b/src/main/java/com/nis/util/DictUtils.java index 5c1303f49..b7390498b 100644 --- a/src/main/java/com/nis/util/DictUtils.java +++ b/src/main/java/com/nis/util/DictUtils.java @@ -1,5 +1,6 @@ package com.nis.util; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -9,7 +10,9 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.SysDataDictionaryName; +import com.nis.domain.basics.SysDictInfo; import com.nis.web.dao.SysDictDao; +import com.nis.web.dao.basics.SysDictInfoDao; import com.nis.web.service.SpringContextHolder; @@ -24,7 +27,7 @@ import com.nis.web.service.SpringContextHolder; public class DictUtils { private final static SysDictDao dictDao = SpringContextHolder.getBean(SysDictDao.class); - + private final static SysDictInfoDao sysDictInfoDao = SpringContextHolder.getBean(SysDictInfoDao.class); public static Map> getDictData() { @@ -139,8 +142,32 @@ public class DictUtils { public static String getDictListJson(String key){ return JsonMapper.toJsonString(getDictList(key)); } - - - - + /** + * 增强字符串配置特征域字典 + * @return + */ + public static List getFeaturesDictData(String itemCode) { + Map> dictMap = (Map>)CacheUtils.get(Constants.CACHE_FEATURES_DICT_MAP); + if(StringUtil.isEmpty(dictMap)){ + dictMap = Maps.newHashMap(); + SysDictInfo dict = new SysDictInfo(); + dict.setItemType(3); + dict.setItemCode(itemCode); + List dicList = sysDictInfoDao.findAllSysDictInfo(dict,""); + dictMap.put(itemCode, dicList); + CacheUtils.put(Constants.CACHE_FEATURES_DICT_MAP, dictMap); + }else{ + if(StringUtil.isEmpty(dictMap.get(itemCode))){ + SysDictInfo dict = new SysDictInfo(); + dict.setItemType(3); + dict.setItemCode(itemCode); + List dicList = sysDictInfoDao.findAllSysDictInfo(dict,""); + dictMap.put(itemCode, dicList); + CacheUtils.put(Constants.CACHE_FEATURES_DICT_MAP, dictMap); + } + + } + + return dictMap.get(itemCode); + } } diff --git a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java index 79eaa7215..a8b78fa1d 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -1,13 +1,300 @@ package com.nis.web.controller.configuration; +import java.util.Date; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +import com.nis.domain.Page; +import com.nis.domain.ServiceConfigInfo; +import com.nis.domain.SystemServiceInfo; +import com.nis.domain.basics.ServiceDictInfo; +import com.nis.domain.basics.SysDictInfo; +import com.nis.domain.configuration.AppIdCfg; +import com.nis.domain.configuration.BaseCfg; +import com.nis.domain.configuration.RequestInfo; +import com.nis.domain.specific.SpecificServiceCfg; +import com.nis.util.Constants; +import com.nis.web.controller.BaseController; /** * 特定协议相关配置控制类 - * @author dell + * @author zhangwei * */ @Controller -public class AppCfgController { +@RequestMapping("${adminPath}/cfg/app") +public class AppCfgController extends BaseController { + @RequestMapping(value = {"list"}) + public String cfgList(Model model,Integer audit,String cfgName,@ModelAttribute("cfg")AppIdCfg cfg,HttpServletRequest request,HttpServletResponse response) { + model.addAttribute("cfgName", cfgName); + model.addAttribute("audit", audit); + if(cfg!=null){ + Integer serviceId=cfg.getServiceId(); + logger.info("servcice id is "+serviceId); + if(serviceId!=null){ + model.addAttribute("serviceId", serviceId); + List serviceList=serviceConfigInfoService.findList(serviceId); + if(serviceList!=null){ + for(ServiceConfigInfo s:serviceList){ + if(s.getTableType()==2 || s.getTableType()==4){ + model.addAttribute("isContainFeaturesCfg", true); + break; + } + } + Page page = appCfgService.findPage(new Page(request, response,"r"), cfg); + model.addAttribute("page", page); + model.addAttribute("action", cfg.getAction()); + List requestInfos=requestInfoService.getValidRequestInfo(); + model.addAttribute("requestInfos", requestInfos); + List fls=serviceDictInfoService.findAllFlDict(); + model.addAttribute("fls", fls); + List xzs=serviceDictInfoService.findAllXzDict(); + model.addAttribute("xzs", xzs); + List lables=serviceDictInfoService.findAllLableDict(); + model.addAttribute("lables", lables); + SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg(); + specificServiceCfg.setIsValid(1); + model.addAttribute("protocolList",specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,"spec_service_id DESC")); + }else{ + logger.error("未获取到正确的serviceId"); + } + } + } + + return "/cfg/appCfgList"; + } + + @RequestMapping(value = {"form"}) + public String cfgForm(int action,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) { + model.addAttribute("action", action); + model.addAttribute("serviceId", serviceId); + model.addAttribute("audit", Constants.CFG_PAGE); + model.addAttribute("cfgName", cfgName); + logger.info("sercice id is "+serviceId); + +// SystemServiceInfo serviceInfo=systemServiceService.get(serviceId); +// model.addAttribute("serviceInfo", serviceInfo); + //来函信息 + List requestInfos=requestInfoService.getValidRequestInfo(); + model.addAttribute("requestInfos", requestInfos); + //分类信息 + List fls=serviceDictInfoService.findFlDict(); + model.addAttribute("fls", fls); + //性质信息 + List xzs=serviceDictInfoService.findXzDict(); + model.addAttribute("xzs", xzs); + //标签信息 + List lables=serviceDictInfoService.findLableDict(); + model.addAttribute("lables", lables); + //特定服务信息 + SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg(); + specificServiceCfg.setIsValid(1); + model.addAttribute("protocolList",specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,"spec_service_id DESC")); + //协议特征配置 + List featuresList = serviceConfigInfoService.findList(serviceId); + model.addAttribute("featuresList",featuresList); + //特征作用域信息 + /*SysDictInfo sysDictInfo = new SysDictInfo(); + sysDictInfo.setItemType(3); + Integer[] itType = new Integer[0]; + List featuresAreaList = sysDictInfoService.findAllSysDictInfo(sysDictInfo,itType,null); + model.addAttribute("featuresAreaList", featuresAreaList);*/ + AppIdCfg cfg = new AppIdCfg(); + cfg.initDefaultValue(); + cfg.setAction(action); + cfg.setServiceId(serviceId.intValue()); + model.addAttribute("_cfg", cfg); + return "/cfg/appCfgForm"; + } + @RequestMapping(value = {"updateForm"}) + public String updateAppCfgForm(int action,long cfgId,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) { + model.addAttribute("cfgName", cfgName); + model.addAttribute("serviceId", serviceId); + model.addAttribute("action", action); + model.addAttribute("audit", Constants.CFG_PAGE); + + AppIdCfg searchBean=new AppIdCfg(); + searchBean.setCfgId(cfgId); + AppIdCfg cfg=appCfgService.getAppCfgById(searchBean); + model.addAttribute("_cfg", cfg); + List requestInfos=requestInfoService.getAllRequestInfo(); + model.addAttribute("requestInfos", requestInfos); + List fls=serviceDictInfoService.findAllFlDict(); + model.addAttribute("fls", fls); + List xzs=serviceDictInfoService.findAllXzDict(); + model.addAttribute("xzs", xzs); + List lables=serviceDictInfoService.findAllLableDict(); + model.addAttribute("lables", lables); + //特定服务信息 + SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg(); + specificServiceCfg.setIsValid(1); + model.addAttribute("protocolList",specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,"spec_service_id DESC")); + //协议特征配置 + List featuresList = serviceConfigInfoService.findList(serviceId); + model.addAttribute("featuresList",featuresList); + return "/cfg/appCfgForm"; + } + @RequestMapping(value = {"showFeaturesCfg"}) + public String showFeaturesCfg(int action,long cfgId,Integer compileId,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response){ + AppIdCfg cfg=new AppIdCfg(); + cfg.setCfgId(cfgId); + cfg.setCompileId(compileId); + cfg = appCfgService.findAppIdCfg(cfg); + model.addAttribute("_cfg", cfg); + model.addAttribute("cfgName", cfgName); + model.addAttribute("serviceId", serviceId); + model.addAttribute("action", action); + //协议特征配置 + List featuresList = serviceConfigInfoService.findList(serviceId); + model.addAttribute("featuresList",featuresList); + return "/cfg/appFeaturesCfg"; + } + + /** + * + * addAppCfg(新增IP配置) + * (这里描述这个方法适用条件 – 可选) + * @return + *String + * @exception + * @since 1.0.0 + */ + @RequestMapping(value = {"saveOrUpdateCfg"}) + public String saveOrUpdateAppCfg(String cfgName,Model model, AppIdCfg cfg) { + model.addAttribute("audit", Constants.CFG_PAGE); + model.addAttribute("cfgType","app"); + model.addAttribute("cfgName",cfgName); + model.addAttribute("serviceId",cfg.getServiceId()); + model.addAttribute("action",cfg.getAction()); + logger.info("saveOrUpdateAppCfg loaded"); + if(cfg==null){ + logger.error("无法保存空的配置!"); + addMessage(model,"保存失败!"); + }else{ + SpecificServiceCfg protocol = specificServiceCfgService.getBySpecServiceId(cfg.getAppId().intValue()); + if(protocol!=null){ + cfg.setAppName(protocol.getSpecServiceName()); + int serviceId=cfg.getServiceId(); + cfg.setIsValid(Constants.VALID_NO); + cfg.setIsAudit(Constants.AUDIT_NOT_YET); + if(cfg.getCfgId()==null){ + cfg.setCreatorId(cfg.getCurrentUser().getId()); + cfg.setCreateTime(new Date()); + try { + appCfgService.addAppCfg(cfg); + } catch (Exception e) { + e.printStackTrace(); + logger.error("配置保存失败!"+e.getMessage()); + addMessage(model,"保存失败!"); + } + }else{ + cfg.setEditorId(cfg.getCurrentUser().getId()); + cfg.setEditTime(new Date()); + try { + appCfgService.updateAppCfg(cfg); + } catch (Exception e) { + e.printStackTrace(); + logger.error("配置保存失败!"+e.getMessage()); + addMessage(model,"保存失败!"); + } + } + model.addAttribute("serviceId",serviceId); + model.addAttribute("action",cfg.getAction()); + addMessage(model,"保存成功,正在为您跳转页面..."); + }else{ + logger.error("所选协议信息无效!"); + addMessage(model,"保存失败!"); + } + + } + return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+cfg.getServiceId()+"&action="+cfg.getAction()+"&cfgName="+cfgName); + } + + /** + * + * auditAppCfg(审核IP配置) + * (这里描述这个方法适用条件 – 可选) + * @return + *String + * @exception + * @since 1.0.0 + */ + @RequestMapping(value = {"auditCfg"}) + public String auditAppCfg(String cfgName,AppIdCfg cfg,Model model) { + model.addAttribute("cfgName", cfgName); + model.addAttribute("audit", Constants.AUDIT_PAGE); + if(cfg==null){ + logger.error("无法审核空的配置!"); + }else{ + int audit=appCfgService.getIsAudit(cfg.getCfgId()); + if(audit==Constants.AUDIT_YES&&cfg.getIsAudit()!=Constants.AUDIT_NOT_YES){ + logger.error("审核通过的配置只能取消审核通过!"); + }else{ + cfg.setAuditorId(cfg.getCurrentUser().getId()); + cfg.setAuditTime(new Date()); + + if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0 + cfg.setIsValid(Constants.VALID_NO); + }else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1 + cfg.setIsValid(Constants.VALID_YES); + } + int result=appCfgService.auditAppCfg(cfg); + model.addAttribute("serviceId", cfg.getServiceId()); + model.addAttribute("action", cfg.getAction()); + } + } + return "redirect:" + adminPath + "/cfg/app/list"; + } + /** + * + * auditAppCfg(删除IP配置,逻辑删除) + * (这里描述这个方法适用条件 – 可选) + * @return + *String + * @exception + * @since 1.0.0 + */ + @RequestMapping(value = {"deleteCfg"}) + public String deleteAppCfg(int action,long cfgId,String cfgName,Integer serviceId,Model model) { + model.addAttribute("serviceId", serviceId); + model.addAttribute("cfgName", cfgName); + model.addAttribute("action", action); + model.addAttribute("cfgType","complex"); + model.addAttribute("audit", Constants.CFG_PAGE); + int audit=appCfgService.getIsAudit(cfgId); + //未审核时可删除 + if(audit!=Constants.AUDIT_YES){ + AppIdCfg cfg=new AppIdCfg(); + cfg.setCfgId(cfgId); + cfg.setEditorId(cfg.getCurrentUser().getId()); + cfg.setEditTime(new Date()); + cfg.setIsValid(Constants.VALID_DEL); + int result=appCfgService.deleteAppCfg(cfg); + addMessage(model,"删除成功,正在为您跳转页面..."); + }else{ + logger.error("通过审核的配置不能删除!"); + } + return "/cfg/resultPage"; + } + /** + * + * getCompileId(获取编译ID) + * (这里描述这个方法适用条件 – 可选) + * @return + *long + * @exception + * @since 1.0.0 + */ + protected Integer getCompileId(BaseCfg cfg){ + return 0; + } } diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java index b5e4bdb38..9fe92589f 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.java @@ -1,11 +1,41 @@ package com.nis.web.dao.configuration; +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.nis.domain.configuration.AppIdCfg; +import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex; +import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.ComplexkeywordCfg; +import com.nis.web.dao.CrudDao; +import com.nis.web.dao.MyBatisDao; + /** * 特定协议相关配置数据处理类 * @author dell * */ -public class AppCfgDao { - +@MyBatisDao +public interface AppCfgDao extends CrudDao { + public AppIdCfg getById(@Param("cfgId")Long id) ; + public AppIdCfg get(AppIdCfg entity) ; + public List findList(AppIdCfg entity) ; + public int insert(AppIdCfg entity) ; + public int updateByPrimaryKeySelective(AppIdCfg entity) ; + public int updateValid(AppIdCfg entity) ; + public int audit(AppIdCfg entity) ; +// public int getIsValid(@Param("tableName")String tableName,@Param("cfgId")Long id); + public int getIsValid(@Param("cfgId")Long id); +// public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id); + public int getIsAudit(@Param("cfgId")Long id); + public List getComplexkeywordCfgList(); + public List getFeaturesTableListByAppCompileId(@Param("appCompileId")Integer appCompileId) ; + public List getFeaturesCfgListByCompileId(@Param("compileId")Integer compileId) ; + public int insertFeatures(AppFeaturesIndex entity) ; + public int updateFeaturesByAppId(AppFeaturesIndex entity) ; + public int deleteFeaturesByAppId(AppFeaturesIndex entity) ; + public List getComplexkeywordFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId); + public List getStrFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId); } diff --git a/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml new file mode 100644 index 000000000..5264a2e00 --- /dev/null +++ b/src/main/java/com/nis/web/dao/configuration/AppCfgDao.xml @@ -0,0 +1,562 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CFG_ID, 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,AREA_EFFECTIVE_IDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN + + + + CFG_ID, CFG_DESC,DISTRICT, 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,AREA_EFFECTIVE_IDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN + + + + CFG_ID, CFG_DESC,APP_NAME, APP_ID,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 + + + + + + ${page.alias}.CFG_ID as cfgId, ${page.alias}.CFG_DESC as cfgDesc,${page.alias}.APP_NAME as appName, ${page.alias}.APP_ID as appId, ${page.alias}.ACTION as action,${page.alias}.IS_VALID as isValid,${page.alias}.IS_AUDIT as isAudit, + ${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime, + ${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify, + ${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable, + ${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds + + + r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc,r.APP_NAME as appName, r.APP_ID as appId, r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit, + r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime, + r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify, + r.ATTRIBUTE AS attribute,r.LABLE AS lable, + r.AREA_EFFECTIVE_IDS AS areaEffectiveIds + + + + + CFG_DESC,APP_NAME,APP_ID, 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 + + + #{cfgDesc,jdbcType=VARCHAR},#{appName,jdbcType=VARCHAR},#{appId,jdbcType=INTEGER},#{action,jdbcType=INTEGER}, + #{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{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} + + + + + + + + SELECT LAST_INSERT_ID() + + insert into app_id_cfg ( + + )values ( + + ) + + + update app_id_cfg + + + + cfg_desc = #{cfgDesc,jdbcType=VARCHAR}, + + + APP_NAME = #{appName,jdbcType=VARCHAR}, + + + APP_ID = #{appId,jdbcType=BIGINT}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + creator_id = #{creatorId,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + auditor_id = #{auditorId,jdbcType=INTEGER}, + + + audit_time = #{auditTime,jdbcType=TIMESTAMP}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + compile_id = #{compileId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + + where cfg_id = #{cfgId,jdbcType=BIGINT} + + + + update app_id_cfg set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT} + + + update app_id_cfg set is_audit = #{isAudit,jdbcType=INTEGER}, auditor_id = #{auditorId,jdbcType=INTEGER}, audit_time = #{auditTime,jdbcType=TIMESTAMP} + + ,is_valid = #{isValid,jdbcType=INTEGER} + + where cfg_id = #{cfgId,jdbcType=BIGINT} + + + + + + + + + + + + insert into app_features_index (INDEX_ID,APP_COMPILE_ID,FEATURES_TABLE,FEATURES_COMPILE_ID,FEATURES_TABLE_TYPE) + values + (#{indexId,jdbcType=BIGINT},#{appCompileId,jdbcType=INTEGER},#{featuresTable,jdbcType=VARCHAR}, + #{featuresCompileId,jdbcType=INTEGER},#{featuresTableType,jdbcType=INTEGER} + ) + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/AppCfgService.java b/src/main/java/com/nis/web/service/configuration/AppCfgService.java index 20577d6a9..afff26429 100644 --- a/src/main/java/com/nis/web/service/configuration/AppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppCfgService.java @@ -1,6 +1,28 @@ package com.nis.web.service.configuration; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +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.ServiceConfigInfo; +import com.nis.domain.configuration.AppIdCfg; +import com.nis.domain.configuration.BaseStringCfg; +import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex; +import com.nis.domain.configuration.ComplexkeywordCfg; +import com.nis.main.ConvertTool; +import com.nis.util.StringUtil; +import com.nis.web.dao.configuration.AppCfgDao; +import com.nis.web.dao.configuration.ComplexStringCfgDao; +import com.nis.web.dao.configuration.StringCfgDao; +import com.nis.web.dao.systemService.ServiceConfigInfoDao; +import com.nis.web.service.CrudService; + /** * 特定协议相关配置事务类 @@ -8,6 +30,296 @@ import org.springframework.stereotype.Service; * */ @Service -public class AppCfgService { - +public class AppCfgService extends CrudService { + @Autowired + protected AppCfgDao appCfgDao; + @Autowired + protected ServiceConfigInfoDao serviceConfigInfoDao; + @Autowired + protected StringCfgDao stringCfgDao; + @Autowired + protected ComplexStringCfgDao complexStringCfgDao; + + public Page findPage(Page page, AppIdCfg entity) { + entity.setPage(page); + List list = dao.findList(entity); + page.setList(list); + return page; + } + public AppIdCfg findAppIdCfg(AppIdCfg entity) { + //查询协议关联特征表 + List featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(entity.getCompileId()); + List complexList = new ArrayList(); + List strList = new ArrayList(); + if(!StringUtil.isEmpty(featuresTableList)){ + for(AppFeaturesIndex features:featuresTableList){ + if(features.getFeaturesTableType().equals(4)){//增强字符串特征配置 + List complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId( + features.getFeaturesTable(),features.getFeaturesCompileId()); + complexList.addAll(complexFeaturesList); + + + }else if(features.getFeaturesTableType().equals(2)){//普通字符串特征配置 + List strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId( + features.getFeaturesTable(),features.getFeaturesCompileId()); + strList.addAll(strFeaturesCfgList); + } + } + } + entity.setComplexFeaturesList(complexList); + entity.setStrFeaturesCfgList(strList); + return entity; + } + /** + * + * addAppCfg(新增IP类配置) + * (继承AppIdCfg这个类方可使用) + * @param cfg + * @return + *int + * @throws Exception + * @exception + * @since 1.0.0 + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public int addAppCfg(AppIdCfg cfg) throws Exception{ + //通过配置转换工具获取compileId + Integer appCompileId = 0; + int cfgId = 0; + appCompileId = new ConvertTool().getCompileId(); + cfg.setCompileId(appCompileId); + cfgId = appCfgDao.insert(cfg); + if(cfg.getComplexFeaturesList()!=null){ + for(ComplexkeywordCfg c:cfg.getComplexFeaturesList()){ + Integer featuresCompileId = new ConvertTool().getCompileId(); + AppFeaturesIndex f = new AppFeaturesIndex(); + f.setAppCompileId(cfg.getCompileId()); + f.setFeaturesCompileId(featuresCompileId); + f.setFeaturesTableType(4); + f.setFeaturesTable(c.getTableName()); + appCfgDao.insertFeatures(f); + + c.setTableName(c.getTableName()); +// c.initDefaultValue(); + c.setAction(cfg.getAction()); + c.setServiceId(cfg.getServiceId()); + c.setCompileId(featuresCompileId); + c.setCreateTime(cfg.getCreateTime()); + c.setCreatorId(cfg.getCreatorId()); + c.setIsAudit(cfg.getIsAudit()); + c.setIsValid(cfg.getIsValid()); + c.setIsAreaEffective(cfg.getIsAreaEffective()); + c.setAreaEffectiveIds(cfg.getAreaEffectiveIds()); + c.setAttribute(cfg.getAttribute()); + c.setLable(cfg.getLable()); + c.setClassify(cfg.getClassify()); + c.setRequestId(cfg.getRequestId()); + c.setCfgDesc(cfg.getCfgDesc()); + complexStringCfgDao.insert(c); + } + } + if(cfg.getStrFeaturesCfgList()!=null){ + for(BaseStringCfg s:cfg.getStrFeaturesCfgList()){ + Integer featuresCompileId = new ConvertTool().getCompileId(); + AppFeaturesIndex f = new AppFeaturesIndex(); + f.setAppCompileId(cfg.getCompileId()); + f.setFeaturesCompileId(featuresCompileId); + f.setFeaturesTableType(2); + f.setFeaturesTable(s.getTableName()); + appCfgDao.insertFeatures(f); + s.setTableName(s.getTableName()); +// s.initDefaultValue(); + s.setAction(cfg.getAction()); + s.setServiceId(cfg.getServiceId()); + s.setCompileId(featuresCompileId); + s.setCreateTime(cfg.getCreateTime()); + s.setCreatorId(cfg.getCreatorId()); + s.setIsAudit(cfg.getIsAudit()); + s.setIsValid(cfg.getIsValid()); + s.setIsAreaEffective(cfg.getIsAreaEffective()); + s.setAreaEffectiveIds(cfg.getAreaEffectiveIds()); + s.setAttribute(cfg.getAttribute()); + s.setLable(cfg.getLable()); + s.setClassify(cfg.getClassify()); + s.setRequestId(cfg.getRequestId()); + s.setCfgDesc(cfg.getCfgDesc()); + stringCfgDao.insert(s); + } + } + return cfgId; + } + /** + * + * updateAppCfg(更新IP类配置) + * (继承AppIdCfg这个类方可使用) + * @param cfg + * @return + *int + * @throws Exception + * @exception + * @since 1.0.0 + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public int updateAppCfg(AppIdCfg cfg) throws Exception{ + if(cfg.getComplexFeaturesList()!=null){ + for(ComplexkeywordCfg c:cfg.getComplexFeaturesList()){ + Integer featuresCompileId = 0; + c.setIsAreaEffective(cfg.getIsAreaEffective()); + c.setAreaEffectiveIds(cfg.getAreaEffectiveIds()); + c.setAttribute(cfg.getAttribute()); + c.setLable(cfg.getLable()); + c.setClassify(cfg.getClassify()); + c.setRequestId(cfg.getRequestId()); + c.setCfgDesc(cfg.getCfgDesc()); + c.setEditorId(cfg.getEditorId()); + c.setEditTime(cfg.getEditTime()); + if(c.getCompileId()==null){ + featuresCompileId = new ConvertTool().getCompileId(); + AppFeaturesIndex f = new AppFeaturesIndex(); + f.setAppCompileId(cfg.getCompileId()); + f.setFeaturesCompileId(featuresCompileId); + f.setFeaturesTableType(4); + f.setFeaturesTable(c.getTableName()); + appCfgDao.insertFeatures(f); + c.setTableName(c.getTableName()); + c.setAction(cfg.getAction()); + c.setServiceId(cfg.getServiceId()); + c.setCompileId(featuresCompileId); + c.setCreateTime(new Date()); + c.setCreatorId(cfg.getCurrentUser().getId()); + c.setIsAudit(cfg.getIsAudit()); + c.setIsValid(cfg.getIsValid()); + complexStringCfgDao.insert(c); + }else{ + complexStringCfgDao.update(c); + } + + + } + } + if(cfg.getStrFeaturesCfgList()!=null){ + for(BaseStringCfg s:cfg.getStrFeaturesCfgList()){ + Integer featuresCompileId = 0; + s.setIsAreaEffective(cfg.getIsAreaEffective()); + s.setAreaEffectiveIds(cfg.getAreaEffectiveIds()); + s.setAttribute(cfg.getAttribute()); + s.setLable(cfg.getLable()); + s.setClassify(cfg.getClassify()); + s.setRequestId(cfg.getRequestId()); + s.setCfgDesc(cfg.getCfgDesc()); + s.setEditorId(cfg.getEditorId()); + s.setEditTime(cfg.getEditTime()); + if(s.getCompileId()==null){ + featuresCompileId = new ConvertTool().getCompileId(); + AppFeaturesIndex f = new AppFeaturesIndex(); + f.setAppCompileId(cfg.getCompileId()); + f.setFeaturesCompileId(featuresCompileId); + f.setFeaturesTableType(2); + f.setFeaturesTable(s.getTableName()); + appCfgDao.insertFeatures(f); + s.setTableName(s.getTableName()); + s.setAction(cfg.getAction()); + s.setServiceId(cfg.getServiceId()); + s.setCompileId(featuresCompileId); + s.setCreateTime(new Date()); + s.setCreatorId(cfg.getCurrentUser().getId()); + s.setIsAudit(cfg.getIsAudit()); + s.setIsValid(cfg.getIsValid()); + stringCfgDao.insert(s); + }else{ + stringCfgDao.update(s); + } + + } + } + return appCfgDao.updateByPrimaryKeySelective(cfg); + } + /** + * + * auditAppCfg(审核IP类配置) + * (继承AppIdCfg这个类方可使用) + * @param cfg + * @return + *int + * @exception + * @since 1.0.0 + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public int auditAppCfg(AppIdCfg cfg){ + return appCfgDao.audit(cfg); + } + /** + * + * deleteAppCfg(删除IP类配置) + * (继承AppIdCfg这个类方可使用) + * @param cfg + * @return + *int + * @exception + * @since 1.0.0 + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public int deleteAppCfg(AppIdCfg cfg){ + return appCfgDao.updateValid(cfg); + } + /** + * + * getAppCfg(根据IP与类名获取IP配置) + * (继承AppIdCfg这个类方可使用) + * @param id + * @return + *AppIdCfg + * @exception + * @since 1.0.0 + */ + public AppIdCfg getAppCfgById(long id){ + return appCfgDao.getById(id); + } + /** + * + * getAppCfg(根据IP与类名获取IP配置) + * (继承AppIdCfg这个类方可使用) + * @param id + * @return + *AppIdCfg + * @exception + * @since 1.0.0 + */ + public AppIdCfg getAppCfgById(AppIdCfg cfg){ + cfg = appCfgDao.get(cfg); + List featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(cfg.getCompileId()); + List complexList = new ArrayList(); + List strList = new ArrayList(); + if(!StringUtil.isEmpty(featuresTableList)){ + for(AppFeaturesIndex features:featuresTableList){ + if(features.getFeaturesTableType().equals(4)){//增强字符串特征配置 + List complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId( + features.getFeaturesTable(),features.getFeaturesCompileId()); + complexList.addAll(complexFeaturesList); + + + }else if(features.getFeaturesTableType().equals(2)){//普通字符串特征配置 + List strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId( + features.getFeaturesTable(),features.getFeaturesCompileId()); + strList.addAll(strFeaturesCfgList); + } + } + + } + cfg.setComplexFeaturesList(complexList); + cfg.setStrFeaturesCfgList(strList); + return cfg; + } + public Integer getIsValid(Long cfgId){ + return appCfgDao.getIsValid(cfgId); + } + /*public Integer getIsValid(String tableName, long id){ + return appCfgDao.getIsValid(tableName,id); + }*/ + public Integer getIsAudit(Long cfgId){ + return appCfgDao.getIsAudit(cfgId); + } + /*public Integer getIsAudit(String tableName, long id){ + return appCfgDao.getIsAudit(tableName,id); + }*/ } diff --git a/src/main/webapp/WEB-INF/tlds/fns.tld b/src/main/webapp/WEB-INF/tlds/fns.tld index d0dc8fae7..9f47325c8 100644 --- a/src/main/webapp/WEB-INF/tlds/fns.tld +++ b/src/main/webapp/WEB-INF/tlds/fns.tld @@ -268,7 +268,13 @@ ${fns:getDictListJson(dictKey)} - + + 获取特征域字典对象列表 + getFeaturesDictData + com.nis.util.DictUtils + java.lang.String getFeaturesDictData(java.lang.String) + ${fns:getFeaturesDictData(itemCode)} + diff --git a/src/main/webapp/WEB-INF/views/cfg/appCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/appCfgForm.jsp new file mode 100644 index 000000000..a762ff797 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/appCfgForm.jsp @@ -0,0 +1,302 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + + +
+ +

+ +

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

+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ + + <%-- --%> +
+
+
+
+
+
+ +
+ +
+
+
+ + + + + +

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

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

+ + +

+ +
+
+
+
+
+ + + + + + + + + + +
+
+ + + + + + + + +
+
+ + + + + ${app.specServiceName} + + + +
+ <%--
+ + +
--%> + <%-- --%> + <%--
+ + +
--%> +
+ + + +
+ +
+ + + +
+
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+ +
+
+ + " 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});"/> + +
+
+
+ + +
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + <%-- --%> + + + + + <%-- --%> + + + + + + + + + + + + +
${cfg.cfgDesc }${cfg.appId }${cfg.appName } + + + + + + + + + + + ${cfg.serviceId }${cfg.requestName }${cfg.compileId } + + + + + + + ${fl.itemValue}, + + + + ${classifyName[status]} + + + + ${xz.itemValue}, + + + + + + ${lable.itemValue}, + + + ${cfg.areaEffectiveIds } + + + + + + + + + + + ${cfg.creatorName }${cfg.editorName }${cfg.auditorName } +
+ + +
+
+
${page}
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/appFeaturesCfg.jsp b/src/main/webapp/WEB-INF/views/cfg/appFeaturesCfg.jsp new file mode 100644 index 000000000..263c51658 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/appFeaturesCfg.jsp @@ -0,0 +1,226 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + + +
+ +

+ +

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

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

+ + + +
+
+
+ +
+ + <%-- --%> +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+ + +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+ +
+ + + + + + + + +
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file