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 fromCondtion = new HashMap(); fromCondtion.put("FLOWUNID",flowunid); Map otherProperty = new HashMap(); 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("SUMS")==null?"0":dibo.getAttribute("SUMS").getString();//.getString(); BigDecimal sums = new BigDecimal("".equals(num)?"0":num); BigDecimal cautionMoney = new BigDecimal(deit.getAttribute(D_DEPOSITRETURN_INFO_TEMP.CAUTION_MONEY).getString()); double num1 = sums.add(cautionMoney).doubleValue(); JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO.CLASS_NAME,Sqlca).createQuery("update o set SUMS='"+num1+"' where distributor_no='"+DistributorNo+"'").executeUpdate(); return "true"; } }