diff --git a/uapbd/src/private/nccloud/api/uapbd/customer/listener/CusttaxUpdateListener.java b/uapbd/src/private/nccloud/api/uapbd/customer/listener/CusttaxUpdateListener.java new file mode 100644 index 0000000..a43bd90 --- /dev/null +++ b/uapbd/src/private/nccloud/api/uapbd/customer/listener/CusttaxUpdateListener.java @@ -0,0 +1,38 @@ +package nccloud.api.uapbd.customer.listener; + +import nc.bs.businessevent.IBusinessEvent; +import nc.bs.businessevent.IBusinessListener; +import nc.bs.businessevent.bd.BDCommonEvent; +import nc.bs.trade.business.HYPubBO; +import nc.vo.bd.cust.CustomerVO; +import nc.vo.bd.cust.custtax.CusttaxVO; +import nc.vo.pub.BusinessException; + +public class CusttaxUpdateListener implements IBusinessListener{ + + @Override + public void doAction(IBusinessEvent event) throws BusinessException { + HYPubBO bo = new HYPubBO(); + BDCommonEvent e = (BDCommonEvent) event; + if(e.getObjs().length>1) { + return; + } + CustomerVO newobjs = (CustomerVO) e.getObjs()[0]; + CustomerVO oldobjs = (CustomerVO) e.getOldObjs()[0]; + + String newname = newobjs.getName(); + String oldname = oldobjs.getName(); + if(oldname!=null && !oldname.equals(newname)) { + CusttaxVO[] vos = (CusttaxVO[])bo.queryByCondition(CusttaxVO.class, "pk_customer = '"+oldobjs.getPrimaryKey()+"'"); + if(vos.length>0) { + for(CusttaxVO vo: vos) { + vo.setBuyername(newname); + vo.setStatus(1); + } + bo.updateAry(vos); + } + + } + } + +}