1380 lines
69 KiB
Java
1380 lines
69 KiB
Java
package com.tenwa.flow.rent.rentincome;
|
||
|
||
import java.math.BigDecimal;
|
||
import java.sql.*;
|
||
import java.text.ParseException;
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.*;
|
||
import java.util.Date;
|
||
import java.util.concurrent.atomic.AtomicReference;
|
||
import java.util.function.Function;
|
||
import java.util.stream.Collectors;
|
||
|
||
import cn.hutool.db.Entity;
|
||
import cn.hutool.db.handler.EntityHandler;
|
||
import cn.hutool.db.handler.EntityListHandler;
|
||
import cn.hutool.db.handler.NumberHandler;
|
||
import com.amarsoft.are.ARE;
|
||
import com.amarsoft.are.log.Log;
|
||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||
import com.fasterxml.jackson.databind.JsonNode;
|
||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||
import com.google.common.collect.ImmutableMap;
|
||
import com.tenwa.lease.service.LCOccupyRentListService;
|
||
import com.tenwa.util.JsonUtil;
|
||
import com.tenwa.util.SqlRunnerUtil;
|
||
import org.apache.commons.lang3.tuple.Pair;
|
||
import org.springframework.web.context.ContextLoader;
|
||
import org.springframework.web.context.WebApplicationContext;
|
||
|
||
import jbo.app.tenwa.calc.LC_CARD_DEDUCT_DOC_TEMP;
|
||
import jbo.app.tenwa.calc.LC_EBANK_PROCESS;
|
||
import jbo.app.tenwa.calc.LC_EBANK_TEMP;
|
||
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.LC_RENT_INCOME;
|
||
import jbo.app.tenwa.calc.LC_RENT_INCOME_TEMP;
|
||
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
||
import jbo.app.tenwa.calc.VI_CARD_DEDUCT_DATA;
|
||
import jbo.app.tenwa.calc.VI_LC_RENT_PLAN;
|
||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
|
||
import jbo.com.tenwa.lease.comm.LC_OCCUPY_RENT_LIST;
|
||
|
||
import com.amarsoft.app.awe.config.InitDBType;
|
||
import com.amarsoft.app.util.ProductParamUtil;
|
||
import com.amarsoft.are.jbo.BizObject;
|
||
import com.amarsoft.are.jbo.BizObjectManager;
|
||
import com.amarsoft.are.jbo.JBOException;
|
||
import com.amarsoft.are.jbo.JBOFactory;
|
||
import com.amarsoft.are.jbo.JBOTransaction;
|
||
import com.amarsoft.are.util.StringFunction;
|
||
import com.amarsoft.awe.util.Transaction;
|
||
import com.mchange.v2.c3p0.ComboPooledDataSource;
|
||
import com.tenwa.reckon.constant.Scale;
|
||
import com.tenwa.reckon.util.UUIDUtil;
|
||
|
||
public class RentIncomeMethod {
|
||
|
||
protected static Log logger = ARE.getLog();
|
||
|
||
private String planIDs;
|
||
private String flowunid;
|
||
private String overCorpuss;
|
||
private String overInterests;
|
||
private String overPenaltys;
|
||
private String balance;
|
||
private String portionCollectionID;
|
||
private String portionMoney;
|
||
private String oldFactMoney;
|
||
private String newFactMoney;
|
||
private String cautionDeductionIDs;
|
||
private String ids;//ʵ<>ʻ<EFBFBD><CABB><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʶ
|
||
private String isChanged;//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>̨<EFBFBD><CCA8><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD><E4BBAF><EFBFBD><EFBFBD>
|
||
private String sql;
|
||
private String userid;
|
||
private String orgid;
|
||
private String deductDocId;
|
||
|
||
private String params;
|
||
|
||
public String getDeductDocId() {
|
||
return deductDocId;
|
||
}
|
||
|
||
public void setDeductDocId(String deductDocId) {
|
||
this.deductDocId = deductDocId;
|
||
}
|
||
|
||
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 getSql() {
|
||
return sql;
|
||
}
|
||
|
||
public void setSql(String sql) {
|
||
this.sql = sql;
|
||
}
|
||
|
||
public String getIsChanged() {
|
||
return isChanged;
|
||
}
|
||
|
||
public void setIsChanged(String isChanged) {
|
||
this.isChanged = isChanged;
|
||
}
|
||
|
||
public String getIds() {
|
||
return ids;
|
||
}
|
||
|
||
public void setIds(String ids) {
|
||
this.ids = ids;
|
||
}
|
||
|
||
public String getCautionDeductionIDs() {
|
||
return cautionDeductionIDs;
|
||
}
|
||
|
||
public void setCautionDeductionIDs(String cautionDeductionIDs) {
|
||
this.cautionDeductionIDs = cautionDeductionIDs;
|
||
}
|
||
|
||
public String getFlowunid() {
|
||
return flowunid;
|
||
}
|
||
|
||
public void setFlowunid(String flowunid) {
|
||
this.flowunid = flowunid;
|
||
}
|
||
|
||
public String getPlanIDs() {
|
||
return planIDs;
|
||
}
|
||
|
||
public void setPlanIDs(String planIDs) {
|
||
this.planIDs = planIDs;
|
||
}
|
||
|
||
public String getOverCorpuss() {
|
||
return overCorpuss;
|
||
}
|
||
|
||
public void setOverCorpuss(String overCorpuss) {
|
||
this.overCorpuss = overCorpuss;
|
||
}
|
||
|
||
public String getOverInterests() {
|
||
return overInterests;
|
||
}
|
||
|
||
public void setOverInterests(String overInterests) {
|
||
this.overInterests = overInterests;
|
||
}
|
||
|
||
public String getOverPenaltys() {
|
||
return overPenaltys;
|
||
}
|
||
|
||
public void setOverPenaltys(String overPenaltys) {
|
||
this.overPenaltys = overPenaltys;
|
||
}
|
||
|
||
public String getBalance() {
|
||
return balance;
|
||
}
|
||
|
||
public void setBalance(String balance) {
|
||
this.balance = balance;
|
||
}
|
||
|
||
public String getPortionCollectionID() {
|
||
return portionCollectionID;
|
||
}
|
||
|
||
public void setPortionCollectionID(String portionCollectionID) {
|
||
this.portionCollectionID = portionCollectionID;
|
||
}
|
||
|
||
public String getPortionMoney() {
|
||
return portionMoney;
|
||
}
|
||
|
||
public void setPortionMoney(String portionMoney) {
|
||
this.portionMoney = portionMoney;
|
||
}
|
||
|
||
public String getOldFactMoney() {
|
||
return oldFactMoney;
|
||
}
|
||
|
||
public void setOldFactMoney(String oldFactMoney) {
|
||
this.oldFactMoney = oldFactMoney;
|
||
}
|
||
|
||
public String getNewFactMoney() {
|
||
return newFactMoney;
|
||
}
|
||
|
||
public void setNewFactMoney(String newFactMoney) {
|
||
this.newFactMoney = newFactMoney;
|
||
}
|
||
|
||
public String getParams() {
|
||
return params;
|
||
}
|
||
|
||
public void setParams(String params) {
|
||
this.params = params;
|
||
}
|
||
|
||
/**
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*/
|
||
public String setRentDataToRentIncome(JBOTransaction tx) throws JBOException {
|
||
try {
|
||
boolean flag = false;
|
||
if ("Y".equals(isChanged)) {
|
||
flag = true;
|
||
}
|
||
BigDecimal bel = new BigDecimal(balance == null ? "0" : balance); //<2F>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BigDecimal allFactMoney = bel;
|
||
BizObjectManager bomEb = JBOFactory.getBizObjectManager(LC_EBANK_TEMP.CLASS_NAME);
|
||
tx.join(bomEb);
|
||
BizObject boEb = bomEb.createQuery("FLOWUNID=:FLOWUNID")
|
||
.setParameter("FLOWUNID", flowunid).getSingleResult(true);
|
||
if (flag) {
|
||
bel = new BigDecimal(boEb.getAttribute("MAYOPE_MONEY").getString());
|
||
allFactMoney = bel;
|
||
}
|
||
String[] ids = planIDs.split("@");
|
||
String[] corpuss = new String[ids.length];
|
||
String[] interests = new String[ids.length];
|
||
String[] Penaltys = new String[ids.length];
|
||
if (overCorpuss != null) {
|
||
corpuss = overCorpuss.split("@");
|
||
interests = overInterests.split("@");
|
||
Penaltys = overPenaltys.split("@");
|
||
}
|
||
String factDate = boEb.getAttribute("FACT_DATE").getString();
|
||
Date f = new SimpleDateFormat("yyyy/MM/dd").parse(factDate);
|
||
for (int i = 0; i < ids.length; i++) {
|
||
BizObject boVLRP = JBOFactory.createBizObjectQuery(LC_RENT_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", ids[i])
|
||
.getSingleResult(false);
|
||
BizObject boLCI = JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME, "ID=:ID")
|
||
.setParameter("ID", boVLRP.getAttribute("CONTRACT_ID").getString())
|
||
.getSingleResult(false);
|
||
Map<String, List<Map<String, String>>> paymentOrders = ProductParamUtil
|
||
.getProductComponentDecisionTable(boLCI.getAttribute("PRODUCT_ID").getString(), "PRD0307", "rmoname", "rmosortno");
|
||
String penaltyRule = ProductParamUtil
|
||
.getProductParameterValue(boLCI.getAttribute("PRODUCT_ID").getString(), "PRD0307", "PenaltyRule", "PenaltyRule");
|
||
String[] paymentOrder = new String[3];
|
||
String planDate = boVLRP.getAttribute("PLAN_DATE").getString();
|
||
if (f.compareTo(new SimpleDateFormat("yyyy/MM/dd").parse(planDate)) > 0) {
|
||
for (int j = 0; j < paymentOrders.get("RMO-02").size(); j++) {
|
||
paymentOrder[Integer.parseInt(paymentOrders.get("RMO-02").get(j).get("rmosortno")) - 1] = paymentOrders.get("RMO-02").get(j).get("rmoname");
|
||
}
|
||
} else {
|
||
for (int j = 0; j < paymentOrders.get("RMO-01").size(); j++) {
|
||
paymentOrder[Integer.parseInt(paymentOrders.get("RMO-01").get(j).get("rmosortno")) - 1] = paymentOrders.get("RMO-01").get(j).get("rmoname");
|
||
}
|
||
|
||
}
|
||
if ("penalty_income".equals(penaltyRule)) {
|
||
Penaltys[i] = "0.00";
|
||
}
|
||
BizObjectManager boLRI = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME);
|
||
BizObjectManager bomLORL = JBOFactory.getBizObjectManager(LC_OCCUPY_RENT_LIST.CLASS_NAME, tx);
|
||
BizObject boLORL = bomLORL.newObject();
|
||
boLORL.setAttributeValue("ID", UUIDUtil.getUUID());
|
||
boLORL.setAttributeValue("PAYMENT_NUMBER", boVLRP.getAttribute("PAYMENT_NUMBER").getString());
|
||
boLORL.setAttributeValue("PLAN_LIST", boVLRP.getAttribute("PLAN_LIST").getString());
|
||
boLORL.setAttributeValue("PLAN_ID", boVLRP.getAttribute("ID").getString());
|
||
boLORL.setAttributeValue("FLOW_NAME", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>");
|
||
boLORL.setAttributeValue("FLOWUNID", flowunid);
|
||
boLORL.setAttributeValue(LC_OCCUPY_RENT_LIST.INPUTTIME, StringFunction.getTodayNow());
|
||
bomLORL.saveObject(boLORL);
|
||
tx.join(boLRI);
|
||
BizObject boLRIT = boLRI.newObject();
|
||
boLRIT.setAttributeValue("QUOT_ID", boVLRP.getAttribute("QUOT_ID").getString());
|
||
boLRIT.setAttributeValue("CUST_ID", boVLRP.getAttribute("CUST_ID").getString());
|
||
boLRIT.setAttributeValue("PROJECT_ID", boVLRP.getAttribute("PROJECT_ID").getString());
|
||
boLRIT.setAttributeValue("PROJECT_PLAN_NUMBER", boVLRP.getAttribute("PROJECT_PLAN_NUMBER").getString());
|
||
boLRIT.setAttributeValue("CONTRACT_ID", boVLRP.getAttribute("CONTRACT_ID").getString());
|
||
boLRIT.setAttributeValue("CONTRACT_PLAN_NUMBER", boVLRP.getAttribute("CONTRACT_PLAN_NUMBER").getString());
|
||
boLRIT.setAttributeValue("PAYMENT_NUMBER", boVLRP.getAttribute("PAYMENT_NUMBER").getString());
|
||
boLRIT.setAttributeValue("EBANK_NUMBER", boEb.getAttribute("EBANK_NUMBER").getString());
|
||
boLRIT.setAttributeValue("PLAN_ID", ids[i]);
|
||
boLRIT.setAttributeValue("PLAN_LIST", boVLRP.getAttribute("PLAN_LIST").getString());
|
||
boLRIT.setAttributeValue("INTEREST_ADJUST", 0);
|
||
boLRIT.setAttributeValue("SETTLE_METHOD", "settlemethod6");
|
||
List<BizObject> boLCRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID").setParameter("PLAN_ID", ids[i])
|
||
.getResultList(false);
|
||
List<BizObject> boLCRIT = JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = 0").setParameter("PLAN_ID", ids[i])
|
||
.getResultList(false);
|
||
boLRIT.setAttributeValue("HIRE_LIST", boLCRI.size() + boLCRIT.size() + 1);
|
||
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
boLRIT.setAttributeValue("HIRE_DATE", factDate);
|
||
boLRIT.setAttributeValue("CHARGE_WAY", "Collection");
|
||
boLRIT.setAttributeValue("HIRE_OBJECT", boEb.getAttribute("CLIENT_NAME").getString());
|
||
BigDecimal money;
|
||
if (!flag) {
|
||
money = new BigDecimal(corpuss[i]).add(new BigDecimal(interests[i])).add(new BigDecimal(Penaltys[i]));
|
||
if (!ids[i].equals(portionCollectionID)) {
|
||
bel = bel.subtract(money);
|
||
boLRIT.setAttributeValue("RENT", new BigDecimal(corpuss[i]).add(new BigDecimal(interests[i])));
|
||
boLRIT.setAttributeValue("CORPUS", new BigDecimal(corpuss[i]));
|
||
boLRIT.setAttributeValue("INTEREST", new BigDecimal(interests[i]));
|
||
boLRIT.setAttributeValue("PENALTY", new BigDecimal(Penaltys[i]));
|
||
} else {
|
||
BigDecimal portionMoneys = new BigDecimal(portionMoney);
|
||
BigDecimal rentMoney = new BigDecimal(0);
|
||
for (int j = 0; j < paymentOrder.length; j++) { //<2F><>ȡ<EFBFBD><C8A1>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BigDecimal subtractMoney = new BigDecimal(0);
|
||
String subtractMoneyName = "";
|
||
if ("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(paymentOrder[j])) {
|
||
subtractMoneyName = "CORPUS";
|
||
subtractMoney = new BigDecimal(corpuss[i]);
|
||
} else if ("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[j])) {
|
||
subtractMoneyName = "INTEREST";
|
||
subtractMoney = new BigDecimal(interests[i]);
|
||
} else if ("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[j])) {
|
||
subtractMoneyName = "PENALTY";
|
||
subtractMoney = new BigDecimal(Penaltys[i]);
|
||
}
|
||
if (portionMoneys.compareTo(new BigDecimal(0)) == 0) { //<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>Ϊ0,<2C><>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ0
|
||
if ("CORPUS".equals(subtractMoneyName) || "INTEREST".equals(subtractMoneyName)) {
|
||
rentMoney = rentMoney.add(new BigDecimal(0));
|
||
}
|
||
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if ("".equals(subtractMoneyName) || subtractMoneyName == null) {
|
||
subtractMoneyName = "PENALTY";
|
||
}
|
||
boLRIT.setAttributeValue(subtractMoneyName, 0);
|
||
} else {
|
||
if (portionMoneys.compareTo(subtractMoney) >= 0) { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ,<2C><>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Ӧֵ
|
||
if ("CORPUS".equals(subtractMoneyName) || "INTEREST".equals(subtractMoneyName)) {
|
||
rentMoney = rentMoney.add(subtractMoney);
|
||
}
|
||
portionMoneys = portionMoneys.subtract(subtractMoney);
|
||
boLRIT.setAttributeValue(subtractMoneyName, subtractMoney);
|
||
} else { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if ("CORPUS".equals(subtractMoneyName) || "INTEREST".equals(subtractMoneyName)) {
|
||
rentMoney = rentMoney.add(portionMoneys);
|
||
}
|
||
boLRIT.setAttributeValue(subtractMoneyName, portionMoneys);
|
||
portionMoneys = new BigDecimal(0);
|
||
}
|
||
}
|
||
}
|
||
boLRIT.setAttributeValue("RENT", rentMoney);
|
||
bel = bel.subtract(new BigDecimal(portionMoney));
|
||
}
|
||
} else {
|
||
// BizObject bo = JBOFactory.getBizObjectManager(VI_LC_RENT_PLAN.CLASS_NAME).createQuery("id=:planID").setParameter("planID", ids[i]).getSingleResult(false);
|
||
Map<String, Object> sqlParamMap = new HashMap<>();
|
||
sqlParamMap.put("planId", ids[i]);
|
||
Entity entity = SqlRunnerUtil.query("flow.FundCollectionFlow.queryRentPlanList", sqlParamMap, new EntityHandler());
|
||
String paymentNumber = entity.getStr("payment_number");
|
||
String planList = entity.getStr("plan_list");
|
||
BigDecimal corpusOver = entity.getBigDecimal("corpus_over");
|
||
BigDecimal interestOver = entity.getBigDecimal("interest_over");
|
||
BigDecimal penaltySum = entity.getBigDecimal("penalty_sum");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʵ<CFA2>պͷ<D5BA>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||
String penalty = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME)
|
||
.createQuery("select v.round(v.getRentPenalty('" + paymentNumber + "','" + planList + "','" + factDate + "'),2) as v.penalty from O").getSingleResult(false).getAttribute("penalty").getString();
|
||
BigDecimal penaltyOver = new BigDecimal(penalty).subtract(penaltySum);
|
||
|
||
if ("penalty_income".equals(penaltyRule)) {
|
||
penaltyOver = BigDecimal.ZERO;
|
||
} else {
|
||
// penaltyOver = JBOFactory.getBizObjectManager(VI_LC_RENT_PLAN.CLASS_NAME).createQuery("select v.getRentPenalty('"+boVLRP.getAttribute("PAYMENT_NUMBER").getString()+"','"+boVLRP.getAttribute("PLAN_LIST").getString()+"','"+factDate+"') v.penalty from O").getSingleResult(false).getAttribute("penalty").getString();
|
||
}
|
||
money = corpusOver.add(interestOver).add(penaltyOver);
|
||
if (money.compareTo(bel) <= 0) {
|
||
bel = bel.subtract(money);
|
||
boLRIT.setAttributeValue("RENT", corpusOver.add(interestOver));
|
||
boLRIT.setAttributeValue("CORPUS", corpusOver);
|
||
boLRIT.setAttributeValue("INTEREST", interestOver);
|
||
boLRIT.setAttributeValue("PENALTY", penaltyOver);
|
||
} else {
|
||
BigDecimal portionMoneys = bel;
|
||
BigDecimal rentMoney = new BigDecimal(0);
|
||
for (int j = 0; j < paymentOrder.length; j++) { //<2F><>ȡ<EFBFBD><C8A1>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BigDecimal subtractMoney = new BigDecimal(0);
|
||
String subtractMoneyName = "";
|
||
if ("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(paymentOrder[j])) {
|
||
subtractMoneyName = "CORPUS";
|
||
subtractMoney = corpusOver;
|
||
} else if ("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[j])) {
|
||
subtractMoneyName = "INTEREST";
|
||
subtractMoney = interestOver;
|
||
} else if ("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[j])) {
|
||
subtractMoneyName = "PENALTY";
|
||
subtractMoney = penaltyOver;
|
||
}
|
||
if (portionMoneys.compareTo(new BigDecimal(0)) == 0) { //<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>Ϊ0,<2C><>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ0
|
||
if ("CORPUS".equals(subtractMoneyName) || "INTEREST".equals(subtractMoneyName)) {
|
||
rentMoney = rentMoney.add(new BigDecimal(0));
|
||
}
|
||
boLRIT.setAttributeValue(subtractMoneyName, 0);
|
||
} else {
|
||
if (portionMoneys.compareTo(subtractMoney) >= 0) { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ,<2C><>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Ӧֵ
|
||
if ("CORPUS".equals(subtractMoneyName) || "INTEREST".equals(subtractMoneyName)) {
|
||
rentMoney = rentMoney.add(subtractMoney);
|
||
}
|
||
portionMoneys = portionMoneys.subtract(subtractMoney);
|
||
boLRIT.setAttributeValue(subtractMoneyName, subtractMoney);
|
||
} else { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if ("CORPUS".equals(subtractMoneyName) || "INTEREST".equals(subtractMoneyName)) {
|
||
rentMoney = rentMoney.add(portionMoneys);
|
||
}
|
||
boLRIT.setAttributeValue(subtractMoneyName, portionMoneys);
|
||
portionMoneys = new BigDecimal(0);
|
||
}
|
||
}
|
||
}
|
||
boLRIT.setAttributeValue("RENT", rentMoney);
|
||
bel = bel.subtract(bel);
|
||
}
|
||
}
|
||
boLRIT.setAttributeValue("CORPUS_ADJUST", 0);
|
||
boLRIT.setAttributeValue("PENALTY_ADJUST", 0);
|
||
boLRIT.setAttributeValue("OWN_BANK", boEb.getAttribute("OWN_BANK").getString());
|
||
boLRIT.setAttributeValue("OWN_ACCOUNT", boEb.getAttribute("OWN_ACCOUNT").getString());
|
||
boLRIT.setAttributeValue("OWN_NUMBER", boEb.getAttribute("OWNACC_NUMBER").getString());
|
||
boLRIT.setAttributeValue("HIRE_BANK", boEb.getAttribute("CLIENT_BANK").getString());
|
||
boLRIT.setAttributeValue("HIRE_ACCOUNT", boEb.getAttribute("CLIENT_ACCOUNT").getString());
|
||
boLRIT.setAttributeValue("HIRE_NUMBER", boEb.getAttribute("CLIENT_ACC_NUMBER").getString());
|
||
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||
//boLRIT.setAttributeValue("ACCOUNTING_DATE", boEb.getAttribute("FACT_DATE").getString());
|
||
boLRIT.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
|
||
boLRIT.setAttributeValue("ROLL_BACK", 0);
|
||
boLRIT.setAttributeValue("COIN", boVLRP.getAttribute("COIN").getString());
|
||
boLRIT.setAttributeValue("IS_FLOWING", 0);
|
||
boLRIT.setAttributeValue("FLOWUNID", flowunid);
|
||
boLRI.saveObject(boLRIT);
|
||
}
|
||
if (bel.compareTo(new BigDecimal(0)) > 0) {
|
||
allFactMoney = allFactMoney.subtract(bel);
|
||
}
|
||
BizObjectManager bomLEP = JBOFactory.getBizObjectManager(LC_EBANK_PROCESS.CLASS_NAME);
|
||
tx.join(bomLEP);
|
||
BizObject boLEP = bomLEP.createQuery("FLOWUNID=:FLOWUNID").setParameter("FLOWUNID", flowunid).getSingleResult(true);
|
||
BigDecimal processMoney = new BigDecimal(boLEP.getAttribute("PROCESS_MONEY").getDouble());
|
||
boLEP.setAttributeValue("PROCESS_MONEY", processMoney.add(allFactMoney));
|
||
bomLEP.saveObject(boLEP);
|
||
//ʣ<><CAA3><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=<3D>ϴε<CFB4>ʣ<EFBFBD><CAA3><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//<2F>Ѻ<EFBFBD><D1BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = <20><><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD> - ʣ<><CAA3><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BigDecimal mayMoney = new BigDecimal(boEb.getAttribute("MAYOPE_MONEY").getDouble());
|
||
BigDecimal factMoney = new BigDecimal(boEb.getAttribute("FACT_MONEY").getDouble());
|
||
BigDecimal mayMoneyNew = mayMoney.subtract(allFactMoney);
|
||
boEb.setAttributeValue("MAYOPE_MONEY", mayMoneyNew.toString());
|
||
boEb.setAttributeValue("HAD_MONEY", factMoney.subtract(mayMoneyNew).toString());
|
||
bomEb.saveObject(boEb);
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "ERROR";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
public String generateRentIncomeData(JBOTransaction tx) throws Exception {
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
ObjectMapper objectMapper = JsonUtil.getObjectMapper();
|
||
JsonNode jsonNode = objectMapper.readTree(params);
|
||
String contractId = jsonNode.get("contractId").textValue();
|
||
String planIDsParam = jsonNode.get("planIDs").textValue();
|
||
String flowunidParam = jsonNode.get("flowunid").textValue();
|
||
String hireTypesParam = jsonNode.get("hireTypes").textValue();
|
||
String currUserId = jsonNode.get("currUserId").textValue();
|
||
String currOrgId = jsonNode.get("currOrgId").textValue();
|
||
List<String> planIDList = Arrays.asList(planIDsParam.split(","));
|
||
List<String> hireTypeList = Arrays.asList(hireTypesParam.split(","));
|
||
|
||
Transaction transaction = Transaction.createTransaction(tx);
|
||
|
||
LCOccupyRentListService lcOccupyRentListService = LCOccupyRentListService.getInstance();
|
||
|
||
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObjectManager ebankTempBOM = JBOFactory.getBizObjectManager(LC_EBANK_TEMP.CLASS_NAME, tx);
|
||
BizObject ebankTempBizObj = ebankTempBOM.createQuery("FLOWUNID=:FLOWUNID").setParameter("FLOWUNID", flowunidParam).getSingleResult(true);
|
||
String factDateStr = ebankTempBizObj.getAttribute("FACT_DATE").getString();
|
||
Date factDate = new SimpleDateFormat("yyyy/MM/dd").parse(factDateStr);
|
||
// <20>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BigDecimal mayopeMoney = new BigDecimal(ebankTempBizObj.getAttribute("MAYOPE_MONEY").getString());
|
||
//
|
||
AtomicReference<BigDecimal> moneyAmtRef = new AtomicReference<>(mayopeMoney);
|
||
|
||
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ƻ<EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||
Map<String, Object> sqlParamMap = new HashMap<>();
|
||
// sqlParamMap.put("planIds", planIDList);
|
||
sqlParamMap.put("contractId", contractId);
|
||
sqlParamMap.put("factDate", factDateStr);
|
||
List<Entity> entityList = SqlRunnerUtil.query(transaction, "flow.FundCollectionFlow.queryRentPlanList", sqlParamMap, new EntityListHandler());
|
||
entityList.sort(Comparator.comparingInt(o -> o.getInt("plan_list")));
|
||
|
||
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>
|
||
BizObjectManager lbContractInfoBOM = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME, tx);
|
||
BizObject lbContractInfoBizObj = lbContractInfoBOM.createQuery("ID=:contractId").setParameter("contractId", contractId).getSingleResult(false);
|
||
Map<String, List<Map<String, String>>> paymentOrders = ProductParamUtil
|
||
.getProductComponentDecisionTable(lbContractInfoBizObj.getAttribute("PRODUCT_ID").getString(), "PRD0307", "rmoname", "rmosortno");
|
||
// <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
String penaltyRule = ProductParamUtil
|
||
.getProductParameterValue(lbContractInfoBizObj.getAttribute("PRODUCT_ID").getString(), "PRD0307", "PenaltyRule", "PenaltyRule");
|
||
|
||
Pair<List<String>, List<String>> paymentOrderPair = getHirePaymentOrder(paymentOrders, hireTypeList);
|
||
int hirePlanCount = planIDList.size();
|
||
int hireTimes = 0;
|
||
List<String> paymentOrder = null;
|
||
for (Entity entity : entityList) {
|
||
String planId = entity.getStr("id");
|
||
String paymentNumber = entity.getStr("payment_number");
|
||
Integer planList = entity.getInt("plan_list");
|
||
String planDate = entity.getStr("plan_date");
|
||
BigDecimal corpusOver = entity.getBigDecimal("corpus_over");
|
||
BigDecimal interestOver = entity.getBigDecimal("interest_over");
|
||
BigDecimal penaltyOver = entity.getBigDecimal("penalty_over");
|
||
|
||
if ((hireTypeList.contains("CORPUS") && corpusOver.compareTo(BigDecimal.ZERO) == 1)
|
||
|| (hireTypeList.contains("INTEREST") && interestOver.compareTo(BigDecimal.ZERO) == 1)
|
||
|| (hireTypeList.contains("PENALTY") && penaltyOver.compareTo(BigDecimal.ZERO) == 1)
|
||
) {
|
||
hireTimes++;
|
||
if (hireTimes <= hirePlanCount) {
|
||
if (!planIDList.contains(planId)) {
|
||
throw new RuntimeException("ERROR@<40>ڴΡ<DAB4>" + planList + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD>ں<EFBFBD><EFBFBD><EFBFBD>");
|
||
}
|
||
if (moneyAmtRef.get().compareTo(BigDecimal.ZERO) < 1) {
|
||
throw new RuntimeException("ERROR@<40><><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB>");
|
||
}
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC>
|
||
lcOccupyRentListService.save(tx, paymentNumber, planList, planId, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>տ<EFBFBD>", flowunidParam);
|
||
|
||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>
|
||
if (factDate.compareTo(new SimpleDateFormat("yyyy/MM/dd").parse(planDate)) > 0) {
|
||
paymentOrder = paymentOrderPair.getLeft();
|
||
} else {
|
||
paymentOrder = paymentOrderPair.getRight();
|
||
}
|
||
|
||
// <20>жϷ<D0B6>Ϣ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||
if("penalty_income".equals(penaltyRule)) {
|
||
penaltyOver = BigDecimal.ZERO;
|
||
}
|
||
|
||
Map<String, BigDecimal> moneyOverMap = ImmutableMap.of("CORPUS", corpusOver, "INTEREST", interestOver, "PENALTY", penaltyOver);
|
||
Map<String, BigDecimal> hireResMap = hireMoney(paymentOrder, moneyAmtRef, moneyOverMap);
|
||
BigDecimal incomeCorpus = hireResMap.containsKey("CORPUS") ? hireResMap.get("CORPUS") : BigDecimal.ZERO;
|
||
BigDecimal incomeInterest = hireResMap.containsKey("INTEREST") ? hireResMap.get("INTEREST") : BigDecimal.ZERO;
|
||
BigDecimal incomePenalty = hireResMap.containsKey("PENALTY") ? hireResMap.get("PENALTY") : BigDecimal.ZERO;
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||
BizObjectManager rentIncomeTempBOM = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME, tx);
|
||
BizObject rentIncomeTempBizObj = rentIncomeTempBOM.newObject();
|
||
rentIncomeTempBizObj.setAttributeValue("QUOT_ID", entity.getStr("quot_id"));
|
||
rentIncomeTempBizObj.setAttributeValue("CUST_ID", entity.getStr("cust_id"));
|
||
rentIncomeTempBizObj.setAttributeValue("PROJECT_ID", entity.getStr("project_id"));
|
||
rentIncomeTempBizObj.setAttributeValue("PROJECT_PLAN_NUMBER", entity.getStr("project_plan_number"));
|
||
rentIncomeTempBizObj.setAttributeValue("CONTRACT_ID", entity.getStr("contract_id"));
|
||
rentIncomeTempBizObj.setAttributeValue("CONTRACT_PLAN_NUMBER", entity.getStr("contract_plan_number"));
|
||
rentIncomeTempBizObj.setAttributeValue("PAYMENT_NUMBER", paymentNumber);
|
||
rentIncomeTempBizObj.setAttributeValue("EBANK_NUMBER", ebankTempBizObj.getAttribute("EBANK_NUMBER").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("PLAN_ID", planId);
|
||
rentIncomeTempBizObj.setAttributeValue("PLAN_LIST", planList);
|
||
rentIncomeTempBizObj.setAttributeValue("INTEREST_ADJUST", 0);
|
||
rentIncomeTempBizObj.setAttributeValue("SETTLE_METHOD", "settlemethod6");
|
||
rentIncomeTempBizObj.setAttributeValue("HIRE_LIST", getPlanHireList(planId));
|
||
rentIncomeTempBizObj.setAttributeValue("HIRE_DATE", factDateStr);
|
||
rentIncomeTempBizObj.setAttributeValue("CHARGE_WAY", "Collection");
|
||
rentIncomeTempBizObj.setAttributeValue("HIRE_OBJECT", ebankTempBizObj.getAttribute("CLIENT_NAME").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("RENT", incomeCorpus.add(incomeInterest));
|
||
rentIncomeTempBizObj.setAttributeValue("CORPUS", incomeCorpus);
|
||
rentIncomeTempBizObj.setAttributeValue("INTEREST", incomeInterest);
|
||
rentIncomeTempBizObj.setAttributeValue("PENALTY", incomePenalty);
|
||
rentIncomeTempBizObj.setAttributeValue("CORPUS_ADJUST", 0);
|
||
rentIncomeTempBizObj.setAttributeValue("PENALTY_ADJUST", 0);
|
||
rentIncomeTempBizObj.setAttributeValue("OWN_BANK", ebankTempBizObj.getAttribute("OWN_BANK").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("OWN_ACCOUNT", ebankTempBizObj.getAttribute("OWN_ACCOUNT").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("OWN_NUMBER", ebankTempBizObj.getAttribute("OWNACC_NUMBER").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("HIRE_BANK", ebankTempBizObj.getAttribute("CLIENT_BANK").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("HIRE_ACCOUNT", ebankTempBizObj.getAttribute("CLIENT_ACCOUNT").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("HIRE_NUMBER", ebankTempBizObj.getAttribute("CLIENT_ACC_NUMBER").getString());
|
||
//<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||
//boLRIT.setAttributeValue("ACCOUNTING_DATE", boEb.getAttribute("FACT_DATE").getString());
|
||
rentIncomeTempBizObj.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
|
||
rentIncomeTempBizObj.setAttributeValue("ROLL_BACK", 0);
|
||
rentIncomeTempBizObj.setAttributeValue("COIN", entity.getStr("COIN"));
|
||
rentIncomeTempBizObj.setAttributeValue("IS_FLOWING", 0);
|
||
rentIncomeTempBizObj.setAttributeValue("FLOWUNID", flowunidParam);
|
||
rentIncomeTempBizObj.setAttributeValue("INPUTUSERID", currUserId);
|
||
rentIncomeTempBizObj.setAttributeValue("INPUTORGID", currOrgId);
|
||
rentIncomeTempBizObj.setAttributeValue("INPUTTIME", StringFunction.getTodayNow());
|
||
rentIncomeTempBizObj.setAttributeValue("UPDATEUSERID", currUserId);
|
||
rentIncomeTempBizObj.setAttributeValue("UPDATEORGID", currOrgId);
|
||
rentIncomeTempBizObj.setAttributeValue("UPDATETIME", StringFunction.getTodayNow());
|
||
rentIncomeTempBOM.saveObject(rentIncomeTempBizObj);
|
||
}
|
||
}
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD>ʹ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD>
|
||
BigDecimal allFactMoney = mayopeMoney.subtract(moneyAmtRef.get());
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̱<EFBFBD>
|
||
BizObjectManager lcEbankProcessBOM = JBOFactory.getBizObjectManager(LC_EBANK_PROCESS.CLASS_NAME, tx);
|
||
BizObject lcEbankProcessBizObj = lcEbankProcessBOM.createQuery("FLOWUNID=:FLOWUNID").setParameter("FLOWUNID", flowunidParam).getSingleResult(true);
|
||
BigDecimal processMoney = new BigDecimal(lcEbankProcessBizObj.getAttribute("PROCESS_MONEY").getString());
|
||
lcEbankProcessBizObj.setAttributeValue("PROCESS_MONEY", processMoney.add(allFactMoney));
|
||
lcEbankProcessBOM.saveObject(lcEbankProcessBizObj);
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MAYOPE_MONEY<45><59><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> HAD_MONEY<45><59><EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//ʣ<><CAA3><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=<3D>ϴε<CFB4>ʣ<EFBFBD><CAA3><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//<2F>Ѻ<EFBFBD><D1BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = <20><><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD> - ʣ<><CAA3><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// BigDecimal mayMoney = new BigDecimal(ebankTempBizObj.getAttribute("MAYOPE_MONEY").getDouble());
|
||
BigDecimal factMoney = new BigDecimal(ebankTempBizObj.getAttribute("FACT_MONEY").getString());
|
||
// BigDecimal mayMoneyNew = mayopeMoney.subtract(allFactMoney);
|
||
ebankTempBizObj.setAttributeValue("MAYOPE_MONEY", moneyAmtRef.get());
|
||
ebankTempBizObj.setAttributeValue("HAD_MONEY", factMoney.subtract(moneyAmtRef.get()).toString());
|
||
ebankTempBOM.saveObject(ebankTempBizObj);
|
||
return "SUCCESS";
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* @param planID
|
||
* @return
|
||
* @throws JBOException
|
||
*/
|
||
private Integer getPlanHireList(String planID) throws JBOException {
|
||
List<BizObject> boLCRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID").setParameter("PLAN_ID", planID)
|
||
.getResultList(false);
|
||
List<BizObject> boLCRIT = JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = 0").setParameter("PLAN_ID", planID)
|
||
.getResultList(false);
|
||
return boLCRI.size() + boLCRIT.size() + 1;
|
||
}
|
||
|
||
/**
|
||
* <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺͺ<CDBA><CDBA><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>б<EFBFBD>
|
||
* @param paymentOrders
|
||
* @param hireTypeList
|
||
* @return
|
||
*/
|
||
private Pair<List<String>, List<String>> getHirePaymentOrder(Map<String, List<Map<String, String>>> paymentOrders, List<String> hireTypeList) {
|
||
Function<List<Map<String, String>>, List<String>> hireTypeConvertFunc = tempList -> tempList.stream()
|
||
.map(tempMap -> {
|
||
String rmoname = tempMap.get("rmoname");
|
||
if("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(rmoname)) {
|
||
tempMap.put("hireType", "CORPUS");
|
||
} else if("<EFBFBD><EFBFBD>Ϣ".equals(rmoname)) {
|
||
tempMap.put("hireType", "INTEREST");
|
||
} else if("<EFBFBD><EFBFBD>Ϣ".equals(rmoname)) {
|
||
tempMap.put("hireType", "PENALTY");
|
||
}
|
||
return tempMap;
|
||
})
|
||
.filter(o -> o.containsKey("hireType") && hireTypeList.contains(o.get("hireType")))
|
||
.sorted(Comparator.comparing(o -> Integer.valueOf(o.get("rmosortno"))))
|
||
.map(tempMap -> tempMap.get("hireType"))
|
||
.collect(Collectors.toList());
|
||
return Pair.of(hireTypeConvertFunc.apply(paymentOrders.get("RMO-02")), hireTypeConvertFunc.apply(paymentOrders.get("RMO-01")));
|
||
|
||
|
||
// for (int j = 0; j < paymentOrders.get("RMO-02").size(); j++) {
|
||
// String hireType = hireTypeConvertFunc.apply(paymentOrders.get("RMO-02").get(j).get("rmoname"));
|
||
// if(hireTypeList.contains(hireType)) {
|
||
// paymentOrderLeft.add(hireType);
|
||
// }
|
||
// }
|
||
// List<String> paymentOrderRight = new ArrayList<>();
|
||
// for (int j = 0; j < paymentOrders.get("RMO-01").size(); j++) {
|
||
// String hireType = hireTypeConvertFunc.apply(paymentOrders.get("RMO-01").get(j).get("rmoname"));
|
||
// if(hireTypeList.contains(hireType)) {
|
||
//// paymentOrderRight[Integer.parseInt(paymentOrders.get("RMO-01").get(j).get("rmosortno")) - 1] = hireType;
|
||
// paymentOrderRight.add(hireType);
|
||
// }
|
||
// }
|
||
// return Pair.of(paymentOrderLeft, paymentOrderRight);
|
||
}
|
||
|
||
|
||
private Map<String, BigDecimal> hireMoney(List<String> paymentOrder, AtomicReference<BigDecimal> moneyAmtRef, Map<String, BigDecimal> hireMap) {
|
||
Map<String, BigDecimal> resMap = new HashMap<>();
|
||
System.out.println("paymentOrder:" + paymentOrder);
|
||
System.out.println("moneyAmt:" + moneyAmtRef.get());
|
||
System.out.println("hireMap:" + hireMap);
|
||
for (String hireType : paymentOrder) {
|
||
BigDecimal overMoney = hireMap.get(hireType);
|
||
BigDecimal incomeMoney;
|
||
if (moneyAmtRef.get().compareTo(overMoney) >= 0) {
|
||
incomeMoney = overMoney;
|
||
moneyAmtRef.set(moneyAmtRef.get().subtract(overMoney));
|
||
} else {
|
||
incomeMoney = moneyAmtRef.get();
|
||
moneyAmtRef.set(BigDecimal.ZERO);
|
||
}
|
||
logger.info(hireType + ": overMoney:" + overMoney + ", incomeMoney:" + incomeMoney + ", moneyAmt:" + moneyAmtRef.get());
|
||
resMap.put(hireType, incomeMoney);
|
||
}
|
||
return resMap;
|
||
}
|
||
|
||
/**
|
||
* <20><>֤<EFBFBD><D6A4><EFBFBD>ֿ<EFBFBD>
|
||
*/
|
||
public String setCautionDeduction(JBOTransaction tx) throws Exception{
|
||
try{
|
||
boolean flag = false;
|
||
if("Y".equals(isChanged)){
|
||
flag = true;
|
||
}
|
||
String[] ids = planIDs.split("@");//<2F>ƻ<EFBFBD>id
|
||
String[] corpuss = new String[ids.length];
|
||
String[] interests = new String[ids.length];
|
||
String[] Penaltys = new String[ids.length];
|
||
if(overCorpuss != null){
|
||
corpuss = overCorpuss.split("@");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
interests = overInterests.split("@");//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||
Penaltys = overPenaltys.split("@");//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||
}
|
||
String[] datas = cautionDeductionIDs.split("@~");//<2F><>֤<EFBFBD><D6A4><EFBFBD>ֿ<EFBFBD>id+<2B><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
String[] cIDs = new String[datas.length];
|
||
BigDecimal[] overmoneys = new BigDecimal[datas.length];//<2F><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BigDecimal zero = new BigDecimal(0);
|
||
BizObjectManager boLRI = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME);
|
||
tx.join(boLRI);
|
||
BizObjectManager boLFI = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
|
||
tx.join(boLFI);
|
||
for(int i=0;i<datas.length;i++){
|
||
cIDs[i] = datas[i].split("@")[0];//<2F><>֤<EFBFBD><D6A4><EFBFBD>ֿ<EFBFBD>id
|
||
overmoneys[i] = new BigDecimal(datas[i].split("@")[1]);//<2F><>֤<EFBFBD><D6A4><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
for(int i=0;i<cIDs.length;i++){
|
||
String deductionID = UUIDUtil.getUUID();
|
||
BigDecimal deductionOverMoney = overmoneys[i];
|
||
for(int j=0;j<ids.length;j++){
|
||
List<BizObject> boLCRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK=0 ").setParameter("PLAN_ID", ids[j])
|
||
.getResultList(false);
|
||
List<BizObject> boLCRIT = JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = 0 and ROLL_BACK=0 ").setParameter("PLAN_ID", ids[j])
|
||
.getResultList(false);
|
||
int charge_list = boLCRI.size()+boLCRIT.size()+1;
|
||
BizObject boVLRP = JBOFactory.createBizObjectQuery(LC_RENT_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", ids[j])
|
||
.getSingleResult(false);
|
||
BizObject boLCI = JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME, "ID=:ID").setParameter("ID", boVLRP.getAttribute("CONTRACT_ID").getString())
|
||
.getSingleResult(false);
|
||
Map<String,List<Map<String,String>>> paymentOrders = ProductParamUtil.getProductComponentDecisionTable(boLCI.getAttribute("PRODUCT_ID").getString(), "PRD0307", "rmoname", "rmosortno");
|
||
String penaltyRule = ProductParamUtil.getProductParameterValue(boLCI.getAttribute("PRODUCT_ID").getString(), "PRD0307","PenaltyRule", "PenaltyRule");
|
||
if("penalty_income".equals(penaltyRule)){
|
||
Penaltys[j] = "0.00";
|
||
}
|
||
BigDecimal money = new BigDecimal(corpuss[j]).add(new BigDecimal(interests[j])).add(new BigDecimal(Penaltys[j]));
|
||
String corpusOver = "";
|
||
String interestOver = "";
|
||
String penaltyOver = "";
|
||
if(flag){
|
||
BizObject bo = JBOFactory.getBizObjectManager(VI_LC_RENT_PLAN.CLASS_NAME).createQuery("id=:planID").setParameter("planID", ids[i]).getSingleResult(false);
|
||
corpusOver = bo.getAttribute("corpus_over").getString();
|
||
interestOver = bo.getAttribute("interest_over").getString();
|
||
penaltyOver = bo.getAttribute("penalty_over").getString();
|
||
if("penalty_income".equals(penaltyRule)){
|
||
penaltyOver = "0.00";
|
||
}
|
||
money = new BigDecimal(corpusOver).add(new BigDecimal(interestOver)).add(new BigDecimal(penaltyOver));
|
||
}
|
||
if(deductionOverMoney.compareTo(zero)>0 && money.compareTo(zero)>0){//<2F><>֤<EFBFBD><D6A4><EFBFBD>ֿ۴<D6BF><DBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<CDBB><EEB6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
BizObjectManager bomLORL = JBOFactory.getBizObjectManager(LC_OCCUPY_RENT_LIST.CLASS_NAME,tx);
|
||
BizObject boLORL = bomLORL.createQuery("PAYMENT_NUMBER=:paymentnumber and PLAN_LIST=:planlist and FLOW_NAME='<27><>֤<EFBFBD><D6A4><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>' and FLOWUNID=:flowunid ").setParameter("paymentnumber", boVLRP.getAttribute("PAYMENT_NUMBER").getString())
|
||
.setParameter("planlist",boVLRP.getAttribute("PLAN_LIST").getString()).setParameter("flowunid",flowunid).getSingleResult();
|
||
if(boLORL==null){
|
||
boLORL = bomLORL.newObject();
|
||
boLORL.setAttributeValue("ID", UUIDUtil.getUUID());
|
||
boLORL.setAttributeValue("PAYMENT_NUMBER", boVLRP.getAttribute("PAYMENT_NUMBER").getString());
|
||
boLORL.setAttributeValue("PLAN_LIST", boVLRP.getAttribute("PLAN_LIST").getString());
|
||
boLORL.setAttributeValue("FLOW_NAME", "<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
boLORL.setAttributeValue("FLOWUNID", flowunid);
|
||
bomLORL.saveObject(boLORL);
|
||
}
|
||
String[] paymentOrder = new String[3];
|
||
if(new BigDecimal(Penaltys[j]).compareTo(zero)==0){//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
for(int k=0;k<paymentOrders.get("RMO-01").size();k++){
|
||
paymentOrder[Integer.parseInt(paymentOrders.get("RMO-01").get(k).get("rmosortno"))-1] = paymentOrders.get("RMO-01").get(k).get("rmoname");
|
||
}
|
||
}else{
|
||
for(int k=0;k<paymentOrders.get("RMO-02").size();k++){//<2F><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
paymentOrder[Integer.parseInt(paymentOrders.get("RMO-02").get(k).get("rmosortno"))-1] = paymentOrders.get("RMO-02").get(k).get("rmoname");
|
||
}
|
||
}
|
||
BizObject boLRIT = boLRI.newObject();
|
||
boLRIT.setAttributeValue("QUOT_ID", boVLRP.getAttribute("QUOT_ID").getString());
|
||
boLRIT.setAttributeValue("CUST_ID", boVLRP.getAttribute("CUST_ID").getString());
|
||
boLRIT.setAttributeValue("PROJECT_ID", boVLRP.getAttribute("PROJECT_ID").getString());
|
||
boLRIT.setAttributeValue("PROJECT_PLAN_NUMBER", boVLRP.getAttribute("PROJECT_PLAN_NUMBER").getString());
|
||
boLRIT.setAttributeValue("CONTRACT_ID", boVLRP.getAttribute("CONTRACT_ID").getString());
|
||
boLRIT.setAttributeValue("CONTRACT_PLAN_NUMBER", boVLRP.getAttribute("CONTRACT_PLAN_NUMBER").getString());
|
||
boLRIT.setAttributeValue("PAYMENT_NUMBER", boVLRP.getAttribute("PAYMENT_NUMBER").getString());
|
||
boLRIT.setAttributeValue("PLAN_ID", ids[j]);
|
||
boLRIT.setAttributeValue("PLAN_LIST", boVLRP.getAttribute("PLAN_LIST").getString());
|
||
boLRIT.setAttributeValue("INTEREST_ADJUST", 0);
|
||
boLRIT.setAttributeValue("SETTLE_METHOD", "settlemethod7");
|
||
boLRIT.setAttributeValue("HIRE_LIST", charge_list);
|
||
boLRIT.setAttributeValue("HIRE_DATE", StringFunction.getToday());
|
||
boLRIT.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
|
||
if(deductionOverMoney.compareTo(money)>=0){//<2F>˱ʱ<CBB1>֤<EFBFBD><D6A4><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD>Ϣ֮<CFA2><D6AE>
|
||
if(flag){
|
||
boLRIT.setAttributeValue("RENT", new BigDecimal(corpusOver).add(new BigDecimal(interestOver)));
|
||
boLRIT.setAttributeValue("CORPUS", new BigDecimal(corpusOver));
|
||
boLRIT.setAttributeValue("INTEREST", new BigDecimal(interestOver));
|
||
boLRIT.setAttributeValue("PENALTY", new BigDecimal(penaltyOver));
|
||
}else{
|
||
boLRIT.setAttributeValue("RENT", new BigDecimal(corpuss[j]).add(new BigDecimal(interests[j])));
|
||
boLRIT.setAttributeValue("CORPUS", new BigDecimal(corpuss[j]));
|
||
boLRIT.setAttributeValue("INTEREST", new BigDecimal(interests[j]));
|
||
boLRIT.setAttributeValue("PENALTY", new BigDecimal(Penaltys[j]));
|
||
corpuss[j]="0.00";
|
||
interests[j]="0.00";
|
||
Penaltys[j]="0.00";
|
||
}
|
||
deductionOverMoney=deductionOverMoney.subtract(money);
|
||
}else{//<2F>˱ʱ<CBB1>֤<EFBFBD><D6A4><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD>Ϣ֮<CFA2><D6AE>
|
||
if(flag){
|
||
BigDecimal thisRent = zero;
|
||
for(int k=0;k<paymentOrder.length;k++){
|
||
if("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(paymentOrder[k])){
|
||
if(deductionOverMoney.compareTo(new BigDecimal(corpusOver))>=0){
|
||
boLRIT.setAttributeValue("CORPUS", new BigDecimal(corpusOver));
|
||
deductionOverMoney=deductionOverMoney.subtract(new BigDecimal(corpusOver));
|
||
thisRent=thisRent.add(new BigDecimal(corpusOver));
|
||
}else{
|
||
boLRIT.setAttributeValue("CORPUS", deductionOverMoney);
|
||
deductionOverMoney=zero;
|
||
thisRent=thisRent.add(deductionOverMoney);
|
||
}
|
||
}else if("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[k])){
|
||
if(deductionOverMoney.compareTo(new BigDecimal(interestOver))>=0){
|
||
boLRIT.setAttributeValue("INTEREST", new BigDecimal(interestOver));
|
||
deductionOverMoney=deductionOverMoney.subtract(new BigDecimal(interestOver));
|
||
thisRent=thisRent.add(new BigDecimal(interestOver));
|
||
}else{
|
||
boLRIT.setAttributeValue("INTEREST", deductionOverMoney);
|
||
deductionOverMoney=zero;
|
||
thisRent=thisRent.add(deductionOverMoney);
|
||
}
|
||
}else if("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[k])){
|
||
if(deductionOverMoney.compareTo(new BigDecimal(penaltyOver))>=0){
|
||
boLRIT.setAttributeValue("PENALTY", new BigDecimal(penaltyOver));
|
||
deductionOverMoney=deductionOverMoney.subtract(new BigDecimal(penaltyOver));
|
||
}else{
|
||
boLRIT.setAttributeValue("PENALTY", deductionOverMoney);
|
||
deductionOverMoney=zero;
|
||
}
|
||
}
|
||
}
|
||
boLRIT.setAttributeValue("RENT", thisRent);
|
||
}else{
|
||
BigDecimal thisRent = zero;
|
||
for(int k=0;k<paymentOrder.length;k++){
|
||
if("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(paymentOrder[k])){
|
||
if(deductionOverMoney.compareTo(new BigDecimal(corpuss[j]))>=0){
|
||
boLRIT.setAttributeValue("CORPUS", new BigDecimal(corpuss[j]));
|
||
deductionOverMoney=deductionOverMoney.subtract(new BigDecimal(corpuss[j]));
|
||
thisRent=thisRent.add(new BigDecimal(corpuss[j]));
|
||
corpuss[j]="0.00";
|
||
}else{
|
||
boLRIT.setAttributeValue("CORPUS", deductionOverMoney);
|
||
thisRent=thisRent.add(deductionOverMoney);
|
||
deductionOverMoney=zero;
|
||
corpuss[j]=new BigDecimal(corpuss[j]).subtract(deductionOverMoney).setScale(Scale.CORPUS_SCALE).toString();
|
||
}
|
||
}else if("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[k])){
|
||
if(deductionOverMoney.compareTo(new BigDecimal(interests[j]))>=0){
|
||
boLRIT.setAttributeValue("INTEREST", new BigDecimal(interests[j]));
|
||
deductionOverMoney=deductionOverMoney.subtract(new BigDecimal(interests[j]));
|
||
thisRent=thisRent.add(new BigDecimal(interests[j]));
|
||
interests[j]="0.00";
|
||
}else{
|
||
boLRIT.setAttributeValue("INTEREST", deductionOverMoney);
|
||
thisRent=thisRent.add(deductionOverMoney);
|
||
deductionOverMoney=zero;
|
||
interests[j]=new BigDecimal(interests[j]).subtract(deductionOverMoney).setScale(Scale.INTEREST_SCALE).toString();
|
||
}
|
||
}else if("<EFBFBD><EFBFBD>Ϣ".equals(paymentOrder[k])){
|
||
if(deductionOverMoney.compareTo(new BigDecimal(Penaltys[j]))>=0){
|
||
boLRIT.setAttributeValue("PENALTY", new BigDecimal(Penaltys[j]));
|
||
deductionOverMoney=deductionOverMoney.subtract(new BigDecimal(Penaltys[j]));
|
||
Penaltys[j]="0.00";
|
||
}else{
|
||
boLRIT.setAttributeValue("PENALTY", deductionOverMoney);
|
||
deductionOverMoney=zero;
|
||
Penaltys[j]=new BigDecimal(Penaltys[j]).subtract(deductionOverMoney).setScale(Scale.RENT_SCALE).toString();
|
||
}
|
||
}
|
||
}
|
||
boLRIT.setAttributeValue("RENT", thisRent);
|
||
}
|
||
}
|
||
boLRIT.setAttributeValue("CORPUS_ADJUST", 0);
|
||
boLRIT.setAttributeValue("PENALTY_ADJUST", 0);
|
||
boLRIT.setAttributeValue("ROLL_BACK", 0);
|
||
boLRIT.setAttributeValue("DEDUCTION_ID", deductionID);
|
||
boLRIT.setAttributeValue("COIN", boVLRP.getAttribute("COIN").getString());
|
||
boLRIT.setAttributeValue("IS_FLOWING", 0);
|
||
boLRIT.setAttributeValue("FLOWUNID", flowunid);
|
||
boLRI.saveObject(boLRIT);
|
||
}
|
||
}
|
||
if(overmoneys[i].compareTo(deductionOverMoney)>0){
|
||
List<BizObject> boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK=0 ").setParameter("PLAN_ID", cIDs[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 ").setParameter("PLAN_ID", cIDs[i])
|
||
.getResultList(false);
|
||
int charge_listFund = boLCFI.size()+boLCFIT.size()+1;
|
||
BizObject boLFP = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, "id=:id").setParameter("id", cIDs[i]).getSingleResult(false);
|
||
BizObject boLFIT = boLFI.newObject();
|
||
boLFIT.setAttributeValue("ID", deductionID);
|
||
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", boLFP.getAttribute("ID").getString());
|
||
boLFIT.setAttributeValue("PLAN_LIST", boLFP.getAttribute("PLAN_LIST").getString());
|
||
boLFIT.setAttributeValue("PAY_TYPE", boLFP.getAttribute("PAY_TYPE").getString());
|
||
boLFIT.setAttributeValue("FEE_TYPE", boLFP.getAttribute("FEE_TYPE").getString());
|
||
boLFIT.setAttributeValue("SETTLE_METHOD", "settlemethod7");
|
||
boLFIT.setAttributeValue("CHARGE_LIST", charge_listFund);
|
||
boLFIT.setAttributeValue("FACT_DATE", StringFunction.getToday());
|
||
boLFIT.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
|
||
boLFIT.setAttributeValue("FACT_MONEY", overmoneys[i].subtract(deductionOverMoney));
|
||
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);
|
||
boLFIT.setAttributeValue("COIN", boLFP.getAttribute("COIN").getString());
|
||
boLFIT.setAttributeValue("MEMO", boLFP.getAttribute("FPNOTE").getString());
|
||
boLFI.saveObject(boLFIT);
|
||
}
|
||
}
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
return "ERROR";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
public String updateEbankAndEbankProcess(JBOTransaction tx){
|
||
try{
|
||
BizObjectManager bomEb = JBOFactory.getBizObjectManager(LC_EBANK_TEMP.CLASS_NAME);
|
||
tx.join(bomEb);
|
||
BizObject boEb = bomEb.createQuery("FLOWUNID=:FLOWUNID")
|
||
.setParameter("FLOWUNID", flowunid).getSingleResult(true);
|
||
BigDecimal hadMoney = new BigDecimal(boEb.getAttribute("HAD_MONEY").getDouble())
|
||
.subtract(new BigDecimal(oldFactMoney)).add(new BigDecimal(newFactMoney));
|
||
BigDecimal factMoney = new BigDecimal(boEb.getAttribute("FACT_MONEY").getDouble());
|
||
boEb.setAttributeValue("HAD_MONEY", hadMoney);
|
||
boEb.setAttributeValue("MAYOPE_MONEY", factMoney.subtract(hadMoney));
|
||
BizObjectManager bomLEP = JBOFactory.getBizObjectManager(LC_EBANK_PROCESS.CLASS_NAME);
|
||
tx.join(bomLEP);
|
||
bomLEP.createQuery("update O set process_money=:allFactMoney where flowunid=:flowUnid")
|
||
.setParameter("allFactMoney", newFactMoney).setParameter("flowUnid", flowunid).executeUpdate();
|
||
bomEb.saveObject(boEb);
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
return "ERROR";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
public String updateRelativeFundIncome(JBOTransaction tx){
|
||
try{
|
||
if(ids != null){
|
||
BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
|
||
tx.join(bomLFIT);
|
||
String[] incomeIds = ids.split("@");
|
||
for(int i=0;i<incomeIds.length;i++){
|
||
BizObject boLRIT = JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME, "flowunid=:flowunid and id=:id")
|
||
.setParameter("flowunid", flowunid).setParameter("id", incomeIds[i]).getSingleResult(false);
|
||
BigDecimal useMoney = new BigDecimal(boLRIT.getAttribute("RENT").getString())
|
||
.add(new BigDecimal(boLRIT.getAttribute("PENALTY").getString()));
|
||
bomLFIT.createQuery("update O set fact_money=:useMoney where id=:id").setParameter("useMoney", useMoney.toString())
|
||
.setParameter("id", boLRIT.getAttribute("DEDUCTION_ID").getString())
|
||
.executeUpdate();
|
||
}
|
||
}
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
return "ERROR";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
public String deleteRelativeFundIncome(JBOTransaction tx){
|
||
try{
|
||
BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
|
||
tx.join(bomLFIT);
|
||
String[] deductionIDs = ids.split("@");
|
||
for(int i=0;i<deductionIDs.length;i++){
|
||
bomLFIT.createQuery("delete from O where id=:id and flowunid=:flowunid").setParameter("id", deductionIDs[i])
|
||
.setParameter("flowunid", flowunid)
|
||
.executeUpdate();
|
||
}
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
return "ERROR";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
public String deleteRelativeRentIncome(JBOTransaction tx){
|
||
try{
|
||
BizObjectManager bomLFIT = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME);
|
||
tx.join(bomLFIT);
|
||
String[] deductionIDs = ids.split("@");
|
||
for(int i=0;i<deductionIDs.length;i++){
|
||
bomLFIT.createQuery("delete from O where deduction_id=:id and flowunid=:flowunid").setParameter("id", deductionIDs[i])
|
||
.setParameter("flowunid", flowunid)
|
||
.executeUpdate();
|
||
}
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
return "ERROR";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
/**
|
||
* <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||
*/
|
||
public String setPenaltyDataToRentIncome(JBOTransaction tx) throws JBOException {
|
||
try {
|
||
// String[] Penaltys = overPenaltys.split("@");
|
||
// Boolean flag = false;
|
||
// if ("Y".equals(isChanged)) {
|
||
// flag = true;
|
||
// }
|
||
String[] ids = planIDs.split("@");
|
||
for (int i = 0; i < ids.length; i++) {
|
||
BizObject boVLR = JBOFactory.createBizObjectQuery(LC_RENT_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", ids[i])
|
||
.getSingleResult(false);
|
||
// BizObject boVLRP = JBOFactory.createBizObjectQuery(VI_LC_RENT_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", ids[i])
|
||
// .getSingleResult(false);
|
||
Transaction tran = Transaction.createTransaction(tx);
|
||
BigDecimal penaltyOver = (BigDecimal)SqlRunnerUtil.query(tran, "flow.PenaltyReductionFlow.queryRentPlanRemainPenalty", ImmutableMap.of("planId", ids[i]), new NumberHandler());
|
||
|
||
BizObjectManager boLRI = JBOFactory.getBizObjectManager(LC_RENT_INCOME_TEMP.CLASS_NAME);
|
||
BizObjectManager bomLORL = JBOFactory.getBizObjectManager(LC_OCCUPY_RENT_LIST.CLASS_NAME, tx);
|
||
BizObject boLORL = bomLORL.newObject();
|
||
boLORL.setAttributeValue("ID", UUIDUtil.getUUID());
|
||
boLORL.setAttributeValue("PAYMENT_NUMBER", boVLR.getAttribute(LC_RENT_PLAN.PAYMENT_NUMBER).getString());
|
||
boLORL.setAttributeValue("PLAN_LIST", boVLR.getAttribute(LC_RENT_PLAN.PLAN_LIST).getString());
|
||
boLORL.setAttributeValue("FLOW_NAME", "<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
boLORL.setAttributeValue("FLOWUNID", flowunid);
|
||
bomLORL.saveObject(boLORL);
|
||
tx.join(boLRI);
|
||
BizObject boLRIT = boLRI.newObject();
|
||
boLRIT.setAttributeValue("QUOT_ID", boVLR.getAttribute("QUOT_ID").getString());
|
||
boLRIT.setAttributeValue("CUST_ID", boVLR.getAttribute("CUST_ID").getString());
|
||
boLRIT.setAttributeValue("PROJECT_ID", boVLR.getAttribute("PROJECT_ID").getString());
|
||
boLRIT.setAttributeValue("PROJECT_PLAN_NUMBER", boVLR.getAttribute("PROJECT_PLAN_NUMBER").getString());
|
||
boLRIT.setAttributeValue("CONTRACT_ID", boVLR.getAttribute("CONTRACT_ID").getString());
|
||
boLRIT.setAttributeValue("CONTRACT_PLAN_NUMBER", boVLR.getAttribute("CONTRACT_PLAN_NUMBER").getString());
|
||
boLRIT.setAttributeValue("PAYMENT_NUMBER", boVLR.getAttribute("PAYMENT_NUMBER").getString());
|
||
boLRIT.setAttributeValue("EBANK_NUMBER", "");
|
||
boLRIT.setAttributeValue("PLAN_ID", ids[i]);
|
||
boLRIT.setAttributeValue("PLAN_LIST", boVLR.getAttribute("PLAN_LIST").getString());
|
||
boLRIT.setAttributeValue("INTEREST_ADJUST", 0);
|
||
boLRIT.setAttributeValue("SETTLE_METHOD", "settlemethod12");
|
||
List<BizObject> boLCRI = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME, "PAYMENT_NUMBER=:paymentNumber AND PLAN_LIST = :planList and ROLL_BACK='0'")
|
||
.setParameter("paymentNumber", boVLR.getAttribute(LC_RENT_PLAN.PAYMENT_NUMBER).getString())
|
||
.setParameter("planList", boVLR.getAttribute(LC_RENT_PLAN.PLAN_LIST).getString())
|
||
.getResultList(false);
|
||
List<BizObject> boLCRIT = JBOFactory.createBizObjectQuery(LC_RENT_INCOME_TEMP.CLASS_NAME, "PAYMENT_NUMBER=:paymentNumber AND PLAN_LIST = :planList and IS_FLOWING = 0 and ROLL_BACK='0'")
|
||
.setParameter("paymentNumber", boVLR.getAttribute(LC_RENT_PLAN.PAYMENT_NUMBER).getString())
|
||
.setParameter("planList", boVLR.getAttribute(LC_RENT_PLAN.PLAN_LIST).getString())
|
||
.getResultList(false);
|
||
boLRIT.setAttributeValue("HIRE_LIST", boLCRI.size() + boLCRIT.size() + 1);
|
||
boLRIT.setAttributeValue("HIRE_DATE", StringFunction.getToday());
|
||
boLRIT.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
|
||
boLRIT.setAttributeValue("RENT", 0);
|
||
boLRIT.setAttributeValue("CORPUS", 0);
|
||
boLRIT.setAttributeValue("INTEREST", 0);
|
||
boLRIT.setAttributeValue("INTEREST_ADJUST", 0);
|
||
boLRIT.setAttributeValue("PENALTY", 0);
|
||
boLRIT.setAttributeValue("CORPUS_ADJUST", 0);
|
||
boLRIT.setAttributeValue("PENALTY_ADJUST", penaltyOver);
|
||
boLRIT.setAttributeValue("ROLL_BACK", 0);
|
||
boLRIT.setAttributeValue("COIN", boVLR.getAttribute("COIN").getString());
|
||
boLRIT.setAttributeValue("IS_FLOWING", 0);
|
||
boLRIT.setAttributeValue("FLOWUNID", flowunid);
|
||
boLRI.saveObject(boLRIT);
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
return "ERROR";
|
||
}
|
||
return "SUCCESS";
|
||
}
|
||
|
||
public String createRentIncomeWithCard(JBOTransaction tx) throws Exception{
|
||
String sReturn = "SUCCESS";
|
||
Transaction tran = Transaction.createTransaction(tx);
|
||
Connection con = null;
|
||
try{
|
||
con = tran.getConnection(tran);
|
||
/* ResultSet rs = stat.executeQuery("select count(1) cou from lc_card_deduct_data where deduct_docid='"+deductDocId+"' and income_status='0'");
|
||
if(rs.next()){
|
||
String cou = rs.getString("cou");
|
||
if("0".equals(cou)){
|
||
return "false";
|
||
}
|
||
}*/
|
||
CallableStatement call = con.prepareCall("call proc_card_income('"+deductDocId+"','"+userid+"','"+orgid+"')");
|
||
call.execute();
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
if(con !=null){
|
||
con.rollback();
|
||
con.close();
|
||
con = null;
|
||
}
|
||
return "ERROR";
|
||
}finally{
|
||
if(con !=null){
|
||
con.commit();
|
||
con.close();
|
||
con = null;
|
||
}
|
||
}
|
||
return sReturn;
|
||
}
|
||
|
||
/*public String createRentIncomeWithCard(JBOTransaction tx) throws Exception{
|
||
String sReturn = "SUCCESS";
|
||
sql = sql.replaceAll("<22><>", ",");
|
||
sql = sql.replaceAll("&", "=");
|
||
Connection con = null;
|
||
try{
|
||
List<BizObject> boVCDD = JBOFactory.getBizObjectManager(VI_CARD_DEDUCT_DATA.CLASS_NAME).createQuery(sql).getResultList(false);
|
||
int count = 0;//ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
int n = 0;//ƥ<><C6A5>ʧ<EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>
|
||
long start = System.currentTimeMillis();
|
||
WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();
|
||
ComboPooledDataSource datasource = wac.getBean("dataSourceJDBC",ComboPooledDataSource.class);
|
||
BigDecimal money = new BigDecimal(0);
|
||
con = datasource.getConnection();
|
||
con.setAutoCommit(false);
|
||
String executeSql = "insert into lc_rent_income_temp (id,"
|
||
+ "quot_id,"
|
||
+ "cust_id,"
|
||
+ "project_id,"
|
||
+ "project_plan_number,"
|
||
+ "contract_id,"
|
||
+ "contract_plan_number,"
|
||
+ "payment_number,"
|
||
+ "plan_id,"
|
||
+ "plan_list,"
|
||
+ "hire_list,"
|
||
+ "hire_date,"
|
||
+ "rent,"
|
||
+ "corpus,"
|
||
+ "interest,"
|
||
+ "penalty,"
|
||
+ "corpus_adjust,"
|
||
+ "interest_adjust,"
|
||
+ "penalty_adjust,"
|
||
+ "settle_method,"
|
||
+ "carddeduct_id,"
|
||
+ "carddeduct_status,"
|
||
+ "hire_object,"
|
||
+ "hire_bank,"
|
||
+ "hire_account,"
|
||
+ "hire_number,"
|
||
+ "own_bank,"
|
||
+ "own_account,"
|
||
+ "own_number,"
|
||
+ "roll_back,"
|
||
+ "flowunid,"
|
||
+ "inputuserid,"
|
||
+ "inputorgid,"
|
||
+ "inputtime,"
|
||
+ "is_flowing) "
|
||
+ "SELECT replace(uuid(),'-',''),"
|
||
+ "lrp.quot_id,"
|
||
+ "lrp.cust_id,"
|
||
+ "lrp.project_id,"
|
||
+ "lrp.project_plan_number,"
|
||
+ "lrp.contract_id,"
|
||
+ "lrp.contract_plan_number,"
|
||
+ "lrp.payment_number,"
|
||
+ "lrp.id,"
|
||
+ "lrp.plan_list,"
|
||
+ "ifnull(li.hire_list,0)+1+?,"
|
||
+ "?,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN vlrp.rent_over ELSE 0 END,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN vlrp.corpus_over ELSE 0 END,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN vlrp.interest_over ELSE 0 END,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN 0 ELSE vlrp.penalty_over END,"
|
||
+ "0,"
|
||
+ "0,"
|
||
+ "0,"
|
||
+ "'settlemethod6',"
|
||
+ "?,"
|
||
+ "'have_income',"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "'0',"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "'0' FROM lc_rent_plan AS lrp LEFT JOIN(SELECT lr.payment_number,lr.plan_list,COUNT(lr.plan_list)AS hire_list FROM (SELECT lri.payment_number,lri.plan_list,COUNT(lri.plan_list)AS hire_list FROM lc_rent_income AS lri WHERE lri.ROLL_BACK='0' and lri.payment_number=? and lri.plan_list=? GROUP BY lri.payment_number,lri.plan_list UNION SELECT lrit.payment_number,lrit.plan_list,COUNT(lrit.plan_list)AS hire_list FROM lc_rent_income_temp AS lrit WHERE lrit.roll_back='0' AND lrit.is_flowing='0' and lrit.payment_number=? and lrit.plan_list=? GROUP BY lrit.payment_number,lrit.plan_list)AS lr GROUP BY lr.payment_number,lr.plan_list) AS li ON li.payment_number=lrp.PAYMENT_NUMBER AND li.plan_list=lrp.PLAN_LIST LEFT JOIN vi_lc_rent_plan AS vlrp ON vlrp.payment_number=lrp.PAYMENT_NUMBER AND vlrp.plan_list=lrp.plan_list where lrp.plan_list=? and lrp.PAYMENT_NUMBER=?";
|
||
if("ORACLE".equals(InitDBType.DBTYPE)){
|
||
executeSql = "insert into lc_rent_income_temp (id,"
|
||
+ "quot_id,"
|
||
+ "cust_id,"
|
||
+ "project_id,"
|
||
+ "project_plan_number,"
|
||
+ "contract_id,"
|
||
+ "contract_plan_number,"
|
||
+ "payment_number,"
|
||
+ "plan_id,"
|
||
+ "plan_list,"
|
||
+ "hire_list,"
|
||
+ "hire_date,"
|
||
+ "rent,"
|
||
+ "corpus,"
|
||
+ "interest,"
|
||
+ "penalty,"
|
||
+ "corpus_adjust,"
|
||
+ "interest_adjust,"
|
||
+ "penalty_adjust,"
|
||
+ "settle_method,"
|
||
+ "carddeduct_id,"
|
||
+ "carddeduct_status,"
|
||
+ "hire_object,"
|
||
+ "hire_bank,"
|
||
+ "hire_account,"
|
||
+ "hire_number,"
|
||
+ "own_bank,"
|
||
+ "own_account,"
|
||
+ "own_number,"
|
||
+ "roll_back,"
|
||
+ "flowunid,"
|
||
+ "inputuserid,"
|
||
+ "inputorgid,"
|
||
+ "inputtime,"
|
||
+ "is_flowing) "
|
||
+ "SELECT sys_guid(),"
|
||
+ "lrp.quot_id,"
|
||
+ "lrp.cust_id,"
|
||
+ "lrp.project_id,"
|
||
+ "lrp.project_plan_number,"
|
||
+ "lrp.contract_id,"
|
||
+ "lrp.contract_plan_number,"
|
||
+ "lrp.payment_number,"
|
||
+ "lrp.id,"
|
||
+ "lrp.plan_list,"
|
||
+ "nvl(li.hire_list,0)+1+?,"
|
||
+ "?,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN vlrp.rent_over ELSE 0 END,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN vlrp.corpus_over ELSE 0 END,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN vlrp.interest_over ELSE 0 END,"
|
||
+ "CASE WHEN '<27><><EFBFBD><EFBFBD>'=? THEN 0 ELSE vlrp.penalty_over END,"
|
||
+ "0,"
|
||
+ "0,"
|
||
+ "0,"
|
||
+ "'settlemethod6',"
|
||
+ "?,"
|
||
+ "'have_income',"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "'0',"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "?,"
|
||
+ "'0' FROM lc_rent_plan lrp LEFT JOIN(SELECT lr.payment_number,lr.plan_list,COUNT(lr.plan_list)AS hire_list FROM (SELECT lri.payment_number,lri.plan_list,COUNT(lri.plan_list)AS hire_list FROM lc_rent_income lri WHERE lri.ROLL_BACK='0' and lri.payment_number=? and lri.plan_list=? GROUP BY lri.payment_number,lri.plan_list UNION SELECT lrit.payment_number,lrit.plan_list,COUNT(lrit.plan_list)AS hire_list FROM lc_rent_income_temp lrit WHERE lrit.roll_back='0' AND lrit.is_flowing='0' and lrit.payment_number=? and lrit.plan_list=? GROUP BY lrit.payment_number,lrit.plan_list) lr GROUP BY lr.payment_number,lr.plan_list) li ON li.payment_number=lrp.PAYMENT_NUMBER AND li.plan_list=lrp.PLAN_LIST LEFT JOIN vi_lc_rent_plan vlrp ON vlrp.payment_number=lrp.PAYMENT_NUMBER AND vlrp.plan_list=lrp.plan_list where lrp.plan_list=? and lrp.PAYMENT_NUMBER=?";
|
||
}
|
||
String failedSql = "insert into lc_card_deduct_matchfail_temp(id,deduct_docid,carddeduct_id,inputuserid,inputorgid,inputtime,flowunid) values(replace(uuid(),'-',''),?,?,?,?,?,?)";
|
||
if("ORACLE".equals(InitDBType.DBTYPE)){
|
||
failedSql = "insert into lc_card_deduct_matchfail_temp(id,deduct_docid,carddeduct_id,inputuserid,inputorgid,inputtime,flowunid) values(sys_guid(),?,?,?,?,?,?)";
|
||
}
|
||
PreparedStatement executeStat = con.prepareStatement(executeSql);
|
||
PreparedStatement executeFailedStat = con.prepareStatement(failedSql);
|
||
String planList = "";
|
||
String paymentNumber = "";
|
||
for(BizObject b:boVCDD){
|
||
if(!b.getAttribute("actual_debit_amt").getString().equals(b.getAttribute("over_money").getString())){
|
||
n++;
|
||
executeFailedStat.setString(1, b.getAttribute("deduct_docid").getString());
|
||
executeFailedStat.setString(2, b.getAttribute("carddeduct_id").getString());
|
||
executeFailedStat.setString(3, userid);
|
||
executeFailedStat.setString(4, orgid);
|
||
executeFailedStat.setString(5, StringFunction.getToday());
|
||
executeFailedStat.setString(6, flowunid);
|
||
executeFailedStat.addBatch();
|
||
continue;
|
||
}
|
||
count++;
|
||
if(planList.equals(b.getAttribute("plan_list").getString()) && paymentNumber.equals(b.getAttribute("payment_number").getString())){
|
||
executeStat.setInt(1, 0);
|
||
}else{
|
||
executeStat.setInt(1, 0);
|
||
}
|
||
executeStat.setString(2, b.getAttribute("enddate").getString());
|
||
executeStat.setString(3, b.getAttribute("fee_type").getString());
|
||
executeStat.setString(4, b.getAttribute("fee_type").getString());
|
||
executeStat.setString(5, b.getAttribute("fee_type").getString());
|
||
executeStat.setString(6, b.getAttribute("fee_type").getString());
|
||
executeStat.setString(7, b.getAttribute("carddeduct_id").getString());
|
||
executeStat.setString(8, b.getAttribute("client_account").getString());
|
||
executeStat.setString(9, b.getAttribute("client_bank").getString());
|
||
executeStat.setString(10, b.getAttribute("client_account").getString());
|
||
executeStat.setString(11, b.getAttribute("client_acc_number").getString());
|
||
executeStat.setString(12, b.getAttribute("lease_acc_bank").getString());
|
||
executeStat.setString(13, b.getAttribute("own_account").getString());
|
||
executeStat.setString(14, b.getAttribute("ownacc_number").getString());
|
||
executeStat.setString(15, flowunid);
|
||
executeStat.setString(16, userid);
|
||
executeStat.setString(17, orgid);
|
||
executeStat.setString(18, StringFunction.getToday());
|
||
executeStat.setString(19, b.getAttribute("payment_number").getString());
|
||
executeStat.setString(20, b.getAttribute("plan_list").getString());
|
||
executeStat.setString(21, b.getAttribute("payment_number").getString());
|
||
executeStat.setString(22, b.getAttribute("plan_list").getString());
|
||
executeStat.setString(23, b.getAttribute("plan_list").getString());
|
||
executeStat.setString(24, b.getAttribute("payment_number").getString());
|
||
planList = b.getAttribute("plan_list").getString();
|
||
paymentNumber = b.getAttribute("payment_number").getString();
|
||
money = money.add(new BigDecimal(b.getAttribute("actual_debit_amt").getString()));
|
||
executeStat.addBatch();
|
||
if(count == 1000){
|
||
executeStat.executeBatch();
|
||
executeStat.clearBatch();
|
||
count = 0;
|
||
}
|
||
}
|
||
executeFailedStat.executeBatch();
|
||
executeStat.executeBatch();
|
||
BizObjectManager bomLCDD = JBOFactory.getBizObjectManager(LC_CARD_DEDUCT_DOC_TEMP.CLASS_NAME);
|
||
tx.join(bomLCDD);
|
||
bomLCDD.createQuery("update O set allmayope_money=allfact_money-(allhad_money+"+money+"),allhad_money=allhad_money+"+money+" where flowunid='"+flowunid+"'").executeUpdate();
|
||
con.commit();
|
||
if(n > 0){
|
||
sReturn = "PORTION@"+n;
|
||
}
|
||
}catch(Exception e){
|
||
e.printStackTrace();
|
||
con.rollback();
|
||
tx.rollback();
|
||
return "ERROR";
|
||
}
|
||
return sReturn;
|
||
}*/
|
||
}
|