@Override public void initConditons(String pk_template, CpGzConditionVO[] conditions) throws TplBusinessException { try { BaseDAO dao = new BaseDAO(); // List<CpQueryConditionVO> list = (List<CpQueryConditionVO>) // dao.retrieveByClause(CpQueryConditionVO.class, "pkTemplet='" + pk_template + "'"); // Iterator<CpQueryConditionVO> it = list.iterator(); dao.deleteByClause(CpGzConditionVO.class, "pk_gz_template='" + pk_template + "'"); if (null != conditions) dao.insertVOArray(conditions); } catch (DAOException e) { LfwLogger.error(e); throw new TplBusinessException(e.getMessage(), e); } }
/** * 复写查询表体数据函数 * * @user zhengcy * @datetime 2009-12-16上午11:45:14 * @see * nc.lfw.billtemplate.delegator.deft.DefaultBusinessDelegator#queryBodyAllData(nc.md.model.IBusinessEntity, * java.lang.String, java.lang.String, java.lang.String, nc.lfw.data.PaginationInfo) */ public NCObject[] queryBodyAllData( IBusinessEntity arg0, String arg1, String arg2, String arg3, PaginationInfo arg4) throws BusinessException { BaseDAO dao = new BaseDAO(); if (arg3 != null && arg3.trim().length() > 0) { String[] contions = arg3.split("and"); if (contions.length == 3 || contions.length == 4) { String type = contions[2]; String types[] = type.split("="); if (types.length == 2) { if (types[0].trim().equals("type")) { IContractQueryService service = (IContractQueryService) NCLocator.getInstance().lookup(IContractQueryService.class); List<ProdPriceRepoVO> list = service.queryQuoteInfo1( new String[] {contions[0].split("=")[1], contions[1].split("=")[1]}); if (list != null && list.size() > 0) { return Ds2NCObjectUtil.wrapVOsToNCObjects(list.toArray(new ProdPriceRepoVO[0])); } else { return new NCObject[0]; } } else if (types[0].trim().equals("ghtype")) { // 编辑状态下获取价格列表的方法,避免刷新之后数据出错。 IContractQueryService service = (IContractQueryService) NCLocator.getInstance().lookup(IContractQueryService.class); List<ProdPriceRepoVO> list = service.queryQuoteInfo1( new String[] {contions[0].split("=")[1], contions[1].split("=")[1]}); if (list != null && list.size() > 0) { if (contions != null && contions.length > 0) { for (String ss : contions) { if (ss.indexOf("pk_ht_contract") != -1) { arg3 = ss; } } } if (arg3.indexOf("pk_ht_contract") != -1) { String pk = arg3.split("=")[1]; pk = pk.trim().substring(1, 21); for (ProdPriceRepoVO vo : list) { vo.setPk_ht_contract(pk); } dao.deleteByClause(ProdPriceRepoVO.class, "pk_ht_contract='" + pk + "'"); dao.insertVOArray(list.toArray(new ProdPriceRepoVO[0])); String className = arg0.getFullClassName(); // 协议价格库过滤出所属合同的信息 wangye if ("nc.vo.ebscg.htcontract.ProdPriceRepoVO".equals(className)) { arg3 += " and isnull(contract_info,0)=0 "; } // 调用默认的表体查询方法 return super.queryBodyAllData(arg0, arg1, arg2, arg3, arg4); } else { return new NCObject[0]; } // return Ds2NCObjectUtil.wrapVOsToNCObjects(list.toArray(new ProdPriceRepoVO[0])); } else { return new NCObject[0]; } } } } } if (arg3.indexOf("pk_ht_contract") == -1 && arg3.indexOf("bill_id") == -1) { // 根据采购方案主键和供应商主键查询表体数据 String[] strWhere = arg3.split("="); IContractQueryService service = (IContractQueryService) NCLocator.getInstance().lookup(IContractQueryService.class); List<ProdPriceRepoVO> list = service.queryQuoteInfo(strWhere); if (list != null && list.size() > 0) { return Ds2NCObjectUtil.wrapVOsToNCObjects(list.toArray(new ProdPriceRepoVO[0])); } else { return new NCObject[0]; } } else { String className = arg0.getFullClassName(); // 协议价格库过滤出所属合同的信息 wangye if ("nc.vo.ebscg.htcontract.ProdPriceRepoVO".equals(className)) { arg3 += " and isnull(contract_info,0)=0 "; } else if ("nc.vo.ebscg.htcontract.ConstratMoneyPlanVO".equals(className)) { // 付款信息排序 arg3 = payAddDrWhere(arg3); ConstratMoneyPlanVO[] svo = null; NCObject[] ncobjects = null; Collection<ConstratMoneyPlanVO> con = getBaseDao().retrieveByClause(ConstratMoneyPlanVO.class, arg3); if (con != null && con.size() > 0) { ncobjects = new NCObject[con.size()]; svo = con.toArray(new ConstratMoneyPlanVO[0]); for (int i = 0; i < svo.length; i++) { ncobjects[i] = NCObject.newInstance(svo[i]); } } return ncobjects; } // 调用默认的表体查询方法 return super.queryBodyAllData(arg0, arg1, arg2, arg3, arg4); } }