|
@@ -109,24 +109,49 @@ public class FeiBillFileViewMultListPlugin extends AbstractListPlugin implement
|
|
DynamicObject elecreceiptDyn = BusinessDataServiceHelper.loadSingle("bei_elecreceipt", new QFilter[]{qf2});
|
|
DynamicObject elecreceiptDyn = BusinessDataServiceHelper.loadSingle("bei_elecreceipt", new QFilter[]{qf2});
|
|
|
|
|
|
if(EmptyUtil.isEmpty(elecreceiptDyn)) {
|
|
if(EmptyUtil.isEmpty(elecreceiptDyn)) {
|
|
- return null;
|
|
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- Map<String, Object> attachmentMap = getAttachmentFile(elecreceiptDyn.getLong("id"));
|
|
|
|
|
|
|
|
- if(attachmentMap == null) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
|
|
+ Long elecreceiptId = elecreceiptDyn.getLong("id");
|
|
|
|
|
|
- Object relativeUrl = attachmentMap.get("relativeUrl");
|
|
|
|
- if (relativeUrl == null) {
|
|
|
|
|
|
+ //创建一条基础资料数据-附件字段
|
|
|
|
+ //获取单据信息,并查询单据中的附件字段
|
|
|
|
+ QFilter qf = new QFilter("id", QCP.equals, elecreceiptId);
|
|
|
|
+ DynamicObject file = BusinessDataServiceHelper.loadSingle("bei_elecreceipt", "attachmentpanel", new QFilter[]{qf});
|
|
|
|
+
|
|
|
|
+ if(file == null){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
|
- String path = FilePathUtil.dealPath(relativeUrl.toString(), "attach");
|
|
|
|
- InputStream inputStream = FileServiceFactory.getAttachmentFileService().getInputStream(path);
|
|
|
|
|
|
|
|
- byte[] bytesAtt = getBytes(inputStream,outputStream);
|
|
|
|
- resList.add(bytesAtt);
|
|
|
|
|
|
+ //获取单据中附件面板信息
|
|
|
|
+ List<Map<String, Object>> atts = AttachmentServiceHelper.getAttachments("bei_elecreceipt", file.getPkValue().toString(), "attachmentpanel");
|
|
|
|
+ //遍历文件
|
|
|
|
+ for (Map<String, Object> attachmentMap: atts) {
|
|
|
|
+ if(attachmentMap.get("type") != null
|
|
|
|
+ && ("pdf".equals(attachmentMap.get("type").toString()) || "jpg".equals(attachmentMap.get("type").toString()))) {
|
|
|
|
+
|
|
|
|
+ if(attachmentMap == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Object relativeUrl = attachmentMap.get("relativeUrl");
|
|
|
|
+ if (relativeUrl == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
|
+ String path = FilePathUtil.dealPath(relativeUrl.toString(), "attach");
|
|
|
|
+ InputStream inputStream = FileServiceFactory.getAttachmentFileService().getInputStream(path);
|
|
|
|
+
|
|
|
|
+ if("jpg".equals(attachmentMap.get("type").toString())){
|
|
|
|
+ ReceiptPrintHelper.imageConvertPdf(path, resList, inputStream);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ byte[] bytesAtt = getBytes(inputStream,outputStream);
|
|
|
|
+ resList.add(bytesAtt);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if(resList.size() == 0){
|
|
if(resList.size() == 0){
|