Пример #1
0
  // 保存项目工兼职教师人员
  public void saveWageEmpPerson(UserBO user, String wage, String other) throws SysException {

    boolean isnew = user.getUserID() == null ? true : false;
    if (isnew) {
      String sql = "select personnum_sequence.nextval from dual";
      int code = this.jdbcTemplate.queryForInt(sql);
      user.setPersonSeq(code + "");
      user.setComeDate(CommonFuns.getSysDate("yyyy-MM-dd"));
    }
    PersonBO pEdit = null;
    if (!isnew) {
      pEdit = SysCacheTool.findPersonById(user.getUserID());
    }
    OrgBO org = SysCacheTool.findOrgById(user.getDeptId());
    OrgBO superOrg = SysCacheTool.findOrgById(org.getSuperId());
    user.setDeptSort(org.getTreeId());
    user.setMainDeptSort(superOrg.getTreeId());
    user.setOrgId(superOrg.getOrgId());
    if (user.isHasCash()) {
      user.setHasCashStr("1");
    } else {
      user.setHasCashStr("0");
    }
    HibernateTemplate temp = (HibernateTemplate) SysContext.getBean("hibernateTemplate");
    temp.saveOrUpdate(user);
    temp.flush();

    // 添加
    if (isnew) {
      String sql =
          "insert into sys_user_info s (s.person_id,s.login_name,login_pwd,s.is_use) values ('"
              + user.getUserID()
              + "','"
              + user.getName()
              + "','98f6bcd4621d373cade4e832627b4f6',0)";
      this.jdbcTemplate.execute(sql);
      String wageOrgId = superOrg.getOrgId();
      sql =
          "insert into a795 (id,a795701,a795705,a795708,a795710,a795718,a795720,a795725) values ('"
              + user.getUserID()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "')";
      this.jdbcTemplate.execute(sql);
      sql =
          "insert into a239 (id,a239200,a239201) values ('"
              + user.getUserID()
              + "','"
              + wage
              + "','"
              + other
              + "')";
      this.jdbcTemplate.execute(sql);
    } else {
      String sql =
          "update a239 set a239200='"
              + wage
              + "',a239201='"
              + other
              + "' where id='"
              + user.getUserID()
              + "'";
      this.jdbcTemplate.execute(sql);
    }
  }