(1)审核修正userregion,定时userregion修正
(2)form表单monit修正,list group为空报错修复 (3)删除组下的域配置相关逻辑修正
This commit is contained in:
@@ -2,19 +2,21 @@ 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.CachePolicyUserRegion;
|
||||
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.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
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;
|
||||
@@ -26,21 +28,18 @@ 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.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
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")
|
||||
public class ObjectGroupController extends BaseController {
|
||||
@Autowired
|
||||
private ObjectGroupService objectGroupService;
|
||||
@RequestMapping(value = { "/list" })
|
||||
public String list(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
|
||||
HttpServletResponse response){
|
||||
@@ -213,15 +212,15 @@ public class ObjectGroupController extends BaseController {
|
||||
List<BaseCfg> baseCfgList=new ArrayList<>();
|
||||
for (CfgIndexInfo cfg : list) {
|
||||
if(cfg.getUserRegion()!=null){
|
||||
for (Object val:cfg.getUserRegion().values()) {
|
||||
if(StringUtils.isNotBlank(val.toString())){
|
||||
if(val.toString().startsWith(",")){
|
||||
serviceGroupIds.append(val.toString().substring(1));
|
||||
}else{
|
||||
serviceGroupIds.append(val.toString());
|
||||
for (Object val:cfg.getUserRegion().values()) {
|
||||
if(StringUtils.isNotBlank(val.toString())){
|
||||
if(val.toString().startsWith(",")){
|
||||
serviceGroupIds.append(val.toString().substring(1));
|
||||
}else{
|
||||
serviceGroupIds.append(val.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BaseCfg baseCfg=new BaseCfg();
|
||||
BeanUtils.copyProperties(cfg, baseCfg);
|
||||
@@ -242,7 +241,7 @@ public class ObjectGroupController extends BaseController {
|
||||
}
|
||||
public List getDataList(Page searchPage
|
||||
,CfgIndexInfo searchCfg
|
||||
){
|
||||
){
|
||||
BaseCfg baseCfg=new BaseCfg<>();
|
||||
if(!StringUtil.isEmpty(searchCfg)) {
|
||||
BeanUtils.copyProperties(searchCfg, baseCfg);
|
||||
@@ -438,4 +437,156 @@ public class ObjectGroupController extends BaseController {
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 批量审核
|
||||
* @param page
|
||||
* @param auditType
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public void auditAll(Page page,Integer auditType,CfgIndexInfo entity)throws Exception {
|
||||
long start=System.currentTimeMillis();
|
||||
page.setOrderBy("");
|
||||
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
//携带审核状态信息的BaseCfg
|
||||
BaseCfg auditBatchCfg=new BaseCfg();
|
||||
//携带审核条件的BaseCfg
|
||||
CfgIndexInfo searchCfg=new CfgIndexInfo();
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchCfg);
|
||||
}
|
||||
auditType = (Integer)Reflections.invokeGetter(entity, "isAudit");
|
||||
|
||||
//全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过
|
||||
if(auditType.equals(1) || auditType.equals(2)) {
|
||||
if(auditType.equals(1)) {
|
||||
auditBatchCfg.setIsAudit(1);
|
||||
auditBatchCfg.setIsValid(1);
|
||||
}else {
|
||||
auditBatchCfg.setIsAudit(2);
|
||||
auditBatchCfg.setIsValid(0);
|
||||
}
|
||||
auditBatchCfg.setAuditTime(new Date());
|
||||
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
}else {
|
||||
|
||||
auditBatchCfg.setIsAudit(3);
|
||||
auditBatchCfg.setIsValid(0);
|
||||
auditBatchCfg.setAuditTime(new Date());
|
||||
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
}
|
||||
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
Integer functionId=0;
|
||||
if(auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) {
|
||||
functionId=auditBatchCfg.getFunctionId();
|
||||
}
|
||||
|
||||
|
||||
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
|
||||
for(Map<String,Object> service:serviceList){
|
||||
String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表
|
||||
String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback
|
||||
String classNameXml = service.get("className").toString(); // 主配置Java类
|
||||
String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段
|
||||
String serviceIds=service.get("serviceIds").toString();
|
||||
auditBatchCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
auditBatchCfg.setTableName(tableNameXml);
|
||||
//searchCfg.setServiceId(Integer.valueOf(serviceIdXml));
|
||||
searchCfg.setTableName(tableNameXml);
|
||||
|
||||
if("1".equals(serviceTypeXml)){//maat类配置
|
||||
if(StringUtils.isNotBlank(serviceIds)) {//公共分组
|
||||
// 存放域配置类型 及 对应表名
|
||||
Map<Integer,List<Map<String,Object>>> childrenCfgMap=new HashMap<>();
|
||||
Map<Integer,List<Map<String,Object>>> childrenUserRegionMap=new HashMap<>();
|
||||
for(String _serviceId:serviceIds.split(",")){
|
||||
if(StringUtils.isNotBlank(_serviceId)){
|
||||
Map<String,Object> subService=serviceTemplate.getServiceListByServiceId(Integer.parseInt(_serviceId)).get(0);
|
||||
childrenCfgMap.put(Integer.parseInt(_serviceId),(List<Map<String,Object>>)subService.get("cfgList"));
|
||||
}
|
||||
}
|
||||
if(childrenCfgMap.size()>0){
|
||||
for(Map.Entry e:childrenCfgMap.entrySet()){
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
page.setPageNo(1);
|
||||
page.setLastPage(false);
|
||||
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主配置表数据
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//配置生效处理 复用全量下发
|
||||
if(auditBatchCfg.getIsAudit().equals(1)) {
|
||||
hasData = configSynchronizationService.auditObjGroupListMaatData(childrenCfgMap,childrenUserRegionMap,page,auditBatchCfg,list,hasData,true);
|
||||
}else {
|
||||
List<BaseCfg> BaseCfgList=new ArrayList<>();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (CfgIndexInfo cfg : list) {
|
||||
BaseCfg baseCfg=new BaseCfg();
|
||||
BeanUtils.copyProperties(cfg, baseCfg);
|
||||
BaseCfgList.add(baseCfg);
|
||||
}
|
||||
}
|
||||
if(auditBatchCfg.getIsAudit().equals(2)) {// 配置批量审核不通过
|
||||
hasData = commonPolicyService.batchUnApproveObjGroupListatData(page, auditBatchCfg, BaseCfgList, hasData);
|
||||
}else {// 配置失效处理 批量处理
|
||||
hasData = commonPolicyService.auditObjGroupListMaatData(tableNameXml, page, auditBatchCfg, BaseCfgList, hasData);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//批量审核通过时,如果没有携带isValid检索条件,返回界面需要将isValid置为null
|
||||
if(!StringUtil.isEmpty(entity)) {
|
||||
BaseCfg base=(BaseCfg)entity ;
|
||||
base.setBatchAuditValue("");
|
||||
base.setBatchValidValue("");
|
||||
//配置目标状态:1 1 生效,isAudit条件置为1,有selType条件,且不是isValid不改,没有sel改为isValid并且为1
|
||||
if(base.getIsAudit()==1 && base.getIsValid()==1){
|
||||
base.setIsAudit(1);
|
||||
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
|
||||
base.setIsValid(null);
|
||||
}else{
|
||||
base.setIsValid(1);
|
||||
base.setSeltype("isValid");
|
||||
}
|
||||
}
|
||||
//配置目标状态:2 0 不通过,isAudit条件置为2,有selType条件,且不是isValid不改,没有sel改为isValid并且为0
|
||||
if(base.getIsAudit()==2 && base.getIsValid()==0){
|
||||
base.setIsAudit(2);
|
||||
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
|
||||
base.setIsValid(null);
|
||||
}else{
|
||||
base.setIsValid(0);
|
||||
base.setSeltype("isValid");
|
||||
}
|
||||
}
|
||||
//配置目标状态:3 0 取消
|
||||
if(base.getIsAudit()==3 && base.getIsValid()==0){
|
||||
base.setIsAudit(3);
|
||||
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
|
||||
base.setIsValid(null);
|
||||
}else{
|
||||
base.setIsValid(0);
|
||||
base.setSeltype("isValid");
|
||||
}
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties(base, entity);
|
||||
}
|
||||
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("配置批量生效/失效耗时:"+(end-start));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user