コード例 #1
0
  @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;
  }
コード例 #2
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;
 }
コード例 #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;
  }
コード例 #4
0
  @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;
  }