Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

xuhao 5 mēneši atpakaļ
vecāks
revīzija
65bdb05ed7

+ 48 - 0
src/main/java/bamp/basedata/opplugin/SupplierBankChangeOpPlugin.java

@@ -0,0 +1,48 @@
+package bamp.basedata.opplugin;
+
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
+import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
+import kd.bos.servicehelper.BusinessDataServiceHelper;
+import kd.bos.servicehelper.operation.SaveServiceHelper;
+
+/**
+ * 供应商银行信息变更操作插件
+ * 2024-11-08 wangj
+ * 主要功能:供应商银行信息变更单审批通过时,反写更新供应商银行信息
+ */
+public class SupplierBankChangeOpPlugin  extends AbstractOperationServicePlugIn {
+    @Override
+    public void endOperationTransaction(EndOperationTransactionArgs e) {
+        super.endOperationTransaction(e);
+        DynamicObject[] dynamicObjects = e.getDataEntities();
+        for (int i = 0; i < dynamicObjects.length; i++) {
+            DynamicObject bill = dynamicObjects[i];
+            DynamicObject supplier = BusinessDataServiceHelper.loadSingle(
+                    bill.getDynamicObject("nckd_supplierfield").getLong("id"),"bd_supplier");
+            DynamicObjectCollection supplierBankCol = supplier.getDynamicObjectCollection("entry_bank");
+            supplierBankCol.clear();
+            DynamicObjectCollection entryCol = bill.getDynamicObjectCollection("nckd_entry_bank");
+            for(DynamicObject entry : entryCol){
+                DynamicObject supplierEntryInfo = supplierBankCol.addNew();
+                supplierEntryInfo.set("bankaccount",entry.get("nckd_bankaccount"));
+                supplierEntryInfo.set("accountname",entry.get("nckd_accountname"));
+                supplierEntryInfo.set("iban",entry.get("nckd_iban"));
+                supplierEntryInfo.set("bank",entry.get("nckd_bank"));
+                supplierEntryInfo.set("currency",entry.get("nckd_currency"));
+                supplierEntryInfo.set("payeeadmindivision",entry.get("nckd_payeeadmindivision"));
+                supplierEntryInfo.set("payeeaddress",entry.get("nckd_payeeaddress"));
+                supplierEntryInfo.set("payeephone",entry.get("nckd_payeephone"));
+                supplierEntryInfo.set("isdefault_bank",entry.get("nckd_isdefault_bank"));
+                supplierEntryInfo.set("bankaccounttype",entry.get("nckd_bankaccounttype"));
+                supplierEntryInfo.set("settlment",entry.get("nckd_settlment"));
+                supplierEntryInfo.set("commissionbearer",entry.get("nckd_commissionbearer"));
+                supplierEntryInfo.set("liquidationparam",entry.get("nckd_liquidationparam"));
+                supplierEntryInfo.set("agentbankaccount",entry.get("nckd_agentbankaccount"));
+                supplierEntryInfo.set("agentbank",entry.get("nckd_agentbank"));
+            }
+            SaveServiceHelper.save(new DynamicObject[]{supplier});
+        }
+    }
+}

+ 20 - 16
src/main/java/fi/em/formPlugin/SalaryBankNumEditPlugin.java

