apzl_leasing/calc/com/tenwa/flow/ChangeWechatSubmitStatusVeto.java

95 lines
4.5 KiB
Java

package com.tenwa.flow;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import jbo.app.WECHAT_ADVANCE_SETTLE;
import jbo.app.WECHAT_BANKNUMBER_CHANGE;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_HIS;
import jbo.com.tenwa.entity.comm.message.BT_BUSSINESS_MESSAGE;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE;
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE_TEMP;
import jbo.sys.FLOW_OPINION;
import jbo.sys.FLOW_TASK;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
/*
* 修改微信公众号提交修改信息状态
*/
public class ChangeWechatSubmitStatusVeto extends BaseBussiness{
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String flowunid = this.getAttribute("ObjectNo").toString();
String flowName = this.getAttribute("FlowName").toString();
String ProjectId = this.getAttribute("ProjectId").toString();
BizObjectManager ftManage = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME,Sqlca);
BizObjectManager foManager = JBOFactory.getBizObjectManager(FLOW_OPINION.CLASS_NAME,Sqlca);
BizObjectManager bumManager = JBOFactory.getBizObjectManager(BT_BUSSINESS_MESSAGE.CLASS_NAME,Sqlca);
Date date1 = new Date() ; //获取系统时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); //日期格式
String date = sdf.format(date1); //将系统时间转换成上方指定类型
if("扣款信息变更审核".equals(flowName)){
BizObject ft = ftManage.createQuery(" objectno=:flowunid and phaseno='0010' ").setParameter("flowunid", flowunid).getSingleResult(false);
BizObject fo = foManager.createQuery(" SerialNo=:SerialNo ").setParameter("SerialNo", ft == null ? "" : ft.getAttribute("SerialNo").toString()).getSingleResult(false);
BizObjectManager wbcMange = JBOFactory.getBizObjectManager(WECHAT_BANKNUMBER_CHANGE.CLASS_NAME,Sqlca);
BizObject wbc = wbcMange.createQuery("flowUnid=:flowUnid " ).setParameter("flowUnid", flowunid).getSingleResult(true);
if(wbc != null){
wbc.setAttributeValue("STATUS", "否决");
wbc.setAttributeValue("flowStatus", "否决");
wbc.setAttributeValue("opinions", fo == null ? "" : fo.getAttribute("phaseopinion"));
wbcMange.saveObject(wbc);
BizObject bum = bumManager.createQuery(" id=:id").setParameter("id", wbc.getAttribute("messgeId").toString()).getSingleResult(true);
if(bum != null ){
bum.setAttributeValue("message_status", "has_process");
bum.setAttributeValue("is_read", "has_read");
bum.setAttributeValue("finish_time", date);
bum.setAttributeValue("read_time", date);
bumManager.saveObject(bum);
}
}
Map<String,String>fromCondtion=new HashMap<String, String>();
fromCondtion.put("flowunid", flowunid);
Map<String,String> otherProperty = new HashMap<String, String>();
otherProperty.put("Project_Id", ProjectId);
DataOperatorUtil.copySingleJBO(CUSTOMER_ACCOUNT_HIS.CLASS_NAME, fromCondtion, CUSTOMER_ACCOUNT.CLASS_NAME, otherProperty, null, Sqlca);
}else if ("提前结清".equals(flowName)){
BizObject ft = ftManage.createQuery(" objectno=:flowunid and phaseno='0030' ").setParameter("flowunid", flowunid).getSingleResult(false);
BizObject fo = foManager.createQuery(" SerialNo=:SerialNo ").setParameter("SerialNo", ft == null ? "" : ft.getAttribute("SerialNo").toString()).getSingleResult(false);
BizObjectManager wasMange = JBOFactory.getBizObjectManager(WECHAT_ADVANCE_SETTLE.CLASS_NAME,Sqlca);
BizObject wbc = wasMange.createQuery(" flowUnid=:flowUnid " ).setParameter("flowUnid", flowunid).getSingleResult(true);
if(wbc != null){
wbc.setAttributeValue("STATUS", "否决");
wbc.setAttributeValue("flowStatus", "否决");
wbc.setAttributeValue("opinions", fo == null ? "" : fo.getAttribute("phaseopinion"));
wasMange.saveObject(wbc);
BizObject bum = bumManager.createQuery(" id=:id").setParameter("id", wbc.getAttribute("messgeId").toString()).getSingleResult(true);
if(bum != null ){
bum.setAttributeValue("message_status", "has_process");
bum.setAttributeValue("is_read", "has_read");
bum.setAttributeValue("finish_time", date);
bum.setAttributeValue("read_time", date);
bumManager.saveObject(bum);
}
}
}
return "true";
}
}