apzl_leasing/src_tenwa/com/tenwa/apzl/comm/CopyLbCarLicensePlateToTemp.java

56 lines
2.7 KiB
Java

package com.tenwa.apzl.comm;
import java.util.HashMap;
import java.util.Map;
import org.springframework.expression.spel.ast.AstUtils;
import jbo.app.LB_EQUIPMENT_CAR;
import jbo.com.tenwa.lease.comm.LB_CAR_LICENSE_PLATE_INFO;
import jbo.com.tenwa.lease.comm.LB_CAR_LICENSE_PLATE_INFO_TEMP;
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.amarsoft.context.ASUser;
import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
public class CopyLbCarLicensePlateToTemp extends BaseBussiness{
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String contract_id = this.getAttribute("ContractId").toString();
String flowunid = this.getAttribute("ObjectNo").toString();
String contractNo = this.getAttribute("FlowKey").toString();
String userId = this.getAttribute("CurUserID").toString();
BizObjectManager carLicensePlateManager = JBOFactory.getBizObjectManager(LB_CAR_LICENSE_PLATE_INFO.CLASS_NAME, Sqlca);
BizObjectManager tempManager = JBOFactory.getBizObjectManager(LB_CAR_LICENSE_PLATE_INFO_TEMP.CLASS_NAME, Sqlca);
BizObject carLicensePlate = carLicensePlateManager.createQuery("contract_id=:contract_id").setParameter("contract_id", contract_id).getSingleResult(true);
if(carLicensePlate ==null){
BizObject lbEquipmentCar = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR.CLASS_NAME, "select frame_number from o where contract_id=:contract_id").setParameter("contract_id", contract_id).getSingleResult(false);
String frame_number = lbEquipmentCar.getAttribute("frame_number").toString();
BizObject tempbo = tempManager.newObject();
tempbo.setAttributeValue("frame_number", frame_number);
tempbo.setAttributeValue("contract_no", contractNo);
tempbo.setAttributeValue("FLOWUNID", flowunid);
tempbo.setAttributeValue("inputuserid", userId);
tempbo.setAttributeValue("inputtime", DateAssistant.getTodayNow());
tempbo.setAttributeValue("inputorgid", new ASUser(userId).getOrgID());
tempManager.saveObject(tempbo);
return "true";
}
Map<String,String> fromCondtion = new HashMap<String,String>();
fromCondtion.put("contract_id", contract_id);
Map<String,String> otherProperty = new HashMap<String,String>();
otherProperty.put("FLOWUNID", flowunid);
DataOperatorUtil.copySingleJBO(LB_CAR_LICENSE_PLATE_INFO.CLASS_NAME, fromCondtion, LB_CAR_LICENSE_PLATE_INFO_TEMP.CLASS_NAME, null, otherProperty, Sqlca);
return "true";
}
}