refactor(uapbd): 优化材料 PLM 文件下载逻辑

- 修改文件命名逻辑,使用 "name_物料编码_序号.后缀" 的格式
This commit is contained in:
mzr 2025-08-12 16:15:41 +08:00
parent 2435980c97
commit df9a6f7d79
1 changed files with 6 additions and 2 deletions

View File

@ -104,14 +104,18 @@ public class MaterialPlmDownloadAction implements ICommonAction {
ByteArrayOutputStream zipOut = new ByteArrayOutputStream();
ZipOutputStream zipStream = new ZipOutputStream(zipOut);
try {
for (String materialCode : materialCodeArr) {
for (int i = 0; i < materialCodeArr.length; i++) {
String materialCode = materialCodeArr[i];
JSONObject plmFileJson = this.getPlmFile(materialCode);
String objId = plmFileJson.getString("objId");
String fname = plmFileJson.getString("fname");
// String fname = plmFileJson.getString("fname"); // þάͼµµ.pdf
String name = plmFileJson.getString("name");
String suffix = plmFileJson.getString("suffix");
byte[] fileBytes = this.doDownloadPlmFile(objId);
if (fileBytes.length == 0) {
continue;
}
String fname = name + "_" + materialCode + "_" + i + "." + suffix;
zipStream.putNextEntry(new ZipEntry(fname));
zipStream.write(fileBytes);
zipStream.closeEntry();