增加主题网站配置

This commit is contained in:
zhanghongqing
2018-08-23 17:07:09 +08:00
parent c5e372f4d0
commit cc8b3f566a
9 changed files with 1593 additions and 3 deletions

View File

@@ -0,0 +1,153 @@
/**
*@Title: BaseStringConfig.java
*@Package com.nis.domain.restful
*@Description TODO
*@author dell
*@date 2018年2月5日 下午5:26:02
*@version 版本号
*/
package com.nis.domain.configuration;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
/**
* @Description: 主题网站配置
* @author (dell)
* @date 2018年2月5日 下午5:26:02
* @version V1.0
*/
public class AppTopicDomainCfg extends BaseCfg<AppTopicDomainCfg> {
private static final long serialVersionUID = -442502179959427340L;
private static final String tableName="app_topic_domain_cfg";
@Expose
private Integer compileId;
@Expose
private Integer ratelimit;
// private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
private String domain;
private String cfgKeywords;
private String appName;
private Integer topic;
@Expose
@ExcelField(title="expression_type")
@SerializedName("exprType")
protected Integer exprType ;
@Expose
@ExcelField(title="match_method")
@SerializedName("matchMethod")
protected Integer matchMethod ;
@Expose
@ExcelField(title="whether_hexbinary")
@SerializedName("isHexbin")
protected Integer isHexbin;
public Integer getTopic() {
return topic;
}
public void setTopic(Integer topic) {
this.topic = topic;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
public Integer getMatchMethod() {
return matchMethod;
}
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getIsHexbin() {
return isHexbin;
}
public void setIsHexbin(Integer isHexbin) {
this.isHexbin = isHexbin;
}
@Override
public void initDefaultValue() {
super.initDefaultValue();
this.isHexbin = 0;
this.doLog = 0;//app特征域不记录日志
}
public Integer getCompileId() {
return compileId;
}
public void setCompileId(Integer compileId) {
this.compileId = compileId;
}
public static String getTablename() {
return tableName;
}
public Integer getRatelimit() {
return ratelimit;
}
public void setRatelimit(Integer ratelimit) {
this.ratelimit = ratelimit;
}
// public Integer getAppCode() {
// return appCode;
// }
// public void setAppCode(Integer appCode) {
// this.appCode = appCode;
// }
public Integer getSpecServiceId() {
return specServiceId;
}
public void setSpecServiceId(Integer specServiceId) {
this.specServiceId = specServiceId;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public Integer getBehavCode() {
return behavCode;
}
public void setBehavCode(Integer behavCode) {
this.behavCode = behavCode;
}
}

View File

@@ -24,9 +24,11 @@ import com.nis.domain.configuration.AppHttpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AppSslCertCfg;
import com.nis.domain.configuration.AppTopicDomainCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
@@ -864,4 +866,141 @@ public class AppCfgController extends BaseController {
appCfgService.updateAppHeaderCfgValid(isValid,ids,functionId);
return "redirect:" + adminPath +"/app/headerCfgList?functionId="+functionId;
}
/**
* 主题网站配置列表
* @param model
* @param cfg
* @param request
* @param response
* @return
*/
@RequestMapping(value = {"topicDomainCfgList"})
public String TopicDomainCfgList(Model model,@ModelAttribute("cfg")AppTopicDomainCfg cfg,HttpServletRequest request,HttpServletResponse response) {
Page<AppTopicDomainCfg> searchPage=new Page<AppTopicDomainCfg>(request,response,"r");
Page<AppTopicDomainCfg> page = appCfgService.findAppTopicDomainList(searchPage, cfg);
// for(AppDomainCfg entity:page.getList()){
// SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
// entity.setAppName(app.getSpecServiceName());
// }
model.addAttribute("page", page);
initPageCondition(model,cfg);
return "/cfg/app/appTopicDomainCfgList";
}
/**
* app主题网站配置表单
* @param model
* @param ids
* @param entity
* @return
*/
@RequestMapping(value = {"topicDomainCfgForm"})
@RequiresPermissions(value={"app:topic:config"})
public String topicDomainCfgForm(Model model,String ids,AppTopicDomainCfg entity) {
if(StringUtils.isNotBlank(ids)){
entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(ids));
initUpdateFormCondition(model,entity);
}else{
initFormCondition(model,entity);
}
model.addAttribute("_cfg", entity);
return "/cfg/app/appTopicDomainCfgForm";
}
/**
* app主题网站配置新增修改
* @param model
* @param request
* @param response
* @param entity
* @param redirectAttributes
* @return
*/
@RequestMapping(value = {"saveAppTopicDomainCfg"})
@RequiresPermissions(value={"app:topic:config"})
public String saveAppTopicDomainCfg(Model model,HttpServletRequest request,HttpServletResponse response,
AppTopicDomainCfg entity,RedirectAttributes redirectAttributes) {
try {
// SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
// if(specificService!=null){
// entity.setAppCode(specificService.getSpecServiceCode());
// }
appCfgService.saveOrUpdateAppTopicDomainCfg(entity);
addMessage(redirectAttributes,"save_success");
} catch (Exception e) {
if(e instanceof MaatConvertException) {
e.printStackTrace();
logger.info("app主题网站配置下发失败"+e.getMessage());;
addMessage(redirectAttributes,"request_service_failed");
}else {
e.printStackTrace();
logger.error("app主题网站配置下发失败",e);
addMessage(redirectAttributes,"save_failed");
}
}
return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+entity.getFunctionId();
}
/**
* domain配置审核
* @param isAudit
* @param isValid
* @param ids
* @param functionId
* @param redirectAttributes
* @return
*/
@RequestMapping(value = {"auditAppTopicDomainCfg"})
// @RequiresPermissions(value={"app:domain:confirm"})
public String auditAppTopicDomainCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
AppTopicDomainCfg entity = new AppTopicDomainCfg();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appCfgService.auditAppTopicDomainCfg(entity,isAudit);
addMessage(redirectAttributes,"audit_success");
} catch (MaatConvertException e) {
if(e instanceof MaatConvertException) {
e.printStackTrace();
logger.info("app主题网站配置下发失败"+e.getMessage());;
addMessage(redirectAttributes,"request_service_failed");
}else {
e.printStackTrace();
logger.error("app主题网站配置下发失败",e);
addMessage(redirectAttributes,"audit_failed");
}
}
}
return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+functionId;
}
/**
* 网站主题配置删除
* @param isValid
* @param ids
* @param functionId
* @return
*/
@RequestMapping(value = {"updateAppTopicDomainCfgValid"})
@RequiresPermissions(value={"app:topic:config"})
public String updateAppTopicDomainCfgValid(Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) {
try {
appCfgService.updateAppTopicDomainCfgValid(isValid,ids,functionId);
addMessage(redirectAttributes,"delete_success");
} catch (Exception e) {
logger.error("app主题网站删除失败",e);
if(e instanceof MaatConvertException||e instanceof CallExternalProceduresException) {
e.printStackTrace();
addMessage(redirectAttributes,"request_service_failed");
}else {
e.printStackTrace();
addMessage(redirectAttributes,"delete_failed");
}
}
return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+functionId;
}
}

