通联bug修改

This commit is contained in:
zhangbb 2020-10-29 13:57:26 +08:00
parent 688c5ee212
commit 1c71cc0562
3 changed files with 99 additions and 87 deletions

View File

@ -29,6 +29,7 @@
// //{"true","All","Button","实时扣款","实时扣款","timelyCollect()","","","","btn_icon_add",""},
// {"true","All","Button","手工核销","手工扣款","afterCollectManage()","","","","btn_icon_add",""},
{"true","All","Button","手动刷新","手动刷新","queryBatchCollect()","","","","btn_icon_add",""},
{"true","All","Button","通联刷新","手动刷新","TLquery()","","","","btn_icon_add",""},
// //{"true","","Button","退回","审核未通过,退回初审","if(confirm('确定要退回吗?')){viewAndEdit()}","","","","btn_icon_detail",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
@ -186,12 +187,18 @@
var res = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCacheTj", "queryBatchCollectStatus",parm);
console.log(res);
}else{
alert("查询到对应的主体方法!");
alert("查询到对应的主体方法!");
}
// reloadSelf();
location.reload();
}
}
function TLquery(){
debugger;
var resTL = RunJavaMethod("com.tenwa.lease.app.allinpay.service.impl.AllinpayPaymentDo", "queryCollectResult","");
console.log(resTL);
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -102,7 +102,10 @@ public class AllinpayPaymentDo {
AllinpayPaymentRun run = new AllinpayPaymentRun(list);
new Thread(run).start();
}
public void queryCollectResult(){
AllinpayPaymentQueryRun run = new AllinpayPaymentQueryRun();
new Thread(run).start();
}
public String getId() {
return id;
}

View File

@ -5,6 +5,7 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
@ -100,87 +101,6 @@ public class AllinpayPaymentQueryRun implements Runnable{
mapXml.put("quertSn", quertSn);
sqlMap = sendMessageByProxy(mapXml, sqlMap);
Transaction Sqlca =null;
ASResultSet rs = null;
Sqlca = Transaction.createTransaction("als");
JBOTransaction tx = Sqlca.getTransaction();
BizObjectManager bomLRP = JBOFactory.getBizObjectManager("jbo.app.tenwa.calc.LC_RENT_PLAN",tx);
boolean partFlag = false;
String plan_id = boLCP.getAttribute("UUID").toString();
String sn = "";
String finishAmount= "0.00";
if(plan_id.indexOf("-")!=-1){
plan_id = plan_id.substring(0, plan_id.indexOf("-"));
sn = plan_id.substring(plan_id.length()-3);
partFlag = true;
}
BizObject boLRP = bomLRP.createQuery("id=:id").setParameter("id", plan_id).getSingleResult(true);
String batchStatus = boLRP.getAttribute("batch_status")==null?"":boLRP.getAttribute("batch_status").toString();
String collectStatus = boLRP.getAttribute("batch_status")==null?"":boLRP.getAttribute("collect_status").toString();
String collectMsg = boLRP.getAttribute("batch_status")==null?"":boLRP.getAttribute("collect_msg").toString();
boolean status = false;
if("处理成功".equals(sqlMap.get("STATUS"))){
//添加实收表的插入
finishAmount = sqlMap.get("FINISH_AMOUNT");
try {
String ln_contract_id = boLRP.getAttribute("contract_id").toString();
String ln_plan_date = boLRP.getAttribute("plan_date").toString();
String in_rent = sqlMap.get("FINISH_AMOUNT");
String in_hire_list = boLRP.getAttribute("plan_list").toString();
String in_type = "2";
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();
}
// 代偿红冲处理
CollectAuditInfoCache caic = new CollectAuditInfoCache();
caic.writeBackDistributor(plan_id, finishAmount, Sqlca);
//租金计划表状态处理
if(partFlag){
BizObjectManager bomVRC = JBOFactory.getBizObjectManager("jbo.loan.VI_RENT_COLLECT",tx);
BizObject vrc = bomVRC.createQuery("id=:id").setParameter("id", plan_id).getSingleResult(false);
double rentOver = vrc.getAttribute("rent_over").getDouble();
double penaltyOver = vrc.getAttribute("penalty_over").getDouble();
if(rentOver>0 || penaltyOver>0){
batchStatus = "complete";
collectStatus = "部分收款";
collectMsg = "通联收款";
}
}else{
batchStatus = "complete";
collectStatus = "批量收款";
collectMsg = "批量收款,通联收款";
}
}else{
String retStatus = sqlMap.get("RET_STATUS");
//扣款失败
if("5000".equals(retStatus)){
batchStatus = "complete";
collectMsg = sqlMap.get("STATUS");
//银行正在处理中
}else if("1000".equals(retStatus)){
status = true;
}
}
//保存状态到日志表
if(!status){
boLRP.setAttributeValue("batch_status", batchStatus);
boLRP.setAttributeValue("collect_status", collectStatus);
boLRP.setAttributeValue("collect_msg", collectMsg);
bomLRP.saveObject(boLRP);
saveBuckle(boLRP,tx,sn,finishAmount);
}
if (localFilePath == null) {
LocalDateTime ldt = LocalDateTime.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMdd");
@ -272,7 +192,6 @@ public class AllinpayPaymentQueryRun implements Runnable{
AipgRsp rsp = XmlParser.parseRsp(responseContent);
InfoRsp infoRsp = rsp.getINFO();
if ("|0000|4000|".indexOf(infoRsp.getRET_CODE()) > 0) {
sqlMap.put("RET_STATUS", "0000");
QTransRsp ret = (QTransRsp) rsp.trxObj();
List<QTDetail> list = ret.getDetails();
for (QTDetail qtDetail : list) {
@ -300,7 +219,6 @@ public class AllinpayPaymentQueryRun implements Runnable{
}
}
} else if ("|1000|1002|2000|2001|2003|2005|2007|2008|".indexOf(infoRsp.getRET_CODE()) > 0) {
sqlMap.put("RET_STATUS", "1000");
logger.info(">>>>>>>>>>>处理中间状态需重新查询>>>>>>>>" + infoRsp.getRET_CODE());
logger.info("请求报文:" + requestContent);
logger.info("响应报文:" + responseContent);
@ -316,7 +234,6 @@ public class AllinpayPaymentQueryRun implements Runnable{
sqlMap.put("RET_CODE", infoRsp.getRET_CODE());
}
} else {
sqlMap.put("RET_STATUS", "5000");
String errMsg = infoRsp.getERR_MSG();
logger.error(">>>>>>>>>>>处理失败>>>>>>>>errMsg:" + errMsg);
logger.error("请求报文:" + requestContent);
@ -342,6 +259,8 @@ public class AllinpayPaymentQueryRun implements Runnable{
boLCP.setAttributeValue(key, sqlMap.get(key));
}
bomLCP.saveObject(boLCP);
updateOtherMessage(boLCP);
}
public void saveBuckle(BizObject bo,JBOTransaction tx,String sn,String rent) throws JBOException{
BizObjectManager blog = JBOFactory.getBizObjectManager(LB_BUCKLE_LOG.CLASS_NAME, tx);
@ -365,4 +284,87 @@ public class AllinpayPaymentQueryRun implements Runnable{
blog.saveObject(blbo);
}
public void updateOtherMessage(BizObject boLCP) throws JBOException{
String status = boLCP.getAttribute("STATUS").toString();
String plan_id = boLCP.getAttribute("UUID").toString();
String sn = "001";
String finishAmount= boLCP.getAttribute("FINISH_AMOUNT").toString();
if(plan_id.indexOf("-")!=-1){
plan_id = plan_id.substring(0, plan_id.indexOf("-"));
sn = plan_id.substring(plan_id.length()-3);
}
JBOTransaction tx = JBOFactory.createJBOTransaction();
BizObjectManager bomLRP = JBOFactory.getBizObjectManager("jbo.app.tenwa.calc.LC_RENT_PLAN",tx);
BizObject boLRP = bomLRP.createQuery("id=:id").setParameter("id", plan_id).getSingleResult(true);
String batchStatus = boLRP.getAttribute("batch_status")==null?"":boLRP.getAttribute("batch_status").toString();
String collectStatus = boLRP.getAttribute("collect_status")==null?"":boLRP.getAttribute("collect_status").toString();
String collectMsg = boLRP.getAttribute("batch_status")==null?"":boLRP.getAttribute("collect_msg").toString();
if("处理成功".equals(status)&&boLCP.getAttribute("FINISH_AMOUNT")!=null&&!"".equals(boLCP.getAttribute("FINISH_AMOUNT").toString())){
insertMessage(boLRP,finishAmount);
//租金计划表状态处理
BizObjectManager bomVRC = JBOFactory.getBizObjectManager("jbo.loan.VI_RENT_COLLECT",tx);
BizObject vrc = bomVRC.createQuery("id=:id").setParameter("id", plan_id).getSingleResult(false);
double rentOver = vrc.getAttribute("rent_over").getDouble();
double penaltyOver = vrc.getAttribute("penalty_over").getDouble();
if(rentOver>0 || penaltyOver>0){
batchStatus = "complete";
collectStatus = "部分收款";
collectMsg = "通联收款";
}else{
batchStatus = "complete";
collectStatus = "批量收款";
collectMsg = "通联收款";
}
}else if("正在处理".equals(status)){
}else{
batchStatus = "complete";
collectStatus = "未收款";
collectMsg = status;
}
//保存状态到租金计划表和日志表
if(!"正在处理".equals(status)){
boLRP.setAttributeValue("batch_status", batchStatus);
boLRP.setAttributeValue("collect_status", collectStatus);
boLRP.setAttributeValue("collect_msg", collectMsg);
bomLRP.saveObject(boLRP);
saveBuckle(boLRP,tx,sn,finishAmount);
}
tx.commit();
}
public void insertMessage(BizObject boLRP,String finishAmount){
Transaction Sqlca =null;
ASResultSet rs = null;
Sqlca = Transaction.createTransaction("als");
try {
String ln_contract_id = boLRP.getAttribute("contract_id").toString();
String ln_plan_date = boLRP.getAttribute("plan_date").toString();
String in_rent = finishAmount;
String in_hire_list = boLRP.getAttribute("plan_list").toString();
String in_type = "2";
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);
// 代偿红冲处理
CollectAuditInfoCache caic = new CollectAuditInfoCache();
caic.writeBackDistributor(boLRP.getAttribute("ID").toString(), finishAmount, Sqlca);
} catch (Exception e) {
e.printStackTrace();
}finally{
if(rs != null)
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
if(Sqlca!=null)
try {
Sqlca.commit();
} catch (JBOException e) {
e.printStackTrace();
}
}
}
}