通联修改

This commit is contained in:
yjf 2021-09-03 10:15:18 +08:00
parent ae4ee4bac8
commit 6080a1a90e
4 changed files with 125 additions and 136 deletions

View File

@ -19,7 +19,7 @@ import com.amarsoft.are.jbo.JBOTransaction;
public class AllinpayPaymentDo {
private String id;
/**
* 批量代收-发送请求
* @param tx
@ -103,8 +103,7 @@ public class AllinpayPaymentDo {
new Thread(run).start();
}
public void queryCollectResult(){
AllinpayPaymentQueryRun run = new AllinpayPaymentQueryRun();
new Thread(run).start();
new AllinpayPaymentQueryRun().allinpayPaymentQuerySt();
}
public String getId() {
return id;

View File

@ -1,31 +1,30 @@
package com.tenwa.lease.app.allinpay.service.impl;
import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class AllinpayPaymentQueryJob implements Job{
private Logger logger = Logger.getLogger(this.getClass());
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
try {
BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.app.tenwa.calc.LC_CARD_PAYMENT");
BizObject object = manager.createQuery("O.STATUS='正在处理'").getSingleResult(true);
if(object==null) {
logger.info("没有需要查询的通联卡扣信息");
return;
}
AllinpayPaymentQueryRun run = new AllinpayPaymentQueryRun();
run.run();
} catch (JBOException e) {
e.printStackTrace();
}
}
public class AllinpayPaymentQueryJob implements Job {
private Logger logger = Logger.getLogger(this.getClass());
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
try {
BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.app.tenwa.calc.LC_CARD_PAYMENT");
BizObject object = manager.createQuery("O.STATUS='正在处理'").getSingleResult(true);
if (object == null) {
logger.info("没有需要查询的通联卡扣信息");
return;
}
new AllinpayPaymentQueryRun().allinpayPaymentQuerySt();
} catch (JBOException e) {
e.printStackTrace();
}
}
}

View File

@ -1,67 +1,53 @@
package com.tenwa.lease.app.allinpay.service.impl;
import java.io.BufferedWriter;
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;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import jbo.com.tenwa.lease.comm.LB_BUCKLE_LOG;
import org.apache.log4j.Logger;
import com.allinpay.xml.XmlParser;
import com.allinpay.xstruct.common.AipgRsp;
import com.allinpay.xstruct.common.InfoRsp;
import com.allinpay.xstruct.trans.qry.QTDetail;
import com.allinpay.xstruct.trans.qry.QTransRsp;
import com.amarsoft.app.lc.util.DateAssistant;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.jbo.*;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.ctc.wstx.util.DataUtil;
import com.tenwa.collectaudit.cache.CollectAuditInfoCache;
import com.tenwa.lease.app.allinpay.util.AllinpayProperties;
import com.tenwa.lease.app.allinpay.util.ConfigConstant;
import com.tenwa.reckon.util.UUIDUtil;
import jbo.app.tenwa.calc.LC_RENT_INCOME;
import jbo.com.tenwa.lease.comm.LB_BUCKLE_LOG;
import org.apache.log4j.Logger;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
public class AllinpayPaymentQueryRun implements Runnable{
@Override
public void run() {
this.allinpayPaymentQuerySt();
}
private AllinpayProperties allinpay;
private String localFilePath;
private Logger logger = Logger.getLogger(this.getClass());
public AllinpayPaymentQueryRun() {
}
/**
* 分页处理需要进行查询的扣款数据
* @param
* @param
* @return
*/
@SuppressWarnings({ "unchecked"})
@ -82,16 +68,16 @@ public class AllinpayPaymentQueryRun implements Runnable{
while (size > start) {
logger.info("开始第" + start + "" + (start + maxCount) + "次循环");
boLOEDs = bomLCP.createQuery("O.STATUS='正在处理' ").setFirstResult(start).setMaxResults(maxCount).getResultList(true);
if (boLOEDs == null || boLOEDs.size() == 0) {
logger.error("没有需要查询的通联支付信息>>>>>>>>>>:");
break;
}
for (BizObject boLCP : boLOEDs) {
try {
BizObject object = JBOFactory.getBizObjectManager("jbo.com.tenwa.lease.comm.LB_PROJECT_INFO").createQuery("O.id=:id").setParameter("id", boLCP.getAttribute("PROJECT_ID").toString()).getSingleResult(false);
allinpay = new AllinpayProperties(object.getAttribute("subjectid").toString());
String quertSn= boLCP.getAttribute("REQ_SN").toString();
String num = boLCP.getAttribute("NUM").toString();
@ -101,7 +87,7 @@ public class AllinpayPaymentQueryRun implements Runnable{
sqlMap.put("NUM", Integer.parseInt(num) + "");
mapXml.put("quertSn", quertSn);
sqlMap = sendMessageByProxy(mapXml, sqlMap);
if (localFilePath == null) {
LocalDateTime ldt = LocalDateTime.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMdd");
@ -248,7 +234,6 @@ public class AllinpayPaymentQueryRun implements Runnable{
/**
* 修改通联扣款数据汇总表
* @param map
* @return Exception
*/
private void updateMessage(BizObjectManager bomLCP, BizObject boLCP, Map<String, String> sqlMap) throws Exception {
@ -260,7 +245,7 @@ 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{
@ -306,11 +291,11 @@ public class AllinpayPaymentQueryRun implements Runnable{
if("处理成功".equals(status)&&boLCP.getAttribute("FINISH_AMOUNT")!=null&&!"".equals(boLCP.getAttribute("FINISH_AMOUNT").toString())){
insertMessage(boLRP,finishAmount,tx);
//租金计划表状态处理
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){
BizObjectManager bomIncome = JBOFactory.getBizObjectManager(LC_RENT_INCOME.CLASS_NAME,tx);
BizObject boLRI = bomIncome.createQuery("select v.sum(v.ifnull(rent,0)) as v.rent from o where payment_number=:paymentNumber and plan_list=:planList")
.setParameter("paymentNumber", boLRP.getAttribute("payment_number").getString())
.setParameter("planList", boLRP.getAttribute("plan_list").getString()).getSingleResult(false);
if(boLRP.getAttribute("rent").getDouble()>boLRI.getAttribute("rent").getDouble()){
batchStatus = "complete";
collectStatus = "部分收款";
collectMsg = "通联收款";

View File

@ -1,15 +1,6 @@
package com.tenwa.lease.app.quartzmession;
import java.util.List;
import jbo.com.tenwa.lease.comm.VI_LC_AUDIT_RENT_PLAN;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.Configure;
@ -21,65 +12,80 @@ import com.tenwa.collectaudit.cache.CollectAuditInfoCache;
import com.tenwa.collectaudit.cache.CollectAuditInfoCacheTj;
import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.lease.app.allinpay.service.impl.AllinpayPaymentQueryRun;
import jbo.com.tenwa.lease.comm.VI_LC_AUDIT_RENT_PLAN;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class AutoRefresh implements Job{
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
CollectAuditInfoCache ca = new CollectAuditInfoCache();
JBOTransaction tx = null;
String plan_date = DateAssistant.getToday();
Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId");
String curUserId = userId == null? "system" : userId.toString();
try {
tx = JBOFactory.createJBOTransaction();
Transaction Sqlca = Transaction.createTransaction(tx);
String sSql = "SELECT STATUS FROM lb_card_buckle_status WHERE STATUS='Y' ";
SqlObject asql = new SqlObject(sSql);
ASResultSet rs = Sqlca.getASResultSet(asql);
if(rs.next()) {
return ;
}
List<BizObject> bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款','代偿') and O.SUBJECTID='aa740e4111c111eaaa0000163e0e11e6' and O.collect_type='YLcollect' and O.BATCH_STATUS='process' and O.PLAN_DATE <= '"+plan_date+"'").getResultList(true);
StringBuffer ids = new StringBuffer();
if(bos!=null && bos.size()>0){
for (BizObject bo : bos) {
ids.append(bo.getAttribute("id").getString()+"@");
}
ca.setId(ids.toString().substring(0, ids.toString().length()-1));
Configure CurConfig = Configure.getInstance();
ca.setFileSavePath(CurConfig.getConfigure("InterfaceFileSavePath"));
ca.setInputuserid("system");
ca.setInputorgid("system");
ca.queryBatchCollectStatus(tx);
}
//天津自动回盘
CollectAuditInfoCacheTj caTj = new CollectAuditInfoCacheTj();
List<BizObject> bosTj = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款','代偿') and O.SUBJECTID='d989246c11c111eaaa0000163e0e11e6' and O.collect_type='YLcollect' and O.BATCH_STATUS='process' and O.PLAN_DATE <= '"+plan_date+"'").getResultList(true);
StringBuffer idsTj = new StringBuffer();
if(bosTj!=null && bosTj.size()>0){
for (BizObject bo : bosTj) {
idsTj.append(bo.getAttribute("id").getString()+"@");
}
caTj.setId(idsTj.toString().substring(0, idsTj.toString().length()-1));
Configure CurConfig = Configure.getInstance();
caTj.setFileSavePath(CurConfig.getConfigure("InterfaceFileSavePath"));
caTj.setInputuserid("system");
caTj.setInputorgid("system");
caTj.queryBatchCollectStatus(tx);
}
QuartzUtil.insertLog(plan_date,"com.tenwa.lease.app.quartzmession.AutoRefresh", "success", "成功",curUserId);
} catch (Exception e) {
e.printStackTrace();
QuartzUtil.insertLog(plan_date,"com.tenwa.lease.app.quartzmession.AutoRefresh", "error", "失败",curUserId);
}finally{
try {
tx.commit();
} catch (JBOException e) {
e.printStackTrace();
}
}
AllinpayPaymentQueryRun run = new AllinpayPaymentQueryRun();
new Thread(run).start();
}
public class AutoRefresh implements Job {
private static final Lock lock = new ReentrantLock();
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
String plan_date = DateAssistant.getToday();
Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId");
String curUserId = userId == null ? "system" : userId.toString();
boolean lockHoldStatus = lock.tryLock();
try {
if (lockHoldStatus) {
CollectAuditInfoCache ca = new CollectAuditInfoCache();
JBOTransaction tx = null;
try {
tx = JBOFactory.createJBOTransaction();
Transaction Sqlca = Transaction.createTransaction(tx);
String sSql = "SELECT STATUS FROM lb_card_buckle_status WHERE STATUS='Y' ";
SqlObject asql = new SqlObject(sSql);
ASResultSet rs = Sqlca.getASResultSet(asql);
if (rs.next()) {
return;
}
List<BizObject> bos = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款','代偿') and O.SUBJECTID='aa740e4111c111eaaa0000163e0e11e6' and O.collect_type='YLcollect' and O.BATCH_STATUS='process' and O.PLAN_DATE <= '" + plan_date + "'").getResultList(true);
StringBuilder ids = new StringBuilder();
if (bos != null && bos.size() > 0) {
for (BizObject bo : bos) {
ids.append(bo.getAttribute("id").getString()).append("@");
}
ca.setId(ids.toString().substring(0, ids.toString().length() - 1));
ca.setFileSavePath(Configure.getInstance().getConfigure("InterfaceFileSavePath"));
ca.setInputuserid("system");
ca.setInputorgid("system");
ca.queryBatchCollectStatus(tx);
}
//天津自动回盘
CollectAuditInfoCacheTj caTj = new CollectAuditInfoCacheTj();
List<BizObject> bosTj = JBOFactory.getBizObjectManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME, tx).createQuery("O.COLLECT_STATUS IN ('未收款', '部分收款','代偿') and O.SUBJECTID='d989246c11c111eaaa0000163e0e11e6' and O.collect_type='YLcollect' and O.BATCH_STATUS='process' and O.PLAN_DATE <= '" + plan_date + "'").getResultList(true);
StringBuilder idsTj = new StringBuilder();
if (bosTj != null && bosTj.size() > 0) {
for (BizObject bo : bosTj) {
idsTj.append(bo.getAttribute("id").getString()).append("@");
}
caTj.setId(idsTj.toString().substring(0, idsTj.toString().length() - 1));
caTj.setFileSavePath(Configure.getInstance().getConfigure("InterfaceFileSavePath"));
caTj.setInputuserid("system");
caTj.setInputorgid("system");
caTj.queryBatchCollectStatus(tx);
}
tx.commit();
//通联卡扣回盘
new AllinpayPaymentQueryRun().allinpayPaymentQuerySt();
QuartzUtil.insertLog(plan_date, "com.tenwa.lease.app.quartzmession.AutoRefresh", "success", "成功", curUserId);
} catch (Exception e) {
if (tx != null) tx.rollback();
e.printStackTrace();
QuartzUtil.insertLog(plan_date, "com.tenwa.lease.app.quartzmession.AutoRefresh", "error", "失败", curUserId);
}
} else {
QuartzUtil.insertLog(plan_date, "com.tenwa.lease.app.quartzmession.AutoRefresh", "lockerror", "获取锁失败", curUserId);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (lockHoldStatus) lock.unlock();
}
}
}