View File

@@ -17,6 +17,7 @@ import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AppSslCertCfg;
import com.nis.domain.configuration.AppStringCfg;
import com.nis.domain.configuration.AppTopicDomainCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.ComplexkeywordCfg;
@@ -57,6 +58,11 @@ public interface AppCfgDao {
public AppDomainCfg getAppDomainCfg(Long cfgId) ;
public int insertAppDomainCfg(AppDomainCfg entity);
public int updateAppDomainCfg(AppDomainCfg entity);
//app 主题网站配置增删改查
public List<AppTopicDomainCfg> findAppTopicDomainList(AppTopicDomainCfg entity) ;
public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId) ;
public int insertAppTopicDomainCfg(AppTopicDomainCfg entity);
public int updateAppTopicDomainCfg(AppTopicDomainCfg entity);
//app 字节特征增删改查
public List<AppByteCfg> findAppByteList(AppByteCfg entity) ;
public AppByteCfg getAppByteCfg(Long cfgId) ;

View File

@@ -137,6 +137,37 @@
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<resultMap id="AppTopicDomainCfgMap" type="com.nis.domain.configuration.AppTopicDomainCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="topic" property="topic" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
<result column="domain" property="domain" jdbcType="VARCHAR" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="INTEGER" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<resultMap id="AppByteCfgMap" type="com.nis.domain.configuration.AppByteCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
@@ -332,6 +363,14 @@
r.DOMAIN,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG
</sql>
<sql id="AppTopicDomainCfg_Column" >
r.CFG_ID, r.TOPIC,r.BEHAV_CODE,r.SPEC_SERVICE_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT,
r.CREATOR_ID,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.AREA_EFFECTIVE_IDS,r.RATELIMIT,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE,
r.DOMAIN,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG
</sql>
<sql id="AppByteCfg_Column" >
r.CFG_ID, r.APP_CODE,r.BEHAV_CODE,r.SPEC_SERVICE_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT,
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
@@ -358,6 +397,17 @@
#{areaEffectiveIds,jdbcType=VARCHAR},#{ratelimit,jdbcType=INTEGER},#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}
</sql>
<sql id="AppTopicCommonCfg_Value_List" >
#{topic,jdbcType=INTEGER},#{behavCode,jdbcType=INTEGER},#{specServiceId,jdbcType=INTEGER},
#{cfgDesc,jdbcType=VARCHAR},#{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},#{ratelimit,jdbcType=INTEGER},#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
@@ -438,6 +488,13 @@
FROM app_domain_cfg r
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
<!-- 主题网站 -->
<select id="getAppTopicDomainCfg" resultMap="AppTopicDomainCfgMap" parameterType="java.lang.Long" >
SELECT
<include refid="AppTopicDomainCfg_Column" />
FROM app_topic_domain_cfg r
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
<select id="getAppByteCfg" resultMap="AppByteCfgMap" parameterType="java.lang.Long" >
SELECT
<include refid="AppByteCfg_Column" />
@@ -923,6 +980,103 @@
</otherwise>
</choose>
</select>
<select id="findAppTopicDomainList" resultMap="AppTopicDomainCfgMap">
select
<include refid="AppTopicDomainCfg_Column"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
from app_topic_domain_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
left join request_info ri on r.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="functionId != null">
AND r.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="specServiceId != null">
AND r.spec_service_id=#{specServiceId,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="domain != null and domain != ''">
AND r.DOMAIN like concat(concat('%',#{domain,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime != ''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName != ''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime != ''">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime != ''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY CFG_ID desc
</otherwise>
</choose>
</select>
<select id="findAppByteList" resultMap="AppByteCfgMap">
select
<include refid="AppByteCfg_Column"/>
@@ -1383,6 +1537,23 @@
#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
)
</insert>
<!-- 主题网站新增 -->
<insert id="insertAppTopicDomainCfg" parameterType="com.nis.domain.configuration.AppTopicDomainCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into app_topic_domain_cfg (
TOPIC,BEHAV_CODE,SPEC_SERVICE_ID,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,RATELIMIT,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE,
DOMAIN,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG
)values (
<include refid="AppTopicCommonCfg_Value_List" />,
#{domain,jdbcType=VARCHAR},#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
)
</insert>
<insert id="insertAppByteCfg" parameterType="com.nis.domain.configuration.AppByteCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
@@ -1933,6 +2104,106 @@
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 主题网站 -->
<update id="updateAppTopicDomainCfg" parameterType="com.nis.domain.configuration.AppTopicDomainCfg" >
update app_topic_domain_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="topic != null">
TOPIC = #{topic,jdbcType=INTEGER},
</if>
<if test="behavCode != null">
BEHAV_CODE = #{behavCode,jdbcType=INTEGER},
</if>
<if test="specServiceId != null">
SPEC_SERVICE_ID = #{specServiceId,jdbcType=INTEGER},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="compileId != null" >
compile_id = #{compileId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="ratelimit != null">
RATELIMIT=#{ratelimit,jdbcType=INTEGER},
</if>
<if test="cfgRegionCode != null">
CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="cfgType != null and cfgType != ''">
CFG_TYPE =#{cfgType,jdbcType=VARCHAR},
</if>
<if test="domain != null and domain != ''">
domain=#{domain,jdbcType=VARCHAR},
</if>
<if test="exprType != null">
expr_type=#{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null">
match_method=#{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null">
is_hexbin=#{isHexbin,jdbcType=INTEGER},
</if>
<!-- <if test="doLog != null" >
do_log = #{doLog,jdbcType=INTEGER},
</if> -->
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<update id="updateAppByteCfg" parameterType="com.nis.domain.configuration.AppByteCfg" >
update app_byte_cfg
<set >

