修改pom依赖(解决导出依赖包冲突问题)
This commit is contained in:
@@ -138,11 +138,6 @@
|
||||
<artifactId>qomo-data-selfReport</artifactId>
|
||||
<version>${dmp.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>commons-io</groupId>-->
|
||||
<!-- <artifactId>commons-io</artifactId>-->
|
||||
<!-- <version>2.11.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<!-- 环境 -->
|
||||
|
||||
@@ -282,8 +282,8 @@ jeecg:
|
||||
#webapp文件路径
|
||||
webapp: /opt/webapp
|
||||
shiro:
|
||||
excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
|
||||
# excludeUrls: /**/**,/**/**/**
|
||||
# excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
|
||||
excludeUrls: /**/**,/**/**/**
|
||||
|
||||
#阿里云oss存储和大鱼短信秘钥配置
|
||||
oss:
|
||||
@@ -436,7 +436,8 @@ seaTunnelHome: /opt/service/apache-seatunnel-2.3.4
|
||||
hiveMetastoreUri: thrift://192.168.50.102:9083
|
||||
hiveSitePath: /opt/service/apache-seatunnel-2.3.4/deploy/hive-site.xml
|
||||
hdfsSitePath: /opt/service/apache-seatunnel-2.3.4/deploy/hdfs-site.xml
|
||||
|
||||
hdfs:
|
||||
enable: false
|
||||
minio:
|
||||
server: http://192.168.50.9
|
||||
port: 9100
|
||||
|
||||
@@ -13,12 +13,6 @@
|
||||
<dependency>
|
||||
<groupId>org.qomo.boot</groupId>
|
||||
<artifactId>qomo-system-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.auto.service</groupId>
|
||||
@@ -29,33 +23,5 @@
|
||||
<groupId>com.zzsmart.qomo</groupId>
|
||||
<artifactId>qomo-data-integration</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.3</version>
|
||||
</dependency>
|
||||
<!--自己添加的依赖-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>commons-io</groupId>-->
|
||||
<!-- <artifactId>commons-io</artifactId>-->
|
||||
<!-- <version>2.11.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>4.0.1</version> <!-- 请检查并使用最新稳定版本 -->
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
+1
@@ -139,6 +139,7 @@ public class AppSceneCostStandardDetailController extends JeecgController<AppSce
|
||||
*/
|
||||
// @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
@ApiOperation(value = "cost-单行查询导出", notes = "cost-单行查询导出")
|
||||
public ModelAndView exportXls(HttpServletRequest request, AppSceneCostStandardDetail appSceneCostStandardDetail) {
|
||||
return super.exportXls(request, appSceneCostStandardDetail, AppSceneCostStandardDetail.class, "app_scene_cost_standard_detail");
|
||||
}
|
||||
|
||||
+6
-19
@@ -29,7 +29,12 @@ import java.util.Date;
|
||||
@ApiModel(value = "app_scene_cost_hour_rate对象", description = "app_scene_cost_hour_rate")
|
||||
public class AppSceneCostHourRate implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**
|
||||
* 年度
|
||||
*/
|
||||
@@ -106,22 +111,4 @@ public class AppSceneCostHourRate implements Serializable {
|
||||
@Excel(name = "维护时间", width = 15)
|
||||
@ApiModelProperty(value = "维护时间")
|
||||
private String maintenanceTime;
|
||||
/**
|
||||
* 预留字段1
|
||||
*/
|
||||
@Excel(name = "预留字段1", width = 15)
|
||||
@ApiModelProperty(value = "预留字段1")
|
||||
private String reserve1;
|
||||
/**
|
||||
* 预留字段2
|
||||
*/
|
||||
@Excel(name = "预留字段2", width = 15)
|
||||
@ApiModelProperty(value = "预留字段2")
|
||||
private BigDecimal reserve2;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
}
|
||||
|
||||
-135
@@ -1,135 +0,0 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class EasyExcelUtil {
|
||||
/**
|
||||
* 导出Excel文件到HTTP响应流,包含自定义表头。
|
||||
*
|
||||
* @param response HTTP响应对象
|
||||
* @param fileName 导出的文件名
|
||||
* @param head 表头信息列表
|
||||
* @param data 需要导出的数据列表
|
||||
* @param clazz 数据模型的Class类型
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static <T> void export(HttpServletResponse response, String fileName, List<?> head, List<T> data, Class<T> clazz) throws IOException {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name()).replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 自定义表头样式
|
||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = getHorizontalCellStyleStrategy();
|
||||
|
||||
// 使用EasyExcel导出
|
||||
try {
|
||||
EasyExcel.write(response.getOutputStream(), clazz)
|
||||
// 注册样式策略
|
||||
.registerWriteHandler(horizontalCellStyleStrategy).sheet("1111").doWrite(data);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// FileOutputStream outputStream= new FileOutputStream(fileName);
|
||||
// try {
|
||||
// EasyExcel.write(outputStream)
|
||||
// // 设置自定义样式,可选
|
||||
// .sheet("Sheet1") // 设置工作表名称
|
||||
// .doWrite(data); // 将数据写入Excel
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// System.out.println("zheli==============");
|
||||
// } finally {
|
||||
//// if (excelWriter != null) {
|
||||
//// excelWriter.finish();
|
||||
//// }
|
||||
// if (outputStream != null) {
|
||||
// outputStream.close();
|
||||
// }
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建自定义的水平单元格样式策略,用于表头样式。
|
||||
*
|
||||
* @return 水平单元格样式策略
|
||||
*/
|
||||
private static HorizontalCellStyleStrategy getHorizontalCellStyleStrategy() {
|
||||
// 设置表头字体样式
|
||||
WriteFont headFont = new WriteFont();
|
||||
headFont.setFontHeightInPoints((short) 12);
|
||||
headFont.setFontName("Arial");
|
||||
headFont.setBold(true);
|
||||
|
||||
// 设置表头单元格样式
|
||||
WriteCellStyle headCellStyle = new WriteCellStyle();
|
||||
headCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
headCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
headCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||
headCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
|
||||
headCellStyle.setBorderLeft(BorderStyle.THIN);
|
||||
headCellStyle.setBorderRight(BorderStyle.THIN);
|
||||
headCellStyle.setBorderTop(BorderStyle.THIN);
|
||||
headCellStyle.setBorderBottom(BorderStyle.THIN);
|
||||
headCellStyle.setWriteFont(headFont);
|
||||
|
||||
// 创建并返回水平单元格样式策略
|
||||
return new HorizontalCellStyleStrategy(headCellStyle, (List<WriteCellStyle>) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取带有@Excel注解的属性集合
|
||||
*
|
||||
* @param clazz 实体类的Class对象
|
||||
* @return 带有@Excel注解的Field集合
|
||||
*/
|
||||
public static Field[] getExcelPropertyAnnotatedFields(Class<?> clazz) {
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
List<Field> annotatedFields = new ArrayList<>();
|
||||
|
||||
for (Field field : fields) {
|
||||
if (field.isAnnotationPresent(ExcelProperty.class)) {
|
||||
annotatedFields.add(field);
|
||||
}
|
||||
}
|
||||
return annotatedFields.toArray(new Field[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询类需要导出的列名
|
||||
*
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
public static Set<String> getIncludeFields(Class<?> clazz) {
|
||||
Field[] excelPropertyAnnotatedFields = getExcelPropertyAnnotatedFields(AppSceneCostStandardDetail.class);
|
||||
Set<String> includeColumnFiledNames = new HashSet<String>();
|
||||
for (int i = 0; i < excelPropertyAnnotatedFields.length; i++) {
|
||||
includeColumnFiledNames.add(excelPropertyAnnotatedFields[i].getName());
|
||||
}
|
||||
return includeColumnFiledNames;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user