Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop

This commit is contained in:
duandongmei
2018-07-24 15:17:18 +08:00
44 changed files with 1239 additions and 179 deletions

View File

@@ -35,7 +35,20 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
private Integer specServiceId;
private String appName;
private String behavName;
private String cfgKeywords;
private String userRegion1;
private String userRegion2;
private String userRegion3;
private String userRegion4;
private String userRegion5;
public String getBehavName() {
return behavName;
}
public void setBehavName(String behavName) {
this.behavName = behavName;
}
@Expose
@ExcelField(title="expression_type")
@@ -155,5 +168,45 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
public void setIpPort(IpPortCfg ipPort) {
this.ipPort = ipPort;
}
public String getUserRegion1() {
return userRegion1;
}
public void setUserRegion1(String userRegion1) {
this.userRegion1 = userRegion1;
}
public String getUserRegion2() {
return userRegion2;
}
public void setUserRegion2(String userRegion2) {
this.userRegion2 = userRegion2;
}
public String getUserRegion3() {
return userRegion3;
}
public void setUserRegion3(String userRegion3) {
this.userRegion3 = userRegion3;
}
public String getUserRegion4() {
return userRegion4;
}
public void setUserRegion4(String userRegion4) {
this.userRegion4 = userRegion4;
}
public String getUserRegion5() {
return userRegion5;
}
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
}

View File

