コード例 #1
0
  public void run() {
    int pagesize = PAGESIZE;
    try {
      while (!m_spool.isHasError() && !m_spool.isEmpty()) {
        if (linecounter >= pagesize) {
          // 处理组合单元格
          if (!mergeCells.isEmpty()) {
            Region[] regs = new Region[mergeCells.size()];
            mergeCells.values().toArray(regs);
            int len = regs.length;
            for (int i = 0; i < len; i++) m_sheet.addMergedRegion(regs[i]);
          }
          try {
            flushToFile();
          } catch (Exception e) {
            Logger.error(e.getMessage(), e);
            m_spool.setErrorMsg(e.getMessage());
          } finally {
            if (out != null)
              try {
                out.close();
              } catch (IOException e) {
                Logger.error(e.getMessage(), e);
              }
          }

          m_workbook = new HSSFWorkbook(); // 创建工作薄
          m_sheet = m_workbook.createSheet(); // 创建表单
          mergeCells = new Hashtable(); // 存放所有组合单元格
          styles = new Hashtable();
          linecounter = 0;
          sheetCounter++;
        }

        PrintCellData[] data = null;
        data = (PrintCellData[]) m_spool.retrieve();
        linecounter = linecounter + data.length; // 其实为单元格数目,非行数

        fileUtil.exportSheet2(m_templateData, data, m_sheet, m_workbook, styles, mergeCells);

        /* 每往Excel写入一行,进度条+1,已导出的行数+1 */
        m_spool.setExportedLineCount(m_spool.getExportedLineCount() + 1);
        stepProgressBar(1);
        setProgressBarHintMsg();
      }
    } catch (Exception e) {
      Logger.error(e.getMessage(), e);
      m_spool.setErrorMsg(e.getMessage());
    } catch (OutOfMemoryError e) {
      Logger.error(e.getMessage(), e);
      m_spool.setErrorMsg(
          nc.ui.ml.NCLangRes.getInstance()
              .getStrByID(
                  "10100108", "UPP10100108-000860") /*@res "内存不足,请修改Java Plugin参数,将内存调整大一些"*/);
    }
  }
コード例 #2
0
ファイル: FBMClientInfo.java プロジェクト: chenjiayou/Test
  /**
   * 根据结算单位,账户取账户对应的VO 拆分出来做公用方法
   *
   * @return
   */
  public static CurrtypeVO getCurrTypeVO(String pk_accid) throws BusinessException {
    StringBuffer whereClause =
        new StringBuffer()
            .append(" bd_currtype.pk_currtype = ")
            .append(" (select e.pk_currtype from bd_accid e where ")
            .append(" e.pk_accid='")
            .append(pk_accid)
            .append("')");
    SuperVO[] vos = null;
    try {
      vos = HYPubBO_Client.queryByCondition(CurrtypeVO.class, whereClause.toString());
    } catch (UifException e) {
      Logger.error(e.getMessage(), e);
      throw new BusinessException(
          nc.ui.ml.NCLangRes.getInstance().getStrByID("fbmcomm", "UPPFBMComm-000155") /*
																								 * @res
																								 * "根据结算单位和账户查询账户币种异常"
																								 */);
    }
    if (vos == null || vos.length == 0) {
      throw new BusinessException(
          nc.ui.ml.NCLangRes.getInstance().getStrByID("fbmcomm", "UPPFBMComm-000156") /*
																								 * @res
																								 * "根据结算单位和账户无法查询到账户对应币种"
																								 */);
    }
    return (CurrtypeVO) vos[0];
  }
