@Override
  public boolean addJudge(
      String userPassword,
      String userName,
      String judgeName,
      String judgeGender,
      String judgeLevel,
      String identifiedId,
      String phonenum) {

    try {

      YsmsJudge ysmsJudge = new YsmsJudge();

      ysmsJudge.setDeleteflag(0);
      ysmsJudge.setIdentifiedName(judgeName);
      ysmsJudge.setIdentifiedGender(Integer.parseInt(judgeGender));
      ysmsJudge.setJudgeStatus(2);
      ysmsJudge.setIdentifiedId(identifiedId);
      ysmsJudge.setJudgeMobile(phonenum);
      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);

      YsmsUser ysmsUser = new YsmsUser();
      ysmsUser.setUserName(userName);
      ysmsUser.setUserPassword(userPassword);
      ysmsUser.setDeleteflag(0);
      // HARD CODE
      YsmsGroup ysmsGroup = groupDao.findById(9);
      ysmsUser.setYsmsGroup(ysmsGroup);

      // 先保存,进入持久态获取Id
      userDao.save(ysmsUser);
      judgeDao.save(ysmsJudge);

      YsmsJudgeUser judgeUser = new YsmsJudgeUser();
      judgeUser.setYsmsJudge(ysmsJudge);
      judgeUser.setYsmsUser(ysmsUser);
      judgeUserDao.save(judgeUser);

    } catch (Exception exception) {
      exception.printStackTrace();
      return false;
    }
    return true;
  }
  @Override
  public boolean deleteJudge(String judge_id) {
    try {
      for (String judgeId : judge_id.split(",")) {
        judgeDao.delete(judgeId);
        List<YsmsJudgeUser> judgeUserList = judgeUserDao.findByJudgeId(Integer.parseInt(judgeId));
        for (int m = 0; m < judgeUserList.size(); m++) {
          userDao.delete(judgeUserList.get(m).getYsmsUser().getUserId());
        }
      }

    } catch (Exception exception) {
      exception.printStackTrace();
      return false;
    }
    return true;
  }
  @Override
  public boolean applyJudge(
      String identifiedId,
      String identifiedName,
      int identifiedGender,
      String identifiedNationality,
      Date identifiedBirthday,
      String identifiedAddress,
      int jobId,
      int districtId,
      String jobAddress,
      int judgeLevel,
      int judgeStatus,
      String judgeMobile,
      String judgeTips,
      String fileName_id,
      String fileName_level,
      String username,
      String password) {
    try {
      YsmsJudge ysmsJudge = new YsmsJudge();

      ysmsJudge.setIdentifiedId(identifiedId);
      ysmsJudge.setIdentifiedName(identifiedName);
      ysmsJudge.setIdentifiedGender(identifiedGender);
      ysmsJudge.setIdentifiedNationality(identifiedNationality);
      ysmsJudge.setIdentifiedAddress(identifiedAddress);
      ysmsJudge.setJudgeJobaddress(jobAddress);
      ysmsJudge.setJudgeMobile(judgeMobile);
      ysmsJudge.setJudgeTips(judgeTips);
      ysmsJudge.setJudgeStatus(judgeStatus);
      ysmsJudge.setJudgeLevel(judgeLevel);
      ysmsJudge.setIdentifiedBirthday(identifiedBirthday);
      ysmsJudge.setDeleteflag(0);
      YsmsDistrict district = new YsmsDistrict();
      district.setDistrictId(districtId);
      ysmsJudge.setYsmsDistrict(district);
      YsmsJobs jobs = new YsmsJobs();
      jobs.setJobId(jobId);
      ysmsJudge.setYsmsJobs(jobs);
      judgeDao.save(ysmsJudge);

      YsmsUser ysmsUser = new YsmsUser();
      ysmsUser.setDeleteflag(0);
      ysmsUser.setUserName(username);
      ysmsUser.setUserPassword(password);
      ysmsUser.setYsmsGroup(groupDao.findById(9)); // hard code
      userDao.save(ysmsUser);

      YsmsJudgeUser ju = new YsmsJudgeUser();
      ju.setYsmsJudge(ysmsJudge);
      ju.setYsmsUser(ysmsUser);
      judgeUserDao.save(ju);

      if (!ToolsUtil.isEmpty(fileName_level)) {
        YsmsJudgeAtt att = new YsmsJudgeAtt();
        att.setAttName(fileName_level);
        att.setAttType(1); // type=0 身份证 1 等级证
        att.setYsmsJudge(ysmsJudge);
        judgeDao.saveAtt(att);
      }
      if (!ToolsUtil.isEmpty(fileName_id)) {
        YsmsJudgeAtt att = new YsmsJudgeAtt();
        att.setAttName(fileName_id);
        att.setAttType(0); // type=0 身份证 1 等级证
        att.setYsmsJudge(ysmsJudge);
        judgeDao.saveAtt(att);
      }

    } catch (Exception exception) {
      exception.printStackTrace();
      return false;
    }
    return true;
  }