1.经销商代偿增加核销罚息

This commit is contained in:
zhangbb 2019-06-05 16:03:51 +08:00
parent eb111a4fe3
commit e1c3118237
2 changed files with 113 additions and 19 deletions

View File

@ -8,7 +8,7 @@
*/
String plan_date = DateAssistant.getToday();
ASObjectModel doTemp = new ASObjectModel("ViLcReviewAuditRentPlanList");
ASObjectModel doTemp = new ASObjectModel("ViLcReviewAuditRentPlanListRepay");
// doTemp.setJboWhere(" O.AUDIT_STATE = 'N'");
//默认预查询
//只有计划日期未收款的都可以收款
@ -19,7 +19,7 @@
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.MultiSelect = true; //多选
dwTemp.ReadOnly = "1"; //Ö»¶Áģʽ
dwTemp.ReadOnly = "0"; //只读模式
dwTemp.ShowSummary = "1"; //显示小计
dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize));
dwTemp.genHTMLObjectWindow("");
@ -37,6 +37,7 @@
window.onload=function(){
initFilter();
setItemReadOnly(0, 0, "penalty_0", false);
}
function initFilter(){
@ -144,6 +145,8 @@
if(confirm('确实要执行经销商保证金代偿操作吗?')){
var sParm = getItemValueArray(0, "id");
var sParm_rent = getItemValueArray(0, "rent");
var penalty = getItemValueArray(0, "penalty");
var sParm_penalty = getItemValueArray(0, "penalty_0");
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{
alert("请至少选择一条记录!");
@ -156,6 +159,13 @@
return;
}
}
debugger;
for(var i=0;i<sParm.length;i++){
if(Number(sParm_penalty[i])>Number(penalty[i])){
alert("核销罚息不能大于罚息金额!");
return;
}
}
// var dis = distributorIds.join("@");
//暂时只能选一个经销商,以后如果有多个经销商需求再打开下面代码
/* var distributorArray = [];
@ -167,14 +177,18 @@
for(var i=0;i<distributorArray.length;i++){
var DISTRIBUTOR_ID = distributorArray[i];
} */
var ids = "";
for(var i = 0;i < sParm.length; i++){
var ids = sParm.join("@");
var penaltys = sParm_penalty.join("@");
//简化为上面形式
/* for(var i = 0;i < sParm.length; i++){
if(ids.length == 0){
ids += sParm[i] +"@";
penaltys += sParm_penalty[i];
}else{
ids += sParm[i] +"@";
penaltys += "@"+sParm_penalty[i];
}
}
} */
//扣款前提校验
var result = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "checkRentIsIncome", "id="+ids);
@ -196,7 +210,7 @@
return;
}
//核销
var parm = "id="+ids+",inputuserid="+"<%=CurUser.getUserID()%>"+",inputorgid="+"<%=CurUser.getOrgID()%>"+",distributor_id="+distributor_id;
var parm = "id="+ids+",inputuserid="+"<%=CurUser.getUserID()%>"+",inputorgid="+"<%=CurUser.getOrgID()%>"+",distributor_id="+distributor_id+",penaltys="+penaltys;
var res = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "afterCollectManageDistributor", parm);
alert(res);
//location.reload(); IE浏览器用这个方法报错

View File

