예제 #1
0
 public String view() throws Exception {
   if (studentno == null || studentno == "" || studentScoreDAO.findById(studentno) == null) {
     addActionError("学生不存在!");
     return "error";
   }
   // log.fatal(studentno);
   studentScore = studentScoreDAO.findById(studentno);
   if (studentScore.getDbpingyu() != null
       && studentScore.getPypingyu() != null
       && studentScore.getZdpingyu() != null) {
     Dbpingyu = studentScore.getDbpingyu();
     Pypingyu = studentScore.getPypingyu();
     Zdpingyu = studentScore.getZdpingyu();
   } else {
     int size = 0;
     // log.fatal(grade);
     if (studentScore.getGrade() == null) {
       addActionError("出错!");
       return "error";
     }
     int grade = studentScore.getGrade();
     List<Py> py;
     if (grade >= 85 && grade <= 100) {
       py = pyDAO.findByLv("A");
       size = py.size();
       Dbpingyu = py.get(MathEx.randomInt(0, size - 1)).getDbpingyu();
       Pypingyu = py.get(MathEx.randomInt(0, size - 1)).getPypingyu();
       Zdpingyu = py.get(MathEx.randomInt(0, size - 1)).getZdpingyu();
     } else if (grade >= 75 && grade <= 84) {
       py = pyDAO.findByLv("B");
       size = py.size();
       Dbpingyu = py.get(MathEx.randomInt(0, size - 1)).getDbpingyu();
       Pypingyu = py.get(MathEx.randomInt(0, size - 1)).getPypingyu();
       Zdpingyu = py.get(MathEx.randomInt(0, size - 1)).getZdpingyu();
     } else if (grade >= 60 && grade <= 74) {
       py = pyDAO.findByLv("C");
       size = py.size();
       Dbpingyu = py.get(MathEx.randomInt(0, size - 1)).getDbpingyu();
       Pypingyu = py.get(MathEx.randomInt(0, size - 1)).getPypingyu();
       Zdpingyu = py.get(MathEx.randomInt(0, size - 1)).getZdpingyu();
     } else if (grade >= 0 && grade <= 59) {
       py = pyDAO.findByLv("D");
       size = py.size();
       Dbpingyu = py.get(MathEx.randomInt(0, size - 1)).getDbpingyu();
       Pypingyu = py.get(MathEx.randomInt(0, size - 1)).getPypingyu();
       Zdpingyu = py.get(MathEx.randomInt(0, size - 1)).getZdpingyu();
     }
   }
   return "viewStudent";
 }
예제 #2
0
 public String modify() throws Exception {
   py = pyDAO.findById(pyNo);
   return SUCCESS;
 }
예제 #3
0
 @Override
 @Transactional(readOnly = false)
 public String execute() throws Exception {
   pyDAO.merge(py);
   return SUCCESS;
 }