コード例 #3
0
  /**
   * 功能:合并多公司查询分别查询的结果 作者:宋涛 创建时间:(2004-06-21 11:36:50) 使用说明:以及别人可能感兴趣的介绍 注意:现存Bug
   *
   * @return nc.vo.pub.rs.MemoryResultSet[]
   * @param mrsSource nc.vo.pub.rs.MemoryResultSet[]
   * @param mrsNew nc.vo.pub.rs.MemoryResultSet[]
   * @exception java.lang.Exception 异常说明。
   */
  private MemoryResultSet[] mergeMultiCorps(MemoryResultSet[] mrsSource, MemoryResultSet[] mrsNew)
      throws java.lang.Exception {
    // if (mrsSource == null) {
    // return mrsNew;
    // }
    // for (int i = 0; i < mrsSource.length; i++) {
    // mrsSource[i] =
    // ComTool.combineResultSet(mrsSource[i], mrsNew[i], new String[] { "rq" }, false, 0);
    // }
    if (mrsNew != null) {
      for (MemoryResultSet mr : mrsNew) {
        try {
          int row = mr.getColumnIndex("ZB_DJDL");
          if (row > 0) {
            MemoryResultSetMetaData mrsmd = (MemoryResultSetMetaData) mr.getMetaData();
            mrsmd.removeColumn("ZB_DJDL");

            if (mr.getResultArrayList() != null) {
              for (Object ar : mr.getResultArrayList()) {
                if (ar instanceof ArrayList) {
                  ((ArrayList) ar).remove(row - 1);
                }
              }
            }
          }
        } catch (SQLException e) {
          Logger.error(e.getCause());
        }
      }
    }
    return nc.vo.arap.pub.mrstools.MrsTools.unionAll(mrsSource, mrsNew);
  }
コード例 #4
0
  /**
   * 根据权限对表体按钮进行剪裁
   *
   * @param meta
   */
  public void modifyMenubarComp(PageMeta meta) {
    FuncRegisterVO fvo = LfwFrameUtil.getInstance().getCurrentFuncRegisterVO();
    if (fvo != null) {
      try {
        if (!fvo.getIsbuttonpower().booleanValue()) return;
        PowerResultVO prvo = InitAuthenticationUtil.getPowerButton(fvo);
        if (!prvo.isPowerControl()) return;
        String[] prArr = prvo.getPowerId();
        //				if(prArr == null)
        //					return;
        Map<String, String> prMap = new HashMap<String, String>();
        if (prArr != null) {
          for (int i = 0; i < prArr.length; i++) {
            prMap.put(prArr[i], prArr[i]);
          }
        }

        Map<String, WebComponent> map =
            (HashMap<String, WebComponent>) meta.getViewComponents().getComponentsMap();
        // 处理表体按钮权限    表头按钮已经在父类中处理过了
        MenubarComp menubarBodyMap = (MenubarComp) map.get("menubar_body");

        if (menubarBodyMap != null) {
          List<MenuItem> listBody = (List<MenuItem>) menubarBodyMap.getMenuList();
          if (listBody != null && listBody.size() > 0) {
            getAllMenuItem(prMap, listBody);
          }
        }

      } catch (Exception e) {
        Logger.error("根据权限对按钮进行剪裁: ", e);
      }
    }
  }
コード例 #5
0
  public void end() {
    // 处理组合单元格
    if (!mergeCells.isEmpty()) {
      Region[] regs = new Region[mergeCells.size()];
      mergeCells.values().toArray(regs);
      int len = regs.length;
      for (int i = 0; i < len; i++) m_sheet.addMergedRegion(regs[i]);
    }

    try {
      flushToFile();
    } catch (Exception e) {
      m_spool.setErrorMsg(e.getMessage());
    } finally {
      if (out != null)
        try {
          out.close();
        } catch (IOException e) {
          Logger.error(e.getMessage(), e);
        }
    }

    StringBuffer msg = new StringBuffer();
    // 最后给出完整的提示
    if (sheetCounter > 1) {
      String filename =
          m_filepath.substring(m_filepath.lastIndexOf(System.getProperty("file.separator")) + 1);
      msg.append(
          nc.ui.ml.NCLangRes.getInstance()
              .getStrByID(
                  "10100108", "UPP10100108-000856") /*@res "\n您要导出的内容太多,为减小内存的使用量,它们被存储到目录 \n"*/);
      msg.append(
          m_filepath.substring(0, m_filepath.lastIndexOf(System.getProperty("file.separator"))));
      msg.append(
          nc.ui.ml.NCLangRes.getInstance()
              .getStrByID("10100108", "UPP10100108-000857") /*@res " 下的多个Excel文件中,分别是:\n"*/);
      msg.append(filename).append(",");
      for (int i = 2; i <= sheetCounter; i++) {
        if (i != sheetCounter) {
          msg.append(filename.substring(0, filename.indexOf('.')) + "-" + i + ".xls").append(",");
        } else {
          msg.append(filename.substring(0, filename.indexOf('.')) + "-" + i + ".xls");
        }
      }
    } else {
      msg.append(
          nc.ui.ml.NCLangRes.getInstance()
                  .getStrByID("10100108", "UPP10100108-000858") /*@res "导出内容被存放在文件 \n"*/
              + m_filepath
              + nc.ui.ml.NCLangRes.getInstance()
                  .getStrByID("10100108", "UPP10100108-000859") /*@res " 中."*/);
    }

    m_spool.setMsg(msg.toString());
    mergeCells = new Hashtable(); // 存放所有组合单元格
    styles = new Hashtable();
  }
