Example #1
0
  public static Purchase jsonToObject(JSONObject jsonObject) {
    Purchase model = new Purchase();
    if (jsonObject.containsKey("purchaseid")) {
      model.setPurchaseid(jsonObject.getLong("purchaseid"));
    }
    if (jsonObject.containsKey("purchaseno")) {
      model.setPurchaseno(jsonObject.getString("purchaseno"));
    }
    if (jsonObject.containsKey("area")) {
      model.setArea(jsonObject.getString("area"));
    }
    if (jsonObject.containsKey("company")) {
      model.setCompany(jsonObject.getString("company"));
    }
    if (jsonObject.containsKey("dept")) {
      model.setDept(jsonObject.getString("dept"));
    }
    if (jsonObject.containsKey("post")) {
      model.setPost(jsonObject.getString("post"));
    }
    if (jsonObject.containsKey("appuser")) {
      model.setAppuser(jsonObject.getString("appuser"));
    }
    if (jsonObject.containsKey("appdate")) {
      model.setAppdate(jsonObject.getDate("appdate"));
    }
    if (jsonObject.containsKey("purchasesum")) {
      model.setPurchasesum(jsonObject.getDouble("purchasesum"));
    }
    if (jsonObject.containsKey("status")) {
      model.setStatus(jsonObject.getInteger("status"));
    }
    if (jsonObject.containsKey("processname")) {
      model.setProcessname(jsonObject.getString("processname"));
    }
    if (jsonObject.containsKey("processinstanceid")) {
      model.setProcessinstanceid(jsonObject.getLong("processinstanceid"));
    }
    if (jsonObject.containsKey("wfstatus")) {
      model.setWfstatus(jsonObject.getLong("wfstatus"));
    }
    if (jsonObject.containsKey("createBy")) {
      model.setCreateBy(jsonObject.getString("createBy"));
    }
    if (jsonObject.containsKey("createDate")) {
      model.setCreateDate(jsonObject.getDate("createDate"));
    }
    if (jsonObject.containsKey("updateDate")) {
      model.setUpdateDate(jsonObject.getDate("updateDate"));
    }
    if (jsonObject.containsKey("updateBy")) {
      model.setUpdateBy(jsonObject.getString("updateBy"));
    }

    return model;
  }
  // 添加面试人记录
  public String addInterview() {
    // System.out.println(jsonObject.getInteger("apid"));
    Apply apply = applyDAO.findById(jsonObject.getInteger("apid"));
    // System.out.println(apply);
    // 判断是否面试表已有该记录
    if (apply.getInterviews().isEmpty()) { // 如果没有该记录,则可添加
      Interview interview = new Interview();
      // interview.setStaff(staffDAO.findById(1));//暂时默认面试官为1号面试官,interviewerId
      // int sid = (Integer) ServletActionContext.getRequest().getSession().getAttribute("sid");
      interview.setStaff(staffDAO.findById(1));
      interview.setApply(apply); // 通过关联映射,设置apid的值。		
      interview.setTime(jsonObject.getDate("date"));
      interview.setRemark(jsonObject.getString("remark"));
      // 给ranK设置一个""空字符代替NULL值,方便操作
      interview.setRank("");
      interview.setPass(-1);
      interview.setEvaluate("");
      interviewDAO.save(interview);
      interviewDAO.attachDirty(interview);
    } else {
      map.put("exist", 1);
    }

    return SUCCESS;
  }
