예제 #1
0
 /**
  * @param e
  * @param errorCode
  * @param propertyPath
  */
 public static void assertViolationContainsTemplateAndPath(
     final ConstraintViolationException e, final String errorCode, final String propertyPath) {
   Assert.assertNotNull(e.getConstraintViolations());
   Assert.assertEquals(1, CollectionUtils.size(e.getConstraintViolations()));
   final ConstraintViolation<?> violation = e.getConstraintViolations().iterator().next();
   Assert.assertEquals(errorCode, violation.getMessageTemplate());
   Assert.assertEquals(propertyPath, violation.getPropertyPath().toString());
 }
예제 #2
0
 /**
  * Returns the id of the token. The signature is identified by its index: 0 for the first one.
  *
  * @param index (position/order) of the signature within the report
  * @return {@code String} identifying the token
  */
 public String getBasicBuildingBlocksSignatureId(final int index) {
   List<XmlBasicBuildingBlocks> bbbs = jaxbDetailedReport.getBasicBuildingBlocks();
   if (CollectionUtils.size(bbbs) >= index) {
     XmlBasicBuildingBlocks bbb = jaxbDetailedReport.getBasicBuildingBlocks().get(index);
     if (bbb != null) {
       return bbb.getId();
     }
   }
   return null;
 }
  /**
   * 批量更新持有记录状态
   *
   * @param holdLoanIds
   * @param versions
   * @param status
   * @return
   */
  public int batchUpdate(
      final List<Integer> holdLoanIds,
      final List<Integer> versions,
      final MiddleManHoldLoanStatus status) {
    final int updateSize =
        CollectionUtils.isNotEmpty(holdLoanIds) ? CollectionUtils.size(holdLoanIds) : 0;

    StringBuffer sql = new StringBuffer();
    sql.append(" UPDATE biz_middle_man_hold_loan ");
    sql.append(" 	SET hold_status = ?,         ");
    sql.append(" 	    last_update_datetime = ?,");
    sql.append(" 	    version = version + 1    ");
    sql.append(" WHERE                           ");
    sql.append(" 	id = ?                       ");
    sql.append(" and version = ?                 ");

    int[] result =
        this.jdbcTemplate.batchUpdate(
            sql.toString(),
            new BatchPreparedStatementSetter() {

              @Override
              public void setValues(PreparedStatement ps, int index) throws SQLException {
                ps.setString(1, status.name());
                ps.setTimestamp(2, new Timestamp(new Date().getTime()));
                ps.setInt(3, holdLoanIds.get(index));
                ps.setInt(4, versions.get(index));
              }

              @Override
              public int getBatchSize() {
                return updateSize;
              }
            });

    Assert.isTrue(result.length == updateSize, "update middleman hold loan error.");
    return result.length;
  }
예제 #4
0
  @Override
  protected void renderDefaultContent(TagWriter tagWriter) throws JspException {
    String[] errorMessages = getBindStatus().getErrorMessages();

    if (CollectionUtils.size(errorMessages) > 1) {
      tagWriter.startTag(getElement());
      writeDefaultAttributes(tagWriter);

      for (String errorMessage : errorMessages) {
        tagWriter.startTag("li");
        tagWriter.appendValue(errorMessage);
        tagWriter.endTag();
      }

      tagWriter.endTag();
    } else {
      tagWriter.startTag("span");
      for (String errorMessage : errorMessages) {
        tagWriter.appendValue(errorMessage);
      }
      tagWriter.endTag();
    }
  }
예제 #5
0
  private Map<String, String> updateResumeMixInfo(Integer perId, String updateTable) {
    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;
        String schoolName = "";
        String speciality = "";
        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();
            }
          }
        }

        ComReceiveAssistBo craVo = new ComReceiveAssistBo();
        if (vo.getWorkInfoVoList() != null && CollectionUtils.size(vo.getWorkInfoVoList()) > 0) {
          PerResumeBo.WorkInfoVo workVo = vo.getWorkInfoVoList().get(0);
          craVo.setLastPosName(workVo.getJobName());
          //                        craVo.setLastJobLocation(workVo.get); //个人简历无此数据
          craVo.setComName(workVo.getComName());
          craVo.setStart(workVo.getBegin());
          craVo.setEnd(workVo.getEnd());
        }

        craVo.setJobyearType(perUser.getJobyearType());
        craVo.setMobile(perUser.getMobile());
        if (vo.getIntentInfoVo() != null) {
          craVo.setSkill(vo.getIntentInfoVo().getProfessionSkill());
        }
        //                    craVo.setFileName();
        //                    craVo.setFilePath();

        // 计算年龄的公式修改为精确到年与搜索引擎匹配
        DateTime bDate = new DateTime(perUser.getBirthday());
        bDate = bDate.monthOfYear().setCopy(1).dayOfMonth().setCopy(1);
        DateTime nDate = DateTime.now();
        nDate = nDate.monthOfYear().setCopy(1).dayOfMonth().setCopy(2);
        Integer age = Years.yearsBetween(bDate, nDate).getYears();

        if (perUser.getResId() != null
            && perUser.getResId() > 0
            && StringUtils.isNotBlank(perUser.getUserName())) {
          getJdbcTemplateAction()
              .update(
                  "update "
                      + updateTable
                      + " set "
                      + "resume_id = ? , "
                      + "user_name=? , "
                      + "gender = ? , "
                      +
                      //                        "job_location = ? , " +
                      //                        "location = ? , " +
                      "age = ? , "
                      + "degree = ? , "
                      + "mix_info = ? , "
                      + "school_name = ? , "
                      + "speciality = ?, "
                      + "jobyear_type = ? "
                      + "where per_user_id = ?",
                  perUser.getResId(),
                  perUser.getUserName(),
                  perUser.getGender(),
                  //                            vo.getIntentInfoVo().getJobLocation(),
                  //                            "",
                  (age < 16 || age > 65) ? 16 : age,
                  degree,
                  (new Gson()).toJson(craVo),
                  schoolName,
                  speciality,
                  perUser.getJobyearType(),
                  perUser.getId());
        }

        Map<String, String> map = Maps.newHashMap();
        map.put("resumeId", String.valueOf(perUser.getResId()));
        map.put("userName", perUser.getUserName());
        map.put("gender", String.valueOf(perUser.getGender()));
        map.put("age", String.valueOf((age < 16 || age > 65) ? 16 : age));
        map.put("degree", String.valueOf(degree));
        map.put("mixInfo", (new Gson()).toJson(craVo));
        map.put("schoolName", schoolName);
        map.put("speciality", speciality);
        map.put("schoolName", schoolName);
        map.put("jobyearType", String.valueOf(perUser.getJobyearType()));

        return map;
      }
    }
    return null;
  }
