예제 #1
0
 public void save(Connection con, JUser juser) throws Exception {
   PreparedStatement pstmt = null;
   java.sql.Timestamp now = new java.sql.Timestamp(System.currentTimeMillis());
   String sql = null;
   int idx = 1;
   if (JUtil.convertNull(this.getGroup_id()).equals("")) {
     sql =
         " insert into t_ym_book(group_id, group_name, inquire_date, group_no, contact,"
             + "	 contact_phone, contact_handset, contact_fax, countries, countries_name, group_type, "
             + "	 memo, company_id, zxgw_id, zxgw_name, take_out, creater, createrName, created) "
             + " values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
     pstmt = con.prepareStatement(sql);
     this.setGroup_id(JUtil.createUNID());
     pstmt.setString(idx++, this.getGroup_id());
     pstmt.setString(idx++, this.getGroup_name());
     pstmt.setDate(idx++, this.getInquire_date());
     pstmt.setString(idx++, this.getGroup_no());
     pstmt.setString(idx++, this.getContact());
     pstmt.setString(idx++, this.getContact_phone());
     pstmt.setString(idx++, this.getContact_handset());
     pstmt.setString(idx++, this.getContact_fax());
     pstmt.setString(idx++, this.getCountries());
     pstmt.setString(idx++, this.getCountries_name());
     pstmt.setInt(idx++, this.getGroup_type());
     pstmt.setString(idx++, this.getMemo());
     pstmt.setString(idx++, this.getCompany_id());
     pstmt.setString(idx++, this.getZxgw_id());
     pstmt.setString(idx++, this.getZxgw_name());
     pstmt.setString(idx++, this.getTake_out());
     pstmt.setString(idx++, juser.getUserId());
     pstmt.setString(idx++, juser.getUserName());
     pstmt.setTimestamp(idx++, now);
     pstmt.executeUpdate();
     pstmt.close();
   } else {
     sql =
         " update t_ym_book set group_name = ?, inquire_date = ?, memo = ?, "
             + " group_no = ?, contact = ?, contact_phone = ?, contact_handset = ?, contact_fax = ?,"
             + " countries = ?, countries_name = ?, zxgw_id = ?, zxgw_name = ?, take_out = ? "
             + " where group_id = ? ";
     pstmt = con.prepareStatement(sql);
     pstmt.setString(idx++, this.getGroup_name());
     pstmt.setDate(idx++, this.getInquire_date());
     pstmt.setString(idx++, this.getMemo());
     pstmt.setString(idx++, this.getGroup_no());
     pstmt.setString(idx++, this.getContact());
     pstmt.setString(idx++, this.getContact_phone());
     pstmt.setString(idx++, this.getContact_handset());
     pstmt.setString(idx++, this.getContact_fax());
     pstmt.setString(idx++, this.getCountries());
     pstmt.setString(idx++, this.getCountries_name());
     pstmt.setString(idx++, this.getZxgw_id());
     pstmt.setString(idx++, this.getZxgw_name());
     pstmt.setString(idx++, this.getTake_out());
     pstmt.setString(idx++, this.getGroup_id());
     pstmt.executeUpdate();
     pstmt.close();
   }
 }