Example #3
0
  public static SysUser jsonToObject(JSONObject jsonObject) {
    SysUser model = new SysUser();

    if (jsonObject.containsKey("actorId")) {
      model.setActorId(jsonObject.getString("actorId"));
    }
    if (jsonObject.containsKey("account")) {
      model.setActorId(jsonObject.getString("account"));
    }
    if (jsonObject.containsKey("name")) {
      model.setName(jsonObject.getString("name"));
    }

    if (jsonObject.containsKey("evection")) {
      model.setEvection(jsonObject.getIntValue("evection"));
    }

    if (jsonObject.containsKey("gender")) {
      model.setGender(jsonObject.getIntValue("gender"));
    }

    if (jsonObject.containsKey("userType")) {
      model.setUserType(jsonObject.getIntValue("userType"));
    }

    if (jsonObject.containsKey("accountType")) {
      model.setAccountType(jsonObject.getIntValue("accountType"));
    }

    if (jsonObject.containsKey("dumpFlag")) {
      model.setDumpFlag(jsonObject.getIntValue("dumpFlag"));
    }

    if (jsonObject.containsKey("createDate")) {
      model.setCreateDate(jsonObject.getDate("createDate"));
    }

    if (jsonObject.containsKey("createBy")) {
      model.setCreateBy(jsonObject.getString("createBy"));
    }
    if (jsonObject.containsKey("updateBy")) {
      model.setUpdateBy(jsonObject.getString("updateBy"));
    }
    if (jsonObject.containsKey("updateDate")) {
      model.setUpdateDate(jsonObject.getDate("updateDate"));
    }

    if (jsonObject.containsKey("lastLoginTime")) {
      model.setLastLoginTime(jsonObject.getDate("lastLoginTime"));
    }

    if (jsonObject.containsKey("lastLoginIP")) {
      model.setLastLoginIP(jsonObject.getString("lastLoginIP"));
    }

    if (jsonObject.containsKey("remark")) {
      model.setRemark(jsonObject.getString("remark"));
    }

    if (jsonObject.containsKey("deptId")) {
      model.setDeptId(jsonObject.getInteger("deptId"));
    }

    if (jsonObject.containsKey("mail")) {
      model.setMail(jsonObject.getString("mail"));
    }

    if (jsonObject.containsKey("mobile")) {
      model.setMobile(jsonObject.getString("mobile"));
    }

    if (jsonObject.containsKey("telephone")) {
      model.setTelephone(jsonObject.getString("telephone"));
    }

    if (jsonObject.containsKey("headship")) {
      model.setHeadship(jsonObject.getString("headship"));
    }

    if (jsonObject.containsKey("superiorIds")) {
      model.setSuperiorIds(jsonObject.getString("superiorIds"));
    }

    if (jsonObject.containsKey("status")) {
      model.setStatus(jsonObject.getString("status"));
    }

    if (jsonObject.containsKey("adminFlag")) {
      model.setAdminFlag(jsonObject.getString("adminFlag"));
    }

    if (jsonObject.containsKey("userRoles")) {
      JSONArray array = jsonObject.getJSONArray("userRoles");
      if (array != null && !array.isEmpty()) {
        for (int i = 0; i < array.size(); i++) {
          JSONObject json = array.getJSONObject(i);
          SysUserRole r = SysUserRoleJsonFactory.jsonToObject(json);
          model.getUserRoles().add(r);
        }
      }
    }

    if (jsonObject.containsKey("roles")) {
      JSONArray array = jsonObject.getJSONArray("roles");
      if (array != null && !array.isEmpty()) {
        for (int i = 0; i < array.size(); i++) {
          JSONObject json = array.getJSONObject(i);
          SysRole r = SysRoleJsonFactory.jsonToObject(json);
          model.getRoles().add(r);
        }
      }
    }

    if (jsonObject.containsKey("functions")) {
      JSONArray array = jsonObject.getJSONArray("functions");
      if (array != null && !array.isEmpty()) {
        for (int i = 0; i < array.size(); i++) {
          JSONObject json = array.getJSONObject(i);
          SysFunction r = SysFunctionJsonFactory.jsonToObject(json);
          model.getFunctions().add(r);
        }
      }
    }

    if (jsonObject.containsKey("apps")) {
      JSONArray array = jsonObject.getJSONArray("apps");
      if (array != null && !array.isEmpty()) {
        for (int i = 0; i < array.size(); i++) {
          JSONObject json = array.getJSONObject(i);
          SysApplication r = SysApplicationJsonFactory.jsonToObject(json);
          model.getApps().add(r);
        }
      }
    }

    return model;
  }
 // 面试官通知面试时间
 public String saveTime() {
   Interview interview = interviewDAO.findById(jsonObject.getInteger("iid"));
   interview.setTime(jsonObject.getDate("time"));
   interviewDAO.attachDirty(interview);
   return SUCCESS;
 }