コード例 #6
0
 /**
  * @author zhf @说明 获取vo转换类实例 @时间 2010-9-26上午10:47:52
  * @param classname
  * @return
  */
 private static nc.vo.pf.change.IchangeVO getChangeClass(String classname) throws Exception {
   if (PuPubVO.getString_TrimZeroLenAsNull(classname) == null) return null;
   try {
     Class c = Class.forName(classname);
     Object o = c.newInstance();
     return (nc.vo.pf.change.IchangeVO) o;
   } catch (Exception ex) {
     Logger.error(ex.getMessage(), ex);
     throw ex;
   }
 }
コード例 #7
0
ファイル: OpenProcessor.java プロジェクト: dalinhuang/sdb
  // ----------------------
  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;
  }
コード例 #8
0
  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();
  }
コード例 #9
0
ファイル: FBMClientInfo.java プロジェクト: chenjiayou/Test
  /**
   * 通过校验受理情况,确认操作按钮是否可见
   *
   * @param centercorpid
   * @param date
   */
  public static boolean isMakeBtnVisible() {
    if (!isSettleCenter()) {
      return true; // 结算单位按钮可见
    }

    ICommon icom = NCLocator.getInstance().lookup(ICommon.class);
    String pk_corp = ClientEnvironment.getInstance().getCorporation().getPrimaryKey();
    UFDate date = ClientEnvironment.getInstance().getDate();
    try {
      return icom.isStartProcess(pk_corp, date).booleanValue();
    } catch (BusinessException e) {
      Logger.error(e.getMessage(), e);
    }
    return true;
  }
コード例 #10
0
 /**
  * 覆写方法:初始化所有数据
  *
  * @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);
   }
 }
コード例 #11
0
  private void doInit() {
    try {
      System.out.println("\nInitializing master portal server......");
      if (Logger.isDebugEnabled())
        LfwLogger.debug("===PortalBizServerListener类:Begin to initialize Portal!");

      String portalDs = PortalDsnameFetcher.getPortalDsName();
      if (portalDs == null || portalDs.equals("")) {
        LfwLogger.error("没有获取到NC数据源,不做初始化");
        return;
      }
      String oldDs = null;
      if (portalDs != null) {
        oldDs = InvocationInfoProxy.getInstance().getUserDataSource();
        LfwRuntimeEnvironment.setDatasource(portalDs);
      }
      /* 初始化配置信息*/
      //
      try {
        initConfig();
      } catch (Throwable e) {
        LfwLogger.error("===PortalBizServerListener类:initConfig error!" + e.getMessage(), e);
      }

      try {
        initCtx();
      } catch (Throwable e) {
        LfwLogger.error("===PortalBizServerListener类:initCtx error!" + e.getMessage(), e);
      }

      /* 部署Portal */
      initDeploy();

      /** 吊销登陆令牌* */
      destoryToken();
      /** Portal定时任务调度器初始化 */
      // new Executor(new PtTimer(LfwRuntimeEnvironment.getDatasource())).start();

      if (oldDs != null) LfwRuntimeEnvironment.setDatasource(oldDs);
      System.out.println("master portal server is successfully initialized");
    } catch (Exception e) {
      System.out.println("master portal server is not successfully initialized");
      Logger.error("error occurred while initializing portal container!", e);
    }
  }
