540 lines
31 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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_CALC_CONDITION;
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.LPOUNDAGE_MAINTENANCE;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.com.tenwa.lease.comm.LB_LESSOR_INFO;
import jbo.com.tenwa.lease.comm.LB_TENANTRY_INFO;
import jbo.com.tenwa.lease.comm.LC_PAY_CONDTION;
import jbo.com.tenwa.lease.comm.LC_PAY_CONDTION_TEMP;
import com.amarsoft.app.util.ProductParamUtil;
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.lease.flow.comm.service.LeaseFlowBaseService;
import com.tenwa.lease.flow.comm.service.ServiceOperatorEnum;
import com.tenwa.lease.flow.comm.serviceImp.LeaseFlowBaseServiceImp;
import com.tenwa.reckon.util.UUIDUtil;
public class FundPayment {
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;
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 setDeductMoney(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);
String contractId = boLFPAMT.getAttribute("contract_id").toString();
BizObject boLLI = JBOFactory.createBizObjectQuery(LB_LESSOR_INFO.CLASS_NAME, "contract_id=:contractId").setParameter("contractId", contractId).getSingleResult(false);
BizObject boLTI = JBOFactory.createBizObjectQuery(LB_TENANTRY_INFO.CLASS_NAME, "contract_id=:contractId").setParameter("contractId", contractId).getSingleResult(false);
String incomeID = UUIDUtil.getUUID();
BigDecimal outOverMoney = new BigDecimal(equipOverMoney);
tx.join(bomLFIT);
String[] funds = fundList.split("@~");
BigDecimal deductMoney = new BigDecimal(0);
for(int i=0;i<funds.length;i++){
if(funds[i].length() == 0){
continue;
}
if(outOverMoney.compareTo(new BigDecimal(0)) == 0){
continue;
}
String planID = funds[i].split("@")[0];
String inOvermoney = funds[i].split("@")[1];
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").getString());
boLFITOut.setAttributeValue("PAY_TYPE", "pay_type_out");
boLFITOut.setAttributeValue("FEE_TYPE", "feetype10");
boLFITOut.setAttributeValue("SETTLE_METHOD", "settlemethod11");
List<BizObject> 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<BizObject> 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);
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰʱ<C7B0><CAB1>
//boLFITOut.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString());
boLFITOut.setAttributeValue("BANK", boLLI.getAttribute("LEASE_ACC_BANK").toString());
boLFITOut.setAttributeValue("ACCOUNT", boLLI.getAttribute("LEASE_ACC_NAME").toString());
boLFITOut.setAttributeValue("ACC_NUMBER", boLLI.getAttribute("LEASE_ACC_NUMBER").toString());
boLFITOut.setAttributeValue("CLIENT_BANK", boLTI.getAttribute("CLIENT_ACC_BANK").toString());
boLFITOut.setAttributeValue("CLIENT_ACCOUNT", boLTI.getAttribute("CLIENT_ACC_NAME").toString());
boLFITOut.setAttributeValue("CLIENT_ACCNUMBER", boLTI.getAttribute("CLIENT_ACC_NUMBER").toString());
boLFITOut.setAttributeValue("FACT_DATE", StringFunction.getToday());
boLFITOut.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
boLFITOut.setAttributeValue("FACT_MONEY", inOvermoney);
boLFITOut.setAttributeValue("FEE_ADJUST", 0);
//boLFITOut.setAttributeValue("FACT_OBJECT", boLFPAMT.getAttribute("PAY_OBJ").getString());
boLFITOut.setAttributeValue("APPLYPAY_DATE", boLFP.getAttribute("PLAN_DATE").getString());
boLFITOut.setAttributeValue("APPLY_PERSON", userId);
boLFITOut.setAttributeValue("APPLY_DEPT", orgId);
boLFITOut.setAttributeValue("MEMO", "<EFBFBD>ֿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
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").getString());
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);
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰʱ<C7B0><CAB1>
//boLFITOut.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString());
boLFITIn.setAttributeValue("BANK", boLLI.getAttribute("LEASE_ACC_BANK").toString());
boLFITIn.setAttributeValue("ACCOUNT", boLLI.getAttribute("LEASE_ACC_NAME").toString());
boLFITIn.setAttributeValue("ACC_NUMBER", boLLI.getAttribute("LEASE_ACC_NUMBER").toString());
boLFITIn.setAttributeValue("CLIENT_BANK", boLTI.getAttribute("CLIENT_ACC_BANK").toString());
boLFITIn.setAttributeValue("CLIENT_ACCOUNT", boLTI.getAttribute("CLIENT_ACC_NAME").toString());
boLFITIn.setAttributeValue("CLIENT_ACCNUMBER", boLTI.getAttribute("CLIENT_ACC_NUMBER").toString());
boLFITIn.setAttributeValue("FACT_DATE", StringFunction.getToday());
boLFITIn.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
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", 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<BizObject> 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<BizObject> 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);
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰʱ<C7B0><CAB1>
//boLFITOut.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString());
boEquipAmt.setAttributeValue("BANK", boLLI.getAttribute("LEASE_ACC_BANK").toString());
boEquipAmt.setAttributeValue("ACCOUNT", boLLI.getAttribute("LEASE_ACC_NAME").toString());
boEquipAmt.setAttributeValue("ACC_NUMBER", boLLI.getAttribute("LEASE_ACC_NUMBER").toString());
boEquipAmt.setAttributeValue("CLIENT_BANK", boLTI.getAttribute("CLIENT_ACC_BANK").toString());
boEquipAmt.setAttributeValue("CLIENT_ACCOUNT", boLTI.getAttribute("CLIENT_ACC_NAME").toString());
boEquipAmt.setAttributeValue("CLIENT_ACCNUMBER", boLTI.getAttribute("CLIENT_ACC_NUMBER").toString());
boEquipAmt.setAttributeValue("FACT_DATE",StringFunction.getToday());
boEquipAmt.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
boEquipAmt.setAttributeValue("FACT_MONEY", new BigDecimal(equipOverMoney).subtract(deductMoney));
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);
String getProductSQL = "select PRODUCT_ID from O where O.id='"+boLFPAMT.getAttribute("CONTRACT_ID").getString()+"'";
BizObject boLCI = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME,tx).createQuery(getProductSQL).getSingleResult(false);
String productId = boLCI.getAttribute("PRODUCT_ID").toString();
String isBalance = ProductParamUtil.getProductParameterValue(productId, "PRD0315", "UNITE_MONEY", "isBalance");
if("yes".equals(isBalance)){
BizObject boUniteMoney = bomLFIT.newObject();
// boUniteMoney.setAttributeValue("QUOT_ID", boLFP.getAttribute("QUOT_ID").getString());
// boUniteMoney.setAttributeValue("CUST_ID", boLFP.getAttribute("CUST_ID").getString());
boUniteMoney.setAttributeValue("PROJECT_ID", boLFPAMT.getAttribute("PROJECT_ID").getString());
boUniteMoney.setAttributeValue("RELATIVE_ID", incomeID);
boUniteMoney.setAttributeValue("PROJECT_PLAN_NUMBER", boLFPAMT.getAttribute("PROJECT_PLAN_NUMBER").getString());
boUniteMoney.setAttributeValue("CONTRACT_ID", boLFPAMT.getAttribute("CONTRACT_ID").getString());
boUniteMoney.setAttributeValue("CONTRACT_PLAN_NUMBER", boLFPAMT.getAttribute("CONTRACT_PLAN_NUMBER").getString());
boUniteMoney.setAttributeValue("PAYMENT_NUMBER", boLFPAMT.getAttribute("PAYMENT_NUMBER").getString());
// boUniteMoney.setAttributeValue("PLAN_ID", planID);
// boUniteMoney.setAttributeValue("PLAN_LIST", boLFPAMT.getAttribute("PLAN_LIST").getString());
boUniteMoney.setAttributeValue("PAY_TYPE", "pay_type_in");
boUniteMoney.setAttributeValue("FEE_TYPE", "feetype10");
boUniteMoney.setAttributeValue("SETTLE_METHOD", "settlemethod11");
// List<BizObject> 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<BizObject> 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);
// boUniteMoney.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1);
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰʱ<C7B0><CAB1>
//boLFITOut.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString());
// boUniteMoney.setAttributeValue("BANK", boLLI.getAttribute("LEASE_ACC_BANK").toString());
// boUniteMoney.setAttributeValue("ACCOUNT", boLLI.getAttribute("LEASE_ACC_NAME").toString());
// boUniteMoney.setAttributeValue("ACC_NUMBER", boLLI.getAttribute("LEASE_ACC_NUMBER").toString());
boUniteMoney.setAttributeValue("CLIENT_BANK", boLTI.getAttribute("CLIENT_ACC_BANK").toString());
boUniteMoney.setAttributeValue("CLIENT_ACCOUNT", boLTI.getAttribute("CLIENT_ACC_NAME").toString());
boUniteMoney.setAttributeValue("CLIENT_ACCNUMBER", boLTI.getAttribute("CLIENT_ACC_NUMBER").toString());
boUniteMoney.setAttributeValue("FACT_DATE", StringFunction.getToday());
boUniteMoney.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
BizObject boLCC = JBOFactory.createBizObjectQuery(LC_CALC_CONDITION.CLASS_NAME, "CONTRACT_ID=:CONTRACT_ID").setParameter("CONTRACT_ID",boLFPAMT.getAttribute("CONTRACT_ID").getString()).getSingleResult(false);
boUniteMoney.setAttributeValue("FACT_MONEY", boLCC.getAttribute("UNITE_MONEY").toString());
boUniteMoney.setAttributeValue("FEE_ADJUST", 0);
//boLFITOut.setAttributeValue("FACT_OBJECT", boLFPAMT.getAttribute("PAY_OBJ").getString());
// boUniteMoney.setAttributeValue("APPLYPAY_DATE", boLFP.getAttribute("PLAN_DATE").getString());
boUniteMoney.setAttributeValue("APPLY_PERSON", userId);
boUniteMoney.setAttributeValue("APPLY_DEPT", orgId);
boUniteMoney.setAttributeValue("MEMO", "<EFBFBD><EFBFBD><EFBFBD>ϳ<EFBFBD><EFBFBD>ʲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>");
boUniteMoney.setAttributeValue("ROLL_BACK", 0);
boUniteMoney.setAttributeValue("FLOWUNID", flowunid);
boUniteMoney.setAttributeValue("IS_FLOWING", 0);
bomLFIT.saveObject(boUniteMoney);
}
Map<String,String> 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<String,String> 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 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);
String contractId = boLFPAMT.getAttribute("contract_id").toString();
BizObject boLLI = JBOFactory.createBizObjectQuery(LB_LESSOR_INFO.CLASS_NAME, "contract_id=:contractId").setParameter("contractId", contractId).getSingleResult(false);
BizObject boLTI = JBOFactory.createBizObjectQuery(LB_TENANTRY_INFO.CLASS_NAME, "contract_id=:contractId").setParameter("contractId", contractId).getSingleResult(false);
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<BizObject> 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<BizObject> 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);
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰʱ<C7B0><CAB1>
//boLFITOut.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString());
boEquipAmt.setAttributeValue("BANK", boLLI.getAttribute("LEASE_ACC_BANK").toString());
boEquipAmt.setAttributeValue("ACCOUNT", boLLI.getAttribute("LEASE_ACC_NAME").toString());
boEquipAmt.setAttributeValue("ACC_NUMBER", boLLI.getAttribute("LEASE_ACC_NUMBER").toString());
boEquipAmt.setAttributeValue("CLIENT_BANK", boLTI.getAttribute("CLIENT_ACC_BANK").toString());
boEquipAmt.setAttributeValue("CLIENT_ACCOUNT", boLTI.getAttribute("CLIENT_ACC_NAME").toString());
boEquipAmt.setAttributeValue("CLIENT_ACCNUMBER", boLTI.getAttribute("CLIENT_ACC_NUMBER").toString());
boEquipAmt.setAttributeValue("FACT_DATE", StringFunction.getToday());
boEquipAmt.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
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<String,String> 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<String,String> 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("@");
BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
BizObject lit = bomLFIT.createQuery("flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
String contractId = lit.getAttribute("contract_id").toString();
BizObject boLLI = JBOFactory.createBizObjectQuery(LB_LESSOR_INFO.CLASS_NAME, "contract_id=:contractId").setParameter("contractId", contractId).getSingleResult(false);
BizObject boLTI = JBOFactory.createBizObjectQuery(LB_TENANTRY_INFO.CLASS_NAME, "contract_id=:contractId").setParameter("contractId", contractId).getSingleResult(false);
for(int i=0;i<ids.length;i++){
BizObject boLFP = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, "id=:id").setParameter("id", ids[i]).getSingleResult(false);
tx.join(bomLFIT);
BizObject boLFI = bomLFIT.newObject();
boLFI.setAttributeValue("QUOT_ID", boLFP.getAttribute("QUOT_ID").getString());
boLFI.setAttributeValue("CUST_ID", boLFP.getAttribute("CUST_ID").getString());
boLFI.setAttributeValue("PROJECT_ID", boLFP.getAttribute("PROJECT_ID").getString());
boLFI.setAttributeValue("PROJECT_PLAN_NUMBER", boLFP.getAttribute("PROJECT_PLAN_NUMBER").getString());
boLFI.setAttributeValue("CONTRACT_ID", boLFP.getAttribute("CONTRACT_ID").getString());
boLFI.setAttributeValue("CONTRACT_PLAN_NUMBER", boLFP.getAttribute("CONTRACT_PLAN_NUMBER").getString());
boLFI.setAttributeValue("PAYMENT_NUMBER", boLFP.getAttribute("PAYMENT_NUMBER").getString());
boLFI.setAttributeValue("PLAN_ID", ids[i]);
boLFI.setAttributeValue("PLAN_LIST", boLFP.getAttribute("PLAN_LIST").getString());
//boLFI.setAttributeValue("FACT_OBJECT", boLFP.getAttribute("PAY_OBJ").getString());
boLFI.setAttributeValue("APPLYPAY_DATE", boLFP.getAttribute("PLAN_DATE").getString());
boLFI.setAttributeValue("APPLY_PERSON", userId);
boLFI.setAttributeValue("APPLY_DEPT", orgId);
boLFI.setAttributeValue("PAY_TYPE", boLFP.getAttribute("PAY_TYPE").getString());
boLFI.setAttributeValue("FEE_TYPE", boLFP.getAttribute("FEE_TYPE").getString());
boLFI.setAttributeValue("SETTLE_METHOD", "settlemethod6");
List<BizObject> 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<BizObject> 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);
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰʱ<C7B0><CAB1>
//boLFITOut.setAttributeValue("FACT_DATE", boLFPAMT.getAttribute("PLAN_DATE").getString());
boLFI.setAttributeValue("BANK", boLLI.getAttribute("LEASE_ACC_BANK").toString());
boLFI.setAttributeValue("ACCOUNT", boLLI.getAttribute("LEASE_ACC_NAME").toString());
boLFI.setAttributeValue("ACC_NUMBER", boLLI.getAttribute("LEASE_ACC_NUMBER").toString());
boLFI.setAttributeValue("CLIENT_BANK", boLTI.getAttribute("CLIENT_ACC_BANK").toString());
boLFI.setAttributeValue("CLIENT_ACCOUNT", boLTI.getAttribute("CLIENT_ACC_NAME").toString());
boLFI.setAttributeValue("CLIENT_ACCNUMBER", boLTI.getAttribute("CLIENT_ACC_NUMBER").toString());
boLFI.setAttributeValue("FACT_DATE", StringFunction.getToday());
boLFI.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
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<String,String> 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<String,String> 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("<EFBFBD><EFBFBD>");
String[] fmoneys = factmoneys.split("<EFBFBD><EFBFBD>");
String[] fadjusts = feeadjusts.split("<EFBFBD><EFBFBD>");
BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
tx.join(bomLFIT);
for(int i=0;i<ids.length;i++){
bomLFIT.createQuery("update O set fact_money=:FactMoney,fee_adjust=:FeeAdjust where Plan_id=:PlanID and Flowunid=:FlowUnid and pay_type='pay_type_in'")
.setParameter("FactMoney", fmoneys[i]).setParameter("FeeAdjust", fadjusts[i]).setParameter("PlanID", ids[i]).setParameter("FlowUnid", flowunid).executeUpdate();
}
}catch(Exception e){
e.printStackTrace();
return "ERROR";
}
return "SUCCESS";
}
public String setCautionReturn(JBOTransaction tx) throws Exception{
try{
String[] returnIDs = returnID.split("@");
for(int i=0;i<returnIDs.length;i++){
BizObject bo = JBOFactory.createBizObjectQuery(VI_LC_FUND_PLAN.CLASS_NAME, "id=:id").setParameter("id", returnIDs[i]).getSingleResult(false);
if(bo != null){
BizObject boLFP = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, "id=:id").setParameter("id", returnIDs[i]).getSingleResult(false);
BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
tx.join(bomLFIT);
BizObject boLFIT = bomLFIT.newObject();
boLFIT.setAttributeValue("QUOT_ID", boLFP.getAttribute("QUOT_ID").getString());
boLFIT.setAttributeValue("CUST_ID", boLFP.getAttribute("CUST_ID").getString());
boLFIT.setAttributeValue("PROJECT_ID", boLFP.getAttribute("PROJECT_ID").getString());
boLFIT.setAttributeValue("PROJECT_PLAN_NUMBER", boLFP.getAttribute("PROJECT_PLAN_NUMBER").getString());
boLFIT.setAttributeValue("CONTRACT_ID", boLFP.getAttribute("CONTRACT_ID").getString());
boLFIT.setAttributeValue("CONTRACT_PLAN_NUMBER", boLFP.getAttribute("CONTRACT_PLAN_NUMBER").getString());
boLFIT.setAttributeValue("PAYMENT_NUMBER", boLFP.getAttribute("PAYMENT_NUMBER").getString());
boLFIT.setAttributeValue("PLAN_ID", returnIDs[i]);
boLFIT.setAttributeValue("PLAN_LIST", boLFP.getAttribute("PLAN_LIST").getString());
//boLFIT.setAttributeValue("FACT_OBJECT", boLFP.getAttribute("PAY_OBJ").getString());
boLFIT.setAttributeValue("APPLYPAY_DATE", boLFP.getAttribute("PLAN_DATE").getString());
boLFIT.setAttributeValue("APPLY_PERSON", userId);
boLFIT.setAttributeValue("APPLY_DEPT", orgId);
boLFIT.setAttributeValue("PAY_TYPE", boLFP.getAttribute("PAY_TYPE").getString());
boLFIT.setAttributeValue("FEE_TYPE", boLFP.getAttribute("FEE_TYPE").getString());
boLFIT.setAttributeValue("SETTLE_METHOD", "settlemethod8");
List<BizObject> 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<BizObject> 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";
}
}