(1)修复共用页面左上角显示配置类别
(2)域名转发提交,与域名拦截复用页面
This commit is contained in:
@@ -20,6 +20,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
@@ -33,14 +35,24 @@ import com.nis.web.controller.BaseController;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class CommonController extends BaseController {
|
||||
public void _ipList(Model model,IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
public void _ipList(String cfgName,Model model,IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request,response,"r");
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
}
|
||||
public void _ipForm(Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
public void _domainList(String cfgName,Model model,HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
Page<BaseStringCfg> searchPage=new Page<BaseStringCfg>(request,response,"r");
|
||||
Page<BaseStringCfg> page = stringCfgService.findPage(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
}
|
||||
public void _ipForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = ipCfgService.getIpCfgById(IpPortCfg.getTablename(),Long.parseLong(ids));
|
||||
}
|
||||
@@ -56,7 +68,24 @@ public class CommonController extends BaseController {
|
||||
initFormCondition(model,entity);
|
||||
}
|
||||
}
|
||||
public void _saveOrUpdateIp(RedirectAttributes model, IpPortCfg cfg) {
|
||||
public void _domainForm(String cfgName,Model model,String ids,Integer functionId,BaseStringCfg entity) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = stringCfgService.getStringCfgById(HttpUrlCfg.getTablename(),Long.parseLong(ids));
|
||||
}
|
||||
if(entity.getCfgId()!=null){
|
||||
model.addAttribute("_cfg", entity);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
HttpUrlCfg cfg=new HttpUrlCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
model.addAttribute("_cfg", cfg);
|
||||
initFormCondition(model,entity);
|
||||
}
|
||||
}
|
||||
public void _saveOrUpdateIp(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
Date date=new Date();
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
logger.info("saveOrUpdateIp loaded");
|
||||
@@ -78,7 +107,31 @@ public class CommonController extends BaseController {
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
}
|
||||
public void _deleteIp(String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
public void _saveOrUpdateDomain(String cfgName,RedirectAttributes model, HttpUrlCfg cfg) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
cfg.setTableName(HttpUrlCfg.getTablename());
|
||||
logger.info("saveOrUpdateDomain 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);
|
||||
stringCfgService.addStringCfg((BaseStringCfg)cfg);
|
||||
}else{//修改
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
stringCfgService.updateStringCfg((BaseStringCfg)cfg);
|
||||
}
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
}
|
||||
public void _deleteIp(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
try{
|
||||
ipCfgService.deleteIp(ids,compileIds,functionId.intValue());
|
||||
addMessage(model,"delete_success");
|
||||
@@ -87,7 +140,18 @@ public class CommonController extends BaseController {
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
}
|
||||
public void _auditIp(String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
public void _deleteDomain(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
try{
|
||||
stringCfgService.deleteDomain(ids,compileIds,functionId.intValue());
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
}
|
||||
public void _auditIp(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
redirectAttributes.addAttribute("cfgName", cfgName);
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
@@ -111,4 +175,28 @@ public class CommonController extends BaseController {
|
||||
addMessage(redirectAttributes, "audit_failed");
|
||||
}
|
||||
}
|
||||
public void _auditDomain(String ids,HttpUrlCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
List<BaseStringCfg> beans=stringCfgService.getListByCfgId(HttpUrlCfg.getTablename(),ids);
|
||||
Date date=new Date();
|
||||
for(BaseStringCfg bean:beans){
|
||||
bean.setTableName(HttpUrlCfg.getTablename());
|
||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
||||
bean.setAuditTime(date);
|
||||
bean.setIsAudit(cfg.getIsAudit());
|
||||
bean.setIsValid(cfg.getIsValid());
|
||||
stringCfgService.auditDomain(bean);
|
||||
}
|
||||
addMessage(redirectAttributes,"audit_success");
|
||||
}catch(MaatConvertException e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(redirectAttributes, e.getPrefix()+e.getResult().getReason());
|
||||
}catch(Exception e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(redirectAttributes, "audit_failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user