예제 #2
0
  /**
   * 获得对外合同申请的默认审批人
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  private String calDefaultExterContractApprover(
      HttpServletRequest request, HttpServletResponse response) throws Exception {
    String xml = null;
    String company_id = JUtil.convertNull(request.getParameter("company_id"));
    String con_type = JUtil.convertNull(request.getParameter("con_type"));
    String con_money_str = JUtil.convertNull(request.getParameter("con_money"));
    String apply_user_id = JUtil.convertNull(request.getParameter("apply_user_id"));
    Double con_money = null;
    if (con_money_str.length() > 0) {
      try {
        con_money = Double.parseDouble(con_money_str);
      } catch (Exception e) {
      }
    }

    xml = "<?xml version='1.0' encoding='gbk'?>\n";
    org.jdom.Element eleRoot = new org.jdom.Element("root");
    org.jdom.Element eleRows = new org.jdom.Element("users");
    eleRoot.addContent(eleRows);
    org.jdom.Element eleRow = null;

    try {
      Map<String, JUser> mapUser = null;
      if (company_id.length() > 0 && con_type.length() > 0) {
        boolean need_con_money = false;
        List<ExterContractType> lsType = ExterContractType.getContractTypeByCompany(company_id);
        for (ExterContractType type : lsType) {
          if (type.getCon_type_id().equals(con_type)) {
            if (type.getNeed_con_money() == 1) {
              need_con_money = true;
            }
            break;
          }
        }
        if (!need_con_money || con_money != null) {
          mapUser =
              ExterContractApply.getDefaultApprover(
                  company_id, con_type, con_money == null ? 0 : con_money, apply_user_id);
        }
      }
      if (mapUser != null) {
        for (String userId : mapUser.keySet()) {
          JUser user = mapUser.get(userId);
          if (user == null) continue;
          eleRow = new org.jdom.Element("user");
          eleRow.setAttribute("user_id", user.getUserId());
          eleRow.setAttribute("user_name", user.getUserName());
          eleRows.addContent(eleRow);
        }
      }
      org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter();
      xml += xmlout.outputString(eleRoot);
      JLog.getLogger().debug("xml=\n" + xml);
      return xml.trim();
    } catch (Exception e) {
      JLog.getLogger().error("", e);
    }
    return "";
  }
예제 #3
0
  public void insert(Connection con, JUser user) throws Exception {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = null;
    sql = "update t_card set valid=1 where member_id=?";
    pstmt = con.prepareStatement(sql);
    pstmt.setString(1, this.member_id);
    pstmt.executeUpdate();
    pstmt.close();

    this.card_id = com.gemway.util.ID.getIDObject("default").create();

    sql =
        "insert into t_card "
            + "  (card_id,   regdate, card_no,    member_id, card_class, op_type, moneyPaid, "
            + "   paidOfPro, con_no,  class_name, markup,    created,    createrName,valid)"
            + " values(?,?,?,?,?,?,?,  ?,?,?,?,?,?,0)";
    pstmt = con.prepareStatement(sql);
    int colIndex = 1;
    pstmt.setString(colIndex++, this.card_id);
    pstmt.setDate(colIndex++, this.regdate);
    pstmt.setString(colIndex++, this.card_no);
    pstmt.setString(colIndex++, this.member_id);
    pstmt.setString(colIndex++, this.card_class);
    pstmt.setInt(colIndex++, this.op_type);
    pstmt.setString(colIndex++, this.moneypaid);
    pstmt.setString(colIndex++, this.paidofpro);
    pstmt.setString(colIndex++, this.con_no);
    pstmt.setString(colIndex++, this.class_name);
    pstmt.setString(colIndex++, this.markup);
    pstmt.setTimestamp(colIndex++, new java.sql.Timestamp(System.currentTimeMillis()));
    pstmt.setString(colIndex++, user.getUserName());
    pstmt.executeUpdate();
    pstmt.close();
  }
예제 #4
0
  public void saveModify(Connection con, JUser juser, String modify_content) throws Exception {
    java.sql.Timestamp now = new java.sql.Timestamp(System.currentTimeMillis());

    java.sql.PreparedStatement pstmt = null;
    String sql = null;
    String modify_memo = JUtil.convertNull(this.getModify_memo());
    String szMemo = "";

    if (modify_memo.getBytes().length > 950) {
      // 丢弃前100个字符
      modify_memo = "..." + modify_memo.substring(100);
    }
    if (modify_memo.length() > 0) szMemo = "\n------------------------------------------\n";

    szMemo = "\n" + JUtil.formatDate(now, "YYYY-MM-DD HH:mm") + juser.getUserName();
    szMemo += " 修改本团组,以下为本次修改的内容及原因 \r\n";
    szMemo += " 修改内容:\r\n" + modify_content;

    sql =
        " update t_ym_book "
            + " set modify_memo = ? "
            + "	where group_status >= 4 and group_id = ? ";

    pstmt = con.prepareStatement(sql);
    pstmt.setString(1, modify_memo + szMemo);
    pstmt.setString(2, this.getGroup_id());
    pstmt.executeUpdate();
    pstmt.close();
  }
예제 #5
0
  /**
   * 保存修改
   *
   * @param con
   * @throws Exception
   */
  public static void saveWithOutApproval(
      Connection con, JUser juser, String approval_type, String approval_type_name, String con_id)
      throws Exception {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = null;
    int idx = 1;
    int approvalCount = 0;

    sql =
        " select count(*) count from t_ym_process_approval where con_id = ? and approval_type = ?  ";

    pstmt = con.prepareStatement(sql);
    pstmt.setString(idx++, con_id);
    pstmt.setString(idx++, approval_type);
    rs = pstmt.executeQuery();
    if (rs.next()) {
      approvalCount = rs.getInt("count");
    }
    rs.close();
    pstmt.close();
    if (approvalCount > 0) return;
    idx = 1;
    sql =
        " insert into t_ym_process_approval(approval_id, con_id, approver, status, "
            + " approval_type, approval_type_name, creater, createrName, created) "
            + " values(?, ?, ?, 4,  ?, ?, ?, ?, ?) ";

    pstmt = con.prepareStatement(sql);
    pstmt.setString(idx++, JUtil.createUNID());
    pstmt.setString(idx++, con_id);
    pstmt.setString(idx++, "-1");
    pstmt.setString(idx++, approval_type);
    pstmt.setString(idx++, approval_type_name);
    pstmt.setString(idx++, juser.getUserId());
    pstmt.setString(idx++, juser.getUserName());
    pstmt.setTimestamp(idx++, new java.sql.Timestamp(System.currentTimeMillis()));
    pstmt.executeUpdate();
    pstmt.close();
  }
