用友nc65 uap开发 nc.vo.bd.meta.BatchOperateVO(批量操作的包装VO)转aggvo

来源:互联网 发布:python编程入门下载 编辑:程序博客网 时间:2024/06/05 05:18
用友nc65 uap开发 nc.vo.bd.meta.BatchOperateVO(批量操作的包装VO)转aggvo
1.目标:调用BatchOperateVO进行增删改查操作,需要对该vo中的某几个字段进行操作。此案例就是要在增加和修改时进行code唯一性校验,此时我们就要取出vo。
2.源代码
public class H303110120MaintainImpl extends AceH303110120PubServiceImplimplements IH303110120Maintain {@Overridepublic Extracttype[] query(IQueryScheme queryScheme) throws BusinessException {return super.pubquerybasedoc(queryScheme);}@Overridepublic BatchOperateVO batchSave(BatchOperateVO batchVO) throws BusinessException {BatchSaveAction<Extracttype> saveAction = new BatchSaveAction<Extracttype>();BatchOperateVO retData = saveAction.batchSave(batchVO);return retData;}
3.我们要对BatchOperateVO转换为aggvo或者vo
//zl  唯一性校验IUnique service=NCLocator.getInstance().lookup(IUnique.class);Pactendc[] dvd = null;if(batchVO.getAddObjs()!=null&&batchVO.getAddObjs().length>0 ){if (batchVO.getAddObjs()[0] instanceof Pactendc) {Object[] aggDvd =batchVO.getAddObjs();dvd = new Pactendc[aggDvd.length] ;for(int i=0;i<aggDvd.length;i++){dvd[i] = ((Pactendc)aggDvd[i]);}}}//修改if(batchVO.getUpdObjs()!=null&&batchVO.getUpdObjs().length>0 ){if (batchVO.getUpdObjs()[0] instanceof Pactendc) {Object[] aggDvd =batchVO.getUpdObjs();dvd = new Pactendc[aggDvd.length] ;for(int i=0;i<aggDvd.length;i++){dvd[i] = ((Pactendc)aggDvd[i]);}}}if (dvd!=null) {boolean bool=service.checkUnique("fdc_pr_myzulx", dvd[0].getAttributeValue("code"),dvd[0].getAttributeValue("pk_group"),dvd[0].getAttributeValue("pk_org"));if (bool) {ExceptionUtils.wrappBusinessException("提示:违反唯一性约束,已存在该编码:"+dvd[0].getAttributeValue("code"));}}



0 0