示例#1
0
  // ---------------
  public String agree() 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));

      String sqld =
          "select * from ebs_xy_projexec_personjzx  where ( discard_status != '3' or discard_status is null ) and zdy3 = '"
              + pk_xy_step_pub
              + "' and pk_xy_proj_main ='"
              + pk_xy_proj_main
              + "' and pk_person in "
              + "(select pk_psndoc from bd_psndoc where pk_psnbasdoc in "
              + "(select pk_psndoc from sm_userandclerk where userid  in "
              + "(select operatorid from ebs_xy_proj_main where pk_xy_proj_main ='"
              + pk_xy_proj_main
              + "')))";

      List<ProjGroupVO> listd =
          (List<ProjGroupVO>) dao.executeQuery(sqld, new BeanListProcessor(ProjGroupVO.class));

      if (listb != null && listb.size() > 0) {
        ProjGroupVO pcg = listb.get(0);
        String judgment = pcg.getZdy1();
        if (!listd.get(0).getPk_person().equals(pcg.getPk_person())) {
          if ("是".equals(listd.get(0).getZdy2())) {
            if ("是".equals(pcg.getZdy2())) {
              success = "NO";
              return success;
            } else {
              if ("是".equals(judgment)) {
                pcg.setZdy2("是");
                dao.updateVO(pcg, new String[] {"zdy2"});
              } else {
                success = "N";
              }
            }
          } else {
            success = "operNO";
            return success;
          }
        } else {
          if ("是".equals(pcg.getZdy2())) {
            success = "NO";
            return success;
          } else {
            if ("是".equals(judgment)) {
              pcg.setZdy2("是");
              dao.updateVO(pcg, new String[] {"zdy2"});
            } else {
              success = "N";
            }
          }
        }

      } else {
        success = "你不属于采购小组人员或者采购小组人员变化了,请重新打开采购执行界面!";
      }
    } catch (Exception e) {
      Logger.error("同意开启失败");
      Logger.error(e.getMessage(), e);
      success = "同意开启失败";
    }

    return success;
  }