refactor(uapbd): 优化材料 PLM 文件下载逻辑
- 修改文件命名逻辑,使用 "name_物料编码_序号.后缀" 的格式
This commit is contained in:
parent
2435980c97
commit
df9a6f7d79
|
@ -104,14 +104,18 @@ public class MaterialPlmDownloadAction implements ICommonAction {
|
||||||
ByteArrayOutputStream zipOut = new ByteArrayOutputStream();
|
ByteArrayOutputStream zipOut = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zipStream = new ZipOutputStream(zipOut);
|
ZipOutputStream zipStream = new ZipOutputStream(zipOut);
|
||||||
try {
|
try {
|
||||||
for (String materialCode : materialCodeArr) {
|
for (int i = 0; i < materialCodeArr.length; i++) {
|
||||||
|
String materialCode = materialCodeArr[i];
|
||||||
JSONObject plmFileJson = this.getPlmFile(materialCode);
|
JSONObject plmFileJson = this.getPlmFile(materialCode);
|
||||||
String objId = plmFileJson.getString("objId");
|
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);
|
byte[] fileBytes = this.doDownloadPlmFile(objId);
|
||||||
if (fileBytes.length == 0) {
|
if (fileBytes.length == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
String fname = name + "_" + materialCode + "_" + i + "." + suffix;
|
||||||
zipStream.putNextEntry(new ZipEntry(fname));
|
zipStream.putNextEntry(new ZipEntry(fname));
|
||||||
zipStream.write(fileBytes);
|
zipStream.write(fileBytes);
|
||||||
zipStream.closeEntry();
|
zipStream.closeEntry();
|
||||||
|
|
Loading…
Reference in New Issue