@@ -11,7 +11,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
 /**
  * @author cjz
  * @date 2024/10/25 16:37
- * @description:根据人力薪酬分录自动带出人员银行账户
+ * @description:根据收款信息自动带出人员银行账户
  */
 public class SalaryBankNumEditPlugin extends AbstractFormPlugin {
 
@@ -35,16 +35,18 @@ public class SalaryBankNumEditPlugin extends AbstractFormPlugin {
             for (DynamicObject item:dynamicObjectCollection) {
                 //人力一般工号
                 String sae_jobid=item.getString(nckd_sae_jobid);
-                QFilter qFilter=new QFilter("nckd_payeenum.number", QCP.equals,sae_jobid);
-                //数据状态为启用
-                qFilter.and("nckd_datastatus",QCP.equals,"A");
-                //查询员工收款信息表
-                DynamicObject dynamicObjects= BusinessDataServiceHelper
-                        .loadSingle("nckd_payinformation","id,nckd_payaccount",new QFilter[]{qFilter});
+                QFilter qFilter=new QFilter("payer", QCP.equals,sae_jobid);
+                //使用状态为可用
+                qFilter.and("enable",QCP.equals,"1");
+                //默认账号
+                qFilter.and("isdefault",QCP.equals,true);
+                //查询收款信息表
+                DynamicObject er_payeer=BusinessDataServiceHelper
+                        .loadSingle("er_payeer","id,payer,payeraccount");
                 //存在数据则设值
-                if (dynamicObjects!=null) {
+                if (er_payeer!=null) {
                     //设置银行账号
-                    this.getModel().setValue(nckd_sae_banknumber,dynamicObjects.getString("nckd_payaccount"));
+                    this.getModel().setValue(nckd_sae_banknumber,er_payeer.getString("payeraccount"));
                 }
             }
         }
@@ -55,17 +57,19 @@ public class SalaryBankNumEditPlugin extends AbstractFormPlugin {
             DynamicObjectCollection dynamicObjectCollection=dynamicObject.getDynamicObjectCollection(nckd_salaryentryre);
             for (DynamicObject item:dynamicObjectCollection) {
                 //人力一般工号
-                String sae_jobid=item.getString(nckd_see_jobid);
-                QFilter qFilter=new QFilter("nckd_payeenum.number", QCP.equals,sae_jobid);
+                String see_jobid=item.getString(nckd_see_jobid);
+                QFilter qFilter=new QFilter("payer", QCP.equals,see_jobid);
                 //数据状态为启用
-                qFilter.and("nckd_datastatus",QCP.equals,"A");
+                qFilter.and("enable",QCP.equals,"1");
+                //默认账号
+                qFilter.and("isdefault",QCP.equals,true);
                 //查询员工收款信息表
-                DynamicObject dynamicObjects= BusinessDataServiceHelper
-                        .loadSingle("nckd_payinformation","id,nckd_payaccount",new QFilter[]{qFilter});
+                DynamicObject er_payeer= BusinessDataServiceHelper
+                        .loadSingle("er_payeer","id,payer,payeraccount",new QFilter[]{qFilter});
                 //存在数据则设值
-                if (dynamicObjects!=null) {
+                if (er_payeer!=null) {
                     //设置银行账号
-                    this.getModel().setValue(nckd_see_banknumber,dynamicObjects.getString("nckd_payaccount"));
+                    this.getModel().setValue(nckd_see_banknumber,er_payeer.getString("payeraccount"));
                 }
             }
         }

+ 8 - 2
src/main/java/fi/gl/task/AutoSynVoucher.java

@@ -41,6 +41,7 @@ public class AutoSynVoucher extends AbstractTask {
     String SELECTFIELDS = "billno,period,org,createtime,auditdate,bookeddate," +
             "entries,entries.account,entries.creditori,entries.debitori,entries.creditlocal,entries.debitlocal,entries.entrydc,entries.edescription,entries.currency";
 
+    Date beginDate = null;
     @Override
     public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
         Connection conn = null;
@@ -66,6 +67,7 @@ public class AutoSynVoucher extends AbstractTask {
                 }
 
                 //查找待同步数据执行插入数据
+                beginDate = getBeginDate();
                 log.info("[凭证反同步用友]同步数据执行插入开始");
                 pstmt1 = conn.prepareStatement("INSERT INTO jf_voucher (" + DB_VOUCHER_FIELDS + ") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
                 doExecuteNewData(conn,pstmt1,orgMap_numbber,orgMap_name);
@@ -73,7 +75,10 @@ public class AutoSynVoucher extends AbstractTask {
 
                 //清空汇总中间表
                 pstmt2 = conn.createStatement();
-                String deleteSql = "DELETE FROM jf_balance";
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                String yearv = sdf.format(beginDate).substring(0,4);
+                int periodv = Integer.valueOf(sdf.format(beginDate).substring(5,7));
+                String deleteSql = "DELETE FROM jf_balance WHERE yearv='"+yearv+"' AND periodv='"+periodv+"'";
                 int affectedRows = pstmt2.executeUpdate(deleteSql);
                 log.info("[凭证反同步用友]删除中间表记录数:"+affectedRows);
                 conn.commit();
@@ -149,6 +154,7 @@ public class AutoSynVoucher extends AbstractTask {
     * 获取凭证汇总数据集
      */
     private JSONArray getVoucherTotalDatas(Map orgMapNumbber, Map orgMapName) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         String sql = "SELECT TEMP.orgid,TEMP.yearv,TEMP.periodv,TEMP.subjcd,TEMP.subjnm,TEMP.currentid,TEMP.entrydc," +
                 "SUM(TEMP.creditamount) creditamount_total,SUM(TEMP.debitamount) debitamount_total," +
                 "SUM(TEMP.localcreditamount) localcreditamount_total,SUM(TEMP.localdebitamount) localdebitamount_total " +
@@ -163,6 +169,7 @@ public class AutoSynVoucher extends AbstractTask {
                     "LEFT JOIN T_BD_Account ACC ON VOUE.faccountid  = ACC.FID " +
                     "WHERE VOU.fispost='1' " +
                     "AND VOU.fk_nckd_issynyy='1' " +
+                    "AND VOU.Fbookeddate>='"+sdf.format(beginDate)+"'"+
                 ") TEMP " +
                 "GROUP BY TEMP.orgid,TEMP.yearv,TEMP.periodv,TEMP.subjcd,TEMP.subjnm,TEMP.currentid,TEMP.entrydc";
         DataSet ds = DB.queryDataSet(this.getClass().getName(), new DBRoute("fi"), sql, null);
@@ -385,7 +392,6 @@ public class AutoSynVoucher extends AbstractTask {
     }
 
     private DynamicObject[] getVoucherDatas() {
-        Date beginDate = getBeginDate();
         QFilter qFilter_beginDate = new QFilter("bookeddate",QCP.large_equals,beginDate);
         QFilter qFilter_ispost = new QFilter("ispost", QCP.equals,"1");
         QFilter qFilter_issynyy = new QFilter("nckd_issynyy", QCP.equals,"0");

+ 1099 - 0
src/main/java/kd/fi/er/formplugin/web/TripEntryEditEx.java

@@ -0,0 +1,1099 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package kd.fi.er.formplugin.web;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Collections;
+import java.util.Date;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import kd.bos.bill.OperationStatus;
+import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
+import kd.bos.dataentity.metadata.IDataEntityProperty;
+import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection;
+import kd.bos.dataentity.resource.ResManager;
+import kd.bos.entity.MainEntityType;
+import kd.bos.entity.datamodel.IDataModel;
+import kd.bos.entity.datamodel.events.ChangeData;
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
+import kd.bos.entity.property.BasedataProp;
+import kd.bos.form.ConfirmCallBackListener;
+import kd.bos.form.FormShowParameter;
+import kd.bos.form.IFormView;
+import kd.bos.form.MessageBoxOptions;
+import kd.bos.form.MessageBoxResult;
+import kd.bos.form.control.Control;
+import kd.bos.form.events.MessageBoxClosedEvent;
+import kd.bos.form.field.BasedataEdit;
+import kd.bos.form.field.DateRangeEdit;
+import kd.bos.form.field.FieldEdit;
+import kd.bos.form.field.MulBasedataEdit;
+import kd.bos.form.plugin.AbstractFormPlugin;
+import kd.bos.list.ListShowParameter;
+import kd.bos.logging.Log;
+import kd.bos.logging.LogFactory;
+import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.BusinessDataServiceHelper;
+import kd.bos.servicehelper.org.OrgUnitServiceHelper;
+import kd.fi.er.business.bean.CostDeptF7ChangePram;
+import kd.fi.er.business.invoicecloud.ItemFrom;
+import kd.fi.er.business.servicehelper.BaseCurrencyServiceHelper;
+import kd.fi.er.business.servicehelper.CommonServiceHelper;
+import kd.fi.er.business.servicehelper.CoreBaseBillServiceHelper;
+import kd.fi.er.business.servicehelper.ExpenseItemServiceHelper;
+import kd.fi.er.business.tripstd.service.IErTripStdService;
+import kd.fi.er.business.tripstd.service.imp.ErTripStdServiceImp;
+import kd.fi.er.business.utils.AmountUtils;
+import kd.fi.er.business.utils.ErCommonUtils;
+import kd.fi.er.business.utils.ErCostCenterUtil;
+import kd.fi.er.business.utils.ErEntityTypeUtils;
+import kd.fi.er.business.utils.ErStdConfig;
+import kd.fi.er.business.utils.SystemParamterUtil;
+import kd.fi.er.common.ControlMethodEnum;
+import kd.fi.er.common.SettlementTypeEnum;
+import kd.fi.er.formplugin.budget.BudgetCommonUtil;
+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.BeforeCostCompanyF7SelectListener;
+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.BeforeCostDeptF7SelectListener;
+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.BeforeExpenseItemF7SelectListener;
+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.TripBeforeCostCenterF7SelectListener;
+import kd.fi.er.formplugin.daily.web.workflow.ErMobWorkFlowOtherViewEditUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
+
+public class TripEntryEditEx extends AbstractFormPlugin {
+    private static final Log log = LogFactory.getLog(TripEntryEdit.class);
+    private static final String TRIP_ENTRY_ROW_INDEX = "tripEntryRowIndex";
+    private static final String BTN_OK = "btnok";
+
+    public TripEntryEditEx() {
+    }
+
+    public void registerListener(EventObject e) {
+        super.registerListener(e);
+        this.addClickListeners(new String[]{"btnok"});
+        MulBasedataEdit travelersF7 = (MulBasedataEdit)this.getControl("travelers");
+        this.getF7FilterInfo(travelersF7);
+        BasedataEdit travelerF7 = (BasedataEdit)this.getControl("traveler");
+        this.getF7FilterInfo(travelerF7);
+        if (this.getView().getParentView() != null && this.getView().getParentView().getModel() != null) {
+            IDataModel model = this.getModel();
+            IDataModel parentModel = this.getView().getParentView().getModel();
+            String number = parentModel.getDataEntityType().getName();
+            if (ErEntityTypeUtils.isTripReqBill(number) && (Boolean)model.getValue("isloan")) {
+                number = "er_loanbill";
+            }
+
+            BasedataEdit tripExpenseItemF7 = (BasedataEdit)this.getControl("tripexpenseitem");
+            tripExpenseItemF7.addBeforeF7SelectListener(new BeforeExpenseItemF7SelectListener(this.getView(), number, "entrycostdept"));
+            this.costDeptF7Filter();
+            this.costCompanyF7Filter();
+            this.costCenterF7Filter();
+        }
+
+    }
+
+    private void costCenterF7Filter() {
+        TripBeforeCostCenterF7SelectListener beforeCostCenterF7SelectListener = new TripBeforeCostCenterF7SelectListener(this.getView());
+        BasedataEdit entryCostCenterF7 = (BasedataEdit)this.getControl("std_entrycostcenter");
+        if (entryCostCenterF7 != null) {
+            entryCostCenterF7.addBeforeF7SelectListener(beforeCostCenterF7SelectListener);
+        }
+
+    }
+
+    protected void costDeptF7Filter() {
+        BasedataEdit entrycostDeptF7 = (BasedataEdit)this.getControl("entrycostdept");
+        if (entrycostDeptF7 != null) {
+            BeforeCostDeptF7SelectListener beforeCostDeptF7SelectListener = new BeforeCostDeptF7SelectListener(this.getView());
+            entrycostDeptF7.addBeforeF7SelectListener(beforeCostDeptF7SelectListener);
+        }
+
+    }
+
+    protected void costCompanyF7Filter() {
+        BasedataEdit costCompanyF7 = (BasedataEdit)this.getControl("entrycostcompany");
+        Object costDept = this.getModel().getValue("entrycostdept");
+        Object company = this.getModel().getValue("company");
+        if (costCompanyF7 != null && costDept != null) {
+            BeforeCostCompanyF7SelectListener beforeCostCompanyF7SelectListener = new BeforeCostCompanyF7SelectListener(ErCommonUtils.getPk(costDept), ErCommonUtils.getPk(company));
+            costCompanyF7.addBeforeF7SelectListener(beforeCostCompanyF7SelectListener);
+        }
+
+    }
+
+    public void getF7FilterInfo(BasedataEdit travelerF7) {
+        travelerF7.addBeforeF7SelectListener((listener) -> {
+            ListShowParameter list = (ListShowParameter)listener.getFormShowParameter();
+            IFormView parentView = this.getView().getParentView();
+            if (parentView != null) {
+                IDataModel parentModel = parentView.getModel();
+                DynamicObject org = (DynamicObject)parentModel.getValue("company");
+                if (org != null) {
+                    boolean travelersrelationtripreq = SystemParamterUtil.getBoolParamResult(ErCommonUtils.getPk(org), "travelersrelationtripreq");
+                    if (travelersrelationtripreq) {
+                        Set<Object> longSet = new HashSet();
+                        DynamicObjectCollection clearloanentry;
+                        if (parentModel.getProperty("writeoffapply") != null && !parentModel.getEntryEntity("writeoffapply").isEmpty()) {
+                            clearloanentry = parentModel.getEntryEntity("writeoffapply");
+                            Iterator var9 = clearloanentry.iterator();
+
+                            label106:
+                            while(true) {
+                                DynamicObjectCollection applytravelers;
+                                do {
+                                    if (!var9.hasNext()) {
+                                        break label106;
+                                    }
+
+                                    DynamicObject itemx = (DynamicObject)var9.next();
+                                    applytravelers = itemx.getDynamicObjectCollection("applytravelers");
+                                } while(applytravelers == null);
+
+                                Iterator var12 = applytravelers.iterator();
+
+                                while(var12.hasNext()) {
+                                    DynamicObject apply = (DynamicObject)var12.next();
+                                    longSet.add(ErCommonUtils.getPk(apply.getDynamicObject("fbasedataid")));
+                                }
+                            }
+                        }
+
+                        if (parentModel.getProperty("clearloanentry") != null && !parentModel.getEntryEntity("clearloanentry").isEmpty()) {
+                            clearloanentry = parentModel.getEntryEntity("clearloanentry");
+                            HashSet<Long> applyIdSet = new HashSet();
+                            Iterator var25 = clearloanentry.iterator();
+
+                            while(var25.hasNext()) {
+                                DynamicObject item = (DynamicObject)var25.next();
+                                if ("er_tripreqbill".equals(item.getString("srcbilltype"))) {
+                                    applyIdSet.add(item.getLong("loanbillid"));
+                                }
+                            }
+
+                            DynamicObject[] reqBills = BusinessDataServiceHelper.load("er_tripreqbill", "tripentry.travelers", new QFilter[]{new QFilter("id", "in", applyIdSet)});
+                            DynamicObject[] var29 = reqBills;
+                            int var31 = reqBills.length;
+
+                            label83:
+                            for(int var32 = 0; var32 < var31; ++var32) {
+                                DynamicObject reqBill = var29[var32];
+                                DynamicObjectCollection tripentry = reqBill.getDynamicObjectCollection("tripentry");
+                                if (null != tripentry) {
+                                    Iterator var16 = tripentry.iterator();
+
+                                    while(true) {
+                                        DynamicObjectCollection travelers;
+                                        do {
+                                            if (!var16.hasNext()) {
+                                                continue label83;
+                                            }
+
+                                            DynamicObject entry = (DynamicObject)var16.next();
+                                            travelers = entry.getDynamicObjectCollection("travelers");
+                                        } while(null == travelers);
+
+                                        Iterator var19 = travelers.iterator();
+
+                                        while(var19.hasNext()) {
+                                            DynamicObject traveler = (DynamicObject)var19.next();
+                                            longSet.add(ErCommonUtils.getPk(traveler.getDynamicObject("fbasedataid")));
+                                        }
+                                    }
+                                }
+                            }
+                        }
+
+                        longSet.remove((Object)null);
+                        if (!longSet.isEmpty()) {
+                            list.getListFilterParameter().setFilter(new QFilter("id", "in", longSet));
+                        }
+                    }
+
+                    int multravelersrange = SystemParamterUtil.getMulTravelersRange(ErCommonUtils.getPk(org));
+                    List allOrgList;
+                    switch (multravelersrange) {
+                        case 0:
+                        default:
+                            DynamicObject dept = (DynamicObject)parentModel.getValue("org");
+                            list.getListFilterParameter().setFilter(QFilter.of("entryentity.dpt.masterid=?", new Object[]{dept.get("masterid")}).and(new QFilter("enable", "=", Boolean.TRUE)));
+                            break;
+                        case 1:
+                            allOrgList = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, Collections.singletonList(ErCommonUtils.getPk(org)), true);
+                            list.getListFilterParameter().setFilter((new QFilter("entryentity.dpt.masterid", "in", allOrgList)).and(new QFilter("enable", "=", Boolean.TRUE)));
+                            break;
+                        case 2:
+                            long rootOrgId = OrgUnitServiceHelper.getRootOrgId();
+                            allOrgList = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, Collections.singletonList(rootOrgId), true);
+                            list.getListFilterParameter().setFilter((new QFilter("entryentity.dpt.masterid", "in", allOrgList)).and(new QFilter("enable", "=", Boolean.TRUE)));
+                    }
+
+                    if (multravelersrange == 0 || multravelersrange == 1) {
+                        Long id = ErCommonUtils.getPk(parentModel.getValue("org"));
+                        if (multravelersrange == 1) {
+                            id = ErCommonUtils.getPk(org);
+                        }
+
+                        listener.getFormShowParameter().setCustomParam("initRootOrgId", id);
+                        listener.getFormShowParameter().setCustomParam("initOrgId", id);
+                    }
+
+                    list.setCustomParam("isIncludeAllSub", true);
+                }
+            }
+
+        });
+    }
+
+    public void afterCreateNewData(EventObject e) {
+        super.afterCreateNewData(e);
+        IFormView parentView = this.getView().getParentView();
+        if (parentView != null) {
+            IDataModel parentModel = parentView.getModel();
+            IDataModel model = this.getModel();
+            model.setValue("formid", parentModel.getValue("formid"));
+            model.setValue("iscurrency", parentModel.getValue("iscurrency"));
+            model.setValue("currency", ErCommonUtils.getPk(parentModel.getValue("currency")));
+            model.setValue("isloan", parentModel.getValue("isloan"));
+            model.setValue("company", parentModel.getValue("company"));
+            model.setValue("org", parentModel.getValue("org"));
+            model.setValue("bizdate", parentModel.getValue("bizdate"));
+            model.setValue("costorgusemode", parentModel.getValue("costorgusemode"));
+            model.setValue("tripentrystatus", "A");
+            DynamicObject applierOb = (DynamicObject)parentModel.getValue("applier");
+            String formId = (String)model.getValue("formid");
+            if (applierOb != null && (ErEntityTypeUtils.isTripReqBill(parentView.getEntityId()) || ErEntityTypeUtils.isTripReimburseBill(parentView.getEntityId()))) {
+                MulBasedataEdit travelersF7 = (MulBasedataEdit)this.getControl("travelers");
+                travelersF7.setMustInput(true);
+            }
+
+            this.setRowIndexPageCache();
+            DynamicObject company = (DynamicObject)model.getValue("company");
+            String costMode = ErCommonUtils.getCostOrgUseMode(company == null ? 0L : (Long)company.getPkValue());
+            if (!"0".equals(costMode)) {
+                BasedataEdit entryCostCenter = (BasedataEdit)this.getControl("std_entrycostcenter");
+                entryCostCenter.setMustInput(true);
+            }
+
+            int tripEntryRowIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex"));
+            if (tripEntryRowIndex != -1) {
+                DynamicObject tripEntry = parentModel.getEntryRowEntity("tripentry", tripEntryRowIndex);
+                DataEntityPropertyCollection tripEntryProps = tripEntry.getDataEntityType().getProperties();
+                DataEntityPropertyCollection properties = model.getDataEntityType().getProperties();
+                Iterator var13 = properties.iterator();
+
+                while(var13.hasNext()) {
+                    IDataEntityProperty property = (IDataEntityProperty)var13.next();
+                    String propertyName = property.getName();
+                    if (tripEntryProps.get(propertyName) != null) {
+                        model.setValue(propertyName, ErCommonUtils.getObjectValue(tripEntry.get(propertyName)));
+                    }
+                }
+
+                if (ErEntityTypeUtils.isTripReimburseBill(formId) && tripEntry.get("tripentryarea") != null) {
+                    model.setValue("triparea", ErCommonUtils.getPk(tripEntry.get("tripentryarea")));
+                }
+            } else {
+                model.setValue("entrycostdept", ErCommonUtils.getPk(parentModel.getValue("costdept")));
+                String centerKey = "std_entrycostcenter";
+                if (!"0".equals(costMode)) {
+                    ErCostCenterUtil.initEntryCostCenter(this.getModel(), "tripentry", model.getEntryCurrentRowIndex("std_entrycostcenter"), -1);
+                    DynamicObject costCenter = (DynamicObject)parentModel.getValue("std_costcenter");
+                    if (model.getProperty(centerKey) == null) {
+                        centerKey = "entrycostcenter";
+                    }
+
+                    if (costCenter != null) {
+                        model.setValue(centerKey, costCenter);
+                    }
+                }
+
+                model.setValue("entrycostcompany", ErCommonUtils.getPk(parentModel.getValue("costcompany")));
+                if (!"0".equals(costMode)) {
+                    if (model.getProperty(centerKey) == null) {
+                        centerKey = "entrycostcenter";
+                    }
+
+                    if (ErCostCenterUtil.costCenterHasCostCompany(model.getValue(centerKey), parentModel.getValue("costcompany"))) {
+                        model.setValue(centerKey, (Object)null);
+                    }
+                }
+
+                model.setValue("tripcurrency", ErCommonUtils.getPk(parentModel.getValue("currency")));
+                DynamicObjectCollection parentTripEntry = parentModel.getEntryEntity("tripentry");
+                if (parentTripEntry != null && parentTripEntry.size() > 0) {
+                    DynamicObject tripEntry = (DynamicObject)parentTripEntry.get(parentTripEntry.size() - 1);
+                    DynamicObject toPlace = tripEntry.getDynamicObject("to");
+                    model.setValue("from", ErCommonUtils.getPk(toPlace));
+                    model.setValue("startdate", tripEntry.getDate("enddate"));
+                    model.setValue("triphappendate", tripEntry.getDate("enddate"));
+                }
+
+                model.setValue("tripexchangerate", BigDecimal.ONE);
+            }
+
+            DynamicObjectCollection travelers = (DynamicObjectCollection)model.getValue("travelers");
+            if (travelers != null && applierOb != null && travelers.size() == 0) {
+                Long pkid = (Long)applierOb.getPkValue();
+                Long[] applierIds = new Long[]{pkid};
+                model.setValue("travelers", applierIds);
+            }
+
+            FormShowParameter formShowParameter = this.getView().getFormShowParameter();
+            Object istravelers = formShowParameter.getCustomParam("istravelers");
+            model.setValue("istravelers", istravelers);
+            if (model.getValue("company") != null) {
+                Object pkValue = ((DynamicObject)model.getValue("company")).getPkValue();
+                boolean isControl = SystemParamterUtil.isEnableTripStandard(Long.parseLong(pkValue.toString())) && SystemParamterUtil.getTripStandardControlLevel(Long.parseLong(pkValue.toString())) != ControlMethodEnum.NO_CONTROL;
+                model.setValue("istripcontrol", isControl);
+            }
+
+            if (company != null) {
+                int showType = ErCommonUtils.getExpenseAssumeShowTypes((Long)company.getPkValue());
+                model.setValue("expensesassumeshowtypes", String.valueOf(showType));
+                if (showType == 2) {
+                    FieldEdit costDept = (FieldEdit)this.getControl("entrycostdept");
+                    costDept.setMustInput(true);
+                    FieldEdit costCompany = (FieldEdit)this.getControl("entrycostcompany");
+                    costCompany.setMustInput(true);
+                }
+            }
+
+            this.showExchangeRate(false);
+            Boolean isMonth = (Boolean)formShowParameter.getCustomParam("isMonth");
+            if (isMonth != null) {
+                model.setValue("ismonth", isMonth);
+            }
+
+            Object ismulwayto = formShowParameter.getCustomParam("ismulwayto");
+            model.setValue("ismulwayto", ismulwayto);
+            CommonServiceHelper.setMulWayToVisible(parentModel, this.getView());
+            boolean iscurrencyshowintripentry = SystemParamterUtil.getIsCurrencyShowinTripentry(ErCommonUtils.getPk(company));
+            model.setValue("iscurrencyshowintripentry", iscurrencyshowintripentry);
+            this.setBudgetInfoByDefaultValue();
+        }
+    }
+
+    private void setBudgetInfoByDefaultValue() {
+        FormShowParameter formShowParameter = this.getView().getFormShowParameter();
+        OperationStatus status = formShowParameter.getStatus();
+        Boolean isQueryBudget = (Boolean)formShowParameter.getCustomParam("isquerybudget");
+        Object expenseItemObj = this.getModel().getValue("tripexpenseitem");
+        if (expenseItemObj != null && status.equals(OperationStatus.ADDNEW) && isQueryBudget) {
+            BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0);
+        }
+
+    }
+
+    public void afterBindData(EventObject e) {
+        super.afterBindData(e);
+        this.setControlVisible();
+        IFormView parentView = this.getView().getParentView();
+        Long companyId = 0L;
+        if (parentView != null) {
+            companyId = ErCommonUtils.getPk(parentView.getModel().getValue("company"));
+        }
+
+        if (!SystemParamterUtil.getTripexpenseitemMustInput(companyId) && !this.isShowExpenseItem()) {
+            this.getView().setVisible(false, new String[]{"tripexpenseitem"});
+        } else {
+            FieldEdit editor = (FieldEdit)this.getView().getControl("tripexpenseitem");
+           // editor.setMustInput(true);
+            this.getView().setVisible(true, new String[]{"tripexpenseitem"});
+        }
+
+        IDataModel model = this.getModel();
+        String formId = (String)model.getValue("formid");
+        Boolean istripcontrol = (Boolean)model.getValue("istripcontrol");
+        if (ErEntityTypeUtils.isTripReimburseBill(formId) && istripcontrol) {
+            FieldEdit editor = (FieldEdit)this.getView().getControl("triparea");
+            editor.setMustInput(true);
+        }
+
+        FieldEdit tripexchangerateEditor;
+        if (ErEntityTypeUtils.isTripReqBill(formId)) {
+            Object type = model.getValue("triporiamouctrltype");
+            String tripamountctrltype = type == null ? "" : type.toString();
+            if ("1".equals(tripamountctrltype) || "3".equals(tripamountctrltype)) {
+                tripexchangerateEditor = (FieldEdit)this.getView().getControl("triporiamount");
+                tripexchangerateEditor.setMustInput(true);
+            }
+        }
+
+        Boolean iscurrency = (Boolean)model.getValue("iscurrency");
+        if (iscurrency) {
+            FieldEdit editor = (FieldEdit)this.getView().getControl("tripcurrency");
+            editor.setMustInput(true);
+            tripexchangerateEditor = (FieldEdit)this.getView().getControl("tripexchangerate");
+            tripexchangerateEditor.setMustInput(true);
+        }
+
+        this.setRowIndexPageCache();
+        int tripIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex"));
+        if (tripIndex >= 0 && this.getView().getParentView() != null) {
+            IDataModel pModel = this.getView().getParentView().getModel();
+            DynamicObject trip = pModel.getEntryRowEntity("tripentry", tripIndex);
+            if (ErEntityTypeUtils.isTripReimburseBill(formId) && trip != null && trip.getDynamicObjectCollection("entryentity").stream().anyMatch((v) -> {
+                return "2".equals(v.getString("settlementtype"));
+            })) {
+                this.getView().setEnable(false, new String[]{"tripcurrency"});
+            }
+        }
+
+        FormShowParameter formShowParameter = this.getView().getFormShowParameter();
+        Map<String, Object> customParams = formShowParameter.getCustomParams();
+        if (customParams.containsKey("tripEntryRowIndex")) {
+            int tripEntryRowIndex = (Integer)customParams.get("tripEntryRowIndex");
+            boolean isEnable = (Boolean)customParams.get("isEnable");
+            Map<String, IDataEntityProperty> allFields = this.getModel().getDataEntityType().getAllFields();
+            String entityId;
+            if (tripEntryRowIndex != -1) {
+                Iterator var14 = allFields.keySet().iterator();
+
+                while(var14.hasNext()) {
+                    entityId = (String)var14.next();
+                    this.getView().setEnable(isEnable, new String[]{entityId});
+                }
+
+                this.getView().setEnable(isEnable, new String[]{"tirpdate"});
+                this.getView().setVisible(isEnable, new String[]{"btnok", "btncancel"});
+            }
+
+            IFormView view = this.getView();
+            if (parentView != null) {
+                entityId = parentView.getEntityId();
+                Boolean isloan = (Boolean)parentView.getModel().getValue("isloan", tripEntryRowIndex);
+                if ("er_tripreqbill_ssc".equals(entityId) && isloan) {
+                    view.setEnable(Boolean.FALSE, new String[]{"from", "to", "mulwayto", "tirpdate", "vehicle", "vehicles", "entrycostcompany", "triporiamount", "entrycostdept", "std_project"});
+                }
+
+                if (!"er_tripreqbill_ssc".equals(entityId) && (this.readOnly() || this.multiVehicles())) {
+                    view.setVisible(Boolean.TRUE, new String[]{"vehicles"});
+                    view.setVisible(Boolean.FALSE, new String[]{"vehicle"});
+                } else {
+                    view.setVisible(Boolean.FALSE, new String[]{"vehicles"});
+                    view.setVisible(Boolean.TRUE, new String[]{"vehicle"});
+                }
+
+                if (ErEntityTypeUtils.isTripReimburseBill(entityId) && tripEntryRowIndex != -1) {
+                    boolean enable = !((DynamicObject)parentView.getModel().getDataEntity(true).getDynamicObjectCollection("tripentry").get(tripEntryRowIndex)).getDynamicObjectCollection("entryentity").stream().anyMatch((v) -> {
+                        return StringUtils.equals(ItemFrom.InvoiceCloud.getValue(), v.getString("itemfrom")) && StringUtils.isNotBlank(v.getString("invoiceno_entry"));
+                    });
+                    this.getView().setEnable(enable, new String[]{"tripcurrency"});
+                }
+            }
+
+            ErMobWorkFlowOtherViewEditUtils.setWorkFlowEditView(this.getView(), customParams, model, 2);
+            this.setTripDateControl();
+        }
+    }
+
+    protected boolean readOnly() {
+        IFormView parentView = this.getView().getParentView();
+        return parentView != null && !"A".equals(parentView.getModel().getValue("billstatus")) && !"D".equals(parentView.getModel().getValue("billstatus"));
+    }
+
+    protected boolean multiVehicles() {
+        return !this.getVihicleFromStdConfig();
+    }
+
+    private boolean getVihicleFromStdConfig() {
+        return StringUtils.equals(ErStdConfig.get("notMultiVehicles"), "true");
+    }
+
+    private void setRowIndexPageCache() {
+        FormShowParameter formShowParameter = this.getView().getFormShowParameter();
+        Map<String, Object> customParams = formShowParameter.getCustomParams();
+        String tripRowIndex = "-1";
+        if (customParams.get("tripEntryRowIndex") != null) {
+            tripRowIndex = customParams.get("tripEntryRowIndex").toString();
+        }
+
+        this.getPageCache().put("tripEntryRowIndex", tripRowIndex);
+    }
+
+    private void setControlVisible() {
+        FormShowParameter formShowParameter = this.getView().getFormShowParameter();
+        Map<String, Object> customParams = formShowParameter.getCustomParams();
+        if (null != this.getView().getParentView() && null != this.getView().getParentView().getModel() && null != this.getView().getParentView().getModel().getProperty("formid") && null != this.getView().getParentView().getModel().getValue("company")) {
+            Long companyId = null;
+            DynamicObject company = (DynamicObject)this.getView().getParentView().getModel().getValue("company");
+            if (company != null) {
+                companyId = (Long)company.getPkValue();
+            }
+
+            if (companyId != null) {
+                String formId = (String)this.getView().getParentView().getModel().getValue("formid");
+                if (customParams.get("isSsc") != null && "er_tripreqbill".equalsIgnoreCase(formId)) {
+                    this.getView().setVisible(true, new String[]{"triporiaccappamount"});
+                    this.setControlEnable(false);
+                } else if (customParams.get("isSsc") != null && "er_tripreimbursebill".equalsIgnoreCase(formId)) {
+                    this.getView().setVisible(false, new String[]{"triporiaccappamount"});
+                    this.setControlEnable(false);
+                } else {
+                    boolean isEnable = (Boolean)customParams.get("isEnable");
+                    this.getView().setVisible(!isEnable, new String[]{"triporiaccappamount"});
+                    this.setControlEnable(true);
+                }
+
+                Boolean isQueryBudget = (Boolean)customParams.get("isquerybudget");
+                String budgeMsgValue = (String)ErCommonUtils.getEMParameter(companyId, "budgeMsgControl");
+                BudgetCommonUtil.setIsQueryBudgetFlag(this.getPageCache(), isQueryBudget);
+                if ((isQueryBudget == null || !isQueryBudget) && !BudgetCommonUtil.getIsQueryEASBudgetFlag(this.getPageCache())) {
+                    this.getView().setVisible(false, new String[]{"budgetamount"});
+                    this.getView().setVisible(false, new String[]{"budgetmsg"});
+                } else {
+                    BudgetCommonUtil.setBudgeInfoVisible(budgeMsgValue, this.getView());
+                }
+
+            }
+        }
+    }
+
+    private void setControlEnable(Boolean isSsc) {
+        this.getView().setEnable(isSsc, new String[]{"from"});
+        this.getView().setEnable(isSsc, new String[]{"to"});
+        this.getView().setEnable(isSsc, new String[]{"tirpdate"});
+        this.getView().setEnable(isSsc, new String[]{"vehicle"});
+        this.getView().setEnable(isSsc, new String[]{"tripcurrency"});
+        this.getView().setEnable(isSsc, new String[]{"tripexchangerate"});
+        this.getView().setEnable(isSsc, new String[]{"triporiamount"});
+    }
+
+    private Boolean isShowExpenseItem() {
+        IDataModel model = this.getModel();
+        String formId = (String)model.getValue("formid");
+        Boolean isLoan = (Boolean)model.getValue("isloan");
+        Boolean istravelers = (Boolean)model.getValue("istravelers");
+        return (!ErEntityTypeUtils.isTripReqBill(formId) || !isLoan) && (!ErEntityTypeUtils.isTripReqBill(formId) || isLoan || !istravelers) && !BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache()) && !BudgetCommonUtil.getIsQueryEASBudgetFlag(this.getPageCache()) && !BudgetCommonUtil.getIsTripReqShowExpenseitemFlag(this.getPageCache()) && !ErEntityTypeUtils.isTripReimburseBill(formId) ? false : true;
+    }
+
+    public void click(EventObject evt) {
+        super.click(evt);
+        IDataModel model = this.getModel();
+        switch (((Control)evt.getSource()).getKey()) {
+            case "btnok":
+                IFormView parentView = this.getView().getParentView();
+                IDataModel parentModel = parentView.getModel();
+                String formId = (String)parentModel.getValue("formid");
+                if (ErEntityTypeUtils.isTripReqBill(formId) && this.amountIsZero()) {
+                    boolean isloan = (Boolean)model.getValue("isloan");
+                    Object type = model.getValue("triporiamouctrltype");
+                    String tripamountctrltype = type == null ? "" : type.toString();
+                    if (isloan && ("2".equals(tripamountctrltype) || "3".equals(tripamountctrltype))) {
+                        this.getView().showTipNotification(ResManager.loadKDString("行程金额必须大于0。", "TripEntryEdit_0", "fi-er-formplugin", new Object[0]));
+                        return;
+                    }
+                }
+
+                if (ErEntityTypeUtils.isTripReqBill(formId)) {
+                    BigDecimal triporiaccappamount = (BigDecimal)model.getValue("triporiaccappamount");
+                    BigDecimal tripOriAmount = (BigDecimal)model.getValue("triporiamount");
+                    if (triporiaccappamount.compareTo(tripOriAmount) > 0) {
+                        this.getView().showErrorNotification(ResManager.loadKDString("核定金额不允许超过借款金额。", "TripEntryEdit_1", "fi-er-formplugin", new Object[0]));
+                        return;
+                    }
+                }
+
+                String billName = parentModel.getDataEntity().getDataEntityType().getName();
+                boolean isTripReimburse = ErEntityTypeUtils.isTripReimburseBill(billName);
+                boolean tripdatecontrol = SystemParamterUtil.isOpenTripDateControl(ErCommonUtils.getPk(parentModel.getValue("company")));
+                if (!(Boolean)parentModel.getValue("istravelers") && !isTripReimburse || !(Boolean)parentModel.getValue("istravelers") && isTripReimburse && tripdatecontrol) {
+                    String error = this.validateTripDate(parentModel);
+                    if (StringUtils.isNotBlank(error)) {
+                        this.getView().showErrorNotification(error);
+                        return;
+                    }
+                }
+
+                Object from = model.getValue("from");
+                Object to = model.getValue("to");
+                String cityMS = "";
+                if (from.equals(to)) {
+                    cityMS = ResManager.loadKDString("出发地与目的地相同,确认继续?", "TripEntryEdit_2", "fi-er-formplugin", new Object[0]);
+                }
+
+                String currencyMs = "";
+                int tripEntryRowIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex"));
+                if (tripEntryRowIndex == 0 || parentModel.getEntryRowCount("tripentry") == 0) {
+                    Object costCompany = model.getValue("entrycostcompany");
+                    Object company = parentModel.getValue("company");
+                    Long newCurrency = BaseCurrencyServiceHelper.getBaseCurrencyId(company, costCompany);
+                    Long oldCurrency = ErCommonUtils.getPk(parentModel.getValue("currency"));
+                    if (newCurrency == null) {
+                        this.getView().showErrorNotification(ResManager.loadKDString("未设置本位币,请联系管理员设置本位币。", "TripEntryEdit_7", "fi-er-formplugin", new Object[0]));
+                        return;
+                    }
+
+                    if (!newCurrency.equals(oldCurrency)) {
+                        currencyMs = ResManager.loadKDString("切换费用承担公司导致本位币变化,将清空填写分录信息,是否继续?", "TripEntryEdit_3", "fi-er-formplugin", new Object[0]);
+                    }
+                }
+
+                if (StringUtils.isNotBlank(cityMS) || StringUtils.isNotBlank(currencyMs)) {
+                    String callBackId = "samecity";
+                    if (StringUtils.isNotBlank(currencyMs)) {
+                        callBackId = "changecurrency";
+                    }
+
+                    this.getView().showConfirm(cityMS + "\r\n" + currencyMs, MessageBoxOptions.OKCancel, new ConfirmCallBackListener(callBackId, this));
+                    return;
+                }
+
+                this.clickOk(model, parentView, parentModel, formId);
+        }
+
+    }
+
+    private boolean amountIsZero() {
+        BigDecimal triporiamount = (BigDecimal)this.getModel().getValue("triporiamount");
+        BigDecimal tripAmount = (BigDecimal)this.getModel().getValue("tripamount");
+        return tripAmount.compareTo(BigDecimal.ZERO) <= 0 || triporiamount.compareTo(BigDecimal.ZERO) <= 0;
+    }
+
+    protected String validateTripDate(IDataModel parentModel) {
+        DynamicObjectCollection parentTripEntry = parentModel.getEntryEntity("tripentry");
+        int parentSize = parentTripEntry.size();
+        Map<Integer, Object> sortMap = new TreeMap();
+        if (parentSize > 0) {
+            parentTripEntry.forEach((entity) -> {
+                if (!sortMap.containsKey(entity.getInt("seq"))) {
+                    sortMap.put(entity.getInt("seq") - 1, entity);
+                }
+
+            });
+        }
+
+        Date startDate = null;
+        Date endDate = null;
+        DynamicObject curTripEntry = this.getModel().getDataEntity();
+        int index = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex"));
+        if (index == -1) {
+            index = parentSize;
+        }
+
+        DynamicObject lastTripEntry = (DynamicObject)sortMap.get(index - 1);
+        if (lastTripEntry != null) {
+            startDate = curTripEntry.getDate("startdate");
+            endDate = lastTripEntry.getDate("enddate");
+            if (startDate != null && endDate != null && startDate.before(endDate)) {
+                return String.format(ResManager.loadKDString("第%1$s程行程期间不能早于第%2$s程行程期间。", "TripEntryEdit_9", "fi-er-formplugin", new Object[0]), index + 1, index);
+            }
+        }
+
+        DynamicObject nextTripEntry = (DynamicObject)sortMap.get(index + 1);
+        if (nextTripEntry != null) {
+            endDate = curTripEntry.getDate("enddate");
+            startDate = nextTripEntry.getDate("startdate");
+            if (startDate != null && endDate != null && startDate.before(endDate)) {
+                return String.format(ResManager.loadKDString("第%1$s程行程期间不能晚于第%2$s程行程期间。", "TripEntryEdit_10", "fi-er-formplugin", new Object[0]), index + 1, index + 2);
+            }
+        }
+
+        return null;
+    }
+
+    public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
+        super.confirmCallBack(messageBoxClosedEvent);
+        String callBackId = messageBoxClosedEvent.getCallBackId();
+        IFormView parentView = this.getView().getParentView();
+        IDataModel parentModel = parentView.getModel();
+        String formId = (String)parentModel.getValue("formid");
+        if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
+            this.clickOk(this.getModel(), parentView, parentModel, formId);
+        }
+
+    }
+
+    protected void clickOk(IDataModel model, IFormView parentView, IDataModel parentModel, String formId) {
+        this.getView().setEnable(false, new String[]{"btnok"});
+        DataEntityPropertyCollection tripEntryProps = parentModel.getDataEntity(true).getDynamicObjectCollection("tripentry").getDynamicObjectType().getProperties();
+        int tripEntryRowIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex"));
+        DataEntityPropertyCollection properties = model.getDataEntityType().getProperties();
+        Map<String, Object> returnParam = new HashMap();
+        DynamicObjectCollection tripEntry = parentModel.getDataEntity().getDynamicObjectCollection("tripentry");
+        Long oldCurrncy = ErCommonUtils.getPk(parentModel.getValue("currency"));
+        IDataEntityProperty tripamount = (IDataEntityProperty)properties.get("tripamount");
+        IDataEntityProperty triporiamount = (IDataEntityProperty)properties.get("triporiamount");
+        IDataEntityProperty property;
+        int i;
+        if (tripamount != null && triporiamount != null) {
+            IDataEntityProperty first = (IDataEntityProperty)properties.get(0);
+            property = (IDataEntityProperty)properties.get(1);
+            i = properties.indexOf(tripamount);
+            int triporiamountIndex = properties.indexOf(triporiamount);
+            properties.set(0, tripamount);
+            properties.set(1, triporiamount);
+            properties.set(i, first);
+            properties.set(triporiamountIndex, property);
+        }
+
+        int entrySize;
+        int rowIndex;
+        if (tripEntryRowIndex == -1) {
+            if (StringUtils.isNotEmpty(formId)) {
+                entrySize = ErCommonUtils.getExpenseAssumeShowTypes(ErCommonUtils.getPk(parentModel.getValue("company")));
+                if (entrySize != 1 && parentModel.getDataEntity(true).getDynamicObjectCollection("tripentry").isEmpty()) {
+                    parentModel.beginInit();
+                    parentModel.setValue("costdept", model.getValue("entrycostdept"));
+                    parentModel.endInit();
+                    parentModel.setValue("costcompany", model.getValue("entrycostcompany"));
+                    this.getView().getParentView().updateView("costdept");
+                    if (oldCurrncy != ErCommonUtils.getPk(parentModel.getValue("currency"))) {
+                        parentView.updateView();
+                        this.getView().sendFormAction(parentView);
+                        this.getView().close();
+                        return;
+                    }
+
+                    if (!(Boolean)parentModel.getValue("iscurrency")) {
+                        model.setValue("tripcurrency", parentModel.getValue("currency"));
+                    }
+                }
+
+                rowIndex = parentModel.createNewEntryRow("tripentry");
+                parentModel.setEntryCurrentRowIndex("tripentry", rowIndex);
+                Iterator var23 = properties.iterator();
+
+                while(var23.hasNext()) {
+                     property = (IDataEntityProperty)var23.next();
+                    if (tripEntry.size() > 0) {
+                        String propertyName = property.getName();
+                        if (tripEntryProps.get(propertyName) != null) {
+                            if ("vehicles".equalsIgnoreCase(propertyName) && ErEntityTypeUtils.isTripReimburseBill(formId)) {
+                                String vehicles = (String)model.getValue(propertyName);
+                                CoreBaseBillServiceHelper.mulTripVehicle(parentModel, vehicles, rowIndex);
+                            }
+
+                            if ("tripexchangerate".equals(propertyName) && properties.containsKey("tripcurrency")) {
+                                parentModel.setValue("tripcurrency", ErCommonUtils.getObjectValue(model.getValue("tripcurrency")), rowIndex);
+                            }
+
+                            parentModel.setValue(propertyName, ErCommonUtils.getObjectValue(model.getValue(propertyName)), rowIndex);
+                        }
+                    }
+                }
+
+                if (tripEntry.size() > 0 && ErEntityTypeUtils.isTripReimburseBill(formId)) {
+                    CoreBaseBillServiceHelper.addDefaultTripExpenseEntry(parentModel, rowIndex);
+                    this.setExpenseEntryValue(parentModel, model, rowIndex);
+                }
+
+                returnParam.put("currentTripEntryIndex", rowIndex);
+            }
+
+            returnParam.put("isUpdate", false);
+        } else if (parentModel.getEntryEntity("tripentry").size() > 0) {
+            if (tripEntryRowIndex == 0) {
+                parentModel.beginInit();
+                parentModel.setValue("costdept", model.getValue("entrycostdept"));
+                parentModel.endInit();
+                Object std_entrycostcenter = model.getValue("std_entrycostcenter");
+                if (std_entrycostcenter != null) {
+                    parentModel.setValue("std_costcenter", std_entrycostcenter);
+                }
+
+                parentModel.setValue("costcompany", model.getValue("entrycostcompany"));
+                this.getView().getParentView().updateView("costdept");
+                if (oldCurrncy != ErCommonUtils.getPk(parentModel.getValue("currency"))) {
+                    parentView.updateView();
+                    this.getView().sendFormAction(parentView);
+                    this.getView().close();
+                    return;
+                }
+            }
+
+            Iterator var21 = properties.iterator();
+
+            while(var21.hasNext()) {
+                property = (IDataEntityProperty)var21.next();
+                String propertyName = property.getName();
+                if (parentModel.getEntryEntity("tripentry").size() > 0 && tripEntryProps.get(propertyName) != null) {
+                    if ("tripexchangerate".equals(propertyName) && properties.containsKey("tripcurrency")) {
+                        parentModel.setValue("tripcurrency", ErCommonUtils.getObjectValue(model.getValue("tripcurrency")), tripEntryRowIndex);
+                    }
+
+                    parentModel.setValue(propertyName, ErCommonUtils.getObjectValue(model.getValue(propertyName)), tripEntryRowIndex);
+                }
+            }
+
+            if (ErEntityTypeUtils.isTripReimburseBill(formId) && parentModel.getEntryEntity("tripentry").size() > 0) {
+                this.setExpenseEntryValue(parentModel, model, tripEntryRowIndex);
+            }
+
+            if (parentModel.getEntryEntity("tripentry").size() > 0) {
+                entrySize = parentModel.getEntryRowCount("entryentity");
+                rowIndex = (Integer)parentModel.getValue("tripday", tripEntryRowIndex);
+
+                for(i = 0; i < entrySize; ++i) {
+                    parentModel.setValue("daycount", rowIndex, i, parentModel.getEntryCurrentRowIndex("tripentry"));
+                }
+
+                returnParam.put("isUpdate", true);
+                returnParam.put("currentTripEntryIndex", parentModel.getEntryCurrentRowIndex("tripentry"));
+            }
+        }
+
+        returnParam.put("isOK", true);
+        returnParam.put("startDate", model.getValue("startDate"));
+        returnParam.put("endDate", model.getValue("endDate"));
+        this.getView().returnDataToParent(returnParam);
+        this.getView().sendFormAction(parentView);
+        this.getView().close();
+    }
+
+    private void setExpenseEntryValue(IDataModel parentModel, IDataModel dataModel, int rowIndex) {
+        DynamicObject tripEntry = parentModel.getEntryRowEntity("tripentry", rowIndex);
+        int tripDay = tripEntry.getInt("tripday");
+        DynamicObjectCollection tripTravlers = tripEntry.getDynamicObjectCollection("travelers");
+        parentModel.setValue("tripentryarea", ErCommonUtils.getPk(dataModel.getValue("triparea")), rowIndex);
+        DynamicObjectCollection expenseEntry = tripEntry.getDynamicObjectCollection("entryentity");
+        if (expenseEntry != null && !expenseEntry.isEmpty()) {
+            for(int i = 0; i < expenseEntry.size(); ++i) {
+                parentModel.setValue("triparea", ErCommonUtils.getPk(dataModel.getValue("tripArea")), i, rowIndex);
+                parentModel.setValue("daycount", tripDay, i, rowIndex);
+                if (!SettlementTypeEnum.MONTH_SETTLEMENT.getCode().equals(parentModel.getValue("settlementtype", i, rowIndex))) {
+                    parentModel.setValue("trip2travelers", tripTravlers, i, rowIndex);
+                    parentModel.setValue("trip2travelerscount", tripTravlers == null ? 0 : tripTravlers.size(), i, rowIndex);
+                }
+            }
+        }
+
+    }
+
+    public void propertyChanged(PropertyChangedArgs e) {
+        super.propertyChanged(e);
+        ChangeData[] valueSet = e.getChangeSet();
+        Object propValue = valueSet[0].getNewValue();
+        String propName = e.getProperty().getName();
+        IDataModel model = this.getModel();
+        String quoteType;
+        BigDecimal tripOriAmount;
+        BigDecimal exchangeRate;
+        int currencyPrecision;
+        BigDecimal tripAmount;
+        BigDecimal triporiaccappamount;
+        BigDecimal tripaccappamount;
+        Date startDate;
+        Date endDate;
+        Long tripDays;
+        switch (propName) {
+            case "tripcurrency":
+                if (propValue == null) {
+                    model.setValue("tripcurrency", ErCommonUtils.getPk(valueSet[0].getOldValue()));
+                }
+
+                this.showExchangeRate(true);
+                BigDecimal tripEntryAmount = (BigDecimal)this.getModel().getValue("triporiamount");
+                this.getModel().setValue("triporiamount", BigDecimal.ZERO);
+                this.getModel().setValue("triporiamount", tripEntryAmount);
+                break;
+            case "triporiamount":
+                quoteType = this.getModel().getProperty("tripquotetype") == null ? "0" : (String)ObjectUtils.defaultIfNull((String)this.getModel().getValue("tripquotetype"), "0");
+                tripOriAmount = (BigDecimal)propValue;
+                exchangeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)model.getValue("tripexchangerate"), BigDecimal.ONE);
+                currencyPrecision = AmountUtils.getCurrencyPrecision(model, "currency");
+                tripAmount = AmountUtils.getCurrencyAmount(tripOriAmount, exchangeRate, currencyPrecision, quoteType);
+                model.setValue("tripamount", tripAmount);
+                model.setValue("triporiaccappamount", tripOriAmount);
+                model.setValue("tripaccappamount", tripAmount);
+                break;
+            case "triporiaccappamount":
+                quoteType = this.getModel().getProperty("tripquotetype") == null ? "0" : (String)ObjectUtils.defaultIfNull((String)this.getModel().getValue("tripquotetype"), "0");
+                triporiaccappamount = (BigDecimal)propValue;
+                BigDecimal triporiamount = (BigDecimal)model.getValue("triporiamount");
+                if (triporiaccappamount.compareTo(triporiamount) > 0) {
+                    triporiaccappamount = triporiamount;
+                    model.setValue("triporiaccappamount", triporiamount);
+                }
+
+                currencyPrecision = AmountUtils.getCurrencyPrecision(model, "currency");
+                BigDecimal changeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)model.getValue("tripexchangerate"), BigDecimal.ONE);
+                if (changeRate == null) {
+                    changeRate = BigDecimal.ONE;
+                }
+
+                tripaccappamount = AmountUtils.getCurrencyAmount(triporiaccappamount, changeRate, currencyPrecision, quoteType);
+                model.setValue("tripaccappamount", tripaccappamount);
+                break;
+            case "tripexchangerate":
+                quoteType = this.getModel().getProperty("tripquotetype") == null ? "0" : (String)ObjectUtils.defaultIfNull((String)this.getModel().getValue("tripquotetype"), "0");
+                exchangeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)propValue, BigDecimal.ONE);
+                tripOriAmount = (BigDecimal)model.getValue("triporiamount");
+                triporiaccappamount = (BigDecimal)model.getValue("triporiaccappamount");
+                currencyPrecision = AmountUtils.getCurrencyPrecision(model, "currency");
+                tripAmount = AmountUtils.getCurrencyAmount(tripOriAmount, exchangeRate, currencyPrecision, quoteType);
+                tripaccappamount = AmountUtils.getCurrencyAmount(triporiaccappamount, exchangeRate, currencyPrecision, quoteType);
+                model.setValue("tripamount", tripAmount);
+                model.setValue("tripaccappamount", tripaccappamount);
+                break;
+            case "startdate":
+                startDate = (Date)propValue;
+                endDate = (Date)model.getValue("enddate");
+                tripDays = CommonServiceHelper.calcDays(startDate, endDate);
+                model.setValue("tripday", tripDays);
+                if (startDate != null && model.getValue("triphappendate") == null) {
+                    model.setValue("triphappendate", startDate);
+                }
+                break;
+            case "enddate":
+                endDate = (Date)propValue;
+                startDate = (Date)model.getValue("startdate");
+                tripDays = CommonServiceHelper.calcDays(startDate, endDate);
+                model.setValue("tripday", tripDays);
+                break;
+            case "to":
+                DynamicObject to = (DynamicObject)propValue;
+                if (to != null) {
+                    IDataModel parentModel = this.getView().getParentView().getModel();
+                    DynamicObject company = (DynamicObject)parentModel.getValue("company");
+                    Long toCityId = (Long)to.getPkValue();
+                    Long companyId = (Long)company.getPkValue();
+                    MainEntityType dataEntityType = model.getDataEntityType();
+                    String orgProp = ((BasedataProp)dataEntityType.getProperty("triparea")).getOrgProp();
+                    ErCommonUtils.getPk(parentModel.getValue(orgProp));
+                    IErTripStdService stdService = new ErTripStdServiceImp();
+                    DynamicObject tripArea = stdService.getTripAreaByCityIdAndCompanyId(toCityId, ErCommonUtils.getPk(parentModel.getValue(orgProp)));
+                    if (tripArea != null) {
+                        model.setValue("triparea", tripArea.getPkValue());
+                    } else {
+                        model.setValue("triparea", (Object)null);
+                    }
+                }
+                break;
+            case "entrycostdept":
+                if (propValue == null) {
+                    propValue = valueSet[0].getOldValue();
+                    this.getModel().setValue("entrycostdept", ErCommonUtils.getPk(propValue));
+                }
+
+                String costDeptShowType = CommonServiceHelper.getBillCostOrgShowType(this.getView());
+                if (!StringUtils.equals("3", costDeptShowType)) {
+                    this.costDeptChange((DynamicObject)propValue);
+                }
+
+                DynamicObject expenseItem = (DynamicObject)model.getValue("tripexpenseitem");
+                log.info("当前 costDeptShowType" + costDeptShowType);
+                log.info("当前 getPageCache" + BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache()));
+                if (expenseItem != null && "2".equals(costDeptShowType) && BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache())) {
+                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0);
+                }
+
+                this.checkExpenseItem(propValue, model);
+                break;
+            case "entrycostcompany":
+                if (propValue == null && valueSet[0].getOldValue() != null) {
+                    this.getModel().setValue("entrycostcompany", valueSet[0].getOldValue());
+                }
+                break;
+            case "tripexpenseitem":
+                if (BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache()) && propValue != null) {
+                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0);
+                }
+                break;
+            case "std_project":
+                if (BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache())) {
+                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0);
+                }
+                break;
+            case "vehicle":
+                if (this.getVihicleFromStdConfig()) {
+                    this.getModel().setValue("vehicles", propValue);
+                }
+                break;
+            case "std_entrycostcenter":
+                if (propValue != null && propValue != "") {
+                    ErCostCenterUtil.costCenterChangeForTripEdit(this.getView(), propValue);
+                }
+        }
+
+    }
+
+    protected void checkExpenseItem(Object propValue, IDataModel model) {
+        if (propValue != null) {
+            Set<Long> exceptRelExpItems = ExpenseItemServiceHelper.getNotRelOrgExpItemIds((Long)((DynamicObject)propValue).getPkValue());
+            DynamicObject tripExpenseItem = (DynamicObject)this.getModel().getValue("tripexpenseitem");
+            if (tripExpenseItem != null && exceptRelExpItems.contains(tripExpenseItem.getLong("id"))) {
+                model.setValue("tripexpenseitem", (Object)null);
+            }
+        }
+
+    }
+
+    protected void costDeptChange(DynamicObject entryCostDept) {
+        if (entryCostDept != null) {
+            DynamicObject company = (DynamicObject)this.getModel().getValue("company");
+            DynamicObject costCompany = (DynamicObject)this.getModel().getValue("entrycostcompany");
+            CostDeptF7ChangePram costDeptF7ChangePram = new CostDeptF7ChangePram(Boolean.TRUE, entryCostDept, costCompany, company);
+            Long costCompanyId = CoreBaseBillServiceHelper.getAccountOrgId(costDeptF7ChangePram);
+            this.getModel().setValue("entrycostcompany", costCompanyId);
+        }
+    }
+
+    private void showExchangeRate(boolean refreshExchangeRate) {
+        IDataModel model = this.getModel();
+        IDataModel parentModel = this.getView().getParentView().getModel();
+        DynamicObject tripCurrency = (DynamicObject)model.getValue("tripcurrency");
+        DynamicObject currency = (DynamicObject)parentModel.getValue("currency");
+        boolean showExchangeRate = tripCurrency != null && currency != null && !tripCurrency.getPkValue().equals(currency.getPkValue());
+        this.getView().setVisible(showExchangeRate, new String[]{"tripexchangerate", "tripamount"});
+        String quoteType = "0";
+        if (refreshExchangeRate) {
+            BigDecimal exchangeRate = BigDecimal.ONE;
+            if (tripCurrency != null && currency != null) {
+                long sourceCurrencyId = tripCurrency.getLong("id");
+                long targetCurrencyId = currency.getLong("id");
+                long companyId = (Long)parentModel.getValue("company_Id");
+                Map<String, Object> exchangeRateAndQuoteType = CommonServiceHelper.getExchangeRateFromSysParams(companyId, parentModel.getValue("costcompany"), sourceCurrencyId, targetCurrencyId, model);
+                quoteType = (String)ObjectUtils.defaultIfNull((String)exchangeRateAndQuoteType.get("quoteType"), "0");
+                exchangeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)exchangeRateAndQuoteType.get("exchangeRate"), BigDecimal.ONE);
+            }
+
+            if (this.getModel().getProperty("tripquotetype") != null) {
+                this.getModel().setValue("tripquotetype", quoteType);
+            }
+
+            this.getModel().setValue("tripexchangerate", exchangeRate);
+        }
+
+    }
+
+    private void setTripDateControl() {
+        IDataModel pModel = this.getView().getParentView().getModel();
+        DateRangeEdit tripDate = (DateRangeEdit)this.getControl("tirpdate");
+        String entryName = pModel.getDataEntityType().getName();
+        LocalDate now = LocalDate.now();
+        Long companyId = ErCommonUtils.getPk(pModel.getValue("company"));
+        if (ErEntityTypeUtils.isTripReqBill(entryName) && StringUtils.equals("1", ErCommonUtils.getTripDateSelectRange(companyId))) {
+            tripDate.setMinDate(ErCommonUtils.getDateFromLocalDate(now));
+        } else {
+            if (ErEntityTypeUtils.isTripReimburseBill(entryName) && StringUtils.equals("0", SystemParamterUtil.getTripReimDateSelectRange(companyId))) {
+                tripDate.setMaxDate(ErCommonUtils.getDateFromLocalDate(now));
+            }
+
+            if (pModel.getProperty("isopentripstd") != null) {
+                Object company = pModel.getValue("company");
+                if ((!(Boolean)pModel.getValue("istravelers") || (Boolean)pModel.getValue("travelerssamestd")) && SystemParamterUtil.isOpenTripDateControl(ErCommonUtils.getPk(company)) && (Boolean)pModel.getValue("isopentripstd") && pModel.getEntryRowCount("tripentry") != 0) {
+                    int currentIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex"));
+                    currentIndex = currentIndex == -1 ? pModel.getEntryRowCount("tripentry") - 1 : currentIndex - 1;
+                    DynamicObjectCollection tripEntry = pModel.getDataEntity(true).getDynamicObjectCollection("tripentry");
+                    if (currentIndex >= 0 && tripEntry.size() != 0) {
+                        DynamicObject preRow = (DynamicObject)tripEntry.get(currentIndex);
+                        Date minDate = preRow.getDate("enddate");
+                        tripDate.setMinDate(minDate);
+                    }
+                }
+            }
+        }
+    }
+}

+ 0 - 365
src/main/java/tmc/bei/task/synTransdetailTask.java

@@ -1,365 +0,0 @@
-package tmc.bei.task;
-
-import fi.cas.opplugin.TypeUtils;
-import kd.bos.context.RequestContext;
-import kd.bos.dataentity.OperateOption;
-import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.entity.operate.result.OperationResult;
-import kd.bos.exception.KDException;
-import kd.bos.logging.Log;
-import kd.bos.logging.LogFactory;
-import kd.bos.login.utils.DemoSMSSender;
-import kd.bos.orm.query.QCP;
-import kd.bos.orm.query.QFilter;
-import kd.bos.schedule.executor.AbstractTask;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
-import kd.bos.servicehelper.operation.OperationServiceHelper;
-import org.apache.commons.lang3.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.json.XML;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.*;
-import java.math.BigDecimal;
-import java.net.Socket;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-
-/**
- * 自动获取资金流水调度任务插件
- * 2024-09-27 wangj
- * 主要功能:调用前置机接口获取第三方系统资金流水写入交易明细
- */
-public class synTransdetailTask extends AbstractTask {
-    protected static final Log log = LogFactory.getLog(DemoSMSSender.class);
-    @Override
-    public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
-        //1.获取计划参数,计算取数日期
-        String type = (String) map.get("type");
-        String queryDate = getDateByType(type);
-        //2.获取接口链接等信息
-        DynamicObject jkpzxx = BusinessDataServiceHelper.loadSingle("nckd_jkpzxx",new QFilter[]{new QFilter("number","=","paytozfqz")});
-        String servername =  jkpzxx.getString("nckd_servername");
-        String port =  jkpzxx.getString("nckd_port");
-        //3.获取取数银行账号,循环查询接口(第三方不支持批量查询)
-        QFilter qFilter_enable = new QFilter("enable", QCP.equals,"1");
-        QFilter qFilter_status = new QFilter("status", QCP.equals, "C");
-        QFilter qFilter_acctstatus = new QFilter("acctstatus", QCP.equals, "normal");
-        DynamicObject[] accountBanks = BusinessDataServiceHelper.load("am_accountbank",
-                "id,bankaccountnumber,openorg,bank",new QFilter[]{qFilter_enable,qFilter_status,qFilter_acctstatus});
-        for(DynamicObject accountBank : accountBanks){
-            String bankaccountnumber = accountBank.getString("bankaccountnumber");
-            //4.拼接xml对象
-            String bodyxml = createMessageRequest(queryDate,bankaccountnumber);
-            log.info("银行账号:"+bankaccountnumber+"请求xml:"+bodyxml);
-            log.info("银行账号:"+bankaccountnumber+"开始调用接口");
-            //5.调用接口
-            JSONObject cbsReturnJson = socketService(servername,port,bodyxml);
-            log.info("银行账号:"+bankaccountnumber+"调用接口返回结果:"+cbsReturnJson.toString());
-            if(cbsReturnJson!=null && cbsReturnJson.length()>0) {
-                JSONObject reMessage = cbsReturnJson.getJSONObject("Message");
-                JSONObject reHeadInfo = reMessage.getJSONObject("HeadInfo");
-                if (reHeadInfo.getString("errorcode").contains("000000")) {//响应成功
-//                    if ("000".equals(reBodyInfo.getString("Fs_retCode"))) {
-                        JSONObject reBodyInfo = reMessage.getJSONObject("BodyInfo");
-                        log.info("银行账号:"+bankaccountnumber+"发送前置机响应成功,前置机接口发送成功");
-                        //6.获取成功写入交易明细表***
-                    try {
-                        writeTransdetail(reBodyInfo,bankaccountnumber);
-                    } catch (Exception e) {
-                        throw new RuntimeException(e);
-                    }
-                    log.info("银行账号:"+bankaccountnumber+"写入交易明细成功");
-//                    } else {
-//                        log.info("银行账号:"+bankaccountnumber+"发送前置机响应成功,前置机接口发送失败");
-//                    }
-                } else {
-                    log.info("银行账号:"+bankaccountnumber+"发送前置机响应失败:"+reHeadInfo.getString("errormsg"));
-                }
-            }
-        }
-    }
-
-    private void writeTransdetail(JSONObject reBodyInfo, String bankaccountnumber) throws ParseException {
-        //银行账号匹配获取银行账户
-        QFilter qFilter_bankaccountnumber = new QFilter("bankaccountnumber",QCP.equals,bankaccountnumber);
-        DynamicObject[] bd_accountbanks = BusinessDataServiceHelper.load(
-                "bd_accountbanks","id,number,name,openorg.number,openorg.name,bank.number,bank.name",
-                    new QFilter[]{qFilter_bankaccountnumber});
-        DynamicObject bd_accountbank = null;
-        if(bd_accountbanks!=null && bd_accountbanks.length>0){
-            bd_accountbank = bd_accountbanks[0];
-        }
-        //拼装接口返回的交易流水号集合
-        List<String> detailids = new ArrayList<String>();
-        JSONArray actrsview_rich = reBodyInfo.getJSONArray("actrsview_rich");
-        for(int i=0;i<actrsview_rich.length();i++){
-            JSONObject actrsview_rich_obj = actrsview_rich.getJSONObject(i);
-            String TransNbr = String.valueOf(actrsview_rich_obj.getLong("TransNbr"));
-            detailids.add(TransNbr);
-        }
-        log.info("预计写入交易明细:"+actrsview_rich.length()+"条");
-        //查询一次交易流水表缓存已存在的交易流水记录
-        QFilter qFilter_detailid = new QFilter("detailid",QCP.in,detailids);
-        DynamicObject[] bills = BusinessDataServiceHelper.load("bei_transdetail","id,detailid",new QFilter[]{qFilter_detailid});
-        Map tempdetailid = new HashMap();
-        int isHaveBillSize = 0;
-        for(DynamicObject bill : bills){
-            String detailid = bill.getString("detailid");
-            tempdetailid.put(detailid,detailid);
-            isHaveBillSize ++;
-        }
-        log.info("已存在交易明细:"+isHaveBillSize+"条");
-        //缓存所有币种
-        Map currencyMap = getCurrencyMap();
-        //过滤已存在的记录,写入不存在的记录
-        int size = actrsview_rich.length() - isHaveBillSize;
-        log.info("最终写入交易明细:"+size+"条");
-        DynamicObject[] datalist = new DynamicObject[size];
-        for(int i=0;i<actrsview_rich.length();i++){
-            JSONObject actrsview_rich_obj = actrsview_rich.getJSONObject(i);
-            String transSet = String.valueOf(actrsview_rich_obj.getLong("TransSet"));
-            if(null == tempdetailid || null == tempdetailid.get(transSet)){
-                DynamicObject bill = createBill(actrsview_rich_obj,bd_accountbank,currencyMap);
-                datalist[i] = bill;
-            }
-        }
-        if(datalist.length>0){
-            log.info("拼装完成,开始保存");
-            OperationResult result = OperationServiceHelper.executeOperate("save","zb_ps_pricemgconfig",datalist, OperateOption.create());
-            log.info("保存结束:"+result.getMessage());
-        }
-        log.info("写入交易明细完成");
-    }
-
-    private DynamicObject createBill(JSONObject actrsview_rich_obj, DynamicObject bd_accountbank, Map currencyMap) throws ParseException {
-        DynamicObject bill = BusinessDataServiceHelper.newDynamicObject("bei_betransdetail_imp");
-        //交易明细编号
-//                bill.set("billno",transSet);
-        if(bd_accountbank!=null){
-            //资金组织
-            DynamicObject company = bd_accountbank.getDynamicObject("openorg");
-            bill.set("company",company.getPkValue());
-            //银行账号
-            bill.set("accountbank",bd_accountbank.getPkValue());
-            //开户银行
-            DynamicObject bank = bd_accountbank.getDynamicObject("bank");
-            bill.set("bank",bank.getPkValue());
-        }
-        //单据状态
-        bill.set("billstatus","A");
-        //币种
-        String currency = String.valueOf(actrsview_rich_obj.getInt("CcyNbr"));
-        bill.set("currency",currencyMap.get(currency));
-        //交易日期
-        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
-        String entryDate = String.valueOf(actrsview_rich_obj.getInt("EntryDate"));
-        String bizdate = entryDate.substring(0,4)+"-"+entryDate.substring(4,6)+"-"+entryDate.substring(6,8);
-        bill.set("bizdate",sdf1.format(bizdate));
-        //交易时间
-        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String entryTime = String.valueOf(actrsview_rich_obj.getInt("EntryTime"));
-        String biztime = transTime(bizdate,entryTime);
-        bill.set("biztime",sdf2.parse(biztime));
-        //摘要
-        String description = "";
-        if(StringUtils.isNotBlank(actrsview_rich_obj.getString("BankText"))){
-            //交易银行内部摘要
-            description = actrsview_rich_obj.getString("BankText")+";";
-        }
-        if(StringUtils.isNotBlank(actrsview_rich_obj.getString("CltText"))){
-            //交易银行内部摘要
-            description = description + actrsview_rich_obj.getString("CltText")+";";
-        }
-        if(StringUtils.isNotBlank(actrsview_rich_obj.getString("ElecText"))){
-            //交易银行内部摘要
-            description = description + actrsview_rich_obj.getString("ElecText")+";";
-        }
-        if(StringUtils.isNotBlank(actrsview_rich_obj.getString("StmVar"))){
-            //交易银行内部摘要
-            description = description + actrsview_rich_obj.getString("StmVar")+";";
-        }
-        bill.set("description",description);
-        //收款金额/付款金额
-        BigDecimal transAmt = actrsview_rich_obj.getBigDecimal("TransAmt");
-        String transDir = actrsview_rich_obj.getString("TransDir");
-        if("C".equals(transDir)){
-            bill.set("creditamount",transAmt);//贷-收款
-        }else if("D".equals(transDir)){
-            bill.set("debitamount",transAmt);//借-付款
-        }
-        //余额
-        BigDecimal transbalance = actrsview_rich_obj.getBigDecimal("OnlBal");
-        bill.set("transbalance",transbalance);
-        //对方户名
-        String oppunit = actrsview_rich_obj.getString("YourRichName");
-        bill.set("oppunit",oppunit);
-        //对方账号
-        String oppbanknumber = actrsview_rich_obj.getString("YourRichNbr");
-        bill.set("oppbanknumber",oppbanknumber);
-        //对方开户行
-        String oppbank = actrsview_rich_obj.getString("CltText");
-        bill.set("oppbank",oppbank);
-        //业务类型
-        bill.set("biztype","1");
-        //明细流水号
-        String detailid = String.valueOf(actrsview_rich_obj.getLong("TransNbr"));
-        bill.set("detailid",detailid);
-        //业务参考号
-        String bizrefno = String.valueOf(actrsview_rich_obj.getLong("TraceNbr"));
-        bill.set("bizrefno",bizrefno);
-        //数据来源
-        bill.set("datasource","hxsys");
-        //入账状态
-        bill.set("receredtype","0");
-//                //记账日期
-//                bill.set("transdate",new Date());
-        return bill;
-    }
-
-    private Map getCurrencyMap() {
-        Map currMap = new HashMap();
-        QFilter qFilter_enable = new QFilter("enable",QCP.equals,"1");
-        DynamicObject[] currCol = BusinessDataServiceHelper.load(
-                "bd_currency","id,number,nckd_hxxtno",new QFilter[]{qFilter_enable});
-        for(DynamicObject currObj : currCol){
-            if(StringUtils.isNotBlank(currObj.getString("nckd_hxxtno"))){
-                currMap.put(currObj.getString("nckd_hxxtno"),currObj);
-            }
-        }
-        return currMap;
-    }
-
-    private String transTime(String entryDate, String entryTime) {
-        String time = "";
-        switch (entryTime.length()){
-            case 1:time="00:00:0"+entryTime;break;
-            case 2:time="00:00:"+entryTime;break;
-            case 3:time="00:0"+entryTime.substring(0,1)+":"+entryTime.substring(1);break;
-            case 4:time="00:"+entryTime.substring(0,2)+":"+entryTime.substring(2);break;
-            case 5:time="0"+entryTime.substring(0,1)+":"+entryTime.substring(1,3)+":"+entryTime.substring(3);break;
-            case 6:time=entryTime.substring(0,2)+":"+entryTime.substring(2,4)+":"+entryTime.substring(4);break;
-        }
-
-        return entryDate+" "+time;
-    }
-
-    private String createMessageRequest(String queryDate, String bankaccountnumber) {
-        try {
-            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-            Document doc = dBuilder.newDocument();
-            //创建Message节点
-            Element rootElement = doc.createElement("Message");
-            doc.appendChild(rootElement);
-            //创建HeadInfo节点
-            Element head = doc.createElement("HeadInfo");
-            rootElement.appendChild(head);
-            //拼接HeadInfo报文
-            createElement(doc, head, "transcode", "ACRCTRSQ"); //请求交易代码
-            createElement(doc, head, "channelcode", "JF");//发起渠道
-            Calendar currentdate = Calendar.getInstance();
-            createElement(doc, head, "channeldate", TypeUtils.date2String(currentdate.getTime(),"yyyyMMdd"));//发起渠道日期
-            String channelserno = TypeUtils.date2String(currentdate.getTime(),"yyyyMMdd HHmmss");
-            createElement(doc, head, "channelserno", channelserno);//发起渠道流水
-            createElement(doc, head, "channeltime", currentdate.get(Calendar.HOUR)+""+currentdate.get(Calendar.MINUTE)+""+currentdate.get(Calendar.SECOND));
-            createElement(doc, head, "brno", "");//交易机构,可为空
-            createElement(doc, head, "tellerno", "");//操作柜员,可为空
-            createElement(doc, head, "terminalno", "");//操作终端号,可为空
-            createElement(doc, head, "reserve", "");//保留域,可为空
-            //创建BodyInfo节点
-            Element body = doc.createElement("BodyInfo");
-            rootElement.appendChild(body);
-            //拼接BodyInfo报文
-            createElement(doc, body, "RichNbr", bankaccountnumber); //户口号
-            createElement(doc, body, "QryRichType", "1"); //交易查询标志
-            createElement(doc, body, "TransTypeFlag", "N"); //交易类型选项标志
-            createElement(doc, body, "BgnDate", queryDate); //查询起始日期
-            createElement(doc, body, "EndDate", queryDate); //查询结束日期
-            createElement(doc, body, "QryDir", "D"); //查询排序方式
-            createElement(doc, body, "MinAmt", "0"); //查询金额下限
-            createElement(doc, body, "MaxAmt", "999999999999.99"); //查询金额上限
-            createElement(doc, body, "YourType", "N"); //查询金额上限
-            createElement(doc, body, "RowCnt", "20000");//展示条数
-            createElement(doc, body, "TotalFlag", "0");//汇总标志
-            // 指定编码格式为GBK
-            TransformerFactory transformerFactory = TransformerFactory.newInstance();
-            Transformer transformer = transformerFactory.newTransformer();
-            transformer.setOutputProperty(OutputKeys.ENCODING, "GBK");
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
-            DOMSource source = new DOMSource(doc);
-            StringWriter writer = new StringWriter();
-            StreamResult result = new StreamResult(writer);
-            transformer.transform(source, result);
-            int length = writer.toString().length();
-            String xmlStr = "00000" +String.valueOf(length)+writer.toString();
-            return xmlStr;
-        }catch (Exception e) {
-            log.info("拼接请求报文异常:"+e.getMessage());
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    private static void createElement(Document doc, Element parent, String name, String value) {
-        Element element = doc.createElement(name);
-        element.appendChild(doc.createTextNode(value));
-        parent.appendChild(element);
-    }
-
-    private String getDateByType(String type) {
-        String date = "";
-        Calendar now = Calendar.getInstance();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-        if("now".equals(type)){
-            date = sdf.format(now.getTime());
-        }else if("before".equals(type)){
-            now.add(Calendar.DAY_OF_MONTH,-1);
-            date = sdf.format(now.getTime());
-        }else{
-            date = type;
-        }
-        return date;
-    }
-
-    public static JSONObject socketService(String serverName,String port,String xmlData){
-        try {
-            Socket client = new Socket(serverName, TypeUtils.nullToInt(port));
-            OutputStream outToServer = client.getOutputStream();
-            PrintWriter out = new PrintWriter(new OutputStreamWriter(outToServer, "GBK"), true);
-            out.println(xmlData);
-
-            InputStream inFromServer = client.getInputStream();
-            BufferedReader in = new BufferedReader(new InputStreamReader(inFromServer, "GBK"));
-            StringBuilder responseBuilder = new StringBuilder();
-            String line;
-            while ((line = in.readLine()) != null) {
-                responseBuilder.append(line);
-            }
-            String responseJson = responseBuilder.toString();
-            if(responseJson.indexOf("<?xml")>0){
-                int index = responseJson.indexOf("<?xml");
-                responseJson = responseJson.substring(index);
-            }
-            JSONObject jsonObject = XML.toJSONObject(responseJson);
-            client.close();
-            return jsonObject;
-        } catch (IOException e) {
-            e.printStackTrace();
-            log.info("短信发送失败:"+e.getMessage());
-        }
-        return null;
-    }
-}