コード例 #1
0
 @Override
 public List<JudgeView> getAllJudge() {
   List<JudgeView> result = new ArrayList<JudgeView>();
   List<YsmsJudge> allJudges = judgeDao.findAll();
   if (allJudges != null) {
     for (int i = 0; i < allJudges.size(); i++) {
       JudgeView judgeView = new JudgeView();
       YsmsJudge judge = allJudges.get(i);
       int levelsStatus[] = new int[8];
       List<YsmsJudgeandlevel> levelList = judgeAndLevelDao.getByJudgeId(judge.getJudgeId());
       if (levelList != null) {
         for (YsmsJudgeandlevel level : levelList) {
           levelsStatus[level.getYsmsJudgelevel().getLevelId() - 1] = 1;
         }
       }
       judgeView.setLevels(levelsStatus);
       judgeView.setJudgeId(judge.getJudgeId());
       judgeView.setJudgeName(judge.getIdentifiedName());
       result.add(judgeView);
     }
   }
   return result;
 }
コード例 #2
0
  @Override
  public List<Map<String, Object>> getJudgeLevelByJudge(String judgeId) {

    return judgeAndLevelDao.query(judgeId, null);
  }
コード例 #3
0
  @Override
  public boolean updateJudge(
      String judgeId,
      String jobId,
      String jobAddress,
      String districtId,
      String identifiedAddress,
      String contact,
      String judgeLevel,
      String level,
      String nationality,
      String birthday,
      String identifiedId,
      String gender) {
    try {
      YsmsJudge ysmsJudge = judgeDao.findById(Integer.parseInt(judgeId));
      if (!ToolsUtil.isEmpty(jobId)) {
        YsmsJobs job = new YsmsJobs();
        job.setJobId(Integer.parseInt(jobId));
        ysmsJudge.setYsmsJobs(job);
      }
      if (!ToolsUtil.isEmpty(districtId)) {
        YsmsDistrict district = new YsmsDistrict();
        district.setDistrictId(Integer.parseInt(districtId));
        ysmsJudge.setYsmsDistrict(district);
      }
      if (!ToolsUtil.isEmpty(identifiedAddress)) {
        ysmsJudge.setIdentifiedAddress(identifiedAddress);
      }
      if (!ToolsUtil.isEmpty(jobAddress)) {
        ysmsJudge.setJudgeJobaddress(jobAddress);
      }
      if (!ToolsUtil.isEmpty(contact)) {
        ysmsJudge.setJudgeMobile(contact);
      }
      if (!ToolsUtil.isEmpty(level)) {
        ysmsJudge.setJudgeLevel(Integer.parseInt(level));
      }
      if (!ToolsUtil.isEmpty(nationality)) {
        ysmsJudge.setIdentifiedNationality(nationality);
      }
      if (!ToolsUtil.isEmpty(birthday)) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        ysmsJudge.setIdentifiedBirthday(sdf.parse(birthday));
      }
      if (!ToolsUtil.isEmpty(identifiedId)) {
        ysmsJudge.setIdentifiedId(identifiedId);
      }
      if (!ToolsUtil.isEmpty(gender)) {
        ysmsJudge.setIdentifiedGender(Integer.parseInt(gender));
      }
      if (!ToolsUtil.isEmpty(judgeLevel)) {
        judgeAndLevelDao.deleteLevel(Integer.parseInt(judgeId));
        Set<YsmsJudgeandlevel> ysmsJudgeandlevels = new HashSet<YsmsJudgeandlevel>();
        String[] levels = judgeLevel.split(",");
        for (String _level : levels) {
          YsmsJudgeandlevel judgeandlevel = new YsmsJudgeandlevel();
          judgeandlevel.setYsmsJudge(ysmsJudge);
          YsmsJudgelevel judgeLevelTemp = new YsmsJudgelevel();
          judgeLevelTemp.setLevelId(Integer.parseInt(_level));
          judgeandlevel.setYsmsJudgelevel(judgeLevelTemp);
          ysmsJudgeandlevels.add(judgeandlevel);
        }
        ysmsJudge.setYsmsJudgeandlevels(ysmsJudgeandlevels);
      }

      judgeDao.updateById(ysmsJudge);
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }