From f6dd2dc4b8d4f0a58473839fbc686cb4fdb6b25f Mon Sep 17 00:00:00 2001 From: zhaoxin Date: Mon, 23 Jul 2018 18:22:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=98=E6=AC=BE=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E6=B1=BD=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FundPayment/LCFundPaymentTempInfo.jsp | 22 + .../CopyFundIncomeTempToFormal.java | 3 +- .../flowpayment/CopyFundPaymentToTemp.java | 70 +++ .../flow/fund/flowpayment/FundPaymentCar.java | 426 ++++++++++++++++++ .../handler/LCFundPaymentTempInfoHandler.java | 87 ++++ 5 files changed, 606 insertions(+), 2 deletions(-) create mode 100644 WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LCFundPaymentTempInfo.jsp create mode 100644 src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundPaymentToTemp.java create mode 100644 src_tenwa/com/tenwa/flow/fund/flowpayment/FundPaymentCar.java create mode 100644 src_tenwa/com/tenwa/handler/LCFundPaymentTempInfoHandler.java diff --git a/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LCFundPaymentTempInfo.jsp b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LCFundPaymentTempInfo.jsp new file mode 100644 index 000000000..b80dd6cd1 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LCFundPaymentTempInfo.jsp @@ -0,0 +1,22 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-07-11 + Content: 示例详情页面 + History Log: + */ + String ishistory = CurPage.getParameter("IsHistory"); + String flowunid = CurPage.getParameter("FlowUnid"); + ASObjectModel doTemp = new ASObjectModel("LCFundPaymentTempInfo"); +/* if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory"); + } */ + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(flowunid); + + String sButtons[][] = { + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundIncomeTempToFormal.java b/src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundIncomeTempToFormal.java index 9682368e8..44766f771 100644 --- a/src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundIncomeTempToFormal.java +++ b/src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundIncomeTempToFormal.java @@ -46,8 +46,7 @@ public class CopyFundIncomeTempToFormal extends BaseBussiness{ otherProperty.clear(); otherProperty.put("FLOWUNID", ""); otherProperty.put("RELATIVE_ID", incomeID); - //otherProperty.put("PAY_STATUS", "apply_pass"); - otherProperty.put("PAY_STATUS", null);//众联项目只有付款申请,不需要实际付款流程 + otherProperty.put("PAY_STATUS", "apply_pass"); DataOperatorUtil.copySingleJBO(LC_FUND_INCOME_TEMP.CLASS_NAME, fromCondition,LC_FUND_INCOME.CLASS_NAME, null, otherProperty,Sqlca.getTransaction()); } } diff --git a/src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundPaymentToTemp.java b/src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundPaymentToTemp.java new file mode 100644 index 000000000..19814cf24 --- /dev/null +++ b/src_tenwa/com/tenwa/flow/fund/flowpayment/CopyFundPaymentToTemp.java @@ -0,0 +1,70 @@ +package com.tenwa.flow.fund.flowpayment; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import com.amarsoft.app.util.ProductParamUtil; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.amarsoft.dict.als.cache.CodeCache; +import com.amarsoft.dict.als.object.Item; +import com.tenwa.flow.baseBussion.BaseBussiness; +/** + * 拷贝差额放款到临时表 + * @author zhulh + * + */ + +public class CopyFundPaymentToTemp extends BaseBussiness{ + public Object run(Transaction Sqlca) throws Exception{ + this.initBussinessParam(Sqlca.getTransaction()); + String contractId = (String)this.getAttribute("ContractId"); + String flowunid = (String)this.getAttribute("ObjectNo"); + String userId = (String)this.getAttribute("CurUserID"); + String productId = (String)this.getAttribute("ProductId"); + //获取坐扣项 + Map> params = ProductParamUtil.getProductComponentType(productId, "PRD0315"); + List deductFeeType = new ArrayList(); + for(Entry> feeTypes : params.entrySet()) { + if(!feeTypes.getValue().containsKey("isBalance")) { + continue; + } + String isBalance = feeTypes.getValue().get("isBalance"); + if("yes".equals(isBalance)) { + deductFeeType.add(feeTypes.getKey()); + } + } + + Item[] items = CodeCache.getItems("FeeType"); + String fundList = ""; + for(Item item : items) { + for(String feetype : deductFeeType) { + if(feetype.equals(item.getRelativeCode())) { + if(fundList.length() != 0) { + fundList += ","; + } + fundList += "'" + item.getItemNo() + "'"; + break; + } + } + } + if(fundList.length() > 0) { + fundList += ","; + } + + fundList += "'feetype27'"; + + ASUser user = ASUser.getUser(userId, Sqlca); + FundPaymentCar fp = new FundPaymentCar(); + fp.setFlowunid(flowunid); + fp.setContractId(contractId); + fp.setUserId(user.getUserID()); + fp.setOrgId(user.getOrgID()); + fp.setFundList(fundList); + fp.setDeductMoney(Sqlca.getTransaction()); + String sMessage="true"; + return sMessage; + } +} diff --git a/src_tenwa/com/tenwa/flow/fund/flowpayment/FundPaymentCar.java b/src_tenwa/com/tenwa/flow/fund/flowpayment/FundPaymentCar.java new file mode 100644 index 000000000..4930aaa11 --- /dev/null +++ b/src_tenwa/com/tenwa/flow/fund/flowpayment/FundPaymentCar.java @@ -0,0 +1,426 @@ +package com.tenwa.flow.fund.flowpayment; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import jbo.app.tenwa.calc.LC_FUND_INCOME; +import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP; +import jbo.app.tenwa.calc.LC_FUND_PLAN; +import jbo.app.tenwa.calc.VI_LC_FUND_PLAN; +import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT; +import jbo.com.tenwa.lease.comm.LC_PAY_CONDTION; +import jbo.com.tenwa.lease.comm.LC_PAY_CONDTION_TEMP; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.BizObjectManager; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.util.StringFunction; +import com.tenwa.comm.util.jboutil.DataOperatorUtil; +import com.tenwa.reckon.util.UUIDUtil; + +public class FundPaymentCar { + private String fundList; + private String flowunid; + private String equipOverMoney; + private String equipAMTID; + private String userId; + private String orgId; + private String planids; + private String overmoneys; + private String factmoneys; + private String feeadjusts; + private String returnID; + private String contractId; + + public String getReturnID() { + return returnID; + } + + public void setReturnID(String returnID) { + this.returnID = returnID; + } + + public String getFactmoneys() { + return factmoneys; + } + + public void setFactmoneys(String factmoneys) { + this.factmoneys = factmoneys; + } + + public String getFeeadjusts() { + return feeadjusts; + } + + public void setFeeadjusts(String feeadjusts) { + this.feeadjusts = feeadjusts; + } + + public String getPlanids() { + return planids; + } + + public void setPlanids(String planids) { + this.planids = planids; + } + + public String getOvermoneys() { + return overmoneys; + } + + public void setOvermoneys(String overmoneys) { + this.overmoneys = overmoneys; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public String getEquipAMTID() { + return equipAMTID; + } + + public void setEquipAMTID(String equipAMTID) { + this.equipAMTID = equipAMTID; + } + + public String getEquipOverMoney() { + return equipOverMoney; + } + + public void setEquipOverMoney(String equipOverMoney) { + this.equipOverMoney = equipOverMoney; + } + + public String getFlowunid() { + return flowunid; + } + + public void setFlowunid(String flowunid) { + this.flowunid = flowunid; + } + + public String getFundList() { + return fundList; + } + + public void setFundList(String fundList) { + this.fundList = fundList; + } + + public String getContractId() { + return contractId; + } + + public void setContractId(String contractId) { + this.contractId = contractId; + } + + public String setDeductMoney(JBOTransaction tx) throws Exception{ + try{ + BizObject boLFPAMT = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, "contract_id = '" + contractId + "' and fee_type = 'feetype10'").getSingleResult(false); + BizObject boCA = JBOFactory.createBizObjectQuery(CUSTOMER_ACCOUNT.CLASS_NAME, "contract_id=:contract_id").setParameter("contract_id", contractId).getSingleResult(false); + BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME); + String incomeID = UUIDUtil.getUUID(); + BigDecimal outOverMoney = new BigDecimal(boLFPAMT.getAttribute("PLAN_MONEY").getString()); + tx.join(bomLFIT); + List boLFPs = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, + "contract_id = '" + contractId + "' and fee_type in (" + fundList + ") ").getResultList(false); + BigDecimal deductMoney = new BigDecimal(0); + for(int i = 0;i < boLFPs.size(); i ++){ + if(outOverMoney.compareTo(new BigDecimal(0)) == 0){ + continue; + } + String planID = boLFPs.get(i).getAttribute("ID").getString(); + String inOvermoney = boLFPs.get(i).getAttribute("PLAN_MONEY").getString(); + if(outOverMoney.compareTo(new BigDecimal(inOvermoney)) < 0){ + inOvermoney = outOverMoney.toString(); + } + deductMoney = deductMoney.add(new BigDecimal(inOvermoney)); + outOverMoney = outOverMoney.subtract(new BigDecimal(inOvermoney)); + BizObject boLFP = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, "id=:PlanID").setParameter("PlanID", planID).getSingleResult(false); + BizObject boLFITOut = bomLFIT.newObject();//抵扣车辆款 + boLFITOut.setAttributeValue("QUOT_ID", boLFP.getAttribute("QUOT_ID").getString()); + boLFITOut.setAttributeValue("CUST_ID", boLFP.getAttribute("CUST_ID").getString()); + boLFITOut.setAttributeValue("PROJECT_ID", boLFP.getAttribute("PROJECT_ID").getString()); + boLFITOut.setAttributeValue("RELATIVE_ID", incomeID); + boLFITOut.setAttributeValue("PROJECT_PLAN_NUMBER", boLFP.getAttribute("PROJECT_PLAN_NUMBER").getString()); + boLFITOut.setAttributeValue("CONTRACT_ID", boLFP.getAttribute("CONTRACT_ID").getString()); + boLFITOut.setAttributeValue("CONTRACT_PLAN_NUMBER", boLFP.getAttribute("CONTRACT_PLAN_NUMBER").getString()); + boLFITOut.setAttributeValue("PAYMENT_NUMBER", boLFP.getAttribute("PAYMENT_NUMBER").getString()); + boLFITOut.setAttributeValue("PLAN_ID", planID); + boLFITOut.setAttributeValue("PLAN_LIST", boLFPAMT.getAttribute("PLAN_LIST").getInt()); + boLFITOut.setAttributeValue("PAY_TYPE", "pay_type_out"); + boLFITOut.setAttributeValue("FEE_TYPE", "feetype10"); + boLFITOut.setAttributeValue("SETTLE_METHOD", "settlemethod11"); + List boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0' and PAY_STATUS<>'apply_return'").setParameter("PLAN_ID", planID) + .getResultList(false); + List boLCFIT = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and pay_type='pay_type_out' and IS_FLOWING = '0' and ROLL_BACK='0' and PAY_STATUS is null").setParameter("PLAN_ID", planID) + .getResultList(false); + boLFITOut.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1); + boLFITOut.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString()); + boLFITOut.setAttributeValue("FACT_MONEY", inOvermoney); + boLFITOut.setAttributeValue("FEE_ADJUST", 0); + boLFITOut.setAttributeValue("FACT_OBJECT", boCA.getAttribute("ACCOUNT").getString()); + boLFITOut.setAttributeValue("CLIENT_BANK", boCA.getAttribute("BANK_NAME").getString()); + boLFITOut.setAttributeValue("CLIENT_ACCOUNT", boCA.getAttribute("ACCOUNT").getString()); + boLFITOut.setAttributeValue("CLIENT_ACCNUMBER", boCA.getAttribute("ACC_NUMBER").getString()); + boLFITOut.setAttributeValue("APPLYPAY_DATE", boLFP.getAttribute("PLAN_DATE").getString()); + boLFITOut.setAttributeValue("APPLY_PERSON", userId); + boLFITOut.setAttributeValue("APPLY_DEPT", orgId); + boLFITOut.setAttributeValue("MEMO", "抵扣融资款"); + boLFITOut.setAttributeValue("ROLL_BACK", 0); + boLFITOut.setAttributeValue("FLOWUNID", flowunid); + boLFITOut.setAttributeValue("IS_FLOWING", 0); + bomLFIT.saveObject(boLFITOut); + BizObject boLFITIn = bomLFIT.newObject();//差额回笼款 + boLFITIn.setAttributeValue("QUOT_ID", boLFP.getAttribute("QUOT_ID").getString()); + boLFITIn.setAttributeValue("CUST_ID", boLFP.getAttribute("CUST_ID").getString()); + boLFITIn.setAttributeValue("PROJECT_ID", boLFP.getAttribute("PROJECT_ID").getString()); + boLFITIn.setAttributeValue("RELATIVE_ID", incomeID); + boLFITIn.setAttributeValue("PROJECT_PLAN_NUMBER", boLFP.getAttribute("PROJECT_PLAN_NUMBER").getString()); + boLFITIn.setAttributeValue("CONTRACT_ID", boLFP.getAttribute("CONTRACT_ID").getString()); + boLFITIn.setAttributeValue("CONTRACT_PLAN_NUMBER", boLFP.getAttribute("CONTRACT_PLAN_NUMBER").getString()); + boLFITIn.setAttributeValue("PAYMENT_NUMBER", boLFP.getAttribute("PAYMENT_NUMBER").getString()); + boLFITIn.setAttributeValue("PLAN_ID", planID); + boLFITIn.setAttributeValue("PLAN_LIST", boLFP.getAttribute("PLAN_LIST").getInt()); + boLFITIn.setAttributeValue("PAY_TYPE", boLFP.getAttribute("PAY_TYPE").getString()); + boLFITIn.setAttributeValue("FEE_TYPE", boLFP.getAttribute("FEE_TYPE").getString()); + boLFITIn.setAttributeValue("SETTLE_METHOD", "settlemethod11"); + boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0' and PAY_STATUS<>'apply_return'").setParameter("PLAN_ID", planID) + .getResultList(false); + boLCFIT = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = '0' and pay_type='pay_type_in' and ROLL_BACK='0' and PAY_STATUS is null").setParameter("PLAN_ID", planID) + .getResultList(false); + boLFITIn.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1); + boLFITIn.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString()); + boLFITIn.setAttributeValue("FACT_MONEY", inOvermoney); + boLFITIn.setAttributeValue("FEE_ADJUST", 0); + boLFITIn.setAttributeValue("FACT_OBJECT", boLFP.getAttribute("PAY_OBJ").getString()); + boLFITIn.setAttributeValue("ROLL_BACK", 0); + boLFITIn.setAttributeValue("FLOWUNID", flowunid); + boLFITIn.setAttributeValue("IS_FLOWING", 0); + bomLFIT.saveObject(boLFITIn); + } + BizObject boEquipAmt = bomLFIT.newObject();//实际放款 + boEquipAmt.setAttributeValue("ID", incomeID); + boEquipAmt.setAttributeValue("QUOT_ID", boLFPAMT.getAttribute("QUOT_ID").getString()); + boEquipAmt.setAttributeValue("CUST_ID", boLFPAMT.getAttribute("CUST_ID").getString()); + boEquipAmt.setAttributeValue("PROJECT_ID", boLFPAMT.getAttribute("PROJECT_ID").getString()); + boEquipAmt.setAttributeValue("PROJECT_PLAN_NUMBER", boLFPAMT.getAttribute("PROJECT_PLAN_NUMBER").getString()); + boEquipAmt.setAttributeValue("CONTRACT_ID", boLFPAMT.getAttribute("CONTRACT_ID").getString()); + boEquipAmt.setAttributeValue("CONTRACT_PLAN_NUMBER", boLFPAMT.getAttribute("CONTRACT_PLAN_NUMBER").getString()); + boEquipAmt.setAttributeValue("PAYMENT_NUMBER", boLFPAMT.getAttribute("PAYMENT_NUMBER").getString()); + boEquipAmt.setAttributeValue("PLAN_ID", boLFPAMT.getAttribute("ID").getString()); + boEquipAmt.setAttributeValue("PLAN_LIST", boLFPAMT.getAttribute("PLAN_LIST").getInt()); + boEquipAmt.setAttributeValue("FACT_OBJECT", boCA.getAttribute("ACCOUNT").getString()); + boEquipAmt.setAttributeValue("CLIENT_BANK", boCA.getAttribute("BANK_NAME").getString()); + boEquipAmt.setAttributeValue("CLIENT_ACCOUNT", boCA.getAttribute("ACCOUNT").getString()); + boEquipAmt.setAttributeValue("CLIENT_ACCNUMBER", boCA.getAttribute("ACC_NUMBER").getString()); + boEquipAmt.setAttributeValue("APPLYPAY_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString()); + boEquipAmt.setAttributeValue("APPLY_PERSON", userId); + boEquipAmt.setAttributeValue("APPLY_DEPT", orgId); + boEquipAmt.setAttributeValue("PAY_TYPE", boLFPAMT.getAttribute("PAY_TYPE").getString()); + boEquipAmt.setAttributeValue("FEE_TYPE", boLFPAMT.getAttribute("FEE_TYPE").getString()); + boEquipAmt.setAttributeValue("SETTLE_METHOD", "settlemethod6"); + List boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0' and PAY_STATUS<>'apply_return'").setParameter("PLAN_ID", boLFPAMT.getAttribute("ID").getString()) + .getResultList(false); + List boLCFIT = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = '0' and ROLL_BACK='0' and PAY_STATUS is null").setParameter("PLAN_ID", boLFPAMT.getAttribute("ID").getString()) + .getResultList(false); + boEquipAmt.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1); + boEquipAmt.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString()); + boEquipAmt.setAttributeValue("FACT_MONEY", new BigDecimal(boLFPAMT.getAttribute("PLAN_MONEY").getString()).subtract(deductMoney)); + boEquipAmt.setAttributeValue("FEE_ADJUST", 0); + boEquipAmt.setAttributeValue("ROLL_BACK", 0); + boEquipAmt.setAttributeValue("FLOWUNID", flowunid); + boEquipAmt.setAttributeValue("IS_FLOWING", 0); + bomLFIT.saveObject(boEquipAmt); + }catch(Exception e){ + e.printStackTrace(); + return "ERROR"; + } + return "SUCCESS"; + } + + + public String setEquipAMTPayment(JBOTransaction tx) throws Exception{ + try{ + BizObject boLFPAMT = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, "id=:id").setParameter("id", equipAMTID).getSingleResult(false); + BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME); + tx.join(bomLFIT); + BizObject boEquipAmt = bomLFIT.newObject(); + boEquipAmt.setAttributeValue("QUOT_ID", boLFPAMT.getAttribute("QUOT_ID").getString()); + boEquipAmt.setAttributeValue("CUST_ID", boLFPAMT.getAttribute("CUST_ID").getString()); + boEquipAmt.setAttributeValue("PROJECT_ID", boLFPAMT.getAttribute("PROJECT_ID").getString()); + boEquipAmt.setAttributeValue("PROJECT_PLAN_NUMBER", boLFPAMT.getAttribute("PROJECT_PLAN_NUMBER").getString()); + boEquipAmt.setAttributeValue("CONTRACT_ID", boLFPAMT.getAttribute("CONTRACT_ID").getString()); + boEquipAmt.setAttributeValue("CONTRACT_PLAN_NUMBER", boLFPAMT.getAttribute("CONTRACT_PLAN_NUMBER").getString()); + boEquipAmt.setAttributeValue("PAYMENT_NUMBER", boLFPAMT.getAttribute("PAYMENT_NUMBER").getString()); + boEquipAmt.setAttributeValue("PLAN_ID", equipAMTID); + boEquipAmt.setAttributeValue("PLAN_LIST", boLFPAMT.getAttribute("PLAN_LIST").getString()); + //boEquipAmt.setAttributeValue("FACT_OBJECT", boLFPAMT.getAttribute("PAY_OBJ").getString()); + boEquipAmt.setAttributeValue("APPLYPAY_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString()); + boEquipAmt.setAttributeValue("APPLY_PERSON", userId); + boEquipAmt.setAttributeValue("APPLY_DEPT", orgId); + boEquipAmt.setAttributeValue("PAY_TYPE", boLFPAMT.getAttribute("PAY_TYPE").getString()); + boEquipAmt.setAttributeValue("FEE_TYPE", boLFPAMT.getAttribute("FEE_TYPE").getString()); + boEquipAmt.setAttributeValue("SETTLE_METHOD", "settlemethod6"); + List boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0' and PAY_STATUS<>'apply_return'").setParameter("PLAN_ID", equipAMTID) + .getResultList(false); + List boLCFIT = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = '0' and ROLL_BACK='0' and PAY_STATUS is null").setParameter("PLAN_ID", equipAMTID) + .getResultList(false); + boEquipAmt.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1); + boEquipAmt.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString()); + boEquipAmt.setAttributeValue("FACT_MONEY", new BigDecimal(equipOverMoney)); + boEquipAmt.setAttributeValue("FEE_ADJUST", 0); + //boEquipAmt.setAttributeValue("FACT_OBJECT", boLFPAMT.getAttribute("PAY_OBJ").getString()); + boEquipAmt.setAttributeValue("ROLL_BACK", 0); + boEquipAmt.setAttributeValue("FLOWUNID", flowunid); + boEquipAmt.setAttributeValue("IS_FLOWING", 0); + bomLFIT.saveObject(boEquipAmt); + Map fromCondtion = new HashMap<>(); + fromCondtion.put("PAYMENT_NUMBER", boLFPAMT.getAttribute("PAYMENT_NUMBER").getString()); + fromCondtion.put("FEE_TYPE", boLFPAMT.getAttribute("FEE_TYPE").getString()); + fromCondtion.put("PLAN_LIST", boLFPAMT.getAttribute("PLAN_LIST").getString()); + Map otherProperty = new HashMap<>(); + otherProperty.put("FLOWUNID", flowunid); + DataOperatorUtil.copyJBOSet(LC_PAY_CONDTION.CLASS_NAME, fromCondtion,LC_PAY_CONDTION_TEMP.CLASS_NAME, null, otherProperty,null, tx); + }catch(Exception e){ + e.printStackTrace(); + return "ERROR"; + } + return "SUCCESS"; + } + + public String setFundPayment(JBOTransaction tx) throws Exception{ + try{ + String[] ids = planids.split("@"); + String[] moneys = overmoneys.split("@"); + for(int i=0;i boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0' and PAY_STATUS<>'apply_return'").setParameter("PLAN_ID", ids[i]) + .getResultList(false); + List boLCFIT = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = '0' and ROLL_BACK='0' and PAY_STATUS is null").setParameter("PLAN_ID", ids[i]) + .getResultList(false); + boLFI.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1); + boLFI.setAttributeValue("FACT_DATE", boLFP.getAttribute("PLAN_DATE").getString()); + boLFI.setAttributeValue("FACT_MONEY", new BigDecimal(moneys[i])); + boLFI.setAttributeValue("FEE_ADJUST", 0); + //boLFI.setAttributeValue("FACT_OBJECT", boLFP.getAttribute("PAY_OBJ").getString()); + boLFI.setAttributeValue("ROLL_BACK", 0); + boLFI.setAttributeValue("FLOWUNID", flowunid); + boLFI.setAttributeValue("IS_FLOWING", 0); + bomLFIT.saveObject(boLFI); + Map fromCondtion = new HashMap<>(); + fromCondtion.put("PAYMENT_NUMBER", boLFP.getAttribute("PAYMENT_NUMBER").getString()); + fromCondtion.put("FEE_TYPE", boLFP.getAttribute("FEE_TYPE").getString()); + fromCondtion.put("PLAN_LIST", boLFP.getAttribute("PLAN_LIST").getString()); + Map otherProperty = new HashMap<>(); + otherProperty.put("FLOWUNID", flowunid); + DataOperatorUtil.copyJBOSet(LC_PAY_CONDTION.CLASS_NAME, fromCondtion,LC_PAY_CONDTION_TEMP.CLASS_NAME, null, otherProperty,null, tx); + } + }catch(Exception e){ + e.printStackTrace(); + return "ERROR"; + } + return "SUCCESS"; + } + + public String updateRelativeData(JBOTransaction tx){ + try{ + String[] ids = planids.split("△"); + String[] fmoneys = factmoneys.split("△"); + String[] fadjusts = feeadjusts.split("△"); + BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME); + tx.join(bomLFIT); + for(int i=0;i boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0' and PAY_STATUS<>'apply_return'").setParameter("PLAN_ID", equipAMTID) + .getResultList(false); + List boLCFIT = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = '0' and ROLL_BACK='0' and PAY_STATUS is null").setParameter("PLAN_ID", equipAMTID) + .getResultList(false); + boLFIT.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1); + boLFIT.setAttributeValue("FACT_DATE", StringFunction.getToday()); + boLFIT.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday()); + boLFIT.setAttributeValue("FACT_MONEY", new BigDecimal(bo.getAttribute("OVERMONEY").getString())); + boLFIT.setAttributeValue("FEE_ADJUST", 0); + //boLFIT.setAttributeValue("FACT_OBJECT", boLFP.getAttribute("PAY_OBJ").getString()); + boLFIT.setAttributeValue("ROLL_BACK", 0); + boLFIT.setAttributeValue("FLOWUNID", flowunid); + boLFIT.setAttributeValue("IS_FLOWING", 0); + bomLFIT.saveObject(boLFIT); + } + } + }catch(Exception e){ + e.printStackTrace(); + return "ERROR"; + } + return "SUCCESS"; + } +} diff --git a/src_tenwa/com/tenwa/handler/LCFundPaymentTempInfoHandler.java b/src_tenwa/com/tenwa/handler/LCFundPaymentTempInfoHandler.java new file mode 100644 index 000000000..d045a2ac5 --- /dev/null +++ b/src_tenwa/com/tenwa/handler/LCFundPaymentTempInfoHandler.java @@ -0,0 +1,87 @@ +package com.tenwa.handler; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP; +import com.amarsoft.app.util.ProductParamUtil; +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.awe.dw.handler.impl.CommonHandler; +import com.amarsoft.dict.als.cache.CodeCache; +import com.amarsoft.dict.als.object.Item; + +public class LCFundPaymentTempInfoHandler extends CommonHandler { + + @Override + protected void initDisplayForEdit(BizObject bo) throws Exception { + String productId = this.asPage.getParameter("ProductId"); + + //获取坐扣项 + Map> params = ProductParamUtil.getProductComponentType(productId, "PRD0315"); + List deductFeeType = new ArrayList(); + for(Entry> feeTypes : params.entrySet()) { + if(!feeTypes.getValue().containsKey("isBalance")) { + continue; + } + String isBalance = feeTypes.getValue().get("isBalance"); + if("yes".equals(isBalance)) { + deductFeeType.add(feeTypes.getKey()); + } + } + + Item[] items = CodeCache.getItems("FeeType"); + String fundList = ""; + for(Item item : items) { + for(String feetype : deductFeeType) { + if(feetype.equals(item.getRelativeCode())) { + if(fundList.length() != 0) { + fundList += ","; + } + fundList += "'" + item.getItemNo() + "'"; + break; + } + } + } + + if(fundList.length() > 0) { + fundList += ","; + } + + fundList += "'feetype27'"; + + String flowunid = this.asPage.getParameter("ObjectNo"); + @SuppressWarnings("unchecked") + List boLFITs = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, + "flowunid = '" + flowunid + "' and fee_type in (" + fundList + ") ").getResultList(false); + BigDecimal cleanLeaseMoney = new BigDecimal("0"); + cleanLeaseMoney = cleanLeaseMoney.add(new BigDecimal(bo.getAttribute("FACT_MONEY").getString())); + for(BizObject boLFIT : boLFITs) { + BigDecimal factMoney = new BigDecimal(boLFIT.getAttribute("FACT_MONEY").getString()); + String feeType = boLFIT.getAttribute("FEE_TYPE").getString(); + if(factMoney.compareTo(BigDecimal.ZERO) > 0) { + switch(feeType) { + case "feetype1": + cleanLeaseMoney = cleanLeaseMoney.add(factMoney); + bo.setAttributeValue("HANDLING_CHARGE_MONEY", factMoney); + this.asDataObject.setVisible("HANDLING_CHARGE_MONEY", true); + break; + case "feetype2": + cleanLeaseMoney = cleanLeaseMoney.add(factMoney); + bo.setAttributeValue("CAUTION_MONEY", factMoney); + this.asDataObject.setVisible("CAUTION_MONEY", true); + break; + case "feetype27": + cleanLeaseMoney = cleanLeaseMoney.add(factMoney); + bo.setAttributeValue("DEALER_DISCOUNT", factMoney); + this.asDataObject.setVisible("DEALER_DISCOUNT", true); + break; + } + + } + } + bo.setAttributeValue("CLEAN_LEASE_MONEY", cleanLeaseMoney); + } +}