Commit a9fe2bab authored by fangxinjiang's avatar fangxinjiang

优化-fxj

parent 7380f8b2
......@@ -170,6 +170,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
HashMap<String,String> userMap = new HashMap<>();
ExcelWriter excelWriter = null;
try {
R<AllUserNaVo> userListR = upmsDaprUtils.getAllUserName();
if (Common.isNotNull(userListR)) {
......@@ -190,7 +191,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
redisLabelMap.putAll(userMap);
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchInfoExportVo.class)
excelWriter = EasyExcel.write(out, TDispatchInfoExportVo.class)
.registerConverter(new DictConverter(nameAndDicTypeMap,redisLabelMap))
.includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0;
......@@ -219,7 +220,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
......@@ -227,6 +227,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (null != out) {
out.close();
}
if (null != excelWriter){
excelWriter.finish();
}
} catch (IOException e) {
log.error("执行异常", e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment