Commit 2db1bb32aadbdee2b09173d99145bb433f2f87dc

Authored by jack
2 parents 1f0490aa c9edd3c9

Merge branch '睿教中性版' of http://120.78.57.84/Elvis/SunvoteEducation into 睿教中性版

WebRoot/WEB-INF/jsp/sunvote/paper/paper_list2.jsp
... ... @@ -43,7 +43,7 @@
43 43 </style>
44 44 </head>
45 45 <body>
46   - <form action="../paper/list2.do?SCHOOL_ID=${pd.SCHOOL_ID }" method="post" name="Form" id="Form">
  46 + <form action="../paper/list2.do?SCHOOL_ID=${pd.SCHOOL_ID }&SUBJECT_ID=${PD.SUBJECT_ID}" method="post" name="Form" id="Form">
47 47 <div class="head_box">
48 48 <div class="box_header">
49 49 <div class="head_box_l">
... ... @@ -67,6 +67,7 @@
67 67 <col style="width: 10%" />
68 68 <col style="width: 10%" />
69 69 <col style="width: 10%" />
  70 + <col style="width: 10%" />
70 71 <col style="width: 17%" />
71 72 <thead>
72 73 <tr>
... ... @@ -76,6 +77,7 @@
76 77 <th>建议考试时长</th>
77 78 <th>考试次数</th>
78 79 <th>总分</th>
  80 + <th>试卷类型</th>
79 81 <th>操作</th>
80 82 </tr>
81 83 </thead>
... ... @@ -91,6 +93,7 @@
91 93 <col style="width: 10%" />
92 94 <col style="width: 10%" />
93 95 <col style="width: 10%" />
  96 + <col style="width: 10%" />
94 97 <col style="width: 17%" />
95 98 <tbody>
96 99 <c:choose>
... ... @@ -103,6 +106,7 @@
103 106 <td >${var.EXAM_TIME}</td>
104 107 <td >${var.TEST_NUM}</td>
105 108 <td >${var.SCORE}</td>
  109 + <td >${var.PAPER_TYPE ==1?"个人卷":"年级卷"}</td>
106 110 <td>
107 111 <c:if test="${var.PAPER_TYPE ==1 }">
108 112 <a <c:if test="${var.TEST_NUM == 0}" >disabled style="pointer-events:none;color:#ccc" </c:if> href="<%=basePath%>paper/paperRep.do?paper_id=${var.PAPER_ID}">查看成绩</a>
... ...
WebRoot/WEB-INF/jsp/sunvote/paper/paper_list5.jsp
... ... @@ -107,7 +107,7 @@
107 107 <td >${var.TEST_NUM}</td>
108 108 <td >${var.SCORE}</td>
109 109 <td>
110   - <a <c:if test="${var.TEST_NUM == 0}" >disabled style="pointer-events:none;color:#ccc" </c:if> href="<%=basePath%>paper/paperRep.do?MB1=nj&paper_id=${var.PAPER_ID}">查看成绩</a>
  110 + <%-- <a <c:if test="${var.TEST_NUM == 0}" >disabled style="pointer-events:none;color:#ccc" </c:if> href="<%=basePath%>paper/paperRep.do?MB1=nj&paper_id=${var.PAPER_ID}">查看成绩</a> --%>
111 111 <a <c:if test="${var.TEST_NUM == 0}" >disabled style="pointer-events:none;color:#ccc" </c:if> href="<%=basePath%>paper/paperRep3.do?MB1=${pd.MB1 }&PAPER_ID=${var.PAPER_ID}">年级分析</a>
112 112 <a href="#" onclick="del('${var.PAPER_ID}');"><img src="../static/images/remove.png" /></a>
113 113 </td>
... ...
WebRoot/WEB-INF/jsp/sunvote/paper/test_list3.jsp
... ... @@ -88,12 +88,14 @@
88 88 <thead>
89 89 <tr>
90 90 <th><div style="width:80px;text-align:center">学生姓名</div></th>
  91 + <th><div style="width:80px;text-align:center">学号</div></th>
  92 + <th><div style="width:80px;text-align:center">键盘号</div></th>
91 93 <th><div style="width:80px;text-align:center">班级</div></th>
92 94 <th><div style="width:80px;text-align:center">综合排名</div></th>
93   - <th><div style="width:100px;text-align:center">个人平均得分</div></th>
94   - <th><div style="width:100px;text-align:center">个人平均得分率</div></th>
  95 + <!-- <th><div style="width:100px;text-align:center">个人平均得分</div></th> -->
  96 + <!-- <th><div style="width:100px;text-align:center">个人平均得分率</div></th> -->
95 97 <th><div style="width:80px;text-align:center">个人得分</div></th>
96   - <th><div style="width:80px;text-align:center">测验平均分</div></th>
  98 + <!-- <th><div style="width:80px;text-align:center">测验平均分</div></th> -->
97 99 <th><div style="width:80px;text-align:center">测验时间</div></th>
98 100 </tr>
99 101 </thead>
... ... @@ -104,20 +106,22 @@
104 106 <c:set var="student_avg" value="${var.TEST_NUM==0?0:var.STUDENT_TOTAL/var.TEST_NUM}"></c:set>
105 107 <tr>
106 108 <td rowspan="${var.TEST_LIST.size()}" align="center">${var.STUDENT_NAME}</td>
  109 + <td rowspan="${var.TEST_LIST.size()}" align="center">${var.STUDENT_NUMBER}</td>
  110 + <td rowspan="${var.TEST_LIST.size()}" align="center">${var.STUDENT_PADID}</td>
107 111 <td rowspan="${var.TEST_LIST.size()}" align="center">${var.CLASS_NAME}</td>
108 112 <td rowspan="${var.TEST_LIST.size()}" align="center">${vs.index+1}</td>
109   - <td rowspan="${var.TEST_LIST.size()}" align="center"><fmt:formatNumber type="number"
  113 + <%-- <td rowspan="${var.TEST_LIST.size()}" align="center"><fmt:formatNumber type="number"
