|
@@ -0,0 +1,95 @@
|
|
|
|
+package nckd.jimin.jyyy.fi.plugin.form;
|
|
|
|
+
|
|
|
|
+import kd.bos.bill.BillShowParameter;
|
|
|
|
+import kd.bos.bill.OperationStatus;
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
+import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
|
|
|
+import kd.bos.entity.operate.result.OperationResult;
|
|
|
|
+import kd.bos.form.ShowType;
|
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
|
+import kd.bos.list.BillList;
|
|
|
|
+import kd.bos.list.plugin.AbstractListPlugin;
|
|
|
|
+import kd.bos.logging.Log;
|
|
|
|
+import kd.bos.logging.LogFactory;
|
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
|
+import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
|
+import kd.fi.cas.util.EmptyUtil;
|
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
|
+
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 改造付款单列表查询 查询银行回单、交易明细
|
|
|
|
+ */
|
|
|
|
+public class PayBillSearchListPlugin extends AbstractListPlugin implements Plugin {
|
|
|
|
+
|
|
|
|
+ private static final Log logger = LogFactory.getLog(PayBillSearchListPlugin.class);
|
|
|
|
+ @Override
|
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs args) {
|
|
|
|
+ super.afterDoOperation(args);
|
|
|
|
+ String operateKey = args.getOperateKey();
|
|
|
|
+ OperationResult operationResult = args.getOperationResult();
|
|
|
|
+
|
|
|
|
+ BillList billList = (BillList)this.getControl("billlistap");
|
|
|
|
+ ListSelectedRowCollection selectedRows = billList.getSelectedRows();
|
|
|
|
+ List<Object> payBillIdList = null;
|
|
|
|
+ if (!selectedRows.isEmpty()) {
|
|
|
|
+ payBillIdList = Arrays.asList(selectedRows.getPrimaryKeyValues());
|
|
|
|
+ logger.info("选中付款单ID:" + payBillIdList);
|
|
|
|
+ }else{
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ BillShowParameter showParameter = new BillShowParameter();
|
|
|
|
+ if (operationResult != null && operationResult.isSuccess() && "transdetail".equals(operateKey)) {
|
|
|
|
+ logger.info("-- 付款单联查交易明细开始 --");
|
|
|
|
+ if(EmptyUtil.isNoEmpty(payBillIdList)){
|
|
|
|
+ String billId = payBillIdList.get(0).toString();
|
|
|
|
+ Long tranbillId = getTransdetailID(billId);
|
|
|
|
+ String formId= "bei_transdetail";
|
|
|
|
+ showParameter.setFormId(formId);
|
|
|
|
+ showParameter.setPkId(tranbillId);
|
|
|
|
+ showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
|
|
|
+ showParameter.setStatus(OperationStatus.VIEW);
|
|
|
|
+ this.getView().showForm(showParameter);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (operationResult != null && operationResult.isSuccess() && "elecreceipt".equals(operateKey)) {
|
|
|
|
+ logger.info("-- 付款单联查电子回单开始 --");
|
|
|
|
+ if(EmptyUtil.isNoEmpty(payBillIdList)){
|
|
|
|
+ String billId = payBillIdList.get(0).toString();
|
|
|
|
+ Long elebillId = getElecreceiptID(billId);
|
|
|
|
+ String formId= "bei_elecreceipt";
|
|
|
|
+ showParameter.setFormId(formId);
|
|
|
|
+ showParameter.setPkId(elebillId);
|
|
|
|
+ showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
|
|
|
+ showParameter.setStatus(OperationStatus.VIEW);
|
|
|
|
+ this.getView().showForm(showParameter);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Long getTransdetailID(String payBillId){
|
|
|
|
+ Long billId = Long.parseLong(payBillId);
|
|
|
|
+ QFilter qf = new QFilter("id", QCP.equals, billId);
|
|
|
|
+ DynamicObject billDyn = BusinessDataServiceHelper.loadSingle("cas_paybill", new QFilter[]{qf});
|
|
|
|
+ String transdetailId = billDyn.getString("detailseqid");
|
|
|
|
+ QFilter qf1 = new QFilter("billno", QCP.equals, transdetailId);
|
|
|
|
+ DynamicObject transdetailDyn = BusinessDataServiceHelper.loadSingle("bei_transdetail", new QFilter[]{qf1});
|
|
|
|
+ return transdetailDyn.getLong("id");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Long getElecreceiptID(String payBillId){
|
|
|
|
+ Long billId = Long.parseLong(payBillId);
|
|
|
|
+ QFilter qf = new QFilter("id", QCP.equals, billId);
|
|
|
|
+ DynamicObject billDyn = BusinessDataServiceHelper.loadSingle("cas_paybill", new QFilter[]{qf});
|
|
|
|
+ String transdetailId = billDyn.getString("detailseqid");
|
|
|
|
+ QFilter qf1 = new QFilter("billno", QCP.equals, transdetailId);
|
|
|
|
+ DynamicObject transdetailDyn = BusinessDataServiceHelper.loadSingle("bei_transdetail", new QFilter[]{qf1});
|
|
|
|
+ String elecreceiptNo = transdetailDyn.getString("receiptno");
|
|
|
|
+ QFilter qf2 = new QFilter("receiptno", QCP.equals, elecreceiptNo);
|
|
|
|
+ DynamicObject elecreceiptDyn = BusinessDataServiceHelper.loadSingle("bei_elecreceipt", new QFilter[]{qf2});
|
|
|
|
+ return elecreceiptDyn.getLong("id");
|
|
|
|
+ }
|
|
|
|
+}
|