Merge remote-tracking branch 'origin/master'

This commit is contained in:
zer0Black
2023-11-26 12:00:47 +08:00
94 changed files with 577 additions and 513 deletions
@@ -178,16 +178,23 @@
</dependency> </dependency>
<!-- AutoPoi Excel工具类--> <!-- AutoPoi Excel工具类-->
<!-- <dependency>-->
<!-- <groupId>org.jeecgframework</groupId>-->
<!-- <artifactId>autopoi-web</artifactId>-->
<!-- <version>${autopoi-web.version}</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>commons-codec</groupId>-->
<!-- <artifactId>commons-codec</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<!-- EasyPoi Excel工具类-->
<dependency> <dependency>
<groupId>org.jeecgframework</groupId> <groupId>cn.afterturn</groupId>
<artifactId>autopoi-web</artifactId> <artifactId>easypoi-spring-boot-starter</artifactId>
<version>${autopoi-web.version}</version> <version>4.4.0</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- mini文件存储服务 --> <!-- mini文件存储服务 -->
@@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -7,16 +7,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -70,13 +72,11 @@ public class JeroController<T, S extends IService<T>> {
} }
// Step.3 AutoPoi 导出Excel // Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下 mv.addObject(FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(CLASS, clazz); mv.addObject(CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title); ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
exportParams.setImageBasePath(upLoadPath); exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(PARAMS,exportParams); mv.addObject(PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList); mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv; return mv;
@@ -89,11 +89,10 @@ public class JeroController<T, S extends IService<T>> {
* @param object 实体类 * @param object 实体类
* @param clazz 实体类class * @param clazz 实体类class
* @param title 标题 * @param title 标题
* @param exportFields 导出字段自定义
* @param pageNum 每个sheet的数据条数 * @param pageNum 每个sheet的数据条数
* @param request * @param request
*/ */
protected ModelAndView exportXlsSheet(HttpServletRequest request, T object, Class<T> clazz, String title,String exportFields,Integer pageNum) { protected ModelAndView exportXlsSheet(HttpServletRequest request, T object, Class<T> clazz, String title,Integer pageNum) {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap()); QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -116,7 +115,8 @@ public class JeroController<T, S extends IService<T>> {
exportList = records; exportList = records;
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title+i,upLoadPath); ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title+i);
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
exportParams.setType(ExcelType.XSSF); exportParams.setType(ExcelType.XSSF);
//map.put("title",exportParams);//表格Title //map.put("title",exportParams);//表格Title
map.put(PARAMS,exportParams);//表格Title map.put(PARAMS,exportParams);//表格Title
@@ -125,23 +125,12 @@ public class JeroController<T, S extends IService<T>> {
listMap.add(map); listMap.add(map);
} }
// Step.4 AutoPoi 导出Excel // Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下 mv.addObject(FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.MAP_LIST, listMap); mv.addObject(NormalExcelConstants.MAP_LIST, listMap);
return mv; return mv;
} }
/**
* 根据权限导出excel,传入导出字段参数
*
* @param request
*/
protected ModelAndView exportXls(HttpServletRequest request, T object, Class<T> clazz, String title,String exportFields) {
ModelAndView mv = this.exportXls(request,object,clazz,title);
mv.addObject(NormalExcelConstants.EXPORT_FIELDS,exportFields);
return mv;
}
/** /**
* 获取对象ID * 获取对象ID
* *
@@ -172,8 +161,9 @@ public class JeroController<T, S extends IService<T>> {
// 获取上传文件对象 // 获取上传文件对象
MultipartFile file = entity.getValue(); MultipartFile file = entity.getValue();
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
/*params.setTitleRows(2); params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setHeadRows(1);*/ params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
try { try {
List<T> list = ExcelImportUtil.importExcel(file.getInputStream(), clazz, params); List<T> list = ExcelImportUtil.importExcel(file.getInputStream(), clazz, params);
@@ -187,7 +177,7 @@ public class JeroController<T, S extends IService<T>> {
return Results.OK("文件导入成功!数据行数:" + list.size()); return Results.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return Results.error("文件导入失败:" + e.getMessage()); return Results.error("文件导入失败,请联系管理员");
} finally { } finally {
try { try {
file.getInputStream().close(); file.getInputStream().close();
@@ -1,7 +1,7 @@
package com.jero.common.system.base.entity; package com.jero.common.system.base.entity;
import java.io.Serializable; import java.io.Serializable;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
@@ -1,5 +1,6 @@
package com.jero.common.system.vo; package com.jero.common.system.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@@ -7,7 +8,6 @@ import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@@ -58,7 +58,7 @@ public class SysDictItemCore implements Serializable {
/** /**
* 排序 * 排序
*/ */
@Excel(name = "排序", width = 15,type=4) @Excel(name = "排序", width = 15, type = 10)
private Integer sortOrder; private Integer sortOrder;
@@ -11,6 +11,7 @@ import java.util.regex.Pattern;
import javax.sql.DataSource; import javax.sql.DataSource;
import cn.afterturn.easypoi.util.PoiPublicUtil;
import cn.hutool.crypto.asymmetric.KeyType; import cn.hutool.crypto.asymmetric.KeyType;
import cn.hutool.crypto.asymmetric.RSA; import cn.hutool.crypto.asymmetric.RSA;
import com.jero.common.constant.CommonConstant; import com.jero.common.constant.CommonConstant;
@@ -18,7 +19,6 @@ import com.jero.common.constant.DataBaseConstant;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.util.filter.FileTypeFilter; import com.jero.common.util.filter.FileTypeFilter;
import com.jero.common.util.oss.OssBootUtil; import com.jero.common.util.oss.OssBootUtil;
import org.jeecgframework.poi.util.PoiPublicUtil;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -360,7 +360,7 @@ public class oConvertUtils {
/** /**
* SET转换MAP * SET转换MAP
* *
* @param str * @param setobj
* @return * @return
*/ */
public static Map<Object, Object> SetToMap(Set<Object> setobj) { public static Map<Object, Object> SetToMap(Set<Object> setobj) {
@@ -450,7 +450,7 @@ public class oConvertUtils {
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world,test_id->helloWorld,testId * 例如:hello_world,test_id->helloWorld,testId
* *
* @param name * @param names
* 转换前的下划线大写方式命名的字符串 * 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
*/ */
@@ -524,28 +524,6 @@ public class oConvertUtils {
return sb.toString().toLowerCase(); return sb.toString().toLowerCase();
} }
/**
* 随机数
* @param place 定义随机数的位数
*/
public static String randomGen(int place) {
String base = "qwertyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKLOP0123456789";
StringBuilder sb = new StringBuilder();
Random rd = null;
try {
rd = SecureRandom.getInstanceStrong();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
if(Objects.isNull(rd)){
return null;
}
for(int i=0;i<place;i++) {
sb.append(base.charAt(rd.nextInt(base.length())));
}
return sb.toString();
}
/** /**
* 获取类的所有属性,包括父类 * 获取类的所有属性,包括父类
* *
@@ -1,28 +1,28 @@
package com.jero.config; //package com.jero.config;
//
import org.jeecgframework.core.util.ApplicationContextUtil; //import org.jeecgframework.core.util.ApplicationContextUtil;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
//
/** ///**
* @Author: Scott // * @Author: Scott
* @Date: 2018/2/7 // * @Date: 2018/2/7
* @description: autopoi 配置类 // * @description: autopoi 配置类
*/ // */
//
@Configuration //@Configuration
public class AutoPoiConfig { //public class AutoPoiConfig {
//
/** // /**
* excel注解字典参数支持(导入导出字典值,自动翻译) // * excel注解字典参数支持(导入导出字典值,自动翻译)
* 举例: @Excel(name = "性别", width = 15, dicCode = "sex") // * 举例: @Excel(name = "性别", width = 15, dicCode = "sex")
* 1、导出的时候会根据字典配置,把值1,2翻译成:男、女; // * 1、导出的时候会根据字典配置,把值1,2翻译成:男、女;
* 2、导入的时候,会把男、女翻译成1,2存进数据库; // * 2、导入的时候,会把男、女翻译成1,2存进数据库;
* @return // * @return
*/ // */
@Bean // @Bean
public ApplicationContextUtil applicationContextUtil() { // public ApplicationContextUtil applicationContextUtil() {
return new org.jeecgframework.core.util.ApplicationContextUtil(); // return new org.jeecgframework.core.util.ApplicationContextUtil();
} // }
//
} //}
@@ -1,65 +1,65 @@
package com.jero.config; //package com.jero.config;
//
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import com.jero.common.api.CommonAPI; //import com.jero.common.api.CommonAPI;
import com.jero.common.system.vo.DictModel; //import com.jero.common.system.vo.DictModel;
import com.jero.common.util.oConvertUtils; //import com.jero.common.util.oConvertUtils;
import org.jeecgframework.dict.service.AutoPoiDictServiceI; //import org.jeecgframework.dict.service.AutoPoiDictServiceI;
import org.springframework.context.annotation.Lazy; //import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import javax.annotation.Resource; //import javax.annotation.Resource;
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
/** ///**
* 描述:AutoPoi Excel注解支持字典参数设置 // * 描述:AutoPoi Excel注解支持字典参数设置
* 举例: @Excel(name = "性别", width = 15, dicCode = "sex") // * 举例: @Excel(name = "性别", width = 15, dicCode = "sex")
* 1、导出的时候会根据字典配置,把值1,2翻译成:男、女; // * 1、导出的时候会根据字典配置,把值1,2翻译成:男、女;
* 2、导入的时候,会把男、女翻译成1,2存进数据库; // * 2、导入的时候,会把男、女翻译成1,2存进数据库;
* // *
* @Author:scott // * @Author:scott
* @since2019-04-09 // * @since2019-04-09
* @Version:1.0 // * @Version:1.0
*/ // */
@Slf4j //@Slf4j
@Service //@Service
public class AutoPoiDictConfig implements AutoPoiDictServiceI { //public class AutoPoiDictConfig implements AutoPoiDictServiceI {
@Lazy // @Lazy
@Resource // @Resource
private CommonAPI commonAPI; // private CommonAPI commonAPI;
//
/** // /**
* 通过字典查询easypoi,所需字典文本 // * 通过字典查询easypoi,所需字典文本
* // *
* @Author:scott // * @Author:scott
* @since2019-04-09 // * @since2019-04-09
* @return // * @return
*/ // */
@Override // @Override
public String[] queryDict(String dicTable, String dicCode, String dicText) { // public String[] queryDict(String dicTable, String dicCode, String dicText) {
List<String> dictReplaces = new ArrayList<>(); // List<String> dictReplaces = new ArrayList<>();
List<DictModel> dictList = null; // List<DictModel> dictList = null;
// step.1 如果没有字典表则使用系统字典表 // // step.1 如果没有字典表则使用系统字典表
if (oConvertUtils.isEmpty(dicTable)) { // if (oConvertUtils.isEmpty(dicTable)) {
dictList = commonAPI.queryDictItemsByCode(dicCode); // dictList = commonAPI.queryDictItemsByCode(dicCode);
} else { // } else {
try { // try {
dicText = oConvertUtils.getString(dicText, dicCode); // dicText = oConvertUtils.getString(dicText, dicCode);
dictList = commonAPI.queryTableDictItemsByCode(dicTable, dicText, dicCode); // dictList = commonAPI.queryTableDictItemsByCode(dicTable, dicText, dicCode);
} catch (Exception e) { // } catch (Exception e) {
log.error(e.getMessage(),e); // log.error(e.getMessage(),e);
} // }
} // }
for (DictModel t : dictList) { // for (DictModel t : dictList) {
if(t!=null){ // if(t!=null){
dictReplaces.add(t.getText() + "_" + t.getValue()); // dictReplaces.add(t.getText() + "_" + t.getValue());
} // }
} // }
if (!dictReplaces.isEmpty()) { // if (!dictReplaces.isEmpty()) {
log.info("---AutoPoi--Get_DB_Dict------"+ dictReplaces.toString()); // log.info("---AutoPoi--Get_DB_Dict------"+ dictReplaces.toString());
return dictReplaces.toArray(new String[dictReplaces.size()]); // return dictReplaces.toArray(new String[dictReplaces.size()]);
} // }
return new String[0]; // return new String[0];
} // }
} //}
@@ -0,0 +1,91 @@
package com.jero.config.easypoi;
import cn.afterturn.easypoi.handler.inter.IExcelDictHandler;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.jero.common.api.CommonAPI;
import com.jero.common.system.vo.DictModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 针对easypoi的@Excel的dict属性,做字典值转换的方法
* 需要进行字段转换必须使用:
* exportParams.setDictHandler(new EasyPoiDictHandlerImpl());
* 来实现转换处理
*/
@Slf4j
@Service
public class EasyPoiDictHandlerImpl implements IExcelDictHandler {
@Lazy
@Resource
private CommonAPI commonAPI;
@Override
public List<Map> getList(String dict) {
if (StrUtil.isEmpty(dict)) {
return null;
}
List<DictModel> dictList = commonAPI.queryDictItemsByCode(dict);
if (dictList != null && !dictList.isEmpty()){
List<Map> result = new ArrayList<>();
for (DictModel t : dictList) {
if(t!=null){
Map<String, String> map = new HashMap<>();
map.put("text", t.getText());
map.put("value", t.getValue());
result.add(map);
}
}
return result;
}
return null;
}
@Override
public String toName(String dict, Object obj, String name, Object value) {
if (ObjectUtil.isEmpty(value)) {
return null;
}
String valueStr = String.valueOf(value);
List<DictModel> dictList = commonAPI.queryDictItemsByCode(dict);
for (DictModel t : dictList) {
if(t!=null && valueStr.equals(t.getValue())){
return t.getText();
}
}
return null;
}
@Override
public String toValue(String dict, Object obj, String name, Object value) {
if (ObjectUtil.isEmpty(value)) {
return null;
}
String valueStr = String.valueOf(value);
List<DictModel> dictList = commonAPI.queryDictItemsByCode(dict);
for (DictModel t : dictList) {
if(t!=null && valueStr.equals(t.getText())){
return t.getValue();
}
}
return null;
}
}
@@ -10,7 +10,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ApiModel(description = "onl_auth_data", value = "onl_auth_data对象") @ApiModel(description = "onl_auth_data", value = "onl_auth_data对象")
@@ -11,7 +11,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ApiModel(description = "onl_auth_page", value = "onl_auth_page对象") @ApiModel(description = "onl_auth_page", value = "onl_auth_page对象")
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.io.Serializable; import java.io.Serializable;
@@ -17,6 +17,7 @@ import com.jero.common.util.BrowserUtils;
import com.jero.common.util.SpringContextUtils; import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.TokenUtils; import com.jero.common.util.TokenUtils;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.generater.modules.online.auth.service.IOnlAuthPageService; import com.jero.generater.modules.online.auth.service.IOnlAuthPageService;
import com.jero.generater.modules.online.cgform.converter.ConvertUtil; import com.jero.generater.modules.online.cgform.converter.ConvertUtil;
import com.jero.generater.modules.online.cgform.entity.OnlCgformEnhanceJs; import com.jero.generater.modules.online.cgform.entity.OnlCgformEnhanceJs;
@@ -40,11 +41,11 @@ import com.jero.generater.modules.online.config.util.DbTableUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.jeecgframework.poi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -566,8 +567,9 @@ public class OnlCgformApiController {
} }
List<ExcelExportEntity> var14 = getExcelExportEntities(var4, var7, fieldList, var12); List<ExcelExportEntity> var14 = getExcelExportEntities(var4, var7, fieldList, var12);
ExportParams exportParams = new ExportParams(null, var5);
Workbook var33 = ExcelExportUtil.exportExcel(new ExportParams(null, var5), var14, var12); exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
Workbook var33 = ExcelExportUtil.exportExcel(exportParams, var14, var12);
ServletOutputStream var34 = null; ServletOutputStream var34 = null;
getVar3(var2, var3, var4, var33, var34); getVar3(var2, var3, var4, var33, var34);
@@ -659,10 +661,9 @@ public class OnlCgformApiController {
while (var53.hasNext()) { while (var53.hasNext()) {
Entry<String, MultipartFile> var20 = var53.next(); Entry<String, MultipartFile> var20 = var53.next();
MultipartFile var21 = var20.getValue(); MultipartFile var21 = var20.getValue();
ImportParams var22 = new ImportParams(); ImportParams params = new ImportParams();
var22.setImageList(var12); params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
var22.setDataHanlder(new CgFormExcelHandler(var10, this.upLoadPath, this.uploadType)); List<Map<String, Object>> var23 = ExcelImportUtil.importExcel(var21.getInputStream(), Map.class, params);
List<Map<String, Object>> var23 = ExcelImportUtil.importExcel(var21.getInputStream(), Map.class, var22);
if (var23 != null) { if (var23 != null) {
Object var24 = ""; Object var24 = "";
ArrayList<Map<String, Object>> var25 = new ArrayList<>(); ArrayList<Map<String, Object>> var25 = new ArrayList<>();
@@ -899,7 +900,8 @@ public class OnlCgformApiController {
if ("image".equals(var1.get(var4).getFieldShowType())) { if ("image".equals(var1.get(var4).getFieldShowType())) {
var6.setType(2); var6.setType(2);
var6.setExportImageType(3); var6.setExportImageType(3);
var6.setImageBasePath(this.upLoadPath); // TODO 处理图片路径的问题
// var6.setImageBasePath(this.upLoadPath);
var6.setHeight(50.0D); var6.setHeight(50.0D);
var6.setWidth(60.0D); var6.setWidth(60.0D);
} else { } else {
@@ -5,11 +5,12 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl;
import cn.afterturn.easypoi.util.PoiPublicUtil;
import com.jero.common.system.api.ISysBaseAPI; import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.util.SpringContextUtils; import com.jero.common.util.SpringContextUtils;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField; import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
import org.jeecgframework.poi.handler.impl.ExcelDataHandlerDefaultImpl;
import org.jeecgframework.poi.util.PoiPublicUtil;
public class CgFormExcelHandler extends ExcelDataHandlerDefaultImpl { public class CgFormExcelHandler extends ExcelDataHandlerDefaultImpl {
Map<String, OnlCgformField> a; Map<String, OnlCgformField> a;
@@ -38,23 +39,6 @@ public class CgFormExcelHandler extends ExcelDataHandlerDefaultImpl {
return var2; return var2;
} }
@Override
public void setMapValue(Map<String, Object> map, String originKey, Object value) {
String var4 = this.a(originKey);
if (value instanceof Double) {
map.put(var4, PoiPublicUtil.doubleToString((Double)value));
} else if (value instanceof byte[]) {
byte[] var5 = ((byte[])value);
String var6 = CgformUtil.a(var5, this.c, this.d, this.e);
if (var6 != null) {
map.put(var4, var6);
}
} else {
map.put(var4, value == null ? "" : value.toString());
}
}
private String a(String var1) { private String a(String var1) {
return this.a.containsKey(var1) ? "$mainTable$" + this.a.get(var1).getDbFieldName() : "$subTable$" + var1; return this.a.containsKey(var1) ? "$mainTable$" + this.a.get(var1).getDbFieldName() : "$subTable$" + var1;
} }
@@ -29,7 +29,7 @@ import com.jero.generater.modules.online.config.util.DbTableUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -13,7 +13,9 @@ import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.DynamicDataSourceModel; import com.jero.common.system.vo.DynamicDataSourceModel;
import com.jero.common.util.BrowserUtils; import com.jero.common.util.BrowserUtils;
import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportHead; import com.jero.generater.modules.online.cgreport.entity.OnlCgreportHead;
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportItem; import com.jero.generater.modules.online.cgreport.entity.OnlCgreportItem;
import com.jero.generater.modules.online.cgreport.entity.OnlCgreportParam; import com.jero.generater.modules.online.cgreport.entity.OnlCgreportParam;
@@ -24,9 +26,9 @@ import com.jero.generater.modules.online.cgreport.util.SqlUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.jeecgframework.poi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -360,13 +362,12 @@ public class OnlCgreportAPI {
var53 = var12.get(var52); var53 = var12.get(var52);
((List)var53).add(var15); ((List)var53).add(var15);
} else { } else {
ExcelExportEntity var23 = new ExcelExportEntity(var52, var52, true); ExcelExportEntity var23 = new ExcelExportEntity(var52, var52);
var13.add(var23); var13.add(var23);
((List)var53).add(var15); ((List)var53).add(var15);
} }
var12.put(var52, var53); var12.put(var52, var53);
var16.setColspan(true);
} }
var13.add(var16); var13.add(var16);
@@ -382,8 +383,6 @@ public class OnlCgreportAPI {
Entry<String, Object> var39 = var37.next(); Entry<String, Object> var39 = var37.next();
var42 = var39.getKey(); var42 = var39.getKey();
List<String> var43 = (List)var39.getValue(); List<String> var43 = (List)var39.getValue();
getVar48(var13, var42, var43);
} }
if (!var36.isEmpty()) { if (!var36.isEmpty()) {
@@ -418,15 +417,6 @@ public class OnlCgreportAPI {
} }
} }
private void getVar48(ArrayList<ExcelExportEntity> var13, String var42, List<String> var43) {
for (ExcelExportEntity o : var13) {
ExcelExportEntity var48 = o;
if (var42.equals(var48.getName()) && var48.isColspan()) {
var48.setSubColumnList(var43);
}
}
}
private void getVar16(ExcelExportEntity var16, List<DictModel> var19) { private void getVar16(ExcelExportEntity var16, List<DictModel> var19) {
if (var19 != null && !var19.isEmpty()) { if (var19 != null && !var19.isEmpty()) {
ArrayList<String> var20 = new ArrayList<>(); ArrayList<String> var20 = new ArrayList<>();
@@ -464,13 +454,16 @@ public class OnlCgreportAPI {
var42 = new String(var4.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); var42 = new String(var4.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
var3.setHeader("content-disposition", "attachment;filename=" + var42 + ".xls"); var3.setHeader("content-disposition", "attachment;filename=" + var42 + ".xls");
} }
ExportParams exportParams = new ExportParams(null, var5);
Workbook var44 = ExcelExportUtil.exportExcel(new ExportParams(null, var5), var13, var9); exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
Workbook var44 = ExcelExportUtil.exportExcel(exportParams, var13, var9);
var41 = var3.getOutputStream(); var41 = var3.getOutputStream();
var44.write(var41); var44.write(var41);
} catch (Exception var33) { } catch (Exception var33) {
log.error("异常",var33); log.error("异常",var33);
} finally { } finally {
try { try {
if(var41 != null){var41.flush();var41.close();} if(var41 != null){var41.flush();var41.close();}
} catch (Exception var32) { } catch (Exception var32) {
@@ -154,10 +154,8 @@ public class JeroDemoController extends JeroController<JeroDemo, IJeroDemoServic
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
@PermissionData(pageComponent = "jero/JeroDemoList") @PermissionData(pageComponent = "jero/JeroDemoList")
public ModelAndView exportXls(HttpServletRequest request, JeroDemo jeroDemo) { public ModelAndView exportXls(HttpServletRequest request, JeroDemo jeroDemo) {
//获取导出表格字段
String exportFields = JeroDemoService.getExportFields();
//分sheet导出表格字段 //分sheet导出表格字段
return super.exportXlsSheet(request, jeroDemo, JeroDemo.class, "单表模型",exportFields,500); return super.exportXlsSheet(request, jeroDemo, JeroDemo.class, "单表模型",500);
} }
/** /**
@@ -7,6 +7,8 @@ import com.jero.common.api.vo.Results;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.SpringContextUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.demo.test.entity.JeroOrderCustomer; import com.jero.modules.demo.test.entity.JeroOrderCustomer;
import com.jero.modules.demo.test.entity.JeroOrderMain; import com.jero.modules.demo.test.entity.JeroOrderMain;
import com.jero.modules.demo.test.entity.JeroOrderTicket; import com.jero.modules.demo.test.entity.JeroOrderTicket;
@@ -18,11 +20,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -178,7 +180,7 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<JeroOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeroOrderMain, request.getParameterMap()); QueryWrapper<JeroOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeroOrderMain, request.getParameterMap());
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
//获取当前用户 //获取当前用户
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -202,7 +204,10 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
// 注解对象Class // 注解对象Class
mv.addObject(CLASS, JeroOrderMainPage.class); mv.addObject(CLASS, JeroOrderMainPage.class);
// 自定义表格参数 // 自定义表格参数
mv.addObject(PARAMS, new ExportParams("自定义导出Excel内容标题", "导出人:" + sysUser.getRealname(), "自定义Sheet名字")); ExportParams exportParams = new ExportParams("自定义导出Excel内容标题", "导出人:" + sysUser.getRealname(), "自定义Sheet名字");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(PARAMS, exportParams);
// 导出数据列表 // 导出数据列表
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
@@ -223,6 +228,7 @@ public class JeroOrderMainController extends JeroController<JeroOrderMain, IJero
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(2); params.setHeadRows(2);
params.setNeedSave(true); params.setNeedSave(true);
@@ -8,17 +8,19 @@ import com.jero.common.api.vo.Results;
import com.jero.common.api.vo.ResultConstant; import com.jero.common.api.vo.ResultConstant;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.demo.test.entity.JoaDemo; import com.jero.modules.demo.test.entity.JoaDemo;
import com.jero.modules.demo.test.service.IJoaDemoService; import com.jero.modules.demo.test.service.IJoaDemoService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -181,12 +183,14 @@ public class JoaDemoController {
} }
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
List<JoaDemo> pageList = joaDemoService.list(queryWrapper); List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
//导出文件名称 //导出文件名称
mv.addObject(JeroController.FILE_NAME, "流程测试列表"); mv.addObject(JeroController.FILE_NAME, "流程测试列表");
mv.addObject(JeroController.CLASS, JoaDemo.class); mv.addObject(JeroController.CLASS, JoaDemo.class);
mv.addObject(JeroController.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jero", "导出信息")); ExportParams exportParams = new ExportParams("流程测试列表数据", "导出人:Jero", "导出信息");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -206,6 +210,7 @@ public class JoaDemoController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -3,7 +3,7 @@ package com.jero.modules.demo.test.entity;
import java.io.Serializable; import java.io.Serializable;
import com.jero.common.system.base.entity.JeroEntity; import com.jero.common.system.base.entity.JeroEntity;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@@ -56,7 +56,7 @@ public class JeroDemo extends JeroEntity implements Serializable {
private java.lang.Double bonusMoney; private java.lang.Double bonusMoney;
/** 性别 {男:1,女:2} */ /** 性别 {男:1,女:2} */
@ApiModelProperty(value = "性别") @ApiModelProperty(value = "性别")
@Excel(name = "性别", width = 15, dicCode = "sex") @Excel(name = "性别", width = 15, dict = "sex")
private java.lang.String sex; private java.lang.String sex;
/** 年龄 */ /** 年龄 */
@ApiModelProperty(value = "年龄",example = "0") @ApiModelProperty(value = "年龄",example = "0")
@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
/** /**
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
/** /**
@@ -2,7 +2,7 @@ package com.jero.modules.demo.test.entity;
import java.io.Serializable; import java.io.Serializable;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
@@ -25,9 +25,4 @@ public interface IJeroDemoService extends JeroService<JeroDemo> {
*/ */
IPage<JeroDemo> queryListWithPermission(int pageSize, int pageNo); IPage<JeroDemo> queryListWithPermission(int pageSize, int pageNo);
/**
* 根据用户权限获取导出字段
* @return
*/
String getExportFields();
} }
@@ -81,33 +81,4 @@ public class JeroDemoServiceImpl extends ServiceImpl<JeroDemoMapper, JeroDemo> i
return this.baseMapper.queryListWithPermission(page, sql); return this.baseMapper.queryListWithPermission(page, sql);
} }
@Override
public String getExportFields() {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//权限配置列导出示例
//1.配置前缀与菜单中配置的列前缀一致
List<String> noAuthList = new ArrayList<>();
List<String> exportFieldsList = new ArrayList<>();
String permsPrefix = "testdemo:";
//查询配置菜单有效字段
List<String> allAuth = this.jeroDemoMapper.queryAllAuth(permsPrefix);
//查询已授权字段
List<String> userAuth = this.jeroDemoMapper.queryUserAuth(sysUser.getId(),permsPrefix);
//列出未授权字段
for(String perms : allAuth){
if(!userAuth.contains(perms)){
noAuthList.add(perms.substring(permsPrefix.length()));
}
}
//实体类中字段与未授权字段比较,列出需导出字段
Field[] fileds = JeroDemo.class.getDeclaredFields();
List<Field> list = new ArrayList<>(Arrays.asList(fileds));
for(Field field : list){
if(!noAuthList.contains(field.getName())){
exportFieldsList.add(field.getName());
}
}
return !exportFieldsList.isEmpty() ? String.join(",", exportFieldsList) : "";
}
} }
@@ -4,8 +4,8 @@ import java.util.List;
import com.jero.modules.demo.test.entity.JeroOrderCustomer; import com.jero.modules.demo.test.entity.JeroOrderCustomer;
import com.jero.modules.demo.test.entity.JeroOrderTicket; import com.jero.modules.demo.test.entity.JeroOrderTicket;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data; import lombok.Data;
@@ -2,7 +2,7 @@ package com.jero.modules.message.entity;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import com.jero.common.system.base.entity.JeroEntity; import com.jero.common.system.base.entity.JeroEntity;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@@ -1,7 +1,7 @@
package com.jero.modules.message.entity; package com.jero.modules.message.entity;
import com.jero.common.system.base.entity.JeroEntity; import com.jero.common.system.base.entity.JeroEntity;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@@ -5,7 +5,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.jero.common.system.base.entity.JeroEntity; import com.jero.common.system.base.entity.JeroEntity;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
@Data @Data
@TableName("oss_file") @TableName("oss_file")
@@ -9,6 +9,8 @@ import com.jero.common.constant.CommonConstant;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.common.util.ImportExcelUtil; import com.jero.common.util.ImportExcelUtil;
import com.jero.common.util.SpringContextUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.quartz.entity.QuartzJob; import com.jero.modules.quartz.entity.QuartzJob;
import com.jero.modules.quartz.service.IQuartzJobService; import com.jero.modules.quartz.service.IQuartzJobService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -16,11 +18,11 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.quartz.Scheduler; import org.quartz.Scheduler;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -204,12 +206,14 @@ public class QuartzJobController {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, request.getParameterMap()); QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, request.getParameterMap());
// Step.2 AutoPoi 导出Excel // Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
List<QuartzJob> pageList = quartzJobService.list(queryWrapper); List<QuartzJob> pageList = quartzJobService.list(queryWrapper);
// 导出文件名称 // 导出文件名称
mv.addObject(JeroController.FILE_NAME, "定时任务列表"); mv.addObject(JeroController.FILE_NAME, "定时任务列表");
mv.addObject(JeroController.CLASS, QuartzJob.class); mv.addObject(JeroController.CLASS, QuartzJob.class);
mv.addObject(JeroController.PARAMS, new ExportParams("定时任务列表数据", "导出人:Jero", "导出信息")); ExportParams exportParams = new ExportParams("定时任务列表数据", "导出人:Jero", "导出信息");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -232,6 +236,7 @@ public class QuartzJobController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -52,7 +52,7 @@ public class QuartzJob implements Serializable {
@Excel(name="描述",width=40) @Excel(name="描述",width=40)
private java.lang.String description; private java.lang.String description;
/**状态 0正常 -1停止*/ /**状态 0正常 -1停止*/
@Excel(name="状态",width=15,dicCode="quartz_status") @Excel(name="状态",width=15, dict="quartz_status")
@Dict(dicCode = "quartz_status") @Dict(dicCode = "quartz_status")
private java.lang.Integer status; private java.lang.Integer status;
@@ -10,7 +10,9 @@ import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.system.entity.SysCategory; import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.model.TreeSelectModel; import com.jero.modules.system.model.TreeSelectModel;
import com.jero.modules.system.service.ISysCategoryService; import com.jero.modules.system.service.ISysCategoryService;
@@ -19,11 +21,11 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -189,7 +191,7 @@ public class SysCategoryController {
QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap()); QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
List<SysCategory> pageList = sysCategoryService.list(queryWrapper); List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
// Step.2 AutoPoi 导出Excel // Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
// 过滤选中数据 // 过滤选中数据
String selections = request.getParameter("selections"); String selections = request.getParameter("selections");
if(oConvertUtils.isEmpty(selections)) { if(oConvertUtils.isEmpty(selections)) {
@@ -203,7 +205,9 @@ public class SysCategoryController {
mv.addObject(JeroController.FILE_NAME, "分类字典列表"); mv.addObject(JeroController.FILE_NAME, "分类字典列表");
mv.addObject(JeroController.CLASS, SysCategory.class); mv.addObject(JeroController.CLASS, SysCategory.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(JeroController.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息")); ExportParams exportParams = new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams);
return mv; return mv;
} }
@@ -12,8 +12,10 @@ import com.jero.common.system.util.JwtUtil;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.system.vo.SysDepartTreeModel; import com.jero.common.system.vo.SysDepartTreeModel;
import com.jero.common.util.ImportExcelUtil; import com.jero.common.util.ImportExcelUtil;
import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.YouBianCodeUtil; import com.jero.common.util.YouBianCodeUtil;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.system.entity.SysDepart; import com.jero.modules.system.entity.SysDepart;
import com.jero.modules.system.entity.SysUser; import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.mapper.SysDepartMapper; import com.jero.modules.system.mapper.SysDepartMapper;
@@ -25,11 +27,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
@@ -315,7 +317,7 @@ public class SysDepartController {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap()); QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
List<SysDepart> pageList = sysDepartService.list(queryWrapper); List<SysDepart> pageList = sysDepartService.list(queryWrapper);
//按字典排序 //按字典排序
Collections.sort(pageList,(SysDepart arg0, SysDepart arg1)-> arg0.getOrgCode().compareTo(arg1.getOrgCode())); Collections.sort(pageList,(SysDepart arg0, SysDepart arg1)-> arg0.getOrgCode().compareTo(arg1.getOrgCode()));
@@ -323,7 +325,9 @@ public class SysDepartController {
mv.addObject(JeroController.FILE_NAME, "部门列表"); mv.addObject(JeroController.FILE_NAME, "部门列表");
mv.addObject(JeroController.CLASS, SysDepart.class); mv.addObject(JeroController.CLASS, SysDepart.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(JeroController.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息")); ExportParams exportParams = new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -348,6 +352,7 @@ public class SysDepartController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -15,8 +15,10 @@ import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.ImportExcelUtil; import com.jero.common.util.ImportExcelUtil;
import com.jero.common.util.SpringContextUtils;
import com.jero.common.util.SqlInjectionUtil; import com.jero.common.util.SqlInjectionUtil;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.system.entity.SuccessAndErrorLines; import com.jero.modules.system.entity.SuccessAndErrorLines;
import com.jero.modules.system.entity.SysDict; import com.jero.modules.system.entity.SysDict;
import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysDictItem;
@@ -32,12 +34,11 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecgframework.poi.excel.ExcelImportCheckUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
@@ -440,14 +441,14 @@ public class SysDictController {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap()); QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
List<SysDictPage> pageList = new ArrayList<>(); List<SysDictPage> pageList = new ArrayList<>();
List<SysDict> sysDictList = sysDictService.list(queryWrapper); List<SysDict> sysDictList = sysDictService.list(queryWrapper);
for (SysDict dictMain : sysDictList) { for (SysDict dictMain : sysDictList) {
SysDictPage vo = new SysDictPage(); SysDictPage vo = new SysDictPage();
BeanUtils.copyProperties(dictMain, vo); BeanUtils.copyProperties(dictMain, vo);
// 查询机票 // 查询子列表
List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId()); List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId());
vo.setSysDictItemList(sysDictItemList); vo.setSysDictItemList(sysDictItemList);
pageList.add(vo); pageList.add(vo);
@@ -459,7 +460,9 @@ public class SysDictController {
mv.addObject(JeroController.CLASS, SysDictPage.class); mv.addObject(JeroController.CLASS, SysDictPage.class);
// 自定义表格参数 // 自定义表格参数
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(JeroController.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典")); ExportParams exportParams = new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams);
// 导出数据列表 // 导出数据列表
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
@@ -474,15 +477,11 @@ public class SysDictController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(2); params.setHeadRows(2);
params.setNeedSave(true); params.setNeedSave(true);
try { try {
//导入Excel格式校验,看匹配的字段文本概率
Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), SysDictPage.class, params);
if(Boolean.FALSE.equals(t)){
throw new JeroBootException("导入Excel校验失败 ");
}
List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params); List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params);
// 错误信息 // 错误信息
List<String> errorMessage = new ArrayList<>(); List<String> errorMessage = new ArrayList<>();
@@ -13,6 +13,8 @@ import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import com.jero.common.util.SpringContextUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -28,10 +30,10 @@ import com.jero.modules.system.service.ISysPermissionDataRuleService;
import com.jero.modules.system.service.ISysPermissionService; import com.jero.modules.system.service.ISysPermissionService;
import com.jero.modules.system.service.ISysRolePermissionService; import com.jero.modules.system.service.ISysRolePermissionService;
import com.jero.modules.system.service.ISysRoleService; import com.jero.modules.system.service.ISysRoleService;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -238,13 +240,15 @@ public class SysRoleController {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap()); QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
List<SysRole> pageList = sysRoleService.list(queryWrapper); List<SysRole> pageList = sysRoleService.list(queryWrapper);
//导出文件名称 //导出文件名称
mv.addObject(JeroController.FILE_NAME,"角色列表"); mv.addObject(JeroController.FILE_NAME,"角色列表");
mv.addObject(JeroController.CLASS,SysRole.class); mv.addObject(JeroController.CLASS,SysRole.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(JeroController.PARAMS,new ExportParams("角色列表数据","导出人:"+user.getRealname(),"导出信息")); ExportParams exportParams = new ExportParams("角色列表数据","导出人:"+user.getRealname(),"导出信息");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST,pageList); mv.addObject(NormalExcelConstants.DATA_LIST,pageList);
return mv; return mv;
} }
@@ -263,6 +267,7 @@ public class SysRoleController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -8,16 +8,18 @@ import com.jero.common.api.vo.Results;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.SpringContextUtils;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.system.entity.SysUserAgent; import com.jero.modules.system.entity.SysUserAgent;
import com.jero.modules.system.service.ISysUserAgentService; import com.jero.modules.system.service.ISysUserAgentService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -186,14 +188,14 @@ public class SysUserAgentController {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap()); QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper); List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
//导出文件名称 //导出文件名称
mv.addObject(JeroController.FILE_NAME, "用户代理人设置列表"); mv.addObject(JeroController.FILE_NAME, "用户代理人设置列表");
mv.addObject(JeroController.CLASS, SysUserAgent.class); mv.addObject(JeroController.CLASS, SysUserAgent.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ExportParams exportParams = new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息"); ExportParams exportParams = new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息");
exportParams.setImageBasePath(upLoadPath); exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams); mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
@@ -214,6 +216,7 @@ public class SysUserAgentController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -21,6 +21,7 @@ import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.util.JwtUtil; import com.jero.common.system.util.JwtUtil;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.*; import com.jero.common.util.*;
import com.jero.config.easypoi.EasyPoiDictHandlerImpl;
import com.jero.modules.base.service.BaseCommonService; import com.jero.modules.base.service.BaseCommonService;
import com.jero.modules.system.dto.SysUserDTO; import com.jero.modules.system.dto.SysUserDTO;
import com.jero.modules.system.dto.SysUserRoleDTO; import com.jero.modules.system.dto.SysUserRoleDTO;
@@ -40,11 +41,11 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -57,6 +58,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -210,7 +212,7 @@ public class SysUserController {
// 密码加盐 // 密码加盐
String password = CommonUtils.decryptBtRsaPriKey(user.getPassword(), rsaPrivateKey); String password = CommonUtils.decryptBtRsaPriKey(user.getPassword(), rsaPrivateKey);
user.setCreateTime(new Date());//设置创建时间 user.setCreateTime(new Date());//设置创建时间
String salt = oConvertUtils.randomGen(8); String salt = RandomUtil.randomString(8);
user.setSalt(salt); user.setSalt(salt);
String passwordEncode = PasswordUtil.encrypt(user.getUsername(), password, salt); String passwordEncode = PasswordUtil.encrypt(user.getUsername(), password, salt);
user.setPassword(passwordEncode); user.setPassword(passwordEncode);
@@ -516,7 +518,7 @@ public class SysUserController {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap()); QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
//update-begin--Author:kangxiaolin Date:20180825 for[03]用户导出,如果选择数据则只导出相关数据-------------------- //update-begin--Author:kangxiaolin Date:20180825 for[03]用户导出,如果选择数据则只导出相关数据--------------------
String selections = request.getParameter("selections"); String selections = request.getParameter("selections");
if(!oConvertUtils.isEmpty(selections)){ if(!oConvertUtils.isEmpty(selections)){
@@ -534,7 +536,7 @@ public class SysUserController {
mv.addObject(JeroController.CLASS, SysUser.class); mv.addObject(JeroController.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
ExportParams exportParams = new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息"); ExportParams exportParams = new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息");
exportParams.setImageBasePath(upLoadPath); exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(JeroController.PARAMS, exportParams); mv.addObject(JeroController.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
@@ -559,6 +561,7 @@ public class SysUserController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -571,7 +574,7 @@ public class SysUserController {
sysUserExcel.setPassword("hzwlsoft.com"); sysUserExcel.setPassword("hzwlsoft.com");
} }
// 密码加密加盐 // 密码加密加盐
String salt = oConvertUtils.randomGen(8); String salt = RandomUtil.randomString(8);
sysUserExcel.setSalt(salt); sysUserExcel.setSalt(salt);
String passwordEncode = PasswordUtil.encrypt(sysUserExcel.getUsername(), sysUserExcel.getPassword(), salt); String passwordEncode = PasswordUtil.encrypt(sysUserExcel.getUsername(), sysUserExcel.getPassword(), salt);
sysUserExcel.setPassword(passwordEncode); sysUserExcel.setPassword(passwordEncode);
@@ -695,19 +698,19 @@ public class SysUserController {
String oldpassword = json.getString("oldpassword"); String oldpassword = json.getString("oldpassword");
String password = json.getString("password"); String password = json.getString("password");
String confirmpassword = json.getString("confirmpassword"); String confirmpassword = json.getString("confirmpassword");
String RSAPublicKey = json.getString(RSA_PUBLIC_KEY); String rsaPublicKey = json.getString(RSA_PUBLIC_KEY);
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
if(!sysUser.getUsername().equals(username)){ if(!sysUser.getUsername().equals(username)){
return Results.error("只允许修改自己的密码!"); return Results.error("只允许修改自己的密码!");
} }
String RSAPrivateKey = String.valueOf(redisUtil.get(RSAPublicKey)); String rsaPrivateKey = String.valueOf(redisUtil.get(rsaPublicKey));
try { try {
oldpassword = CommonUtils.decryptBtRsaPriKey(oldpassword, RSAPrivateKey); oldpassword = CommonUtils.decryptBtRsaPriKey(oldpassword, rsaPrivateKey);
password = CommonUtils.decryptBtRsaPriKey(password, RSAPrivateKey); password = CommonUtils.decryptBtRsaPriKey(password, rsaPrivateKey);
confirmpassword = CommonUtils.decryptBtRsaPriKey(confirmpassword, RSAPrivateKey); confirmpassword = CommonUtils.decryptBtRsaPriKey(confirmpassword, rsaPrivateKey);
}catch (Exception e){ }catch (Exception e){
SysUserController.log.error(e.getMessage(),e); SysUserController.log.error(e.getMessage(),e);
} }
@@ -1025,7 +1028,7 @@ public class SysUserController {
try { try {
user.setCreateTime(new Date());// 设置创建时间 user.setCreateTime(new Date());// 设置创建时间
String salt = oConvertUtils.randomGen(8); String salt = RandomUtil.randomString(8);
String passwordEncode = PasswordUtil.encrypt(username, password, salt); String passwordEncode = PasswordUtil.encrypt(username, password, salt);
user.setSalt(salt); user.setSalt(salt);
user.setUsername(username); user.setUsername(username);
@@ -1105,7 +1108,7 @@ public class SysUserController {
result.setSuccess(false); result.setSuccess(false);
return result; return result;
} else { } else {
String salt = oConvertUtils.randomGen(8); String salt = RandomUtil.randomString(8);
sysUser.setSalt(salt); sysUser.setSalt(salt);
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt); String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt);
sysUser.setPassword(passwordEncode); sysUser.setPassword(passwordEncode);
@@ -1231,7 +1234,7 @@ public class SysUserController {
/** /**
* 彻底删除用户 * 彻底删除用户
* *
* @param userIds 被删除的用户ID,多个id用半角逗号分割 * @param sysUser
* @return * @return
*/ */
@PostMapping("/deleteRecycleBin") @PostMapping("/deleteRecycleBin")
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -58,26 +58,26 @@ public class SysAnnouncement implements Serializable {
/** /**
* 优先级(L低,M中,H高) * 优先级(L低,M中,H高)
*/ */
@Excel(name = "优先级", width = 15, dicCode = "priority") @Excel(name = "优先级", width = 15, dict = "priority")
@Dict(dicCode = "priority") @Dict(dicCode = "priority")
private java.lang.String priority; private java.lang.String priority;
/** /**
* 消息类型1:通知公告2:系统消息 * 消息类型1:通知公告2:系统消息
*/ */
@Excel(name = "消息类型", width = 15, dicCode = "msg_category") @Excel(name = "消息类型", width = 15, dict = "msg_category")
@Dict(dicCode = "msg_category") @Dict(dicCode = "msg_category")
private java.lang.String msgCategory; private java.lang.String msgCategory;
/** /**
* 通告对象类型(USER:指定用户,ALL:全体用户) * 通告对象类型(USER:指定用户,ALL:全体用户)
*/ */
@Excel(name = "通告对象类型", width = 15, dicCode = "msg_type") @Excel(name = "通告对象类型", width = 15, dict = "msg_type")
@Dict(dicCode = "msg_type") @Dict(dicCode = "msg_type")
private java.lang.String msgType; private java.lang.String msgType;
/** /**
* 发布状态(0未发布,1已发布,2已撤销) * 发布状态(0未发布,1已发布,2已撤销)
*/ */
@Excel(name = "发布状态", width = 15, dicCode = "send_status") @Excel(name = "发布状态", width = 15, dict = "send_status")
@Dict(dicCode = "send_status") @Dict(dicCode = "send_status")
private java.lang.String sendStatus; private java.lang.String sendStatus;
/** /**
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@@ -10,7 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
/** /**
@@ -54,7 +54,7 @@ public class SysDataSource {
* 数据库类型 * 数据库类型
*/ */
@Dict(dicCode = "database_type") @Dict(dicCode = "database_type")
@Excel(name = "数据库类型", width = 15, dicCode = "database_type") @Excel(name = "数据库类型", width = 15, dict = "database_type")
@ApiModelProperty(value = "数据库类型") @ApiModelProperty(value = "数据库类型")
private java.lang.String dbType; private java.lang.String dbType;
/** /**
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -46,7 +46,7 @@ public class SysDepart implements Serializable {
@Excel(name="描述",width=15) @Excel(name="描述",width=15)
private String description; private String description;
/**机构类别 1公司,2组织机构,2岗位*/ /**机构类别 1公司,2组织机构,2岗位*/
@Excel(name="机构类别",width=15,dicCode="org_category") @Excel(name="机构类别",width=15, dict="org_category")
private String orgCategory; private String orgCategory;
/**机构类型*/ /**机构类型*/
private String orgType; private String orgType;
@@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
/** /**
* @Description: 部门权限表 * @Description: 部门权限表
@@ -6,7 +6,7 @@ import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@@ -58,7 +58,7 @@ public class SysDictItem implements Serializable {
/** /**
* 排序 * 排序
*/ */
@Excel(name = "排序", width = 15,type=4) @Excel(name = "排序", width = 15,type = 10)
private Integer sortOrder; private Integer sortOrder;
@@ -7,7 +7,7 @@ import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@@ -65,7 +65,7 @@ public class SysDictItemCore implements Serializable {
/** /**
* 排序 * 排序
*/ */
@Excel(name = "排序", width = 15,type=4) @Excel(name = "排序", width = 15, type = 10)
private Integer sortOrder; private Integer sortOrder;
@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
/** /**
@@ -10,7 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
/** /**
* @Description: 第三方登录账号表 * @Description: 第三方登录账号表
@@ -10,7 +10,7 @@ import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -78,7 +78,7 @@ public class SysUser implements Serializable {
/** /**
* 性别(1:男 2:女) * 性别(1:男 2:女)
*/ */
@Excel(name = "性别", width = 15,dicCode="sex") @Excel(name = "性别", width = 15, dict="sex")
@Dict(dicCode = "sex") @Dict(dicCode = "sex")
private Integer sex; private Integer sex;
@@ -108,14 +108,14 @@ public class SysUser implements Serializable {
/** /**
* 状态(1:正常 2:冻结 ) * 状态(1:正常 2:冻结 )
*/ */
@Excel(name = "状态", width = 15,dicCode="user_status") @Excel(name = "状态", width = 15, dict="user_status")
@Dict(dicCode = "user_status") @Dict(dicCode = "user_status")
private Integer status; private Integer status;
/** /**
* 删除状态(0,正常,1已删除) * 删除状态(0,正常,1已删除)
*/ */
@Excel(name = "删除状态", width = 15,dicCode="del_flag") @Excel(name = "删除状态", width = 15, dict="del_flag")
@TableLogic @TableLogic
private Integer delFlag; private Integer delFlag;
@@ -164,7 +164,7 @@ public class SysUser implements Serializable {
/** /**
* 负责部门 * 负责部门
*/ */
@Excel(name="负责部门",width = 15,dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") @Excel(name="负责部门",width = 15, dict ="sys_depart,depart_name,id")
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") @Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
private String departIds; private String departIds;
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
@@ -5,7 +5,7 @@ import com.jero.common.api.vo.Results;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.modules.system.entity.SysRole; import com.jero.modules.system.entity.SysRole;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
/** /**
@@ -1,26 +1,26 @@
package com.jero.modules.system.service.impl; //package com.jero.modules.system.service.impl;
//
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import com.jero.common.util.CommonUtils; //import com.jero.common.util.CommonUtils;
import org.jeecgframework.poi.excel.imports.base.ImportFileServiceI; //import cn.afterturn.easypoi.excel.imports.base.ImportFileServiceI;
import org.springframework.beans.factory.annotation.Value; //import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
/** ///**
* excel导入 实现类 // * excel导入 实现类
*/ // */
@Slf4j //@Slf4j
@Service //@Service
public class ImportFileServiceImpl implements ImportFileServiceI { //public class ImportFileServiceImpl implements ImportFileServiceI {
//
@Value("${jero.path.upload}") // @Value("${jero.path.upload}")
private String upLoadPath; // private String upLoadPath;
//
@Value(value="${jero.uploadType}") // @Value(value="${jero.uploadType}")
private String uploadType; // private String uploadType;
//
@Override // @Override
public String doUpload(byte[] data) { // public String doUpload(byte[] data) {
return CommonUtils.uploadOnlineImage(data, upLoadPath, "import", uploadType); // return CommonUtils.uploadOnlineImage(data, upLoadPath, "import", uploadType);
} // }
} //}
@@ -9,8 +9,8 @@ import com.jero.modules.system.entity.SysRole;
import com.jero.modules.system.mapper.SysRoleMapper; import com.jero.modules.system.mapper.SysRoleMapper;
import com.jero.modules.system.mapper.SysUserMapper; import com.jero.modules.system.mapper.SysUserMapper;
import com.jero.modules.system.service.ISysRoleService; import com.jero.modules.system.service.ISysRoleService;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -1,5 +1,6 @@
package com.jero.modules.system.service.impl; package com.jero.modules.system.service.impl;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.CommonConstant; import com.jero.common.constant.CommonConstant;
@@ -71,7 +72,7 @@ public class SysThirdAccountServiceImpl extends ServiceImpl<SysThirdAccountMappe
user.setUsername(thirdUserUuid); user.setUsername(thirdUserUuid);
user.setPhone(phone); user.setPhone(phone);
//设置初始密码 //设置初始密码
String salt = oConvertUtils.randomGen(8); String salt = RandomUtil.randomString(8);
user.setSalt(salt); user.setSalt(salt);
String passwordEncode = PasswordUtil.encrypt(user.getUsername(), "123456", salt); String passwordEncode = PasswordUtil.encrypt(user.getUsername(), "123456", salt);
user.setPassword(passwordEncode); user.setPassword(passwordEncode);
@@ -1,5 +1,6 @@
package com.jero.modules.system.service.impl; package com.jero.modules.system.service.impl;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -95,7 +96,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override @Override
@CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true) @CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true)
public Results<T> changePassword(SysUser sysUser) { public Results<T> changePassword(SysUser sysUser) {
String salt = oConvertUtils.randomGen(8); String salt = RandomUtil.randomString(8);
sysUser.setSalt(salt); sysUser.setSalt(salt);
String password = sysUser.getPassword(); String password = sysUser.getPassword();
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt); String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt);
@@ -2,8 +2,8 @@ package com.jero.modules.system.vo;
import lombok.Data; import lombok.Data;
import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysDictItem;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import java.util.List; import java.util.List;
@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -12,11 +12,11 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
@@ -230,10 +230,13 @@ public class ${entityName}Controller {
} }
// Step.4 AutoPoi 导出Excel // Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class); mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
ExportParams exportParams = new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -252,6 +255,7 @@ public class ${entityName}Controller {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@@ -6,9 +6,9 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list> </#list>
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity; import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@@ -20,11 +20,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -27,11 +27,11 @@ import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.aspect.annotation.AutoLog;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.io.IOException; import java.io.IOException;
@@ -250,10 +250,13 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
} }
// Step.3 AutoPoi 导出Excel // Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${sub.ftlDescription}"); //此处设置的filename无效 ,前端会重更新设置一下 mv.addObject(NormalExcelConstants.FILE_NAME, "${sub.ftlDescription}"); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.CLASS, ${sub.entityName}.class); mv.addObject(NormalExcelConstants.CLASS, ${sub.entityName}.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${sub.ftlDescription}报表", "导出人:" + sysUser.getRealname(), "${sub.ftlDescription}"));
ExportParams exportParams = new ExportParams("${sub.ftlDescription}报表", "导出人:" + sysUser.getRealname(), "${sub.ftlDescription}");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList); mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv; return mv;
} }
@@ -269,6 +272,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -6,7 +6,7 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@@ -10,7 +10,7 @@ import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.util.Date; import java.util.Date;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -12,11 +12,11 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
@@ -225,10 +225,13 @@ public class ${entityName}Controller {
} }
// Step.4 AutoPoi 导出Excel // Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class); mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
ExportParams exportParams = new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -247,6 +250,7 @@ public class ${entityName}Controller {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.util.Date; import java.util.Date;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@@ -6,9 +6,9 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list> </#list>
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity; import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@@ -12,11 +12,11 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
@@ -230,10 +230,13 @@ public class ${entityName}Controller {
} }
// Step.4 AutoPoi 导出Excel // Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class); mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
ExportParams exportParams = new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -252,6 +255,7 @@ public class ${entityName}Controller {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.util.Date; import java.util.Date;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -6,9 +6,9 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list> </#list>
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity; import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@@ -12,11 +12,11 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
@@ -221,10 +221,13 @@ public class ${entityName}Controller {
} }
// Step.4 AutoPoi 导出Excel // Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class); mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
ExportParams exportParams = new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -243,6 +246,7 @@ public class ${entityName}Controller {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict; import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.util.Date; import java.util.Date;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -6,9 +6,9 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list> </#list>
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity; import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@@ -18,11 +18,11 @@ import java.util.Date;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
/** /**
* @Description: ${tableVo.ftlDescription} * @Description: ${tableVo.ftlDescription}
@@ -22,11 +22,11 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -8,7 +8,7 @@ import lombok.Data;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -12,11 +12,11 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
@@ -200,10 +200,13 @@ public class ${entityName}Controller {
pageList.add(vo); pageList.add(vo);
} }
//Step.3 调用AutoPoi导出Excel //Step.3 调用AutoPoi导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}"); mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}");
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class); mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
ExportParams exportParams = new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -222,6 +225,7 @@ public class ${entityName}Controller {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import java.util.Date; import java.util.Date;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -6,8 +6,8 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list> </#list>
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@@ -11,11 +11,11 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import cn.afterturn.easypoi.view.EasypoiSingleExcelView;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.common.api.vo.Results; import com.jero.common.api.vo.Results;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
@@ -288,10 +288,13 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
pageList.add(vo); pageList.add(vo);
} }
//Step.3 调用AutoPoi导出Excel //Step.3 调用AutoPoi导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new EasypoiSingleExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}"); mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}");
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class); mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
ExportParams exportParams = new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}");
exportParams.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -310,6 +313,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setDictHandler(SpringContextUtils.getApplicationContext().getBean(EasyPoiDictHandlerImpl.class));
params.setTitleRows(2); params.setTitleRows(2);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -6,8 +6,8 @@ import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName}; import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
</#list> </#list>
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
+1 -1
View File
@@ -39,7 +39,7 @@
<shiro.version>1.8.0</shiro.version> <shiro.version>1.8.0</shiro.version>
<java-jwt.version>3.11.0</java-jwt.version> <java-jwt.version>3.11.0</java-jwt.version>
<shiro-redis.version>3.1.0</shiro-redis.version> <shiro-redis.version>3.1.0</shiro-redis.version>
<autopoi-web.version>1.3.6</autopoi-web.version> <!-- <autopoi-web.version>1.4.6</autopoi-web.version>-->
<minio.version>8.0.3</minio.version> <minio.version>8.0.3</minio.version>
<justauth-spring-boot-starter.version>1.3.4</justauth-spring-boot-starter.version> <justauth-spring-boot-starter.version>1.3.4</justauth-spring-boot-starter.version>
<dom4j.version>1.6.1</dom4j.version> <dom4j.version>1.6.1</dom4j.version>
+3 -3
View File
@@ -79,9 +79,9 @@
<!-- table区域-begin --> <!-- table区域-begin -->
<div> <div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{--> <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
<!-- selectedRowKeys.length }}</a>项--> selectedRowKeys.length }}</a>项
<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>--> <a style="margin-left: 24px" @click="onClearSelected">清空</a>
<span style="float:right;"> <span style="float:right;">
<a @click="loadData()"><a-icon type="sync" />刷新</a> <a @click="loadData()"><a-icon type="sync" />刷新</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
@@ -1,8 +1,8 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false" style="margin: -15px 0px 10px 0px">
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator" :md="24" :sm="24" style="margin: -25px 0 10px 0"> <div class="table-operator" :md="24" :sm="24">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
@@ -20,11 +20,6 @@
<!-- table区域-begin --> <!-- table区域-begin -->
<div> <div>
<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
<!-- </div>-->
<a-table <a-table
ref="table" ref="table"
size="middle" size="middle"
@@ -1,8 +1,8 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false" style="margin: -15px 0px 10px 0px">
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator" :md="24" :sm="24" style="margin: -25px 0 10px 2px"> <div class="table-operator" :md="24" :sm="24">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
@@ -20,11 +20,6 @@
<!-- table区域-begin --> <!-- table区域-begin -->
<div> <div>
<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
<!-- </div>-->
<a-table <a-table
ref="table" ref="table"
size="middle" size="middle"