package com.tenwa.reckon.handler; import jbo.app.tenwa.customer.DISTRIBUTOR_ACCOUNT_LOG; import jbo.app.tenwa.customer.DISTRIBUTOR_ACCOUNT_TEMP; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.BizObjectQuery; import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.are.util.StringFunction; import com.amarsoft.awe.dw.handler.impl.CommonHandler; public class DistributorAccountLogHandler extends CommonHandler{ DistributorAccountLogEntity A = new DistributorAccountLogEntity(); DistributorAccountLogEntity UAfter = new DistributorAccountLogEntity(); DistributorAccountLogEntity UBfore = new DistributorAccountLogEntity(); //KKK经销商日志(新增/修改)通用方法 public String distributorLogUtilAddAndUpdate(JBOTransaction tx , DistributorAccountLogEntity dale ) throws JBOException{ //KKK增加经销商增删改日志 BizObjectManager bomPL = JBOFactory.getBizObjectManager(DISTRIBUTOR_ACCOUNT_LOG.CLASS_NAME, tx); BizObject boPL = bomPL.newObject(); boPL.setAttributeValue("DISTRIBUTOR_ID", dale.getDistributorId()); boPL.setAttributeValue("ACTION_TYPE", dale.getActionType()); boPL.setAttributeValue("TIMESTAMP", dale.getTimestamp()); boPL.setAttributeValue("ACC_NUMBER", dale.getAccNumber()); boPL.setAttributeValue("ACCOUNT", dale.getAccount()); boPL.setAttributeValue("IS_MAIN", dale.getIsMain()); boPL.setAttributeValue("ACC_INFO", dale.getAccInfo()); boPL.setAttributeValue("OPEN_BANK", dale.getOpenBank()); boPL.setAttributeValue("PROVINCE", dale.getProvince()); boPL.setAttributeValue("DISTRICT", dale.getDistrict()); bomPL.saveObject(boPL); return "logOK"; } /*@Override protected void beforeInsert(JBOTransaction tx, BizObject bo) throws Exception {//增加前 DistributorAccountLogEntity daLogEntity = new DistributorAccountLogEntity(); daLogEntity.setDistributorId(bo.getAttribute("DISTRIBUTOR_ID").getString()); daLogEntity.setActionType("A"); daLogEntity.setTimestamp(StringFunction.getTodayNow()); daLogEntity.setAccNumber(bo.getAttribute("ACC_NUMBER").getString()); daLogEntity.setAccount(bo.getAttribute("ACCOUNT").getString()); daLogEntity.setIsMain(bo.getAttribute("IS_MAIN").getString()); daLogEntity.setAccInfo(bo.getAttribute("ACC_INFO").getString()); daLogEntity.setOpenBank(bo.getAttribute("OPEN_BANK").getString()); daLogEntity.setProvince(bo.getAttribute("PROVINCEINFO").getString()); daLogEntity.setDistrict(bo.getAttribute("DISTRICT").getString()); distributorLogUtilAddAndUpdate(tx,daLogEntity); }*/ @Override protected void afterInsert(JBOTransaction tx, BizObject bo) throws Exception {//增加后 DistributorAccountLogEntity daLogEntity = new DistributorAccountLogEntity(); daLogEntity.setDistributorId(bo.getAttribute("DISTRIBUTOR_ID").getString()); daLogEntity.setActionType("A"); daLogEntity.setTimestamp(StringFunction.getTodayNow()); daLogEntity.setAccNumber(bo.getAttribute("ACC_NUMBER").getString()); daLogEntity.setAccount(bo.getAttribute("ACCOUNT").getString()); daLogEntity.setIsMain(bo.getAttribute("IS_MAIN").getString()); daLogEntity.setAccInfo(bo.getAttribute("ACC_INFO").getString()); daLogEntity.setOpenBank(bo.getAttribute("OPEN_BANK").getString()); daLogEntity.setProvince(bo.getAttribute("provinceInfo").getString()); daLogEntity.setDistrict(bo.getAttribute("DISTRICT").getString()); distributorLogUtilAddAndUpdate(tx,daLogEntity); } @Override protected void beforeUpdate(JBOTransaction tx, BizObject bo) throws Exception {//修改前 BizObjectManager bomPL = JBOFactory.getBizObjectManager(DISTRIBUTOR_ACCOUNT_TEMP.CLASS_NAME, tx); BizObject boPL = bomPL.newObject(); BizObjectQuery boq = bomPL.createQuery( "select distributor_id,acc_number,account,is_main,acc_info,open_bank,provinceInfo,district FROM O WHERE id=:ID"); boq.setParameter("ID",bo.getAttribute("id").getString()); boPL = boq.getSingleResult(); UBfore.setDistributorId(boPL.getAttribute("DISTRIBUTOR_ID")+""); UBfore.setActionType("UB"); UBfore.setTimestamp(StringFunction.getTodayNow()); UBfore.setAccNumber(boPL.getAttribute("ACC_NUMBER")+""); UBfore.setAccount(boPL.getAttribute("ACCOUNT")+""); UBfore.setIsMain(boPL.getAttribute("IS_MAIN")+""); UBfore.setAccInfo(boPL.getAttribute("ACC_INFO")+""); UBfore.setOpenBank(boPL.getAttribute("OPEN_BANK")+""); UBfore.setProvince(boPL.getAttribute("PROVINCEINFO")+""); UBfore.setDistrict(boPL.getAttribute("DISTRICT")+""); UBfore.setDistributorId(bo.getAttribute("DISTRIBUTOR_ID").getString()); distributorLogUtilAddAndUpdate(tx,UBfore); } @Override protected void afterUpdate(JBOTransaction tx, BizObject bo) throws Exception {//修改后 UAfter.setDistributorId(bo.getAttribute("DISTRIBUTOR_ID").getString()); UAfter.setActionType("UA"); UAfter.setTimestamp(StringFunction.getTodayNow()); UAfter.setAccNumber(bo.getAttribute("ACC_NUMBER").getString()); UAfter.setAccount(bo.getAttribute("ACCOUNT").getString()); UAfter.setIsMain(bo.getAttribute("IS_MAIN").getString()); UAfter.setAccInfo(bo.getAttribute("ACC_INFO").getString()); UAfter.setOpenBank(bo.getAttribute("OPEN_BANK").getString()); UAfter.setProvince(bo.getAttribute("provinceInfo").getString()); UAfter.setDistrict(bo.getAttribute("DISTRICT").getString()); distributorLogUtilAddAndUpdate(tx,UAfter); } }