diff --git a/WebContent/WEB-INF/templates/schedule.ftl b/WebContent/WEB-INF/templates/schedule.ftl index cafcf175c1ced8efb11019069541d0d45215cd9c..e03ce84aa9fa485484eebeeaa7988813b1c11ae0 100644 --- a/WebContent/WEB-INF/templates/schedule.ftl +++ b/WebContent/WEB-INF/templates/schedule.ftl @@ -8632,7 +8632,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -9001,7 +9001,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -9725,7 +9725,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -10094,7 +10094,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -10870,7 +10870,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -11241,7 +11241,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -11966,7 +11966,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -12335,7 +12335,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -14056,7 +14056,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -14425,7 +14425,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -15149,7 +15149,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -15518,7 +15518,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -16294,7 +16294,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -16665,7 +16665,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} @@ -17390,7 +17390,7 @@ -${course.hpw} +<#if course.unit==1>${course.hpw}周<#if course.unit?? && course.unit==0>${course.hpw} diff --git a/WebContent/jsp/QueryCurriculums.jsp b/WebContent/jsp/QueryCurriculums.jsp index d1681a6251db153cdcdd8db6a16303d3f0fc5813..ba45a4f8dc0e74b9cb7a8fba4ea1496694dc9061 100644 --- a/WebContent/jsp/QueryCurriculums.jsp +++ b/WebContent/jsp/QueryCurriculums.jsp @@ -44,7 +44,38 @@ }) function init(){ - + $("#search").click(function(){ + $tbody = $('.dnd .left'); + + $.ajax({ + url : '<%=request.getContextPath()%>/CourseController/QueryCourseBy.action', + data : { name : $('#coursename').val() }, + datatype : 'json', + success : function(data){ + for(var i=0;i + ${course.id } + ${course.name} + + ---- + ${course.score} + 0 + ${course.theoretical} + ${course.experiement} + 0 + 1 + 17 + + + ${course.unit} + + */ + }); } var dragSrcEl = null; @@ -183,7 +214,7 @@ if(i < $dest_trs.length - 1){//前面的行 除了最后一行小计 //计算出总学时(理论学时+实验学时) - $dest_tds[4].innerHTML = parseInt($dest_tds[5].innerHTML) + parseInt($dest_tds[6].innerHTML); + ""; + $dest_tds[4].innerHTML = parseFloat($dest_tds[5].innerHTML) + parseFloat($dest_tds[6].innerHTML); + ""; } } @@ -208,9 +239,11 @@ for(var j = 0;j < $dest_trs_disperse.length; j++){//所有分散课 if($dest_trs_avaliable[i] == $dest_trs_disperse[j]){//开课,并分散进行 var $dest_disperse_tds = $($dest_trs_disperse[j]).children(); - total_disperse += parseInt($($dest_disperse_tds[4]).text()); - theoretical_disperse += parseInt($($dest_disperse_tds[5]).text()); - experiment_disperse += parseInt($($dest_disperse_tds[6]).text()); + if($($dest_disperse_tds[12]).text() == '0'){//单位是学时的累加 + total_disperse += parseFloat($($dest_disperse_tds[4]).text()); + theoretical_disperse += parseFloat($($dest_disperse_tds[5]).text()); + experiment_disperse += parseFloat($($dest_disperse_tds[6]).text()); + } if($($dest_disperse_tds[12]).text() == '1'){//如果单位为周 total_week_disperse += (parseFloat($($dest_disperse_tds[7]).text()));//总分散周数 @@ -230,18 +263,29 @@ } //所有开课,计算学分学时 $dest_tdss = $($dest_trs_avaliable[i]).children(); + for(var k = 0; k < $dest_tdss.length ; k ++ ){ + if(k == 3){//学分全累加 + total[k] += parseFloat($dest_tdss[k].innerHTML); + continue; + } + } //没有找到相同的,计算 if(!found_same){ for(var k = 0; k < $dest_tdss.length ; k ++ ){ - if(k >= 3 && k < 7){ - total[k] += parseInt($dest_tdss[k].innerHTML); + if(k > 3 && k < 7){ + if($($dest_tdss[12]).text() == '0'){//单位是学时的累加 + total[k] += parseFloat($dest_tdss[k].innerHTML); + } } } if($($dest_tdss[12]).text() == '1'){//如果单位为周 - total_week += (parseFloat($($dest_tdss[7]).text()));//总周数 + var str = $($dest_tdss[7]).text(); + str = str.replace("周",""); + + total_week += (parseFloat(str));//总周数 }else{ - total[7] += parseInt($dest_tdss[7].innerHTML) + total[7] += parseFloat($dest_tdss[7].innerHTML) } } @@ -308,6 +352,9 @@ if($($tds[12]).text() == '1'){//如果单位为周 $($tds[7]).text($($tds[4]).text() +"周"); + $($tds[4]).css('color','white'); + $($tds[5]).css('color','white'); + $($tds[6]).css('color','white'); } } @@ -465,8 +512,7 @@ ${course.id } ${course.name} - - ---- + ${course.identifier} ${course.score} 0 ${course.theoretical} diff --git a/build/classes/cn/edu/hrbcu/curriculum/controller/CourseController.class b/build/classes/cn/edu/hrbcu/curriculum/controller/CourseController.class index 243e858c87bb103fdf8f75edd6898636cc0dd893..07aa2d1855705d4a854d97fc152db77b1c2b9932 100644 Binary files a/build/classes/cn/edu/hrbcu/curriculum/controller/CourseController.class and b/build/classes/cn/edu/hrbcu/curriculum/controller/CourseController.class differ diff --git a/build/classes/cn/edu/hrbcu/curriculum/controller/CurriculumController.class b/build/classes/cn/edu/hrbcu/curriculum/controller/CurriculumController.class index 9db0881e5082ea98a3dd72b74c476b3daf460022..ae080c3288936ccdc6165461335da81286c16026 100644 Binary files a/build/classes/cn/edu/hrbcu/curriculum/controller/CurriculumController.class and b/build/classes/cn/edu/hrbcu/curriculum/controller/CurriculumController.class differ diff --git a/build/classes/cn/edu/hrbcu/curriculum/service/CourseService.class b/build/classes/cn/edu/hrbcu/curriculum/service/CourseService.class index ac3164135d3dacbf36e778d32d8a15a57aae2561..e52c6e13d4ee94edb6cbeaf6da6eb92ce9e63085 100644 Binary files a/build/classes/cn/edu/hrbcu/curriculum/service/CourseService.class and b/build/classes/cn/edu/hrbcu/curriculum/service/CourseService.class differ diff --git a/build/classes/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.class b/build/classes/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.class index 0e232fd166919e82135bd15c13042a6904982852..fe4253aef13846c0f450f708f043df476fb11dcd 100644 Binary files a/build/classes/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.class and b/build/classes/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.class differ diff --git a/build/classes/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.class b/build/classes/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.class index dc4c80f51f9af93f3381756343f6c9a573b64b2c..5017de1d32a476458b17ea2baf9301bc4fd491e9 100644 Binary files a/build/classes/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.class and b/build/classes/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.class differ diff --git a/src/cn/edu/hrbcu/curriculum/controller/CourseController.java b/src/cn/edu/hrbcu/curriculum/controller/CourseController.java index a61b9c7522c3a9dbabf60bf9bc71a1a40f311bc7..b17cbde269b2c3e0447f23f615c15f4a746fc33d 100644 --- a/src/cn/edu/hrbcu/curriculum/controller/CourseController.java +++ b/src/cn/edu/hrbcu/curriculum/controller/CourseController.java @@ -182,7 +182,7 @@ public class CourseController { if (tbUsers != null && tbUsers.size() > 0) { Speciality speciality = specialityService.selectSpecialityByUserId(tbUsers.get(0).getId()); if(speciality != null){ - ret = courseService.makeCourseCode(9,speciality.getCode()); + ret = courseService.makeCourseCode(9,speciality.getId(),speciality.getCode()); }else{ ret = false; } diff --git a/src/cn/edu/hrbcu/curriculum/controller/CurriculumController.java b/src/cn/edu/hrbcu/curriculum/controller/CurriculumController.java index a6505e9b905666cdd1e12d063a93c199caf9e5ad..c0da9a92ddefb0453095ed613e057f104e190751 100644 --- a/src/cn/edu/hrbcu/curriculum/controller/CurriculumController.java +++ b/src/cn/edu/hrbcu/curriculum/controller/CurriculumController.java @@ -265,10 +265,11 @@ public class CurriculumController { List> curriculums = new ArrayList>(); //保存小计信息 Map total = new HashMap(); - double[] t = new double[10];//所有时小计 - double[] t_w = new double[10];//所有周小计 - double[] d = new double[10];//开课,分散时小计 - double[] d_w = new double[10];//开课,分散周小计 + double total_score = 0D;//总学分 + double[] total_hour = new double[10];//所有时小计 + double[] total_week = new double[10];//所有周小计 + double[] disperse_hour = new double[10];//开课,分散时小计 + double[] disperse_week = new double[10];//开课,分散周小计 List curriculums_ = curriculumService.selectAllCurriculumBySpecialityandSemester(specialityId, i); if (curriculums_ != null && curriculums_.size() > 0) { @@ -285,46 +286,68 @@ public class CurriculumController { c.put("name", course.getName()); c.put("identifier", course.getIdentifier()); - c.put("score", course.getScore()); - if(!isDisperse){ - t[0] += (course.getScore()==null) ? 0 : course.getScore(); - }else{ - d[0] += (course.getScore()==null) ? 0 : course.getScore(); - } + c.put("score", course.getScore());//总学分 + total_score += (course.getScore()==null) ? 0 : course.getScore(); c.put("time", course.getTheoretical() + course.getExperiement()); if(!isDisperse){ - t[1] += (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement() ; + if(course.getUnit() == null || course.getUnit() == 0){//计算学时 + total_hour[1] += (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement() ; + }else{ + total_week[1] += (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement() ; + } }else{ - d[1] += (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement() ; + if(course.getUnit() == null || course.getUnit() == 0){//计算学时 + disperse_hour[1] += (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement() ; + }else{ + disperse_week[1] += (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement() ; + } } c.put("theoretical", course.getTheoretical()); if(!isDisperse){ - t[2] += (course.getTheoretical()==null) ? 0 : course.getTheoretical(); + if(course.getUnit() == null || course.getUnit() == 0){//计算学时 + total_hour[2] += (course.getTheoretical()==null) ? 0 : course.getTheoretical(); + }else{ + total_week[2] += (course.getTheoretical()==null) ? 0 : course.getTheoretical(); + } }else{ - d[2] += (course.getTheoretical()==null) ? 0 : course.getTheoretical(); + if(course.getUnit() == null || course.getUnit() == 0){//计算学时 + disperse_hour[2] += (course.getTheoretical()==null) ? 0 : course.getTheoretical(); + }else{ + disperse_week[2] += (course.getTheoretical()==null) ? 0 : course.getTheoretical(); + } } c.put("experiement", course.getExperiement()); if(!isDisperse){ - t[3] += (course.getExperiement()==null) ? 0 : course.getExperiement(); + if(course.getUnit() == null || course.getUnit() == 0){//计算学时 + total_hour[3] += (course.getExperiement()==null) ? 0 : course.getExperiement(); + }else{ + total_week[3] += (course.getExperiement()==null) ? 0 : course.getExperiement(); + } }else{ - d[3] += (course.getExperiement()==null) ? 0 : course.getExperiement(); + if(course.getUnit() == null || course.getUnit() == 0){//计算学时 + disperse_hour[3] += (course.getExperiement()==null) ? 0 : course.getExperiement(); + }else{ + disperse_week[3] += (course.getExperiement()==null) ? 0 : course.getExperiement(); + } } c.put("unit", course.getUnit()); - c.put("hpw", curriculum.getHpw()); - if(!isDisperse){ - if(unit == 0){ - t[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); - }else{ - t_w[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); + c.put("hpw", (curriculum.getHpw()==null) ? "" : curriculum.getHpw()); + if(!isDisperse){//不分散 + if(unit == 0){//学时 + total_hour[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); + }else{//学周 + total_week[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); + c.put("hpw", (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement()); } }else{ - if(unit == 0){ - d[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); - }else{ - d_w[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); + if(unit == 0){//学时 + disperse_hour[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); + }else{//学周 + disperse_week[4] += (curriculum.getHpw()==null) ? 0 : curriculum.getHpw(); + c.put("hpw", (course.getTheoretical() == null || course.getExperiement() == null) ? 0 : course.getTheoretical() + course.getExperiement()); } } c.put("start", curriculum.getStart()); @@ -342,36 +365,36 @@ public class CurriculumController { } } //保存学期的小计信息 - total.put("score", t[0] + d[0]);//学分不分是否分散,全部统计 + total.put("score", total_score);//学分不分是否分散,全部统计 - total.put("time", double2String(t[1])); - if(d[1] > 0D){ - total.put("time", double2String(t[1]) + "(" + double2String(d[1]) + ")");// + total.put("time", double2String(total_hour[1])); + if(disperse_hour[1] > 0D){ + total.put("time", double2String(total_hour[1]) + "(" + double2String(disperse_hour[1]) + ")");// } - total.put("theoretical", double2String(t[2])); - if(d[2] > 0D){ - total.put("theoretical", double2String(t[2]) + "(" + double2String(d[2]) + ")"); + total.put("theoretical", double2String(total_hour[2])); + if(disperse_hour[2] > 0D){ + total.put("theoretical", double2String(total_hour[2]) + "(" + double2String(disperse_hour[2]) + ")"); } - total.put("experiement", double2String(t[3])); - if(d[3] > 0D){ - total.put("experiement", double2String(t[3]) + "(" + double2String(d[3]) + ")"); + total.put("experiement", double2String(total_hour[3])); + if(disperse_hour[3] > 0D){ + total.put("experiement", double2String(total_hour[3]) + "(" + double2String(disperse_hour[3]) + ")"); } - if(t_w[4] > 0D || d_w[4] > 0D){ - total.put("hpw", double2String(t[4]) + "/"); - if(t_w[4] > 0D){ - total.put("hpw", (String)total.get("hpw") + double2String(t_w[4])); + if(total_week[4] > 0D || disperse_week[4] > 0D){ + total.put("hpw", double2String(total_hour[4]) + "/"); + if(total_week[4] > 0D){ + total.put("hpw", (String)total.get("hpw") + double2String(total_week[4])); } - if(d_w[4] > 0D){ - total.put("hpw", (String)total.get("hpw") + "(" + double2String(t_w[4]) + ")"); + if(disperse_week[4] > 0D){ + total.put("hpw", (String)total.get("hpw") + "(" + double2String(total_week[4]) + ")"); } total.put("hpw", (String)total.get("hpw") + "周" ); }else{ - total.put("hpw",double2String(t[4])); + total.put("hpw",double2String(total_hour[4])); } semester.put("course", curriculums); @@ -438,8 +461,6 @@ public class CurriculumController { type_.put("total", total); type_.put("coursetypename", coursetype.getName()); - - //all_curriculums.put("coursetype" + coursetype.getId(), type_); all_curriculums.add(type_); } } @@ -513,7 +534,7 @@ public class CurriculumController { List speciality_curriculums = curriculumService.selectAllCurriculumBySpeciality(specialityId, is); List courseids = new ArrayList(); for (Curriculum curriculum : speciality_curriculums) { - courseids.add(curriculum.getId()); + courseids.add(curriculum.getCourseid()); } //(1) 查询所有的教育平台 @@ -534,8 +555,13 @@ public class CurriculumController { if(cms != null && cms.size() > 0){ for (Coursemode cm : cms) { coursemode_theoretical_hour = 0D; + coursemode_theoretical_disperse_hour = 0D; coursemode_experiement_hour = 0D; + coursemode_experiement_disperse_hour = 0D; + coursemode_practice_week = 0D; + coursemode_practice_disperse_week = 0D; coursemode_score = 0D; + //(4) 查询该模式下所有的课程 // selectCourseBy Course exampleCourse = new Course(); diff --git a/src/cn/edu/hrbcu/curriculum/service/CourseService.java b/src/cn/edu/hrbcu/curriculum/service/CourseService.java index fd2537fb78570b230f143e9d336345dbe962e35e..3f2102418d05f05c37d7614c7b1d97d9e74856d3 100644 --- a/src/cn/edu/hrbcu/curriculum/service/CourseService.java +++ b/src/cn/edu/hrbcu/curriculum/service/CourseService.java @@ -20,12 +20,14 @@ public interface CourseService { List selectCourseBy(Course course); + List selectCourseBySpecialityId(Long specialityid, Long coursetypeid); + List selectCourseBy(Course course,List ids); int updateCourse(Course course); void deleteCourse(Course course); - Boolean makeCourseCode(int academyCode, int pecialityCode); + Boolean makeCourseCode(int academyCode, Long specialityid, int specialityCode); } diff --git a/src/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.java b/src/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.java index 5188283c062cddcee9f0c9655269d9992aeaec37..eb3bc61f257ca9c28267a18976f6df88d99769d0 100644 --- a/src/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.java +++ b/src/cn/edu/hrbcu/curriculum/service/CourseServiceImpl.java @@ -127,26 +127,23 @@ public class CourseServiceImpl implements CourseService { @Override - public Boolean makeCourseCode(int academyCode, int specialityCode) { + public Boolean makeCourseCode(int academyCode, Long specialityid, int specialityCode) { // TODO Auto-generated method stub List coursetypes = coursetypeService.selectAllCoursetype(); + if(coursetypes != null && coursetypes.size() > 0){ for (Coursetype coursetype : coursetypes) { - if(coursetype.getId() >= 4L && !coursetype.getId().equals(8L) ){//只有自己的课程编号 - Course c = new Course(); - c.setCoursetypeid(coursetype.getId()); - List courses = selectCourseBy(c); - if(courses != null && courses.size() > 0){ - for(int index = 0;index < courses.size() ; index++ ){ - courses.get(index).setIdentifier( - coursetype.getCode() - + String.format("%02d", academyCode) - + String.format("%01d",specialityCode) - + String.format("%02d",index + 1) - ); - - updateCourse(courses.get(index)); - } + List courses = selectCourseBySpecialityId(specialityid,coursetype.getId()); + if(courses != null && courses.size() > 0){ + for(int index = 0;index < courses.size() ; index++ ){ + courses.get(index).setIdentifier( + coursetype.getCode() + + String.format("%02d", academyCode) + + String.format("%01d",specialityCode) + + String.format("%02d",index + 1) + ); + + updateCourse(courses.get(index)); } } } @@ -182,5 +179,17 @@ public class CourseServiceImpl implements CourseService { return list; } + + + @Override + public List selectCourseBySpecialityId(Long specialityid, Long coursetypeid) { + // TODO Auto-generated method stub + CourseExample example = new CourseExample(); + CourseExample.Criteria criteria = example.createCriteria(); + criteria.andSpecialityidEqualTo(specialityid); + criteria.andCoursetypeidEqualTo(coursetypeid); + + return courseMapper.selectByExample(example); + } } diff --git a/src/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.java b/src/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.java index 97f0230966877705cc973b67cc34458ed1571e2d..20ad8167f3e3c62db345882d73b5ffd9d3720076 100644 --- a/src/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.java +++ b/src/cn/edu/hrbcu/curriculum/service/CurriculumServiceImpl.java @@ -272,6 +272,7 @@ public class CurriculumServiceImpl implements CurriculumService{ CurriculumExample.Criteria criteria = example.createCriteria(); criteria.andSpecialityidEqualTo(specialityid); criteria.andAvailableEqualTo(is); + example.setOrderByClause("courseid asc"); curriculums = curriculumMapper.selectByExample(example); return curriculums;