コード例 #1
0
ファイル: Card.java プロジェクト: fuhongliang/hr-pure
  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();
  }
コード例 #2
0
ファイル: GroupBook.java プロジェクト: fuhongliang/hr-pure
  public String createGroupNO() throws Exception {
    String group_no = null;

    String group_no_temp = ID.getIDObject("YM_GROUP_" + group_type + "_NO").create();
    group_no =
        group_no_temp.substring(0, 4)
            + group_type
            + group_no_temp.substring(4, group_no_temp.length());
    return group_no;
  }
コード例 #3
0
 public void save(Connection con_hr, boolean approverEdit) throws Exception {
   PreparedStatement pstmt = null;
   int indx = 1;
   String sql = null;
   if (JUtil.convertNull(this.term_id).length() == 0) {
     sql = " insert into  t_emp_assess_detail(term_id,assess_id,term_code) values(?,?,?)";
     this.term_id = com.gemway.util.ID.getIDObject("default").create();
     pstmt = con_hr.prepareStatement(sql);
     pstmt.setString(indx++, this.term_id);
     pstmt.setString(indx++, this.assess_id);
     pstmt.setString(indx++, this.term_code);
     pstmt.executeUpdate();
     pstmt.close();
   }
   lsParam = this.getLsParam();
   if (lsParam.size() > 0) {
     for (TermParam paramObj : lsParam) {
       indx = 1;
       if (JUtil.convertNull(paramObj.term_id).length() == 0) {
         sql =
             "insert into t_assess_term_param(term_id,param_name,param_value_emp,param_value_guider) values(?,?,?,?)";
         pstmt = con_hr.prepareStatement(sql);
         pstmt.setString(indx++, this.term_id);
         pstmt.setString(indx++, paramObj.param_name);
         pstmt.setInt(indx++, paramObj.param_value_emp);
         pstmt.setInt(indx++, paramObj.param_value_guider);
         pstmt.executeUpdate();
         pstmt.close();
       } else {
         if (approverEdit) {
           sql =
               "update t_assess_term_param set param_value_emp=? where term_id =? and param_name=? ";
           pstmt = con_hr.prepareStatement(sql);
           pstmt.setInt(indx++, paramObj.param_value_emp);
           pstmt.setString(indx++, paramObj.term_id);
           pstmt.setString(indx++, paramObj.param_name);
         } else {
           sql =
               "update t_assess_term_param set param_value_guider=? where term_id =? and param_name=? ";
           pstmt = con_hr.prepareStatement(sql);
           pstmt.setInt(indx++, paramObj.param_value_guider);
           pstmt.setString(indx++, paramObj.term_id);
           pstmt.setString(indx++, paramObj.param_name);
         }
         pstmt.executeUpdate();
         pstmt.close();
       }
     }
   }
 }
コード例 #4
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);
  }
コード例 #5
0
  /**
   * 格式化某位员工 某一天的 考勤信息
   *
   * @param con
   * @param schedule_id 某节课ID t_fl_class_schedule.line_id
   * @throws Exception
   */
  private static void formatClassSchedule(Connection con, ScheduleDate scheduleObj)
      throws Exception {
    Connection con_igo = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = null;
    StuKqFormatNew stuKqFormatNewObj = null;
    String class_id = null;
    java.sql.Timestamp begin_time = null;

    class_id = scheduleObj.getClass_id();
    begin_time = scheduleObj.getBegin_time();

    String szClassDate = JUtil.formatDate(begin_time, "YYYY-MM-DD");

    java.sql.Timestamp dKqDate = new java.sql.Timestamp(JUtil.str2SQLDate(szClassDate).getTime());
    java.sql.Timestamp nextDate = new java.sql.Timestamp(JUtil.relativeDate(dKqDate, 1).getTime());

    java.util.List<StuKqFormatNew> lsStuKqFormatNew = new java.util.ArrayList<StuKqFormatNew>();
    try {
      // 附加学生基本信息
      con_igo = com.gemway.igo.JDatabase.getJDatabase().getConnection();

      sql =
          "	select a.stu_id, b.stu_no, b.company_id, b.father_phone, c.cstm_name, c.cstm_phone, c.cstm_handset  "
              + " from t_fl_course_stu a, t_fl_student b, t_custom c "
              + " where a.cstm_id=b.cstm_id and b.cstm_id = c.cstm_id and a.course_id=?";
      pstmt = con_igo.prepareStatement(sql);
      pstmt.setString(1, class_id);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        stuKqFormatNewObj = new StuKqFormatNew();
        stuKqFormatNewObj.setKq_id(com.gemway.util.ID.getIDObject("DEFAULT").create());
        stuKqFormatNewObj.setKq_date(JUtil.str2SQLDate(szClassDate));
        stuKqFormatNewObj.setClass_id(scheduleObj.getClass_id());
        stuKqFormatNewObj.setLine_id(scheduleObj.getLine_id());
        stuKqFormatNewObj.setStu_name(rs.getString("cstm_name"));
        stuKqFormatNewObj.setStu_no(rs.getString("stu_no"));
        stuKqFormatNewObj.setIs_late(0);
        stuKqFormatNewObj.setEarlygo(0);
        stuKqFormatNewObj.setAbsenteeism(0);
        stuKqFormatNewObj.setLeave_out(0);
        stuKqFormatNewObj.setFather_phone(rs.getString("father_phone"));
        lsStuKqFormatNew.add(stuKqFormatNewObj);
      }
      rs.close();
      pstmt.close();
    } catch (Exception e) {
      throw e;
    } finally {
      if (con_igo != null) con_igo.close();
    }

    // 格式化前删除原来信息
    sql = "delete from t_fl_stu_kq_format_new where line_id=?";
    pstmt = con.prepareStatement(sql);
    pstmt.setString(1, scheduleObj.getLine_id());
    pstmt.executeUpdate();
    pstmt.close();

    for (int i = 0; i < lsStuKqFormatNew.size(); i++) {
      stuKqFormatNewObj = lsStuKqFormatNew.get(i);
      sql =
          " insert into t_fl_stu_kq_format_new "
              + " (kq_id, kq_date, class_id, line_id, stu_name, stu_no, is_late, "
              + "  earlygo, absenteeism, leave_out, father_phone, created) "
              + " values(?,?,?,?,?,?,?,?,?,?,?,?)";
      pstmt = con.prepareStatement(sql);
      int rowIndex = 1;
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getKq_id());
      pstmt.setDate(rowIndex++, stuKqFormatNewObj.getKq_date());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getClass_id());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getLine_id());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getStu_name());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getStu_no());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getIs_late());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getEarlygo());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getAbsenteeism());
      pstmt.setInt(rowIndex++, stuKqFormatNewObj.getLeave_out());
      pstmt.setString(rowIndex++, stuKqFormatNewObj.getFather_phone());
      pstmt.setTimestamp(rowIndex++, new java.sql.Timestamp(System.currentTimeMillis()));
      pstmt.executeUpdate();
      pstmt.close();
    }
  }