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

42 lines
2.1 KiB
Java

package com.tenwa.flow;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO_TEMP;
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITCHARGE_INFO;
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITCHARGE_INFO_TEMP;
import jbo.com.tenwa.entity.comm.flow.D_DEPOSITRETURN_INFO_TEMP;
import com.amarsoft.are.jbo.BizObject;
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 CopyDChargeTempToFormal extends BaseBussiness{
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String flowunid = this.getAttribute("ObjectNo").toString();
String id = this.getAttribute("ProjectId").toString();
String DistributorNo = this.getAttribute("DistributorNo").toString();
Map<String,String> fromCondtion = new HashMap<String,String>();
fromCondtion.put("FLOWUNID",flowunid);
Map<String,String> otherProperty = new HashMap<String,String>();
DataOperatorUtil.copySingleJBO(D_DEPOSITCHARGE_INFO_TEMP.CLASS_NAME, fromCondtion, D_DEPOSITCHARGE_INFO.CLASS_NAME, null, otherProperty, Sqlca);
BizObject dibo = JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO_TEMP.CLASS_NAME, Sqlca).createQuery("flowunid=:flowunid").setParameter("flowunid",flowunid).getSingleResult(false);
BizObject deit = JBOFactory.createBizObjectQuery(D_DEPOSITCHARGE_INFO_TEMP.CLASS_NAME, "flowunid=:flowunid").setParameter("flowunid",flowunid).getSingleResult(false);
String num = dibo.getAttribute("TOTAL")==null?"0":dibo.getAttribute("TOTAL").getString();//.getString();
BigDecimal total = new BigDecimal(num==""?"0":num);
BigDecimal cautionMoney = new BigDecimal(deit.getAttribute(D_DEPOSITRETURN_INFO_TEMP.CAUTION_MONEY).getString());
double num1 = total.add(cautionMoney).doubleValue();
JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO.CLASS_NAME,Sqlca).createQuery("update o set TOTAL='"+num1+"' where distributor_no='"+DistributorNo+"'").executeUpdate();
return "true";
}
}