コード例 #12
0
  public IQueryAfterSave getQueryAfterSaveInstance() {
    if (queryServer == null) {
      try {
        // @see PfUtilTools.instantizeObject()
        Object objChecker = ObjectCreator.newInstance(IContent.ModuleName, IContent.BusiQuery);
        if (objChecker == null) {
          throw new RuntimeException("Can not found " + IContent.BusiQuery);
        }

        if (objChecker instanceof IBaseBusiQuery) {
          queryServer = (IBaseBusiQuery) objChecker;
          ((IBaseBusiQuery) queryServer).setAggVO(getBillVO());
          ((IBaseBusiQuery) queryServer).setWhere(this.initWhere);
        }
      } catch (Exception e) {
        Logger.error(e.getMessage(), e.getCause());
      }
    }
    return queryServer;
  }
コード例 #13
0
ファイル: FBMClientInfo.java プロジェクト: chenjiayou/Test
 /**
  * 取出公司对应的内部客商
  *
  * <p>作者:lpf 日期:2007-8-15
  */
 public static String getCorpCubasdoc(String pk_corp) {
   // String strWhere = " bd_cubasdoc.pk_corp1 = '" + pk_corp + "' ";
   // CustBasVO[] custbasVos = null;
   // try {
   // custbasVos =
   // OuterProxy.getCustManDocQuery().queryCustBasicInfo(strWhere,
   // getCorpPK());
   // } catch (BusinessException e) {
   // Logger.error(e.getMessage(), e);
   // }
   // if (custbasVos == null || custbasVos.length == 0)
   // return null;
   // return custbasVos[0].getPk_cubasdoc();
   String cubasstr = null;
   try {
     cubasstr = ClientInfo.getCorpCuBas(getCorpPK());
   } catch (BusinessException e) {
     Logger.error(e.getMessage(), e);
   }
   return cubasstr;
 }
コード例 #14
0
  private String aggregateSql(Dataset ds, FieldRelation rel) {
    if (ds.getCurrentKey() == null) return null;
    Dataset refDs = ds.getWidget().getViewModels().getDataset(rel.getRefDataset());
    if (refDs == null) {
      Logger.error("ref ds can not be fount:" + rel.getRefDataset());
      return null;
    }
    if (rel.getWhereField() == null) return null;
    MatchField[] mfs = rel.getMatchFields();
    WhereField where = rel.getWhereField();
    StringBuffer sql = new StringBuffer();
    sql.append("select ");
    for (int i = 0; i < mfs.length; i++) {
      Field f = refDs.getFieldSet().getField(mfs[i].getReadField());
      if (f == null)
        throw new LfwRuntimeException(
            "can not find field in ds:"
                + rel.getRefDataset()
                + ",field:"
                + mfs[i].getReadField()
                + ", in fieldrelation process");
      sql.append("a.").append(f.getField());
      if (i != mfs.length - 1) sql.append(",");
    }
    sql.append(",a.").append(refDs.getFieldSet().getField(where.getKey()).getField());
    sql.append(" from ");
    sql.append(getRefTableName(refDs));
    sql.append(" a where a.")
        .append(refDs.getFieldSet().getField(where.getKey()).getField())
        .append(" in (");

    RowData rowSet = ds.getCurrentRowSet().getCurrentRowData();
    Set<String> inSet = new HashSet<String>();
    if (rowSet != null) {
      Row[] rows = rowSet.getRows();
      int whereIndex = ds.nameToIndex(where.getValue());
      if (whereIndex == -1) return null;
      for (int i = 0; i < rows.length; i++) {
        if (rows[i] instanceof EmptyRow) continue;
        Object wValue = rows[i].getValue(whereIndex);
        String wValueStr = "";
        if (wValue != null) {
          wValueStr = wValue.toString();
          String[] strs = wValueStr.split(",");
          for (int j = 0; j < strs.length; j++) {
            inSet.add(strs[j]);
          }
        }
      }
    }

    if (inSet.size() == 0) return null;

    Iterator<String> it = inSet.iterator();
    while (it.hasNext()) {
      String value = it.next();
      sql.append("'");
      sql.append(value);
      sql.append("'");
      if (it.hasNext()) sql.append(",");
    }
    sql.append(")");
    return sql.toString();
  }
