예제 #1
0
 // 导入项目工兼职教师人员
 public void batchSaveWageEmpPerson(List<Map> list, String importType) throws SysException {
   String sql =
       "update a239 set a239200=null,a239201=null where id in (select id from a001 where A001054='"
           + importType
           + "')";
   this.jdbcTemplate.execute(sql);
   for (Map m : list) {
     UserBO bo = new UserBO();
     bo.setName(m.get("name").toString());
     bo.setDeptId(m.get("deptID").toString());
     bo.setPersonType(m.get("personType").toString());
     bo.setHasCashStr(m.get("hasCash").toString());
     bo.setCardNO(m.get("card").toString());
     bo.setBankNO(m.get("bank") == null ? "" : m.get("bank").toString());
     if (m.get("id") != null) {
       bo.setUserID(m.get("id").toString());
       bo.setPersonSeq(m.get("personCode").toString());
     }
     saveWageEmpPerson(bo, String.valueOf(m.get("wage")), String.valueOf(m.get("other")));
   }
 }
예제 #2
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);
    }
  }