@@ -25,11 +25,17 @@ public class SpecificServiceCfg extends BaseEntity<SpecificServiceCfg>{
private SpecificServiceCfg parent; //parent_id 父节点id int N 0表示一级节点
private Integer isLeaf; //is_leaf 是否是叶子节点 int N 0否1是只有一级填0
private Integer groupId; //group_id maat端配置分组id int N 缺省0表示未与maat分组同步
private Integer cfgType;//配置类型1app;2,加密隧道协议
private Date beginDate; // 开始日期
private Date endDate; // 结束日期
private String showSequence; //显示序号
public Integer getCfgType() {
return cfgType;
}
public void setCfgType(Integer cfgType) {
this.cfgType = cfgType;
}
public Integer getSpecServiceId() {
return specServiceId;
}

View File

@@ -16,17 +16,17 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.ServiceConfigInfo;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.configuration.AppByteCfg;
import com.nis.domain.configuration.AppDomainCfg;
import com.nis.domain.configuration.AppHttpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -54,6 +54,28 @@ public class AppCfgController extends BaseController {
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
entity.setAppName(app.getSpecServiceName());
}
//查找社交应用的所有有效二级特定服务
SpecificServiceCfg second=new SpecificServiceCfg();
for(SysDataDictionaryItem dict:DictUtils.getDictList("SPECIFIC_SERVICE_CFG_TYPE")) {
if(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP.equals(dict.getItemValue())) {
second.setCfgType(Integer.parseInt(dict.getItemCode()));
break;
}
}
second.setIsValid(Constants.VALID_YES);
second.setIsLeaf(1);
List<SpecificServiceCfg> secondList=specificServiceCfgService.findAllSpecificServiceCfg(second, null);
//遍历,找到匹配项后将行为设置进去
for(SpecificServiceCfg secondCfg:secondList) {
if(secondCfg.getSpecServiceCode()==null) continue;
for(AppPolicyCfg entity:page.getList()){
if(entity.getBehavCode()==null) continue;
if(secondCfg.getSpecServiceCode().intValue()==entity.getBehavCode().intValue()) {
entity.setBehavName(secondCfg.getSpecServiceName());
break;
}
}
}
model.addAttribute("page", page);
initPageCondition(model,cfg);
return "/cfg/app/appPolicyCfgList";

View File

@@ -0,0 +1,79 @@
package com.nis.web.controller.log.ntc;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.client.ClientProtocolException;
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.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.PageLog;
import com.nis.domain.log.MmVoipLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping(value = "${adminPath}/log/ntc/mmAvVoipAccountLogs")
public class MmVoipAccountLogController extends BaseController{
/**
* @param model
* @param entry
* @param request
* @param response
* @return
* @throws ClientProtocolException
* @throws IOException
*/
@RequestMapping(value={"list",""})
public String list(Model model,@ModelAttribute("log")MmVoipLog entry,HttpServletRequest request, HttpServletResponse response) throws ClientProtocolException, IOException {
try {
PageLog<MmVoipLog> page = new PageLog<MmVoipLog>(request, response);
Map<String, Object> params=new HashMap<>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
//查询值判断
initLogSearchValue(entry,params);
String url = "";
url = Constants.LOG_BASE_URL+Constants.NTC_MMVOIP_ACCOUNT_LOG;
String jsonString = HttpClientUtil.getMsg(url,params,request);
Gson gson = new GsonBuilder().create();
//gson泛型支持
LogRecvData<MmVoipLog> fromJson = gson.fromJson(jsonString, new TypeToken<LogRecvData<MmVoipLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<MmVoipLog> data = fromJson.getData();
page.setList(data.getList());
List<MmVoipLog> list = page.getList();
for (MmVoipLog l : list) {
l.setFunctionId(entry.getFunctionId());
setLogAction(l);
}
model.addAttribute("page", page);
logger.info("查询mmVoipAccount日志成功");
}
} catch (Exception e) {
logger.info("查询mmVoipAccount日志失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/mmVoipAccountList";
}
}

View File

@@ -0,0 +1,79 @@
package com.nis.web.controller.log.ntc;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.client.ClientProtocolException;
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.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.PageLog;
import com.nis.domain.log.MmVoipLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping(value = "${adminPath}/log/ntc/mmVoipIpLogs")
public class MmVoipIpLogController extends BaseController{
/**
* @param model
* @param entry
* @param request
* @param response
* @return
* @throws ClientProtocolException
* @throws IOException
*/
@RequestMapping(value={"list",""})
public String list(Model model,@ModelAttribute("log")MmVoipLog entry,HttpServletRequest request, HttpServletResponse response) throws ClientProtocolException, IOException {
try {
PageLog<MmVoipLog> page = new PageLog<MmVoipLog>(request, response);
Map<String, Object> params=new HashMap<>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
//查询值判断
initLogSearchValue(entry,params);
String url = "";
url = Constants.LOG_BASE_URL+Constants.NTC_MMVOIP_IP_LOG;
String jsonString = HttpClientUtil.getMsg(url,params,request);
Gson gson = new GsonBuilder().create();
//gson泛型支持
LogRecvData<MmVoipLog> fromJson = gson.fromJson(jsonString, new TypeToken<LogRecvData<MmVoipLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<MmVoipLog> data = fromJson.getData();
page.setList(data.getList());
List<MmVoipLog> list = page.getList();
for (MmVoipLog l : list) {
l.setFunctionId(entry.getFunctionId());
setLogAction(l);
}
model.addAttribute("page", page);
logger.info("查询VoipIp日志成功");
}
} catch (Exception e) {
logger.info("查询VoipIp日志失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/mmVoipIpList";
}
}

View File

@@ -190,7 +190,7 @@ public class SpecificServiceCfgController extends BaseController {
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
@RequestParam(required=false)boolean isLeafShow,HttpServletResponse response){
@RequestParam(required=false)boolean isLeafShow,@RequestParam(required=true)Integer cfgType,HttpServletResponse response){
List<Map<String, Object>> mapList = Lists.newArrayList();
Map<String, Object> map2 = Maps.newHashMap();
map2.put("id", 0);
@@ -203,7 +203,7 @@ public class SpecificServiceCfgController extends BaseController {
SpecificServiceCfg specificServiceCfg = list.get(i);
if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
if(specificServiceCfg.getIsValid().equals(0)||
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))){
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||specificServiceCfg.getCfgType().intValue()!=cfgType){
continue;
}
Map<String, Object> map = Maps.newHashMap();
@@ -215,7 +215,26 @@ public class SpecificServiceCfgController extends BaseController {
}
return mapList;
}
/**
*
*/
@ResponseBody
@RequestMapping(value = "childrenList")
public List<Map<String, Object>> childrenList(@RequestParam(required=false)Integer parent,HttpServletResponse response){
List<Map<String, Object>> mapList = Lists.newArrayList();
List<SpecificServiceCfg> list = specificServiceCfgService.getChildrenById(parent);
for (int i=0; i<list.size(); i++){
Map<String, Object> map = Maps.newHashMap();
SpecificServiceCfg specificServiceCfg = list.get(i);
if(specificServiceCfg.getIsLeaf().equals(1)){
map.put("code", specificServiceCfg.getSpecServiceCode());
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName());
mapList.add(map);
}
}
return mapList;
}
/**
* 校验协议id是否重复
* @param specServiceId

View File

@@ -29,6 +29,11 @@
<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="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="AppIpCfgMap" type="com.nis.domain.configuration.AppIpCfg" >
@@ -229,7 +234,8 @@
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.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN
r.CFG_TYPE,r.CFG_REGION_CODE,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.USER_REGION1,r.USER_REGION2,
r.USER_REGION3,r.USER_REGION4,r.USER_REGION5
</sql>
<sql id="AppIpCfg_Column" >
@@ -440,6 +446,21 @@
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion1 != null and userRegion1 != ''">
AND r.user_region1 =#{userRegion1,jdbcType=VARCHAR}
</if>
<if test="userRegion2 != null and userRegion2 != ''">
AND r.user_region2 =#{userRegion2,jdbcType=VARCHAR}
</if>
<if test="userRegion3 != null and userRegion3 != ''">
AND r.user_region3 =#{userRegion3,jdbcType=VARCHAR}
</if>
<if test="userRegion4 != null and userRegion4 != ''">
AND r.user_region4 =#{userRegion4,jdbcType=VARCHAR}
</if>
<if test="userRegion5 != null and userRegion5 != ''">
AND r.user_region5 =#{userRegion5,jdbcType=VARCHAR}
</if>
<if test="ipPort!=null">
AND r.compile_id in (select t.compile_id from ip_port_cfg t
@@ -991,10 +1012,13 @@
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,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN
CFG_TYPE,CFG_REGION_CODE,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,USER_REGION1
,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
)values (
<include refid="AppCommonCfg_Value_List" />,
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER}
,#{userRegion1,jdbcType=VARCHAR} ,#{userRegion2,jdbcType=VARCHAR} ,#{userRegion3,jdbcType=VARCHAR}
,#{userRegion4,jdbcType=VARCHAR} ,#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<insert id="insertAppIpCfg" parameterType="com.nis.domain.configuration.AppIpCfg" >
@@ -1230,6 +1254,21 @@
</if>
<if test="cfgType != null and cfgType != ''">
CFG_TYPE =#{cfgType,jdbcType=VARCHAR},
</if>
<if test="userRegion1 != null and userRegion1 != ''">
USER_REGION1 =#{userRegion1,jdbcType=VARCHAR},
</if>
<if test="userRegion2 != null and userRegion2 != ''">
USER_REGION2 =#{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''">
USER_REGION1 =#{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''">
USER_REGION1 =#{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''">
USER_REGION1 =#{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>

View File

@@ -11,6 +11,7 @@
<result column="op_time" property="opTime" jdbcType="TIMESTAMP" />
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="INTEGER" />
<!-- 父id -->
<association property="parent" javaType="com.nis.domain.specific.SpecificServiceCfg">
<id column="parent_id" property="specServiceId" jdbcType="INTEGER" />
@@ -26,7 +27,8 @@
s.op_time AS opTime,
s.parent_id AS "parent.specServiceId",
s.is_leaf AS isLeaf,
s.group_id AS groupId
s.group_id AS groupId,
s.cfg_type AS cfgType
</sql>
@@ -53,6 +55,9 @@
<if test="groupId != null and groupId != '' ">
AND group_id like '%${groupId}%'
</if>
<if test="cfgType != null and cfgType != '' ">
AND cfg_type =#{cfgType,jdbcType=INTEGER}
</if>
<if test="beginDate != null" >
AND s.op_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
@@ -112,6 +117,12 @@
<if test="specificServiceCfg.groupId != null and specificServiceCfg.groupId != '' ">
AND group_id like '%${specificServiceCfg.groupId}%'
</if>
<if test="specificServiceCfg.cfgType != null and specificServiceCfg.cfgType != '' ">
AND cfg_type = #{specificServiceCfg.cfgType}
</if>
<if test="specificServiceCfg.isLeaf != null and specificServiceCfg.isLeaf != '' ">
AND is_leaf = #{specificServiceCfg.isLeaf}
</if>
<if test="specificServiceCfg.beginDate != null">
AND op_time &gt; #{specificServiceCfg.beginDate}
</if>
@@ -130,8 +141,8 @@
<!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true">
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId})
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType})
</insert>
<!-- 修改 -->
@@ -144,7 +155,8 @@
s.op_time = #{opTime},
s.parent_id = #{parent.specServiceId},
s.is_leaf = #{isLeaf},
s.group_id = #{groupId}
s.group_id = #{groupId},
s.cfg_type = #{cfgType}
WHERE s.spec_service_id = #{specServiceId}
</update>

View File

@@ -86,6 +86,19 @@ public class ServiceDictInfoService extends BaseService{
}
return list;
}
/**
* 查询该类型所有的非叶子配置
*/
public List<ServiceDictInfo> findAllNoLeafDictList(String itType,Integer cfgType) {
List<ServiceDictInfo> list = Lists.newArrayList();
List<Integer> intArr = ConfigDictUtils.dealTypeCondition(Configurations.getStringProperty("SERVICE_DICT_ITM_TYPE", ""), itType);
for(Integer intType:intArr){
List<ServiceDictInfo> tempList = serviceDictInfoDao.findAllNoLeafDictList(intType);
list.addAll(tempList);
}
return list;
}
/**
* 根据主键查询字典详细信息
* @param serviceDictId

View File

@@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -414,7 +415,7 @@ public class AppCfgService extends BaseService {
if(isAudit==1){
if(entity.getBehavCode()!=null){
entity.setCfgKeywords(entity.getAppCode()+"&"+entity.getBehavCode());
entity.setCfgKeywords(entity.getAppCode()+Constants.KEYWORD_EXPR+entity.getBehavCode());
}else{
entity.setCfgKeywords(entity.getAppCode()+"");
}
@@ -476,10 +477,12 @@ public class AppCfgService extends BaseService {
String actionCode = DictUtils.getDictCode("SERVICE_ACTION", "action_ratelimit");
if(!actionCode.equals("默认")){
if(entity.getAction().equals(Integer.parseInt(actionCode))){
userRegion += Constants.USER_REGION_SPLIT+"RATE_LIMIT="+entity.getRatelimit();
userRegion += Constants.USER_REGION_SPLIT+Constants.RATE_LIMIT_REGION+"="+entity.getRatelimit();
}
}
if(entity.getBehavCode()!=null) {
userRegion += Constants.USER_REGION_SPLIT+Constants.BEHAV_ID_REGION+"="+entity.getBehavCode();
}
maatCfg.setUserRegion(userRegion);
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);