Commit a6067eacbca95a7bc4f3420c8ae9a9424bb91fd8
Merge branch '标准版' of http://120.78.57.84/Elvis/SunvoteEducation into 标准版
Showing
1 changed file
with
21 additions
and
4 deletions
src/com/fh/controller/api/V1.java
@@ -1775,8 +1775,7 @@ public class V1 extends BaseController { | @@ -1775,8 +1775,7 @@ public class V1 extends BaseController { | ||
1775 | try { | 1775 | try { |
1776 | for (StudentPaper.StudentAnswer studentAnswer : list) { | 1776 | for (StudentPaper.StudentAnswer studentAnswer : list) { |
1777 | PageData testPd = new PageData(); | 1777 | PageData testPd = new PageData(); |
1778 | - String testPaperId = this.get32UUID(); | ||
1779 | - testPd.put("STUDENTTEST_ID", testPaperId); | 1778 | + |
1780 | String studentId = studentAnswer.getStudentId(); | 1779 | String studentId = studentAnswer.getStudentId(); |
1781 | String classId = ""; | 1780 | String classId = ""; |
1782 | // 通过学号id 查找学生信息 | 1781 | // 通过学号id 查找学生信息 |
@@ -1800,15 +1799,26 @@ public class V1 extends BaseController { | @@ -1800,15 +1799,26 @@ public class V1 extends BaseController { | ||
1800 | testPd.put("STUDENT_ID", studentId); | 1799 | testPd.put("STUDENT_ID", studentId); |
1801 | testPd.put("CLASS_ID", classId); | 1800 | testPd.put("CLASS_ID", classId); |
1802 | testPd.put("PAPER_ID", studentPaper.getPaperId()); | 1801 | testPd.put("PAPER_ID", studentPaper.getPaperId()); |
1802 | + testPd.put("TEST_ID", studentPaper.getPaperId()); | ||
1803 | testPd.put("SCORE", studentAnswer.getScore()); | 1803 | testPd.put("SCORE", studentAnswer.getScore()); |
1804 | testPd.put("LOST_TEST", studentAnswer.getLosttest()); | 1804 | testPd.put("LOST_TEST", studentAnswer.getLosttest()); |
1805 | - studenttestService.save(testPd); | 1805 | + List<PageData> liste = studenttestService.listAll(testPd); |
1806 | + if(liste == null || liste.size() == 0){ | ||
1807 | + testPd.put("STUDENTTEST_ID", get32UUID()); | ||
1808 | + studenttestService.save(testPd); | ||
1809 | + }else{ | ||
1810 | + PageData ptd = liste.get(0); | ||
1811 | + testPd.put("STUDENTTEST_ID", ptd.get("STUDENTTEST_ID")); | ||
1812 | + studenttestService.edit(testPd); | ||
1813 | + } | ||
1814 | + | ||
1806 | List<PageData> testInfoPdList = new ArrayList(); | 1815 | List<PageData> testInfoPdList = new ArrayList(); |
1807 | List<StudentPaper.Question> questions = studentAnswer | 1816 | List<StudentPaper.Question> questions = studentAnswer |
1808 | .getQuestions(); | 1817 | .getQuestions(); |
1809 | for (StudentPaper.Question question : questions) { | 1818 | for (StudentPaper.Question question : questions) { |
1810 | PageData testInfoPd = new PageData(); | 1819 | PageData testInfoPd = new PageData(); |
1811 | testInfoPd.put("TESTPAPERINFO_ID", this.get32UUID()); | 1820 | testInfoPd.put("TESTPAPERINFO_ID", this.get32UUID()); |
1821 | + testInfoPd.put("TEST_ID", studentPaper.getPaperId()); | ||
1812 | testInfoPd.put("PAPER_ID", studentPaper.getPaperId()); | 1822 | testInfoPd.put("PAPER_ID", studentPaper.getPaperId()); |
1813 | testInfoPd.put("STUDENT_ID", studentId); | 1823 | testInfoPd.put("STUDENT_ID", studentId); |
1814 | testInfoPd.put("QUESTION_ID", question.getQuestionId()); | 1824 | testInfoPd.put("QUESTION_ID", question.getQuestionId()); |
@@ -1816,7 +1826,14 @@ public class V1 extends BaseController { | @@ -1816,7 +1826,14 @@ public class V1 extends BaseController { | ||
1816 | testInfoPd.put("RIGHT", question.getRight()); | 1826 | testInfoPd.put("RIGHT", question.getRight()); |
1817 | testInfoPd.put("SCORE", question.getScore()); | 1827 | testInfoPd.put("SCORE", question.getScore()); |
1818 | testInfoPd.put("ANSWER_TYPE", question.getAnswerType()); | 1828 | testInfoPd.put("ANSWER_TYPE", question.getAnswerType()); |
1819 | - testInfoPdList.add(testInfoPd); | 1829 | + List<PageData> listse = testpaperinfoService.listAll(testInfoPd); |
1830 | + if(listse == null || listse.size() == 0){ | ||
1831 | + testInfoPdList.add(testInfoPd); | ||
1832 | + }else{ | ||
1833 | + PageData ptd = listse.get(0); | ||
1834 | + testInfoPd.put("TESTPAPERINFO_ID", testInfoPd.get("TESTPAPERINFO_ID")); | ||
1835 | + testpaperinfoService.edit(testInfoPd); | ||
1836 | + } | ||
1820 | } | 1837 | } |
1821 | 1838 | ||
1822 | if (testInfoPdList.size() > 0) { | 1839 | if (testInfoPdList.size() > 0) { |