From b0191c630de1aacecbdb2ac06d16611565de4d8d Mon Sep 17 00:00:00 2001 From: jianghongdong Date: Mon, 13 Aug 2018 11:32:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E5=85=89=E5=A4=A7=E7=9A=84=E5=90=88?= =?UTF-8?q?=E5=90=8C=E7=BB=93=E6=9D=9F=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?v1,=E6=9C=AA=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/WEB-INF/etc/jbo/jbo_lease.xml | 32 +++ .../quartz/ContractInfoForNomalEndSign.java | 210 ++++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 src_tenwa/quartz/ContractInfoForNomalEndSign.java diff --git a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml index 897a370f8..fc54a1ae0 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml @@ -4254,6 +4254,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src_tenwa/quartz/ContractInfoForNomalEndSign.java b/src_tenwa/quartz/ContractInfoForNomalEndSign.java new file mode 100644 index 000000000..29def86d7 --- /dev/null +++ b/src_tenwa/quartz/ContractInfoForNomalEndSign.java @@ -0,0 +1,210 @@ +package quartz; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO; +import jbo.com.tenwa.lease.comm.VI_NORMALEND_CONTRACT; + +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.JBOFactory; +import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.util.StringFunction; +import com.amarsoft.awe.util.Transaction; +import com.amarsoft.context.ASUser; +import com.base.util.QuartzUtil; +//import com.tenwa.action.channelportal.ContractSignAction; +//import com.tenwa.action.channelportal.comm.ContractTransferRightForEnd; +import com.tenwa.comm.util.jboutil.DataOperatorUtil; +import com.tenwa.officetempalte.action.CreateOfficeAction; +//import com.tenwa.quartz.BeforeSerialTimingTask; +//import com.tenwa.quartz.service.BeforeSerialTimingTaskService; +//import com.tenwa.quartz.serviceImpl.BeforeSerialTimingTaskServiceImpl; +import com.tenwa.reckon.util.UUIDUtil; + +import org.apache.log4j.Logger; + +public class ContractInfoForNomalEndSign implements Job{ + + @Override + public void execute(JobExecutionContext arg0) throws JobExecutionException { + String startime = StringFunction.getTodayNow(); + try { + JBOTransaction tx = JBOFactory.createJBOTransaction(); + ownershipTransferSign(tx); + tx.commit(); + QuartzUtil.insertLog(startime, "quartz.ContractInfoForNomalEndSign", "success", "³É¹¦"); + } catch (Exception e) { + QuartzUtil.insertLog(startime, "quartz.ContractInfoForNomalEndSign", "success", "ʧ°Ü"); + e.printStackTrace(); + } + } + + /* + *¼ìË÷Ò»ÌìÀïÃæÕý³£½áÊøµÄºÏͬ£¬²¢Éú³ÉËùÓÐÈ¨×ªÒÆÖ¤Ã÷£¬²¢µç×Óǩՠ+ *7¸öºÏͬ´ó¸Å40s + * */ +// public void ownershipTransferSign(JBOTransaction tx ) throws Exception{ +// MakeContractInfo makeContract = new MakeContractInfo(); +// String conInfo1 = makeContract.getContractId(tx); +// if(!(conInfo1 == null || conInfo1.length() <= 0)){ +// String[] conInfos = conInfo1.split(","); +// ContractSignAction conSign=new ContractSignAction(); +// for(String conInfo:conInfos){ +// String customerName = conInfo.split("@")[1]; +// String contractId = conInfo.split("@")[0]; +// String businessStatus = conInfo.split("@")[2]; +// //Éú³ÉÀíÅâ¹ØÁª¸½¼þ +// Map param = new HashMap(); +// param.put("contract_id", contractId); +// param.put("flow_unid", contractId); +// param.put("OBJECTTYPE", "²úÈ¨×ªÒÆµ¥"); +// param.put("NEW_TIME", StringFunction.getTodayNow()); +// param.put("Flag", "true");//¹ØÁªÇ©Ô¼±í +// param.put("Display", "true"); +// param.put("ID", UUIDUtil.getUUID());//ΪÁËʹÓÃͬһÌõRelative¼Ç¼ +// Transaction tran = Transaction.createTransaction("als"); +// String templateParam = makeContract.initClaimsParams(param,tran,contractId); +// CreateOfficeAction coa = new CreateOfficeAction(); +// makeContract.deleteAttrAndContractInfo(tx, contractId); +// if("37".equals(businessStatus)){ +// //Ìáǰ½áÇå +// makeContract.createOfficeByTemplate(coa, templateParam, "ËùÓÐÈ¨×ªÒÆµ¥","dc51c2a8661846528da47a03461e9f24" , customerName, null, tx); +// }else if("35".equals(businessStatus)){ +// //±£ÏÕÀíÅ⣨һÁ¾³µ£© +// makeContract.createOfficeByTemplate(coa, templateParam, "ËùÓÐÈ¨×ªÒÆµ¥(±£ÏÕÀíÅâ)","efc6e5dfa79148ad84074d0203e6ed1d" , customerName, null, tx); +// }else { +// //Õý³£½áÊø +// makeContract.createOfficeByTemplate(coa, templateParam, "ËùÓÐÈ¨×ªÒÆµ¥","041df2e804c54f8a8955457d586e8980" , customerName, null, tx); +// } +// //µç×ÓǩԼ +// String sReturn = conSign.transferSign(tx, contractId); +// if("success".equals(sReturn)){ +// //Èç¹ûǩԼ³É¹¦£¬½«ºÏͬ״̬¸ÄΪ105£¨½áÊø£© +// ContractTransferRightForEnd ctrf = new ContractTransferRightForEnd(); +// ctrf.setContract_id(contractId); +// ctrf.updateContractStatues(tx); +// } +// } +// } +// } + public void ownershipTransferSign(JBOTransaction tx ) throws Exception{ +// MakeContractInfo makeContract = new MakeContractInfo(); + String conInfo1 = getContractId(tx); + if(!(conInfo1 == null || conInfo1.length() <= 0)){ + String[] conInfos = conInfo1.split(","); +// ContractSignAction conSign=new ContractSignAction(); + for(String conInfo:conInfos){ + String customerName = conInfo.split("@")[1]; + String contractId = conInfo.split("@")[0]; + String businessStatus = conInfo.split("@")[2]; + //Éú³ÉÀíÅâ¹ØÁª¸½¼þ +// Map param = new HashMap(); +// param.put("contract_id", contractId); +// param.put("flow_unid", contractId); +// param.put("OBJECTTYPE", "²úÈ¨×ªÒÆµ¥"); +// param.put("NEW_TIME", StringFunction.getTodayNow()); +// param.put("Flag", "true");//¹ØÁªÇ©Ô¼±í +// param.put("Display", "true"); +// param.put("CUSTOMER_NAME", customerName); +// param.put("ID", UUIDUtil.getUUID());//ΪÁËʹÓÃͬһÌõRelative¼Ç¼ +// String templateParam = initClaimsParams(param,tx,contractId); +// CreateOfficeAction coa = new CreateOfficeAction(); +// deleteAttrAndContractInfo(tx, contractId); +// if("37".equals(businessStatus)){ +// //Ìáǰ½áÇå +// makeContract.createOfficeByTemplate(coa, templateParam, "ËùÓÐÈ¨×ªÒÆµ¥","dc51c2a8661846528da47a03461e9f24" , customerName, null, tx); +// }else if("35".equals(businessStatus)){ +// //±£ÏÕÀíÅ⣨һÁ¾³µ£© +// makeContract.createOfficeByTemplate(coa, templateParam, "ËùÓÐÈ¨×ªÒÆµ¥(±£ÏÕÀíÅâ)","efc6e5dfa79148ad84074d0203e6ed1d" , customerName, null, tx); +// }else { +// //Õý³£½áÊø +// createOfficeByTemplate(coa, templateParam, "ËùÓÐÈ¨×ªÒÆµ¥","041df2e804c54f8a8955457d586e8980" , customerName, null, tx); +// } + //µç×ÓǩԼ +// String sReturn = conSign.transferSign(tx, contractId); +// if("success".equals(sReturn)){ + //Èç¹ûǩԼ³É¹¦£¬½«ºÏͬ״̬¸ÄΪ105£¨½áÊø£© + Transaction tran = Transaction.createTransaction("als"); + BizObjectManager bm = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME, tran); + bm.createQuery("update O set contract_status = '105' where id = '"+contractId+"'").executeUpdate(); + tran.commit(); +// } + } + } + } + public String initClaimsParams(Map param,JBOTransaction sqlca,String contractId) throws Exception { + //³õʼ»¯Ò»Ï»ù´¡²ÎÊý + String fileSavePath = "d:/tmp/als/Upload"; + StringBuffer templateParam = new StringBuffer(); + templateParam.append("{"); + for(String p:param.keySet()){ + if("Flag".equals(p)||"Display".equals(p)){ + templateParam.append("\""+p+"\"" + ":\"" + param.get(p) + "\"@"); + }else{ + templateParam.append("\""+p.toUpperCase()+"\"" + ":\"" + param.get(p) + "\"@"); + } + } + templateParam.append("\"CurUserId\":\""); + templateParam.append("admin"); + templateParam.append("\"@\"CurOrgId\":\""); + templateParam.append("8001007"); + templateParam.append("\"@\"fileSavePath\":\""); + templateParam.append(fileSavePath+"\""); + return templateParam.toString(); + } + + //»ñÈ¡Õý³£½áÊøµÄºÏͬûÓеç×ÓǩԼµÄºÏͬºÅ + public String getContractId(JBOTransaction tx ) throws Exception{ + BizObjectManager bom=JBOFactory.getBizObjectManager(VI_NORMALEND_CONTRACT.CLASS_NAME,tx); + List boList = bom.createQuery("contract_status <> '105'").getResultList(true); + String conInfos = new String(); + for(BizObject bo : boList){ + conInfos += bo.getAttribute("id")+"@"; + conInfos += bo.getAttribute("customername")+"@"; + conInfos += bo.getAttribute("BUSINESS_STATUS")+","; + } + return conInfos; + } + + public void createOfficeByTemplate(CreateOfficeAction coa,String templateParam,String docName,String templetNo,String otherName,String otherParam,JBOTransaction sqlca) throws Exception{ + StringBuffer sql = new StringBuffer(); + sql.append(templateParam.toString()); + sql.append("@"); + sql.append("\"DOCNAME\":\""); + sql.append(docName); + sql.append("\""); + sql.append("@"); + sql.append("\"OTHERNAME\":\""); + sql.append(otherName); + sql.append("\""); + if(otherParam != null){ + sql.append(otherParam); + } + sql.append("}"); + coa.setTemplateParam(sql.toString()); + coa.setTemplateNo(templetNo); + coa.createOfficeByTemplate(sqlca); + } + + public void deleteAttrAndContractInfo(JBOTransaction tx,String contract_id) throws Exception{ + BizObjectManager LdrBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCRELATIVE.CLASS_NAME); + BizObjectManager LdclBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST.CLASS_NAME); + BizObjectManager LdlBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCLIBRARY.CLASS_NAME); + BizObjectManager LdaBom=JBOFactory.getBizObjectManager(jbo.app.tenwa.doc.LB_DOCATTRIBUTE.CLASS_NAME); + BizObject LdrBo = LdrBom.createQuery("contract_id = :contract_id and objecttype = '²úÈ¨×ªÒÆµ¥'").setParameter("contract_id",contract_id).getSingleResult(true); + if(LdrBo!=null){ + BizObject LdlBo = LdlBom.createQuery("relative_id=:id and doc_class_itemno = '010003'").setParameter("id",LdrBo.getAttribute("id").toString()).getSingleResult(true); + if(LdlBo!=null){ + LdaBom.createQuery("delete from O where library_id = :id").setParameter("id",LdlBo.getAttribute("id").toString()).executeUpdate(); + } + } + int LdclBo = LdclBom.createQuery("delete from O where flow_unid = :contract_id and doc_name like 'ËùÓÐȨ%'").setParameter("contract_id",contract_id).executeUpdate(); + } +}