Ejemplo n.º 1
0
  public Map<String, String> queryBillProp(String pk_corp, String[] billno)
      throws BusinessException {
    if (billno == null && billno.length == 0) {
      return null;
    }

    int len = billno.length;
    Map<String, String> ret = new HashMap<String, String>();
    BaseDAO dao = new BaseDAO();
    List list = null;
    for (int i = 0; i < len; i++) {
      list =
          (List)
              dao.retrieveByClause(
                  BaseinfoVO.class, " isnull(dr,0)=0 and fbmbillno='" + billno[i] + "'");
      if (list != null && list.size() > 0) {
        BaseinfoVO baseinfoVO = (BaseinfoVO) list.get(0);
        ret.put(billno[i], baseinfoVO.getOrientation());
      } else {
        throw new BusinessException(
            nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
                .getStrByID("fbmcomm", "UPPFBMComm-000330") /* @res"不存在的票据编号"*/);
      }
    }

    return ret;
  }
Ejemplo n.º 2
0
  // 维护持票单位内部账户余额
  private int doHoldUnitAccont(PfParameterVO vo) throws BusinessException {
    AggregatedValueObject billvo = vo.m_preValueVo;
    ReckonVO reckvo = (ReckonVO) billvo.getParentVO();
    String accont = reckvo.getInacc();
    UFDouble reckmoney = reckvo.getReckonmoneysum();
    BaseDAO basebo = new BaseDAO();
    String sql = null;
    if (reckmoney.compareTo(new UFDouble(0)) > 0) {
      sql =
          "update bd_accid set currmny = currmny + "
              + reckmoney
              + " where pk_accid = '"
              + accont
              + "'";
    } else if (reckmoney.compareTo(new UFDouble(0)) < 0) {
      sql =
          "update bd_accid set currmny = currmny + "
              + reckmoney
              + " where pk_accid = '"
              + accont
              + "' and currmny >= "
              + reckmoney.abs();
    }
    int ret = 0;

    if (sql != null) {
      ret = basebo.executeUpdate(sql);
    }
    return ret;
  }
Ejemplo n.º 3
0
 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;
 }
 @Override
 public void updateTemplate(CpGzTemplateVO templateVo) throws TplBusinessException {
   BaseDAO dao = new BaseDAO();
   try {
     dao.updateVO(templateVo);
   } catch (DAOException e) {
     LfwLogger.error(e);
     throw new TplBusinessException(e.getMessage(), e);
   }
 }
 @Override
 public void deleteTemplate(String pk_template) throws TplBusinessException {
   try {
     BaseDAO dao = new BaseDAO();
     dao.deleteByPK(CpGzTemplateVO.class, pk_template);
     dao.deleteByClause(CpGzConditionVO.class, "pk_gz_template='" + pk_template + "'");
   } catch (DAOException e) {
     LfwLogger.error(e);
     throw new TplBusinessException(e.getMessage(), e);
   }
 }
Ejemplo n.º 6
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();
  }
Ejemplo n.º 7
0
  /**
   * yanlei start 关联框架协议时,带出供应商 yanlei
   *
   * @param pk
   * @return
   * @throws LfwBusinessException
   */
  public String querySupByCtId(String pk) throws LfwBusinessException {
    String ss = "";
    try {
      BaseDAO baseDao = new BaseDAO();

      ContractVO contraceVO = (ContractVO) baseDao.retrieveByPK(ContractVO.class, pk);
      if (contraceVO != null && contraceVO.getPk_supplier() != null) {
        ss = contraceVO.getPk_supplier();
      }
    } catch (Exception e) {
      throw new LfwRuntimeException("查询框架协议出错!");
    }
    return ss;
  }
 @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);
   }
 }
Ejemplo n.º 9
0
  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;
    }
  }
Ejemplo n.º 10
0
  /**
   * 搜索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;
  }
Ejemplo n.º 11
0
  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;
  }
Ejemplo n.º 12
0
  // 季凌峰 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;
  }
Ejemplo n.º 13
0
 private void changeAccountDetailLiquidFlag(PfParameterVO vo) throws BusinessException {
   AggregatedValueObject billvo = vo.m_preValueVo;
   ReckonBVO[] childvos = (ReckonBVO[]) billvo.getChildrenVO();
   StringBuffer pk_details = new StringBuffer();
   for (int i = 0; i < childvos.length; i++) {
     if (i == 0) {
       pk_details.append(" (");
     }
     pk_details.append("'" + childvos[i].getPk_source() + "'");
     if (i == childvos.length - 1) {
       pk_details.append(" ) ");
     } else {
       pk_details.append(", ");
     }
   }
   BaseDAO basebo = new BaseDAO();
   String sql = "update fbm_accountdetail set isliquid = 'Y' where pk_detail in " + pk_details;
   basebo.executeUpdate(sql);
 }
Ejemplo n.º 14
0
  // ----------------------
  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;
  }
Ejemplo n.º 15
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);
   }
 }
Ejemplo n.º 16
0
  /*
   * (非 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);
  }
Ejemplo n.º 17
0
 /**
  * 搜索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;
 }
Ejemplo n.º 18
0
  /**
   * 更新单据受理状态的方法
   *
   * @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;
  }
Ejemplo n.º 19
0
  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);
    }
  }
Ejemplo n.º 20
0
  /** 王磊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);
  }
Ejemplo n.º 21
0
  @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;
  }
Ejemplo n.º 22
0
  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";
  }
Ejemplo n.º 23
0
  // 季凌峰 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";
  }
Ejemplo n.º 24
0
  /**
   * 复写查询表体数据函数
   *
   * @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);
    }
  }