From a725c1980e2a1d043441cc579d54f3c8abace206 Mon Sep 17 00:00:00 2001 From: liuzhao Date: Wed, 26 Dec 2018 18:08:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=82=AC=E6=AC=BE=E5=91=98=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=86=E6=B4=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src_tenwa/quartz/AutoDistribute.java | 53 +++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/src_tenwa/quartz/AutoDistribute.java b/src_tenwa/quartz/AutoDistribute.java index 28a7bff1b..ed5be1fe5 100644 --- a/src_tenwa/quartz/AutoDistribute.java +++ b/src_tenwa/quartz/AutoDistribute.java @@ -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 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 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 boList = bom.createQuery("SELECT O.id,O.over_days FROM O ").getResultList(true); + @SuppressWarnings("unchecked") + List 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) {