Commit bf1bf5bc authored by hongguangwu's avatar hongguangwu

1.7.21-税友花名册,去除多余tmp

parent 5b151414
...@@ -190,6 +190,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -190,6 +190,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
} }
} finally { } finally {
atomicPushFriend.decrementAndGet(); atomicPushFriend.decrementAndGet();
cleanSpireTempFiles();
} }
return R.ok(); return R.ok();
} else { } else {
...@@ -198,6 +199,41 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -198,6 +199,41 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
} }
} }
// 2026-03-26 hgw
// 不可以并发,会使花名册转图片的字体不正确
// 后续优化,考虑升级(spire.xls)的版本
// 此方法是:删除临时文件
public void cleanSpireTempFiles() {
try {
String tempDirPath = System.getProperty("java.io.tmpdir");
File tempDir = new File(tempDirPath);
if (tempDir.exists() && tempDir.isDirectory()) {
File[] spireTempFiles = tempDir.listFiles((dir, name) ->
name.startsWith("+~JF") && name.endsWith(".tmp")
);
if (spireTempFiles != null && spireTempFiles.length > 0) {
int count = 0;
long totalSize = 0;
for (File file : spireTempFiles) {
if (file.isFile() && file.canWrite()) {
long fileSize = file.length();
if (file.delete()) {
count++;
totalSize += fileSize;
}
}
}
log.info("清理 Spire.XLS 临时文件完成:删除 {} 个文件,释放 {} MB 空间",
count, totalSize / 1024 / 1024);
}
}
} catch (Exception e) {
log.error("清理 Spire.XLS 临时文件失败", e);
}
}
// 获取特殊的户名称,当前给 徽州区 使用,徽州区需要走不同的分支 // 获取特殊的户名称,当前给 徽州区 使用,徽州区需要走不同的分支
private Map<String, Integer> getSpecialHuNameMap() { private Map<String, Integer> getSpecialHuNameMap() {
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
......
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