定时任务触发合同结清
This commit is contained in:
parent
f0379f3911
commit
b42f1a74ea
132
src_tenwa/quartz/ContractInfoForNomalSettle.java
Normal file
132
src_tenwa/quartz/ContractInfoForNomalSettle.java
Normal file
@ -0,0 +1,132 @@
|
||||
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.comm.util.jboutil.SaveBusinessStatus;
|
||||
import com.tenwa.lease.app.quartzmession.JobInitUserName;
|
||||
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 ContractInfoForNomalSettle implements Job{
|
||||
private JobInitUserName jboName;
|
||||
@Override
|
||||
public void execute(JobExecutionContext arg0) throws JobExecutionException {
|
||||
String startime = StringFunction.getTodayNow();
|
||||
try {
|
||||
JBOTransaction tx = JBOFactory.createJBOTransaction();
|
||||
ownershipTransferSign(tx,arg0);
|
||||
tx.commit();
|
||||
QuartzUtil.insertLog(startime, "quartz.ContractInfoForNomalSettle", "success", "成功");
|
||||
} catch (Exception e) {
|
||||
QuartzUtil.insertLog(startime, "quartz.ContractInfoForNomalSettle", "success", "失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void ownershipTransferSign(JBOTransaction tx ,JobExecutionContext arg0) throws Exception{
|
||||
String conInfo1 = getContractId(tx);
|
||||
if(!(conInfo1 == null || conInfo1.length() <= 0)){
|
||||
String[] conInfos = conInfo1.split(",");
|
||||
for(String conInfo:conInfos){
|
||||
// String customerName = conInfo.split("@")[1];
|
||||
String contractId = conInfo.split("@")[0];
|
||||
BizObjectManager bm = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME, tx);
|
||||
bm.createQuery("update O set contract_status = '105' where id = '"+contractId+"'").executeUpdate();
|
||||
SaveBusinessStatus.saveByContractId(contractId, tx, "61", jboName.getUserId(arg0, tx));
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user