@ -48,6 +48,7 @@ public class CollectAuditInfoCache {
private String inputorgid;
private String clearDate;
private String distributor_id;
private String penaltys;
//获取存盘文件
public static String getCollectIntface(String id) throws Exception{
@ -476,6 +477,83 @@ public class CollectAuditInfoCache {
/*BizObject bco = bc.createQuery("id=:id").setParameter("id", bo.getAttribute("id").toString()).getSingleResult(false);
String batch_number = bco.getAttribute("BATCH_NO").toString();
if (batch_number.length() == 0) {
batch_number += "手工付款金额:"+rent;
}else{
batch_number += ";手工付款金额:"+rent;
}*/
//更新收付状态
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();
map.put("RET_CODE", "0000");
return map;
}
/**
* 手动回笼租金
* @param tx
* @param bc
* @param bo
* @param rent
* @return
* @throws JBOException
* @throws SQLException
* @throws Exception
*/
public Map<String, String> handcraftsingleCollectMoenyDistrbutor(JBOTransaction tx,BizObjectManager bc,BizObject bo,String rent,String hire_list) throws JBOException, SQLException {
String cerrentDate = DateAssistant.getToday();//获取当前日期,格式为:yyyy/MM/dd
Map<String, String> map = new HashMap<String, String>();
//改为存储过程实现
/*JBOTransaction transaction = JBOFactory.createJBOTransaction();
BizObjectManager bmi = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME,transaction);
BizObject boi = bmi.createQuery("select v.replace(v.uuid(),'-','') as v.id,O.QUOT_ID as v.QUOT_ID,O.CUST_ID as v.CUST_ID,O.PROJECT_ID as v.PROJECT_ID,O.PROJECT_PLAN_NUMBER as v.PROJECT_PLAN_NUMBER,"
+ "O.CONTRACT_ID as v.CONTRACT_ID,O.CONTRACT_PLAN_NUMBER as v.CONTRACT_PLAN_NUMBER,O.PAYMENT_NUMBER as v.PAYMENT_NUMBER,'' as v.EBANK_NUMBER,O.id as v.PLAN_ID,O.PLAN_LIST as v.PLAN_LIST,"
+ "'0' as v.INTEREST_ADJUST,'settlemethod6' as v.SETTLE_METHOD,'"+hire_list+"' as v.HIRE_LIST,'"+cerrentDate+"' as v.HIRE_DATE,vl.rent_over as v.RENT,vl.corpus_over as v.CORPUS,vl.interest_over as v.INTEREST,("+rent+"-vl.corpus_over-vl.interest_over) as v.PENALTY,"
+ "'0' as v.CORPUS_ADJUST,'0' as v.PENALTY_ADJUST,'0' as v.ROLL_BACK,O.COIN as v.COIN from O, jbo.app.tenwa.calc.VI_LC_RENT_PLAN vl where O.id = vl.id"
+ " and vl.contract_id =:contract_id and vl.plan_date =:plan_date")
.setParameter("contract_id", bo.getAttribute("contract_id").toString())
.setParameter("plan_date", bo.getAttribute("plan_date").toString()).getSingleResult(false);
if (boi != null) {
//插入数据
String sql = "insert into LC_RENT_INCOME (ID, QUOT_ID, CUST_ID, PROJECT_ID, PROJECT_PLAN_NUMBER, CONTRACT_ID, CONTRACT_PLAN_NUMBER, PAYMENT_NUMBER,EBANK_NUMBER,PLAN_ID, PLAN_LIST,"
+ " INTEREST_ADJUST,SETTLE_METHOD,HIRE_LIST,HIRE_DATE, RENT,CORPUS,INTEREST,PENALTY,CORPUS_ADJUST,PENALTY_ADJUST,ROLL_BACK,COIN)"
+ "values ('"+boi.getAttribute("id")+"','"+boi.getAttribute("QUOT_ID")+"','"+boi.getAttribute("CUST_ID")+"','"+boi.getAttribute("PROJECT_ID")+"','"+boi.getAttribute("PROJECT_PLAN_NUMBER")+"',"
+ "'"+boi.getAttribute("CONTRACT_ID")+"','"+boi.getAttribute("CONTRACT_PLAN_NUMBER")+"','"+boi.getAttribute("PAYMENT_NUMBER")+"','"+boi.getAttribute("EBANK_NUMBER")+"','"+boi.getAttribute("PLAN_ID")+"',"
+ "'"+boi.getAttribute("PLAN_LIST")+"','"+boi.getAttribute("INTEREST_ADJUST")+"','"+boi.getAttribute("SETTLE_METHOD")+"','"+boi.getAttribute("HIRE_LIST")+"','"+boi.getAttribute("HIRE_DATE")+"','"+boi.getAttribute("RENT")+"','"+boi.getAttribute("CORPUS")+"',"
+ "'"+boi.getAttribute("INTEREST")+"','"+boi.getAttribute("PENALTY")+"','"+boi.getAttribute("CORPUS_ADJUST")+"','"+boi.getAttribute("PENALTY_ADJUST")+"','"+boi.getAttribute("ROLL_BACK")+"','"+boi.getAttribute("COIN")+"')";
Transaction Sqlca =null;
Sqlca = Transaction.createTransaction(transaction);
SqlObject asql = new SqlObject(sql);
Sqlca.executeSQL(asql);
Sqlca.commit();
}
transaction.commit();*/
Transaction Sqlca =null;
ASResultSet rs = null;
try {
Sqlca = Transaction.createTransaction(tx);
String ln_contract_id = bo.getAttribute("contract_id").toString();
String ln_plan_date = bo.getAttribute("plan_date").toString();
String in_rent = rent;
String in_hire_list = hire_list;
String in_type = "3";
String SQL="{call proc_insert_hexiao('"+ln_contract_id+"','"+ln_plan_date+"','"+in_rent+"','"+in_hire_list+"','"+in_type+"')} ";
SqlObject asql = new SqlObject(SQL);
rs = Sqlca.getASResultSet(asql);
} catch (Exception e) {
e.printStackTrace();
}finally{
if(rs != null) rs.close();
if(Sqlca!=null)Sqlca.commit();
}
/*BizObject bco = bc.createQuery("id=:id").setParameter("id", bo.getAttribute("id").toString()).getSingleResult(false);
String batch_number = bco.getAttribute("BATCH_NO").toString();
if (batch_number.length() == 0) {
@ -533,28 +611,24 @@ public class CollectAuditInfoCache {
public String afterCollectManageDistributor(JBOTransaction tx) throws Exception{
int i = 0,j = 0;
String[] ids = id.split("@");
StringBuffer parms = new StringBuffer();
for (String str : ids) {
if (parms.length()==0) {
parms.append("'"+str+"'");
}else{
parms.append(",'"+str+"'");
}
}
String[] penaltyArray = penaltys.split("@");
BizObjectManager bm = JBOFactory.getFactory().getManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME);
BizObjectManager bc = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME);
BizObjectManager bd = JBOFactory.getFactory().getManager(D_DEPOSITRETURN_INFO.CLASS_NAME);
BizObjectManager bdi = JBOFactory.getFactory().getManager(DISTRIBUTOR_INFO.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);
for (BizObject bo : bolist) {
String rent = bo.getAttribute("rent").toString();
Map<String, String> map = handcraftsingleCollectMoeny(tx,bc,bo,rent,"1");
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);
String rent = bom.getAttribute("rent").toString();
//handcraftsingleCollectMoeny方法的最后一个参数原为hire_list现改为客户输入核销罚息参数周亚辉
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")
.setParameter("COLLECT_STATUS", "经销商代偿")
.setParameter("COLLECT_MSG", "经销商保证金代偿")
.setParameter("id", bo.getAttribute("id").toString()).executeUpdate();
.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());
@ -1611,6 +1685,12 @@ public class CollectAuditInfoCache {
public void setDistributor_id(String distributor_id) {
this.distributor_id = distributor_id;
}
public String getPenaltys() {
return penaltys;
}
public void setPenaltys(String penaltys) {
this.penaltys = penaltys;
}
}