经销商保证金代偿增加事务、同步锁

This commit is contained in:
zhangjun 2019-11-07 16:51:31 +08:00
parent bc704c09c8
commit f630e74224
2 changed files with 12 additions and 7 deletions

View File

@ -111,7 +111,7 @@ public class CollectAuditInfoCache {
parms.append(",'"+str+"'");
}
}
BizObjectManager bm = JBOFactory.getFactory().getManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME);
BizObjectManager bm = JBOFactory.getFactory().getManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME,tx);
List<BizObject> bolist = bm.createQuery("select v.getCustomerName(O.customer_id) as v.customer_name,O.account,O.acc_number,O.mobile,O.contract_id,O.plan_list,O.plan_date,O.COLLECT_STATUS,O.BATCH_STATUS,O.rent from O where O.id in ("+parms.toString()+")").getResultList(false);
for (BizObject bo : bolist) {
String name = bo.getAttribute("customer_name").toString().trim();
@ -652,10 +652,10 @@ public class CollectAuditInfoCache {
String[] ids = id.split("@");
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);
BizObjectManager bm = JBOFactory.getFactory().getManager(VI_LC_AUDIT_RENT_PLAN.CLASS_NAME,tx);
BizObjectManager bc = JBOFactory.getFactory().getManager(LC_RENT_PLAN.CLASS_NAME,tx);
BizObjectManager bd = JBOFactory.getFactory().getManager(D_DEPOSITRETURN_INFO.CLASS_NAME,tx);
BizObjectManager bdi = JBOFactory.getFactory().getManager(DISTRIBUTOR_INFO.CLASS_NAME,tx);
for(int c=0;c<ids.length;c++){
BizObject bom = bm.createQuery("select distinct O.contract_id,O.plan_list,O.plan_date,O.id,O.corpus,O.interest,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);
@ -692,7 +692,6 @@ public class CollectAuditInfoCache {
//修改经销商信息表里的金额
bdi.createQuery("update O set O.sums='"+account_balance+"' where O.distributor_no=:distributor_id").setParameter("distributor_id", distributor_id).executeUpdate();
}
return "总共有 "+i+" 笔租金收款成功\n"+j+" 笔租金收款失败";
}
private BigDecimal BigDecimal(String string) {

View File

@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import jbo.com.tenwa.lease.carbrand.lb_automatic_compensatory;
import jbo.com.tenwa.lease.comm.VI_LC_AUDIT_RENT_PLAN;
@ -21,10 +22,14 @@ import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.flow.action.comm.SelectBalance;
public class DistributorMarginCompensation implements Job {
private JobInitUserName jboName;
public static ReentrantLock lock = new ReentrantLock();
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
public void execute(JobExecutionContext arg0) throws JobExecutionException {
lock.lock();
JBOTransaction tx =null;
Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId");
String curUserId = userId == null? "system" : userId.toString();
@ -115,6 +120,7 @@ public class DistributorMarginCompensation implements Job {
}
}
}finally{
lock.unlock();
try {
if(tx !=null){