private ActionMessages validateInput(DynaActionForm form) { ActionMessages msgs = new ActionMessages(); Double teacherScore; Double deptheaderScore; Double militaryScore; Double meetingScore; if (!form.getString("teacherScore").trim().equals("")) teacherScore = Double.parseDouble(form.getString("teacherScore")); if (!form.getString("deptheaderScore").trim().equals("")) deptheaderScore = Double.parseDouble(form.getString("deptheaderScore")); if (!form.getString("militaryScore").trim().equals("")) militaryScore = Double.parseDouble(form.getString("militaryScore")); if (!form.getString("meetingScore").trim().equals("")) meetingScore = Double.parseDouble(form.getString("meetingScore")); String comCode1 = form.getString("comCode1"); String comCode1Sel = form.getString("comCode1Sel"); String comCode2 = form.getString("comCode2"); String comCode2Sel = form.getString("comCode2Sel"); String comCode3 = form.getString("comCode3"); String comCode3Sel = form.getString("comCode3Sel"); StudAffairManager sm = (StudAffairManager) getBean("studAffairManager"); List<Code1> ConductMarkList = sm.findConductMark(""); boolean isfound = false; if (!comCode1.equals(comCode1Sel)) { msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Message.ConductMarkErr")); return msgs; } isfound = false; if (comCode1.equals("")) { msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Message.ConductMarkErr")); return msgs; } else { for (Iterator<Code1> c1Iter = ConductMarkList.iterator(); c1Iter.hasNext(); ) { Code1 code1 = c1Iter.next(); if (comCode1.equals(code1.getNo())) { isfound = true; break; } } if (!isfound) { msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Message.ConductMarkErr")); return msgs; } } return msgs; }
public ActionForward Query( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // Toolket.resetCheckboxCookie(response, "StudConduct"); DynaActionForm aForm = (DynaActionForm) form; HttpSession session = request.getSession(false); String studentNo = aForm.getString("studentNo"); String studentName = aForm.getString("studentName"); String clazz = aForm.getString("clazz"); String downYear = aForm.getString("downYear"); Map stuMap = new HashMap(); stuMap.put("studentNo", studentNo); ScoreManager scm = (ScoreManager) getBean("scoreManager"); StudAffairManager sm = (StudAffairManager) getBean("studAffairManager"); ActionMessages msgs = new ActionMessages(); if (studentNo.trim().equals("") && downYear.trim().equals("") && studentName.trim().equals("") && clazz.trim().equals("")) { msgs.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Message.MustInput", "學號or學生姓名or班級or定察學年")); this.saveMessages(request, msgs); setContentPage(session, "studaffair/StudInspected.jsp"); return mapping.findForward("Main"); } List<Keep> keepList = sm.findStudInspectedByForm(aForm.getMap()); session.setAttribute("StudInspectedList", keepList); setContentPage(session, "studaffair/StudInspected.jsp"); return mapping.findForward("Main"); }
public ActionForward DelConfirm( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(false); List<Keep> selKeeps = (List<Keep>) session.getAttribute("StudInspectedDelete"); StudAffairManager sm = (StudAffairManager) getBean("studAffairManager"); ActionMessages errs = sm.delStudInspected(selKeeps, Toolket.getBundle(request, "messages.studaffair")); session.removeAttribute("StudInspectedDelete"); // no undeleteScores will happen even if delete failure if (errs.isEmpty()) { session.removeAttribute("StudInspectedList"); setContentPage(session, "studaffair/StudInspected.jsp"); return mapping.findForward("Main"); } else { saveErrors(request, errs); setContentPage(session, "studaffair/StudInspected.jsp"); return mapping.findForward("Main"); } }
/** 取得成績未上傳老師名單並寄發e-mail, cc給學務單位 */ @SuppressWarnings("unchecked") @Override public void run() { StudAffairManager sm = (StudAffairManager) Global.context.getBean(IConstants.STUD_AFFAIR_MANAGER_BEAN_NAME); StudAffairDAO dao = (StudAffairDAO) Global.context.getBean("studAffairDAO"); ScoreManager scm = (ScoreManager) Global.context.getBean(IConstants.SCORE_MANAGER_BEAN_NAME); MemberManager mm = (MemberManager) Global.context.getBean(IConstants.MEMBER_MANAGER_BEAN_NAME); String email = ""; Calendar start = null; Calendar end = null; List<String> depts = sm.findCampusDepartment(); String hql = ""; String err = ""; // Send email for Department that Teacher not upload score data which will expire start = Calendar.getInstance(); start.add(Calendar.DATE, -8); List<Map> notUpload = new ArrayList<Map>(); // Send email for Teacher not upload score data will expired try { notUpload = scm.findScoreNotUpload(depart, level, scope); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } String teachedId = ""; Empl empl = new Empl(); DEmpl dempl = new DEmpl(); int cnt = 0; for (Map notupMap : notUpload) { teachedId = notupMap.get("teacherID").toString(); empl = mm.findEmplByIdno(teachedId); if (empl != null) { if (empl.getEmail() != null) { email = empl.getEmail(); } else { email = ""; } } else { dempl = mm.findDEmplByIdno(teachedId); if (dempl.getEmail() != null) { email = dempl.getEmail(); } else { email = ""; } } if (!email.equals("")) { // if(notupMap.get("teacherId").toString().equalsIgnoreCase("D120148934")|| // notupMap.get("teacherId").toString().equalsIgnoreCase("F120603503")){ // log.debug("email:" + email + ",is valid: " + // Toolket.isValidEmail(email)); if (Toolket.isValidEmail(email)) { // TODO:test only if (cnt == 0) { err = this.sendEmail(notupMap, "*****@*****.**"); cnt++; // break; } err = this.sendEmail(notupMap, email); err += err; } // } } } if (!err.equals("")) { sendDeptEmail("SysAdmin", err); } }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()); StudAffairManager sm = (StudAffairManager) wac.getBean("studAffairManager"); ScoreManager scm = (ScoreManager) wac.getBean("scoreManager"); HttpSession session = request.getSession(false); CourseManager manager = (CourseManager) wac.getBean("courseManager"); // UserCredential credential = // (UserCredential)session.getAttribute("Credential"); // String studentNo = credential.getMember().getAccount(); String studentNo = request.getParameter("studentno"); String sterm = Toolket.getSysParameter("School_term"); /* * if(studentNo == null) { studentNo = * credential.getStudent().getStudentNo(); } else * if(studentNo.trim().equals("")) { studentNo = * credential.getStudent().getStudentNo(); } */ response.setContentType("text/xml; charset=UTF-8"); PrintWriter out = response.getWriter(); if (!studentNo.trim().equals("")) { Student student = scm.findStudentByStudentNo(studentNo); if (student != null) { String studentName = student.getStudentName(); String departClass = student.getDepartClass(); String deptClassName = student.getDepartClass2(); String daynite = sm.chkStudentDepart(studentNo); String mode = request.getParameter("mode"); if (mode.equals("")) mode = "all"; log.info("GetTimeOff has been called! and Mode=" + mode); // Leo 20120321 將下列79~83行遮蔽,改取85~90行程式執行 // int elearnSum = 0; // List<Seld> elearnList= sm.findDilgByStudentNo(studentNo,"elearn"); // for (Seld seld : elearnList) { // elearnSum += seld.getElearnDilg(); // } String elcnt; elcnt = manager.ezGetString( "Select SUM(s.`elearn_dilg`) " + "From Seld s, Dtime d " + "Where s.`student_no` like '" + studentNo + "' " + " And s.`Dtime_oid`=d.`Oid` " + " And d.`Sterm`='" + sterm + "' "); int elearnSum; if (elcnt == null) { elearnSum = 0; } else { elearnSum = Integer.parseInt(elcnt); } List dilgList = sm.getDilgByStudentNo(studentNo, mode); Dilg dilg; // ===========================Leo // Start==================================================================================================== List desdList = sm.findDesdByStudentNo(studentNo); Desd desd; // ===========================Leo // End====================================================================================================== String weekday = ""; // Map result = new HashMap(); out.println("<dilgPrompt>"); out.println("<mode>" + mode + "</mode>"); out.println("<studentNo>" + studentNo + "</studentNo>"); out.println("<studentName>" + studentName + "</studentName>"); out.println("<departClass>" + departClass + "</departClass>"); out.println("<deptClassName>" + deptClassName + "</deptClassName>"); out.println("<daynite>" + daynite + "</daynite>"); out.println("<elearnSum>" + elearnSum + "</elearnSum>"); if (mode.equals("all")) { if (dilgList.size() > 0) { for (Iterator<Dilg> dilgIter = dilgList.iterator(); dilgIter.hasNext(); ) { dilg = dilgIter.next(); out.println("<dilgInfo>"); out.println( "<ddate>" + Toolket.printNativeDate(dilg.getDdate()) + "(" + weekTran(dilg.getWeekDay()) + ")" + "</ddate>"); out.println("<abs0>" + dilg.getAbsName0() + "</abs0>"); out.println("<abs1>" + dilg.getAbsName1() + "</abs1>"); out.println("<abs2>" + dilg.getAbsName2() + "</abs2>"); out.println("<abs3>" + dilg.getAbsName3() + "</abs3>"); out.println("<abs4>" + dilg.getAbsName4() + "</abs4>"); out.println("<abs5>" + dilg.getAbsName5() + "</abs5>"); out.println("<abs6>" + dilg.getAbsName6() + "</abs6>"); out.println("<abs7>" + dilg.getAbsName7() + "</abs7>"); out.println("<abs8>" + dilg.getAbsName8() + "</abs8>"); out.println("<abs9>" + dilg.getAbsName9() + "</abs9>"); out.println("<abs10>" + dilg.getAbsName10() + "</abs10>"); out.println("<abs11>" + dilg.getAbsName11() + "</abs11>"); out.println("<abs12>" + dilg.getAbsName12() + "</abs12>"); out.println("<abs13>" + dilg.getAbsName13() + "</abs13>"); out.println("<abs14>" + dilg.getAbsName14() + "</abs14>"); out.println("<abs15>" + dilg.getAbsName15() + "</abs15>"); out.println("</dilgInfo>"); } } else { out.println("<dilgInfo></dilgInfo>"); } } else if (mode.equals("subject")) { if (dilgList.size() > 0) { for (Iterator dilgIter = dilgList.iterator(); dilgIter.hasNext(); ) { Map dilgMap = (Map) dilgIter.next(); out.println("<dilgInfo>"); out.println("<subjectName>" + dilgMap.get("subjectName") + "</subjectName>"); out.println("<period>" + dilgMap.get("period") + "</period>"); out.println("<tfLimit>" + dilgMap.get("tfLimit") + "</tfLimit>"); out.println("<timeOff>" + dilgMap.get("timeOff") + "</timeOff>"); out.println("<elearnDilg>" + dilgMap.get("elearnDilg") + "</elearnDilg>"); out.println("<warnning>" + dilgMap.get("warnning") + "</warnning>"); out.println("<dtimeClass>" + dilgMap.get("dtimeClass") + "</dtimeClass>"); out.println("<absType>" + dilgMap.get("absType") + "</absType>"); out.println("</dilgInfo>"); } } else { out.println("<dilgInfo></dilgInfo>"); } // ===========================Leo // Start==================================================================================================== } else if (mode.equals("desd")) { if (desdList.size() > 0) { // System.out.println(desdList.size()); for (Iterator<Desd> desdIter = desdList.iterator(); desdIter.hasNext(); ) { desd = desdIter.next(); Map Reason = manager.ezGetMap("SELECT name FROM code2 WHERE no='" + desd.getReason() + "'"); // System.out.println(Reason.get("name")); out.println("<dilgInfo>"); out.println("<ddate>" + desd.getDdate() + "</ddate>"); out.println("<no>" + desd.getNo() + "</no>"); out.println("<reason>" + Reason.get("name") + "</reason>"); out.println("<kind1>" + desd.getKind1() + "</kind1>"); out.println("<cnt1>" + desd.getCnt1() + "</cnt1>"); out.println("<kind2>" + desd.getKind2() + "</kind2>"); out.println("<cnt2>" + desd.getCnt2() + "</cnt2>"); out.println("</dilgInfo>"); } } else { out.println("<dilgInfo></dilgInfo>"); } } // ===========================Leo // End====================================================================================================== out.println("</dilgPrompt>"); out.close(); } else { out.println("<dilgPrompt>"); out.println("<dilgInfo>"); out.println("<mode>notfound</mode>"); out.println("</dilgInfo>"); out.println("</dilgPrompt>"); out.close(); } } else { out.println("<dilgPrompt>"); out.println("<dilgInfo>"); out.println("<mode>notfound</mode>"); out.println("</dilgInfo>"); out.println("</dilgPrompt>"); out.close(); } }
public ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaActionForm aForm = (DynaActionForm) form; HttpSession session = request.getSession(false); UserCredential credential = (UserCredential) session.getAttribute("Credential"); String classInCharge = credential.getClassInChargeSqlFilterT(); String idenType = aForm.getString("idenType").trim(); StudAffairManager sm = (StudAffairManager) getBean("studAffairManager"); MemberManager mm = (MemberManager) getBean("memberManager"); Map<String, String> counselType = new HashMap<String, String>(); counselType.put("L", "學習輔導"); counselType.put("T", "職涯輔導"); String schoolYear = Toolket.getSysParameter(IConstants.PARAMETER_SCHOOL_YEAR); String schoolTerm = Toolket.getSysParameter(IConstants.PARAMETER_SCHOOL_TERM); Map<String, String> CounselingReportInit = new HashMap<String, String>(); CounselingReportInit.put("idenType", idenType); CounselingReportInit.put("schoolYear", schoolYear); CounselingReportInit.put("schoolTerm", schoolTerm); List<CounselingCode> codesL = sm.findCounselingCode("L"); List<CounselingCode> codesT = sm.findCounselingCode("T"); session.setAttribute("StudCounselCodeL", codesL); session.setAttribute("StudCounselCodeT", codesT); session.setAttribute("StudCounselType", counselType); session.setAttribute("CounselingReportInit", CounselingReportInit); String[][] repType = new String[][] { {"1", "學習輔導記錄(導師)"}, {"2", "職涯輔導記錄(導師)"}, {"3", "學習輔導記錄(老師)"}, {"4", "學生接受輔導記錄"}, {"5", "輔導次數統計(導師)"}, {"6", "輔導次數統計(老師)"} }; session.setAttribute("CounselReportType", repType); List<Map> depts = Toolket.getCollegeDepartment(true); session.setAttribute("depts", depts); /* if(idenType.equals("T")){ //Tutor setContentPage(session, "studaffair/CounselingReportT.jsp"); }else if(idenType.equals("L")){ //Teacher setContentPage(session, "studaffair/CounselingReportL.jsp"); }else if(idenType.equals("C")){ //department chief or assistance setContentPage(session, "studaffair/CounselingReportC.jsp"); }else if(idenType.equals("A")){ //student affair officer setContentPage(session, "studaffair/CounselingReportA.jsp"); }else if(idenType.equals("S")){ //execution manager //int empOid = credential.getMember().getOid(); List<Empl> empls = mm.findEmplByGroup("S1"); for(Empl empl:empls){ if(empl.getIdno().equalsIgnoreCase(credential.getMember().getIdno())){ setContentPage(session, "studaffair/CounselingReportS.jsp"); break; } } } */ session.removeAttribute("CounselingReoport"); setContentPage(session, "studaffair/CounselingReport.jsp"); return mapping.findForward("Main"); }
public ActionForward query( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Toolket.resetCheckboxCookie(response, "CounselingsL"); DynaActionForm aForm = (DynaActionForm) form; HttpSession session = request.getSession(false); StudAffairManager sm = (StudAffairManager) getBean("studAffairManager"); MemberManager mm = (MemberManager) getBean("memberManager"); UserCredential credential = (UserCredential) session.getAttribute("Credential"); String schoolYear = aForm.getString("schoolYear").trim(); String schoolTerm = aForm.getString("schoolTerm").trim(); String depart = aForm.getString("department").trim(); String idenType = aForm.getString("idenType").trim(); String reportType = aForm.getString("reportType").trim(); String campusInCharge = ""; String schoolInCharge = ""; String deptInCharge = ""; String departClass = ""; if (idenType.equalsIgnoreCase("C")) { campusInCharge = aForm.getString("campusInChargeC").trim(); schoolInCharge = aForm.getString("schoolInChargeC").trim(); deptInCharge = aForm.getString("deptInChargeC").trim(); departClass = aForm.getString("classInChargeC").trim(); } else if (idenType.equalsIgnoreCase("A")) { campusInCharge = aForm.getString("campusInChargeSAF").trim(); schoolInCharge = aForm.getString("schoolInChargeSAF").trim(); deptInCharge = aForm.getString("deptInChargeSAF").trim(); departClass = aForm.getString("classInChargeSAF").trim(); } else if (idenType.equalsIgnoreCase("S")) { campusInCharge = aForm.getString("campusInCharge").trim(); schoolInCharge = aForm.getString("schoolInCharge").trim(); deptInCharge = aForm.getString("deptInCharge").trim(); departClass = aForm.getString("classInCharge").trim(); } // String studentNo = aForm.getString("studentNo").trim(); Map<String, String> CounselingReportInit = (Map<String, String>) (session.getAttribute("CounselingReportInit")); CounselingReportInit.put("schoolYear", schoolYear); CounselingReportInit.put("schoolTerm", schoolTerm); CounselingReportInit.put("campusInCharge", campusInCharge); CounselingReportInit.put("schoolInCharge", schoolInCharge); CounselingReportInit.put("deptInCharge", deptInCharge); CounselingReportInit.put("classInCharge", departClass); CounselingReportInit.put("reportType", reportType); ActionMessages messages = new ActionMessages(); if (idenType.equalsIgnoreCase("C") || idenType.equalsIgnoreCase("A") || idenType.equalsIgnoreCase("S")) { if (schoolInCharge.equalsIgnoreCase("All")) { if (campusInCharge.equalsIgnoreCase("All")) { departClass = ""; } else { departClass = campusInCharge; } } else if (deptInCharge.equalsIgnoreCase("All")) { departClass = campusInCharge + schoolInCharge; } else if (departClass.equalsIgnoreCase("All")) { departClass = campusInCharge + schoolInCharge + deptInCharge; } } if (!depart.equals("")) { departClass = "___" + depart + "__"; } if (schoolYear.equals("") || schoolTerm.equals("")) { messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("MessageN1", "請輸入學年及學期!")); saveMessages(request, messages); setContentPage(session, "studaffair/CounselingReport.jsp"); return mapping.findForward("Main"); } List counselingList = new ArrayList(); /* if(!studentNo.equals("")) { departClass = ""; } */ /* * "1":學習輔導記錄(導師) "2":職涯輔導記錄(導師) "3":學習輔導記錄(老師) "4":學生接受輔導記錄 "5":輔導次數統計(導師) "6":輔導次數統計(老師) */ char iden = idenType.charAt(0); if (reportType.equalsIgnoreCase("1")) { switch (iden) { case 'T': counselingList = sm.findCounselingByInput( schoolYear, schoolTerm, "U", credential.getMember().getIdno(), "", departClass, null, null); break; case 'C': case 'A': case 'S': counselingList = sm.findCounselingByInput( schoolYear, schoolTerm, "U", "", "", departClass, null, null); break; case 'L': } } else if (reportType.equalsIgnoreCase("2")) { switch (iden) { case 'T': counselingList = sm.findCounselingByInput( schoolYear, schoolTerm, "T", credential.getMember().getIdno(), "", departClass, null, null); break; case 'C': case 'A': case 'S': counselingList = sm.findCounselingByInput( schoolYear, schoolTerm, "T", "", "", departClass, null, null); break; case 'L': } } else if (reportType.equalsIgnoreCase("3")) { switch (iden) { case 'L': counselingList = sm.findCounselingByInput( schoolYear, schoolTerm, "L", credential.getMember().getIdno(), "", departClass, null, null); break; case 'C': case 'A': case 'S': counselingList = sm.findCounselingByInput( schoolYear, schoolTerm, "L", "", "", departClass, null, null); break; case 'T': } } else if (reportType.equalsIgnoreCase("4")) { // 學生接受輔導記錄 switch (iden) { case 'C': case 'A': case 'S': List<StudCounseling> counselsT = sm.findCounselingByInput( schoolYear, schoolTerm, "T", "", "", departClass, null, null); List<StudCounseling> counselsU = sm.findCounselingByInput( schoolYear, schoolTerm, "U", "", "", departClass, null, null); List<StudCounseling> counselsL = sm.findCounselingByInput( schoolYear, schoolTerm, "L", "", "", departClass, null, null); counselingList.addAll(counselsT); counselingList.addAll(counselsU); counselingList.addAll(counselsL); Collections.sort(counselingList, new counselComp()); break; case 'L': case 'T': } } else if (reportType.equalsIgnoreCase("5")) { // 輔導次數統計(導師) switch (iden) { case 'C': case 'A': case 'S': counselingList = sm.findCounselingReport(schoolYear, schoolTerm, "T", departClass, ""); int countT = 0, countU = 0, countStudent_UT = 0; for (Object counsel : counselingList) { countT += Integer.parseInt(((Map) counsel).get("countT").toString()); countU += Integer.parseInt(((Map) counsel).get("countU").toString()); countStudent_UT += Integer.parseInt(((Map) counsel).get("countStudent_UT").toString()); } CounselingReportInit.put("countT", "" + countT); CounselingReportInit.put("countU", "" + countU); CounselingReportInit.put("countStudent_UT", "" + countStudent_UT); CounselingReportInit.put("total", "" + (countT + countU)); break; case 'L': case 'T': System.out.println(schoolYear); counselingList = sm.findCounselingReport( schoolYear, schoolTerm, "T", "", credential.getMember().getIdno()); int cntT = 0, cntU = 0, countStudentUT = 0; for (Object counsel : counselingList) { cntT += Integer.parseInt(((Map) counsel).get("countT").toString()); cntU += Integer.parseInt(((Map) counsel).get("countU").toString()); countStudentUT += Integer.parseInt(((Map) counsel).get("countStudent_UT").toString()); } CounselingReportInit.put("countT", "" + cntT); CounselingReportInit.put("countU", "" + cntU); CounselingReportInit.put("countStudent_UT", "" + countStudentUT); CounselingReportInit.put("total", "" + (cntT + cntU)); break; } } else if (reportType.equalsIgnoreCase("6")) { // 輔導次數統計(老師) // 依照開課班級,老師,科目排序,一個老師可能教授多個科目 switch (iden) { case 'C': case 'A': case 'S': counselingList = sm.findCounselingReport(schoolYear, schoolTerm, "L", departClass, ""); int countL = 0, countL_UT = 0; for (Object counsel : counselingList) { countL += Integer.parseInt(((Map) counsel).get("countL").toString()); countL_UT += Integer.parseInt(((Map) counsel).get("countL_UT").toString()); } CounselingReportInit.put("countL", "" + countL); CounselingReportInit.put("countL_UT", "" + countL_UT); break; case 'L': counselingList = sm.findCounselingReport( schoolYear, schoolTerm, "L", "", credential.getMember().getIdno()); int cntL = 0, countLUT = 0; for (Object counsel : counselingList) { cntL += Integer.parseInt(((Map) counsel).get("countL").toString()); countLUT += Integer.parseInt(((Map) counsel).get("countL_UT").toString()); } CounselingReportInit.put("countL", "" + cntL); CounselingReportInit.put("countL_UT", "" + countLUT); break; case 'T': } } // session.setAttribute("StudCounselingInit", StudCounselingInit); session.setAttribute("CounselingReportInit", CounselingReportInit); session.setAttribute("CounselingReoport", counselingList); setContentPage(session, "studaffair/CounselingReport.jsp"); return mapping.findForward("Main"); }