예제 #6
0
  /**
   * 获得国内合作渠道申请的默认审批人
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  private String calDefaultGnOrgApprover(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String xml = null;
    String company_id = JUtil.convertNull(request.getParameter("company_id"));
    String dep_id = JUtil.convertNull(request.getParameter("dep_id"));
    String contract_template = JUtil.convertNull(request.getParameter("contract_template"));
    String hasDomain_name = JUtil.convertNull(request.getParameter("hasDomain_name"));
    xml = "<?xml version='1.0' encoding='gbk'?>\n";
    org.jdom.Element eleRoot = new org.jdom.Element("root");
    org.jdom.Element eleRows = new org.jdom.Element("users");
    eleRoot.addContent(eleRows);
    org.jdom.Element eleRow = null;
    Connection con = null;
    try {
      con = com.gemway.igo.JDatabase.getJDatabase().getConnection();

      Map<String, JUser> mapUser =
          GnOrgApply.getDefaultApprover(con, company_id, dep_id, contract_template, hasDomain_name);
      if (mapUser != null) {
        for (String userId : mapUser.keySet()) {
          JUser user = mapUser.get(userId);
          if (user == null) continue;

          eleRow = new org.jdom.Element("user");
          eleRow.setAttribute("user_id", user.getUserId());
          eleRow.setAttribute("user_name", user.getUserName());
          eleRows.addContent(eleRow);
        }
      }
      org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter();
      xml += xmlout.outputString(eleRoot);
      // JLog.getLogger().debug("xml=\n" + xml);
      return xml.trim();
    } catch (Exception e) {
      JLog.getLogger().error("", e);
    } finally {
      if (con != null) con.close();
    }
    return "";
  }
예제 #7
0
  /**
   * 保存修改
   *
   * @param con
   * @throws Exception
   */
  public void save(Connection con, JUser juser) throws Exception {
    PreparedStatement pstmt = null;
    String sql = null;
    int idx = 1;
    int updateCount = 0;
    if (JUtil.convertNull(this.getApproval_id()).length() > 0) {
      sql =
          " update t_ym_process_approval set approver = ?, status = 2 where approval_id = ? and status in(1, 3) ";

      pstmt = con.prepareStatement(sql);
      pstmt.setString(idx++, this.getApprover());
      pstmt.setString(idx++, this.getApproval_id());
      updateCount = pstmt.executeUpdate();
      pstmt.close();
      if (updateCount != 1)
        throw new Exception(
            "更新的记录不只一条approval_id=" + this.getApproval_id() + " con_id=" + this.getCon_id());
    } else {
      sql =
          " insert into t_ym_process_approval(approval_id, con_id, approver, status, "
              + " approval_type, approval_type_name, creater, createrName, created) "
              + " values(?, ?, ?,2,  ?, ?, ?, ?, ?) ";

      pstmt = con.prepareStatement(sql);
      this.setApproval_id(JUtil.createUNID());
      pstmt.setString(idx++, this.getApproval_id());
      pstmt.setString(idx++, this.getCon_id());
      pstmt.setString(idx++, this.getApprover());
      pstmt.setString(idx++, this.getApproval_type());
      pstmt.setString(idx++, this.getApproval_type_name());
      pstmt.setString(idx++, juser.getUserId());
      pstmt.setString(idx++, juser.getUserName());
      pstmt.setTimestamp(idx++, new java.sql.Timestamp(System.currentTimeMillis()));
      pstmt.executeUpdate();
      pstmt.close();
    }
  }
