客户修改同步更新税务信息购买方名称

This commit is contained in:
sun 2025-06-27 15:01:50 +08:00 committed by mzr
parent 015754a403
commit 669855735c
1 changed files with 38 additions and 0 deletions

View File

@ -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);
}
}
}
}