Commit 931af053ee004232b900bc64bc1dfd1bdaa23bbc

Authored by 孙向锦
1 parent 8ebabb04

添加二级排序

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
... ... @@ -1786,18 +1786,48 @@ public class V1 extends BaseController {
1786 1786 .date2Str(new Date()) : studentPaper
1787 1787 .getCreateDate());
1788 1788 testPd.put("TEST_TYPE", "1");
1789   - testPd.put("START_DATE", "");
  1789 + testPd.put("START_DATE",studentPaper.getStartDate());
1790 1790 testPd.put("END_DATE", studentPaper.getEndDate());
1791   - testPd.put("NAME", "");
1792 1791 testPd.put("TESTPAPER_ID", studentPaper.getPaperId());
1793 1792 testPd.put("OTHER_SCORE", "");
1794 1793 testPd.put("HIGHT_SCORE", "");
1795 1794 testPd.put("LOW_SCORE", "");
1796 1795 testPd.put("AVG_SCORE", "");
1797 1796 testPd.put("TOTAL_SCORE", "");
1798   - testPd.put("SUBJECT_ID", "");
  1797 + testPd.put("SUBJECT_ID", studentPaper.getSubject_id());
1799 1798 testPd.put("REMARK", "");
  1799 + testPd.put("NAME", studentPaper.getName());
1800 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;
  1807 + }
  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 + }
1801 1831 }
1802 1832  
1803 1833 List<StudentPaper.StudentAnswer> list = studentPaper
... ...
src/com/fh/controller/sunvote/paper/PaperController.java
... ... @@ -843,7 +843,15 @@ public class PaperController extends BaseController {
843 843 Float o2GetScore = Float.valueOf(o2.getString("TEST_NUM")) == 0 ? 0
844 844 : Float.valueOf(o2.getString("STUDENT_TOTAL"))
845 845 / Float.valueOf(o2.getString("TEST_NUM"));
846   - return o2GetScore.compareTo(o1GetScore);
  846 + int result = o2GetScore.compareTo(o1GetScore);
  847 + if(result == 0){
  848 + if(Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) == 0 ){
  849 + return o1.get("STUDENT_NUMBER").toString().compareTo(o2.get("STUDENT_NUMBER").toString());
  850 + }
  851 + return Float.valueOf(o1.getString("TEST_NUM")) -Float.valueOf(o2.getString("TEST_NUM")) > 0 ? -1 : 1;
  852 +
  853 + }
  854 + return result;
847 855 }
848 856  
849 857 });
... ...