예제 #8
0
  /**
   * 审批
   *
   * @param user
   * @param jobId
   * @param agree
   * @param suggest
   */
  public void approve(JUser user, String jobId, boolean agree, String suggest) throws Exception {
    Connection con = null;
    PreparedStatement pstmt = null;
    String sql = null;
    Job job = null;
    java.util.Map<String, Object> context = new java.util.HashMap<String, Object>();
    StringBuffer contextXML = new StringBuffer();

    context.put("user_id", user.getUserId()); // 当前操作人
    context.put("approveFlag", (agree ? "1" : "0")); // 审批标记
    context.put("suggest", suggest); // 审批意见
    boolean end = true;
    try {
      con = JDatabase.getJDatabase().getConnection();
      con.setAutoCommit(false);
      job = Job.getJobById(con, jobId);

      contextXML.append("<ContextData>");
      contextXML.append("<approval><flag>" + (agree ? "1" : "0") + "</flag></approval>");

      if (agree) {
        YmContract contract = YmContract.getYmContractByConId(con, this.getCon_id());
        YmProcessItem item =
            YmProcessItem.getYmProcessItem(contract.getApply_project(), this.getApproval_type());
        if (item != null
            && !user.getUserId().equals(this.getApprover())
            && item.getCon_lead_app() == 1) {
          end = false;
          contextXML.append("<approver>" + this.getApprover() + "</approver>");
        }
        contextXML.append("<Participants>");
        contextXML.append("<Participant type=\"user\">");
        if (item != null
            && !user.getUserId().equals(this.getApprover())
            && item.getCon_lead_app() == 1) {
          contextXML.append("<user>" + this.getApprover() + "</user>");
        }
        contextXML.append("</Participant>");
        contextXML.append("</Participants>");
      }
      contextXML.append("</ContextData>");
      context.put("contextXML", contextXML.toString());
      job.setContext(context);
      job.start(con);

      if (!agree) {
        sql = "update t_ym_process_approval set status = 3 where approval_id = ? ";
        pstmt = con.prepareStatement(sql);
        pstmt.setString(1, this.getApproval_id());
        pstmt.executeUpdate();
        pstmt.close();
        YmContract contract = YmContract.getYmContractByConId(con, this.getCon_id());
        int msgWay = JMessageEnum.SYSTEM_MESSAGE;

        Set<String> set = new HashSet<String>();
        set.add(contract.getCon_visa_con());
        if (!set.contains(contract.getCon_visa_guide())) set.add(contract.getCon_visa_guide());

        String toUserIds[] = new String[set.size()];
        int i = 0;
        for (Iterator<String> iter = set.iterator(); iter.hasNext(); i++) {
          toUserIds[i] = (String) iter.next();
        }

        String subject =
            contract.getCstm_name()
                + "的办理进程"
                + JUtil.convertNull(this.getApproval_type_name())
                + "审核未通过";
        String url = "/ym/processControl.jsp?cmd=update&con_id=" + this.getCon_id();
        JMessageAdapter.sendMessage(msgWay, toUserIds, subject, subject, "-1", url);
      } else if (job.getActivityId().equals("manager") && end) {
        this.pass(con, suggest);
      }
      con.commit();
    } catch (Exception e) {
      throw e;
    } finally {
      if (con != null) con.rollback();
      if (con != null) con.close();
    }
  }
