diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioInfo.jsp
index 7ed569fa3..6b649ca2d 100644
--- a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioInfo.jsp
+++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioInfo.jsp
@@ -12,6 +12,7 @@ include
dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID"));
String sButtons[][] = {
{"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""},
+ {"true","All","Button","根据产品ID补录分润计划","根据产品ID补录分润计划","split()","","","","btn_icon_delete",""},
};
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<%@ include file="/Frame/resources/include/include_end.jspf"%>
diff --git a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java
index f6644f1e1..b5c93bd7e 100644
--- a/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java
+++ b/calc/com/tenwa/reckon/executor/CreateTransactionExecutor.java
@@ -16,15 +16,14 @@ import com.tenwa.quartz.StringUtil;
import com.tenwa.reckon.bean.*;
import com.tenwa.reckon.executor.rentChange.RentChangeExe;
import com.tenwa.reckon.executor.rentTerminate.RentTerminateExe;
-import com.tenwa.reckon.help.CalYearRateFromRent;
-import com.tenwa.reckon.help.ConditionHelper;
-import com.tenwa.reckon.help.RentPlanContrCalDAOImpl;
+import com.tenwa.reckon.help.*;
import com.tenwa.reckon.util.*;
import jbo.app.tenwa.calc.*;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.com.tenwa.lease.comm.LB_EQUIPMENT_TEMP;
import jbo.com.tenwa.lease.comm.LC_PAY_CONDTION_TEMP;
+import jbo.prd.LB_SPLITTING_RATIO;
import jbo.sys.CODE_LIBRARY;
import java.io.InputStream;
@@ -58,6 +57,8 @@ public class CreateTransactionExecutor implements Transaction {
private String flow_name;
private String ebanknumber;
private String projectId;
+ private String distributorId;
+
public String getStartDate() {
return startDate;
@@ -384,6 +385,38 @@ public class CreateTransactionExecutor implements Transaction {
}
+ public String getSplitByProductId(JBOTransaction tx) {
+ try{
+ com.amarsoft.awe.util.Transaction Sqlca = com.amarsoft.awe.util.Transaction.createTransaction(tx);
+ String splitType = Sqlca.getString( "select attribute5 from business_type where typeno = '" + productId + "'" );
+ BizObjectManager bmLSR = JBOFactory.getBizObjectManager(LB_SPLITTING_RATIO.CLASS_NAME,tx);
+ BizObjectManager bmLCI = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME,tx);
+ BizObjectManager bmLRP = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME,tx);
+ BizObject boLSR= bmLSR.createQuery("product_id=:productId and distributor_id=:distributorId").setParameter("productId",productId).setParameter("distributorId",distributorId).getSingleResult(false);
+ String splitRatio = boLSR.getAttribute("splitting_ratio").toString();
+
+ List boLCIs = bmLCI.createQuery("product_id=:productId and distributor_id=:distributorId").setParameter("productId",productId).setParameter("distributorId",distributorId).getResultList(false);
+ if(boLCIs.size()>0){
+ for(BizObject boLCI : boLCIs){
+ String contractId = boLCI.getAttribute("ID").toString();
+ BizObject boLRP = bmLRP.createQuery("contract_id=:contractId and corpus_sp is null").setParameter("contractId",contractId).getSingleResult(false);
+ if(boLRP!=null){
+ setPlannumber(boLRP.getAttribute("PAYMENT_NUMBER").toString());
+ insertRentPlan_SP(splitRatio,Sqlca,splitType);
+ }else{
+ return "当前产品和经销商下的起租合同均已经有分润";
+ }
+ }
+ }else{
+ return "未找到对应的起租合同";
+ }
+ return "success";
+ }catch (Exception e){
+ return "操作失败";
+ }
+
+
+ }
public void insertRentPlan_SP_Flexible(String ratio,Transaction Sqlca){
}
@@ -762,6 +795,100 @@ public class CreateTransactionExecutor implements Transaction {
return "服务器繁忙,请稍后再试!";
}
}
+
+ /**
+ * 租金计划休眠
+ */
+ @Override
+ public String runRentdormant() throws Exception{
+
+ JSONObject jsonObject = JSONObject.createObject();
+ JBOTransaction tx=null;
+ try {
+ tx=JBOFactory.createJBOTransaction();
+ //组装实体bean
+ TabCalBean bean = TbBeanTools.getTabInfo(calType, flowunid,plannumber,productId);
+ ConditionBean cb = bean.getCb();
+ cb = DictTools.getReversDict(cb);
+ bean.setCb(cb);
+ BizObject bo = JBOFactory.getFactory().getManager("jbo.app.tenwa.calc.LC_DORMANT_RENT_ADJUST_TEMP").createQuery("flowunid =:flowunid and payment_number=:payment_number").setParameter("flowunid", flowunid).setParameter("payment_number", plannumber).getSingleResult(false);
+ int startList = bo.getAttribute("START_LIST").getInt();
+ int endList = bo.getAttribute("END_LIST").getInt();
+ String dormantYearRate = bo.getAttribute("DORMANT_YEAR_RATE").toString();
+ BizObjectManager bomLRPT = JBOFactory.getFactory().getManager(LC_RENT_PLAN_TEMP.CLASS_NAME,tx);
+ List bolLRPT = bomLRPT.createQuery("flowunid =:flowunid and payment_number=:payment_number order by plan_list").setParameter("flowunid", flowunid).setParameter("payment_number", plannumber).getResultList(true);
+ String ALL_REMAIN_CORPUS = bolLRPT.get(startList-1).getAttribute("ALL_REMAIN_CORPUS").toString();
+ String CORPUS = bolLRPT.get(startList-1).getAttribute("CORPUS").toString();
+ BigDecimal allRemainCorpus = new BigDecimal(ALL_REMAIN_CORPUS).add(new BigDecimal(CORPUS));
+ BigDecimal dormantInterest = allRemainCorpus.multiply(new BigDecimal(dormantYearRate)).divide(new BigDecimal("100")).divide(new BigDecimal("12"),2,BigDecimal.ROUND_HALF_UP);
+
+ BigDecimal finalPayment = new BigDecimal(cb.getFinalPayment()==null?"0":cb.getFinalPayment());
+ String preRate = RateTools.getPreRate(cb.getYearRate(), cb.getIncomeNumberYear(),cb.getRateAdjustType());
+ String rent = new BigDecimal(RentTools.getPMT(preRate, bolLRPT.size()-endList + "", "-"+allRemainCorpus.toString(), finalPayment.toString(), cb.getPeriodType())).toString();
+ List rentList = new ArrayList<>();
+ for(int i=0;i interests = icsi.getInterestList(rentList, allRemainCorpus.toString(), cb.getYearRate(), cb.getPeriodType(), cb.getGrace(), cb.getIncomeNumberYear(), cb.getEquipEndValue(),cb.getRateAdjustType());
+
+ // 加载本金列表103196.63*(1.0075)
+ CorpusServiceImpl csi = new CorpusServiceImpl();
+ List corpusList = csi.getCorpusList(rentList, interests);
+
+ FundRentPlanBean frpb = new FundRentPlanBean();
+ frpb.setRentList(rentList);
+ frpb.setCorpusBusinessList(corpusList);
+ frpb.setInterestBusinessList(interests);
+
+ // 加载调整信息列表
+ RentPlanServiceImpl rpsi = new RentPlanServiceImpl();
+ rpsi.adjustLastRentPlan(frpb, allRemainCorpus.toString(), cb.getEquipEndValue());
+
+ // 加载本金余额列表
+ List corpusOverageBusinessList = TransRateHelper.getCorpusOvergeList(allRemainCorpus.toString(), frpb.getCorpusBusinessList());
+
+ for(int i=0;i=startList&&planNo<=endList){
+ String interest = dormantInterest.toString();
+ String remainCorpus = allRemainCorpus.toString();
+ bolLRPT.get(i).setAttributeValue("RENT",interest);
+ bolLRPT.get(i).setAttributeValue("CORPUS","0.00");
+ bolLRPT.get(i).setAttributeValue("INTEREST",interest);
+ bolLRPT.get(i).setAttributeValue("CORPUS_BUSINESS","0.00");
+ bolLRPT.get(i).setAttributeValue("INTEREST_BUSINESS",interest);
+ bolLRPT.get(i).setAttributeValue("ALL_REMAIN_CORPUS",remainCorpus);
+ }else if (planNo>endList){
+ bolLRPT.get(i).setAttributeValue("RENT",frpb.getRentList().get(i-endList));
+ bolLRPT.get(i).setAttributeValue("CORPUS",frpb.getCorpusBusinessList().get(i-endList));
+ bolLRPT.get(i).setAttributeValue("INTEREST",frpb.getInterestBusinessList().get(i-endList));
+ bolLRPT.get(i).setAttributeValue("CORPUS_BUSINESS",frpb.getCorpusBusinessList().get(i-endList));
+ bolLRPT.get(i).setAttributeValue("INTEREST_BUSINESS",frpb.getInterestBusinessList().get(i-endList));
+ bolLRPT.get(i).setAttributeValue("ALL_REMAIN_CORPUS",corpusOverageBusinessList.get(i-endList));
+
+ }
+ bomLRPT.saveObject(bolLRPT.get(i));
+ }
+ String irr = this.createCashFlow(bean,tx);
+ BizObjectManager bomLCCT = JBOFactory.getFactory().getManager(LC_CALC_CONDITION_TEMP.CLASS_NAME);
+ BizObject boLCCT = bomLCCT.createQuery("flowunid =:flowunid and payment_number=:payment_number").setParameter("flowunid", flowunid).setParameter("payment_number", plannumber).getSingleResult(true);
+ boLCCT.setAttributeValue("IRR",irr);
+ bomLCCT.saveObject(boLCCT);
+
+ jsonObject.appendElement("result", "true");
+ } catch (Exception e) {
+ tx.rollback();
+ e.printStackTrace();
+ jsonObject.appendElement("result", "false");
+ }finally{
+ if(tx!=null){
+ tx.commit();
+ }
+ }
+ return JSONEncoder.encode(jsonObject);
+ }
/**
* 租金计划变更
*/
@@ -1334,7 +1461,12 @@ public class CreateTransactionExecutor implements Transaction {
public void setProjectId(String projectId) {
this.projectId = projectId;
}
-
+ public String getDistributorId() {
+ return distributorId;
+ }
+ public void setDistributorId(String distributorId) {
+ this.distributorId = distributorId;
+ }
}