提交相关代码

This commit is contained in:
zfhai 2023-12-05 16:38:24 +08:00
parent d560d48070
commit 29ddfa9583
3 changed files with 7 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package com.bonus.zlpt.common.core.utils.poi;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
@ -471,11 +472,10 @@ public class ExcelUtil<T>
* *
* 可以设置文件名称 * 可以设置文件名称
*/ */
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title,String fileName) public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title,String fileName) throws UnsupportedEncodingException {
{
String encodedFileName = null; String encodedFileName = null;
encodedFileName = URLEncoder.encode(fileName+".xlsx", StandardCharsets.UTF_8); encodedFileName = URLEncoder.encode(fileName+".xlsx", String.valueOf(StandardCharsets.UTF_8));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\""); response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\"");

View File

@ -17,6 +17,8 @@ import com.bonus.zlpt.common.core.domain.equip.DevInfo;
import com.bonus.zlpt.equip.service.IDevInfoService; import com.bonus.zlpt.equip.service.IDevInfoService;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
/** /**
* 设备信息Service业务层处理 * 设备信息Service业务层处理
* *
@ -30,7 +32,7 @@ public class DevInfoServiceImpl implements IDevInfoService
private final String EXAMINATION_PDF = "EXAMINATION_PDF"; private final String EXAMINATION_PDF = "EXAMINATION_PDF";
private final String INSURANCE_PDF = "INSURANCE_PDF"; private final String INSURANCE_PDF = "INSURANCE_PDF";
@Autowired @Resource
private DevInfoMapper devInfoMapper; private DevInfoMapper devInfoMapper;
/** /**

View File

@ -68,10 +68,7 @@
</dependency> </dependency>
<!-- RuoYi Common Swagger --> <!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-common-swagger</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.bonus.zlpt</groupId> <groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-common-swagger</artifactId> <artifactId>zlpt-common-swagger</artifactId>