예제 #6
0
  public PerResume fixDuplicateInfoListId(PerResume perResume) {
    if (perResume != null) {
      PerResumeBo perReusmeVo = new PerResumeBo(perResume);
      List<PerResumeBo.EducationInfoVo> educationInfoVoList = perReusmeVo.getEducationInfoVoList();
      if (CollectionUtils.isNotEmpty(educationInfoVoList)
          && CollectionUtils.size(educationInfoVoList) > 1) {
        for (int i = 0; i < educationInfoVoList.size(); i++) {
          PerResumeBo.EducationInfoVo vo = educationInfoVoList.get(i);
          vo.setId((long) i + 1);
          educationInfoVoList.set(i, vo);
        }
        perReusmeVo.setEducationInfoVoList(educationInfoVoList);
      }

      List<PerResumeBo.WorkInfoVo> workInfoVoList = perReusmeVo.getWorkInfoVoList();
      if (CollectionUtils.isNotEmpty(workInfoVoList) && CollectionUtils.size(workInfoVoList) > 1) {
        for (int i = 0; i < workInfoVoList.size(); i++) {
          PerResumeBo.WorkInfoVo vo = workInfoVoList.get(i);
          vo.setId((long) i + 1);
          workInfoVoList.set(i, vo);
        }
        perReusmeVo.setWorkInfoVoList(workInfoVoList);
      }

      List<PerResumeBo.AccessoryInfoVo> accessoryInfoVoList = perReusmeVo.getAccessoryInfoVoList();
      if (CollectionUtils.isNotEmpty(accessoryInfoVoList)
          && CollectionUtils.size(accessoryInfoVoList) > 1) {
        for (int i = 0; i < accessoryInfoVoList.size(); i++) {
          PerResumeBo.AccessoryInfoVo vo = accessoryInfoVoList.get(i);
          vo.setId((long) i + 1);
          accessoryInfoVoList.set(i, vo);
        }
        perReusmeVo.setAccessoryInfoVoList(accessoryInfoVoList);
      }

      List<PerResumeBo.CertificateInfoVo> certificateInfoVoList =
          perReusmeVo.getCertificateInfoVoList();
      if (CollectionUtils.isNotEmpty(certificateInfoVoList)
          && CollectionUtils.size(certificateInfoVoList) > 1) {
        for (int i = 0; i < certificateInfoVoList.size(); i++) {
          PerResumeBo.CertificateInfoVo vo = certificateInfoVoList.get(i);
          vo.setId((long) i + 1);
          certificateInfoVoList.set(i, vo);
        }
        perReusmeVo.setCertificateInfoVoList(certificateInfoVoList);
      }

      List<PerResumeBo.TrainInfoVo> trainInfoVoList = perReusmeVo.getTrainInfoVoList();
      if (CollectionUtils.isNotEmpty(trainInfoVoList)
          && CollectionUtils.size(trainInfoVoList) > 1) {
        for (int i = 0; i < trainInfoVoList.size(); i++) {
          PerResumeBo.TrainInfoVo vo = trainInfoVoList.get(i);
          vo.setId((long) i + 1);
          trainInfoVoList.set(i, vo);
        }
        perReusmeVo.setTrainInfoVoList(trainInfoVoList);
      }

      List<PerResumeBo.LanguageInfoVo> languageInfoVoList = perReusmeVo.getLanguageInfoVoList();
      if (CollectionUtils.isNotEmpty(languageInfoVoList)
          && CollectionUtils.size(languageInfoVoList) > 1) {
        for (int i = 0; i < languageInfoVoList.size(); i++) {
          PerResumeBo.LanguageInfoVo vo = languageInfoVoList.get(i);
          vo.setId((long) i + 1);
          languageInfoVoList.set(i, vo);
        }
        perReusmeVo.setLanguageInfoVoList(languageInfoVoList);
      }

      perResume = perReusmeVo.toModel();
    }
    return perResume;
  }