public Map<Integer, Integer> getListPageSizeMap(QueryStructVO voQryStruct) throws BusinessException { BaseDAO dao = new BaseDAO(); List<?> objPairs = (List<?>) dao.executeQuery( voQryStruct.getPaginationConfig().getPageSizeMapSQL(), new ArrayListProcessor()); Map<Integer, Integer> pageSizeMap = new LinkedHashMap<Integer, Integer>(); Map<Integer, Queue<RowInfo>> pageRowInfoMap = new LinkedHashMap<Integer, Queue<RowInfo>>(); if (objPairs != null && !objPairs.isEmpty()) { int i = 0; RowInfo lastRowInfo = null; Queue<RowInfo> rowQueue = new ArrayBlockingQueue<RowInfo>(10); for (Object rs : objPairs) { RowInfo rowInfo = RowInfoConverter.getInstance().convert(rs); if (lastRowInfo != null && !rowInfo.getObjValue(1).equals(lastRowInfo.getObjValue(1))) { pageRowInfoMap.put(++i, rowQueue); rowQueue = new ArrayBlockingQueue<RowInfo>(10); } rowQueue.add(rowInfo); lastRowInfo = rowInfo; } pageRowInfoMap.put(++i, rowQueue); for (Integer pageIndex : pageRowInfoMap.keySet()) { pageSizeMap.put( pageIndex, PageSizeCalculater.getInstance().calulate(pageRowInfoMap.get(pageIndex))); if (pageIndex == pageRowInfoMap.size()) { // 合计 pageSizeMap.put(pageIndex, pageSizeMap.get(pageIndex) + 1); } } } return pageSizeMap; }
/** * 搜索SNvoucherF * * @param businessNum * @param customerCode * @return listContF SNvoucherF单据集合 * @throws Exception */ private List<String[]> selectF(Object[] snvoucherF2202) throws Exception { List<String[]> listContF; String mainBusinessNum = null; // 主业务单号 String voucherCode = null; // 凭证号 String year = null; // 年 if (snvoucherF2202[21] != null) { mainBusinessNum = snvoucherF2202[21].toString(); } if (snvoucherF2202[13] != null) { voucherCode = snvoucherF2202[13].toString(); } if (snvoucherF2202[25] != null) { year = snvoucherF2202[25].toString(); } String sql = "select * from SNvoucherF where [主业务单号] = '" + mainBusinessNum + "' and [凭证号] = '" + voucherCode + "' and [年] = '" + year + "'"; listContF = (List<String[]>) baseDao.executeQuery(sql, new ArrayListProcessor()); return listContF; }
protected void initPageMetaStruct() { try { BaseDAO dao = new BaseDAO(); Map<String, WebComponent> map = getPageMeta().getViewComponents().getComponentsMap(); Set<String> key = map.keySet(); String pageId = getWebContext().getParameter(ParamConstant.PAGE_ID); String sql = "select * from ebs_func_memo_item where pk_func_memo in (select pk_func_memo from ebs_func_memo where pk_func_no = '" + pageId + "' and isnull(dr,0)=0) "; List<FuncMemoItemVO> fmvo = (List<FuncMemoItemVO>) dao.executeQuery(sql, new BeanListProcessor(FuncMemoItemVO.class)); for (Iterator it = key.iterator(); it.hasNext(); ) { String s = (String) it.next(); if (s != null && s.length() > 0) { if (s.lastIndexOf("_form") > -1) { FormComp form = (FormComp) getPageMeta().getViewComponents().getComponentById(s); for (int i = 0; i < fmvo.size(); i++) { FormElement fm = form.getElementById(fmvo.get(i).getFunc_field()); if (fm != null) { if (fmvo.get(i).getFunc_field_memo() != null) { fm.setShowTile(fmvo.get(i).getFunc_field_memo()); } } } } } // else if(s.lastIndexOf("_grid")>-1){ // // GridComp gc = (GridComp)getPageMeta().getViewComponents().getComponentById(s); // for(int i = 0; i < fmvo.size(); i++){ // GridColumn gcol = (GridColumn)gc.getColumnByField(fmvo.get(i).getFunc_field()); // gcol.setShowtitle(fmvo.get(i).getFunc_field_memo()); // if(gcol == null){ // gcol.setShowtitle("注释测试 "); // } // } // } } } catch (Exception e) { e.printStackTrace(); Logger.error(e.getMessage(), e); } super.initPageMetaStruct(); }
/** * 覆写方法:初始化所有数据 * * @return * @throws LfwBusinessException * @see nc.vo.ebscg.xydowmload.service.IDownloadService#getDown() */ public List<XyDowmloadVO> getDown() throws LfwBusinessException { // TODO Auto-generated method stub String sql = "select * from ebs_xy_down_file_sign isnull(dr, 0)=0"; try { List<XyDowmloadVO> list = (List<XyDowmloadVO>) baseDao.executeQuery(sql, new BeanListProcessor(XyDowmloadVO.class)); System.out.println(list); return list; } catch (DAOException e) { // TODO Auto-generated catch block Logger.error(e.getMessage(), e); e.printStackTrace(); throw new LfwBusinessException("没有查询到数据", e); } }
public int getNextID(String pk_baseinfo) throws BusinessException { BaseDAO dao = new BaseDAO(); Object curNum = dao.executeQuery( "select max(serialnum) from fbm_action where isnull(dr,0)=0 and pk_baseinfo='" + pk_baseinfo + "'", new ColumnProcessor()); if (curNum == null) { return 1; } else { return ((Integer) curNum).intValue() + 1; } }
private String getErrorMsg(String[] paramArray, String pk_field) throws BusinessException { StringBuffer sqlBuffer = new StringBuffer(); String tableName = paramArray[0]; String fieldName = paramArray[1]; String commonCondition = paramArray[2]; String errMsg = paramArray[3]; sqlBuffer.append("select " + fieldName + " from " + tableName + " where "); sqlBuffer.append(fieldName + " ='" + pk_field + "' "); sqlBuffer.append(" and " + commonCondition); BaseDAO baseDAO = new BaseDAO(); List list = (List) baseDAO.executeQuery(sqlBuffer.toString(), new ColumnListProcessor()); if (list != null && list.size() > 0) { return errMsg; } return null; }
// 季凌峰 2012/11/5 采购方案执行 询价 查询状态为已经完成的数据 public String dealbutton() throws DAOException { BaseDAO dao = new BaseDAO(); String pk_xy_proj_main = getWebContext().getParameter("pk_xy_proj_main"); String dosql = "select * from ebs_xy_step_exec_state s where s.step_id='3' and pk_xy_proj_main='" + pk_xy_proj_main + "' "; List<StepExecStateVO> dofines = (List<StepExecStateVO>) dao.executeQuery(dosql, new BeanListProcessor(StepExecStateVO.class)); if (dofines != null) { if ("2".equals(dofines.get(0).getStep_status().toString())) { return "Y"; } } return null; }
/* * (非 Javadoc) * * @see nc.bs.erp.receipt.ace.bp.ExendReceiptInsertimpl#auto_send() */ @SuppressWarnings("unchecked") public void auto_send() throws Exception { ExtendInsertServiceBP eisbp = new ExtendInsertServiceBP(); // 新增Agg集合 String sql = "SELECT * FROM SNvoucherF WHERE [业务员] = '甘健锋' AND 年 = '2014'; "; List<String[]> listCont = (List<String[]>) baseDAO.executeQuery(sql, new ArrayListProcessor()); List<AbstractBill> billss = eisbp.getExtendInsertBill( listCont, CostsHVO.class.getName(), CostsBVO.class.getName(), AggCostsHVO.class.getName()); // 把Agg集合转化为VO数组 AggCostsHVO[] bills = billss.toArray(new AggCostsHVO[0]); // 把VO数组持久化 receiptInsert.insert(bills); // eisbp.uploadJL(CostsHVO.class.getName(), listCont); }
// ---------------------- public String sdbSyn() throws LfwBusinessException { WebContext ctx = getWebContext(); String pk_xy_step_pub = ctx.getParameter("pk_xy_step_pub"); String pk_xy_proj_main = ctx.getParameter("pk_xy_proj_main"); String success = "ok"; String operatorID = LfwRuntimeEnvironment.getUserVO().getPrimaryKey(); BaseDAO dao = new BaseDAO(); try { String sqlb = "select * from ebs_xy_projexec_personjzx where ( discard_status != '3' or discard_status is null ) and zdy3 ='" + pk_xy_step_pub + "' and pk_person in " + "(select pk_psndoc from bd_psndoc where pk_psnbasdoc in " + "(select pk_psndoc from sm_userandclerk where userid = '" + operatorID + "'))"; List<ProjGroupVO> listb = (List<ProjGroupVO>) dao.executeQuery(sqlb, new BeanListProcessor(ProjGroupVO.class)); if (listb != null && listb.size() > 0) { ProjGroupVO pcg = listb.get(0); String judgment = pcg.getZdy1(); if ("是".equals(judgment)) { success = "N"; } else { pcg.setZdy1("是"); dao.updateVO(pcg, new String[] {"zdy1"}); } } else { success = "你不属于采购小组人员或者采购小组人员变化了,请重新打开采购执行界面!"; } } catch (Exception e) { Logger.error("签到失败"); Logger.error(e.getMessage(), e); success = "签到失败"; } return success; }
/** * 搜索F2202 * * @param String 业务单号 * @param String 客户编码 * @return listContF2202 SNvoucherF2202单据 */ private List<String[]> selectF2202(Object[] snvoucherSYF) throws Exception { List<String[]> listContF2202; String businessNum = null; // 业务单号 String customerCode = null; // 客户编码 if (snvoucherSYF[19] != null && snvoucherSYF[9] != null) { businessNum = snvoucherSYF[19].toString(); customerCode = snvoucherSYF[9].toString(); // } // if(snvoucherSYF[9] != null){ // customerCode = snvoucherSYF[9].toString(); // } String sql = "select * from SNvoucherF2202 where [业务单号] = '" + businessNum + "'" + "and [客户编码] = '" + customerCode + "'"; listContF2202 = (List<String[]>) baseDao.executeQuery(sql, new ArrayListProcessor()); return listContF2202; } return null; }
public void split(String where) throws BusinessException, Exception { insertBP = new ExchangeSplitSYFMap(); // 杰思的拆分类 String reson_billno = "业务单号为空,不用处理"; String reson_month = "月份为空,不用处理"; String sql = "select * " + where + " and 产品 <> '快递'"; // 正式代码 // sql = "select * from SNvoucherSYF where 业务单号='CJSZE140102028'";//测试代码 // sql = "select * from SNvoucherSYF where 单据编号 in // ('00000000002069461362','00000000002069461111')";//测试代码 List<String[]> listSYF; // 存放从南北取出来的数据 List<AggExchangeSyfHVO> syfBills = new ArrayList<AggExchangeSyfHVO>(); // 等于SYF的条数 // List<ExchangeSyfBVO> syfBvoBills = new ArrayList<ExchangeSyfBVO>();// 表体数=F的条数*3 List<AggExchangeAssistSyfHVO> assistBills = new ArrayList<AggExchangeAssistSyfHVO>(); // 辅单 List<AggSplitFail> aggSplitFailBills = new ArrayList<AggSplitFail>(); // 不处理的单据,失败单 listSYF = (List<String[]>) baseDao.executeQuery(sql, new ArrayListProcessor()); int count = 0; List<String[]> listF2202 = null; List<String[]> listF = null; for (Object[] objSYF : listSYF) { if (SellDate == null) { SellDate = new UFDate( sdf.parse(objSYF[23].toString() + "-" + objSYF[24].toString() + "-01 00:00:00")); } SYF_Bill_no = objSYF[1].toString(); count = count + 1; PK_Subject_orientation = getSubject_orientation(objSYF); local_total = 0.00; origin = Double.valueOf(objSYF[14].toString()); local = Double.valueOf(objSYF[15].toString()); balance_origin = origin; // 针对每一张单开始拆分的时候,先记录一下,拆分的时候要用,看CountByPercent方法 balance_local = local; // 针对每一张单开始拆分的时候,先记录一下,拆分的时候要用,看CountByPercent方法 if (objSYF[19].equals(" ") || objSYF[19] == null) { // 不拆分,直接将记录插入到数据表中 AggSplitFail aggsfvo = RecordSplitFail(objSYF, reson_billno); aggSplitFailBills.add(aggsfvo); continue; } if (objSYF[24] == null) { // 月份为0的请不用处理。 AggSplitFail aggsfvo = RecordSplitFail(objSYF, reson_month); aggSplitFailBills.add(aggsfvo); continue; } // 2015-08-17改为判断每一条F // /** // * 直接照搬: 1、产品为海整、快递的不用进行拆分,直接照搬。放在AggExchangegalCostHVO // * 2、主业务单元为订舱公司2、香港天尚2、深圳天尚2 放在AggExchangegalCostHVO 3、业务员部门为 // * 深圳天尚、香港天尚 、 订舱公司 的,bcode改为 对应名称,放在AggExchangegalCostHVO // * // * */ // if (CopyOrNot(objSYF)) { // AggExchangeSyfHVO bill_copy = CopyWithoutSplit(objSYF); // syfBills.add(bill_copy); // continue; // } // 找F2202表 listF2202 = selectF2202(objSYF); // 找F表 if (listF2202 != null && listF2202.size() > 0) { listF = selectF(listF2202.get(0)); // if(listF.size() == 0 ){ // //按照不拆分处理: // AggExchangeSyfHVO bill_copy = CopyWithoutSplit(objSYF); // syfBills.add(bill_copy); // continue; // } listF_size = listF.size(); } else { continue; } // 计算出F的本币总金额 for (Object[] objF : listF) { // String billno = objF[1].toString();//单据编号 // String BusinessNum = objF[20].toString();//业务单号 // String mainBusinessNum = objF[21].toString();//主业务单号 // Double origin = Double.valueOf(objF[15].toString());// 15原币金额 Double localF = Double.valueOf(objF[16].toString()); // 16本币金额 local_total = local_total + localF; } // 计算比例,并且保存 percentList = new ArrayList<Double>(); for (Object[] objF : listF) { Double local = Double.valueOf(objF[16].toString()); Double percent = local / local_total; percentList.add(percent); } // 进行拆分: AggExchangeSyfHVO aggsyfvo = new AggExchangeSyfHVO(); ExchangeSyfHVO syfHVO; if (CopyOrNot(objSYF)) { // 不拆分 syfHVO = notSplitSyfHVO(objSYF); SYF_Sellnum = syfHVO.getSellnumber(); SYF_pk_product = syfHVO.getProduct(); } else { // 拆分 syfHVO = SplitToSyfHVO(objSYF); SYF_Sellnum = syfHVO.getSellnumber(); SYF_pk_product = syfHVO.getProduct(); } aggsyfvo.setParent(syfHVO); List<ExchangeSyfBVO> syfBvoBills = new ArrayList<ExchangeSyfBVO>(); // 表体数=F的条数*3 for (int indexOflistF = 0; indexOflistF < listF.size(); indexOflistF++) { Object[] objF = listF.get(indexOflistF); origin_temp = roundHalfUp(CountByPercent(origin, indexOflistF, 0)); // origin * 比例得到中间结果 local_temp = roundHalfUp(CountByPercent(local, indexOflistF, 1)); // local * 比例得到中间结果 // ----- if (CopyOrNot_bvo(objF)) { // F不需要442拆分 ExchangeSyfBVO bvo = copyWithoutSplitToSyfBvo(objF); syfBvoBills.add(bvo); // 拆分到辅组织汇兑损益应付单 AggExchangeAssistSyfHVO aggAssistStart = notSplitAssistSyfHVO(objF, bvo); assistBills.add(aggAssistStart); } else { // F需要442拆分: if ("PP".equals(objF[12]) || "月结".equals(objF[12])) { // // 结算方式为PP,月结时,挂在业务员 // 拆分过程,需要用到的变量 origin_start = roundHalfUp(origin_temp * 0.4); origin_def_count = roundHalfUp(origin_temp * 0.1); origin_sellman = origin_def_count * 2; origin_des = roundHalfUp(origin_temp - origin_start - origin_sellman); local_start = roundHalfUp(local_temp * 0.4); local_def_count = roundHalfUp(local_temp * 0.1); local_sellman = local_def_count * 2; local_des = roundHalfUp(local_temp - local_start - local_sellman); // 拆分到汇兑损益应付单 List<ExchangeSyfBVO> syfBvos = splitToSyfBvos(objSYF, objF); // 根据一条F拆分出3条表体记录 syfBvoBills.addAll(syfBvos); // 增加3条 // 拆分到辅组织汇兑损益应付单-始发地: AggExchangeAssistSyfHVO aggAssistStart = SplitToAssistSyfStart(objF, objSYF); assistBills.add(aggAssistStart); // 拆分到辅组织汇兑损益应付单-目的地: AggExchangeAssistSyfHVO aggAssistDes = SplitToAssistSyfDes(objF, objSYF); assistBills.add(aggAssistDes); } else { // 挂在目的地 origin_start = roundHalfUp(origin_temp * 0.4); origin_def_count = roundHalfUp(origin_temp * 0.2); origin_des = origin_def_count * 2; origin_sellman = roundHalfUp(origin_temp - origin_start - origin_des); // double相减有误差 local_start = roundHalfUp(local_temp * 0.4); local_def_count = roundHalfUp(local_temp * 0.2); local_des = local_def_count * 2; local_sellman = roundHalfUp(local_temp - local_start - local_des); // 拆分到汇兑损益应付单 List<ExchangeSyfBVO> syfBvos = splitToSyfBvos(objSYF, objF); // 根据一条F拆分出3条表体记录 syfBvoBills.addAll(syfBvos); // 增加3条 // 拆分到辅组织汇兑损益应付单-始发地: AggExchangeAssistSyfHVO aggAssistStart = SplitToAssistSyfStart(objF, objSYF); assistBills.add(aggAssistStart); // 拆分到辅组织汇兑损益应付单-业务员: AggExchangeAssistSyfHVO aggAssistSellMan = SplitToAssistSyfSellMan(objF, objSYF); assistBills.add(aggAssistSellMan); } } // ------ // 减去余额: balance_origin = balance_origin - origin_temp; balance_local = balance_local - local_temp; } // FOR F 遍历结束 // 将生成的syf表体记录放进syfhvo ExchangeSyfBVO[] syfbvostemp = syfBvoBills.toArray(new ExchangeSyfBVO[0]); // 转换成数组 aggsyfvo.setChildren(ExchangeSyfBVO.class, syfbvostemp); // 一条汇兑损益应付单(表头+表体) syfBills.add(aggsyfvo); // 将syfHVO放进list中 } // for SYF遍历结束 // 保存: // 保存 汇兑损益应付单 AggExchangeSyfHVO[] aggSyfVOs = syfBills.toArray(new AggExchangeSyfHVO[0]); if (aggSyfVOs.length > 0) { // if (aggvos[0] != null) { AceExchangeSyfInsertBP insertBP = new AceExchangeSyfInsertBP(); insertBP.insert(aggSyfVOs); } // 保存 辅组织汇兑损益应付单 AggExchangeAssistSyfHVO[] aggAssistSyfVOs = assistBills.toArray(new AggExchangeAssistSyfHVO[0]); if (aggAssistSyfVOs.length > 0) { // if (aggvos[0] != null) { AceExchangeAssistSyfInsertBP insertBP = new AceExchangeAssistSyfInsertBP(); insertBP.insert(aggAssistSyfVOs); } }
@Override protected NCObject[] doBillLoad(IBusinessEntity entity) throws BusinessException { // 采购方案主键 // 这里需要从其他地方来获取现在使用默认值,当业务真正的串联时需要统一获取 String pk_proj_main = this.getWebContext().getParameter("projectPk"); // 采购方案模板环节执行主键ID String pk_xy_step_exec_state = this.getWebContext().getParameter("stepId"); // 点击开启来源 String open_source = this.getWebContext().getParameter("open_source"); // 发布环节PK String pubPk = this.getWebContext().getParameter("pubPk"); BaseDAO dao = new BaseDAO(); try { // 获取采购小组人员信息 String sql = "select * from ebs_xy_projexec_person where pk_xy_proj_main ='" + pk_proj_main + "' "; List<ProjPersonCGVO> ppj = (List<ProjPersonCGVO>) dao.executeQuery(sql, new BeanListProcessor(ProjPersonCGVO.class)); if (ppj != null || ppj.size() > 0) { for (ProjPersonCGVO cvo : ppj) { // 每轮的采购小组数据 zdy3是发布主键 zdy5是采购小组信息每条数据的主键 String sqljzx = "select * from ebs_xy_projexec_personjzx where zdy3 = '" + pubPk + "' and zdy5= '" + cvo.getPk_xy_proj_person() + "'"; List<ProjGroupVO> ppjjzx = (List<ProjGroupVO>) dao.executeQuery(sqljzx, new BeanListProcessor(ProjGroupVO.class)); if (ppjjzx != null && ppjjzx.size() > 0) { ProjGroupVO jzx = ppjjzx.get(0); jzx.setDiscard_status(cvo.getDiscard_status()); jzx.setTicketnum(cvo.getTicketnum()); jzx.setWeight(cvo.getWeight()); jzx.setPk_corp(cvo.getPk_corp()); jzx.setPk_dept(cvo.getPk_dept()); jzx.setPk_person(cvo.getPk_person()); dao.updateVO( jzx, new String[] { "discard_status", "ticketnum", "weight", "pk_corp", "pk_dept", "pk_person" }); } else { ProjGroupVO pg = new ProjGroupVO(); pg.setDiscard_status(cvo.getDiscard_status()); pg.setPk_xy_proj_main(pk_proj_main); // pg.setPk_xy_proj_person(cvo.getPk_xy_proj_person()); pg.setPk_corp(cvo.getPk_corp()); pg.setPk_dept(cvo.getPk_dept()); pg.setPk_person(cvo.getPk_person()); pg.setZdy3(pubPk); pg.setTicketnum(cvo.getTicketnum()); pg.setWeight(cvo.getWeight()); pg.setZdy5(cvo.getPk_xy_proj_person()); dao.insertVO(pg); } } } } catch (Exception e) { Logger.error(e.getMessage(), e); } NCObject ncObj = ((OpenDelegator) this.billHandler) .doQueryOpenVOSByPK(pk_proj_main, pk_xy_step_exec_state, open_source, pubPk); NCObject[] s = null; if (pk_proj_main != null && pk_proj_main.length() > 0) { s = new NCObject[1]; s[0] = ncObj; } else { s = super.doBillLoad(entity); } return s; }
// 季凌峰 2012/12/25 附件解密 public String loupadate( String opensource, String pk_xy_proj_main, String pk_xy_pub_step, String price_type) { String keyValue = null; // 附件解密方法 Properties props = new Properties(); // 文件存放的路径。评标会解密的附件压缩 String ebsfile = ""; BaseDAO dao = new BaseDAO(); InputStream is = null; try { // 读取应用下的配置文件 String path = RuntimeEnv.getInstance().getNCHome() + File.separatorChar + "hotwebs" + File.separatorChar + "ebscg" + File.separatorChar + "WEB-INF" + File.separatorChar + "conf" + File.separatorChar + "system.properties"; is = new FileInputStream(path); props.load(is); keyValue = props.getProperty(EbsOperaitonConst.CHECK_KEY); } catch (Exception e) { Logger.error("读取系统配置错误!", e); try { if (is != null) is.close(); } catch (Exception et) { Logger.error("读取系统配置错误!", et); } } finally { try { if (is != null) is.close(); } catch (IOException e) { Logger.error("读取系统配置错误!", e); } } // 如果为1的时候则对文件解密 if (keyValue != null) { // 因为没有从js获取,没有打开界面调用数据,所以参数需要自己定义和获取。 String openvalue = "2"; // 模块类型 model_type 7门户上传附件 String modelType = "7"; // 来源单据类型 bill_type //发标应答 E059 发布应答 E05A String billType = "E059"; // 发标应答 E059 if (opensource != null && opensource.equals("0")) { billType = "E05A"; // 发布应答 E05A } // 所属单据ID bill_id 采购方案主键 String billId = pk_xy_proj_main; // 所属单据明细ID itemid 供应商确定主键 try { String sql = "select * from ebs_xy_proj_item_sup_cfm where pk_xy_proj_main = '" + pk_xy_proj_main + "' and isnull(dr,0) = 0 "; List<ProjItemSupCfmVO> sp = (List<ProjItemSupCfmVO>) dao.executeQuery(sql, new BeanListProcessor(ProjItemSupCfmVO.class)); if (sp != null && sp.size() > 0) { for (ProjItemSupCfmVO sup : sp) { // 获取每次供应商的附件 // 修改下面的方法,主要是为了取得对应的附件类型。 String sqls = "select * from ebs_da_att where model_type='" + modelType + "' and bill_type= '" + billType + "' and bill_id='" + billId + "' and itemid='" + sup.getPk_xy_proj_item_sup_cfm() + "' and zdy3='" + pk_xy_pub_step + "' and price_type in (" + price_type + ") and ISNULL(dr,0) = 0 "; List<AttVO> list = (List<AttVO>) dao.executeQuery(sqls, new BeanListProcessor(AttVO.class)); // List<AttVO> list = getOpenQueryService().getCaFileByPara(modelType, billType, billId, // sup.getPk_xy_proj_item_sup_cfm()); EbscgFileUploadHandler fileHandler = (EbscgFileUploadHandler) LfwClassUtil.newInstance(EbscgFileUploadHandler.class.getName()); if (list != null && list.size() > 0) { SignVO signvo = null; byte[] baOutPlaintext = null; for (AttVO attvo : list) { if (attvo != null && attvo.getAfter_ca() != null && attvo.getAfter_ca() == 1) { continue; } try { // 采用数据库读取文件数据 DataFileFactory dff = DataFileFactory.getInstance(); IDataBaseFileOper ibfo = dff.getFileDealServer(); byte[] content = null; content = ibfo.obtainFileMess(attvo.getPk_da_att(), "ca_content"); EncrypteDecrypte3DES des = new EncrypteDecrypte3DES(); BASE64Decoder base64 = new BASE64Decoder(); des.setKey(base64.decodeBuffer(keyValue)); des.setIv(base64.decodeBuffer("zz7cZtYpVR4=")); baOutPlaintext = des.decrypt(base64.decodeBuffer(new String(content).trim())); ibfo.updateFileMess(attvo.getPk_da_att(), baOutPlaintext, "content"); attvo.setAfter_ca(1); // 设置文档解密状态 dao.updateVO(attvo, new String[] {"after_ca"}); } catch (Exception ex) { // TODO Auto-generated catch block logger.error(ex.getMessage(), ex); return "文件解密失败"; /*throw new LfwRuntimeException("文件解密失败");*/ } } } } } } catch (Exception e) { logger.error(e.getMessage(), e); return "文件解密失败"; /*throw new LfwRuntimeException("文件解密失败");*/ } } return "ok"; }
/** 王磊2011-3-26改动,判断为空的问题 */ public NCObject write(NCObject billVO, Object userObject) throws BusinessException { // 子表修改记录时插入主表主键 // 获取AggVO BaseDAO dao = new BaseDAO(); AggReqVO aggReqVO = (AggReqVO) billVO.getContainmentObject(); if (null != aggReqVO) { // 获取主表VO ReqMainVO reqMainVO = (ReqMainVO) aggReqVO.getParentVO(); // 修改不给复制建议人的问题 String operid = reqMainVO.getPk_oper_person(); String dept = reqMainVO.getPk_dept_sug(); try { String sql = " select * from bd_psndoc where pk_deptdoc = '" + dept + "' and pk_psndoc ='" + operid + "' "; List<PsndocVO> list = (List<PsndocVO>) dao.executeQuery(sql, new BeanListProcessor(PsndocVO.class)); // psnvo = (PsndocVO)dao.retrieveByPK(PsndocVO.class, operid); if (list != null && list.size() > 0) { } else { throw new LfwRuntimeException("请不要手动填写采购经办人,你选择的建议采购部门与填写的采购经办人部门不对应,请重新选择!"); } } catch (Exception e) { throw new LfwRuntimeException("请不要手动填写采购经办人,你选择的建议采购部门与填写的采购经办人部门不对应,请重新选择!"); // Logger.error("请选择建议采购人,不要手动填写!"); // Logger.error(e.getMessage()); } String bill_code = reqMainVO.getBill_code(); if (bill_code == null || bill_code.trim().length() == 0) { bill_code = CodPlatformService.billCodeXqRep(LfwRuntimeEnvironment.getPkCorp()); reqMainVO.setBill_code(bill_code); } // 获取主表VO属性 String pk_xq_req_main = reqMainVO.getPk_xq_req_main(); if (null != pk_xq_req_main && !"".equals(pk_xq_req_main)) { // 修改保存时设置修改人和修改时间 // 修改人 reqMainVO.setModifier(LfwRuntimeEnvironment.getUserVO().getPrimaryKey()); // 修改时间为当前的系统时间 reqMainVO.setModifydate(new UFDate(System.currentTimeMillis())); // 获取所有子表VO,以数组形式返回 CircularlyAccessibleValueObject[] cavo = aggReqVO.getChildrenVO(); if (cavo != null && cavo.length > 0) { // 现在可以导入数据,导入数据时是需要把单据保存后才能进行处理,因此去掉了表体不能为空的限制 // throw new LfwRuntimeException("表体行不能为空"); for (int i = 0; i < cavo.length; i++) { // 为子表VO中的属性set主表主键 cavo[i].setAttributeValue("pk_xq_req_main", pk_xq_req_main); } } } UFDouble ufd = reqMainVO.getBuget_amount(); // boolean flag=true; CircularlyAccessibleValueObject[] cavo = aggReqVO.getChildrenVO(); UFDouble amount = new UFDouble(0); if (cavo != null && cavo.length > 0) { for (CircularlyAccessibleValueObject cav : cavo) { if (cav instanceof ReqItemProdVO) { ReqItemProdVO pvo = (ReqItemProdVO) cav; if (pvo != null) { if (pvo.getStatus() != 3) { UFDouble tAmount = pvo.getAmount(); if (tAmount != null) { amount = amount.add(tAmount); } if (tAmount.toDouble() <= 0) { throw new LfwRuntimeException("预算单价必须大于0"); } // flag= false; } } } } } /* if(flag) { throw new LfwRuntimeException("表体行不能为空"); } */ reqMainVO.setBuget_amount(amount); } return super.write(billVO, userObject); }
/** * 更新单据受理状态的方法 * * @author liweiqiang * @param key 主表的PK值 * @param btnNo 出发事件的按钮编号 2009-11-12 */ public String setAcceptStatusValue(String key, String btnNo) throws LfwBusinessException { BaseDAO dao = new BaseDAO(); try { DzcgMainAuthority dma = new DzcgMainAuthority(); if (dma.existsCloseData(key, EbsOperaitonConst.CLOSEREQCODE)) { return "此单据已经被关闭,无法进行此操作!"; } } catch (Exception e) { Logger.error( (new StringBuilder("采购申请,点击收回按钮时没有申请单数据 Pk_xq_req_main == ")).append(key).toString()); return "操作失败,请重新操作!"; } String result = null; ReqMainVO reqMainVO = new ReqMainVO(); reqMainVO.setPk_xq_req_main(key); reqMainVO.setStatus(1); ReqMainVO reqMainDeptVO = null; String fieldNames[] = { "accept_status", "modifydate", "modifier", "pk_oper_person", "pk_dept_sug", "zdy1" }; try { reqMainDeptVO = (ReqMainVO) dao.retrieveByPK(ReqMainVO.class, key); } catch (Exception e) { Logger.error( (new StringBuilder("采购申请,点击收回按钮时没有申请单数据 Pk_xq_req_main == ")).append(key).toString()); return "无法进行收回,没有找到申请单数据,请刷新后在进行操作!"; } reqMainVO.setModifydate(new UFDate(System.currentTimeMillis())); reqMainVO.setModifier(LfwRuntimeEnvironment.getUserVO().getPrimaryKey()); IReqService service = (IReqService) NCLocator.getInstance().lookup(IReqService.class); if ("998".equals(btnNo)) { Integer acceptstatus = reqMainDeptVO.getAccept_status(); Integer billstatus = reqMainDeptVO.getBillstatus(); if (acceptstatus == null || billstatus == null) { Logger.error("采购申请,点击收回按钮时没有找到正确的单据状态 acceptstatus == null, billstatus == null"); return "请刷新界面数据,在重新操作!"; } Logger.warn( (new StringBuilder("采购申请,点击收回按钮时数据状态为 acceptstatus == ")) .append(acceptstatus) .append(", billstatus == ") .append(billstatus) .toString()); switch (acceptstatus.intValue()) { case 3: // '\003' reqMainVO.setAccept_status(Integer.valueOf(1)); reqMainVO.setBillstatus(Integer.valueOf(8)); reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person()); reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug()); reqMainVO.setZdy1(reqMainDeptVO.getZdy1()); service.setReqVOValue(reqMainVO, fieldNames); return "收回成功!"; } return "只有在提交受理状态下才能收回单据"; } if (btnNo.equals("1")) { reqMainVO.setAccept_status(Integer.valueOf(2)); } else if (btnNo.equals("2")) { boolean flagTmp = false; // yanlei start 将建议采购经办人进行处理,对照转授权表。。有被授权人时,改为被授权人 try { // 获取当前方案申请记录 ArrayList<ReqMainVO> reqMainVOTmp = (ArrayList<ReqMainVO>) dao.retrieveByClause( ReqMainVO.class, " pk_xq_req_main like '" + reqMainVO.getPk_xq_req_main() + "'"); // 获取原建议采购经办人主键 // String old_pk_oper_person = // (String)((AggReqVO)ncobjects[i].getContainmentObject()).getParentVO().getAttributeValue("pk_oper_person"); String old_pk_oper_person = reqMainVOTmp.get(0).getPk_oper_person(); if (null != old_pk_oper_person && !"".equals(old_pk_oper_person)) { // 查询出被授权人人员的编码 String sqlPsnTmp = " pk_psndoc like '" + old_pk_oper_person + "'"; ArrayList<PsndocVO> psnvoTmp = (ArrayList<PsndocVO>) (dao.retrieveByClause(PsndocVO.class, sqlPsnTmp)); List<SmUserVO> asqvoTmp = (List<SmUserVO>) dao.executeQuery( "SELECT * FROM sm_user bd , sm_userandclerk sm WHERE " + " sm.pk_psndoc='" + psnvoTmp.get(0).getPk_psnbasdoc() + "' AND sm.userid = bd.cuserid", new BeanListProcessor(SmUserVO.class)); // String sqlAsTmp = " cuserid = (select userid from sm_userandclerk tttt where // tttt.pk_psndoc='"+psnvoTmp.get(0).getPk_psnbasdoc()+"'"; // ArrayList<SmUserVO> asqvoTmp = // (ArrayList<SmUserVO>)(dao.retrieveByClause(SmUserVO.class, sqlAsTmp)); String old_cuserid = asqvoTmp.get(0).getPrimaryKey(); String sqlWhere = " isnull(dr,0) = 0 and operatorid like '" + old_cuserid.toString() + "'"; ArrayList<ZsqVO> zsqvo = (ArrayList<ZsqVO>) (dao.retrieveByClause(ZsqVO.class, sqlWhere)); if (null != zsqvo && 0 != zsqvo.size()) { if ((null != zsqvo.get(0).getAuthorid()) && !old_cuserid.equals(zsqvo.get(0).getAuthorid())) { // 被授权人的人员id String new_cuserid = zsqvo.get(0).getAuthorid(); Date date1 = new Date(System.currentTimeMillis()); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); String currDateStr = df.format(date1); UFDate currDate = new UFDate(currDateStr); UFDateTime uft = new UFDateTime(System.currentTimeMillis()); UFDateTime end_date = null; if (null != zsqvo.get(0).getEnd_author()) { end_date = zsqvo.get(0).getEnd_author(); } boolean is_youxiao = false; if (null != end_date) { is_youxiao = uft.before(end_date); } boolean is_everl_author = false; if (null != zsqvo.get(0).getIs_everl_author()) { is_everl_author = zsqvo.get(0).getIs_everl_author().booleanValue(); } if (null == new_cuserid) { reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person()); reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug()); reqMainVO.setZdy1(reqMainDeptVO.getZdy1()); } else if (is_youxiao || is_everl_author) { // 查询出被授权人人员的编码 // 当被授权人为操作人员时 // List<PsndocVO> psnvo = (List<PsndocVO>)dao.executeQuery( "SELECT // bd.pk_psndoc FROM bd_psndoc bd , sm_userandclerk sm WHERE " + // " sm.userid='"+new_cuserid+"' AND sm.pk_psndoc = bd.pk_psnbasdoc", new // BeanListProcessor(PsndocVO.class)); String sqlPsn = " pk_psndoc like '" + new_cuserid + "'"; ArrayList<PsndocVO> psnvo = (ArrayList<PsndocVO>) (dao.retrieveByClause(PsndocVO.class, sqlPsn)); // String sqlUser = "******"+new_cuserid+"'"; // ArrayList<SmUserVO> asqvo = // (ArrayList<SmUserVO>)(dao.retrieveByClause(SmUserVO.class, sqlUser)); // String str_code = asqvo.get(0).getUser_code(); // String sqlPsn = " psncode like '"+str_code+"'"; // ArrayList<PsndocVO> psnvo = // (ArrayList<PsndocVO>)(dao.retrieveByClause(PsndocVO.class, sqlPsn)); // // ((AggReqVO)ncobjects[i].getContainmentObject()).getParentVO().setAttributeValue("pk_oper_person", psnvo.get(0).getPk_psndoc()); reqMainVO.setPk_oper_person(psnvo.get(0).getPk_psndoc()); reqMainVO.setPk_dept_sug(psnvo.get(0).getPk_deptdoc()); reqMainVO.setZdy1(psnvo.get(0).getPk_corp()); } else { reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person()); reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug()); reqMainVO.setZdy1(reqMainDeptVO.getZdy1()); } } else { reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person()); reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug()); reqMainVO.setZdy1(reqMainDeptVO.getZdy1()); } } else { reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person()); reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug()); reqMainVO.setZdy1(reqMainDeptVO.getZdy1()); } } else { reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person()); reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug()); reqMainVO.setZdy1(reqMainDeptVO.getZdy1()); } } catch (DAOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // yanlei end String sql = " select * from ebs_xq_req_item_prod where pk_xq_req_main ='" + key + "' and isnull(dr,0) = 0"; // 查找合同表体数据 try { List<ReqItemProdVO> list = (List<ReqItemProdVO>) dao.executeQuery(sql, new BeanListProcessor(ReqItemProdVO.class)); if (list == null || list.size() <= 0) { return "表体数据无数据!"; } } catch (Exception e) { } reqMainVO.setAccept_status(Integer.valueOf(3)); if (flagTmp) reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person()); // 申请人 String pk_persom = reqMainDeptVO.getOperatorid(); // 申请处理人 // yanlei start 当未授权时,发件人为原处理人,有授权人时,发件人变为被授权人 String pk_oper_person = reqMainVO.getPk_oper_person(); String psnname = ""; String email = ""; String person = ""; String email_s = ""; String dianhua = ""; String deptName = ""; DzcgMainAuthority dma = new DzcgMainAuthority(); try { // 获取人员管理档案信息 PsndocVO pvo = dma.getPsndocByPk(pk_oper_person); PsndocVO pdvo = dma.getPsndocVO(pk_persom); DeptdocVO dept = dma.getDeptInfo(reqMainDeptVO.getPk_dept()); if (pvo != null) { // 处理人员 psnname = pvo.getPsnname(); PsnbasdocVO pbvo = null; pbvo = dma.getPsnbasdocVOByPk(pvo.getPk_psnbasdoc()); if (pbvo != null) { // 处理人邮箱 email = pbvo.getEmail(); } } if (dept != null) { deptName = dept.getDeptname(); } if (pdvo != null) { // 申请人名称 person = pdvo.getPsnname(); PsnbasdocVO pcvo = null; pcvo = dma.getPsnbasdocVOByPk(pdvo.getPk_psnbasdoc()); if (pcvo != null) { // 申请人电话邮箱 email_s = pcvo.getEmail(); dianhua = pcvo.getMobile(); } } } catch (Exception e) { Logger.error("采购申请提交受理,发送email时获取人员档案信息失败!"); Logger.error(e.getMessage()); } // ---zhoqui--修改邮件发送内容--- String title = "新的采购项目等待您处理"; StringBuffer mail = new StringBuffer( psnname + ":<br> 电子采购系统(需求受理)中有新的采购项目等待您处理。<br> 项目名称【"); mail.append(reqMainDeptVO.getBill_name()).append("】【"); mail.append(reqMainDeptVO.getBill_code()).append("】<br><br>"); mail.append(deptName).append("<br>联系人:"); mail.append(person).append("(申请人)<br>电话:"); mail.append(dianhua).append("<br>邮箱:"); mail.append(email_s).append("<br>注:此邮件为系统自动发出,请勿直接回复。谢谢!"); dma.sendEmail(title, mail.toString(), email); } else { reqMainVO.setAccept_status(Integer.valueOf(4)); } service.setReqVOValue(reqMainVO, fieldNames); // 现在都是email的通信机制所以不发送代办事项 /* try { IPredictQueryService queryService = (IPredictQueryService)NCLocator.getInstance().lookup(IPredictQueryService.class); MessageinfoVO messageinfoVO = new MessageinfoVO(); messageinfoVO.setBillid(null); messageinfoVO.setBillno("/manageui.jsp?ctrl=nc.ui.ebscg.xqreqaccept.ClientUIWebCtrl&model=nc.ui.ebscg.xqreqaccept.ReqAcceptPageModel&delegator=nc.ui.ebscg.xqreqaccept.ReqAcceptDelegator&pageId=E05405"); messageinfoVO.setContent((new StringBuilder("采购申请提交受理,请进入待处理查看!")).append(new UFDateTime(System.currentTimeMillis())).toString()); messageinfoVO.setPk_billtype("E04C"); messageinfoVO.setPk_corp(LfwRuntimeEnvironment.getPkCorp()); messageinfoVO.setPk_srcbilltype(messageinfoVO.getPk_billtype()); messageinfoVO.setSenddate(new UFDateTime(System.currentTimeMillis())); messageinfoVO.setSenderman(LfwRuntimeEnvironment.getUserVO().getPrimaryKey()); messageinfoVO.setSendermanName(LfwRuntimeEnvironment.getUserVO().getUserName()); messageinfoVO.setPriority(new Integer(0)); List uaVOs = queryService.queryUserInfoByRolecode(reqMainDeptVO.getPk_dept_sug(), LfwRuntimeEnvironment.getCorp().getUnitcode(), "E05405"); messageinfoVO.setState(new Integer(0)); messageinfoVO.setType(new Integer(3)); if (uaVOs != null) { for (Iterator iterator = uaVOs.iterator(); iterator.hasNext(); dao.insertVO(messageinfoVO)) { UserAndClerkVO uaVO = (UserAndClerkVO)iterator.next(); messageinfoVO.setCheckman(uaVO.getUserid()); } } } catch (DAOException e1) { throw new LfwRuntimeException("向建议采购部门采购申请处理人发送待办失败!"); } */ result = "success"; return result; }