This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java

1177 lines
49 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.nis.web.controller.configuration;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
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 com.nis.domain.Page;
import com.nis.domain.ServiceConfigInfo;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.MultipleCfg;
import com.nis.domain.configuration.MultipleSearchCfg;
import com.nis.domain.configuration.NumBoundaryCfg;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.TableBean;
import com.nis.main.ConvertTool;
import com.nis.util.Constants;
import com.nis.web.controller.BaseController;
import com.nis.web.service.configuration.MultipleCfgService;
/**
* 文本增强(多域)组合配置服务
* @author dell
*
*/
@Controller
@RequestMapping("${adminPath}/cfg/multiple")
public class MultipleCfgController extends BaseController{
@Autowired
protected MultipleCfgService multipleCfgService;
/**
*
* list(查询列表,分开查)
* (这里描述这个方法适用条件 可选)
* @param model
* @param audit
* @param cfgName
* @param cfg
* @param request
* @param response
* @return
*String
* @exception
* @since 1.0.0
*/
@SuppressWarnings({"unchecked","rawtypes"})
@RequestMapping(value = {"list"})
public String list(Model model,Integer audit,String cfgName,@ModelAttribute("cfg")MultipleSearchCfg cfg,HttpServletRequest request,HttpServletResponse response) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("cfgType", "multiple");
model.addAttribute("audit", audit);
model.addAttribute("mainTable", cfg.getMainTable());
Page<MultipleCfg> resultPage=new Page(request,response);
Integer serviceId=cfg.getServiceId();
model.addAttribute("serviceId", serviceId);
List<TableBean> otherTables=null;
if(cfg.getOtherTables()==null){
otherTables=new ArrayList<TableBean>();
cfg.setOtherTables(otherTables);
}else{
otherTables=cfg.getOtherTables();
}
if(cfg.getMainTable()==null){
logger.error("cannot get main table");
return "/cfg/multipleCfgList";
}else{//从菜单url获取mainTable
String mainTable=cfg.getMainTable();
//获取相关表名
List<ServiceConfigInfo> serviceConfigInfos=serviceConfigInfoService.findList(serviceId);
List<MultipleCfg> resultList=new ArrayList<MultipleCfg>();
resultPage.setList(resultList);
List<? extends BaseCfg> mainList=null;
//查询主表将主表中的数据set到结果中
for(ServiceConfigInfo info:serviceConfigInfos){
int type=info.getTableType();
String tableName=info.getTableName();
if(mainTable.equals(tableName)){
model.addAttribute("mainTableType", String.valueOf(info.getTableType()));
model.addAttribute("mainTableDesc", info.getTableDesc());
cfg.setMainTableType(String.valueOf(type));
cfg.setMainTableDesc(info.getTableDesc());
if(Constants.TABLE_TYPE_COMPLEX==type){//增强字符串类型
ComplexkeywordCfg _cfg=cfg.getComplexCfg()==null?new ComplexkeywordCfg():cfg.getComplexCfg();
_cfg.setTableName(mainTable);
this.setProperties(cfg,_cfg);
Page<ComplexkeywordCfg> mainPage=complexStringCfgService.findPage(new Page<ComplexkeywordCfg>(request,response,"r"), _cfg);
setPageProps(mainPage,resultPage);
mainList=mainPage.getList();//主表结果
if(mainList!=null){
//遍历主表结果将主表结果数据set到到返回结果中
for(int i=0;i<mainList.size();i++){
if(resultList.size()<mainList.size()){
MultipleCfg resultCfg=new MultipleCfg();
Map<String,ComplexkeywordCfg> cfgMap=new HashMap<String,ComplexkeywordCfg>();
cfgMap.put(mainTable, (ComplexkeywordCfg)mainList.get(i));
resultCfg.setComplexCfg(cfgMap);
this.setPropertiesToMultipleCfg(resultCfg, mainList.get(i),"select");
resultList.add(resultCfg);
}
}
}else{
logger.info("no data");
return "/cfg/multipleCfgList";
}
}else if(Constants.TABLE_TYPE_STRING==type){//字符串类型
BaseStringCfg _cfg=cfg.getStringCfg()==null?new BaseStringCfg():cfg.getStringCfg();
_cfg.setTableName(mainTable);
this.setProperties(cfg,_cfg);
Page<BaseStringCfg> mainPage=stringCfgService.findPage(new Page<BaseStringCfg>(request,response,"r"), _cfg);
mainList=mainPage.getList();//主表结果
setPageProps(mainPage,resultPage);
if(mainList!=null){
//遍历主表结果将主表结果数据set到到返回结果中
for(int i=0;i<mainList.size();i++){
if(resultList.size()<mainList.size()){
MultipleCfg resultCfg=new MultipleCfg();
Map<String,BaseStringCfg> cfgMap=new HashMap<String,BaseStringCfg>();
cfgMap.put(mainTable, (BaseStringCfg)mainList.get(i));
resultCfg.setStringCfg(cfgMap);
this.setPropertiesToMultipleCfg(resultCfg, mainList.get(i),"select");
resultList.add(resultCfg);
}
}
}else{
logger.info("no data");
return "/cfg/multipleCfgList";
}
}else if(Constants.TABLE_TYPE_IP==type){//字符串类型
BaseIpCfg _cfg=cfg.getIpCfg()==null?new BaseIpCfg():cfg.getIpCfg();
_cfg.setTableName(mainTable);
this.setProperties(cfg, _cfg);
Page<BaseIpCfg> mainPage=ipCfgService.findPage(new Page<BaseIpCfg>(request,response,"r"), _cfg);
mainList=mainPage.getList();//主表结果
setPageProps(mainPage,resultPage);
if(mainList!=null){
//遍历主表结果将主表结果数据set到到返回结果中
for(int i=0;i<mainList.size();i++){
if(resultList.size()<mainList.size()){
MultipleCfg resultCfg=new MultipleCfg();
Map<String,BaseIpCfg> cfgMap=new HashMap<String,BaseIpCfg>();
cfgMap.put(mainTable, (BaseIpCfg)mainList.get(i));
resultCfg.setIpCfg(cfgMap);
this.setPropertiesToMultipleCfg(resultCfg, mainList.get(i),"select");
resultList.add(resultCfg);
}
}
}else{
logger.info("no data");
return "/cfg/multipleCfgList";
}
}else if(Constants.TABLE_TYPE_NUMBER==type){
NumBoundaryCfg _cfg=cfg.getNumCfg()==null?new NumBoundaryCfg():cfg.getNumCfg();
_cfg.setTableName(mainTable);
this.setProperties(cfg,_cfg);
Page<NumBoundaryCfg> mainPage=numCfgService.findPage(new Page<NumBoundaryCfg>(request,response,"r"), _cfg);
mainList=mainPage.getList();//主表结果
setPageProps(mainPage,resultPage);
if(mainList!=null){
//遍历主表结果将主表结果数据set到到返回结果中
for(int i=0;i<mainList.size();i++){
if(resultList.size()<mainList.size()){
MultipleCfg resultCfg=new MultipleCfg();
Map<String,NumBoundaryCfg> cfgMap=new HashMap<String,NumBoundaryCfg>();
cfgMap.put(mainTable, (NumBoundaryCfg)mainList.get(i));
resultCfg.setNumCfg(cfgMap);
this.setPropertiesToMultipleCfg(resultCfg, mainList.get(i),"select");
resultList.add(resultCfg);
}
}
}else{
logger.info("no data");
return "/cfg/multipleCfgList";
}
}
break;
}
}
if(mainList!=null&&mainList.size()>0){
Page page=new Page(request,response,"r");
StringBuffer compileIds=new StringBuffer();
for(int i=0;i<mainList.size();i++){
if(i==mainList.size()-1){
compileIds.append(mainList.get(i).getCompileId());
}else{
compileIds.append(mainList.get(i).getCompileId()+",");
}
}
if(StringUtils.isBlank(page.getWhere())){
page.setWhere(page.getWhere()+"r.compile_id in ("+compileIds+")");
}else{
page.setWhere(page.getWhere()+"AND r.compile_id in ("+compileIds+")");
}
for(ServiceConfigInfo info:serviceConfigInfos){
int type=info.getTableType();
TableBean tableBean=new TableBean(info.getTableName(),String.valueOf(type),info.getTableDesc());
if(!mainTable.equals(info.getTableName())){
otherTables.add(tableBean);
if(Constants.TABLE_TYPE_COMPLEX==type){//增强字符串类型
ComplexkeywordCfg _cfg=cfg.getComplexCfg()==null?new ComplexkeywordCfg():cfg.getComplexCfg();
_cfg.setTableName(info.getTableName());
this.setProperties(cfg,_cfg);
List<ComplexkeywordCfg> list=complexStringCfgService
.findPage(page, _cfg)
.getList();
for(MultipleCfg resultCfg:resultPage.getList()){
BaseCfg main=null;
if(resultCfg.getComplexCfg()!=null&&resultCfg.getComplexCfg().containsKey(mainTable)){
main=resultCfg.getComplexCfg().get(mainTable);
}else if(resultCfg.getStringCfg()!=null&&resultCfg.getStringCfg().containsKey(mainTable)){
main=resultCfg.getStringCfg().get(mainTable);
}else if(resultCfg.getIpCfg().containsKey(mainTable)){
main=resultCfg.getIpCfg().get(mainTable);
}else if(resultCfg.getNumCfg().containsKey(mainTable)){
main=resultCfg.getNumCfg().get(mainTable);
}
for(ComplexkeywordCfg prop:list){
if(main.getCompileId().longValue()==prop.getCompileId().longValue()){
prop.setTableName(info.getTableName());
if(resultCfg.getComplexCfg()==null){
Map<String,ComplexkeywordCfg> map=new HashMap<String,ComplexkeywordCfg>();
map.put(info.getTableName(), prop);
resultCfg.setComplexCfg(map);
}else{
resultCfg.getComplexCfg().put(info.getTableName(), prop);
}
break;
}
}
}
}else if(Constants.TABLE_TYPE_STRING==type){//字符串类型
BaseStringCfg _cfg=cfg.getStringCfg()==null?new BaseStringCfg():cfg.getStringCfg();
_cfg.setTableName(info.getTableName());
this.setProperties(cfg,_cfg);
List<BaseStringCfg> list=stringCfgService
.findPage(page, _cfg)
.getList();
for(MultipleCfg resultCfg:resultPage.getList()){
BaseCfg main=null;
if(resultCfg.getComplexCfg()!=null&&resultCfg.getComplexCfg().containsKey(mainTable)){
main=resultCfg.getComplexCfg().get(mainTable);
}else if(resultCfg.getStringCfg()!=null&&resultCfg.getStringCfg().containsKey(mainTable)){
main=resultCfg.getStringCfg().get(mainTable);
}else if(resultCfg.getIpCfg()!=null&&resultCfg.getIpCfg().containsKey(mainTable)){
main=resultCfg.getIpCfg().get(mainTable);
}else if(resultCfg.getNumCfg()!=null&&resultCfg.getNumCfg().containsKey(mainTable)){
main=resultCfg.getNumCfg().get(mainTable);
}
for(BaseStringCfg prop:list){
if(main.getCompileId().longValue()==prop.getCompileId().longValue()){
prop.setTableName(info.getTableName());
if(resultCfg.getStringCfg()==null){
Map<String,BaseStringCfg> map=new HashMap<String,BaseStringCfg>();
map.put(info.getTableName(), prop);
resultCfg.setStringCfg(map);
}else{
resultCfg.getStringCfg().put(info.getTableName(), prop);
}
break;
}
}
}
}else if(Constants.TABLE_TYPE_IP==type){//IP类型
tableBean.setCanEmpty(true);
BaseIpCfg _cfg=cfg.getIpCfg()==null?new BaseIpCfg():cfg.getIpCfg();
_cfg.setTableName(info.getTableName());
this.setProperties(cfg, _cfg);
List<BaseIpCfg> list=ipCfgService
.findPage(page, _cfg)
.getList();
for(MultipleCfg resultCfg:resultPage.getList()){
BaseCfg main=null;
if(resultCfg.getComplexCfg()!=null&&resultCfg.getComplexCfg().containsKey(mainTable)){
main=resultCfg.getComplexCfg().get(mainTable);
}else if(resultCfg.getStringCfg()!=null&&resultCfg.getStringCfg().containsKey(mainTable)){
main=resultCfg.getStringCfg().get(mainTable);
}else if(resultCfg.getIpCfg()!=null&&resultCfg.getIpCfg().containsKey(mainTable)){
main=resultCfg.getIpCfg().get(mainTable);
}else if(resultCfg.getNumCfg()!=null&&resultCfg.getNumCfg().containsKey(mainTable)){
main=resultCfg.getNumCfg().get(mainTable);
}
for(BaseIpCfg prop:list){
if(main.getCompileId().longValue()==prop.getCompileId().longValue()){
prop.setTableName(info.getTableName());
if(resultCfg.getIpCfg()==null){
Map<String,BaseIpCfg> map=new HashMap<String,BaseIpCfg>();
map.put(info.getTableName(), prop);
resultCfg.setIpCfg(map);
}else{
resultCfg.getIpCfg().put(info.getTableName(), prop);
}
break;
}
}
}
}else if(Constants.TABLE_TYPE_NUMBER==type){
NumBoundaryCfg _cfg=cfg.getNumCfg()==null?new NumBoundaryCfg():cfg.getNumCfg();
_cfg.setTableName(info.getTableName());
this.setProperties(cfg,_cfg);
List<NumBoundaryCfg> list=numCfgService
.findPage(page, _cfg)
.getList();
for(MultipleCfg resultCfg:resultPage.getList()){
BaseCfg main=null;
if(resultCfg.getComplexCfg()!=null&&resultCfg.getComplexCfg().containsKey(mainTable)){
main=resultCfg.getComplexCfg().get(mainTable);
}else if(resultCfg.getStringCfg()!=null&&resultCfg.getStringCfg().containsKey(mainTable)){
main=resultCfg.getStringCfg().get(mainTable);
}else if(resultCfg.getIpCfg()!=null&&resultCfg.getIpCfg().containsKey(mainTable)){
main=resultCfg.getIpCfg().get(mainTable);
}else if(resultCfg.getNumCfg()!=null&&resultCfg.getNumCfg().containsKey(mainTable)){
main=resultCfg.getNumCfg().get(mainTable);
}
for(NumBoundaryCfg prop:list){
if(main.getCompileId().longValue()==prop.getCompileId().longValue()){
prop.setTableName(info.getTableName());
if(resultCfg.getNumCfg()==null){
Map<String,NumBoundaryCfg> map=new HashMap<String,NumBoundaryCfg>();
map.put(info.getTableName(), prop);
resultCfg.setNumCfg(map);
}else{
resultCfg.getNumCfg().put(info.getTableName(), prop);
}
break;
}
}
}
}
}
}
}else{
for(ServiceConfigInfo info:serviceConfigInfos){
int type=info.getTableType();
TableBean tableBean=new TableBean(info.getTableName(),String.valueOf(type),info.getTableDesc());
if(!mainTable.equals(info.getTableName())){
otherTables.add(tableBean);
}
}
}
}
model.addAttribute("mainTableType", cfg.getMainTableType());
model.addAttribute("mainTableDesc", cfg.getMainTableDesc());
model.addAttribute("action", cfg.getAction());
model.addAttribute("page", resultPage);
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
model.addAttribute("requestInfos", requestInfos);
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
model.addAttribute("fls", fls);
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
model.addAttribute("xzs", xzs);
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
model.addAttribute("lables", lables);
return "/cfg/multipleCfgList";
}
@RequestMapping(value = {"form"})
public String cfgForm(int action,String mainTable,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("action", action);
model.addAttribute("serviceId", serviceId);
model.addAttribute("audit", Constants.CFG_PAGE);
model.addAttribute("mainTable", mainTable);
model.addAttribute("operator", "save");
logger.info("sercice id is "+serviceId);
MultipleCfg cfg=new MultipleCfg();
cfg.setMainTable(mainTable);
cfg.setAction(action);
cfg.setServiceId(serviceId);
List<ServiceConfigInfo> serviceConfigInfos=serviceConfigInfoService.findList(serviceId);
List<TableBean> otherTables=new ArrayList<TableBean>();
cfg.setOtherTables(otherTables);
for(ServiceConfigInfo info:serviceConfigInfos){
int type=info.getTableType();
TableBean tableBean=new TableBean(info.getTableName(), String.valueOf(type),info.getTableDesc());
if(mainTable.equals(info.getTableName())){
cfg.setMainTableType(String.valueOf(type));
cfg.setMainTableDesc(info.getTableDesc());
model.addAttribute("mainTableType", String.valueOf(type));
model.addAttribute("mainTableDesc", info.getTableDesc());
}else{
otherTables.add(tableBean);
}
String tableName=info.getTableName();
if(Constants.TABLE_TYPE_IP==type){//ip类型
tableBean.setCanEmpty(true);
BaseIpCfg ipCfg=(BaseIpCfg)this.getClassBean(info.getTableName(), true);
if(cfg.getIpCfg()==null){
Map<String,BaseIpCfg> map=new HashMap<String,BaseIpCfg>();
map.put(tableName,ipCfg);
cfg.setIpCfg(map);
}else{
Map<String,BaseIpCfg> map=cfg.getIpCfg();
map.put(tableName,ipCfg);
}
}else if(Constants.TABLE_TYPE_STRING==type){//字符串类型
BaseStringCfg stringCfg=(BaseStringCfg)this.getClassBean(info.getTableName(), true);
if(cfg.getStringCfg()==null){
Map<String,BaseStringCfg> map=new HashMap<String,BaseStringCfg>();
map.put(tableName,stringCfg);
cfg.setStringCfg(map);
}else{
Map<String,BaseStringCfg> map=cfg.getStringCfg();
map.put(tableName,stringCfg);
}
}else if(Constants.TABLE_TYPE_NUMBER==type){//数值类型
NumBoundaryCfg numCfg=(NumBoundaryCfg)this.getClassBean(info.getTableName(), true);
if(cfg.getNumCfg()==null){
Map<String,NumBoundaryCfg> map=new HashMap<String,NumBoundaryCfg>();
map.put(tableName,numCfg);
cfg.setNumCfg(map);
}else{
Map<String,NumBoundaryCfg> map=cfg.getNumCfg();
map.put(tableName,numCfg);
}
}else if(Constants.TABLE_TYPE_COMPLEX==type){//增强字符串类型
ComplexkeywordCfg complexCfg=(ComplexkeywordCfg)this.getClassBean(info.getTableName(), true);
if(cfg.getComplexCfg()==null){
Map<String,ComplexkeywordCfg> map=new HashMap<String,ComplexkeywordCfg>();
map.put(tableName,complexCfg);
cfg.setComplexCfg(map);
}else{
Map<String,ComplexkeywordCfg> map=cfg.getComplexCfg();
map.put(tableName,complexCfg);
}
// List<SysDictInfo> districts=sysDictInfoService.getDistrictDict(tableName);
// model.addAttribute("districts", districts);
}
}
cfg.setAction(action);
cfg.setServiceId(serviceId);
model.addAttribute("_cfg", cfg);
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
model.addAttribute("requestInfos", requestInfos);
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
model.addAttribute("fls", fls);
List<ServiceDictInfo> xzs=serviceDictInfoService.findXzDict();
model.addAttribute("xzs", xzs);
List<ServiceDictInfo> lables=serviceDictInfoService.findLableDict();
model.addAttribute("lables", lables);
return "/cfg/multipleCfgForm";
}
@RequestMapping(value = {"updateForm"})
public String updateCfgForm(String cfgName,MultipleCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
model.addAttribute("operator", "update");
model.addAttribute("cfgName", cfgName);
model.addAttribute("serviceId", cfg.getServiceId());
model.addAttribute("action", cfg.getAction());
model.addAttribute("audit", Constants.CFG_PAGE);
MultipleCfg resultCfg=new MultipleCfg();
String mainTable=cfg.getMainTable();
model.addAttribute("mainTable", mainTable);
resultCfg.setMainTable(mainTable);
String mainTableType=cfg.getMainTableType();
model.addAttribute("mainTableType", mainTableType);
model.addAttribute("mainTableDesc", cfg.getMainTableDesc());
resultCfg.setMainTableType(mainTableType);
resultCfg.setMainTableDesc(cfg.getMainTableDesc());
resultCfg.setAction(cfg.getAction());
int serviceId=cfg.getServiceId();
cfg.setServiceId(serviceId);
int compileId=cfg.getCompileId().intValue();
resultCfg.setCompileId(compileId);
List<ServiceConfigInfo> serviceConfigInfos=serviceConfigInfoService.findList(serviceId);
List<TableBean> otherTables=new ArrayList<TableBean>();
resultCfg.setOtherTables(otherTables);
for(ServiceConfigInfo info:serviceConfigInfos){
String tableName=info.getTableName();
int type=info.getTableType();
if(!tableName.equals(mainTable)){
TableBean bean=new TableBean(tableName,String.valueOf(type),info.getTableDesc());
if(Constants.TABLE_TYPE_IP==type){
bean.setCanEmpty(true);
}
otherTables.add(bean);
}
if(Constants.TABLE_TYPE_IP==type){
BaseIpCfg searchIpCfg=new BaseIpCfg();
searchIpCfg.setTableName(info.getTableName());
searchIpCfg.setCompileId(compileId);
BaseIpCfg resultIpCfg=ipCfgService.get(searchIpCfg);
if(resultIpCfg!=null){
if(resultCfg.getIpCfg()==null){
Map<String,BaseIpCfg> map=new HashMap<String,BaseIpCfg>();
map.put(info.getTableName(), resultIpCfg);
resultCfg.setIpCfg(map);
}else{
Map<String,BaseIpCfg> map=resultCfg.getIpCfg();
map.put(info.getTableName(), resultIpCfg);
}
if(mainTable.equals(info.getTableName())){
this.setPropertiesToMultipleCfg(resultCfg, resultIpCfg,"update");
}
}else{
resultIpCfg=(BaseIpCfg)this.getClassBean(info.getTableName(), true);
resultIpCfg.initDefaultValue();
resultIpCfg.setCompileId(compileId);
if(resultCfg.getIpCfg()==null){
Map<String,BaseIpCfg> map=new HashMap<String,BaseIpCfg>();
map.put(info.getTableName(), resultIpCfg);
resultCfg.setIpCfg(map);
}else{
Map<String,BaseIpCfg> map=resultCfg.getIpCfg();
map.put(info.getTableName(), resultIpCfg);
}
if(mainTable.equals(info.getTableName())){
this.setPropertiesToMultipleCfg(resultCfg, resultIpCfg,"update");
}
}
}else if(Constants.TABLE_TYPE_STRING==type){
BaseStringCfg searchStringCfg=new BaseStringCfg();
searchStringCfg.setTableName(info.getTableName());
searchStringCfg.setCompileId(compileId);
BaseStringCfg resultStringCfg=stringCfgService.get(searchStringCfg);
if(resultStringCfg!=null){
if(resultCfg.getStringCfg()==null){
Map<String,BaseStringCfg> map=new HashMap<String,BaseStringCfg>();
map.put(info.getTableName(), resultStringCfg);
resultCfg.setStringCfg(map);
}else{
Map<String,BaseStringCfg> map=resultCfg.getStringCfg();
map.put(info.getTableName(), resultStringCfg);
}
if(mainTable.equals(info.getTableName())){
this.setPropertiesToMultipleCfg(resultCfg, resultStringCfg,"update");
}
}
}else if(Constants.TABLE_TYPE_NUMBER==type){
NumBoundaryCfg searchNumCfg=new NumBoundaryCfg();
searchNumCfg.setTableName(info.getTableName());
searchNumCfg.setCompileId(compileId);
NumBoundaryCfg resultNumCfg=numCfgService.get(searchNumCfg);
if(resultNumCfg!=null){
if(resultCfg.getNumCfg()==null){
Map<String,NumBoundaryCfg> map=new HashMap<String,NumBoundaryCfg>();
map.put(info.getTableName(), resultNumCfg);
resultCfg.setNumCfg(map);
}else{
Map<String,NumBoundaryCfg> map=resultCfg.getNumCfg();
map.put(info.getTableName(), resultNumCfg);
}
if(mainTable.equals(info.getTableName())){
this.setPropertiesToMultipleCfg(resultCfg, resultNumCfg,"update");
}
}
}else if(Constants.TABLE_TYPE_COMPLEX==type){
ComplexkeywordCfg searchComplexCfg=new ComplexkeywordCfg();
searchComplexCfg.setTableName(info.getTableName());
searchComplexCfg.setCompileId(compileId);
ComplexkeywordCfg resultComplexCfg=complexStringCfgService.get(searchComplexCfg);
if(resultComplexCfg!=null){
if(resultCfg.getComplexCfg()==null){
Map<String,ComplexkeywordCfg> map=new HashMap<String,ComplexkeywordCfg>();
map.put(info.getTableName(), resultComplexCfg);
resultCfg.setComplexCfg(map);
}else{
Map<String,ComplexkeywordCfg> map=resultCfg.getComplexCfg();
map.put(info.getTableName(), resultComplexCfg);
}
if(mainTable.equals(info.getTableName())){
this.setPropertiesToMultipleCfg(resultCfg, resultComplexCfg,"update");
}
}
// List<SysDictInfo> districts=sysDictInfoService.getDistrictDict(tableName);
// model.addAttribute("districts", districts);
}
}
model.addAttribute("_cfg", resultCfg);
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
model.addAttribute("requestInfos", requestInfos);
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
model.addAttribute("fls", fls);
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
model.addAttribute("xzs", xzs);
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
model.addAttribute("lables", lables);
return "/cfg/multipleCfgForm";
}
@RequestMapping(value = {"deleteCfg"})
public String deleteCfg(String cfgName,MultipleCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
model.addAttribute("operator", "delete");
model.addAttribute("cfgName", cfgName);
model.addAttribute("cfgType", "multiple");
model.addAttribute("serviceId", cfg.getServiceId());
model.addAttribute("action", cfg.getAction());
model.addAttribute("audit", Constants.CFG_PAGE);
MultipleCfg resultCfg=new MultipleCfg();
String mainTable=cfg.getMainTable();
model.addAttribute("mainTable", mainTable);
resultCfg.setMainTable(mainTable);
String mainTableType=cfg.getMainTableType();
model.addAttribute("mainTableType", mainTableType);
model.addAttribute("mainTableDesc", cfg.getMainTableDesc());
resultCfg.setMainTableType(mainTableType);
resultCfg.setMainTableDesc(cfg.getMainTableDesc());
resultCfg.setAction(cfg.getAction());
int serviceId=cfg.getServiceId();
cfg.setServiceId(serviceId);
int compileId=cfg.getCompileId().intValue();
resultCfg.setCompileId(compileId);
List<ServiceConfigInfo> serviceConfigInfos=serviceConfigInfoService.findList(serviceId);
Date date=new Date();
for(ServiceConfigInfo info:serviceConfigInfos){
int type=info.getTableType();
if(Constants.TABLE_TYPE_IP==type){
BaseIpCfg searchIpCfg=new BaseIpCfg();
searchIpCfg.setTableName(info.getTableName());
searchIpCfg.setCompileId(compileId);
searchIpCfg.setIsValid(Constants.VALID_DEL);
searchIpCfg.setIsAudit(Constants.AUDIT_NOT_YET);
searchIpCfg.setEditorId(cfg.getCurrentUser().getId());
searchIpCfg.setEditTime(date);
if(resultCfg.getIpCfg()==null){
Map<String,BaseIpCfg> map=new HashMap<String,BaseIpCfg>();
map.put(info.getTableName(), searchIpCfg);
resultCfg.setIpCfg(map);
}else{
Map<String,BaseIpCfg> map=resultCfg.getIpCfg();
map.put(info.getTableName(), searchIpCfg);
}
}else if(Constants.TABLE_TYPE_STRING==type){
BaseStringCfg searchStringCfg=new BaseStringCfg();
searchStringCfg.setTableName(info.getTableName());
searchStringCfg.setCompileId(compileId);
searchStringCfg.setIsValid(Constants.VALID_DEL);
searchStringCfg.setIsAudit(Constants.AUDIT_NOT_YET);
searchStringCfg.setEditorId(cfg.getCurrentUser().getId());
searchStringCfg.setEditTime(date);
if(resultCfg.getStringCfg()==null){
Map<String,BaseStringCfg> map=new HashMap<String,BaseStringCfg>();
map.put(info.getTableName(), searchStringCfg);
resultCfg.setStringCfg(map);
}else{
Map<String,BaseStringCfg> map=resultCfg.getStringCfg();
map.put(info.getTableName(), searchStringCfg);
}
}else if(Constants.TABLE_TYPE_NUMBER==type){
NumBoundaryCfg searchNumCfg=new NumBoundaryCfg();
searchNumCfg.setTableName(info.getTableName());
searchNumCfg.setCompileId(compileId);
searchNumCfg.setIsValid(Constants.VALID_DEL);
searchNumCfg.setIsAudit(Constants.AUDIT_NOT_YET);
searchNumCfg.setEditorId(cfg.getCurrentUser().getId());
searchNumCfg.setEditTime(date);
if(resultCfg.getNumCfg()==null){
Map<String,NumBoundaryCfg> map=new HashMap<String,NumBoundaryCfg>();
map.put(info.getTableName(), searchNumCfg);
resultCfg.setNumCfg(map);
}else{
Map<String,NumBoundaryCfg> map=resultCfg.getNumCfg();
map.put(info.getTableName(), searchNumCfg);
}
}else if(Constants.TABLE_TYPE_COMPLEX==type){
ComplexkeywordCfg searchComplexCfg=new ComplexkeywordCfg();
searchComplexCfg.setTableName(info.getTableName());
searchComplexCfg.setCompileId(compileId);
searchComplexCfg.setIsValid(Constants.VALID_DEL);
searchComplexCfg.setIsAudit(Constants.AUDIT_NOT_YET);
searchComplexCfg.setEditorId(cfg.getCurrentUser().getId());
searchComplexCfg.setEditTime(date);
if(resultCfg.getComplexCfg()==null){
Map<String,ComplexkeywordCfg> map=new HashMap<String,ComplexkeywordCfg>();
map.put(info.getTableName(), searchComplexCfg);
resultCfg.setComplexCfg(map);
}else{
Map<String,ComplexkeywordCfg> map=resultCfg.getComplexCfg();
map.put(info.getTableName(), searchComplexCfg);
}
}
}
try{
multipleCfgService.deleteCfg(resultCfg);
}catch (Exception e) {
logger.error("删除失败");
addMessage(model,"delete_failed");
}
addMessage(model,"delete_success");
return "/cfg/resultPage";
}
/**
*
* saveOrUpdateCfg(保存配置)
* (这里描述这个方法适用条件 可选)
* @return
*String
* @exception
* @since 1.0.0
*/
@RequestMapping(value = {"saveOrUpdateCfg"})
public String saveOrUpdateCfg(String operator,String cfgName,Model model, MultipleCfg cfg) {
model.addAttribute("cfgName",cfgName);
model.addAttribute("action",cfg.getAction());
model.addAttribute("cfgType", "multiple");
model.addAttribute("audit", Constants.CFG_PAGE);
logger.info("saveOrUpdateCfg loaded");
int serviceId=cfg.getServiceId();
Date date=new Date();
String mainTable=cfg.getMainTable();
model.addAttribute("mainTable",mainTable);
model.addAttribute("serviceId",serviceId);
model.addAttribute("action",cfg.getAction());
try{
List<ServiceConfigInfo> serviceConfigInfos=serviceConfigInfoService.findList(cfg.getServiceId());
Integer compileId=0;
if(operator.equals("save")){
compileId=new ConvertTool().getCompileId();
}else if(operator.equals("update")){
compileId=cfg.getCompileId();
}
for(ServiceConfigInfo info:serviceConfigInfos){
if(Constants.TABLE_TYPE_IP==info.getTableType()){
if(cfg.getIpCfg()!=null){
for(Entry<String, BaseIpCfg> ipCfg:cfg.getIpCfg().entrySet()){
if(!isNull(ipCfg.getValue())){
ipCfg.getValue().setTableName(ipCfg.getKey());
ipCfg.getValue().setIsValid(Constants.VALID_NO);
ipCfg.getValue().setIsAudit(Constants.AUDIT_NOT_YET);
ipCfg.getValue().setCompileId(compileId);
setProperties(cfg,ipCfg.getValue());
if(ipCfg.getValue().getCfgId()==null){
ipCfg.getValue().setCreatorId(cfg.getCurrentUser().getId());
ipCfg.getValue().setCreateTime(date);
}else{
ipCfg.getValue().setEditorId(cfg.getCurrentUser().getId());
ipCfg.getValue().setEditTime(date);
}
}
}
}
}else if(Constants.TABLE_TYPE_STRING==info.getTableType()){
if(cfg.getStringCfg()!=null){
for(Entry<String, BaseStringCfg> stringCfg:cfg.getStringCfg().entrySet()){
if(!isNull(stringCfg.getValue())){
stringCfg.getValue().setTableName(stringCfg.getKey());
stringCfg.getValue().setIsValid(Constants.VALID_NO);
stringCfg.getValue().setIsAudit(Constants.AUDIT_NOT_YET);
stringCfg.getValue().setCompileId(compileId);
setProperties(cfg,stringCfg.getValue());
if(stringCfg.getValue().getCfgId()==null){
stringCfg.getValue().setCreatorId(cfg.getCurrentUser().getId());
stringCfg.getValue().setCreateTime(date);
}else{
stringCfg.getValue().setEditorId(cfg.getCurrentUser().getId());
stringCfg.getValue().setEditTime(date);
}
}
}
}
}else if(Constants.TABLE_TYPE_NUMBER==info.getTableType()){
if(cfg.getNumCfg()!=null){
for(Entry<String,NumBoundaryCfg> numCfg:cfg.getNumCfg().entrySet()){
if(!isNull(numCfg.getValue())){
numCfg.getValue().setTableName(numCfg.getKey());
numCfg.getValue().setIsValid(Constants.VALID_NO);
numCfg.getValue().setIsAudit(Constants.AUDIT_NOT_YET);
numCfg.getValue().setCompileId(compileId);
setProperties(cfg,numCfg.getValue());
if(numCfg.getValue().getCfgId()==null){
numCfg.getValue().setCreatorId(cfg.getCurrentUser().getId());
numCfg.getValue().setCreateTime(date);
}else{
numCfg.getValue().setEditorId(cfg.getCurrentUser().getId());
numCfg.getValue().setEditTime(date);
}
}
}
}
}else if(Constants.TABLE_TYPE_COMPLEX==info.getTableType()){
if(cfg.getComplexCfg()!=null){
for(Entry<String,ComplexkeywordCfg> complexCfg:cfg.getComplexCfg().entrySet()){
if(!isNull(complexCfg.getValue())){
complexCfg.getValue().setTableName(complexCfg.getKey());
complexCfg.getValue().setIsValid(Constants.VALID_NO);
complexCfg.getValue().setIsAudit(Constants.AUDIT_NOT_YET);
complexCfg.getValue().setCompileId(compileId);
setProperties(cfg,complexCfg.getValue());
if(complexCfg.getValue().getCfgId()==null){
complexCfg.getValue().setCreatorId(cfg.getCurrentUser().getId());
complexCfg.getValue().setCreateTime(date);
}else{
complexCfg.getValue().setEditorId(cfg.getCurrentUser().getId());
complexCfg.getValue().setEditTime(new Date());
}
}
}
}
}
}
if("save".equals(operator)){
multipleCfgService.addCfg(cfg);
}else if("update".equals(operator)){
multipleCfgService.updateCfg(cfg);
}
addMessage(model,"save_success");
}catch (Exception e) {
e.printStackTrace();
logger.error("保存失败!",e);
// TODO: handle exception
addMessage(model,"save_failed");
}
return "/cfg/resultPage";
}
/**
*
* auditIpCfg(审核IP配置)
* (审核流程只在审核页面)
* @return
*String
* @exception
* @since 1.0.0
*/
@RequestMapping(value = {"auditCfg"})
public String auditCfg(String cfgName,MultipleCfg cfg,Model model) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("audit", Constants.AUDIT_PAGE);
model.addAttribute("cfgType", "multiple");
model.addAttribute("serviceId", cfg.getServiceId());
model.addAttribute("action", cfg.getAction());
model.addAttribute("mainTable", cfg.getMainTable());
int compileId=cfg.getCompileId().intValue();
int audit=cfg.getIsAudit();
try{
MultipleCfg resultCfg=new MultipleCfg();
MultipleCfg searchCfg=new MultipleCfg();
searchCfg.setIsAudit(cfg.getIsAudit());
List<ServiceConfigInfo> serviceConfigInfos=serviceConfigInfoService.findList(cfg.getServiceId());
Date date=new Date();
for(ServiceConfigInfo info:serviceConfigInfos){
int type=info.getTableType();
String tableName=info.getTableName();
if(cfg.getMainTable().equals(tableName)){
model.addAttribute("mainTableType", String.valueOf(type));
model.addAttribute("mainTableDesc", info.getTableDesc());
}
if(Constants.TABLE_TYPE_IP==type){
BaseIpCfg searchIpCfg=new BaseIpCfg();
searchIpCfg.setTableName(tableName);
searchIpCfg.setCompileId(compileId);
//根据表名编译ID查询唯一结果
BaseIpCfg resultIpCfg=ipCfgService.get(searchIpCfg);
if(resultIpCfg!=null){
searchIpCfg.setAuditorId(searchIpCfg.getCurrentUser().getId());
searchIpCfg.setAuditTime(date);
searchIpCfg.setCfgId(resultIpCfg.getCfgId());
searchIpCfg.setIsAudit(audit);
if(audit==Constants.AUDIT_NOT_YES){//取消审核通过设置有效标志为0
searchIpCfg.setIsValid(Constants.VALID_NO);
if(resultIpCfg!=null){
resultIpCfg.setIsValid(Constants.VALID_NO);
resultIpCfg.setMaatTable(info.getMaatTable());
}
}else if(audit==Constants.AUDIT_YES){//审核通过设置有效标志为1
searchIpCfg.setIsValid(Constants.VALID_YES);
if(resultIpCfg!=null){
resultIpCfg.setIsValid(Constants.VALID_YES);
resultIpCfg.setMaatTable(info.getMaatTable());
}
}
//更新gwall库表数据
if(searchCfg.getIpCfg()==null){
Map<String,BaseIpCfg> map=new HashMap<String,BaseIpCfg>();
map.put(tableName, searchIpCfg);
searchCfg.setIpCfg(map);
}else{
Map<String,BaseIpCfg> map=searchCfg.getIpCfg();
map.put(tableName, searchIpCfg);
}
//传入maat数据
if(resultIpCfg!=null){
if(resultCfg.getIpCfg()==null){
Map<String,BaseIpCfg> map=new HashMap<String,BaseIpCfg>();
map.put(tableName, resultIpCfg);
resultCfg.setIpCfg(map);
}else{
Map<String,BaseIpCfg> map=resultCfg.getIpCfg();
map.put(tableName, resultIpCfg);
}
}
}
}else if(Constants.TABLE_TYPE_STRING==type){
BaseStringCfg searchStringCfg=new BaseStringCfg();
searchStringCfg.setTableName(tableName);
searchStringCfg.setCompileId(compileId);
//根据表名编译ID查询唯一结果
BaseStringCfg resultStringCfg=stringCfgService.get(searchStringCfg);
if(resultStringCfg!=null){
searchStringCfg.setAuditorId(searchStringCfg.getCurrentUser().getId());
searchStringCfg.setAuditTime(date);
searchStringCfg.setCfgId(resultStringCfg.getCfgId());
searchStringCfg.setIsAudit(audit);
if(audit==Constants.AUDIT_NOT_YES){//取消审核通过设置有效标志为0
searchStringCfg.setIsValid(Constants.VALID_NO);
if(resultStringCfg!=null){
resultStringCfg.setIsValid(Constants.VALID_NO);
resultStringCfg.setMaatTable(info.getMaatTable());
}
}else if(audit==Constants.AUDIT_YES){//审核通过设置有效标志为1
searchStringCfg.setIsValid(Constants.VALID_YES);
if(resultStringCfg!=null){
resultStringCfg.setIsValid(Constants.VALID_YES);
resultStringCfg.setMaatTable(info.getMaatTable());
}
}
//更新gwall库表数据
if(searchCfg.getStringCfg()==null){
Map<String,BaseStringCfg> map=new HashMap<String,BaseStringCfg>();
map.put(tableName, searchStringCfg);
searchCfg.setStringCfg(map);
}else{
Map<String,BaseStringCfg> map=searchCfg.getStringCfg();
map.put(tableName, searchStringCfg);
}
//传入maat数据
if(resultStringCfg!=null){
if(resultCfg.getStringCfg()==null){
Map<String,BaseStringCfg> map=new HashMap<String,BaseStringCfg>();
map.put(tableName, resultStringCfg);
resultCfg.setStringCfg(map);
}else{
Map<String,BaseStringCfg> map=resultCfg.getStringCfg();
map.put(tableName, resultStringCfg);
}
}
}
}else if(Constants.TABLE_TYPE_NUMBER==type){
NumBoundaryCfg searchNumCfg=new NumBoundaryCfg();
searchNumCfg.setTableName(tableName);
searchNumCfg.setCompileId(compileId);
NumBoundaryCfg resultNumCfg=numCfgService.get(searchNumCfg);
if(resultNumCfg!=null){
searchNumCfg.setAuditorId(searchNumCfg.getCurrentUser().getId());
searchNumCfg.setAuditTime(date);
searchNumCfg.setCfgId(resultNumCfg.getCfgId());
searchNumCfg.setIsAudit(audit);
if(audit==Constants.AUDIT_NOT_YES){//取消审核通过设置有效标志为0
searchNumCfg.setIsValid(Constants.VALID_NO);
if(resultNumCfg!=null){
resultNumCfg.setIsValid(Constants.VALID_NO);
resultNumCfg.setMaatTable(info.getMaatTable());
}
}else if(audit==Constants.AUDIT_YES){//审核通过设置有效标志为1
searchNumCfg.setIsValid(Constants.VALID_YES);
if(resultNumCfg!=null){
resultNumCfg.setIsValid(Constants.VALID_YES);
resultNumCfg.setMaatTable(info.getMaatTable());
}
}
//更新gwall库表数据
if(searchCfg.getNumCfg()==null){
Map<String,NumBoundaryCfg> map=new HashMap<String,NumBoundaryCfg>();
map.put(tableName, searchNumCfg);
searchCfg.setNumCfg(map);
}else{
Map<String,NumBoundaryCfg> map=searchCfg.getNumCfg();
map.put(tableName, searchNumCfg);
}
//传入maat数据
if(resultNumCfg!=null){
if(resultCfg.getNumCfg()==null){
Map<String,NumBoundaryCfg> map=new HashMap<String,NumBoundaryCfg>();
map.put(tableName, resultNumCfg);
resultCfg.setNumCfg(map);
}else{
Map<String,NumBoundaryCfg> map=resultCfg.getNumCfg();
map.put(tableName, resultNumCfg);
}
}
}
}else if(Constants.TABLE_TYPE_COMPLEX==type){
ComplexkeywordCfg searchComplexCfg=new ComplexkeywordCfg();
searchComplexCfg.setTableName(tableName);
searchComplexCfg.setCompileId(compileId);
ComplexkeywordCfg resultComplexCfg=complexStringCfgService.get(searchComplexCfg);
if(resultComplexCfg!=null){
searchComplexCfg.setAuditorId(searchComplexCfg.getCurrentUser().getId());
searchComplexCfg.setAuditTime(date);
searchComplexCfg.setCfgId(resultComplexCfg.getCfgId());
searchComplexCfg.setIsAudit(audit);
if(audit==Constants.AUDIT_NOT_YES){//取消审核通过设置有效标志为0
searchComplexCfg.setIsValid(Constants.VALID_NO);
if(resultComplexCfg!=null){
resultComplexCfg.setIsValid(Constants.VALID_NO);
resultComplexCfg.setMaatTable(info.getMaatTable());
}
}else if(audit==Constants.AUDIT_YES){//审核通过设置有效标志为1
searchComplexCfg.setIsValid(Constants.VALID_YES);
if(resultComplexCfg!=null){
resultComplexCfg.setIsValid(Constants.VALID_YES);
resultComplexCfg.setMaatTable(info.getMaatTable());
}
}
//更新gwall库表数据
if(searchCfg.getComplexCfg()==null){
Map<String,ComplexkeywordCfg> map=new HashMap<String,ComplexkeywordCfg>();
map.put(tableName, searchComplexCfg);
searchCfg.setComplexCfg(map);
}else{
Map<String,ComplexkeywordCfg> map=searchCfg.getComplexCfg();
map.put(tableName, searchComplexCfg);
}
//传入maat数据
if(resultComplexCfg!=null){
if(resultCfg.getComplexCfg()==null){
Map<String,ComplexkeywordCfg> map=new HashMap<String,ComplexkeywordCfg>();
map.put(tableName, resultComplexCfg);
resultCfg.setComplexCfg(map);
}else{
Map<String,ComplexkeywordCfg> map=resultCfg.getComplexCfg();
map.put(tableName, resultComplexCfg);
}
}
}
}
}
boolean result=multipleCfgService.auditCfg(resultCfg,searchCfg);
if(!result){
addMessage(model,"audit_failed");
}else{
addMessage(model,"audit_success");
}
}catch (Exception e) {
logger.error("审核失败",e);
addMessage(model,"audit_failed");
}
return "/cfg/resultPage";
}
/**
*
* getClassBean(通过表名获取类)
* (这里描述这个方法适用条件 可选)
* @param tableName 表名
* @param initDefaultValue 是否初始化bean的默认值
* @return
*BaseCfg
* @exception
* @since 1.0.0
*/
@SuppressWarnings("rawtypes")
protected BaseCfg getClassBean(String tableName,boolean initDefaultValue){
logger.info("table name is "+tableName);
String className=ipCfgService.getClassName(tableName);
logger.info("class name is "+className);
String packageName=BaseCfg.class.getPackage().getName();
//通过反射获得BaseCfg的子类的实例并调用子类的initDefaultValue初始化默认值
try {
Class clazz = Class.forName(packageName+"."+className);
BaseCfg cfg=(BaseCfg)clazz.newInstance();
cfg.setTableName(tableName);
if(initDefaultValue){
cfg.initDefaultValue();
}
return cfg;
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@SuppressWarnings("rawtypes")
protected boolean isNull(BaseCfg cfg) {
if(cfg==null)return true;
try {
Field[] fieldArray=cfg.getClass().getDeclaredFields();
for(Field field:fieldArray){
field.setAccessible(true);
if(field.get(cfg)!=null&&!"serialVersionUID".equals(field.getName())
&&!field.getName().endsWith("ShowName")&&!field.getName().endsWith("cfgDesc")){
return false;
}
}
} catch (IllegalArgumentException | IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
@SuppressWarnings("rawtypes")
protected void setPropertiesToMultipleCfg(MultipleCfg resultCfg,BaseCfg _cfg,String option){
resultCfg.setAction(_cfg.getAction());
resultCfg.setAreaEffectiveIds(_cfg.getAreaEffectiveIds());
resultCfg.setAttribute(_cfg.getAttribute());
resultCfg.setClassify(_cfg.getClassify());
resultCfg.setLable(_cfg.getLable());
resultCfg.setCompileId(_cfg.getCompileId());
resultCfg.setIsAreaEffective(_cfg.getIsAreaEffective());
resultCfg.setIsAudit(_cfg.getIsAudit());
resultCfg.setIsValid(_cfg.getIsValid());
resultCfg.setRequestId(_cfg.getRequestId());
resultCfg.setServiceId(_cfg.getServiceId());
resultCfg.setRequestName(_cfg.getRequestName());
if("select".equals(option)){//列表时设置以下属性
resultCfg.setCreatorId(_cfg.getCreatorId());
resultCfg.setCreatorName(_cfg.getCreatorName());
resultCfg.setCreateTime(_cfg.getCreateTime());
resultCfg.setEditorId(_cfg.getEditorId());
resultCfg.setEditorName(_cfg.getEditorName());
resultCfg.setEditTime(_cfg.getEditTime());
resultCfg.setAuditorId(_cfg.getAuditorId());
resultCfg.setAuditorName(_cfg.getAuditorName());
resultCfg.setAuditTime(_cfg.getAuditTime());
}
}
@SuppressWarnings("rawtypes")
protected void setProperties(MultipleSearchCfg source,BaseCfg cfg){
if(cfg!=null){
cfg.setIsValid(source.getIsValid());
cfg.setIsAudit(source.getIsAudit());
cfg.setAction(source.getAction());
cfg.setAreaEffectiveIds(source.getAreaEffectiveIds());
cfg.setAttribute(source.getAttribute());
cfg.setClassify(source.getClassify());
cfg.setLable(source.getLable());
cfg.setIsAreaEffective(source.getIsAreaEffective());
cfg.setRequestId(source.getRequestId());
cfg.setServiceId(source.getServiceId());
cfg.setCreatorId(source.getCreatorId());
cfg.setCreatorName(source.getCreatorName());
cfg.setCreateTime(source.getCreateTime());
cfg.setEditorId(source.getEditorId());
cfg.setEditorName(source.getEditorName());
cfg.setEditTime(source.getEditTime());
cfg.setAuditorId(source.getAuditorId());
cfg.setAuditorName(source.getAuditorName());
cfg.setAuditTime(source.getAuditTime());
cfg.setSeltype(source.getSeltype());
cfg.setSearch_create_time_start(source.getSearch_create_time_start());
cfg.setSearch_create_time_end(source.getSearch_create_time_end());
cfg.setSearch_edit_time_start(source.getSearch_edit_time_start());
cfg.setSearch_edit_time_end(source.getSearch_edit_time_end());
cfg.setSearch_audit_time_start(source.getSearch_audit_time_start());
cfg.setSearch_audit_time_end(source.getSearch_audit_time_end());
}
}
protected void setProperties(MultipleCfg source,BaseCfg cfg){
if(cfg!=null){
cfg.setAction(source.getAction());
cfg.setAreaEffectiveIds(source.getAreaEffectiveIds());
cfg.setAttribute(source.getAttribute());
cfg.setClassify(source.getClassify());
cfg.setLable(source.getLable());
cfg.setIsAreaEffective(source.getIsAreaEffective());
cfg.setRequestId(source.getRequestId());
cfg.setServiceId(source.getServiceId());
}
}
@SuppressWarnings("rawtypes")
protected void setPageProps(Page source,Page target){
target.setCount(source.getCount());
target.setPageNo(source.getPageNo());
target.setPageSize(source.getPageSize());
}
}