批量下发功能增加,delRow.tag中暂时不打开此功能。

app topic domain和app domain业务修改domain存储cfgkeyword属性。
摘要修改level属性存储为下发的最终数值。
同步的单域配置的增加时间和状态属性从entity中获取
This commit is contained in:
DuanDongmei
2018-12-05 17:56:41 +08:00
parent e5fa7cbca8
commit bb302e3f13
37 changed files with 2406 additions and 703 deletions

View File

@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.taglibs.standard.functions.Functions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -223,29 +224,57 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = {"auditAppPolicyCfg"})
@RequiresPermissions(value={"app:policy:confirm"})
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),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
try {
appCfgService.auditAppPolicyCfg(entity,isAudit);
} catch (Exception e) {
e.printStackTrace();
logger.error("app策略配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
public String auditAppPolicyCfg(Model model,@ModelAttribute("cfg")AppPolicyCfg cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
AppPolicyCfg entity = new AppPolicyCfg();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
try {
appCfgService.auditAppPolicyCfg(entity,isAudit);
} catch (Exception e) {
e.printStackTrace();
logger.error("app策略配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else {
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
BeanUtils.copyProperties(searchPage, auditPage);
try {
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return policyCfgList(model, cfg, request, response);
}
return "redirect:" + adminPath +"/app/policyCfgList?functionId="+functionId;
}
/**
@@ -477,27 +506,54 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = {"auditAppHttpCfg"})
// @RequiresPermissions(value={"app:http:confirm"})
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 (Exception e) {
e.printStackTrace();
logger.error("app http配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
public String auditAppHttpCfg(Model model,@ModelAttribute("cfg")AppHttpCfg cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
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 (Exception e) {
e.printStackTrace();
logger.error("app http配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else {
Page<AppHttpCfg> searchPage=new Page<AppHttpCfg>(request,response,"r");
Page<AppHttpCfg> auditPage=new Page<AppHttpCfg>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return httpCfgList(model, cfg, request, response);
}
return "redirect:" + adminPath +"/app/httpCfgList?functionId="+functionId;
}
@@ -595,27 +651,54 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = {"auditAppDomainCfg"})
// @RequiresPermissions(value={"app:domain:confirm"})
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 (Exception e) {
e.printStackTrace();
logger.error("app协议domain配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
public String auditAppDomainCfg(Model model,@ModelAttribute("cfg")AppDomainCfg cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
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 (Exception e) {
e.printStackTrace();
logger.error("app协议domain配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else {
Page<AppDomainCfg> searchPage=new Page<AppDomainCfg>(request,response,"r");
Page<AppDomainCfg> auditPage=new Page<AppDomainCfg>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return domainCfgList(model, cfg, request, response);
}
return "redirect:" + adminPath +"/app/domainCfgList?functionId="+functionId;
}
@@ -834,27 +917,55 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = {"auditAppSslCfg"})
@RequiresPermissions(value={"app:ssl:confirm"})
public String auditAppSslCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
AppSslCertCfg entity = new AppSslCertCfg();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = appCfgService.getAppSslCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appCfgService.auditAppSslCfg(entity,isAudit);
} catch (Exception e) {
logger.error("app SSL配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
public String auditAppSslCfg(Model model,@ModelAttribute("cfg")AppSslCertCfg cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
AppSslCertCfg entity = new AppSslCertCfg();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = appCfgService.getAppSslCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appCfgService.auditAppSslCfg(entity,isAudit);
} catch (Exception e) {
logger.error("app SSL配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else {
Page<AppPolicyCfg> searchPage=new Page<AppPolicyCfg>(request,response,"r");
Page<AppPolicyCfg> auditPage=new Page<AppPolicyCfg>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return sslCfgList(model, cfg, request, response);
}
return "redirect:" + adminPath +"/app/sslCfgList?functionId="+functionId;
}
/**
@@ -1194,9 +1305,9 @@ public class AppCfgController extends BaseController {
AppTopicDomainCfg entity,RedirectAttributes redirectAttributes) {
try {
//验证域名的重复行
if(!StringUtil.isBlank(entity.getDomain())){
if(!StringUtil.isBlank(entity.getCfgKeywords())){
WebsiteDomainTopic websiteDomainTopic = new WebsiteDomainTopic();
websiteDomainTopic.setDomain(entity.getDomain());
websiteDomainTopic.setDomain(entity.getCfgKeywords());
List<WebsiteDomainTopic> domainDict = appCfgService.getDomainDict(websiteDomainTopic);
if((domainDict==null || domainDict.size()==0)){
//保存到域名关联表中
@@ -1213,8 +1324,8 @@ public class AppCfgController extends BaseController {
}
}
}
if(entity!=null&&StringUtil.isBlank(entity.getDomain())&&!StringUtil.isBlank(entity.getDomain())){
entity.setDomain(entity.getDomain());
if(entity!=null&&StringUtil.isBlank(entity.getCfgKeywords())&&!StringUtil.isBlank(entity.getCfgKeywords())){
entity.setCfgKeywords(entity.getCfgKeywords());
}
appCfgService.saveOrUpdateAppTopicDomainCfg(entity);
addMessage(redirectAttributes,"success","save_success");
@@ -1243,27 +1354,54 @@ public class AppCfgController extends BaseController {
*/
@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,"success","audit_success");
} catch (Exception e) {
logger.error("app主题网站配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
public String auditAppTopicDomainCfg(Model model,@ModelAttribute("cfg")AppTopicDomainCfg cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)){
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,"success","audit_success");
} catch (Exception e) {
logger.error("app主题网站配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else {
Page<AppTopicDomainCfg> searchPage=new Page<AppTopicDomainCfg>(request,response,"r");
Page<AppTopicDomainCfg> auditPage=new Page<AppTopicDomainCfg>(request,response,"r");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return TopicDomainCfgList(model, cfg, request, response);
}
return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+functionId;
}