1.经销商代偿红冲
This commit is contained in:
parent
d4665368be
commit
cf9e52d13e
@ -12,7 +12,7 @@
|
||||
// doTemp.setJboWhere(" O.AUDIT_STATE = 'N'");
|
||||
//默认预查询
|
||||
//只有计划日期未收款的都可以收款
|
||||
doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE <= '"+plan_date+"' and O.COLLECT_STATUS in ('未收款','部分收款')");
|
||||
doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE <= '"+plan_date+"' and O.COLLECT_STATUS in ('未收款','部分收款','代偿')");
|
||||
// doTemp.setJboWhereWhenNoFilter(" and O.COLLECT_STATUS in ('未收款','部分收款') ");
|
||||
// doTemp.setJboWhere("O.PLAN_DATE <= '"+plan_date+"'");
|
||||
|
||||
|
||||
@ -708,6 +708,7 @@
|
||||
<attribute name="ACCOUNT_INFO" label="账户信息" type="STRING" length="32"/>
|
||||
<attribute name="ACCOUNT" label="账户名称" type="STRING" length="32"/>
|
||||
<attribute name="DISTRIBUTOR_ACCOUNT_TEMP" label="经销商名称" type="STRING" length="32"/>
|
||||
<attribute name="RENT_PLAN_ID" label="租金计划ID" type="STRING" length="32"/>
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
@ -766,6 +767,9 @@
|
||||
<attribute name="LOCAL_BANK" label="本方银行" type="STRING" length="100"/>
|
||||
<attribute name="ACCOUNT_BALANCE" label="账户余额" type="DOUBLE" length="22" scale="2"/>
|
||||
<attribute name="refund_number" label="退款账号" type="STRING" length="32"/>
|
||||
<attribute name="CONTRACT_ID" label="合同ID" type="STRING" length="32"/>
|
||||
<attribute name="PLAN_LIST" label="期次" type="STRING" length="32"/>
|
||||
<attribute name="RENT_PLAN_ID" label="租金计划ID" type="STRING" length="32"/>
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
|
||||
@ -15,6 +15,7 @@ import org.springframework.jdbc.object.SqlCall;
|
||||
import jbo.app.tenwa.calc.LC_RENT_PLAN;
|
||||
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT;
|
||||
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
|
||||
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITCHARGE_INFO;
|
||||
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;
|
||||
@ -49,7 +50,39 @@ public class CollectAuditInfoCache {
|
||||
private String clearDate;
|
||||
private String distributor_id;
|
||||
private String penaltys;
|
||||
|
||||
|
||||
/**
|
||||
* 经销商保证金代偿后红冲
|
||||
* 租金计划表ID,在保证金收取表中为depositcharge_id,在退回表中为RENT_PLAN_ID
|
||||
* @param depositcharge_id,tx
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public void writeBackDistributor(String RENT_PLAN_ID,JBOTransaction tx) throws JBOException{
|
||||
BizObjectManager bmDCI = JBOFactory.getFactory().getManager(D_DEPOSITCHARGE_INFO.CLASS_NAME);
|
||||
BizObjectManager bmDRI = JBOFactory.getFactory().getManager(D_DEPOSITRETURN_INFO.CLASS_NAME);
|
||||
BizObjectManager bmDI = JBOFactory.getFactory().getManager(DISTRIBUTOR_INFO.CLASS_NAME);
|
||||
BizObject bDRI= bmDRI.createQuery("RENT_PLAN_ID=:RENT_PLAN_ID").setParameter("RENT_PLAN_ID", RENT_PLAN_ID).getSingleResult(false);
|
||||
String distributorId = bDRI.getAttribute("DISTRIBUTOR_ID").toString();
|
||||
String cautionMoney = bDRI.getAttribute("CAUTION_MONEY").toString();
|
||||
//D_DEPOSITCHARGE_INFO插入新数据
|
||||
BizObject bDCI_N = bmDCI.newObject();
|
||||
bDCI_N.setAttributeValue("DISTRIBUTOR_ID", distributorId);
|
||||
bDCI_N.setAttributeValue("CAUTION_MONEY", cautionMoney);
|
||||
bDCI_N.setAttributeValue("MONEY_TYPE","bondBack");
|
||||
bDCI_N.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
|
||||
bDCI_N.setAttributeValue("INPUTUSERID",inputuserid);
|
||||
bDCI_N.setAttributeValue("INPUTORGID",inputorgid);
|
||||
bDCI_N.setAttributeValue("RENT_PLAN_ID",RENT_PLAN_ID);
|
||||
bmDCI.saveObject(bDCI_N);
|
||||
//修改经销商信息表里的金额
|
||||
BizObject bDI = bmDI.createQuery("distributor_no=:distributor_id").setParameter("distributor_id", distributorId).getSingleResult(false);
|
||||
BigDecimal sum = new BigDecimal(bDI.getAttribute("sums").getString());
|
||||
double account_balance = sum.add(new BigDecimal(cautionMoney)).doubleValue();
|
||||
bmDI.createQuery("update O set O.sums='"+account_balance+"' where O.distributor_no=:distributor_id").setParameter("distributor_id", distributorId).executeUpdate();
|
||||
System.out.println("红冲成功");
|
||||
}
|
||||
|
||||
//获取存盘文件
|
||||
public static String getCollectIntface(String id) throws Exception{
|
||||
|
||||
@ -562,10 +595,10 @@ public class CollectAuditInfoCache {
|
||||
batch_number += ";手工付款金额:"+rent;
|
||||
}*/
|
||||
//更新收付状态
|
||||
bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG 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", map.get("ERR_MSG"))
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();*/
|
||||
map.put("RET_CODE", "0000");
|
||||
return map;
|
||||
}
|
||||
@ -588,7 +621,7 @@ public class CollectAuditInfoCache {
|
||||
}
|
||||
BizObjectManager bm = JBOFactory.getFactory().getManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME);
|
||||
BizObjectManager bc = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME);
|
||||
List<BizObject> bolist = bm.createQuery("select distinct O.contract_id,O.plan_date,O.id,ca.ACC_NUMBER,ca.ACCOUNT,O.rent from O , jbo.app.tenwa.customer.CUSTOMER_ACCOUNT ca where O.contract_id=ca.contract_id and ca.acc_type = 'Debit' and O.id in ("+parms.toString()+")").getResultList(false);
|
||||
List<BizObject> bolist = bm.createQuery("select distinct O.contract_id,O.id,O.plan_date,O.id,ca.ACC_NUMBER,ca.ACCOUNT,O.rent from O , jbo.app.tenwa.customer.CUSTOMER_ACCOUNT ca where O.contract_id=ca.contract_id and ca.acc_type = 'Debit' and O.id in ("+parms.toString()+")").getResultList(false);
|
||||
for (BizObject bo : bolist) {
|
||||
Map<String, String> map = handcraftsingleCollectMoeny(tx,bc,bo,bo.getAttribute("rent").toString(),"1");
|
||||
i++;
|
||||
@ -597,6 +630,7 @@ public class CollectAuditInfoCache {
|
||||
.setParameter("COLLECT_STATUS", "手工收款")
|
||||
.setParameter("COLLECT_MSG", "手工扣款")
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
this.writeBackDistributor(bo.getAttribute("id").toString(), tx);
|
||||
|
||||
}
|
||||
|
||||
@ -619,10 +653,11 @@ public class CollectAuditInfoCache {
|
||||
BizObjectManager bdi = JBOFactory.getFactory().getManager(DISTRIBUTOR_INFO.CLASS_NAME);
|
||||
|
||||
for(int c=0;c<ids.length;c++){
|
||||
BizObject bom = bm.createQuery("select distinct O.contract_id,O.plan_date,O.id,ca.ACC_NUMBER,ca.ACCOUNT,O.rent from O , jbo.app.tenwa.customer.CUSTOMER_ACCOUNT ca where O.contract_id=ca.contract_id and ca.acc_type = 'Debit' and O.id ='"+ids[c]+"'").getSingleResult(false);
|
||||
BizObject bom = bm.createQuery("select distinct O.contract_id,O.plan_list,O.plan_date,O.id,ca.ACC_NUMBER,ca.ACCOUNT,O.rent from O , jbo.app.tenwa.customer.CUSTOMER_ACCOUNT ca where O.contract_id=ca.contract_id and ca.acc_type = 'Debit' and O.id ='"+ids[c]+"'").getSingleResult(false);
|
||||
String rent = bom.getAttribute("rent").toString();
|
||||
//handcraftsingleCollectMoeny方法的最后一个参数原为hire_list,现改为客户输入核销罚息参数(周亚辉)
|
||||
Map<String, String> map = handcraftsingleCollectMoenyDistrbutor(tx,bc,bom,rent,penaltyArray[c]);
|
||||
//代偿不再往租金实收表插入数据
|
||||
// Map<String, String> map = handcraftsingleCollectMoenyDistrbutor(tx,bc,bom,rent,penaltyArray[c]);
|
||||
i++;
|
||||
//更新收付状态
|
||||
bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG where O.id=:id")
|
||||
@ -641,6 +676,9 @@ public class CollectAuditInfoCache {
|
||||
bod.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
|
||||
bod.setAttributeValue("INPUTUSERID",inputuserid);
|
||||
bod.setAttributeValue("INPUTORGID",inputorgid);
|
||||
bod.setAttributeValue("CONTRACT_ID",bom.getAttribute("contract_id").toString());
|
||||
bod.setAttributeValue("PLAN_LIST",bom.getAttribute("plan_list").toString());
|
||||
bod.setAttributeValue("RENT_PLAN_ID",bom.getAttribute("id").toString());
|
||||
bd.saveObject(bod);
|
||||
//修改经销商信息表里的金额
|
||||
bdi.createQuery("update O set O.sums='"+account_balance+"' where O.distributor_no=:distributor_id").setParameter("distributor_id", distributor_id).executeUpdate();
|
||||
@ -787,6 +825,13 @@ public class CollectAuditInfoCache {
|
||||
}
|
||||
String[] snArray = sn.split(",");
|
||||
int n = 0;//拆分租金,扣款成功记录
|
||||
BizObject bolrp = bc.createQuery("O.id=:id").setParameter("id", bo.getAttribute("id").toString()).getSingleResult(false);
|
||||
String collectStatus = "未收款";
|
||||
String collectStatusPart = "部分收款";
|
||||
if(bolrp.getAttribute("COLLECT_STATUS")!=null){
|
||||
collectStatus = bolrp.getAttribute("COLLECT_STATUS").toString();
|
||||
collectStatusPart = bolrp.getAttribute("COLLECT_STATUS").toString();
|
||||
}
|
||||
for (int i = 1; i <= snArray.length; i++) {
|
||||
Map<String, String> map = querySingleBatchCollect(tx, bo, query_sn, snArray[(i-1)]);
|
||||
if (snArray.length == 1) {
|
||||
@ -798,6 +843,7 @@ public class CollectAuditInfoCache {
|
||||
.setParameter("COLLECT_MSG", "批量代收,收款成功")
|
||||
.setParameter("BATCH_STATUS", "complete")//更新批量处理状态-完成
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
this.writeBackDistributor(id,tx);
|
||||
bo.setAttributeValue("COLLECT_STATUS", "批量收款");
|
||||
bo.setAttributeValue("COLLECT_MSG", "批量代收,收款成功");
|
||||
bo.setAttributeValue("BATCH_STATUS", "complete");
|
||||
@ -813,7 +859,7 @@ public class CollectAuditInfoCache {
|
||||
}else{
|
||||
//更新收付状态
|
||||
bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG,O.BATCH_STATUS=:BATCH_STATUS,O.BATCH_NO='',O.BATCH_SN='' where O.id=:id")
|
||||
.setParameter("COLLECT_STATUS", "δÊÕ¿î")
|
||||
.setParameter("COLLECT_STATUS", collectStatus)
|
||||
.setParameter("COLLECT_MSG", map.get("ERR_MSG"))
|
||||
.setParameter("BATCH_STATUS", "")//清空批量处理状态
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
@ -834,6 +880,7 @@ public class CollectAuditInfoCache {
|
||||
.setParameter("COLLECT_MSG", "批量代收,收款成功")
|
||||
.setParameter("BATCH_STATUS", "complete")//更新批量处理状态-完成
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
this.writeBackDistributor(id,tx);
|
||||
bo.setAttributeValue("COLLECT_STATUS", "批量收款");
|
||||
bo.setAttributeValue("COLLECT_MSG", "批量代收,收款成功");
|
||||
bo.setAttributeValue("BATCH_STATUS", "complete");
|
||||
@ -842,7 +889,7 @@ public class CollectAuditInfoCache {
|
||||
}else{
|
||||
//更新收付状态
|
||||
bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG,O.BATCH_STATUS=:BATCH_STATUS where O.id=:id")
|
||||
.setParameter("COLLECT_STATUS", "²¿·ÖÊÕ¿î")
|
||||
.setParameter("COLLECT_STATUS", collectStatusPart)
|
||||
.setParameter("COLLECT_MSG", map.get("ERR_MSG"))
|
||||
.setParameter("BATCH_STATUS", "complete")//清空批量处理状态-完成
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
@ -862,7 +909,7 @@ public class CollectAuditInfoCache {
|
||||
if (i == snArray.length && n == 0) {
|
||||
//更新收付状态
|
||||
bc.createQuery("update O set O.COLLECT_STATUS=:COLLECT_STATUS ,O.COLLECT_MSG=:COLLECT_MSG,O.BATCH_STATUS=:BATCH_STATUS,O.BATCH_NO='',O.BATCH_SN='' where O.id=:id")
|
||||
.setParameter("COLLECT_STATUS", "δÊÕ¿î")
|
||||
.setParameter("COLLECT_STATUS", collectStatus)
|
||||
.setParameter("COLLECT_MSG", map.get("ERR_MSG"))
|
||||
.setParameter("BATCH_STATUS", "")//清空批量处理状态
|
||||
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
|
||||
|
||||
@ -34,7 +34,7 @@ public class AutoBuckle implements Job {
|
||||
//
|
||||
tx = JBOFactory.createJBOTransaction();
|
||||
//and (O.rent<>'' or O.rent<>'0' or O.rent<>'0.0')
|
||||
List<BizObject> bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款') and O.PLAN_DATE <= '"+plan_date+"' and ( O.BATCH_STATUS<>'process' or o.BATCH_STATUS IS NULL ) ").getResultList(true);
|
||||
List<BizObject> bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款','代偿') and O.PLAN_DATE <= '"+plan_date+"' and ( O.BATCH_STATUS<>'process' or o.BATCH_STATUS IS NULL ) ").getResultList(true);
|
||||
StringBuffer ids = new StringBuffer();
|
||||
if(bos.size()>0){
|
||||
for (BizObject bo : bos) {
|
||||
@ -46,7 +46,6 @@ public class AutoBuckle implements Job {
|
||||
ca.setInputuserid(jboName.getUserId(arg0, tx));
|
||||
ca.setInputorgid("system");
|
||||
ca.batchCollectManage(tx);
|
||||
//tx = JBOFactory.createJBOTransaction();
|
||||
ca.queryBatchCollectStatus(tx);
|
||||
}
|
||||
QuartzUtil.insertLog(plan_date,"com.tenwa.lease.app.quartzmession.AutoBuckle", "success", "³É¹¦", curUserId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user