|
@@ -7,6 +7,7 @@ import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
|
|
import kd.bos.util.CollectionUtils;
|
|
|
+import kd.bos.util.StringUtils;
|
|
|
import nckd.jimin.jyyy.fi.common.constant.BillTypeConstants;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -81,26 +82,36 @@ public class ErFindRelationBillUtils {
|
|
|
*/
|
|
|
public static Set<Object> getCasPayBillElecReceipt(Set<Object> casPayBillIdList){
|
|
|
Set<Object> elecReceiptSet = new HashSet<Object>();
|
|
|
- // 付款处理的交易明细ID
|
|
|
- DynamicObjectCollection casPayBillCol = QueryServiceHelper.query("cas_paybill",
|
|
|
- "id,billno,bankcheckentity.edetailid",
|
|
|
- new QFilter[]{new QFilter("id", "in", casPayBillIdList)});
|
|
|
- if(casPayBillCol != null && casPayBillCol.size() > 0){
|
|
|
- Set<Long> transDetailIds = casPayBillCol
|
|
|
- .stream()
|
|
|
- .filter(r -> r.getLong("bankcheckentity.edetailid") != 0)
|
|
|
- .map(r -> r.getLong("bankcheckentity.edetailid"))
|
|
|
- .collect(Collectors.toSet());
|
|
|
+ if(CollectionUtils.isEmpty(casPayBillIdList)){
|
|
|
+ return elecReceiptSet;
|
|
|
+ }
|
|
|
|
|
|
- DynamicObjectCollection elecReceiptCol = QueryServiceHelper.query("bei_elecreceipt",
|
|
|
- "id,matchdetailentry.e_transdetailid",
|
|
|
- new QFilter("matchdetailentry.e_transdetailid", QCP.in, transDetailIds).toArray());
|
|
|
- // 电子回单信息
|
|
|
- if(elecReceiptCol != null && elecReceiptCol.size() > 0){
|
|
|
- Set<Object> elecReceiptIdSet = elecReceiptCol.stream().map(r -> r.get("id")).collect(Collectors.toSet());
|
|
|
- elecReceiptSet.addAll(elecReceiptIdSet);
|
|
|
- }
|
|
|
+ // 查询付款处理关联的交易明细ID
|
|
|
+ Set<String> transDetailIds = QueryServiceHelper.query("cas_paybill", "detailseqid",
|
|
|
+ new QFilter("id", QCP.in, casPayBillIdList).toArray())
|
|
|
+ .stream()
|
|
|
+ .filter(r -> StringUtils.isNotEmpty(r.getString("detailseqid")))
|
|
|
+ .map(r -> r.getString("detailseqid"))
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(transDetailIds)){
|
|
|
+ return elecReceiptSet;
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询交易明细关联的电子回单号
|
|
|
+ Set<String> receiptNoSet = QueryServiceHelper.query("bei_transdetail", "receiptno",
|
|
|
+ new QFilter("billno", QCP.in, transDetailIds).toArray())
|
|
|
+ .stream()
|
|
|
+ .filter(r -> StringUtils.isNotEmpty(r.getString("receiptno")))
|
|
|
+ .map(r -> r.getString("receiptno"))
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+ if(CollectionUtils.isEmpty(receiptNoSet)){
|
|
|
+ return elecReceiptSet;
|
|
|
}
|
|
|
- return elecReceiptSet ;
|
|
|
+ return QueryServiceHelper.query("bei_elecreceipt", "id,receiptno",
|
|
|
+ new QFilter("receiptno", QCP.in, receiptNoSet).toArray())
|
|
|
+ .stream()
|
|
|
+ .map(r -> r.get("id"))
|
|
|
+ .collect(Collectors.toSet());
|
|
|
}
|
|
|
}
|