View File

@@ -18,6 +18,7 @@ import com.nis.domain.configuration.AppHttpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AppSslCertCfg;
import com.nis.domain.configuration.AppTopicDomainCfg;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
@@ -85,6 +86,14 @@ public class AppCfgService extends BaseService {
page.setList(list);
return page;
}
//主题网站列表
public Page<AppTopicDomainCfg> findAppTopicDomainList(Page<AppTopicDomainCfg> page, AppTopicDomainCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
List<AppTopicDomainCfg> list = appCfgDao.findAppTopicDomainList(entity);
page.setList(list);
return page;
}
public Page<AppByteCfg> findAppByteList(Page<AppByteCfg> page, AppByteCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
@@ -122,6 +131,10 @@ public class AppCfgService extends BaseService {
public AppDomainCfg getAppDomainCfg(Long cfgId){
return appCfgDao.getAppDomainCfg(cfgId);
}
//主题网站form
public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId){
return appCfgDao.getAppTopicDomainCfg(cfgId);
}
public AppByteCfg getAppByteCfg(Long cfgId){
return appCfgDao.getAppByteCfg(cfgId);
}
@@ -397,6 +410,62 @@ public class AppCfgService extends BaseService {
}
}
}
//主题网站新增 修改
public void saveOrUpdateAppTopicDomainCfg(AppTopicDomainCfg entity) throws Exception{
//设置区域运营商信息
setAreaEffectiveIds(entity);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
List<Integer> 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());
entity.setIsValid(0);
entity.setIsAudit(0);
appCfgDao.insertAppTopicDomainCfg(entity);
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
}else{
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
entity.setIsValid(0);
entity.setIsAudit(0);
appCfgDao.updateAppTopicDomainCfg(entity);
//删除旧的区域IP新增新的区域IP
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAppByteCfg(AppByteCfg entity) throws Exception{
//设置区域运营商信息
@@ -910,6 +979,98 @@ public class AppCfgService extends BaseService {
logger.info("app域名配置取消配置响应信息"+result.getMsg());
}
}
//app主题网站配置审核
public void auditAppTopicDomainCfg(AppTopicDomainCfg entity,Integer isAudit){
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
entity.setTableName(AppTopicDomainCfg.getTablename());
appCfgDao.auditCfg(entity);
//域名为关键字
if(isAudit==1){
entity.setCfgKeywords(entity.getDomain());
List<AppTopicDomainCfg> list = new ArrayList();
list.add(entity);
Map<String,List> map = cfgConvert(strRegionList,list,2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
appCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> 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());
//设置APP自定义域
// String userRegion = "APP_ID="+entity.getAppCode()+Constants.USER_REGION_SPLIT+
// "DOMAIN_ID="+entity.getCompileId()+Constants.USER_REGION_SPLIT+
// "DOMAIN_STR="+keywordsEscape(entity.getDomain());
//
// 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("app主题网站配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("app主题网站配置下发响应信息"+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("app主题网站配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("app主题网站配置取消配置响应信息"+result.getMsg());
}
}
public void auditAppByteCfg(AppByteCfg entity,Integer isAudit){
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
@@ -1176,6 +1337,30 @@ public class AppCfgService extends BaseService {
}
}
//主题网站配置删除
public void updateAppTopicDomainCfgValid(Integer isValid,String ids,Integer functionId){
AppTopicDomainCfg entity = new AppTopicDomainCfg();
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(AppTopicDomainCfg.getTablename());
entity.setFunctionId(functionId);
appCfgDao.updateCfgValid(entity);
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
appCfgDao.updateCfgValid(cfg);
}
}
}
public void updateAppByteCfgValid(Integer isValid,String ids,Integer functionId){
AppByteCfg entity = new AppByteCfg();
String[] idArray = ids.split(",");