예제 #9
0
  public static int delete(JUser user, Connection con, String[] sk_ids) throws Exception {
    int delRows = 0; // 删除的行数

    if (sk_ids == null) return delRows;
    PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null;
    ResultSet rs = null;
    String sql = null;

    // 下个月的 两个工作日内 可以修改
    java.util.Date two_workDate = CommonOptions.getConfirmerCanMoidyDate();

    sql = "delete from shinyway.emp_fl_sales where sk_id=? ";
    pstmt = con.prepareStatement(sql);

    sql = "delete from t_flschool_money where sk_id=? and sk_status !=1";
    pstmt1 = con.prepareStatement(sql);

    sql = "select count(*) from t_flschool_money where stu_id=?";
    pstmt2 = con.prepareStatement(sql);

    Connection con_igo = com.gemway.igo.JDatabase.getJDatabase().getConnection();
    String szOperateCompanyCodes = user.getOperateCompanyCodeClause(con_igo, "money", "fl_confirm");
    con_igo.close();

    for (int i = 0; i < sk_ids.length; i++) {
      boolean canDel = false;
      FLSchoolMoney moneyObj = FLSchoolMoney.getFLSchoolMoney(con, sk_ids[i]);

      java.util.Date oldSkDate = JUtil.str2SQLDate(moneyObj.getSk_date()); // 修改前的收款日期

      if ((moneyObj.getSk_status() == 0 || moneyObj.getSk_status() == 2)
          && JUtil.daysAfter(oldSkDate, two_workDate) <= 0) {
        // 审核状态的数据不能删除
        if (user.HasFunc("fl_confirm", "money")
            && szOperateCompanyCodes.indexOf(moneyObj.getCompany_code()) != -1) {
          canDel = true; // 有审核权限的人只能删除一个工作日之内的数据
        } else if (moneyObj.getCreater().equals(user.getUserId())) {
          canDel = true; // 无审核权限的人只能删除自己录入的一个工作日之内的数据
        }
      }
      if (canDel) {
        int updateCount = 0;

        pstmt.setString(1, sk_ids[i]);
        pstmt.executeUpdate();

        pstmt1.setString(1, sk_ids[i]);
        updateCount = pstmt1.executeUpdate();
        if (updateCount > 1) throw new Exception("删除记录超过一条");
        delRows++;

        String stu_id = moneyObj.getStu_id();

        pstmt2.setString(1, stu_id);
        rs = pstmt2.executeQuery();
        rs.next();
        int count = rs.getInt(1);
        rs.close();

        FLSchoolStu.setStatData(con, stu_id);

        if (count == 0) FLSchoolStu.delete(con, stu_id);
        rs.close();
      }
    }
    pstmt.close();
    pstmt1.close();
    pstmt2.close();

    return delRows;
  }
