2018-06-23 12:37:09 +08:00
|
|
|
/**
|
|
|
|
|
*@Title: CommonController.java
|
|
|
|
|
*@Package com.nis.web.controller.configuration
|
|
|
|
|
*@Description TODO
|
|
|
|
|
*@author dell
|
|
|
|
|
*@date 2018年6月22日 下午6:35:37
|
|
|
|
|
*@version 版本号
|
|
|
|
|
*/
|
|
|
|
|
package com.nis.web.controller.configuration;
|
|
|
|
|
|
2018-07-01 15:32:27 +08:00
|
|
|
import java.util.ArrayList;
|
2018-06-23 12:37:09 +08:00
|
|
|
import java.util.Date;
|
2018-07-03 14:55:36 +08:00
|
|
|
import java.util.HashMap;
|
2018-10-15 10:14:01 +08:00
|
|
|
import java.util.Iterator;
|
2018-06-23 12:37:09 +08:00
|
|
|
import java.util.List;
|
2018-07-03 14:55:36 +08:00
|
|
|
import java.util.Map;
|
2018-07-02 16:04:41 +08:00
|
|
|
import java.util.Properties;
|
2018-06-23 12:37:09 +08:00
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
2018-10-15 10:14:01 +08:00
|
|
|
import org.apache.axis2.databinding.types.soapencoding.Array;
|
2018-06-23 12:37:09 +08:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2018-06-29 12:44:33 +08:00
|
|
|
import org.springframework.beans.BeanUtils;
|
2018-06-23 12:37:09 +08:00
|
|
|
import org.springframework.ui.Model;
|
2018-07-01 15:32:27 +08:00
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
2018-06-23 12:37:09 +08:00
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
2018-10-15 10:14:01 +08:00
|
|
|
import com.nis.domain.FunctionRegionDict;
|
|
|
|
|
import com.nis.domain.FunctionServiceDict;
|
2018-06-23 12:37:09 +08:00
|
|
|
import com.nis.domain.Page;
|
2018-07-03 14:55:36 +08:00
|
|
|
import com.nis.domain.basics.ServiceDictInfo;
|
2018-06-23 12:37:09 +08:00
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-10-15 10:14:01 +08:00
|
|
|
import com.nis.domain.configuration.CfgIndexInfo;
|
|
|
|
|
import com.nis.domain.configuration.HttpBodyCfg;
|
|
|
|
|
import com.nis.domain.configuration.HttpReqHeadCfg;
|
|
|
|
|
import com.nis.domain.configuration.HttpResHeadCfg;
|
2018-06-23 14:34:27 +08:00
|
|
|
import com.nis.domain.configuration.HttpUrlCfg;
|
2018-10-15 10:14:01 +08:00
|
|
|
import com.nis.domain.configuration.template.IpAllTemplate;
|
2018-07-27 10:16:32 +08:00
|
|
|
import com.nis.domain.configuration.template.IpCfgTemplate;
|
2018-10-15 10:14:01 +08:00
|
|
|
import com.nis.domain.specific.ConfigGroupInfo;
|
2018-06-23 12:37:09 +08:00
|
|
|
import com.nis.domain.configuration.IpPortCfg;
|
2018-10-15 10:14:01 +08:00
|
|
|
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
2018-06-23 12:37:09 +08:00
|
|
|
import com.nis.exceptions.MaatConvertException;
|
|
|
|
|
import com.nis.util.Constants;
|
2018-07-03 14:55:36 +08:00
|
|
|
import com.nis.util.DateUtils;
|
2018-10-15 10:14:01 +08:00
|
|
|
import com.nis.util.DictUtils;
|
2018-07-03 14:55:36 +08:00
|
|
|
import com.nis.util.StringUtil;
|
|
|
|
|
import com.nis.util.excel.ExportExcel;
|
2018-07-01 15:32:27 +08:00
|
|
|
import com.nis.util.excel.ImportExcel;
|
2018-06-23 12:37:09 +08:00
|
|
|
import com.nis.web.controller.BaseController;
|
2018-07-01 15:32:27 +08:00
|
|
|
import com.nis.web.dao.configuration.IpCfgDao;
|
2018-10-15 10:14:01 +08:00
|
|
|
import com.nis.web.security.UserUtils;
|
2018-06-23 12:37:09 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ClassName: CommonController.java
|
|
|
|
|
* @Description: TODO
|
|
|
|
|
* @author (dell)
|
|
|
|
|
* @date 2018年6月22日 下午6:35:37
|
|
|
|
|
* @version V1.0
|
|
|
|
|
*/
|
|
|
|
|
public class CommonController extends BaseController {
|
2018-06-23 14:34:27 +08:00
|
|
|
public void _ipList(String cfgName,Model model,IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
2018-06-23 12:37:09 +08:00
|
|
|
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);
|
|
|
|
|
}
|
2018-06-23 14:34:27 +08:00
|
|
|
public void _domainList(String cfgName,Model model,HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
|
|
|
|
cfg.setTableName(HttpUrlCfg.getTablename());
|
2018-06-29 12:44:33 +08:00
|
|
|
Page<HttpUrlCfg> searchPage=new Page<HttpUrlCfg>(request,response,"r");
|
|
|
|
|
Page<HttpUrlCfg> page = domainService.findPage(searchPage, cfg);
|
2018-06-23 14:34:27 +08:00
|
|
|
model.addAttribute("page", page);
|
|
|
|
|
initPageCondition(model,cfg);
|
|
|
|
|
}
|
|
|
|
|
public void _ipForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
2018-06-23 12:37:09 +08:00
|
|
|
if(StringUtils.isNotBlank(ids)){
|
|
|
|
|
entity = ipCfgService.getIpCfgById(IpPortCfg.getTablename(),Long.parseLong(ids));
|
|
|
|
|
}
|
|
|
|
|
if(entity.getCfgId()!=null){
|
|
|
|
|
model.addAttribute("_cfg", entity);
|
|
|
|
|
initUpdateFormCondition(model,entity);
|
|
|
|
|
}else{
|
|
|
|
|
IpPortCfg cfg=new IpPortCfg();
|
|
|
|
|
cfg.initDefaultValueImpl();
|
|
|
|
|
cfg.setFunctionId(entity.getFunctionId());
|
|
|
|
|
cfg.setProtocolId(entity.getProtocolId());
|
|
|
|
|
model.addAttribute("_cfg", cfg);
|
|
|
|
|
initFormCondition(model,entity);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
public void _domainForm(String cfgName,Model model,String ids,Integer functionId,HttpUrlCfg entity) {
|
2018-06-23 14:34:27 +08:00
|
|
|
model.addAttribute("cfgName", cfgName);
|
|
|
|
|
if(StringUtils.isNotBlank(ids)){
|
2018-06-29 12:44:33 +08:00
|
|
|
entity = domainService.getStringCfgById(Long.parseLong(ids));
|
2018-06-23 14:34:27 +08:00
|
|
|
}
|
|
|
|
|
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);
|
2018-06-23 12:37:09 +08:00
|
|
|
Date date=new Date();
|
|
|
|
|
cfg.setTableName(IpPortCfg.getTablename());
|
|
|
|
|
logger.info("saveOrUpdateIp loaded");
|
|
|
|
|
try{
|
|
|
|
|
cfg.setIsValid(Constants.VALID_NO);
|
|
|
|
|
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
|
|
|
if(cfg.getCfgId()==null){//新增
|
|
|
|
|
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
|
|
|
|
cfg.setCreateTime(date);
|
|
|
|
|
ipCfgService.addIpCfg(cfg);
|
|
|
|
|
}else{//修改
|
|
|
|
|
cfg.setEditorId(cfg.getCurrentUser().getId());
|
|
|
|
|
cfg.setEditTime(new Date());
|
|
|
|
|
ipCfgService.updateIpCfg(cfg);
|
|
|
|
|
}
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(model,"success","save_success");
|
2018-06-23 12:37:09 +08:00
|
|
|
}catch(Exception e){
|
|
|
|
|
logger.error("保存失败",e);
|
2018-11-05 16:45:26 +08:00
|
|
|
if(e instanceof MaatConvertException) {
|
|
|
|
|
addMessage(model,"error", "request_service_failed");
|
|
|
|
|
}else {
|
|
|
|
|
addMessage(model,"error","save_failed");
|
|
|
|
|
}
|
2018-06-23 12:37:09 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-23 14:34:27 +08:00
|
|
|
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);
|
2018-06-29 12:44:33 +08:00
|
|
|
domainService.addStringCfg(cfg);
|
2018-06-23 14:34:27 +08:00
|
|
|
}else{//修改
|
|
|
|
|
cfg.setEditorId(cfg.getCurrentUser().getId());
|
|
|
|
|
cfg.setEditTime(new Date());
|
2018-06-29 12:44:33 +08:00
|
|
|
domainService.updateStringCfg(cfg);
|
2018-06-23 14:34:27 +08:00
|
|
|
}
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(model,"success","save_success");
|
2018-06-23 14:34:27 +08:00
|
|
|
}catch(Exception e){
|
|
|
|
|
logger.error("保存失败",e);
|
2018-11-05 15:43:12 +08:00
|
|
|
if(e instanceof MaatConvertException) {
|
|
|
|
|
addMessage(model,"error", "request_service_failed");
|
|
|
|
|
}else {
|
|
|
|
|
addMessage(model,"error", "save_failed");
|
|
|
|
|
}
|
2018-06-23 14:34:27 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void _deleteIp(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
2018-06-23 12:37:09 +08:00
|
|
|
try{
|
|
|
|
|
ipCfgService.deleteIp(ids,compileIds,functionId.intValue());
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(model,"success","delete_success");
|
2018-06-23 12:37:09 +08:00
|
|
|
}catch(Exception e){
|
|
|
|
|
logger.error("删除失败", e);
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(model,"error","delete_failed");
|
2018-06-23 12:37:09 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-23 14:34:27 +08:00
|
|
|
public void _deleteDomain(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
|
|
|
|
model.addAttribute("cfgName", cfgName);
|
|
|
|
|
try{
|
2018-06-29 12:44:33 +08:00
|
|
|
domainService.deleteDomain(ids,compileIds,functionId.intValue());
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(model,"success","delete_success");
|
2018-06-23 14:34:27 +08:00
|
|
|
}catch(Exception e){
|
|
|
|
|
logger.error("删除失败", e);
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(model,"error","delete_failed");
|
2018-06-23 14:34:27 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void _auditIp(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
|
|
|
|
redirectAttributes.addAttribute("cfgName", cfgName);
|
2018-06-23 12:37:09 +08:00
|
|
|
try{
|
|
|
|
|
for(String id:ids.split(",")){
|
|
|
|
|
Long.parseLong(id);
|
|
|
|
|
}
|
|
|
|
|
List<BaseIpCfg> beans=ipCfgService.getListByCfgId(IpPortCfg.getTablename(),cfg.getFunctionId().intValue(),ids);
|
|
|
|
|
Date date=new Date();
|
|
|
|
|
for(BaseIpCfg bean:beans){
|
|
|
|
|
bean.setTableName(IpPortCfg.getTablename());
|
|
|
|
|
bean.setAuditorId(bean.getCurrentUser().getId());
|
|
|
|
|
bean.setAuditTime(date);
|
|
|
|
|
bean.setIsAudit(cfg.getIsAudit());
|
|
|
|
|
bean.setIsValid(cfg.getIsValid());
|
|
|
|
|
ipCfgService.audit(bean);
|
|
|
|
|
}
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(redirectAttributes,"success","audit_success");
|
2018-06-23 12:37:09 +08:00
|
|
|
}catch(MaatConvertException e){
|
|
|
|
|
logger.error("审核失败", e);
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(redirectAttributes,"error","request_service_failed");
|
2018-06-23 12:37:09 +08:00
|
|
|
}catch(Exception e){
|
|
|
|
|
logger.error("审核失败", e);
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(redirectAttributes,"error","audit_failed");
|
2018-06-23 12:37:09 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-23 14:34:27 +08:00
|
|
|
public void _auditDomain(String ids,HttpUrlCfg cfg,RedirectAttributes redirectAttributes) {
|
|
|
|
|
try{
|
|
|
|
|
for(String id:ids.split(",")){
|
|
|
|
|
Long.parseLong(id);
|
|
|
|
|
}
|
2018-06-29 12:44:33 +08:00
|
|
|
List<HttpUrlCfg> beans=domainService.getListByCfgId(ids);
|
2018-06-23 14:34:27 +08:00
|
|
|
Date date=new Date();
|
2018-06-29 12:44:33 +08:00
|
|
|
for(HttpUrlCfg bean:beans){
|
|
|
|
|
HttpUrlCfg domain=new HttpUrlCfg();
|
|
|
|
|
BeanUtils.copyProperties(bean, domain);
|
|
|
|
|
domain.setTableName(HttpUrlCfg.getTablename());
|
|
|
|
|
domain.setAuditorId(bean.getCurrentUser().getId());
|
|
|
|
|
domain.setAuditTime(date);
|
|
|
|
|
domain.setIsAudit(cfg.getIsAudit());
|
|
|
|
|
domain.setIsValid(cfg.getIsValid());
|
|
|
|
|
domainService.auditDomain(domain);
|
2018-06-23 14:34:27 +08:00
|
|
|
}
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(redirectAttributes,"success","audit_success");
|
2018-06-23 14:34:27 +08:00
|
|
|
}catch(MaatConvertException e){
|
|
|
|
|
logger.error("审核失败", e);
|
2018-11-05 15:43:12 +08:00
|
|
|
addMessage(redirectAttributes,"error", "request_service_failed");
|
2018-06-23 14:34:27 +08:00
|
|
|
}catch(Exception e){
|
|
|
|
|
logger.error("审核失败", e);
|
2018-11-02 16:08:08 +08:00
|
|
|
addMessage(redirectAttributes,"error", "audit_failed");
|
2018-06-23 14:34:27 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-10-24 13:32:30 +08:00
|
|
|
/*public void _importIp(RedirectAttributes redirectAttributes,MultipartFile file,IpPortCfg ipCfg) {
|
2018-07-01 15:32:27 +08:00
|
|
|
try {
|
|
|
|
|
ImportExcel ei = new ImportExcel(file, 0, 0);
|
|
|
|
|
List<IpCfgTemplate> list = ei.getDataList(IpCfgTemplate.class);
|
2018-07-31 12:18:34 +08:00
|
|
|
this.checkIpCfg(ipCfg.getAction().intValue(),ipCfg.getFunctionId(),list);
|
2018-07-01 15:32:27 +08:00
|
|
|
List<BaseIpCfg> ipList = new ArrayList<>();
|
|
|
|
|
Date date=new Date();
|
|
|
|
|
for(IpCfgTemplate cfg : list){
|
|
|
|
|
IpPortCfg ip = new IpPortCfg();
|
|
|
|
|
BeanUtils.copyProperties(ipCfg, ip);
|
|
|
|
|
BeanUtils.copyProperties(cfg, ip);
|
|
|
|
|
ip.setTableName(IpPortCfg.getTablename());
|
|
|
|
|
ip.setIsAreaEffective(0);
|
|
|
|
|
ip.setIsValid(Constants.VALID_NO);
|
|
|
|
|
ip.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
|
|
|
ip.setCreatorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
ip.setCreateTime(date);
|
|
|
|
|
ip.setCompileId(ipCfgService.getCompileId());
|
|
|
|
|
ipList.add(ip);
|
|
|
|
|
}
|
|
|
|
|
ipCfgService.saveBatch(ipList, IpCfgDao.class);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
2018-10-24 13:32:30 +08:00
|
|
|
}*/
|
|
|
|
|
/*public void _importIp(String cfgName,RedirectAttributes redirectAttributes,MultipartFile file,IpPortCfg ipCfg,Class clazz) {
|
2018-07-27 10:16:32 +08:00
|
|
|
redirectAttributes.addAttribute("cfgName", cfgName);
|
|
|
|
|
try {
|
|
|
|
|
ImportExcel ei = new ImportExcel(file, 0, 0);
|
|
|
|
|
List<IpCfgTemplate> list = ei.getDataList(clazz);
|
2018-07-31 12:18:34 +08:00
|
|
|
this.checkIpCfg(ipCfg.getAction().intValue(),ipCfg.getFunctionId(),list);
|
2018-07-27 10:16:32 +08:00
|
|
|
List<BaseIpCfg> ipList = new ArrayList<>();
|
|
|
|
|
Date date=new Date();
|
|
|
|
|
for(IpCfgTemplate cfg : list){
|
|
|
|
|
IpPortCfg ip = new IpPortCfg();
|
|
|
|
|
BeanUtils.copyProperties(ipCfg, ip);
|
|
|
|
|
BeanUtils.copyProperties(cfg, ip);
|
|
|
|
|
ip.setTableName(IpPortCfg.getTablename());
|
|
|
|
|
ip.setIsAreaEffective(0);
|
|
|
|
|
ip.setIsValid(Constants.VALID_NO);
|
|
|
|
|
ip.setIsAudit(Constants.AUDIT_NOT_YET);
|
|
|
|
|
ip.setCreatorId(ipCfg.getCurrentUser().getId());
|
|
|
|
|
ip.setCreateTime(date);
|
|
|
|
|
ip.setCompileId(ipCfgService.getCompileId());
|
2018-07-30 18:14:22 +08:00
|
|
|
ip.setDnsStrategyId(cfg.getDnsStrategyId());
|
2018-07-27 10:16:32 +08:00
|
|
|
ipList.add(ip);
|
|
|
|
|
}
|
|
|
|
|
ipCfgService.saveBatch(ipList, IpCfgDao.class);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
addMessage(redirectAttributes, e.getMessage());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
2018-10-24 13:32:30 +08:00
|
|
|
}*/
|
2018-07-01 15:32:27 +08:00
|
|
|
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
|
|
|
|
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
|
|
|
|
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
|
|
|
|
}
|
2018-07-27 10:16:32 +08:00
|
|
|
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
|
|
|
|
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode,Class clazz) {
|
|
|
|
|
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,clazz);
|
|
|
|
|
}
|
2018-07-03 14:55:36 +08:00
|
|
|
//ip配置导出
|
2018-07-13 19:58:40 +08:00
|
|
|
public void _exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
2018-07-04 17:20:19 +08:00
|
|
|
IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
2018-07-03 14:55:36 +08:00
|
|
|
try {
|
|
|
|
|
//获取国际化配置
|
|
|
|
|
Properties msgProp = getMsgProp();
|
|
|
|
|
//获取分类、性质、标签
|
|
|
|
|
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
|
|
|
|
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
|
|
|
|
List<ServiceDictInfo> labels=serviceDictInfoService.findAllLableDict();
|
|
|
|
|
Map<Object, Object> map=new HashMap<Object, Object>();
|
|
|
|
|
map.put("fls", fls);
|
|
|
|
|
map.put("xzs", xzs);
|
|
|
|
|
map.put("labels", labels);
|
|
|
|
|
|
|
|
|
|
String fileName = msgProp.getProperty("date_list", "data")+"-"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
|
|
|
|
|
|
|
|
|
|
//导出选中记录
|
|
|
|
|
if(!StringUtil.isEmpty(ids)){
|
|
|
|
|
for(String id:ids.split(",")){
|
|
|
|
|
Long.parseLong(id);
|
|
|
|
|
}
|
|
|
|
|
List<BaseIpCfg> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
2018-07-13 19:58:40 +08:00
|
|
|
new ExportExcel(columns,msgProp,null, IpPortCfg.class,1).setDataList(columns,msgProp,list,map).write(response, fileName).dispose();
|
2018-07-03 14:55:36 +08:00
|
|
|
}else{
|
|
|
|
|
//条件导出数据大于最大导出数,只导出最大导出条数
|
|
|
|
|
entity.setTableName(IpPortCfg.getTablename());
|
|
|
|
|
Page<BaseIpCfg> pageInfo=new Page<BaseIpCfg>(request, response,"r");
|
|
|
|
|
if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){
|
|
|
|
|
pageInfo.setPageNo(1);
|
|
|
|
|
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
|
|
|
|
|
}else{
|
|
|
|
|
pageInfo.setPageNo(1);
|
|
|
|
|
pageInfo.setPageSize(-1);
|
|
|
|
|
}
|
|
|
|
|
Page<BaseIpCfg> page = ipCfgService.findPage(pageInfo, entity);
|
2018-07-13 19:58:40 +08:00
|
|
|
new ExportExcel(columns,msgProp,null, IpPortCfg.class,1).setDataList(columns,msgProp,page.getList(),map).write(response, fileName).dispose();
|
2018-07-03 14:55:36 +08:00
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
2018-11-05 16:45:26 +08:00
|
|
|
addMessage(redirectAttributes,"error", "export_failed" );
|
2018-07-03 14:55:36 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-23 12:37:09 +08:00
|
|
|
}
|