2018-01-09 16:50:39 +08:00
|
|
|
|
package com.nis.web.controller.configuration;
|
|
|
|
|
|
|
2018-07-04 16:03:07 +08:00
|
|
|
|
import java.util.ArrayList;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import java.util.Date;
|
2018-07-04 16:03:07 +08:00
|
|
|
|
import java.util.List;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
2018-01-09 16:50:39 +08:00
|
|
|
|
import org.springframework.stereotype.Controller;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
2018-04-08 17:19:43 +08:00
|
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
|
|
|
|
|
|
import com.nis.domain.Page;
|
2018-07-12 19:29:36 +08:00
|
|
|
|
import com.nis.domain.ServiceConfigInfo;
|
2018-06-23 17:29:14 +08:00
|
|
|
|
import com.nis.domain.configuration.AppByteCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.AppDomainCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.AppHttpCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.AppIpCfg;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.domain.configuration.AppPolicyCfg;
|
2018-07-04 16:03:07 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseStringCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.CfgIndexInfo;
|
|
|
|
|
|
import com.nis.domain.configuration.IpPortCfg;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import com.nis.domain.specific.SpecificServiceCfg;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.exceptions.MaatConvertException;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
import com.nis.web.controller.BaseController;
|
2018-06-22 18:46:01 +08:00
|
|
|
|
import com.nis.web.security.UserUtils;
|
2018-01-09 16:50:39 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 特定协议相关配置控制类
|
2018-03-29 17:24:21 +08:00
|
|
|
|
* @author zhangwei
|
2018-01-09 16:50:39 +08:00
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Controller
|
2018-06-22 18:46:01 +08:00
|
|
|
|
@RequestMapping("${adminPath}/app")
|
2018-03-29 17:24:21 +08:00
|
|
|
|
public class AppCfgController extends BaseController {
|
|
|
|
|
|
/**
|
2018-06-22 18:46:01 +08:00
|
|
|
|
* app策略列表
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @return
|
2018-03-29 17:24:21 +08:00
|
|
|
|
*/
|
2018-06-23 17:29:14 +08:00
|
|
|
|
@RequestMapping(value = {"policyCfgList"})
|
|
|
|
|
|
public String policyCfgList(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
|
|
|
|
|
|
Page<AppPolicyCfg> page = appCfgService.findAppPolicyList(searchPage, cfg);
|
|
|
|
|
|
for(AppPolicyCfg entity:page.getList()){
|
|
|
|
|
|
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
entity.setAppName(app.getSpecServiceName());
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("page", page);
|
|
|
|
|
|
initPageCondition(model,cfg);
|
|
|
|
|
|
return "/cfg/app/appPolicyCfgList";
|
|
|
|
|
|
}
|
2018-07-04 16:03:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 查询APP策略IP子配置
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param cfgId
|
|
|
|
|
|
* @param index
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"ajaxAppPolicyIpList"})
|
|
|
|
|
|
public String ajaxSslSubList(Model model,Long cfgId,Integer index) {
|
|
|
|
|
|
AppPolicyCfg cfg = appCfgService.getAppPolicyCfg(cfgId);
|
|
|
|
|
|
List<String[]> tabList = new ArrayList();
|
|
|
|
|
|
if(cfg.getIpPortList()!=null){
|
|
|
|
|
|
String cfgType = null;
|
|
|
|
|
|
for(IpPortCfg ip:cfg.getIpPortList()){
|
|
|
|
|
|
if(!ip.getCfgType().equals(cfgType)){
|
|
|
|
|
|
tabList.add(new String[]{"1",ip.getCfgType()});
|
|
|
|
|
|
cfgType = ip.getCfgType();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("_cfg", cfg);
|
|
|
|
|
|
model.addAttribute("index", index);
|
|
|
|
|
|
model.addAttribute("tabList", tabList);
|
|
|
|
|
|
return "/cfg/app/appPolicyIpList";
|
|
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 策略配置表单
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"policyCfgForm"})
|
2018-06-22 18:46:01 +08:00
|
|
|
|
@RequiresPermissions(value={"app:policy:config"})
|
2018-06-23 17:29:14 +08:00
|
|
|
|
public String policyCfgForm(Model model,String ids,AppPolicyCfg entity) {
|
2018-06-22 18:46:01 +08:00
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
|
entity = appCfgService.getAppPolicyCfg(Long.parseLong(ids));
|
|
|
|
|
|
initUpdateFormCondition(model,entity);
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}else{
|
2018-06-22 18:46:01 +08:00
|
|
|
|
initFormCondition(model,entity);
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-06-22 18:46:01 +08:00
|
|
|
|
model.addAttribute("_cfg", entity);
|
|
|
|
|
|
return "/cfg/app/appPolicyCfgForm";
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 策略配置新增修改
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-06-22 18:46:01 +08:00
|
|
|
|
@RequestMapping(value = {"saveAppPolicyCfg"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:policy:config"})
|
|
|
|
|
|
public String saveAppPolicyCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
|
|
|
|
|
AppPolicyCfg entity,RedirectAttributes redirectAttributes) {
|
2018-04-08 17:19:43 +08:00
|
|
|
|
try {
|
2018-07-12 19:29:36 +08:00
|
|
|
|
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
if(specificService!=null){
|
|
|
|
|
|
entity.setAppCode(specificService.getSpecServiceCode());
|
|
|
|
|
|
}
|
2018-06-22 18:46:01 +08:00
|
|
|
|
appCfgService.saveOrUpdateAppPolicyCfg(entity);
|
2018-04-08 17:19:43 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
2018-06-22 18:46:01 +08:00
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-06-22 18:46:01 +08:00
|
|
|
|
|
2018-06-28 17:16:58 +08:00
|
|
|
|
return "redirect:" + adminPath +"/app/policyCfgList?functionId="+entity.getFunctionId();
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 策略配置审核
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-06-22 18:46:01 +08:00
|
|
|
|
@RequestMapping(value = {"auditAppPolicyCfg"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:policy:audit"})
|
|
|
|
|
|
public String auditAppPolicyCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
AppPolicyCfg entity = new AppPolicyCfg();
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
|
|
|
|
|
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(new Date());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
try {
|
|
|
|
|
|
appCfgService.auditAppPolicyCfg(entity,isAudit);
|
|
|
|
|
|
} catch (MaatConvertException e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("app策略配置下发失败:"+e.getMessage());
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
return "redirect:" + adminPath +"/app/policyCfgList?functionId="+functionId;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 策略配置删除
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-06-22 18:46:01 +08:00
|
|
|
|
@RequestMapping(value = {"updateAppPolicyCfgValid"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:policy:config"})
|
|
|
|
|
|
public String updateAppPolicyCfgValid(Integer isValid,String ids,Integer functionId) {
|
|
|
|
|
|
appCfgService.updateAppPolicyCfgValid(isValid,ids,functionId);
|
2018-06-23 17:29:14 +08:00
|
|
|
|
return "redirect:" + adminPath +"/app/policyCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* app协议IP配置列表
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"ipCfgList"})
|
|
|
|
|
|
public String ipCfgList(Model model,@ModelAttribute("cfg")AppIpCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
|
|
|
|
|
Page<AppIpCfg> searchPage=new Page<AppIpCfg>(request,response,"r");
|
|
|
|
|
|
Page<AppIpCfg> page = appCfgService.findAppIpList(searchPage, cfg);
|
|
|
|
|
|
for(AppIpCfg entity:page.getList()){
|
|
|
|
|
|
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
entity.setAppName(app.getSpecServiceName());
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("page", page);
|
|
|
|
|
|
initPageCondition(model,cfg);
|
|
|
|
|
|
return "/cfg/app/appIpCfgList";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 协议IP配置表单
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"ipCfgForm"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:ip:config"})
|
|
|
|
|
|
public String ipCfgForm(Model model,String ids,AppIpCfg entity) {
|
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
|
entity = appCfgService.getAppIpCfg(Long.parseLong(ids));
|
|
|
|
|
|
initUpdateFormCondition(model,entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
initFormCondition(model,entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("_cfg", entity);
|
|
|
|
|
|
return "/cfg/app/appIpCfgForm";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 协议IP配置新增修改
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"saveAppIpCfg"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:ip:config"})
|
|
|
|
|
|
public String saveAppIpCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
|
|
|
|
|
AppIpCfg entity,RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
try {
|
2018-07-12 19:29:36 +08:00
|
|
|
|
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
if(specificService!=null){
|
|
|
|
|
|
entity.setAppCode(specificService.getSpecServiceCode());
|
|
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
appCfgService.saveOrUpdateAppIpCfg(entity);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-28 17:16:58 +08:00
|
|
|
|
return "redirect:" + adminPath +"/app/ipCfgList?functionId="+entity.getFunctionId();
|
2018-06-23 17:29:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 协议IP配置审核
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"auditAppIpCfg"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:ip:audit"})
|
|
|
|
|
|
public String auditAppIpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
AppIpCfg entity = new AppIpCfg();
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
|
|
|
|
|
entity = appCfgService.getAppIpCfg(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(new Date());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
try {
|
|
|
|
|
|
appCfgService.auditAppIpCfg(entity,isAudit);
|
|
|
|
|
|
} catch (MaatConvertException e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("app协议IP配置下发失败:"+e.getMessage());
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/ipCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* IP配置删除
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"updateAppIpCfgValid"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:ip:config"})
|
|
|
|
|
|
public String updateAppIpCfgValid(Integer isValid,String ids,Integer functionId) {
|
|
|
|
|
|
appCfgService.updateAppIpCfgValid(isValid,ids,functionId);
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/ipCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* app协议http配置列表
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"httpCfgList"})
|
|
|
|
|
|
public String httpCfgList(Model model,@ModelAttribute("cfg")AppHttpCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
|
|
|
|
|
Page<AppHttpCfg> searchPage=new Page<AppHttpCfg>(request,response,"r");
|
|
|
|
|
|
Page<AppHttpCfg> page = appCfgService.findAppHttpList(searchPage, cfg);
|
|
|
|
|
|
for(AppHttpCfg entity:page.getList()){
|
|
|
|
|
|
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
entity.setAppName(app.getSpecServiceName());
|
2018-06-28 17:16:58 +08:00
|
|
|
|
// entity.setCfgKeywords(entity.getCfgKeywords().replace(Constants.KEYWORD_EXPR, "&"));
|
2018-06-23 17:29:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("page", page);
|
|
|
|
|
|
initPageCondition(model,cfg);
|
|
|
|
|
|
return "/cfg/app/appHttpCfgList";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 协议http配置表单
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"httpCfgForm"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:http:config"})
|
|
|
|
|
|
public String httpCfgForm(Model model,String ids,AppHttpCfg entity) {
|
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
|
entity = appCfgService.getAppHttpCfg(Long.parseLong(ids));
|
|
|
|
|
|
initUpdateFormCondition(model,entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
initFormCondition(model,entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("_cfg", entity);
|
|
|
|
|
|
return "/cfg/app/appHttpCfgForm";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* http配置新增修改
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"saveAppHttpCfg"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:http:config"})
|
|
|
|
|
|
public String saveAppHttpCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
|
|
|
|
|
AppHttpCfg entity,RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
try {
|
2018-07-12 19:29:36 +08:00
|
|
|
|
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
if(specificService!=null){
|
|
|
|
|
|
entity.setAppCode(specificService.getSpecServiceCode());
|
|
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
appCfgService.saveOrUpdateAppHttpCfg(entity);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-28 17:16:58 +08:00
|
|
|
|
return "redirect:" + adminPath +"/app/httpCfgList?functionId="+entity.getFunctionId();
|
2018-06-23 17:29:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* http配置审核
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"auditAppHttpCfg"})
|
|
|
|
|
|
// @RequiresPermissions(value={"app:http:audit"})
|
|
|
|
|
|
public String auditAppHttpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
AppHttpCfg entity = new AppHttpCfg();
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
|
|
|
|
|
entity = appCfgService.getAppHttpCfg(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(new Date());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
try {
|
|
|
|
|
|
appCfgService.auditAppHttpCfg(entity,isAudit);
|
|
|
|
|
|
} catch (MaatConvertException e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("app http配置下发失败:"+e.getMessage());
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/httpCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* http配置删除
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"updateAppHttpCfgValid"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:http:config"})
|
|
|
|
|
|
public String updateAppHttpCfgValid(Integer isValid,String ids,Integer functionId) {
|
|
|
|
|
|
appCfgService.updateAppHttpCfgValid(isValid,ids,functionId);
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/httpCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* app协议domain配置列表
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"domainCfgList"})
|
|
|
|
|
|
public String domainCfgList(Model model,@ModelAttribute("cfg")AppDomainCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
|
|
|
|
|
Page<AppDomainCfg> searchPage=new Page<AppDomainCfg>(request,response,"r");
|
|
|
|
|
|
Page<AppDomainCfg> page = appCfgService.findAppDomainList(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/appDomainCfgList";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 协议domain配置表单
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"domainCfgForm"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:domain:config"})
|
|
|
|
|
|
public String domainCfgForm(Model model,String ids,AppDomainCfg entity) {
|
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
|
entity = appCfgService.getAppDomainCfg(Long.parseLong(ids));
|
|
|
|
|
|
initUpdateFormCondition(model,entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
initFormCondition(model,entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("_cfg", entity);
|
|
|
|
|
|
return "/cfg/app/appDomainCfgForm";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* domain配置新增修改
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"saveAppDomainCfg"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:domain:config"})
|
|
|
|
|
|
public String saveAppDomainCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
|
|
|
|
|
AppDomainCfg entity,RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
try {
|
2018-07-12 19:29:36 +08:00
|
|
|
|
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
if(specificService!=null){
|
|
|
|
|
|
entity.setAppCode(specificService.getSpecServiceCode());
|
|
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
appCfgService.saveOrUpdateAppDomainCfg(entity);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-28 17:16:58 +08:00
|
|
|
|
return "redirect:" + adminPath +"/app/domainCfgList?functionId="+entity.getFunctionId();
|
2018-06-23 17:29:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* domain配置审核
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"auditAppDomainCfg"})
|
|
|
|
|
|
// @RequiresPermissions(value={"app:domain:audit"})
|
|
|
|
|
|
public String auditAppDomainCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
AppDomainCfg entity = new AppDomainCfg();
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
|
|
|
|
|
entity = appCfgService.getAppDomainCfg(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(new Date());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
try {
|
|
|
|
|
|
appCfgService.auditAppDomainCfg(entity,isAudit);
|
|
|
|
|
|
} catch (MaatConvertException e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("app协议domain配置下发失败:"+e.getMessage());
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/domainCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* domain配置删除
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"updateAppDomainCfgValid"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:domain:config"})
|
|
|
|
|
|
public String updateAppDomainCfgValid(Integer isValid,String ids,Integer functionId) {
|
|
|
|
|
|
appCfgService.updateAppDomainCfgValid(isValid,ids,functionId);
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/domainCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* app协议byte配置列表
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"byteCfgList"})
|
|
|
|
|
|
public String byteCfgList(Model model,@ModelAttribute("cfg")AppByteCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
|
|
|
|
|
Page<AppByteCfg> searchPage=new Page<AppByteCfg>(request,response,"r");
|
|
|
|
|
|
Page<AppByteCfg> page = appCfgService.findAppByteList(searchPage, cfg);
|
|
|
|
|
|
for(AppByteCfg entity:page.getList()){
|
|
|
|
|
|
SpecificServiceCfg app = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
entity.setAppName(app.getSpecServiceName());
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("page", page);
|
|
|
|
|
|
initPageCondition(model,cfg);
|
|
|
|
|
|
return "/cfg/app/appByteCfgList";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 协议byte配置表单
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"byteCfgForm"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:byte:config"})
|
|
|
|
|
|
public String byteCfgForm(Model model,String ids,AppByteCfg entity) {
|
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
|
entity = appCfgService.getAppByteCfg(Long.parseLong(ids));
|
|
|
|
|
|
initUpdateFormCondition(model,entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
initFormCondition(model,entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
model.addAttribute("_cfg", entity);
|
|
|
|
|
|
return "/cfg/app/appByteCfgForm";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* byte配置新增修改
|
|
|
|
|
|
* @param model
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"saveAppByteCfg"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:byte:config"})
|
|
|
|
|
|
public String saveAppByteCfg(Model model,HttpServletRequest request,HttpServletResponse response,
|
|
|
|
|
|
AppByteCfg entity,RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
try {
|
2018-07-12 19:29:36 +08:00
|
|
|
|
SpecificServiceCfg specificService = specificServiceCfgService.getBySpecServiceId(entity.getSpecServiceId());
|
|
|
|
|
|
if(specificService!=null){
|
|
|
|
|
|
entity.setAppCode(specificService.getSpecServiceCode());
|
|
|
|
|
|
}
|
2018-06-23 17:29:14 +08:00
|
|
|
|
appCfgService.saveOrUpdateAppByteCfg(entity);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-28 17:16:58 +08:00
|
|
|
|
return "redirect:" + adminPath +"/app/byteCfgList?functionId="+entity.getFunctionId();
|
2018-06-23 17:29:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* byte配置审核
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"auditAppByteCfg"})
|
|
|
|
|
|
// @RequiresPermissions(value={"app:byte:audit"})
|
|
|
|
|
|
public String auditAppByteCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
|
|
|
|
|
AppByteCfg entity = new AppByteCfg();
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
|
|
|
|
|
entity = appCfgService.getAppByteCfg(Long.parseLong(id));
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(new Date());
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
try {
|
|
|
|
|
|
appCfgService.auditAppByteCfg(entity,isAudit);
|
|
|
|
|
|
} catch (MaatConvertException e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("app协议byte配置下发失败:"+e.getMessage());
|
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/byteCfgList?functionId="+functionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* byte配置删除
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RequestMapping(value = {"updateAppByteCfgValid"})
|
|
|
|
|
|
@RequiresPermissions(value={"app:byte:config"})
|
|
|
|
|
|
public String updateAppByteCfgValid(Integer isValid,String ids,Integer functionId) {
|
|
|
|
|
|
appCfgService.updateAppByteCfgValid(isValid,ids,functionId);
|
|
|
|
|
|
return "redirect:" + adminPath +"/app/byteCfgList?functionId="+functionId;
|
2018-03-29 17:24:21 +08:00
|
|
|
|
}
|
2018-01-09 16:50:39 +08:00
|
|
|
|
}
|