当组为空的时候不审核,修复排序报错
This commit is contained in:
@@ -2,40 +2,29 @@ package com.nis.web.controller.configuration;
|
||||
|
||||
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ObjGroupCfg;
|
||||
import com.nis.domain.configuration.template.ObjGroupListTemplate;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.exceptions.ServiceException;
|
||||
import com.nis.util.*;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.configuration.ObjectGroupService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/objgroup")
|
||||
@@ -261,10 +250,11 @@ public class ObjectGroupController extends BaseController {
|
||||
RedirectAttributes redirectAttributes,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
|
||||
Properties props=this.getMsgProp();
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
StringBuffer tip=new StringBuffer();
|
||||
for(String id :idArray){
|
||||
entity = objectGroupService.getObjectGroupCfg(Long.parseLong(id),null);
|
||||
entity.setIsAudit(isAudit);
|
||||
@@ -273,8 +263,17 @@ public class ObjectGroupController extends BaseController {
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
objectGroupService.auditPolicy(entity,isAudit,Constants.INSERT_ACTION);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
if(StringUtils.isBlank(entity.getCommonGroupIds())){
|
||||
tip.append(String.format(props.getProperty("no_common_group","The configuration ID of %s does not have an group;"),id));
|
||||
tip.append("<br/>");
|
||||
}else{
|
||||
objectGroupService.auditPolicy(entity,isAudit,Constants.INSERT_ACTION);
|
||||
}
|
||||
if(tip.toString().length()>0){
|
||||
addMessage(redirectAttributes,"success", tip.toString());
|
||||
}else{
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
}
|
||||
} catch ( Exception e) {
|
||||
logger.error("策略对象组下发失败:"+e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
@@ -285,6 +284,7 @@ public class ObjectGroupController extends BaseController {
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"r");
|
||||
@@ -292,8 +292,12 @@ public class ObjectGroupController extends BaseController {
|
||||
|
||||
try {
|
||||
BeanUtils.copyProperties(searchPage, auditPage);
|
||||
auditAll(auditPage,isValid , cfg);
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
String tip= auditAll(auditPage,isValid , cfg,props);
|
||||
if(tip.toString().length()>0){
|
||||
addMessage(redirectAttributes,"success", tip.toString());
|
||||
}else{
|
||||
addMessage(redirectAttributes,"success", "audit_success");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("策略对象组下发失败:",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
@@ -305,8 +309,8 @@ public class ObjectGroupController extends BaseController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list(model, cfg, request, response);
|
||||
//无法保存状态
|
||||
// return list(model, cfg, request, response);
|
||||
}
|
||||
return "redirect:" + adminPath +"/objgroup/list?functionId="+functionId;
|
||||
}
|
||||
@@ -445,7 +449,8 @@ public class ObjectGroupController extends BaseController {
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public void auditAll(Page page,Integer auditType,CfgIndexInfo entity)throws Exception {
|
||||
public String auditAll(Page page,Integer auditType,CfgIndexInfo entity,Properties props)throws Exception {
|
||||
StringBuffer tip=new StringBuffer();
|
||||
long start=System.currentTimeMillis();
|
||||
page.setOrderBy("");
|
||||
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
@@ -519,6 +524,12 @@ public class ObjectGroupController extends BaseController {
|
||||
searchCfg.setServiceId(Integer.parseInt(e.getKey().toString()));
|
||||
auditBatchCfg.setServiceId(Integer.parseInt(e.getKey().toString()));
|
||||
List<CfgIndexInfo> list = getDataList(page,searchCfg,null,null,null); // 通过ServiceId获取cfg_index_info主配置表数据
|
||||
for(CfgIndexInfo info:list){
|
||||
if(StringUtils.isBlank(info.getCommonGroupIds())){
|
||||
tip.append(String.format(props.getProperty("no_common_group","The configuration ID of %s does not have an group;"),info.getCompileId()));
|
||||
tip.append("<br/>");
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//配置生效处理 复用全量下发
|
||||
if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
@@ -589,5 +600,6 @@ public class ObjectGroupController extends BaseController {
|
||||
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("配置批量生效/失效耗时:"+(end-start));
|
||||
return tip.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user