催款员自动分派

This commit is contained in:
liuzhao 2018-12-26 18:08:08 +08:00
parent 4e9a7eb4bb
commit a725c1980e

View File

@ -31,7 +31,9 @@ import com.tenwa.lease.app.quartzmession.JobInitUserName;
public class AutoDistribute implements Job {
private JobInitUserName jboName;
//指定的北财催款员id正式环境需要修改
private String beicaiUserID = "8009011U00000021";
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
String startime = StringFunction.getTodayNow();
@ -41,7 +43,10 @@ public class AutoDistribute implements Job {
try {
JBOTransaction tx = JBOFactory.createJBOTransaction();
//给非北财分配催款员
ownershipTransferSign(tx, arg0);
//北财逾期的合同分配给指定催款员
distributeBeicai(tx, arg0);
tx.commit();
QuartzUtil.insertLog(startime, "quartz.AutoDistribute", "success","³É¹¦", curUserId);
} catch (Exception e) {
@ -50,7 +55,46 @@ public class AutoDistribute implements Job {
}
}
/**
* 北财逾期的合同分配给指定催款员
* @param tx
* @param arg0
*/
public void distributeBeicai(JBOTransaction tx, JobExecutionContext arg0) {
// 获取所有逾期的需要催收的合同信息
BizObjectManager bom;
BizObjectManager overdueManager;
try {
overdueManager = JBOFactory.getBizObjectManager(OVERDUE_DUNNING_INFO.CLASS_NAME, tx);
bom = JBOFactory.getBizObjectManager(VI_AUTODISTRIBUTE.CLASS_NAME, tx);
@SuppressWarnings("unchecked")
List<BizObject> boList = bom.createQuery("SELECT O.id,O.over_days FROM O WHERE O.project_manage IN (SELECT ur.userid FROM jbo.awe.USER_ROLE ur WHERE ur.roleid ='800R00000044')").getResultList(false);
for (BizObject bo : boList) {
String contractId = bo.getAttribute("id").toString();
//查询是否已经有催款员(目前北财只有一个指定的催款员)
BizObject overdue = overdueManager.createQuery("contract_id=:contract_id").setParameter("contract_id", contractId).getSingleResult(false);
if(overdue == null){
BizObject overdueBizObject = overdueManager.newObject();
String uuid = UUID.randomUUID().toString().replace("-", "");
overdueBizObject.setAttributeValue("id", uuid);
overdueBizObject.setAttributeValue("part_dept", beicaiUserID);
overdueBizObject.setAttributeValue("contract_id", contractId);
overdueManager.saveObject(overdueBizObject);
}
}
} catch (JBOException e) {
e.printStackTrace();
}
}
/**
* 给非北财分配催款员
* @param tx
* @param arg0
* @throws Exception
*/
public void ownershipTransferSign(JBOTransaction tx,JobExecutionContext arg0) throws Exception{
//»ñÈ¡ÌìÊý
Map<String,Integer> dayMap = getDay(tx);
@ -260,9 +304,10 @@ public class AutoDistribute implements Job {
* "SELECT O.id,vo.over_days FROM O LEFT JOIN jbo.com.tenwa.lease.comm.LB_UNION_LESSEE lul ON lul.contract_id = O.id LEFT JOIN jbo.sys.OVERDUE_DUNNING_INFO odi ON odi.contract_id = O.id LEFT JOIN jbo.sys.USER_INFO ui ON ui.userid = odi.part_dept LEFT JOIN jbo.app.tenwa.calc.VI_OVERDUE_RENT_PLAN_SUM vo ON vo.contract_id=O.id WHERE lul.is_main='Y' AND O.contract_status='31' AND vo.over_money>0"
* ).getResultList(true);
*/
// 获取所有逾期的需要催收的合同信息
// 获取所有逾期的需要催收的合同信息(非北财合同)
BizObjectManager bom = JBOFactory.getBizObjectManager(VI_AUTODISTRIBUTE.CLASS_NAME, tx);
List<BizObject> boList = bom.createQuery("SELECT O.id,O.over_days FROM O ").getResultList(true);
@SuppressWarnings("unchecked")
List<BizObject> boList = bom.createQuery("SELECT O.id,O.over_days FROM O WHERE O.project_manage NOT IN (SELECT ur.userid FROM jbo.awe.USER_ROLE ur WHERE ur.roleid ='800R00000044')").getResultList(true);
String conInfos = new String();
for (BizObject bo : boList) {