コード例 #15
0
  /**
   * 字段关联处理
   *
   * @param ds
   * @param rels
   */
  public void dealFieldRelation(Dataset ds, FieldRelation[] rels) {
    if (rels != null && rels.length != 0) {
      for (int i = 0; i < rels.length; i++) {
        FieldRelation rel = rels[i];
        try {
          if (!needDoRel(ds, rel)) continue;
          String sql = aggregateSql(ds, rel);
          List<Object[]> result = null;
          if (sql != null) {
            result =
                (List<Object[]>) CRUDHelper.getCRUDService().query(sql, new ArrayListProcessor());
          } else {
            result = new ArrayList<Object[]>();
          }
          // 如果查出数据为空,则增加一行,使后面置空逻辑可继续运行
          if (result.size() == 0) result.add(null);
          Iterator<Object[]> it = result.iterator();

          WhereField whereField = rel.getWhereField();
          // 外键字段
          String key = ds.getFieldSet().getField(whereField.getValue()).getId();
          // 关联字段
          MatchField[] mfs = rel.getMatchFields();
          int[] mfIndices = new int[mfs.length];
          for (int j = 0; j < mfIndices.length; j++) {
            mfIndices[j] = ds.nameToIndex(mfs[j].getWriteField());
          }

          // 记录是否关联过的标识,以便于处理多选关联
          Row[] rows = ds.getCurrentRowData().getRows();
          boolean[][] notFirst = new boolean[rows.length][];
          for (int j = 0; j < notFirst.length; j++) {
            notFirst[j] = new boolean[mfIndices.length];
          }

          while (it.hasNext()) {

            Object[] values = it.next();
            int keyIndex = ds.nameToIndex(key);
            for (int j = 0; j < rows.length; j++) {
              if (rows[j] instanceof EmptyRow) continue;
              String keyValue = (String) rows[j].getValue(keyIndex);
              if (keyValue != null && values != null) {
                // 将主键值分隔
                String[] keyValues = keyValue.split(",");
                for (int m = 0; m < keyValues.length; m++) {
                  // 找出匹配的主键值,将对应的值字段写入
                  if (values[values.length - 1] != null
                      && values[values.length - 1].toString().trim().equals(keyValues[m].trim())) {
                    for (int k = 0; k < mfIndices.length; k++) {
                      Object value = values[k];
                      int mfIndex = mfIndices[k];
                      Object oldValue = rows[j].getValue(mfIndex);

                      // 原来的值不为空,有2种情况。一种是残留值,这种情况应该去掉。另一种是上一循环设置的,这种情况应该拼上 ","
                      if (oldValue != null) {
                        if (notFirst[j][k]) {
                          // SuperVO vo = (SuperVO) cavos[j].getCavo();
                          if (!mfs[k].getReadField().equals(whereField.getKey())) {
                            value = oldValue.toString() + "," + value;
                            rows[j].setValue(mfIndex, value);
                          }
                        } else {
                          notFirst[j][k] = true;
                          rows[j].setValue(mfIndex, value);
                        }
                      } else {
                        notFirst[j][k] = true;
                        rows[j].setValue(mfIndex, value);
                      }
                    }
                    break;
                  }
                }
              }
              // 将数据置空
              else {
                for (int k = 0; k < mfIndices.length; k++) {
                  Object value = null;
                  int mfIndex = mfIndices[k];
                  rows[j].setValue(mfIndex, value);
                }
              }
            }
          }
          if (rel.getChildRelationList() != null) {
            dealFieldRelation(ds, rel.getChildRelationList().toArray(new FieldRelation[0]));
          }
        } catch (Exception e) {
          Logger.error(e.getMessage(), e);
        }
      }
    }
  }