110 114 value="${student_avg}"
111   - maxFractionDigits="2" /></td>
112   - <td rowspan="${var.TEST_LIST.size()}" align="center"><fmt:formatNumber type="number"
  115 + maxFractionDigits="2" /></td> --%>
  116 + <%-- <td rowspan="${var.TEST_LIST.size()}" align="center"><fmt:formatNumber type="number"
113 117 value="${student_avg*100/pd.SCORE}"
114   - maxFractionDigits="2" />%</td>
  118 + maxFractionDigits="2" />%</td> --%>
115 119 <c:forEach items="${var.TEST_LIST }" var ="var1" varStatus="vs1">
116 120 <c:if test="${!vs1.first}">
117 121 <tr>
118 122 </c:if>
119 123 <td>${var1.SCORE } </td>
120   - <td>${var1.AVG_SCORE } </td>
  124 + <%-- <td>${var1.AVG_SCORE } </td> --%>
121 125 <td>${var1.CREATE_DATE } </td>
122 126 </tr>
123 127 </c:forEach>
... ...
WebRoot/static/js/control_template.js
... ... @@ -224,7 +224,7 @@ $(function() {
224 224 if(testData.paper_type == '1'){
225 225 window.location.href = JUMP_URL + "?a=1&defaulturl=../paper/list2.do";
226 226 }else{
227   - window.location.href = JUMP_URL + "?a=1&defaulturl=../paper/list4.do?school_id=" + testData.school_id ;
  227 + window.location.href = JUMP_URL + "?a=1&defaulturl=../paper/list5.do?school_id=" + testData.school_id ;
228 228 }
229 229 }
230 230 })
... ...
resources/mybatis1/api/V1Mapper.xml
... ... @@ -213,6 +213,21 @@
213 213 </select>
214 214  
215 215  
  216 +
  217 + <!-- 通过学校ID和学号,查找学生对应的信息 -->
  218 + <select id="findStudentBySchoolIdAndNumber" parameterType="pd" resultType="pd">
  219 + SELECT
  220 + sv_student.*
  221 + FROM
  222 + sv_student
  223 + LEFT JOIN sv_sclass ON sv_student.CLASS_ID = sv_sclass.ID
  224 + WHERE
  225 + sv_sclass.SCHOOL_ID = #{SCHOOL_ID}
  226 + AND sv_student.NUMBER = #{NUMBER}
  227 +
  228 + </select>
  229 +
  230 +
216 231 <select id="getLastWrongQuestionInfo" parameterType="pd" resultType="pd">
217 232  
218 233 SELECT
... ...
resources/mybatis1/sunvote/StudentTestMapper.xml
... ... @@ -72,6 +72,7 @@
72 72 PAPER_ID = #{PAPER_ID},
73 73 SCORE = #{SCORE},
74 74 CLASS_ID = #{CLASS_ID},
  75 + LOST_TEST = #{LOST_TEST},
75 76 STUDENTTEST_ID = STUDENTTEST_ID
76 77 where
77 78 STUDENTTEST_ID = #{STUDENTTEST_ID}
... ... @@ -100,7 +101,9 @@
100 101 sv_testpaper.CREATE_DATE,
101 102 sv_testpaper.`NAME` AS PAPER_NAME,
102 103 sv_sclass.CLASS_NAME,
103   - sv_student.`NAME` as STUDENT_NAME
  104 + sv_student.`NAME` as STUDENT_NAME,
  105 + sv_student.NUMBER AS STUDENT_NUMBER,
  106 + sv_student.KEYPAD_ID AS STUDENT_PADID
