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;
  }
Esempio n. 2
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";
  }
Esempio n. 3
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;
  }