コード例 #16
0
  private void processFormular(Dataset ds) {
    RowData rd = ds.getCurrentRowData();
    if (rd == null) return;
    int rcount = rd.getRowCount();
    List<String> executedFpList = new ArrayList<String>();
    int fieldCount = ds.getFieldSet().getFieldCount();
    for (int i = 0; i < fieldCount; i++) {
      try {
        Field field = ds.getFieldSet().getField(i);
        List<String> fieldFormulars = new ArrayList<String>();
        String formular = field.getEditFormular();
        if (formular != null) fieldFormulars.add(formular);

        formular = field.getLoadFormular();
        if (formular != null) fieldFormulars.add(formular);

        Iterator<String> fit = fieldFormulars.iterator();
        while (fit.hasNext()) {
          formular = fit.next();
          String exp = null;
          if (formular != null) exp = JsURLDecoder.decode(formular, "UTF-8");
          // 如果没有加载公式,继续下一个字段
          if (exp == null) continue;

          if (executedFpList.contains(exp)) continue;
          executedFpList.add(exp);
          String[] expArr = exp.split(";");

          fp.setExpressArray(expArr);
          VarryVO[] varryVOs = fp.getVarryArray();
          if (varryVOs == null || varryVOs.length == 0) continue;
          String[] formularNames = new String[varryVOs.length];

          Map<String, Integer> indexMap = getIndexMap(ds);
          for (int j = 0; j < varryVOs.length; j++) {
            String[] keys = varryVOs[j].getVarry();
            if (keys != null) {
              for (String key : keys) {
                List<Object> valueList = new ArrayList<Object>();
                for (int k = 0; k < rcount; k++) {
                  Row r = rd.getRow(k);
                  //
                  Object value = r.getValue(indexMap.get(key));
                  Field f = ds.getFieldSet().getField(key);
                  if (f != null && value != null) {
                    //										//如果是Double类型,进行一下转换
                    if (StringDataTypeConst.UFDOUBLE.equals(f.getDataType())
                        || StringDataTypeConst.DOUBLE.equals(f.getDataType())
                        || StringDataTypeConst.Decimal.equals(f.getDataType())) {
                      if (!(value instanceof UFDouble)) value = new UFDouble(value.toString());
                    } else if (StringDataTypeConst.INTEGER.equals(f.getDataType())) {
                      if (!(value instanceof Integer)) value = new Integer((String) value);
                    }
                  }
                  valueList.add(value);
                }
                fp.addVariable(key, valueList);
              }
              formularNames[j] = varryVOs[j].getFormulaName();
            }
          }

          Object[][] result = fp.getValueOArray();
          if (result != null) {
            for (int l = 0; l < formularNames.length; l++) {
              int index = ds.nameToIndex(formularNames[l]);
              if (index == -1) {
                LfwLogger.error(
                    "can not find column:" + formularNames[l] + ", ds id:" + ds.getId());
                continue;
              }
              for (int k = 0; k < rcount; k++) {
                Row r = rd.getRow(k);
                r.setValue(index, result[l][k]);
              }
            }
          }
        }
      } catch (Throwable e) {
        Logger.error(e.getMessage(), e);
      }
    }
  }
コード例 #17
0
ファイル: OpenProcessor.java プロジェクト: dalinhuang/sdb
  @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;
  }
