Пример #1
0
 /**
  * 修复地区名称为地区代码 (comInterview)
  *
  * @param page
  */
 public void fixComInterviewJobLocationToCode(Page<ComInterview> page) {
   if (page == null || CollectionUtils.isEmpty(page.getItems())) {
     return;
   }
   for (ComInterview comInterview : page.getItems()) {
     if (StringUtils.isNotBlank(comInterview.getJobLocation())) {
       List<Integer> jobLocationList = Lists.newArrayList();
       String[] jobLocationArr = comInterview.getJobLocation().split(",");
       for (String location : jobLocationArr) {
         Integer code = OptionMap.getCityCodeByAddr(location);
         if (code != null && code > 0 && !NumberUtils.isNumber(location)) {
           jobLocationList.add(code);
         }
       }
       if (CollectionUtils.isNotEmpty(jobLocationList)) {
         comInterview.setJobLocation(StringUtils.join(jobLocationList, ","));
       }
     }
   }
 }
Пример #2
0
  public void fillBuyHistoryPerInfo(ComResumeBuyHistory comResumeBuyHistory) {
    if (comResumeBuyHistory != null && StringUtils.isBlank(comResumeBuyHistory.getSchoolName())) {
      Integer perId = comResumeBuyHistory.getPerUserId();
      Integer id = comResumeBuyHistory.getId();

      try {
        Map<String, Object> perMap =
            getJdbcTemplate().queryForMap("SELECT * FROM per_user WHERE id=?", perId);

        String birthday = ObjectUtils.toString(perMap.get("birthday"));
        Integer age = 16;
        if (StringUtils.isNotBlank(birthday)) {
          // 计算年龄的公司修改为精确到年与搜索引擎匹配
          DateTime bDate = new DateTime(birthday);
          bDate = bDate.monthOfYear().setCopy(1).dayOfMonth().setCopy(1);
          DateTime nDate = DateTime.now();
          nDate = nDate.monthOfYear().setCopy(1).dayOfMonth().setCopy(1);
          age = Years.yearsBetween(bDate, nDate).getYears();
          age = (age < 16 || age > 65) ? 16 : age;
        }
        Integer gender = NumberUtils.toInt(ObjectUtils.toString(perMap.get("gender")), 0);
        Integer jobyearType = NumberUtils.toInt(ObjectUtils.toString(perMap.get("jobyearType")), 0);
        String schoolName = "";
        String speciality = "";
        String genderStr = OptionMap.getValueByType(OptionMap.OptionType.OPT_GENDER, gender, null);

        PerUser perUser = perUserEao.get(perId);
        if (perUser != null) {
          PerResumeBo vo;
          try {
            vo = perResumeEao.getResumeVo(perUser.getResId());
          } catch (Exception ex) {
            vo = null;
          }
          if (vo != null) {
            int degree = 0;
            if (vo.getEducationInfoVoList() != null) {
              for (PerResumeBo.EducationInfoVo eduVo : vo.getEducationInfoVoList()) {
                if (eduVo != null && eduVo.getDegree() != null && eduVo.getDegree() > degree) {
                  degree = eduVo.getDegree();
                  schoolName = eduVo.getSchoolName();
                  speciality = eduVo.getSpeciality();
                }
              }
            }
          }
        }
        String degreeStr =
            OptionMap.getValueByType(OptionMap.OptionType.OPT_PER_DEGREE, gender, null);
        ;

        comResumeBuyHistory.setAge(age);
        comResumeBuyHistory.setGender(genderStr);
        comResumeBuyHistory.setDegree(degreeStr);
        comResumeBuyHistory.setSchoolName(schoolName);
        comResumeBuyHistory.setSpeciality(speciality);
        comResumeBuyHistory.setJobyear(jobyearType);

        getJdbcTemplate()
            .update(
                "UPDATE com_resume_buy_history SET "
                    + " age = ?,"
                    + " gender = ?,"
                    + " degree = ?,"
                    + " school_name = ? "
                    + " speciality = ? "
                    + " jobyear = ? "
                    + " WHERE "
                    + " id=? ",
                age,
                genderStr,
                degreeStr,
                schoolName,
                speciality,
                jobyearType,
                id);

      } catch (Exception e) {
        // 不处理
      }
    }
  }