diff --git a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml
index 817c20dd9..0b8e87a7f 100644
--- a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml
+++ b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml
@@ -2444,6 +2444,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src_jbo/jbo/com/tenwa/lease/comm/VI_BOND_COMPENSATORY.java b/src_jbo/jbo/com/tenwa/lease/comm/VI_BOND_COMPENSATORY.java
new file mode 100644
index 000000000..98624c292
--- /dev/null
+++ b/src_jbo/jbo/com/tenwa/lease/comm/VI_BOND_COMPENSATORY.java
@@ -0,0 +1,56 @@
+package jbo.com.tenwa.lease.comm;
+
+import java.lang.String;
+
+/**
+* ֤ݲѯ - JBO
+* Note: This file is generated by ADE tools, dont modify it.
+
+*/
+public interface VI_BOND_COMPENSATORY{
+ /**
+ * ֤ݲѯ
+ * ӳBizObjectClass
+ */
+ public static final String CLASS_NAME = "jbo.com.tenwa.lease.comm.VI_BOND_COMPENSATORY";
+ /**
+ * ƻID STRING(20)
+ */
+ public static final String id = "id";
+ /**
+ * STRING(20)
+ */
+ public static final String rent = "rent";
+ /**
+ * ѻ STRING(20)
+ */
+ public static final String irent = "irent";
+ /**
+ * Ѵ STRING(20)
+ */
+ public static final String caution_money = "caution_money";
+ /**
+ * ƻڴ STRING(20)
+ */
+ public static final String plan_date = "plan_date";
+ /**
+ * ͬid STRING(20)
+ */
+ public static final String contract_id = "contract_id";
+ /**
+ * STRING(20)
+ */
+ public static final String distributor_id = "distributor_id";
+ /**
+ * ĿID STRING(20)
+ */
+ public static final String project_id = "project_id";
+ /**
+ * ƻڴ STRING(20)
+ */
+ public static final String plan_list = "plan_list";
+ /**
+ * ҪĽ STRING(20)
+ */
+ public static final String need_caution_money = "need_caution_money";
+}
\ No newline at end of file
diff --git a/src_sql/dailyfix/tft_dailyfix.sql b/src_sql/dailyfix/tft_dailyfix.sql
index 649a4a919..1ad44b312 100644
--- a/src_sql/dailyfix/tft_dailyfix.sql
+++ b/src_sql/dailyfix/tft_dailyfix.sql
@@ -12,4 +12,15 @@ CREATE TABLE lc_card_tlsign_his (
PRIMARY KEY (ID)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;
-- ͨǩԼ֤ʽʷķ
-Insert Into Class_Method (classname,methodname,methodtype,methoddescribe,returntype,methodargs,methodcode,inputuser,inputorg,inputtime,updateuser,updatetime,remark) Values ('','ͨǩԼ״̬ʽʷ','Bizlet','ͨǩԼ״̬ʽʷ','String','String ObjectNo','com.tenwa.lease.flow.project.commbusiness.LcCardTlSignFormalToHisBusiness','','','','','','');
\ No newline at end of file
+Insert Into Class_Method (classname,methodname,methodtype,methoddescribe,returntype,methodargs,methodcode,inputuser,inputorg,inputtime,updateuser,updatetime,remark) Values ('','ͨǩԼ״̬ʽʷ','Bizlet','ͨǩԼ״̬ʽʷ','String','String ObjectNo','com.tenwa.lease.flow.project.commbusiness.LcCardTlSignFormalToHisBusiness','','','','','','');
+
+-- ӱ֤巴巽
+insert into `class_method` (`classname`, `methodname`, `methodtype`, `methoddescribe`, `returntype`, `methodargs`, `methodcode`, `inputuser`, `inputorg`, `inputtime`, `updateuser`, `updatetime`, `remark`) values('','֤巴','Bizlet','֤巴','String','String ObjectNo','com.tenwa.lease.flow.rent.rentreback.DepositRedOffset','','','','','','');
+
+-- ֤巴巽ӵű
+delete from FLOW_MODEL where FlowNo='RentRebackFlow' and PhaseNo='1000';
+insert into `FLOW_MODEL` (`flowno`, `phaseno`, `phasetype`, `phasename`, `phasedescribe`, `phaseattribute`, `prescript`, `initscript`, `choicedescribe`, `choicescript`, `actiondescribe`, `actionscript`, `postscript`, `attribute1`, `attribute2`, `attribute3`, `attribute4`, `attribute5`, `attribute6`, `attribute7`, `attribute8`, `attribute9`, `attribute10`, `aaenabled`, `aapointinitscript`, `aapointcomp`, `aapointcompurl`, `standardtime1`, `standardtime2`, `costlob`, `strips`, `checklist`, `decisionscript`, `riskscanrule`, `buttonset2`, `inputuser`, `inputtime`, `updateuser`, `updatetime`, `distributerule`, `id`, `type`, `name`, `xcoordinate`, `ycoordinate`, `width`, `height`, `version`, `swimlane`, `nodetype`, `flowphasecontext`, `OPINIONSREQUIRED`, `isreadonly`, `flowpageconfig`, `flowprocessclass`, `flowpagecheck`, `backstepnexttype`, `backsteps`, `backscript`, `deletescript`, `phasescript`, `loadproductcheck`, `nextsteps`, `flowtiptype`, `remindnoticttype`, `flowoverdate`, `overnoticetype`, `overnoticeUser`) values('RentRebackFlow','1000','1040','ͨ',NULL,NULL,'!.ʱʽ(#ObjectNo)+!.ʽ(#ObjectNo)+!.ƾ֤--ؿ(#ObjectNo)+!.֤巴(#ObjectNo)','{\"system\"}',NULL,'commroute',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'01',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'586','550','50','50','1',NULL,'END',NULL,NULL,'Y','RentRebackFlow0010',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+
+
+
+
diff --git a/src_sql/view/vi_bond_compensatory.sql b/src_sql/view/vi_bond_compensatory.sql
new file mode 100644
index 000000000..f86265f89
--- /dev/null
+++ b/src_sql/view/vi_bond_compensatory.sql
@@ -0,0 +1,28 @@
+create view vi_bond_compensatory as (
+select
+ lrp.ID AS id,
+ lrp.RENT AS rent,
+ IFNULL(lri.irent,0) AS irent,
+ IFNULL(ddi.CAUTION_MONEY,0) AS caution_money,
+ lrp.PLAN_DATE AS plan_date,
+ lrp.CONTRACT_ID AS contract_id,
+ lci.distributor_id AS distributor_id,
+ lci.PROJECT_ID AS project_id,
+ lrp.PLAN_LIST AS plan_list,
+ lrp.RENT-IFNULL(lri.irent,0)-IFNULL(ddi.CAUTION_MONEY,0) as need_caution_money
+from lb_contract_info lci
+ left join lc_rent_plan lrp
+ on lci.ID = lrp.CONTRACT_ID
+ left join (select
+ SUM(IFNULL(RENT,0)) AS irent,
+ PLAN_ID AS plan_id
+ from lc_rent_income
+ group by PLAN_ID) lri on lri.plan_id = lrp.ID
+ left join (select
+ RENT_PLAN_ID AS RENT_PLAN_ID,
+ SUM(IFNULL(CAUTION_MONEY,0)) AS CAUTION_MONEY
+ from d_depositreturn_info
+ where MONEY_TYPE = 'bondRepay'
+ group by RENT_PLAN_ID) ddi on ddi.RENT_PLAN_ID = lrp.ID
+where lci.BUSINESSTYPE = '1' and lci.CONTRACT_STATUS = '31' and (lrp.BATCH_STATUS<>'process' or lrp.BATCH_STATUS IS NULL) );
+
diff --git a/src_tenwa/com/tenwa/collectaudit/cache/CollectAuditInfoCache.java b/src_tenwa/com/tenwa/collectaudit/cache/CollectAuditInfoCache.java
index 1c8e46a2b..d040f522a 100644
--- a/src_tenwa/com/tenwa/collectaudit/cache/CollectAuditInfoCache.java
+++ b/src_tenwa/com/tenwa/collectaudit/cache/CollectAuditInfoCache.java
@@ -45,6 +45,7 @@ import jbo.com.tenwa.entity.comm.flow.D_DEPOSITRETURN_INFO;
import jbo.com.tenwa.lease.comm.LB_BUCKLE_LOG;
import jbo.com.tenwa.lease.comm.LB_CLEAR_FILE_RECORD;
import jbo.com.tenwa.lease.comm.LB_INTFACE_FILE_RECORD;
+import jbo.com.tenwa.lease.comm.VI_BOND_COMPENSATORY;
import jbo.com.tenwa.lease.comm.VI_LC_AUDIT_RENT_PLAN;
import jbo.loan.VI_RENT_COLLECT;
import jbo.sys.CODE_LIBRARY;
@@ -679,20 +680,22 @@ public class CollectAuditInfoCache {
public String afterCollectManageDistributor(JBOTransaction tx) throws Exception{
int i = 0,j = 0;
String[] ids = id.split("@");
- String[] penaltyArray = penaltys.split("@");
+ //String[] penaltyArray = penaltys.split("@");
String COMPENSATORY_CON=null;
- BizObjectManager bm = JBOFactory.getFactory().getManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME,tx);
+ BizObjectManager bm = JBOFactory.getFactory().getManager(VI_BOND_COMPENSATORY.CLASS_NAME,tx);
BizObjectManager bc = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME,tx);
BizObjectManager bd = JBOFactory.getFactory().getManager(D_DEPOSITRETURN_INFO.CLASS_NAME,tx);
BizObjectManager bdi = JBOFactory.getFactory().getManager(DISTRIBUTOR_INFO.CLASS_NAME,tx);
for(int c=0;c map = handcraftsingleCollectMoenyDistrbutor(tx,bc,bom,t_rent,penaltyArray[c]);
i++;
//ո״̬
- bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG,O.PENALTY=:PENALTY where O.id=:id")
+ bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG where O.id=:id")
.setParameter("COLLECT_STATUS", "")
.setParameter("COLLECT_MSG", "̱֤")
- .setParameter("PENALTY", penaltyArray[c])
+ //.setParameter("PENALTY", penaltyArray[c])
.setParameter("id", bom.getAttribute("id").toString()).executeUpdate();
//뾭̱֤˻ر
BizObject bobdi = bdi.createQuery("distributor_no=:distributor_id").setParameter("distributor_id", distributor_id).getSingleResult(false);
BigDecimal sum = new BigDecimal(bobdi.getAttribute("sums").getString());
- double account_balance = sum.subtract(new BigDecimal(t_rent)).doubleValue();
+ double account_balance = sum.subtract(t_rent).doubleValue();
BizObject bod = bd.newObject();
bod.setAttributeValue("DISTRIBUTOR_ID", distributor_id);
- bod.setAttributeValue("CAUTION_MONEY", t_rent);
+ bod.setAttributeValue("CAUTION_MONEY", t_rent.toString() );
bod.setAttributeValue("ACCOUNT_BALANCE", account_balance);
bod.setAttributeValue("MONEY_TYPE","bondRepay");
bod.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
diff --git a/src_tenwa/com/tenwa/lease/app/quartzmession/DistributorMarginCompensation.java b/src_tenwa/com/tenwa/lease/app/quartzmession/DistributorMarginCompensation.java
index 1430951c4..c62d2e0a2 100644
--- a/src_tenwa/com/tenwa/lease/app/quartzmession/DistributorMarginCompensation.java
+++ b/src_tenwa/com/tenwa/lease/app/quartzmession/DistributorMarginCompensation.java
@@ -20,6 +20,7 @@ import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.flow.action.comm.SelectBalance;
import jbo.com.tenwa.lease.carbrand.lb_automatic_compensatory;
+import jbo.com.tenwa.lease.comm.VI_BOND_COMPENSATORY;
import jbo.com.tenwa.lease.comm.VI_LC_AUDIT_RENT_PLAN;
public class DistributorMarginCompensation implements Job {
@@ -61,24 +62,24 @@ public class DistributorMarginCompensation implements Job {
Date dt_add = cal.getTime();
String repay_date = sdf.format(dt_add);
System.out.println("ƻΪ"+repay_date+"֮ǰƻ");
-
- List bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery(" select id,penalty,rent from O left join jbo.app.tenwa.calc.LC_FUND_RENT_ADJUST_TEMP lfrat on lfrat.payment_number=O.payment_number where O.COLLECT_STATUS IN ('δտ', 'տ') and O.rent>0 and O.PLAN_DATE <= '"+repay_date+"' and ( O.BATCH_STATUS<>'process' or o.BATCH_STATUS IS NULL ) and lfrat.id is null and O.DISTRIBUTOR_ID='"+distributor_no+"' and not exists ( select 1 from jbo.com.tenwa.entity.comm.flow.D_DEPOSITRETURN_INFO ddi where ddi.RENT_PLAN_ID=O.id)").getResultList(false);
+ //VI_BOND_COMPENSATORYרžѯݱеĽȥУûнȻˡʱждͻ壬ܵºȴ
+ List bos = JBOFactory.getBizObjectManager(VI_BOND_COMPENSATORY.CLASS_NAME, tx).createQuery(" select id,need_caution_money from O where O.need_caution_money > 0 and O.plan_date <= '"+repay_date+"' and O.distributor_id='"+distributor_no+"' and not exists (select 1 from jbo.app.tenwa.calc.LC_FUND_RENT_ADJUST_TEMP lfrat where lfrat.contract_id=O.contract_id) ").getResultList(false);
if(bos.size()==0){
System.out.println("̣"+distributor_no+"ûпԺ");
continue;
}
String ids = "";
double rent = 0;
- String penaltys = "";
+ //String penaltys = "";
for(int i=0;i lrits = lriTemp.createQuery("select plan_id,rent from O where flowunid=:flowunid group by plan_id").setParameter("flowunid", flowUnid).getResultList(false);
+ if(lrits.size()>0){
+ BizObjectManager ddiMange = JBOFactory.getFactory().getManager(D_DEPOSITCHARGE_INFO.CLASS_NAME , Sqlca);
+ BizObjectManager diManage = JBOFactory.getFactory().getManager(DISTRIBUTOR_INFO.CLASS_NAME, Sqlca);
+ BizObjectManager bc = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME,Sqlca);
+ for(BizObject lrit:lrits){
+ //ѯڴǷ
+ BizObject boDRI=JBOFactory.createBizObjectQuery(D_DEPOSITRETURN_INFO.CLASS_NAME,"RENT_PLAN_ID=:rentPlanId").setParameter("rentPlanId", lrit.getAttribute("plan_id").getString()).getSingleResult(false);
+ if(boDRI!=null&&boDRI.getAttribute("CAUTION_MONEY")!=null){
+ String planId = lrit.getAttribute("plan_id").getString();
+ BigDecimal rent = new BigDecimal(lrit.getAttribute("rent").getString());
+ //ѯºǷڱ֤
+ BizObject ddi = ddiMange.createQuery(" rent_plan_id=:planId and CAUTION_MONEY=:rent and MONEY_TYPE='bondBack' ").setParameter("planId", planId).setParameter("rent", rent.abs().toString()).getSingleResult(false);
+ if(ddi != null){
+ //D_DEPOSITCHARGE_INFO
+ BizObject bDCI_N = ddiMange.newObject();
+ String distributorId = boDRI.getAttribute("DISTRIBUTOR_ID").toString();
+ bDCI_N.setAttributeValue("DISTRIBUTOR_ID", distributorId);
+ bDCI_N.setAttributeValue("CAUTION_MONEY", rent.toString());
+ bDCI_N.setAttributeValue("MONEY_TYPE","bondBack");
+ bDCI_N.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
+ bDCI_N.setAttributeValue("INPUTUSERID",(String)this.getAttribute("CurUserID"));
+ bDCI_N.setAttributeValue("INPUTORGID",(String)this.getAttribute("ObjectNo"));
+ bDCI_N.setAttributeValue("RENT_PLAN_ID",lrit.getAttribute("plan_id").getString());
+ ddiMange.saveObject(bDCI_N);
+ //Ӧƻе״̬Ϊ
+ bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS where O.id=:id")
+ .setParameter("COLLECT_STATUS", "").setParameter("id", planId ).executeUpdate();
+ //ľϢĽ
+ BizObject bDI = diManage.createQuery("distributor_no=:distributor_id").setParameter("distributor_id", distributorId).getSingleResult(true);
+ String sum = new BigDecimal(bDI.getAttribute("sums").getString()).add(rent).toString();
+ bDI.setAttributeValue("sums", sum);
+ diManage.saveObject(bDI);
+ }
+ }
+ }
+ }
+ return "true";
+ }
+}