コード例 #18
0
ファイル: ReqDelegator.java プロジェクト: dalinhuang/sdb
  /**
   * 更新单据受理状态的方法
   *
   * @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>&nbsp;&nbsp;&nbsp;&nbsp;电子采购系统(需求受理)中有新的采购项目等待您处理。<br>&nbsp;&nbsp;&nbsp;&nbsp;项目名称【");
      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;
  }
コード例 #19
0
ファイル: OpenProcessor.java プロジェクト: dalinhuang/sdb
  public String Opricejm(
      String opensource,
      String pk_xy_proj_main,
      String pk_xy_pub_step,
      String pk_xy_proj_item_sup_cfm)
      throws Exception {

    String sqlWhere =
        "  pk_xy_proj_item_sup_cfm='"
            + pk_xy_proj_item_sup_cfm
            + "' and pk_xy_proj_main='"
            + pk_xy_proj_main
            + "' and ISNULL(dr,0) = 0 ";

    BaseDAO dao = new BaseDAO();
    // 查询本采购环节发标环节主键
    String pubstrwhere =
        "pk_xy_proj_main='"
            + pk_xy_proj_main
            + "' and  step_type="
            + EbsOperaitonConst.OPERATION_PUR_STEP_SENDBID
            + " and isnull(dr,0)=0 ";
    Collection<StepPubEntityVO> pubcol = dao.retrieveByClause(StepPubEntityVO.class, pubstrwhere);
    StepPubEntityVO[] pubvo = null;
    pubvo = new StepPubEntityVO[pubcol.size()];
    pubvo = pubcol.toArray(pubvo);
    if (pubvo != null && pubvo.length > 0) {
      // 发布应答的开启

      if ("0".equals(opensource)) {

        // 发布环节的报价详细
        //	sqlWhere +=" and pk_xy_step_pub !='"+pubvo[0].getPk_xy_step_pub()+"' ";
      } else {
        // 发标环节的报价详细
        sqlWhere += " and pk_xy_step_pub ='" + pubvo[0].getPk_xy_step_pub() + "' ";
      }
    }

    if (pk_xy_pub_step != null && !"null".equals(pk_xy_pub_step)) {

      sqlWhere += " and pk_xy_step_pub ='" + pk_xy_pub_step + "' ";
    }

    String orderBy = " current_price_count";
    ProjSupQuoteVO[] svo = null;
    NCObject[] ncobjects = null;
    int current_count = 0;
    Collection<ProjSupQuoteVO> collection =
        dao.retrieveByClause(ProjSupQuoteVO.class, sqlWhere, orderBy);
    if (collection != null && collection.size() > 0) {
      ArrayList<ProjSupQuoteVO> projSupQuoteVOs = new ArrayList<ProjSupQuoteVO>();
      ArrayList<ProjSupQuoteVO> currentCountVOs = new ArrayList<ProjSupQuoteVO>();
      svo = new ProjSupQuoteVO[collection.size()];
      svo = collection.toArray(svo);
      // 进行解密
      for (int i = 0; i < svo.length; i++) {
        EncrypteDecrypte3DES des = new EncrypteDecrypte3DES();
        BASE64Decoder base64 = new BASE64Decoder();
        try {
          des.setKey(base64.decodeBuffer("EpzmL6tl+uvu70nG0gbaBEG0GhUlcjIb"));
          des.setIv(base64.decodeBuffer("zz7cZtYpVR4="));
          // byte[] discounted_unit_price_encrypt =des.decrypt(base64.decodeBuffer(new
          // String(svo[i].getDiscounted_unit_price_encrypt().getBytes())));
          // byte[] discounted_encrypt =des.decrypt(base64.decodeBuffer(new
          // String(svo[i].getDiscount_encrypt().getBytes())));
          if (svo[i].getDiscounted_amount_encrypt() != null) {
            byte[] discounted_amount_encrypt =
                des.decrypt(
                    base64.decodeBuffer(
                        new String(svo[i].getDiscounted_amount_encrypt().getBytes())));

            // svo[i].setDiscounted_unit_price(new UFDouble(new
            // String(discounted_unit_price_encrypt)));
            // svo[i].setDiscount(new UFDouble(new String(discounted_encrypt)));
            try {
              svo[i].setDiscounted_amount(
                  new UFDouble(new String(discounted_amount_encrypt).trim()));
            } catch (Exception e) {

            }
          }

          svo[i].setPrice_count(String.valueOf(svo[i].getCurrent_price_count()));

          if (svo[i].getCata_unit_price_encrypt() != null) {

            byte[] cata_unit_price_encrypt =
                des.decrypt(
                    base64.decodeBuffer(
                        new String(svo[i].getCata_unit_price_encrypt().getBytes())));

            try {
              svo[i].setCata_unit_price(new UFDouble(new String(cata_unit_price_encrypt).trim()));
            } catch (Exception e) {

            }
          }

        } catch (IOException e) {
          // TODO Auto-generated catch block
          Logger.error("报价明细解密失败!");
          Logger.error(e.getMessage(), e);
        }
      }

      dao.updateVOArray(svo, new String[] {"cata_unit_price", "discounted_amount"});
    }
    return "ok";
  }
コード例 #20
0
ファイル: OpenProcessor.java プロジェクト: dalinhuang/sdb
  // 季凌峰 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";
  }