Commit d9b2b42013f74b89da8026a5bc1b58a45e527174
1 parent
83d0b153
提交数据 使用多线程
Showing
6 changed files
with
298 additions
and
243 deletions
resources/mybatis1/api/V1Mapper.xml
@@ -213,6 +213,21 @@ | @@ -213,6 +213,21 @@ | ||
213 | </select> | 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 | <select id="getLastWrongQuestionInfo" parameterType="pd" resultType="pd"> | 231 | <select id="getLastWrongQuestionInfo" parameterType="pd" resultType="pd"> |
217 | 232 | ||
218 | SELECT | 233 | SELECT |
resources/mybatis1/sunvote/StudentTestMapper.xml
@@ -72,6 +72,7 @@ | @@ -72,6 +72,7 @@ | ||
72 | PAPER_ID = #{PAPER_ID}, | 72 | PAPER_ID = #{PAPER_ID}, |
73 | SCORE = #{SCORE}, | 73 | SCORE = #{SCORE}, |
74 | CLASS_ID = #{CLASS_ID}, | 74 | CLASS_ID = #{CLASS_ID}, |
75 | + LOST_TEST = #{LOST_TEST}, | ||
75 | STUDENTTEST_ID = STUDENTTEST_ID | 76 | STUDENTTEST_ID = STUDENTTEST_ID |
76 | where | 77 | where |
77 | STUDENTTEST_ID = #{STUDENTTEST_ID} | 78 | STUDENTTEST_ID = #{STUDENTTEST_ID} |
src/com/fh/controller/api/V1.java
@@ -1634,118 +1634,132 @@ public class V1 extends BaseController { | @@ -1634,118 +1634,132 @@ public class V1 extends BaseController { | ||
1634 | public Object uploadupdateTestpaper() { | 1634 | public Object uploadupdateTestpaper() { |
1635 | event("uploadupdateTestpaper"); | 1635 | event("uploadupdateTestpaper"); |
1636 | long cur = System.currentTimeMillis(); | 1636 | long cur = System.currentTimeMillis(); |
1637 | - PageData pd = this.getPageData(); | 1637 | + final PageData pd = this.getPageData(); |
1638 | ResponseGson<String> res = new ResponseGson(); | 1638 | ResponseGson<String> res = new ResponseGson(); |
1639 | if (!StringUtils.isEmpty(pd.getJsonString())) { | 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 | } else { | 1763 | } else { |
1750 | res.setDataError(); | 1764 | res.setDataError(); |
1751 | } | 1765 | } |
@@ -1766,156 +1780,163 @@ public class V1 extends BaseController { | @@ -1766,156 +1780,163 @@ public class V1 extends BaseController { | ||
1766 | public Object uploadstudenttest() { | 1780 | public Object uploadstudenttest() { |
1767 | event("uploadstudenttest"); | 1781 | event("uploadstudenttest"); |
1768 | long cur = System.currentTimeMillis(); | 1782 | long cur = System.currentTimeMillis(); |
1769 | - PageData pd = this.getPageData(); | 1783 | + final PageData pd = this.getPageData(); |
1770 | ResponseGson<String> res = new ResponseGson(); | 1784 | ResponseGson<String> res = new ResponseGson(); |
1771 | if (!StringUtils.isEmpty(pd.getJsonString())) { | 1785 | if (!StringUtils.isEmpty(pd.getJsonString())) { |
1772 | - logger.info(pd.getJsonString()); | ||
1773 | - try { | ||
1774 | - StudentPaper studentPaper = StudentPaper.parse(pd | ||
1775 | - .getJsonString()); | ||
1776 | - | ||
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",studentPaper.getStartDate()); | ||
1790 | - testPd.put("END_DATE", studentPaper.getEndDate()); | ||
1791 | - testPd.put("TESTPAPER_ID", studentPaper.getPaperId()); | ||
1792 | - testPd.put("OTHER_SCORE", ""); | ||
1793 | - testPd.put("HIGHT_SCORE", ""); | ||
1794 | - testPd.put("LOW_SCORE", ""); | ||
1795 | - testPd.put("AVG_SCORE", ""); | ||
1796 | - testPd.put("TOTAL_SCORE", ""); | ||
1797 | - testPd.put("SUBJECT_ID", studentPaper.getSubject_id()); | ||
1798 | - testPd.put("REMARK", ""); | ||
1799 | - testPd.put("NAME", studentPaper.getName()); | ||
1800 | - testpaperService.save(testPd); | ||
1801 | - }else{ | ||
1802 | - boolean find = false; | ||
1803 | - for(PageData pda: oldList){ | ||
1804 | - if(pda != null && studentPaper.getPaperId().equals(pda.get("TESTPAPER_ID"))){ | ||
1805 | - find = true; | ||
1806 | - break; | 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 | + } | ||
1807 | } | 1848 | } |
1808 | - } | ||
1809 | - if(!find){ | ||
1810 | - testPd.put("TEACHER_ID", ""); | ||
1811 | - testPd.put("SCLASS_ID", ""); | ||
1812 | - testPd.put( | ||
1813 | - "CREATE_DATE", | ||
1814 | - studentPaper.getCreateDate() == null ? Tools | ||
1815 | - .date2Str(new Date()) : studentPaper | ||
1816 | - .getCreateDate()); | ||
1817 | - testPd.put("TEST_TYPE", "1"); | ||
1818 | - testPd.put("START_DATE",studentPaper.getStartDate()); | ||
1819 | - testPd.put("END_DATE", studentPaper.getEndDate()); | ||
1820 | - testPd.put("TESTPAPER_ID", studentPaper.getPaperId()); | ||
1821 | - testPd.put("OTHER_SCORE", ""); | ||
1822 | - testPd.put("HIGHT_SCORE", ""); | ||
1823 | - testPd.put("LOW_SCORE", ""); | ||
1824 | - testPd.put("AVG_SCORE", ""); | ||
1825 | - testPd.put("TOTAL_SCORE", ""); | ||
1826 | - testPd.put("SUBJECT_ID", studentPaper.getSubject_id()); | ||
1827 | - testPd.put("REMARK", ""); | ||
1828 | - testPd.put("NAME", studentPaper.getName()); | ||
1829 | - testpaperService.save(testPd); | ||
1830 | - } | ||
1831 | - } | ||
1832 | 1849 | ||
1833 | - List<StudentPaper.StudentAnswer> list = studentPaper | ||
1834 | - .getStudents(); | 1850 | + List<StudentPaper.StudentAnswer> list = studentPaper |
1851 | + .getStudents(); | ||
1835 | 1852 | ||
1836 | - for (StudentPaper.StudentAnswer studentAnswer : list) { | ||
1837 | - PageData stestPd = new PageData(); | 1853 | + for (StudentPaper.StudentAnswer studentAnswer : list) { |
1854 | + PageData stestPd = new PageData(); | ||
1838 | 1855 | ||
1839 | - String studentId = studentAnswer.getStudentId(); | ||
1840 | - String classId = ""; | 1856 | + String studentId = studentAnswer.getStudentId(); |
1857 | + String classId = ""; | ||
1841 | 1858 | ||
1842 | - // 通过学号id 查找学生信息 | ||
1843 | - if (StringUtils.isEmpty(studentId)) { | ||
1844 | - PageData ptd = new PageData(); | ||
1845 | - ptd.put("NUMBER", studentAnswer.getNumber()); | ||
1846 | - PageData stPd = studentService.findByNumber(ptd); | ||
1847 | - if (stPd != null) { | ||
1848 | - studentId = stPd.getString("ID"); | ||
1849 | - classId = stPd.getString("CLASS_ID"); | ||
1850 | - } | ||
1851 | - } else { | ||
1852 | - PageData ptd = new PageData(); | ||
1853 | - ptd.put("ID", studentAnswer.getStudentId()); | ||
1854 | - PageData stPd = studentService.findByNumber(ptd); | ||
1855 | - if (stPd != null) { | ||
1856 | - studentId = stPd.getString("ID"); | ||
1857 | - classId = stPd.getString("CLASS_ID"); | ||
1858 | - } | ||
1859 | - } | ||
1860 | - if (StringUtils.isEmpty(studentId)) { | ||
1861 | - continue; | ||
1862 | - } | ||
1863 | - stestPd.put("STUDENT_ID", studentId); | ||
1864 | - stestPd.put("CLASS_ID", classId); | ||
1865 | - stestPd.put("PAPER_ID", studentPaper.getPaperId()); | ||
1866 | - stestPd.put("TEST_ID", studentPaper.getPaperId()); | ||
1867 | - stestPd.put("SCORE", studentAnswer.getScore()); | ||
1868 | - stestPd.put("LOST_TEST", studentAnswer.getLosttest()); | ||
1869 | - List<PageData> liste = studenttestService.listAll(stestPd); | ||
1870 | - if (liste == null || liste.size() == 0) { | ||
1871 | - stestPd.put("STUDENTTEST_ID", get32UUID()); | ||
1872 | - studenttestService.save(stestPd); | ||
1873 | - } else { | ||
1874 | - PageData ptd = liste.get(0); | ||
1875 | - stestPd.put("STUDENTTEST_ID", ptd.get("STUDENTTEST_ID")); | ||
1876 | - studenttestService.edit(stestPd); | ||
1877 | - } | ||
1878 | - | ||
1879 | - List<PageData> testInfoPdList = new ArrayList(); | ||
1880 | - List<StudentPaper.Question> questions = studentAnswer | ||
1881 | - .getQuestions(); | ||
1882 | - for (StudentPaper.Question question : questions) { | ||
1883 | - PageData testInfoPd = new PageData(); | ||
1884 | - testInfoPd.put("TESTPAPERINFO_ID", this.get32UUID()); | ||
1885 | - testInfoPd.put("TEST_ID", studentPaper.getPaperId()); | ||
1886 | - testInfoPd.put("PAPER_ID", studentPaper.getPaperId()); | ||
1887 | - testInfoPd.put("STUDENT_ID", studentId); | ||
1888 | - testInfoPd.put("QUESTION_ID", question.getQuestionId()); | ||
1889 | - testInfoPd.put("ANSWER", question.getAnswer()); | ||
1890 | - testInfoPd.put("RIGHT", question.getRight()); | ||
1891 | - testInfoPd.put("SCORE", question.getScore()); | ||
1892 | - testInfoPd.put("ANSWER_TYPE", question.getAnswerType()); | ||
1893 | - List<PageData> listse = testpaperinfoService | ||
1894 | - .listAll(testInfoPd); | ||
1895 | - if (listse == null || listse.size() == 0) { | ||
1896 | - testInfoPdList.add(testInfoPd); | ||
1897 | - } else { | ||
1898 | - PageData ptd = listse.get(0); | ||
1899 | - testInfoPd.put("TESTPAPERINFO_ID", | ||
1900 | - testInfoPd.get("TESTPAPERINFO_ID")); | ||
1901 | - testpaperinfoService.edit(testInfoPd); | ||
1902 | - } | ||
1903 | - } | 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 | + } | ||
1904 | 1899 | ||
1905 | - if (testInfoPdList.size() > 0) { | ||
1906 | - testpaperinfoService.batchSave(testInfoPdList); | ||
1907 | - } | 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 | + } | ||
1908 | 1925 | ||
1909 | - } | 1926 | + if (testInfoPdList.size() > 0) { |
1927 | + testpaperinfoService.batchSave(testInfoPdList); | ||
1928 | + } | ||
1910 | 1929 | ||
1911 | - } catch (Exception e) { | ||
1912 | - e.printStackTrace(); | ||
1913 | - res.setError(); | ||
1914 | - res.setMessage(e.getMessage()); | ||
1915 | - } | ||
1916 | - } else { | 1930 | + } |
1931 | + }catch(Exception e){ | ||
1932 | + e.printStackTrace(); | ||
1933 | + } | ||
1934 | + }; | ||
1935 | + }.start(); | ||
1936 | + }else{ | ||
1917 | res.setDataError(); | 1937 | res.setDataError(); |
1918 | } | 1938 | } |
1939 | + | ||
1919 | logger.info("uploadstudenttest cost time:" | 1940 | logger.info("uploadstudenttest cost time:" |
1920 | + (System.currentTimeMillis() - cur)); | 1941 | + (System.currentTimeMillis() - cur)); |
1921 | 1942 |
src/com/fh/controller/sunvote/paper/PaperController.java
@@ -961,7 +961,17 @@ public class PaperController extends BaseController { | @@ -961,7 +961,17 @@ public class PaperController extends BaseController { | ||
961 | Float o2GetScore = Float.valueOf(o2.getString("TEST_NUM")) == 0 ? 0 | 961 | Float o2GetScore = Float.valueOf(o2.getString("TEST_NUM")) == 0 ? 0 |
962 | : Float.valueOf(o2.getString("STUDENT_TOTAL")) | 962 | : Float.valueOf(o2.getString("STUDENT_TOTAL")) |
963 | / Float.valueOf(o2.getString("TEST_NUM")); | 963 | / Float.valueOf(o2.getString("TEST_NUM")); |
964 | - return o2GetScore.compareTo(o1GetScore); | 964 | + |
965 | + int result = o2GetScore.compareTo(o1GetScore); | ||
966 | + if(result == 0){ | ||
967 | + if(Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) == 0 ){ | ||
968 | + return o1.get("STUDENT_NUMBER").toString().compareTo(o2.get("STUDENT_NUMBER").toString()); | ||
969 | + } | ||
970 | + return Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) > 0 ? -1 : 1; | ||
971 | + | ||
972 | + } | ||
973 | + | ||
974 | + return result; | ||
965 | } | 975 | } |
966 | 976 | ||
967 | }); | 977 | }); |
src/com/fh/service/api/V1Manager.java
@@ -26,6 +26,9 @@ public interface V1Manager { | @@ -26,6 +26,9 @@ public interface V1Manager { | ||
26 | 26 | ||
27 | public PageData getAdminInfo(PageData pd) throws Exception; | 27 | public PageData getAdminInfo(PageData pd) throws Exception; |
28 | 28 | ||
29 | + | ||
30 | + public PageData findStudentBySchoolIdAndNumber(PageData pd) throws Exception; | ||
31 | + | ||
29 | public List<PageData> getClassBySchoolAndGradle(PageData pd) throws Exception; | 32 | public List<PageData> getClassBySchoolAndGradle(PageData pd) throws Exception; |
30 | 33 | ||
31 | public List<PageData> classReport(PageData pd) throws Exception; | 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,6 +57,11 @@ public class V1Service implements V1Manager { | ||
57 | } | 57 | } |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | + public PageData findStudentBySchoolIdAndNumber(PageData pd) throws Exception { | ||
61 | + return (PageData)dao.findForObject("V1Mapper.findStudentBySchoolIdAndNumber", pd); | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
60 | public List<PageData> getQuestionWrongInfo(PageData pd) throws Exception { | 65 | public List<PageData> getQuestionWrongInfo(PageData pd) throws Exception { |
61 | return (List<PageData>)dao.findForList("V1Mapper.getQuestionWrongInfo", pd); | 66 | return (List<PageData>)dao.findForList("V1Mapper.getQuestionWrongInfo", pd); |
62 | } | 67 | } |