예제 #10
0
  public void save(Connection con, JUser user) throws Exception {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String qry = null;
    java.util.Date skDate = JUtil.str2SQLDate(sk_date);
    java.util.Date today = new java.util.Date();
    java.util.Date two_workDate = CommonOptions.getConfirmerCanMoidyDate();

    if (JUtil.daysAfter(skDate, today) < 0) {
      throw new Exception("收款日期不能在今天之后");
    }
    if (JUtil.daysAfter(skDate, two_workDate) > 0) {
      throw new Exception("收款日期不能在" + JUtil.formatDate(two_workDate, "YYYY-MM-DD") + "之前");
    }

    if (this.company_code.length() == 0) throw new Exception("公司代码不能为空");
    if (this.invoice_type.length() == 0) throw new Exception("开票类型不能为空");
    if (this.currency.length() == 0) throw new Exception("币种不能为空");
    SKItem itemObj = SKItem.getSkItem(sk_item);
    if (itemObj.getItem_type() == 1 || itemObj.getItem_type() == 9 || sk_item.equals("fl.yj.htk")) {
      if (branch_id == null || branch_id.length() == 0) throw new Exception("费用归属分校不能为空");
    }

    if (course_con_id == null || course_con_id.length() == 0) {
      qry =
          "select a.emp_id "
              + "  from shinyway.fl_sale_dist a, t_flschool_student b "
              + " where a.cs_stu_id=b.cs_stu_id and b.stu_id=?"
              + " order by a.row_no";
      pstmt = con.prepareStatement(qry);
      pstmt.setString(1, stu_id);
      rs = pstmt.executeQuery();
      if (rs.next()) course_con_id = rs.getString("emp_id");
      rs.close();
      pstmt.close();
    }

    String skPosName = null;
    if (JSkPos.getSkPosById(sk_pos_id) == null) {
      sk_pos_id = null;
    } else {
      skPosName = JSkPos.getSkPosById(sk_pos_id).getPos_name(); // 收款点名称
    }

    if (sk_id.length() > 0) {
      java.util.Date oldSkDate =
          JUtil.str2SQLDate(FLSchoolMoney.getFLSchoolMoney(con, sk_id).getSk_date()); // 修改前的收款日期
      if (JUtil.daysAfter(oldSkDate, two_workDate) > 0) {
        throw new Exception("不能修改一个工作日前的数据");
      }
      qry =
          " update t_flschool_money "
              + "    set company_code=?, branch_id=?, sk_pos_id=?, sk_pos_name=?, "
              + "        sk_date =?, is_sk=?, stu_id=?,   invoice_type=?, sk_money=?, "
              + "        sk_item=?,  currency=?, course_con_id=?, ds_unit_id=?,  "
              + "        sk_memo=?, modified=?, modifier=?, sk_type=?"
              + "  where sk_id=?";
      int colIndex = 1;
      pstmt = con.prepareStatement(qry);

      pstmt.setString(colIndex++, this.company_code);
      pstmt.setString(colIndex++, this.branch_id);
      pstmt.setString(colIndex++, this.sk_pos_id);
      pstmt.setString(colIndex++, skPosName);
      pstmt.setDate(colIndex++, JUtil.str2SQLDate(sk_date));
      pstmt.setInt(colIndex++, this.is_sk);
      pstmt.setString(colIndex++, this.stu_id);
      pstmt.setString(colIndex++, this.invoice_type);
      pstmt.setString(colIndex++, sk_money);
      pstmt.setString(colIndex++, sk_item);
      pstmt.setString(colIndex++, currency);
      pstmt.setString(colIndex++, this.course_con_id);

      if (ds_unit_id.length() == 0) pstmt.setString(colIndex++, null);
      else pstmt.setString(colIndex++, ds_unit_id);
      pstmt.setString(colIndex++, sk_memo);
      pstmt.setTimestamp(colIndex++, new java.sql.Timestamp(System.currentTimeMillis()));
      pstmt.setString(colIndex++, user.getUserId());
      pstmt.setString(colIndex++, this.sk_type);
      pstmt.setString(colIndex++, sk_id);
      pstmt.executeUpdate();
      pstmt.close();
    } else {
      sk_id = com.gemway.util.ID.getIDObject("DEFAULT").create();

      qry =
          " insert into t_flschool_money "
              + "   (sk_id,     company_code,  branch_id, stu_id,    sk_pos_id,    sk_pos_name,  sk_date,      "
              + "    is_sk,     invoice_type,  sk_money,  sk_item,   currency,     course_con_id,  "
              + "    tk_pay_id, df_pay_id, ds_unit_id,    sk_memo,   sk_status,   creater, created, sk_type) "
              + " values(?,?,?,?,?,?,?,   ?,?,?,?,?,?,  ?,?,?,?,0,?,sysdate,?)";

      int colIndex = 1;
      pstmt = con.prepareStatement(qry);
      pstmt.setString(colIndex++, sk_id);
      pstmt.setString(colIndex++, this.company_code);
      pstmt.setString(colIndex++, this.branch_id);
      pstmt.setString(colIndex++, this.stu_id);
      pstmt.setString(colIndex++, this.sk_pos_id);
      pstmt.setString(colIndex++, skPosName);
      pstmt.setDate(colIndex++, JUtil.str2SQLDate(sk_date));

      pstmt.setInt(colIndex++, this.is_sk);
      pstmt.setString(colIndex++, this.invoice_type);
      pstmt.setDouble(colIndex++, Double.parseDouble(sk_money));
      pstmt.setString(colIndex++, sk_item);
      pstmt.setString(colIndex++, currency);
      pstmt.setString(colIndex++, this.course_con_id);

      pstmt.setString(colIndex++, this.tk_pay_id);
      pstmt.setString(colIndex++, this.df_pay_id);
      pstmt.setString(colIndex++, ds_unit_id.length() == 0 ? null : ds_unit_id);
      pstmt.setString(colIndex++, sk_memo);
      pstmt.setString(colIndex++, user.getUserId());
      pstmt.setString(colIndex++, this.sk_type);
      pstmt.executeUpdate();
      pstmt.close();
    }

    com.gemway.igo.fl.kh.SaleDist.distSkSales(con, sk_id);
    FLSchoolStu.setStatData(con, this.stu_id);
  }
