1.卡扣修改暂时提交

This commit is contained in:
zhangbb 2020-08-06 13:30:29 +08:00
parent 773b6a6600
commit 73bab17251

View File

@ -10,6 +10,13 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.quartz.JobExecutionContext;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.app.awe.config.InitCollectConfig;
import com.amarsoft.app.util.StringUtil;
import com.amarsoft.are.jbo.BizObject;
@ -25,7 +32,9 @@ import com.gnete.security.crypt.Crypt;
import com.gnete.security.crypt.CryptException;
import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.quartz.DateUtil;
import jbo.app.tenwa.calc.LC_COLLECT_MANUAL_INFO;
import jbo.app.tenwa.calc.LC_RENT_PLAN;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT;
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
@ -46,7 +55,27 @@ public class CollectAuditInfoCache {
private String clearDate;
private String distributor_id;
private String penaltys;
private String collectStyle;
private String collecMoneys;
private String datas;
private String jobName;
public String getCollecMoneys() {
return collecMoneys;
}
public void setCollecMoneys(String collecMoneys) {
this.collecMoneys = collecMoneys;
}
public String getDatas() {
return datas;
}
public void setDatas(String datas) {
this.datas = datas;
}
/**
* 经销商保证金代偿后红冲
* 租金计划表ID在保证金收取表中为depositcharge_id在退回表中为RENT_PLAN_ID
@ -801,7 +830,88 @@ public class CollectAuditInfoCache {
}
return "系统正在处理中,请稍后";
}
/**
* 手动批量代收-发送请求
* @param tx
* @return
* @throws Exception
*/
public String batchCollectManageManual(JBOTransaction tx) throws Exception{
String[] ids = id.split("@");
String datas_json = datas.replaceAll("@", ",");
JSONObject object = JSON.parseObject(datas_json);
StringBuffer parms = new StringBuffer();
for (String str : ids) {
if (parms.length()==0) {
parms.append("'"+str+"'");
}else{
parms.append(",'"+str+"'");
}
}
BizObjectManager bm = JBOFactory.getFactory().getManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME);
List<BizObject> bolist = bm.createQuery("select distinct O.contract_id,O.plan_date,O.id,ca.ACC_NUMBER,ca.ACCOUNT,ca.BANK_NAME,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);
if (bolist.size() != 0) {
for(BizObject bo:bolist){
String plan_id = bo.getAttribute("id").toString();
bo.setAttributeValue("rent", object.get(plan_id));
}
singleBatchCollectMoeny(tx, bolist);
}
return "系统正在处理中,请稍后";
}
/**
* 检查定时任务是否正在运行
* @param jobName
* @return
*/
public String isRunning(){
try {
Scheduler defaultScheduler = StdSchedulerFactory.getDefaultScheduler();
List<JobExecutionContext> jobContexts = defaultScheduler.getCurrentlyExecutingJobs();
for (JobExecutionContext context : jobContexts) {
System.out.println(context.getTrigger().getJobKey().getName());
if (jobName.equals(context.getTrigger().getJobKey().getName())) {
return "using";
}
}
} catch (SchedulerException e) {
e.printStackTrace();
return "using";
}
System.out.println("定时任务未在运行中,可以发起!");
return "unUse";
}
/**
* 获取当日扣款数量
* @param jobName
* @return
*/
public String getCollectCount(){
String count = "";
try {
BizObjectManager bmlcmi = JBOFactory.getFactory().getManager(LC_COLLECT_MANUAL_INFO.CLASS_NAME);
String curDate = DateUtil.getSystemTimeByFormat("yyyy/MM/dd");
String[] ids = id.split("@");
for(int i=0;i<ids.length;i++){
int collectCount= bmlcmi.createQuery("select O.id from O where hire_date=:curDate and plan_id=:id")
.setParameter("curDate", curDate)
.setParameter("id", ids[i])
.getTotalCount();
if(collectCount>=2){
count = collectCount+"";
return count;
}
}
} catch (JBOException e) {
e.printStackTrace();
return "error";
}
return count;
}
/**
* 查询批量收款状态
* @return
@ -966,7 +1076,7 @@ public class CollectAuditInfoCache {
n = 0;
}
}
}
}
return "success";
@ -980,6 +1090,8 @@ public class CollectAuditInfoCache {
blbo.setAttributeValue("COLLECT_MSG", bo.getAttribute("COLLECT_MSG").getString());
blbo.setAttributeValue("BATCH_STATUS", bo.getAttribute("BATCH_STATUS").getString());
}
DecimalFormat format = new DecimalFormat("0.00");
rent = format.format(new BigDecimal(rent ));
blbo.setAttributeValue(LB_BUCKLE_LOG.BATCH_SN, batch_sn);
blbo.setAttributeValue(LB_BUCKLE_LOG.BATCH_NO, bo.getAttribute("BATCH_NO").getString());
blbo.setAttributeValue(LB_BUCKLE_LOG.RENT_ID, bo.getAttribute("ID").getString());
@ -1310,11 +1422,12 @@ public class CollectAuditInfoCache {
strbuff.append("<TRANS_DETAILS><TRANS_DETAIL>");
int item = 0;
for (BizObject biz : list) {
BigDecimal m = new BigDecimal(biz.getAttribute("rent").toString());
BigDecimal m = new BigDecimal(biz.getAttribute("rent").toString());
String rent = String.valueOf(m.multiply(new BigDecimal(100)).longValue());
String acc_number = biz.getAttribute("acc_number").toString();
String account = biz.getAttribute("account").toString();
String bank_name = biz.getAttribute("BANK_NAME").toString();
String planId = biz.getAttribute("id").toString();
List<BizObject> codelist = JBOFactory.getFactory().getBizObjectManager(CODE_LIBRARY.CLASS_NAME).createQuery("O.codeno = 'bankType' and O.itemdescribe is not null ").getResultList(false);
double itemdescribe = 0;
boolean flag = false;
@ -1347,7 +1460,7 @@ public class CollectAuditInfoCache {
//追加批量处理状态
JBOTransaction trans = JBOFactory.createJBOTransaction();
BizObjectManager bm = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME,trans);
BizObject bo = bm.createQuery("O.id=:id").setParameter("id", biz.getAttribute("id").toString()).getSingleResult(false);
BizObject bo = bm.createQuery("O.id=:id").setParameter("id", planId).getSingleResult(false);
String itemsn0 = "";
if (bo !=null) {
String itemsn = bo.getAttribute("batch_sn").toString();
@ -1361,14 +1474,34 @@ public class CollectAuditInfoCache {
.setParameter("BATCH_STATUS", "")//处理状态-为空
.setParameter("BATCH_NO", req_sn)
.setParameter("BATCH_SN", itemsn0)
.setParameter("id", biz.getAttribute("id").toString()).executeUpdate();
.setParameter("id", planId).executeUpdate();
//手动的添加到手动表
if("manual".equals(collectStyle)){
BizObjectManager bmlcmi = JBOFactory.getFactory().getManager(LC_COLLECT_MANUAL_INFO.CLASS_NAME,trans);
if(k==1){
BizObject bolmci = bmlcmi.newObject();
bolmci.setAttributeValue("contract_id",biz.getAttribute("contract_id").toString());
bolmci.setAttributeValue("plan_id",planId);
bolmci.setAttributeValue("BATCH_NO",req_sn);
bolmci.setAttributeValue("BATCH_SN",itemsn0);
bolmci.setAttributeValue("money",biz.getAttribute("rent").toString());
bolmci.setAttributeValue("hire_date",DateUtil.getSystemTimeByFormat("yyyy/MM/dd"));
bmlcmi.saveObject(bolmci);
}else{
bmlcmi.createQuery("update O set O.BATCH_SN=:BATCH_SN where O.plan_id=:id and O.BATCH_NO=:BATCH_NO")
.setParameter("BATCH_SN", itemsn0)
.setParameter("BATCH_NO", req_sn)
.setParameter("id", planId).executeUpdate();
}
}
trans.commit();
trans_detail.setSN(sn);
trans_detail.setACCOUNT_TYPE("");
trans_detail.setACCOUNT_NO(acc_number);
trans_detail.setACCOUNT_NAME(account);
trans_detail.setACCOUNT_PROP("0");
trans_detail.setAMOUNT(String.valueOf(singleitem));
trans_detail.setAMOUNT(String.valueOf(singleitem));
trans_detail.setCURRENCY("CNY");
trans_detail.setRECKON_ACCOUNT("");
strbuff.append(EntityTransform.toXmlByBatchCollect(trans_detail));
@ -1389,7 +1522,7 @@ public class CollectAuditInfoCache {
//追加批量处理状态
JBOTransaction trans = JBOFactory.createJBOTransaction();
BizObjectManager bm = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME,trans);
BizObject bo = bm.createQuery("O.id=:id").setParameter("id", biz.getAttribute("id").toString()).getSingleResult(false);
BizObject bo = bm.createQuery("O.id=:id").setParameter("id", planId).getSingleResult(false);
String itemsn0 = "";
if (bo !=null) {
String itemsn = bo.getAttribute("batch_sn").toString();
@ -1403,7 +1536,15 @@ public class CollectAuditInfoCache {
.setParameter("BATCH_STATUS", "")//处理状态-为空
.setParameter("BATCH_NO", req_sn)
.setParameter("BATCH_SN", itemsn0)
.setParameter("id", biz.getAttribute("id").toString()).executeUpdate();
.setParameter("id", planId).executeUpdate();
//手动的添加到手动表
if("manual".equals(collectStyle)){
BizObjectManager bmlcmi = JBOFactory.getFactory().getManager(LC_COLLECT_MANUAL_INFO.CLASS_NAME,trans);
bmlcmi.createQuery("update O set O.BATCH_SN=:BATCH_SN where O.plan_id=:id and O.BATCH_NO=:BATCH_NO")
.setParameter("BATCH_SN", itemsn0)
.setParameter("BATCH_NO", req_sn)
.setParameter("id", planId).executeUpdate();
}
trans.commit();
trans_detail.setSN(sn);
trans_detail.setACCOUNT_TYPE("");
@ -1415,6 +1556,7 @@ public class CollectAuditInfoCache {
trans_detail.setRECKON_ACCOUNT("");
strbuff.append(EntityTransform.toXmlByBatchCollect(trans_detail));
}
}else{
Trans_Detail trans_detail = new Trans_Detail();
String sn = "";
@ -1432,7 +1574,18 @@ public class CollectAuditInfoCache {
.setParameter("BATCH_STATUS", "")//处理状态-为空
.setParameter("BATCH_NO", req_sn)
.setParameter("BATCH_SN", sn)
.setParameter("id", biz.getAttribute("id").toString()).executeUpdate();
.setParameter("id", planId).executeUpdate();
//手动的添加到手动表
if("manual".equals(collectStyle)){
BizObjectManager bmlcmi = JBOFactory.getFactory().getManager(LC_COLLECT_MANUAL_INFO.CLASS_NAME,trans);
BizObject bolmci = bmlcmi.newObject();
bolmci.setAttributeValue("contract_id",biz.getAttribute("contract_id").toString());
bolmci.setAttributeValue("plan_id",planId);
bolmci.setAttributeValue("BATCH_NO",req_sn);
bolmci.setAttributeValue("BATCH_SN",sn);
bolmci.setAttributeValue("hire_date",DateUtil.getSystemTimeByFormat("yyyy/MM/dd"));
bmlcmi.saveObject(bolmci);
}
trans.commit();
trans_detail.setSN(sn);
trans_detail.setACCOUNT_TYPE("");
@ -1449,7 +1602,7 @@ public class CollectAuditInfoCache {
strbuff.append("</TRANS_DETAILS>");
strbuff.append("</BODY>");
strbuff.append("</GZELINK>");
collectStyle=null;
return strbuff;
}
@ -1783,6 +1936,21 @@ public class CollectAuditInfoCache {
public void setPenaltys(String penaltys) {
this.penaltys = penaltys;
}
public String getCollectStyle() {
return collectStyle;
}
public void setCollectStyle(String collectStyle) {
this.collectStyle = collectStyle;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
}