|
@@ -59,6 +59,7 @@ import nckd.jimin.jyyy.fi.common.entity.MergePrintEntity;
|
|
|
import nckd.jimin.jyyy.fi.common.util.ErFindRelationBillUtils;
|
|
|
import nckd.jimin.jyyy.fi.common.util.ReceiveTicketUtils;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -403,51 +404,19 @@ public class HandInReceiveTicketPlugin extends AbstractFormPlugin implements Row
|
|
|
|
|
|
protected void doViewElecReceipt(){
|
|
|
DynamicObject selectRow = getSelectRows().get(0);
|
|
|
-
|
|
|
- Map<String, Set<Object>> relationBelowBillMap = ErFindRelationBillUtils.getRelationBelowBillMap(selectRow.getString(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_BILLID),
|
|
|
- selectRow.getString(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_FORMID));
|
|
|
-
|
|
|
- if (!relationBelowBillMap.containsKey(BillTypeConstants.CAS_PAYBILL)
|
|
|
- || CollectionUtils.isEmpty(relationBelowBillMap.get(BillTypeConstants.CAS_PAYBILL))) {
|
|
|
- getView().showTipNotification("没有相应的电子回单!");
|
|
|
- return;
|
|
|
- }
|
|
|
- Set<Object> casPayBillIdSet = relationBelowBillMap.get(BillTypeConstants.CAS_PAYBILL);
|
|
|
- boolean isHasReceipt = false;
|
|
|
- for (Object casPayBillId : casPayBillIdSet) {
|
|
|
- Map<String, Object> fileMap = getElecreceiptByFile(casPayBillId.toString());
|
|
|
- if (fileMap != null) {
|
|
|
- isHasReceipt = true;
|
|
|
- this.getView().previewAttachment(fileMap);
|
|
|
- }
|
|
|
+ String pdfUrl = null;
|
|
|
+ try {
|
|
|
+ pdfUrl = FeiBillFileViewMultHelper.getElecreceiptByFile(selectRow.getString(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_BILLID));
|
|
|
+ } catch (IOException ex) {
|
|
|
+ throw new RuntimeException(ex);
|
|
|
}
|
|
|
|
|
|
- if(!isHasReceipt){
|
|
|
- getView().showTipNotification("没有相应的电子回单!");
|
|
|
- return;
|
|
|
+ if (kd.bos.util.StringUtils.isNotEmpty(pdfUrl)) {
|
|
|
+ FeiBillFileViewMultHelper.openForm(this.getView(), pdfUrl);
|
|
|
+ } else {
|
|
|
+ this.getView().showSuccessNotification("没有相应的电子回单!");
|
|
|
}
|
|
|
|
|
|
-// List<byte[]> mergeArray = new ArrayList<>();
|
|
|
-// Set<Object> elecReceiptIdSet = relationBelowBillMap.get(BillTypeConstants.BEI_ELECRECEIPT);
|
|
|
-// for(Object elecReceiptId : elecReceiptIdSet){
|
|
|
-// byte[] bytes = ReceiveTicketUtils.getElecReceiptPrintUrl(elecReceiptId);
|
|
|
-// mergeArray.add(bytes);
|
|
|
-// }
|
|
|
-//
|
|
|
-// byte[] bytes = PrintServiceHelper.mergeMultiPdf(mergeArray);//拼接文件流
|
|
|
-//
|
|
|
-// String fileName = String.format("单据%s电子回单文件文件预览",selectRow.getString(HandInReceiveTicketConstant.SCANBILLENTRY.KEY_NCKD_NUMBER));
|
|
|
-// TempFileCache tfc = CacheFactory.getCommonCacheFactory().getTempFileCache();
|
|
|
-// // 设置临时文件有效时间
|
|
|
-// String tempUrl = tfc.saveAsFullUrl(fileName + ".pdf", bytes, 60 * 60 * 2);//文件流生成临时文件
|
|
|
-// String url = null;
|
|
|
-// try {
|
|
|
-// url = URLEncoder.encode(tempUrl, "UTF-8");
|
|
|
-// } catch (UnsupportedEncodingException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// String previewurl = UrlService.getAttachmentPreviewUrl(url);
|
|
|
-// getView().openUrl(previewurl);
|
|
|
}
|
|
|
|
|
|
|