예제 #11
0
 public String getModifierName() {
   if (modifier == null || modifier.length() == 0) return "";
   return JUser.getUserName(modifier);
 }
예제 #12
0
 public String getCreaterName() {
   if (creater == null || creater.length() == 0) return "";
   return JUser.getUserName(creater);
 }
예제 #13
0
  /**
   * 审批
   *
   * @param user
   * @param jobId
   * @param agree
   * @param suggest
   */
  public void approve(JUser user, String jobId, boolean agree, String suggest) throws Exception {
    GroupBook book = null;
    Connection con = null;
    PreparedStatement pstmt = null;
    String sql = null;
    Job job = null;
    java.util.Map<String, Object> context = new java.util.HashMap<String, Object>();
    StringBuffer contextXML = new StringBuffer();

    context.put("user_id", user.getUserId()); // 当前操作人
    context.put("approveFlag", (agree ? "1" : "0")); // 审批标记
    context.put("suggest", suggest); // 审批意见

    try {
      con = JDatabase.getJDatabase().getConnection();
      con.setAutoCommit(false);
      book = GroupBook.getGroupBook(con, this.getGroup_id());
      job = Job.getJobById(con, jobId);
      contextXML.append("<ContextData>");

      if (agree) {
        contextXML.append("<onlyManager>N</onlyManager>");
        contextXML.append("<Participants>");
        contextXML.append("<Participant type=\"user\"></Participant>");
        contextXML.append("</Participants>");
      }
      contextXML.append("</ContextData>");

      context.put("contextXML", contextXML.toString());
      job.setContext(context);
      job.start(con);

      if (!agree) {
        int msgWay = JMessageEnum.SYSTEM_MESSAGE;
        String subject = null;

        sql = "update t_ym_book set group_status = 3 where group_id = ? ";
        subject =
            book.getGroup_name()
                + "的"
                + GroupBasic.getGroupTypeName(this.getGroup_type())
                + "审批未通过,原因:"
                + suggest;
        pstmt = con.prepareStatement(sql);
        pstmt.setString(1, this.getGroup_id());
        pstmt.executeUpdate();
        pstmt.close();
        JMessageAdapter.sendMessage(
            msgWay,
            new String[] {book.getZxgw_id()},
            subject,
            subject,
            "-1",
            "/ym/group/groupBookControl.jsp?cmd=update&group_id=" + this.getGroup_id(),
            1);
      } else if (job.getActivityId().equals("manager")) {
        this.pass(con, user);
      }

      con.commit();
    } catch (Exception e) {
      throw e;
    } finally {
      if (con != null) con.rollback();
      if (con != null) con.close();
    }
  }