104 107 from
105 108 `sv_studenttest`
106 109 LEFT JOIN sv_testpaper ON sv_studenttest.TEST_ID = sv_testpaper.TESTPAPER_ID
... ...
src/com/fh/bean/StudentPaper.java
... ... @@ -130,12 +130,18 @@ public class StudentPaper {
130 130  
131 131 private String createDate;
132 132  
  133 + private String startDate;
  134 +
133 135 private String endDate;
134 136  
135 137 private String schoolId;
136 138  
137 139 private String paperId;
138 140  
  141 + private String name;
  142 +
  143 + private String subject_id ;
  144 +
139 145  
140 146  
141 147 private List<StudentAnswer> students;
... ... @@ -174,6 +180,14 @@ public class StudentPaper {
174 180  
175 181  
176 182  
  183 + public String getStartDate() {
  184 + return startDate;
  185 + }
  186 +
  187 + public void setStartDate(String startDate) {
  188 + this.startDate = startDate;
  189 + }
  190 +
177 191 public String getPaperId() {
178 192 return paperId;
179 193 }
... ... @@ -189,6 +203,22 @@ public class StudentPaper {
189 203 }
190 204  
191 205  
  206 + public String getName() {
  207 + return name;
  208 + }
  209 +
  210 + public void setName(String name) {
  211 + this.name = name;
  212 + }
  213 +
  214 + public String getSubject_id() {
  215 + return subject_id;
  216 + }
  217 +
  218 + public void setSubject_id(String subject_id) {
  219 + this.subject_id = subject_id;
  220 + }
  221 +
192 222 public String toJson(){
193 223 Gson gson = new Gson();
194 224 return gson.toJson(this);
... ...
src/com/fh/controller/api/V1.java
... ... @@ -1634,118 +1634,132 @@ public class V1 extends BaseController {
1634 1634 public Object uploadupdateTestpaper() {
1635 1635 event("uploadupdateTestpaper");
1636 1636 long cur = System.currentTimeMillis();
1637   - PageData pd = this.getPageData();
  1637 + final PageData pd = this.getPageData();
1638 1638 ResponseGson<String> res = new ResponseGson();
1639 1639 if (!StringUtils.isEmpty(pd.getJsonString())) {
1640   - logger.info(pd.getJsonString());
1641   - TestPaper testPaper = TestPaper.parse(pd.getJsonString());
1642   - try {
1643   - PageData testPd = new PageData();
1644   - String testPaperId = this.get32UUID();
1645   - testPd.put("TEACHER_ID", testPaper.getTeacherId());
1646   - testPd.put("PAPER_ID", testPaper.getPaperId());
1647   - testPd.put("SCLASS_ID", testPaper.getClassId());
1648   - testPd.put(
1649   - "CREATE_DATE",
1650   - testPaper.getCreateDate() == null ? Tools
1651   - .date2Str(new Date()) : testPaper
1652   - .getCreateDate());
1653   - testPd.put(
1654   - "TEST_TYPE",
1655   - testPaper.getTest_type() != null ? testPaper
1656   - .getTest_type() : "1");
1657   - List<PageData> listData = testpaperService.listAll(testPd);
1658   - if ((listData != null && listData.size() > 0)) {
1659   - testPaperId = listData.get(0).getString("TESTPAPER_ID");
1660   - testpaperService.deleteList(testPd);
1661   - testPd.put("TEST_ID", testPaperId);
1662   - testpaperinfoService.delete(testPd);
1663   - studenttestService.delete(testPd);
1664   - }
1665   - testPd.put("START_DATE", testPaper.getStartDate());
1666   - testPd.put("END_DATE", testPaper.getEndDate());
1667   - testPd.put("NAME", testPaper.getName());
1668   - testPd.put("TESTPAPER_ID", testPaperId);
1669   - testPd.put("OTHER_SCORE", testPaper.getOtherScore());
1670   - testPd.put("HIGHT_SCORE", testPaper.getHighScore());
1671   - testPd.put("LOW_SCORE", testPaper.getLowScore());
1672   - testPd.put("AVG_SCORE", testPaper.getAvgScore());
1673   - testPd.put("TOTAL_SCORE", testPaper.getTotalScore());
1674   - testPd.put("SUBJECT_ID", testPaper.getSubject_id());
1675   - testPd.put("REMARK", testPaper.getRemark());
1676   - testpaperService.save(testPd);
1677   - if (testPaper.getStudents() != null) {
1678   - List<PageData> testInfoPdList = new ArrayList();
1679   - PageData testInfoPd = null;
1680   - for (StudentAnswer studentAnswer : testPaper.getStudents()) {
1681   - if (studentAnswer.getQuestions() != null) {
1682   - PageData studentPageData = new PageData();
1683   - studentPageData.put("STUDENT_ID",
1684   - studentAnswer.getStudentId());
1685   - studentPageData.put("TEST_ID", testPaperId);
1686   - studentPageData.put("PAPER_ID",
1687   - testPaper.getPaperId());
1688   - studentPageData.put("SCORE",
1689   - studentAnswer.getScore());
1690   - studentPageData.put("CLASS_ID",
1691   - testPaper.getClassId());
1692   - studentPageData.put("STUDENTTEST_ID", get32UUID());
  1640 + new Thread() {
  1641 + public void run() {
  1642 + logger.info(pd.getJsonString());
  1643 + TestPaper testPaper = TestPaper.parse(pd.getJsonString());
  1644 + try {
  1645 + PageData testPd = new PageData();
  1646 + String testPaperId = get32UUID();
  1647 + testPd.put("TEACHER_ID", testPaper.getTeacherId());
  1648 + testPd.put("PAPER_ID", testPaper.getPaperId());
  1649 + testPd.put("SCLASS_ID", testPaper.getClassId());
  1650 + testPd.put(
  1651 + "CREATE_DATE",
  1652 + testPaper.getCreateDate() == null ? Tools
  1653 + .date2Str(new Date()) : testPaper
  1654 + .getCreateDate());
  1655 + testPd.put(
  1656 + "TEST_TYPE",
  1657 + testPaper.getTest_type() != null ? testPaper
  1658 + .getTest_type() : "1");
  1659 + List<PageData> listData = testpaperService
  1660 + .listAll(testPd);
  1661 + if ((listData != null && listData.size() > 0)) {
  1662 + testPaperId = listData.get(0).getString(
  1663 + "TESTPAPER_ID");
  1664 + testpaperService.deleteList(testPd);
  1665 + testPd.put("TEST_ID", testPaperId);
  1666 + testpaperinfoService.delete(testPd);
  1667 + studenttestService.delete(testPd);
  1668 + }
  1669 + testPd.put("START_DATE", testPaper.getStartDate());
  1670 + testPd.put("END_DATE", testPaper.getEndDate());
  1671 + testPd.put("NAME", testPaper.getName());
  1672 + testPd.put("TESTPAPER_ID", testPaperId);
  1673 + testPd.put("OTHER_SCORE", testPaper.getOtherScore());
  1674 + testPd.put("HIGHT_SCORE", testPaper.getHighScore());
  1675 + testPd.put("LOW_SCORE", testPaper.getLowScore());
  1676 + testPd.put("AVG_SCORE", testPaper.getAvgScore());
  1677 + testPd.put("TOTAL_SCORE", testPaper.getTotalScore());
  1678 + testPd.put("SUBJECT_ID", testPaper.getSubject_id());
  1679 + testPd.put("REMARK", testPaper.getRemark());
  1680 + testpaperService.save(testPd);
  1681 + if (testPaper.getStudents() != null) {
  1682 + List<PageData> testInfoPdList = new ArrayList();
  1683 + PageData testInfoPd = null;
  1684 + for (StudentAnswer studentAnswer : testPaper
  1685 + .getStudents()) {
  1686 + if (studentAnswer.getQuestions() != null) {
  1687 + PageData studentPageData = new PageData();
  1688 + studentPageData.put("STUDENT_ID",
  1689 + studentAnswer.getStudentId());
  1690 + studentPageData.put("TEST_ID", testPaperId);
  1691 + studentPageData.put("PAPER_ID",
  1692 + testPaper.getPaperId());
  1693 + studentPageData.put("SCORE",
  1694 + studentAnswer.getScore());
  1695 + studentPageData.put("CLASS_ID",
  1696 + testPaper.getClassId());
  1697 + studentPageData.put("STUDENTTEST_ID",
  1698 + get32UUID());
  1699 +
  1700 + String flag = "";
  1701 + for (TestPaperInfo testPaperInfo : studentAnswer
  1702 + .getQuestions()) {
  1703 + testInfoPd = new PageData();
  1704 + testInfoPd.put("TESTPAPERINFO_ID",
  1705 + get32UUID());
  1706 + testInfoPd.put("PAPER_ID",
  1707 + testPaper.getPaperId());
  1708 + testInfoPd.put("STUDENT_ID",
  1709 + studentAnswer.getStudentId());
  1710 + testInfoPd.put("TEST_ID", testPaperId);
  1711 + testInfoPd.put("QUESTION_ID",
  1712 + testPaperInfo.getQuestionId());
  1713 + testInfoPd.put("ANSWER",
  1714 + testPaperInfo.getAnswer());
  1715 + flag = StringUtils.isEmpty(testPaperInfo
  1716 + .getAnswer())
  1717 + ? ""
  1718 + + flag : testPaperInfo
  1719 + .getAnswer();
  1720 + testInfoPd.put("RIGHT",
  1721 + testPaperInfo.getRight());
  1722 + testInfoPd.put("SCORE",
  1723 + testPaperInfo.getScore());
  1724 + testInfoPd.put("LIKES",
  1725 + testPaperInfo.getLikes());
  1726 + testInfoPd
  1727 + .put("ANSWER_TYPE",
  1728 + testPaperInfo
  1729 + .getAnswerType() == null ? "1"
  1730 + : testPaperInfo
  1731 + .getAnswerType());
  1732 + testInfoPd.put("PRESS_TIME",
  1733 + testPaperInfo.getPressTime());
  1734 + testInfoPd
  1735 + .put("RECEIVER_DATE",
  1736 + testPaperInfo
  1737 + .getReceiverDate());
  1738 + testInfoPd.put("SUBJECTIVE",
  1739 + testPaperInfo.getSubjective());
  1740 + testInfoPd.put("NOTE",
  1741 + testPaperInfo.getNote());
  1742 + testInfoPd.put("MARK_NO",
  1743 + testPaperInfo.getMarkNo());
  1744 + testInfoPdList.add(testInfoPd);
  1745 + }
1693 1746  
1694   - String flag = "";
1695   - for (TestPaperInfo testPaperInfo : studentAnswer
1696   - .getQuestions()) {
1697   - testInfoPd = new PageData();
1698   - testInfoPd.put("TESTPAPERINFO_ID",
1699   - this.get32UUID());
1700   - testInfoPd.put("PAPER_ID",
1701   - testPaper.getPaperId());
1702   - testInfoPd.put("STUDENT_ID",
1703   - studentAnswer.getStudentId());
1704   - testInfoPd.put("TEST_ID", testPaperId);
1705   - testInfoPd.put("QUESTION_ID",
1706   - testPaperInfo.getQuestionId());
1707   - testInfoPd.put("ANSWER",
1708   - testPaperInfo.getAnswer());
1709   - flag = testPaperInfo.getAnswer().toString()
1710   - .equals("") ? "" + flag : testPaperInfo
1711   - .getAnswer().toString();
1712   - testInfoPd.put("RIGHT",
1713   - testPaperInfo.getRight());
1714   - testInfoPd.put("SCORE",
1715   - testPaperInfo.getScore());
1716   - testInfoPd.put("LIKES",
1717   - testPaperInfo.getLikes());
1718   - testInfoPd.put("ANSWER_TYPE", testPaperInfo
1719   - .getAnswerType() == null ? "1"
1720   - : testPaperInfo.getAnswerType());
1721   - testInfoPd.put("PRESS_TIME",
1722   - testPaperInfo.getPressTime());
1723   - testInfoPd.put("RECEIVER_DATE",
1724   - testPaperInfo.getReceiverDate());
1725   - testInfoPd.put("SUBJECTIVE",
1726   - testPaperInfo.getSubjective());
1727   - testInfoPd.put("NOTE", testPaperInfo.getNote());
1728   - testInfoPd.put("MARK_NO",
1729   - testPaperInfo.getMarkNo());
1730   - testInfoPdList.add(testInfoPd);
  1747 + if (flag.equals("")) {
  1748 + studentPageData.put("LOST_TEST", "1");
  1749 + }
  1750 + studenttestService.save(studentPageData);
  1751 + }
1731 1752 }
1732   -
1733   - if (flag.equals("")) {
1734   - studentPageData.put("LOST_TEST", "1");
  1753 + if (testInfoPdList != null
  1754 + && testInfoPdList.size() > 0) {
  1755 + testpaperinfoService.batchSave(testInfoPdList);
1735 1756 }
1736   - studenttestService.save(studentPageData);
1737 1757 }
1738   - }
1739   - if (testInfoPdList != null && testInfoPdList.size() > 0) {
1740   - testpaperinfoService.batchSave(testInfoPdList);
  1758 + } catch (Exception e) {
  1759 + e.printStackTrace();
1741 1760 }
1742 1761 }
1743   - res.setData(testPaperId);
1744   - } catch (Exception e) {
1745   - e.printStackTrace();
1746   - res.setError();
1747   - res.setMessage(e.getMessage());
1748   - }
  1762 + }.start();
1749 1763 } else {
1750 1764 res.setDataError();
1751 1765 }
... ... @@ -1764,129 +1778,166 @@ public class V1 extends BaseController {
1764 1778 @RequestMapping(value = "/uploadstudenttest", produces = "application/json;charset=UTF-8")
1765 1779 @ResponseBody
1766 1780 public Object uploadstudenttest() {
1767   - event("uploadupdateTestpaper");
  1781 + event("uploadstudenttest");
1768 1782 long cur = System.currentTimeMillis();
1769   - PageData pd = this.getPageData();
  1783 + final PageData pd = this.getPageData();
1770 1784 ResponseGson<String> res = new ResponseGson();
1771 1785 if (!StringUtils.isEmpty(pd.getJsonString())) {
1772   - logger.info(pd.getJsonString());
1773   - try {
1774   - StudentPaper studentPaper = StudentPaper.parse(pd
1775   - .getJsonString());
  1786 + new Thread(){
  1787 + public void run() {
  1788 + logger.info(pd.getJsonString());
  1789 +
  1790 + try {
  1791 + StudentPaper studentPaper = StudentPaper.parse(pd
  1792 + .getJsonString());
  1793 +
  1794 + PageData testPd = new PageData();
  1795 + testPd.put("PAPER_ID", studentPaper.getPaperId());
  1796 + List<PageData> oldList = testpaperService.listAll(testPd);
  1797 + if (oldList == null || oldList.size() == 0) {
  1798 + testPd.put("TEACHER_ID", "");
  1799 + testPd.put("SCLASS_ID", "");
  1800 + testPd.put(
  1801 + "CREATE_DATE",
  1802 + studentPaper.getCreateDate() == null ? Tools
  1803 + .date2Str(new Date()) : studentPaper
  1804 + .getCreateDate());
  1805 + testPd.put("TEST_TYPE", "1");
  1806 + testPd.put("START_DATE",studentPaper.getStartDate());
  1807 + testPd.put("END_DATE", studentPaper.getEndDate());
  1808 + testPd.put("TESTPAPER_ID", studentPaper.getPaperId());
  1809 + testPd.put("OTHER_SCORE", "");
  1810 + testPd.put("HIGHT_SCORE", "");
  1811 + testPd.put("LOW_SCORE", "");
  1812 + testPd.put("AVG_SCORE", "");
  1813 + testPd.put("TOTAL_SCORE", "");
  1814 + testPd.put("SUBJECT_ID", studentPaper.getSubject_id());
  1815 + testPd.put("REMARK", "");
  1816 + testPd.put("NAME", studentPaper.getName());
  1817 + testpaperService.save(testPd);
  1818 + }else{
  1819 + boolean find = false;
  1820 + for(PageData pda: oldList){
  1821 + if(pda != null && studentPaper.getPaperId().equals(pda.get("TESTPAPER_ID"))){
  1822 + find = true;
  1823 + break;
  1824 + }
  1825 + }
  1826 + if(!find){
  1827 + testPd.put("TEACHER_ID", "");
  1828 + testPd.put("SCLASS_ID", "");
  1829 + testPd.put(
  1830 + "CREATE_DATE",
  1831 + studentPaper.getCreateDate() == null ? Tools
  1832 + .date2Str(new Date()) : studentPaper
  1833 + .getCreateDate());
  1834 + testPd.put("TEST_TYPE", "1");
  1835 + testPd.put("START_DATE",studentPaper.getStartDate());
  1836 + testPd.put("END_DATE", studentPaper.getEndDate());
  1837 + testPd.put("TESTPAPER_ID", studentPaper.getPaperId());
  1838 + testPd.put("OTHER_SCORE", "");
  1839 + testPd.put("HIGHT_SCORE", "");
  1840 + testPd.put("LOW_SCORE", "");
  1841 + testPd.put("AVG_SCORE", "");
  1842 + testPd.put("TOTAL_SCORE", "");
  1843 + testPd.put("SUBJECT_ID", studentPaper.getSubject_id());
  1844 + testPd.put("REMARK", "");
  1845 + testPd.put("NAME", studentPaper.getName());
  1846 + testpaperService.save(testPd);
  1847 + }
  1848 + }
1776 1849  
1777   - PageData testPd = new PageData();
1778   - testPd.put("PAPER_ID", studentPaper.getPaperId());
1779   - List<PageData> oldList = testpaperService.listAll(testPd);
1780   - if (oldList == null || oldList.size() == 0) {
1781   - testPd.put("TEACHER_ID", "");
1782   - testPd.put("SCLASS_ID", "");
1783   - testPd.put(
1784   - "CREATE_DATE",
1785   - studentPaper.getCreateDate() == null ? Tools
1786   - .date2Str(new Date()) : studentPaper
1787   - .getCreateDate());
1788   - testPd.put("TEST_TYPE", "1");
1789   - testPd.put("START_DATE", "");
1790   - testPd.put("END_DATE", studentPaper.getEndDate());
1791   - testPd.put("NAME", "");
1792   - testPd.put("TESTPAPER_ID", get32UUID());
1793   - testPd.put("OTHER_SCORE", "");
1794   - testPd.put("HIGHT_SCORE", "");
1795   - testPd.put("LOW_SCORE", "");
1796   - testPd.put("AVG_SCORE", "");
1797   - testPd.put("TOTAL_SCORE", "");
1798   - testPd.put("SUBJECT_ID", "");
1799   - testPd.put("REMARK", "");
1800   - testpaperService.save(testPd);
1801   - }
  1850 + List<StudentPaper.StudentAnswer> list = studentPaper
  1851 + .getStudents();
1802 1852  
1803   - List<StudentPaper.StudentAnswer> list = studentPaper
1804   - .getStudents();
  1853 + for (StudentPaper.StudentAnswer studentAnswer : list) {
  1854 + PageData stestPd = new PageData();
1805 1855  
1806   - for (StudentPaper.StudentAnswer studentAnswer : list) {
1807   - PageData stestPd = new PageData();
  1856 + String studentId = studentAnswer.getStudentId();
  1857 + String classId = "";
1808 1858  
1809   - String studentId = studentAnswer.getStudentId();
1810   - String classId = "";
  1859 + // 通过学号id 查找学生信息
  1860 + if (StringUtils.isEmpty(studentId)) {
  1861 + PageData ptd = new PageData();
  1862 + ptd.put("NUMBER", studentAnswer.getNumber());
  1863 + ptd.put("SCHOOL_ID", studentPaper.getSchoolId());
  1864 + PageData stPd = v1Service.findStudentBySchoolIdAndNumber(ptd); //
  1865 + if(stPd == null){
  1866 + stPd = studentService.findByNumber(ptd);
  1867 + }
  1868 + if (stPd != null) {
  1869 + studentId = stPd.getString("ID");
  1870 + classId = stPd.getString("CLASS_ID");
  1871 + }
  1872 + } else {
  1873 + PageData ptd = new PageData();
  1874 + ptd.put("ID", studentAnswer.getStudentId());
  1875 + PageData stPd = studentService.findById(ptd);
  1876 + if (stPd != null) {
  1877 + studentId = stPd.getString("ID");
  1878 + classId = stPd.getString("CLASS_ID");
  1879 + }
  1880 + }
  1881 + if (StringUtils.isEmpty(studentId)) {
  1882 + continue;
  1883 + }
  1884 + stestPd.put("STUDENT_ID", studentId);
  1885 + stestPd.put("CLASS_ID", classId);
  1886 + stestPd.put("PAPER_ID", studentPaper.getPaperId());
  1887 + stestPd.put("TEST_ID", studentPaper.getPaperId());
  1888 + stestPd.put("SCORE", studentAnswer.getScore());
  1889 + stestPd.put("LOST_TEST", studentAnswer.getLosttest());
  1890 + List<PageData> liste = studenttestService.listAll(stestPd);
  1891 + if (liste == null || liste.size() == 0) {
  1892 + stestPd.put("STUDENTTEST_ID", get32UUID());
  1893 + studenttestService.save(stestPd);
  1894 + } else {
  1895 + PageData ptd = liste.get(0);
  1896 + stestPd.put("STUDENTTEST_ID", ptd.get("STUDENTTEST_ID"));
  1897 + studenttestService.edit(stestPd);
  1898 + }
1811 1899  
1812   - // 通过学号id 查找学生信息
1813   - if (StringUtils.isEmpty(studentId)) {
1814   - PageData ptd = new PageData();
1815   - ptd.put("NUMBER", studentAnswer.getNumber());
1816   - PageData stPd = studentService.findByNumber(ptd);
1817   - if (stPd != null) {
1818   - studentId = stPd.getString("ID");
1819   - classId = stPd.getString("CLASS_ID");
1820   - }
1821   - } else {
1822   - PageData ptd = new PageData();
1823   - ptd.put("ID", studentAnswer.getStudentId());
1824   - PageData stPd = studentService.findByNumber(ptd);
1825   - if (stPd != null) {
1826   - studentId = stPd.getString("ID");
1827   - classId = stPd.getString("CLASS_ID");
1828   - }
1829   - }
1830   - if (StringUtils.isEmpty(studentId)) {
1831   - continue;
1832   - }
1833   - stestPd.put("STUDENT_ID", studentId);
1834   - stestPd.put("CLASS_ID", classId);
1835   - stestPd.put("PAPER_ID", studentPaper.getPaperId());
1836   - stestPd.put("TEST_ID", studentPaper.getPaperId());
1837   - stestPd.put("SCORE", studentAnswer.getScore());
1838   - testPd.put("LOST_TEST", studentAnswer.getLosttest());
1839   - List<PageData> liste = studenttestService.listAll(stestPd);
1840   - if (liste == null || liste.size() == 0) {
1841   - testPd.put("STUDENTTEST_ID", get32UUID());
1842   - studenttestService.save(stestPd);
1843   - } else {
1844   - PageData ptd = liste.get(0);
1845   - testPd.put("STUDENTTEST_ID", ptd.get("STUDENTTEST_ID"));
1846   - studenttestService.edit(stestPd);
1847   - }
  1900 + List<PageData> testInfoPdList = new ArrayList();
  1901 + List<StudentPaper.Question> questions = studentAnswer
  1902 + .getQuestions();
  1903 + for (StudentPaper.Question question : questions) {
  1904 + PageData testInfoPd = new PageData();
  1905 + testInfoPd.put("TESTPAPERINFO_ID", get32UUID());
  1906 + testInfoPd.put("TEST_ID", studentPaper.getPaperId());
  1907 + testInfoPd.put("PAPER_ID", studentPaper.getPaperId());
  1908 + testInfoPd.put("STUDENT_ID", studentId);
  1909 + testInfoPd.put("QUESTION_ID", question.getQuestionId());
  1910 + testInfoPd.put("ANSWER", question.getAnswer());
  1911 + testInfoPd.put("RIGHT", question.getRight());
  1912 + testInfoPd.put("SCORE", question.getScore());
  1913 + testInfoPd.put("ANSWER_TYPE", question.getAnswerType());
  1914 + List<PageData> listse = testpaperinfoService
  1915 + .listAll(testInfoPd);
  1916 + if (listse == null || listse.size() == 0) {
  1917 + testInfoPdList.add(testInfoPd);
  1918 + } else {
  1919 + PageData ptd = listse.get(0);
  1920 + testInfoPd.put("TESTPAPERINFO_ID",
  1921 + testInfoPd.get("TESTPAPERINFO_ID"));
  1922 + testpaperinfoService.edit(testInfoPd);
  1923 + }
  1924 + }
1848 1925  
1849   - List<PageData> testInfoPdList = new ArrayList();
1850   - List<StudentPaper.Question> questions = studentAnswer
1851   - .getQuestions();
1852   - for (StudentPaper.Question question : questions) {
1853   - PageData testInfoPd = new PageData();
1854   - testInfoPd.put("TESTPAPERINFO_ID", this.get32UUID());
1855   - testInfoPd.put("TEST_ID", studentPaper.getPaperId());
1856   - testInfoPd.put("PAPER_ID", studentPaper.getPaperId());
1857   - testInfoPd.put("STUDENT_ID", studentId);
1858   - testInfoPd.put("QUESTION_ID", question.getQuestionId());
1859   - testInfoPd.put("ANSWER", question.getAnswer());
1860   - testInfoPd.put("RIGHT", question.getRight());
1861   - testInfoPd.put("SCORE", question.getScore());
1862   - testInfoPd.put("ANSWER_TYPE", question.getAnswerType());
1863   - List<PageData> listse = testpaperinfoService
1864   - .listAll(testInfoPd);
1865   - if (listse == null || listse.size() == 0) {
1866   - testInfoPdList.add(testInfoPd);
1867   - } else {
1868   - PageData ptd = listse.get(0);
1869   - testInfoPd.put("TESTPAPERINFO_ID",
1870   - testInfoPd.get("TESTPAPERINFO_ID"));
1871   - testpaperinfoService.edit(testInfoPd);
1872   - }
1873   - }
  1926 + if (testInfoPdList.size() > 0) {
  1927 + testpaperinfoService.batchSave(testInfoPdList);
  1928 + }
1874 1929  
1875   - if (testInfoPdList.size() > 0) {
1876   - testpaperinfoService.batchSave(testInfoPdList);
  1930 + }
  1931 + }catch(Exception e){
  1932 + e.printStackTrace();
1877 1933 }
1878   -
1879   - }
1880   -
1881   - } catch (Exception e) {
1882   - e.printStackTrace();
1883   - res.setError();
1884   - res.setMessage(e.getMessage());
1885   - }
1886   - } else {
  1934 + };
  1935 + }.start();
  1936 + }else{
1887 1937 res.setDataError();
1888 1938 }
1889   - logger.info("uploadupdatetestpaper cost time:"
  1939 +
  1940 + logger.info("uploadstudenttest cost time:"
1890 1941 + (System.currentTimeMillis() - cur));
1891 1942  
1892 1943 return res.toJson();
... ... @@ -3497,7 +3548,6 @@ public class V1 extends BaseController {
3497 3548 testpaperinfoService.save(testInfoPd);
3498 3549 logger.info("添加学生详细情况成功:");
3499 3550 } catch (Exception e) {
3500   - // TODO Auto-generated catch block
3501 3551 e.printStackTrace();
3502 3552 }
3503 3553 // testInfoPdList.add(testInfoPd);
... ...
src/com/fh/controller/sunvote/coursemanagement/CourseManagementController.java
... ... @@ -96,11 +96,14 @@ public class CourseManagementController extends BaseController {
96 96 pd.put("SUBJECT_ID", tpd.get("SUBJECT_IDS"));
97 97 if(coursemanagementService.findByCourse(pd) == null){
98 98 coursemanagementService.save(pd);
  99 + mv.addObject("msg","success");
  100 + mv.setViewName("save_result2");
99 101 }else{
100 102 //TODO
  103 + mv.addObject("msg","不能重复任课,请检查后再试");
  104 + mv.setViewName("save_result2");
101 105 }
102   - mv.addObject("msg","success");
103   - mv.setViewName("save_result2");
  106 +
104 107 return mv;
105 108 }
106 109  
... ...
src/com/fh/controller/sunvote/paper/PaperController.java
... ... @@ -824,7 +824,7 @@ public class PaperController extends BaseController {
824 824 Integer test_num = 0;
825 825 Integer lost_num = 0;
826 826 List<String> classId = new ArrayList();
827   - PageData sclass = new PageData();
  827 +
828 828 for (PageData item : list) {
829 829  
830 830 PageData p = new PageData();
... ... @@ -872,6 +872,7 @@ public class PaperController extends BaseController {
872 872 stu.put("CLASS_NAME", item.get("CLASS_NAME"));
873 873 if(!classId.contains(item.getString("CLASS_ID"))){
874 874 classId.add(item.getString("CLASS_ID"));
  875 + PageData sclass = new PageData();
875 876 sclass.put("CLASS_ID", item.get("CLASS_ID"));
876 877 sclass.put("CLASS_NAME", item.get("CLASS_NAME"));
877 878 sclass_list.add(sclass);
... ... @@ -889,6 +890,8 @@ public class PaperController extends BaseController {
889 890 test.put("AVG_SCORE", item.get("AVG_SCORE"));
890 891 testList.add(test);
891 892 stu.put("STUDENT_TOTAL", item.get("SCORE"));
  893 + stu.put("STUDENT_NUMBER", item.get("STUDENT_NUMBER"));
  894 + stu.put("STUDENT_PADID", item.get("STUDENT_PADID"));
892 895 stu.put("TEST_LIST", testList);
893 896 stu.put("TEST_NUM", testList.size() - lost_num);
894 897 stu.put("LOST_NUM", lost_num);
... ... @@ -910,7 +913,15 @@ public class PaperController extends BaseController {
910 913 Float o2GetScore = Float.valueOf(o2.getString("TEST_NUM")) == 0 ? 0
911 914 : Float.valueOf(o2.getString("STUDENT_TOTAL"))
912 915 / Float.valueOf(o2.getString("TEST_NUM"));
913   - return o2GetScore.compareTo(o1GetScore);
  916 + int result = o2GetScore.compareTo(o1GetScore);
  917 + if(result == 0){
  918 + if(Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) == 0 ){
  919 + return o1.get("STUDENT_NUMBER").toString().compareTo(o2.get("STUDENT_NUMBER").toString());
  920 + }
  921 + return Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) > 0 ? -1 : 1;
  922 +
  923 + }
  924 + return result;
914 925 }
915 926  
916 927 });
... ... @@ -998,6 +1009,8 @@ public class PaperController extends BaseController {
998 1009 testList.add(test);
999 1010 stu.put("STUDENT_TOTAL", item.get("SCORE"));
1000 1011 stu.put("TEST_LIST", testList);
  1012 + stu.put("STUDENT_NUMBER", item.get("STUDENT_NUMBER"));
  1013 + stu.put("STUDENT_PADID", item.get("STUDENT_PADID"));
1001 1014 stu.put("TEST_NUM", testList.size() - lost_num);
1002 1015 stu.put("LOST_NUM", lost_num);
1003 1016 sid.add(item.getString("STUDENT_ID"));
... ... @@ -1017,7 +1030,17 @@ public class PaperController extends BaseController {
1017 1030 Float o2GetScore = Float.valueOf(o2.getString("TEST_NUM")) == 0 ? 0
1018 1031 : Float.valueOf(o2.getString("STUDENT_TOTAL"))
1019 1032 / Float.valueOf(o2.getString("TEST_NUM"));
1020   - return o2GetScore.compareTo(o1GetScore);
  1033 +
  1034 + int result = o2GetScore.compareTo(o1GetScore);
  1035 + if(result == 0){
  1036 + if(Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) == 0 ){
  1037 + return o1.get("STUDENT_NUMBER").toString().compareTo(o2.get("STUDENT_NUMBER").toString());
  1038 + }
  1039 + return Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) > 0 ? -1 : 1;
  1040 +
  1041 + }
  1042 +
  1043 + return result;
1021 1044 }
1022 1045  
1023 1046 });
... ... @@ -1028,13 +1051,15 @@ public class PaperController extends BaseController {
1028 1051 Map<String, Object> dataMap = new HashMap<String, Object>();
1029 1052 List<String> titles = new ArrayList<String>();
1030 1053 titles.add("学生姓名"); // 1
1031   - titles.add("班级"); // 2
1032   - titles.add("综合排名"); // 3
1033   - titles.add("个人平均得分"); // 4
1034   - titles.add("个人平均得分率"); // 5
  1054 + titles.add("学号"); // 2
  1055 + titles.add("键盘号"); // 3
  1056 + titles.add("班级"); // 4
  1057 + titles.add("综合排名"); // 5
  1058 + //titles.add("个人平均得分"); // 4
  1059 + //titles.add("个人平均得分率"); // 5
1035 1060 titles.add("个人得分"); // 6
1036   - titles.add("测验平均分"); // 7
1037   - titles.add("测验时间"); // 8
  1061 + //titles.add("测验平均分"); // 7
  1062 + titles.add("测验时间"); // 7
1038 1063  
1039 1064 dataMap.put("titles", titles);
1040 1065 List<PageData> varOList = temp;
... ... @@ -1045,36 +1070,23 @@ public class PaperController extends BaseController {
1045 1070 PageData vpd = new PageData();
1046 1071  
1047 1072 vpd.put("var1", varOList.get(i).getString("STUDENT_NAME")); // 1
1048   - vpd.put("var2", varOList.get(i).getString("CLASS_NAME")); // 2
1049   - vpd.put("var3", i + 1); // 3
1050   - vpd.put("var4",
1051   - varOList.get(i).getString("TEST_NUM").equals("0") ? 0
1052   - : decimalFormat.format(Double.valueOf(varOList.get(
1053   - i).getString("STUDENT_TOTAL"))
1054   - / Double.valueOf(varOList.get(i).getString(
1055   - "TEST_NUM")))); // 4
1056   - vpd.put("var5",
1057   - varOList.get(i).getString("TEST_NUM").equals("0") ? 0+"%"
1058   - : decimalFormat.format((Double.valueOf(varOList
1059   - .get(i).getString("STUDENT_TOTAL")) * 100 / Double
1060   - .valueOf(varOList.get(i).getString(
1061   - "TEST_NUM")))
1062   - / Double.valueOf(pd.getString("SCORE")))+"%"); // 5
  1073 + vpd.put("var2", varOList.get(i).getString("STUDENT_NUMBER")); // 2
  1074 + vpd.put("var3", varOList.get(i).getString("STUDENT_PADID")); // 3
  1075 + vpd.put("var4", varOList.get(i).getString("CLASS_NAME")); // 4
  1076 + vpd.put("var5", i + 1); // 5
1063 1077 List<PageData> test_list = (List<PageData>) varOList.get(i).get(
1064 1078 "TEST_LIST");
1065 1079  
1066 1080 List<String> score = new ArrayList<String>();
1067   - List<String> AVG_SCORE = new ArrayList<String>();
  1081 +
1068 1082 List<String> CREATE_DATE = new ArrayList<String>();
1069 1083 for (int x = 0; x < test_list.size(); x++) {
1070 1084 score.add(test_list.get(x).getString("SCORE"));
1071   - AVG_SCORE.add(test_list.get(x).getString("AVG_SCORE"));
1072 1085 CREATE_DATE.add(test_list.get(x).getString("CREATE_DATE"));
1073 1086  
1074 1087 }
1075 1088 vpd.put("var6", score);
1076   - vpd.put("var7", AVG_SCORE);
1077   - vpd.put("var8", CREATE_DATE);
  1089 + vpd.put("var7", CREATE_DATE);
1078 1090 varList.add(vpd);
1079 1091  
1080 1092 }
... ...
src/com/fh/service/api/V1Manager.java
... ... @@ -26,6 +26,9 @@ public interface V1Manager {
26 26  
27 27 public PageData getAdminInfo(PageData pd) throws Exception;
28 28  
  29 +
  30 + public PageData findStudentBySchoolIdAndNumber(PageData pd) throws Exception;
  31 +
29 32 public List<PageData> getClassBySchoolAndGradle(PageData pd) throws Exception;
30 33  
31 34 public List<PageData> classReport(PageData pd) throws Exception;
... ...
src/com/fh/service/api/impl/V1Service.java
... ... @@ -57,6 +57,11 @@ public class V1Service implements V1Manager {
57 57 }
58 58  
59 59 @Override
  60 + public PageData findStudentBySchoolIdAndNumber(PageData pd) throws Exception {
  61 + return (PageData)dao.findForObject("V1Mapper.findStudentBySchoolIdAndNumber", pd);
  62 + }
  63 +
  64 + @Override
60 65 public List<PageData> getQuestionWrongInfo(PageData pd) throws Exception {
61 66 return (List<PageData>)dao.findForList("V1Mapper.getQuestionWrongInfo", pd);
62 67 }
... ...