(1)域名白名单添加订阅ID,dolog
(2)WebsiteController redirect 使用RedirectAttributes
This commit is contained in:
@@ -10,10 +10,6 @@ package com.nis.domain.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nis.domain.SysRole;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.util.excel.fieldtype.RoleListType;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName: CfgIndexInfo.java
|
||||
|
||||
@@ -180,7 +180,7 @@ public class WebsiteController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"saveHttpCfg"})
|
||||
@RequiresPermissions(value={"website:http:config"})
|
||||
public String saveHttpCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
public String saveHttpCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
websiteCfgService.saveHttpCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@@ -242,7 +242,7 @@ public class WebsiteController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"saveSslCfg"})
|
||||
@RequiresPermissions(value={"website:ssl:config"})
|
||||
public String saveSslCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
public String saveSslCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
websiteCfgService.saveSslCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@@ -330,7 +330,7 @@ public class WebsiteController extends BaseController{
|
||||
}
|
||||
@RequestMapping(value = {"saveDnsCfg"})
|
||||
@RequiresPermissions(value={"website:dns:config"})
|
||||
public String saveDnsCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
public String saveDnsCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
websiteCfgService.saveDnsCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@@ -20,13 +19,12 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.WhiteListIpTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -43,7 +41,7 @@ public class WhiteListController extends CommonController{
|
||||
//@RequiresPermissions(value={"whitelist:ip:config","whitelist:ip:confirm","whitelist:ip:aduit"},logical=Logical.OR)
|
||||
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
|
||||
Page<CfgIndexInfo> page = ipCfgService.getWhiteIpList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/whitelist/ipList";
|
||||
@@ -81,7 +79,6 @@ public class WhiteListController extends CommonController{
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
|
||||
entity = this.ipCfgService.getIpPortCfg(Long.parseLong(ids));
|
||||
entity = this.websiteCfgService.getSslCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
@@ -90,7 +87,7 @@ public class WhiteListController extends CommonController{
|
||||
return "/cfg/whitelist/ipForm";
|
||||
}
|
||||
@RequestMapping(value = {"ip/save"})
|
||||
public String saveIpCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
public String saveIpCfg(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
ipCfgService.saveIpCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@@ -120,14 +117,13 @@ public class WhiteListController extends CommonController{
|
||||
@RequiresPermissions(value={"whitelist:ip:config"})
|
||||
public String updateIpCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
ipCfgService.updateIpCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+functionId;
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/ip/list?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"domain/list"})
|
||||
//@RequiresPermissions(value={"whitelist:domain:config","whitelist:domain:confirm","whitelist:domain:aduit"},logical=Logical.OR)
|
||||
public String domainList(Model model,@ModelAttribute("cfg")HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
Page<HttpUrlCfg> searchPage=new Page<HttpUrlCfg>(request,response,"r");
|
||||
Page<HttpUrlCfg> page = domainService.findPage(searchPage, cfg);
|
||||
public String domainList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> page = domainService.getDomainList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/whitelist/domainList";
|
||||
@@ -135,47 +131,54 @@ public class WhiteListController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"domain/form"})
|
||||
@RequiresPermissions(value={"whitelist:domain:config"})
|
||||
public String domainForm(Model model,String ids,HttpUrlCfg entity) {
|
||||
public String domainForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = domainService.getStringCfgById(Long.parseLong(ids));
|
||||
}
|
||||
initFormCondition(model,entity);
|
||||
if(entity.getCfgId()!=null){
|
||||
model.addAttribute("_cfg", entity);
|
||||
entity = domainService.getDomainCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
HttpUrlCfg cfg=new HttpUrlCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
model.addAttribute("_cfg", cfg);
|
||||
initFormCondition(model,entity);
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/whitelist/domainForm";
|
||||
}
|
||||
@RequestMapping(value = {"domain/saveOrUpdate"})
|
||||
public String saveOrUpdateDomain(RedirectAttributes model, HttpUrlCfg cfg) {
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
logger.info("saveOrUpdateIp loaded");
|
||||
try{
|
||||
Date date=new Date();
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgId()==null){//新增
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(date);
|
||||
domainService.addStringCfg(cfg);
|
||||
}else{//修改
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
domainService.updateStringCfg(cfg);
|
||||
}
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+cfg.getFunctionId();
|
||||
@RequestMapping(value = {"domain/save"})
|
||||
public String saveOrUpdateDomain(RedirectAttributes model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
domainService.saveDomainCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"domain/ajaxSubList"})
|
||||
public String ajaxDomainSubList(Model model,Long cfgId,Integer index) {
|
||||
CfgIndexInfo cfg = domainService.getDomainCfg(cfgId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getHttpUrlList()!=null){
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getHttpUrlList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg keyword:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/whitelist/domianSubList";
|
||||
}
|
||||
@RequestMapping(value = {"domain/updateValid"})
|
||||
@RequiresPermissions(value={"whitelist:domain:config"})
|
||||
public String updateDomainValid(Integer isValid,String ids,Integer functionId) {
|
||||
domainService.updateDomainCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"domain/delete"})
|
||||
@RequiresPermissions("whitelist:domain:config")
|
||||
public String deleteDomain(String ids,Integer functionId,RedirectAttributes model) {
|
||||
@@ -191,29 +194,25 @@ public class WhiteListController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"domain/audit"})
|
||||
@RequiresPermissions("whitelist:domain:confirm")
|
||||
public String auditDomain(String ids,HttpUrlCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
try{
|
||||
List<HttpUrlCfg> beans=domainService.getListByCfgId(ids);
|
||||
Date date=new Date();
|
||||
for(HttpUrlCfg bean:beans){
|
||||
HttpUrlCfg domain=new HttpUrlCfg();
|
||||
BeanUtils.copyProperties(bean, domain);
|
||||
domain.setTableName(HttpUrlCfg.getTablename());
|
||||
domain.setAuditorId(bean.getCurrentUser().getId());
|
||||
domain.setAuditTime(date);
|
||||
domain.setIsAudit(cfg.getIsAudit());
|
||||
domain.setIsValid(cfg.getIsValid());
|
||||
domainService.auditWhiteDomain(domain);
|
||||
public String auditDomain(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = domainService.getDomainCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
domainService.auditDomainCfg(entity,isAudit);
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("domain配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}
|
||||
addMessage(redirectAttributes,"audit_success");
|
||||
}catch(MaatConvertException e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}catch(Exception e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(redirectAttributes, "audit_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+cfg.getFunctionId();
|
||||
return "redirect:" + adminPath +"/ntc/whitelist/domain/list?functionId="+functionId;
|
||||
}
|
||||
//ip配置导入
|
||||
@RequestMapping(value = "ip/import", method=RequestMethod.POST)
|
||||
|
||||
@@ -44,5 +44,6 @@ public interface IpCfgDao extends CrudDao<BaseIpCfg>{
|
||||
public void deleteIpCfg(CfgIndexInfo entity);
|
||||
public void updateCfgValid(BaseCfg entity);
|
||||
public void auditCfg(BaseCfg entity);
|
||||
public List<CfgIndexInfo> getWhiteIpList(CfgIndexInfo entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -1001,4 +1001,174 @@
|
||||
and function_id=#{functionId,jdbcType=INTEGER}
|
||||
</trim>
|
||||
</update>
|
||||
<select id="getWhiteIpList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
|
||||
SELECT
|
||||
<include refid="ConfigIndex_Column" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName,dns.cfg_desc as dns_strategy_name
|
||||
</trim>
|
||||
FROM cfg_index_info a
|
||||
left join dns_res_strategy dns on a.dns_strategy_id=dns.cfg_id
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND a.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName != ''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="ipPort!=null">
|
||||
AND a.compile_id in (select t.compile_id from ip_port_cfg t
|
||||
<where>
|
||||
<if test="functionId != null">
|
||||
AND t.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="ipPort.srcIpAddress != null and ipPort.srcIpAddress != ''">
|
||||
and t.src_ip_address =#{(ipPort.srcIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="ipPort.srcPort != null and ipPort.srcPort != ''">
|
||||
and t.src_port =#{ipPort.srcPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="ipPort.destIpAddress != null and ipPort.destIpAddress != ''">
|
||||
and t.dest_ip_address =#{(ipPort.destIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="ipPort.destPort != null and ipPort.destPort != ''">
|
||||
and t.dest_port =#{ipPort.destPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="httpUrl!=null">
|
||||
AND a.compile_id in (select f.compile_id from http_url_cfg f
|
||||
<where>
|
||||
<if test="httpUrl.cfgKeywords != null and httpUrl.cfgKeywords != ''">
|
||||
and f.cfg_keywords like concat(concat('%',#{httpUrl.cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="httpReqBody!=null">
|
||||
AND a.compile_id in (select f.compile_id from http_body_cfg f
|
||||
<where>
|
||||
and cfg_type='http_req_body'
|
||||
<if test="httpReqBody.cfgKeywords != null and httpReqBody.cfgKeywords != ''">
|
||||
and f.cfg_keywords like concat(concat('%',#{httpReqBody.cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="httpResBody!=null">
|
||||
AND a.compile_id in (select f.compile_id from http_body_cfg f
|
||||
<where>
|
||||
and cfg_type='http_res_body'
|
||||
<if test="httpResBody.cfgKeywords != null and httpResBody.cfgKeywords != ''">
|
||||
and f.cfg_keywords like concat(concat('%',#{httpResBody.cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="httpReqHdr!=null">
|
||||
AND a.compile_id in (select f.compile_id from http_req_head_cfg f
|
||||
<where>
|
||||
<if test="httpReqHdr.cfgKeywords != null and httpReqHdr.cfgKeywords != ''">
|
||||
and f.cfg_keywords like concat(concat('%',#{httpReqHdr.cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="httpReqHdr.district != null and httpReqHdr.district != ''">
|
||||
and f.district like concat(concat('%',#{httpReqHdr.district,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="httpResHdr!=null">
|
||||
AND a.compile_id in (select f.compile_id from http_res_head_cfg f
|
||||
<where>
|
||||
<if test="httpResHdr.cfgKeywords != null and httpResHdr.cfgKeywords != ''">
|
||||
and f.cfg_keywords like concat(concat('%',#{httpResHdr.cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="httpResHdr.district != null and httpResHdr.district != ''">
|
||||
and f.district like concat(concat('%',#{httpResHdr.district,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<!-- <if test="sslCfg!=null">
|
||||
AND a.compile_id in (select f.compile_id from ssl_keyword_cfg f
|
||||
<where>
|
||||
<if test="sslCfg.cfgKeywords != null and sslCfg.cfgKeywords != ''">
|
||||
and f.cfg_keywords like concat(concat('%',#{sslCfg.cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
</if> -->
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY a.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -11,9 +11,12 @@ 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.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
@@ -29,6 +32,8 @@ import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
import com.nis.web.dao.configuration.DomainDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.dao.configuration.WebsiteCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
@@ -43,6 +48,8 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
|
||||
@Autowired
|
||||
protected StringCfgDao stringCfgDao;
|
||||
@Autowired
|
||||
protected WebsiteCfgDao websiteCfgDao;
|
||||
@Autowired
|
||||
protected AreaIpCfgDao areaIpCfgDao;
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
@@ -408,4 +415,245 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
|
||||
// TODO Auto-generated method stub
|
||||
return domainDao.getListByCfgId(ids);
|
||||
}
|
||||
public CfgIndexInfo getDomainCfg(Long cfgId) {
|
||||
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
|
||||
List<HttpUrlCfg> httpUrlList = websiteCfgDao.getHttpUrlList(entity);
|
||||
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
|
||||
entity.setHttpUrlList(httpUrlList);
|
||||
entity.setNtcSubscribeIdCfgList(subscribeIdList);
|
||||
return entity;
|
||||
}
|
||||
public void saveDomainCfg(CfgIndexInfo entity){
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
|
||||
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);
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
websiteCfgDao.saveCfgIndex(entity);
|
||||
|
||||
if(entity.getHttpUrlList()!=null){
|
||||
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
websiteCfgDao.saveHttpUrlCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entity.getNtcSubscribeIdCfgList()!=null){
|
||||
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
stringCfgDao.saveSubscribeIdCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null){
|
||||
for(AreaIpCfg cfg:entity.getAreaCfg()){
|
||||
cfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
websiteCfgDao.updateCfgIndex(entity);
|
||||
//无效子配置后,再新增子配置
|
||||
websiteCfgDao.deleteHttpUrlCfg(entity);
|
||||
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(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.getHttpUrlList()!=null){
|
||||
for(HttpUrlCfg cfg:entity.getHttpUrlList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
websiteCfgDao.saveHttpUrlCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entity.getNtcSubscribeIdCfgList()!=null){
|
||||
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
stringCfgDao.saveSubscribeIdCfg(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 updateDomainCfgValid(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);
|
||||
websiteCfgDao.updateCfgValid(entity);
|
||||
//查询子配置
|
||||
entity = this.getDomainCfg(Long.parseLong(id));
|
||||
|
||||
if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0)
|
||||
{
|
||||
HttpUrlCfg cfg = new HttpUrlCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
websiteCfgDao.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());
|
||||
websiteCfgDao.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());
|
||||
websiteCfgDao.updateCfgValid(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public void auditDomainCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||
// TODO Auto-generated method stub
|
||||
//修改数据库审核状态信息
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
websiteCfgDao.auditCfg(entity);
|
||||
|
||||
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 = this.getDomainCfg(entity.getCfgId());
|
||||
|
||||
if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){
|
||||
HttpUrlCfg cfg = new HttpUrlCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
websiteCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(strRegionList,entity.getHttpUrlList(),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());
|
||||
websiteCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),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());
|
||||
websiteCfgDao.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());
|
||||
|
||||
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("domain配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("domain配置下发响应信息:"+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("domain配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("domain配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
public Page<CfgIndexInfo> getDomainList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
|
||||
// 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL)
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
List<CfgIndexInfo> list = websiteCfgDao.getWebsiteList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
@@ -739,4 +740,11 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
}
|
||||
return msgProp;
|
||||
}
|
||||
public Page<CfgIndexInfo> getWhiteIpList(Page<CfgIndexInfo> page, CfgIndexInfo entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
entity.setPage(page);
|
||||
List<CfgIndexInfo> list = ipCfgDao.getWhiteIpList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user