예제 #14
0
  /**
   * 根据地区代码或学校关键字得到学校
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  private String checkRepeatGnOrg(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String xml = "<?xml version='1.0' encoding='gbk'?>\n";
    org.jdom.Element eleRoot = new org.jdom.Element("root");

    CNHttpServletRequest _req = new CNHttpServletRequest(request);
    String company_id_kwd = JUtil.convertNull(_req.getParameter("company_id_kwd"));
    // String dep_id_kwd = JUtil.convertNull(_req.getParameter("dep_id_kwd"));
    String org_id_kwd = JUtil.convertNull(_req.getParameter("org_id_kwd"));
    String org_name_kwd =
        JUtil.convertNull(
            java.net.URLDecoder.decode(request.getParameter("org_name_kwd"), "utf-8"));
    // String org_name_kwd = JUtil.convertNull(_req.getParameter("org_name_kwd"));
    if (org_name_kwd.length() == 0) throw new Exception("机构名称为空!");
    if (org_id_kwd.length() == 0) org_id_kwd = "-";
    com.gemway.igo.page.Page pageObj = new com.gemway.igo.page.PageOracle();
    java.util.List<com.gemway.igo.page.PageHashMap<String, Object>> lsDate = null;
    pageObj.setRequest(_req);
    org.jdom.Element eleRows = null;

    pageObj.setSelectPartSql(
        "company_id, a.org_id, org_no, org_name, shinyway_contracter, org_type");
    pageObj.setFromPartSql("t_gn_org_company a, t_gn_org b");
    pageObj.addWherePartSql(" a.org_id = b.org_id ");
    pageObj.addWherePartSql(" a.org_id != '" + org_id_kwd + "'");
    pageObj.getPageInfo().setSize(21);
    pageObj.addWherePartSql(" org_name = ? ");
    pageObj.addWhereParam(org_name_kwd);
    pageObj.setOrderByPartSql(" created desc ");
    try {
      lsDate = pageObj.getPageData();
    } catch (Exception e) {
      e.printStackTrace();
    }

    for (int i = 0; i < lsDate.size(); i++) {
      com.gemway.igo.page.PageHashMap<String, Object> data = lsDate.get(i);
      eleRows = new org.jdom.Element("org");
      if (data.getString("company_id").equals(company_id_kwd)) {
        // eleRows = new org.jdom.Element("org");
      } else {
        // eleRows = new org.jdom.Element("other_company_org");
      }
      eleRows.setAttribute("company_id", data.getString("company_id"));
      eleRows.setAttribute(
          "company_name", JUnit.getUnit(data.getString("company_id")).getUnit_name());
      eleRows.setAttribute("org_id", data.getString("org_id"));
      eleRows.setAttribute("org_no", data.getString("org_no"));
      eleRows.setAttribute("org_name", data.getString("org_name"));
      eleRows.setAttribute("org_type", GnOrgBean.getOrgTypeNameById(data.getString("org_type")));
      eleRows.setAttribute(
          "shinyway_contracter",
          data.getString("shinyway_contracter") == null
              ? ""
              : JUser.getUserName(data.getString("shinyway_contracter")));

      eleRoot.addContent(eleRows);
    }

    org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter();

    xml += xmlout.outputString(eleRoot);
    JLog.getLogger().debug("xml=\n" + xml);
    return xml.trim();
  }