迁光大的合同结束定时任务v1,未验证

This commit is contained in:
jianghongdong 2018-08-13 11:32:14 +08:00
parent fcb37049e9
commit b0191c630d
2 changed files with 242 additions and 0 deletions

View File

@ -4254,6 +4254,38 @@
</managerProperties>
</manager>
</class>
<class name="VI_NORMALEND_CONTRACT" label="" keyAttributes="">
<attributes>
<attribute name="id" label="id" type="STRING"/>
<attribute name="project_id" label="project_id" type="STRING"/>
<attribute name="contract_number" label="contract_number" type="STRING"/>
<attribute name="InputUserID" label="InputUserID" type="STRING"/>
<attribute name="UpdateUserID" label="UpdateUserID" type="STRING"/>
<attribute name="InputTime" label="InputTime" type="STRING"/>
<attribute name="UpdateTime" label="UpdateTime" type="STRING"/>
<attribute name="flowunid" label="flowunid" type="STRING"/>
<attribute name="customerid" label="customerid" type="STRING"/>
<attribute name="customername" label="customername" type="STRING"/>
<attribute name="PROVINCE" label="PROVINCE" type="STRING"/>
<attribute name="DRESSDETAIL" label="DRESSDETAIL" type="STRING"/>
<attribute name="TELEPHONE" label="TELEPHONE" type="STRING"/>
<attribute name="distributor_name" label="distributor_name" type="STRING"/>
<attribute name="contract_status" label="contract_status" type="STRING"/>
<attribute name="CLEAN_LEASE_MONEY" label="CLEAN_LEASE_MONEY" type="STRING"/>
<attribute name="NOMINAL_PRICE" label="NOMINAL_PRICE" type="STRING"/>
<attribute name="START_DATE" label="START_DATE" type="STRING"/>
<attribute name="RENT_VALUE" label="RENT_VALUE" type="STRING"/>
<attribute name="customertype" label="customertype" type="STRING"/>
<attribute name="PRODUCT_ID" label="PRODUCT_ID" type="STRING"/>
<attribute name="EACH_RENT" label="EACH_RENT" type="STRING"/>
<attribute name="business_status" label="business_status" type="STRING"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="vi_normalend_contract" />
</managerProperties>
</manager>
</class>
</package>
<package name="jbo.com.tenwa.lease.carbrand" >
<class name="LB_CLAIMS_BOOK_DETAIL" label="索赔申请书详情表" keyAttributes="ID">

View File

@ -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<String,String> param = new HashMap<String,String>();
// 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<String,String> param = new HashMap<String,String>();
// 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<String,String> 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<BizObject> 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();
}
}