/** 计算总分和插入需要插入的学期 anping TODO 上午11:30:05 */ public void computerTotalScoreAndIsertTerm(List<ScholarShip> scholarShips, String term) { for (ScholarShip ship : scholarShips) { ship.setMoralQualityAssessmentScore( ship.getBaseScore() + ship.getAwardScore() - ship.getPunishScore()); ship.setQualityScore(ship.getLessonScore() + ship.getInnovateScore() + ship.getSkillsScore()); ship.setSportQualityTotalScore( ship.getSportScore() + ship.getPhysiqueScore() + ship.getSportMatchScore()); ship.setArtEducationTotalScore( ship.getManageScore() + ship.getCultureScore() + ship.getMediaScore() + ship.getServiceScore()); if (term != null) { ship.setTerm(term); } ship.setTotalScore( ship.getMoralQualityAssessmentScore() * 0.2 + ship.getQualityScore() * 0.6 + ship.getSportQualityTotalScore() * 0.05 + ship.getArtEducationTotalScore() * 0.15); System.out.println(ship.getTotalScore() + "总分----------"); } }
/** * 检测分数是否合法 anping TODO 下午4:38:19 * * @param scholarShips * @return */ public String checkScoreHeFa(List<ScholarShip> scholarShips) { String result = null; for (ScholarShip ship : scholarShips) { if (ship.getBaseScore() < 0 || ship.getBaseScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getAwardScore() < 0 || ship.getAwardScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getPunishScore() < 0 || ship.getPunishScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getLessonScore() < 0 || ship.getLessonScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getInnovateScore() < 0 || ship.getInnovateScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getSkillsScore() < 0 || ship.getSkillsScore() > 0) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getSportScore() < 0 || ship.getSportScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getPhysiqueScore() < 0 || ship.getPhysiqueScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getSportMatchScore() < 0 || ship.getSportMatchScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getManageScore() < 0 || ship.getManageScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getCultureScore() < 0 || ship.getCultureScore() > 0) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getMediaScore() < 0 || ship.getMediaScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } if (ship.getServiceScore() < 0 || ship.getServiceScore() > 100) { result = "学号为:" + ship.getStudent().getStudentNo() + "的成绩中不能出现小于0和大于100的值"; break; } } return result; }