Commit ce70231eaa48ad076bae44fe8c4244475535a351
1 parent
02f157fa
增加接口
Showing
21 changed files
with
1281 additions
and
157 deletions
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_report_1.jsp
| @@ -73,29 +73,29 @@ | @@ -73,29 +73,29 @@ | ||
| 73 | </thead> | 73 | </thead> |
| 74 | <tbody> | 74 | <tbody> |
| 75 | <tr> | 75 | <tr> |
| 76 | - <td class="center">班级课程总分</td> | ||
| 77 | - <td class="center"></td> | 76 | + <td class="center"><div style="width:150px;">班级课程总分</div></td> |
| 77 | + <td class="center"><div style="width:150px;"></div></td> | ||
| 78 | <td class="center"><div style="width:80px;"></div></td> | 78 | <td class="center"><div style="width:80px;"></div></td> |
| 79 | <c:forEach items="${testpaperList}" var="var" varStatus="vs"> | 79 | <c:forEach items="${testpaperList}" var="var" varStatus="vs"> |
| 80 | <td class="center"><div style="width:80px;margin:0 auto;">${var.TOTAL_SCORE}</div></td> | 80 | <td class="center"><div style="width:80px;margin:0 auto;">${var.TOTAL_SCORE}</div></td> |
| 81 | </c:forEach> | 81 | </c:forEach> |
| 82 | </tr> | 82 | </tr> |
| 83 | <tr> | 83 | <tr> |
| 84 | - <td class="center">班级课程平均分</td> | ||
| 85 | - <td class="center"></td> | ||
| 86 | - <td class="center"></td> | 84 | + <td class="center"><div style="width:150px;">班级课程平均分</div></td> |
| 85 | + <td class="center"><div style="width:150px;"></div></td> | ||
| 86 | + <td class="center"><div style="width:80px;"></div></td> | ||
| 87 | <c:forEach items="${testpaperList}" var="var" varStatus="vs"> | 87 | <c:forEach items="${testpaperList}" var="var" varStatus="vs"> |
| 88 | - <td class="center">${var.AVG_SCORE}</td> | 88 | + <td class="center"><div style="width:80px;margin:0 auto;">${var.AVG_SCORE}</div></td> |
| 89 | </c:forEach> | 89 | </c:forEach> |
| 90 | </tr> | 90 | </tr> |
| 91 | <tr> | 91 | <tr> |
| 92 | - <td class="center">班级课程平均得分率</td> | ||
| 93 | - <td class="center"></td> | ||
| 94 | - <td class="center"></td> | 92 | + <td class="center"><div style="width:150px;">班级课程平均得分率</div></td> |
| 93 | + <td class="center"><div style="width:150px;"></div></td> | ||
| 94 | + <td class="center"><div style="width:80px;"></div></td> | ||
| 95 | <c:forEach items="${testpaperList}" var="var" varStatus="vs"> | 95 | <c:forEach items="${testpaperList}" var="var" varStatus="vs"> |
| 96 | - <td class="center"><fmt:formatNumber type="number" | 96 | + <td class="center"><div style="width:80px;margin:0 auto;"><fmt:formatNumber type="number" |
| 97 | value="${var.TOTAL_SCORE == 0 ? 0: (var.AVG_SCORE / var.TOTAL_SCORE * 100)}" | 97 | value="${var.TOTAL_SCORE == 0 ? 0: (var.AVG_SCORE / var.TOTAL_SCORE * 100)}" |
| 98 | - maxFractionDigits="2" />%</td> | 98 | + maxFractionDigits="2" />%</div></td> |
| 99 | </c:forEach> | 99 | </c:forEach> |
| 100 | </tr> | 100 | </tr> |
| 101 | 101 | ||
| @@ -106,15 +106,15 @@ | @@ -106,15 +106,15 @@ | ||
| 106 | <%-- <td class="center"><a | 106 | <%-- <td class="center"><a |
| 107 | href="report/student_report?studentid=${var.ID}&class_id=${info.CLASS_ID}">${var.NAME}</a> | 107 | href="report/student_report?studentid=${var.ID}&class_id=${info.CLASS_ID}">${var.NAME}</a> |
| 108 | </td> --%> | 108 | </td> --%> |
| 109 | - <td class="center"><a | ||
| 110 | - onclick="student('${info.CLASS_ID}','${var.ID}')">${var.NAME}</a> | 109 | + <td class="center"><div style="width:150px;"><a |
| 110 | + onclick="student('${info.CLASS_ID}','${var.ID}')">${var.NAME}</a></div> | ||
| 111 | </td> | 111 | </td> |
| 112 | - <td class="center"><div style="width:80px;margin:0 auto;"><fmt:formatNumber type="number" | 112 | + <td class="center"><div style="width:150px;"><fmt:formatNumber type="number" |
| 113 | value="${var.TOTALSCORE == 0 ? 0: (var.GETSCORE / var.TOTALSCORE * 100)}" | 113 | value="${var.TOTALSCORE == 0 ? 0: (var.GETSCORE / var.TOTALSCORE * 100)}" |
| 114 | maxFractionDigits="2" />%</div></td> | 114 | maxFractionDigits="2" />%</div></td> |
| 115 | - <td class="center">${var.GETSCORE }</td> | 115 | + <td class="center"><div style="width:80px;margin:0 auto;">${var.GETSCORE }</div></td> |
| 116 | <c:forEach items="${testpaperList}" var="var1" varStatus="vs1"> | 116 | <c:forEach items="${testpaperList}" var="var1" varStatus="vs1"> |
| 117 | - <td class="center"><div style="width:80px;margin:0 auto;"><c:set var="TEST_ID" | 117 | + <td class="center"><div style="width:180px;margin:0 auto;"><c:set var="TEST_ID" |
| 118 | value="${var1.TESTPAPER_ID}" /> ${var[TEST_ID] }</div></td> | 118 | value="${var1.TESTPAPER_ID}" /> ${var[TEST_ID] }</div></td> |
| 119 | </c:forEach> | 119 | </c:forEach> |
| 120 | </tr> | 120 | </tr> |
| @@ -268,12 +268,13 @@ | @@ -268,12 +268,13 @@ | ||
| 268 | $("#simple-table").tablescroller(options); | 268 | $("#simple-table").tablescroller(options); |
| 269 | 269 | ||
| 270 | 270 | ||
| 271 | - var name_height = $(".kc").last().parent().height()-18; | 271 | + var name_height = $(".kc").last().parent().height()-18.5; |
| 272 | + console.log(name_height); | ||
| 272 | $(".th_name").height(name_height); | 273 | $(".th_name").height(name_height); |
| 273 | }); | 274 | }); |
| 274 | 275 | ||
| 275 | 276 | ||
| 276 | - console.log('${studentList}'); | 277 | + //console.log('${studentList}'); |
| 277 | 278 | ||
| 278 | </script> | 279 | </script> |
| 279 | 280 |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_report_test.jsp
| @@ -52,51 +52,51 @@ | @@ -52,51 +52,51 @@ | ||
| 52 | style="margin-top:0px;margin-bottom:0;"> | 52 | style="margin-top:0px;margin-bottom:0;"> |
| 53 | <thead> | 53 | <thead> |
| 54 | <tr> | 54 | <tr> |
| 55 | - <th class="center"><div style="width:80px;">键盘</div></th> | 55 | + <th class="center"><div style="width:109px;">键盘</div></th> |
| 56 | <th class="center"><div style="width:80px;">学号</div></th> | 56 | <th class="center"><div style="width:80px;">学号</div></th> |
| 57 | <th class="center"><div style="width:80px;">姓名</div></th> | 57 | <th class="center"><div style="width:80px;">姓名</div></th> |
| 58 | <th class="center"><div style="width:80px;">得分</div></th> | 58 | <th class="center"><div style="width:80px;">得分</div></th> |
| 59 | <!-- <th class="center"><div style="width:80px;">正确率</div></th> --> | 59 | <!-- <th class="center"><div style="width:80px;">正确率</div></th> --> |
| 60 | <th class="center"><div style="width:80px;">排名</div></th> | 60 | <th class="center"><div style="width:80px;">排名</div></th> |
| 61 | <c:forEach items="${questionInfo}" var="var" varStatus="vs"> | 61 | <c:forEach items="${questionInfo}" var="var" varStatus="vs"> |
| 62 | - <th class="center"><div style="width:80px;">题目${vs.index+1}</div></th> | 62 | + <th class="center"><div style="width:80px;margin:0 auto;">题目${vs.index+1}</div></th> |
| 63 | </c:forEach> | 63 | </c:forEach> |
| 64 | <!-- <th class="center"><div style="width:150px;">非选择题得分</div></th> --> | 64 | <!-- <th class="center"><div style="width:150px;">非选择题得分</div></th> --> |
| 65 | - <th class="center"><div style="width:80px;">总分</div></th> | 65 | + <th class="center"><div style="width:80px;margin:0 auto;">总分</div></th> |
| 66 | </tr> | 66 | </tr> |
| 67 | </thead> | 67 | </thead> |
| 68 | <tbody> | 68 | <tbody> |
| 69 | <tr> | 69 | <tr> |
| 70 | - <td class="center">--</td> | ||
| 71 | - <td class="center">--</td> | ||
| 72 | - <td class="center">--</td> | ||
| 73 | - <td class="center">--</td> | 70 | + <td class="center"><div style="width:109px;">--</div></td> |
| 71 | + <td class="center"><div style="width:80px;">--</div></td> | ||
| 72 | + <td class="center"><div style="width:80px;">--</div></td> | ||
| 73 | + <td class="center"><div style="width:80px;">--</div></td> | ||
| 74 | <!-- <td class="center"></td> --> | 74 | <!-- <td class="center"></td> --> |
| 75 | - <td class="center">--</td> | 75 | + <td class="center"><div style="width:80px;">--</div></td> |
| 76 | <c:forEach items="${questionInfo}" var="var" varStatus="vs"> | 76 | <c:forEach items="${questionInfo}" var="var" varStatus="vs"> |
| 77 | - <td class="center"><fmt:formatNumber type="number" | 77 | + <td class="center"><div style="width:80px;margin:0 auto;"><fmt:formatNumber type="number" |
| 78 | value="${var == 0 ? 0: (var / classInfo.studentNum * 100)}" | 78 | value="${var == 0 ? 0: (var / classInfo.studentNum * 100)}" |
| 79 | - maxFractionDigits="1" />%</td> | 79 | + maxFractionDigits="1" />%</div></td> |
| 80 | </c:forEach> | 80 | </c:forEach> |
| 81 | <!-- <td class="center"></td> --> | 81 | <!-- <td class="center"></td> --> |
| 82 | - <td class="center"></td> | 82 | + <td class="center"><div style="width:80px;margin:0 auto;"></div></td> |
| 83 | </tr> | 83 | </tr> |
| 84 | 84 | ||
| 85 | <c:choose> | 85 | <c:choose> |
| 86 | <c:when test="${not empty studentInfo}"> | 86 | <c:when test="${not empty studentInfo}"> |
| 87 | <c:forEach items="${studentInfo}" var="var" varStatus="vs"> | 87 | <c:forEach items="${studentInfo}" var="var" varStatus="vs"> |
| 88 | <tr> | 88 | <tr> |
| 89 | - <td class="center">${var.KEYPAD_ID}</td> | ||
| 90 | - <td class="center">${var.NUMBER}</td> | ||
| 91 | - <td class="center">${var.NAME}</td> | ||
| 92 | - <td class="center">${var.GETSCORE}</td> | 89 | + <td class="center"><div style="width:109px;">${var.KEYPAD_ID}</div></td> |
| 90 | + <td class="center"><div style="width:80px;">${var.NUMBER}</div></td> | ||
| 91 | + <td class="center"><div style="width:80px;">${var.NAME}</div></td> | ||
| 92 | + <td class="center"><div style="width:80px;">${var.GETSCORE}</div></td> | ||
| 93 | <%-- <td class="center">${var.RIGHT}</td> --%> | 93 | <%-- <td class="center">${var.RIGHT}</td> --%> |
| 94 | - <td class="center">${vs.index + 1}</td> | 94 | + <td class="center"><div style="width:80px;">${vs.index + 1}</div></td> |
| 95 | <c:forEach items="${questionInfo}" var="var1" varStatus="vs1"> | 95 | <c:forEach items="${questionInfo}" var="var1" varStatus="vs1"> |
| 96 | - <td class="center"><div style="width:80px">${var.detail[vs1.index].ANSWER}</div></td> | 96 | + <td class="center"><div style="width:80px;margin:0 auto;">${var.detail[vs1.index].ANSWER}</div></td> |
| 97 | </c:forEach> | 97 | </c:forEach> |
| 98 | <%-- <td class="center">${var.OTHER_SCORE}</td> --%> | 98 | <%-- <td class="center">${var.OTHER_SCORE}</td> --%> |
| 99 | - <td class="center">${var.GETSCORE}</td> | 99 | + <td class="center"><div style="width:80px;margin:0 auto;">${var.GETSCORE}</div></td> |
| 100 | </tr> | 100 | </tr> |
| 101 | </c:forEach> | 101 | </c:forEach> |
| 102 | </c:when> | 102 | </c:when> |
resources/mybatis1/sunvote/CacheMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="CacheMapper"> | ||
| 4 | + | ||
| 5 | + <!--表名 --> | ||
| 6 | + <sql id="tableName"> | ||
| 7 | + SV_CACHE | ||
| 8 | + </sql> | ||
| 9 | + | ||
| 10 | + <!-- 字段 --> | ||
| 11 | + <sql id="Field"> | ||
| 12 | + `KEY`, | ||
| 13 | + `CACHE` | ||
| 14 | + </sql> | ||
| 15 | + | ||
| 16 | + <!-- 字段值 --> | ||
| 17 | + <sql id="FieldValue"> | ||
| 18 | + #{KEY}, | ||
| 19 | + #{CACHE} | ||
| 20 | + </sql> | ||
| 21 | + | ||
| 22 | + <!-- 新增--> | ||
| 23 | + <insert id="save" parameterType="pd"> | ||
| 24 | + insert into | ||
| 25 | + <include refid="tableName"></include> | ||
| 26 | + ( | ||
| 27 | + <include refid="Field"></include> | ||
| 28 | + ) values ( | ||
| 29 | + <include refid="FieldValue"></include> | ||
| 30 | + ) | ||
| 31 | + </insert> | ||
| 32 | + | ||
| 33 | + <!-- 删除--> | ||
| 34 | + <delete id="delete" parameterType="pd"> | ||
| 35 | + delete from | ||
| 36 | + <include refid="tableName"></include> | ||
| 37 | + where | ||
| 38 | + `KEY` = #{KEY} | ||
| 39 | + </delete> | ||
| 40 | + | ||
| 41 | + <!-- 通过ID获取数据 --> | ||
| 42 | + <select id="findById" parameterType="pd" resultType="pd"> | ||
| 43 | + select | ||
| 44 | + <include refid="Field"></include> | ||
| 45 | + from | ||
| 46 | + <include refid="tableName"></include> | ||
| 47 | + where | ||
| 48 | + `KEY` = #{KEY} | ||
| 49 | + </select> | ||
| 50 | + | ||
| 51 | + <!-- 列表 --> | ||
| 52 | + <select id="datalistPage" parameterType="page" resultType="pd"> | ||
| 53 | + select | ||
| 54 | + <include refid="Field"></include> | ||
| 55 | + from | ||
| 56 | + <include refid="tableName"></include> | ||
| 57 | + where 1=1 | ||
| 58 | + | ||
| 59 | + </select> | ||
| 60 | + | ||
| 61 | + <!-- 列表(全部) --> | ||
| 62 | + <select id="listAll" parameterType="pd" resultType="pd"> | ||
| 63 | + select | ||
| 64 | + <include refid="Field"></include> | ||
| 65 | + from | ||
| 66 | + <include refid="tableName"></include> | ||
| 67 | + </select> | ||
| 68 | + | ||
| 69 | + <!-- 批量删除 --> | ||
| 70 | + <delete id="deleteAll" parameterType="String"> | ||
| 71 | + delete from | ||
| 72 | + <include refid="tableName"></include> | ||
| 73 | + where | ||
| 74 | + `KEY` in | ||
| 75 | + <foreach item="item" index="index" collection="array" open="(" separator="," close=")"> | ||
| 76 | + #{item} | ||
| 77 | + </foreach> | ||
| 78 | + </delete> | ||
| 79 | + | ||
| 80 | + <!-- fh313596790qq(青苔) --> | ||
| 81 | +</mapper> | ||
| 0 | \ No newline at end of file | 82 | \ No newline at end of file |
resources/mybatis1/sunvote/ChapterMapper.xml
| @@ -101,6 +101,31 @@ | @@ -101,6 +101,31 @@ | ||
| 101 | <include refid="tableName"></include> | 101 | <include refid="tableName"></include> |
| 102 | </select> | 102 | </select> |
| 103 | 103 | ||
| 104 | + <!-- 列表(全部) --> | ||
| 105 | + <select id="listAllChapter" parameterType="pd" resultType="pd"> | ||
| 106 | + select | ||
| 107 | + <include refid="Field"></include> | ||
| 108 | + from | ||
| 109 | + <include refid="tableName"></include> | ||
| 110 | + | ||
| 111 | + where 1 = 1 | ||
| 112 | + | ||
| 113 | + <if test="P_ID != null and P_ID != ''"> | ||
| 114 | + and P_ID = #{P_ID} | ||
| 115 | + </if> | ||
| 116 | + | ||
| 117 | + <if test="P_ID == null or P_ID == ''"> | ||
| 118 | + and P_ID is NULL | ||
| 119 | + </if> | ||
| 120 | + | ||
| 121 | + | ||
| 122 | + <if test="TEACHINGMATERIAL_ID != null and TEACHINGMATERIAL_ID != ''"> | ||
| 123 | + and TEACHINGMATERIAL_ID = #{TEACHINGMATERIAL_ID} | ||
| 124 | + </if> | ||
| 125 | + | ||
| 126 | + order by RANK | ||
| 127 | + </select> | ||
| 128 | + | ||
| 104 | <!-- 批量删除 --> | 129 | <!-- 批量删除 --> |
| 105 | <delete id="deleteAll" parameterType="String"> | 130 | <delete id="deleteAll" parameterType="String"> |
| 106 | delete from | 131 | delete from |
resources/mybatis1/sunvote/KnowledgeMapper.xml
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | P_ID, | 13 | P_ID, |
| 14 | RANK, | 14 | RANK, |
| 15 | CODE, | 15 | CODE, |
| 16 | + SUBJECT_ID, | ||
| 16 | REMARK, | 17 | REMARK, |
| 17 | KNOWLEDGE_ID | 18 | KNOWLEDGE_ID |
| 18 | </sql> | 19 | </sql> |
| @@ -23,6 +24,7 @@ | @@ -23,6 +24,7 @@ | ||
| 23 | #{P_ID}, | 24 | #{P_ID}, |
| 24 | #{RANK}, | 25 | #{RANK}, |
| 25 | #{CODE}, | 26 | #{CODE}, |
| 27 | + #{SUBJECT_ID}, | ||
| 26 | #{REMARK}, | 28 | #{REMARK}, |
| 27 | #{KNOWLEDGE_ID} | 29 | #{KNOWLEDGE_ID} |
| 28 | </sql> | 30 | </sql> |
| @@ -98,6 +100,33 @@ | @@ -98,6 +100,33 @@ | ||
| 98 | <include refid="tableName"></include> | 100 | <include refid="tableName"></include> |
| 99 | </select> | 101 | </select> |
| 100 | 102 | ||
| 103 | + <!-- 列表(全部) --> | ||
| 104 | + <select id="listAllknowledge" parameterType="pd" resultType="pd"> | ||
| 105 | + select | ||
| 106 | + <include refid="Field"></include> | ||
| 107 | + from | ||
| 108 | + <include refid="tableName"></include> | ||
| 109 | + | ||
| 110 | + where 1 = 1 | ||
| 111 | + | ||
| 112 | + <if test="P_ID != null and P_ID != ''"> | ||
| 113 | + and P_ID = #{P_ID} | ||
| 114 | + </if> | ||
| 115 | + | ||
| 116 | + <if test="P_ID == null or P_ID == ''"> | ||
| 117 | + and P_ID is NULL | ||
| 118 | + </if> | ||
| 119 | + | ||
| 120 | + <if test="SUBJECT_ID != null and SUBJECT_ID != ''"> | ||
| 121 | + and SUBJECT_ID = #{SUBJECT_ID} | ||
| 122 | + </if> | ||
| 123 | + <if test="KNOWLEDGE_FROM != null and KNOWLEDGE_FROM != ''"> | ||
| 124 | + and KNOWLEDGE_FROM = #{KNOWLEDGE_FROM} | ||
| 125 | + </if> | ||
| 126 | + | ||
| 127 | + </select> | ||
| 128 | + | ||
| 129 | + | ||
| 101 | <!-- 批量删除 --> | 130 | <!-- 批量删除 --> |
| 102 | <delete id="deleteAll" parameterType="String"> | 131 | <delete id="deleteAll" parameterType="String"> |
| 103 | delete from | 132 | delete from |
resources/mybatis1/sunvote/QuestionMapper.xml
| @@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
| 28 | USER_ID, | 28 | USER_ID, |
| 29 | CREATE_DATE, | 29 | CREATE_DATE, |
| 30 | REMARK, | 30 | REMARK, |
| 31 | + METHOD, | ||
| 31 | QUESTION_ID | 32 | QUESTION_ID |
| 32 | </sql> | 33 | </sql> |
| 33 | 34 | ||
| @@ -52,6 +53,7 @@ | @@ -52,6 +53,7 @@ | ||
| 52 | #{USER_ID}, | 53 | #{USER_ID}, |
| 53 | #{CREATE_DATE}, | 54 | #{CREATE_DATE}, |
| 54 | #{REMARK}, | 55 | #{REMARK}, |
| 56 | + #{METHOD}, | ||
| 55 | #{QUESTION_ID} | 57 | #{QUESTION_ID} |
| 56 | </sql> | 58 | </sql> |
| 57 | 59 | ||
| @@ -98,6 +100,7 @@ | @@ -98,6 +100,7 @@ | ||
| 98 | USER_ID = #{USER_ID}, | 100 | USER_ID = #{USER_ID}, |
| 99 | CREATE_DATE = #{CREATE_DATE}, | 101 | CREATE_DATE = #{CREATE_DATE}, |
| 100 | REMARK = #{REMARK}, | 102 | REMARK = #{REMARK}, |
| 103 | + METHOD = #{METHOD}, | ||
| 101 | QUESTION_ID = QUESTION_ID | 104 | QUESTION_ID = QUESTION_ID |
| 102 | where | 105 | where |
| 103 | QUESTION_ID = #{QUESTION_ID} | 106 | QUESTION_ID = #{QUESTION_ID} |
| @@ -140,6 +143,96 @@ | @@ -140,6 +143,96 @@ | ||
| 140 | <include refid="tableName"></include> | 143 | <include refid="tableName"></include> |
| 141 | </select> | 144 | </select> |
| 142 | 145 | ||
| 146 | + <!-- 列表(全部) --> | ||
| 147 | + <select id="listAllquestion" parameterType="pd" resultType="pd"> | ||
| 148 | + select | ||
| 149 | + <include refid="Field"></include> | ||
| 150 | + from | ||
| 151 | + <include refid="tableName"></include> | ||
| 152 | + | ||
| 153 | + where 1 =1 | ||
| 154 | + <if test="CHAPTER_IDS != null and CHAPTER_IDS.size() > 0"> | ||
| 155 | + and CHAPTER_ID in | ||
| 156 | + | ||
| 157 | + <foreach item="item" index="index" collection="CHAPTER_IDS" open="(" separator="," close=")"> | ||
| 158 | + #{item} | ||
| 159 | + </foreach> | ||
| 160 | + | ||
| 161 | + </if> | ||
| 162 | + <if test="KNOWLEDGE_IDS != null and KNOWLEDGE_IDS.size() > 0"> | ||
| 163 | + and | ||
| 164 | + <foreach item="item" index="index" collection="KNOWLEDGE_IDS" open="(" separator=" or " close=")"> | ||
| 165 | + FIND_IN_SET(#{item},KNOWLEDGE_ID) | ||
| 166 | + </foreach> | ||
| 167 | + | ||
| 168 | + </if> | ||
| 169 | + <if test="QUESTION_FROM != null and QUESTION_FROM != ''"> | ||
| 170 | + and QUESTION_FROM = #{QUESTION_FROM} | ||
| 171 | + </if> | ||
| 172 | + <if test="USER_ID != null and USER_ID != ''"> | ||
| 173 | + and USER_ID = #{USER_ID} | ||
| 174 | + </if> | ||
| 175 | + <if test="PROBLEM_TYPE != null and PROBLEM_TYPE != ''"> | ||
| 176 | + and PROBLEM_TYPE = #{PROBLEM_TYPE} | ||
| 177 | + </if> | ||
| 178 | + <if test="SUBJECT_ID != null and SUBJECT_ID != ''"> | ||
| 179 | + and SUBJECT_ID = #{SUBJECT_ID} | ||
| 180 | + </if> | ||
| 181 | + | ||
| 182 | + ORDER BY QUESTION_ID | ||
| 183 | + | ||
| 184 | + <if test="COUNT != null and COUNT != ''"> | ||
| 185 | + limit ${COUNT} | ||
| 186 | + </if> | ||
| 187 | + | ||
| 188 | + | ||
| 189 | + </select> | ||
| 190 | + | ||
| 191 | + <!-- 列表(全部) --> | ||
| 192 | + <select id="listAllRandquestion" parameterType="pd" resultType="pd"> | ||
| 193 | + select | ||
| 194 | + <include refid="Field"></include> | ||
| 195 | + from | ||
| 196 | + <include refid="tableName"></include> | ||
| 197 | + | ||
| 198 | + where 1 =1 | ||
| 199 | + <if test="CHAPTER_IDS != null and CHAPTER_IDS.size() > 0"> | ||
| 200 | + and CHAPTER_ID in | ||
| 201 | + | ||
| 202 | + <foreach item="item" index="index" collection="CHAPTER_IDS" open="(" separator="," close=")"> | ||
| 203 | + #{item} | ||
| 204 | + </foreach> | ||
| 205 | + | ||
| 206 | + </if> | ||
| 207 | + <if test="KNOWLEDGE_IDS != null and KNOWLEDGE_IDS.size() > 0"> | ||
| 208 | + and | ||
| 209 | + <foreach item="item" index="index" collection="KNOWLEDGE_IDS" open="(" separator=" or " close=")"> | ||
| 210 | + FIND_IN_SET(#{item},KNOWLEDGE_ID) | ||
| 211 | + </foreach> | ||
| 212 | + | ||
| 213 | + </if> | ||
| 214 | + <if test="QUESTION_FROM != null and QUESTION_FROM != ''"> | ||
| 215 | + and QUESTION_FROM = #{QUESTION_FROM} | ||
| 216 | + </if> | ||
| 217 | + <if test="USER_ID != null and USER_ID != ''"> | ||
| 218 | + and USER_ID = #{USER_ID} | ||
| 219 | + </if> | ||
| 220 | + <if test="PROBLEM_TYPE != null and PROBLEM_TYPE != ''"> | ||
| 221 | + and PROBLEM_TYPE = #{PROBLEM_TYPE} | ||
| 222 | + </if> | ||
| 223 | + <if test="SUBJECT_ID != null and SUBJECT_ID != ''"> | ||
| 224 | + and SUBJECT_ID = #{SUBJECT_ID} | ||
| 225 | + </if> | ||
| 226 | + | ||
| 227 | + ORDER BY rand() | ||
| 228 | + | ||
| 229 | + <if test="COUNT != null and COUNT != ''"> | ||
| 230 | + limit ${COUNT} | ||
| 231 | + </if> | ||
| 232 | + | ||
| 233 | + | ||
| 234 | + </select> | ||
| 235 | + | ||
| 143 | <!-- 批量删除 --> | 236 | <!-- 批量删除 --> |
| 144 | <delete id="deleteAll" parameterType="String"> | 237 | <delete id="deleteAll" parameterType="String"> |
| 145 | delete from | 238 | delete from |
resources/mybatis1/sunvote/TeachingMaterialMapper.xml
| @@ -32,17 +32,10 @@ | @@ -32,17 +32,10 @@ | ||
| 32 | insert into | 32 | insert into |
| 33 | <include refid="tableName"></include> | 33 | <include refid="tableName"></include> |
| 34 | ( | 34 | ( |
| 35 | - NAME, | ||
| 36 | - SUBJECT_ID, | ||
| 37 | - GRADE_ID, | ||
| 38 | - VERSION_CODE, | ||
| 39 | - VERSION_NAME | 35 | + <include refid="Field"></include> |
| 36 | + | ||
| 40 | ) values ( | 37 | ) values ( |
| 41 | - #{NAME}, | ||
| 42 | - #{SUBJECT_ID}, | ||
| 43 | - #{GRADE_ID}, | ||
| 44 | - #{VERSION_CODE}, | ||
| 45 | - #{VERSION_NAME} | 38 | + <include refid="FieldValue"></include> |
| 46 | ) | 39 | ) |
| 47 | </insert> | 40 | </insert> |
| 48 | 41 |
src/com/fh/bean/Point.java
0 → 100644
| 1 | +package com.fh.bean; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import com.google.gson.Gson; | ||
| 6 | + | ||
| 7 | +public class Point { | ||
| 8 | + | ||
| 9 | + private String code ; | ||
| 10 | + | ||
| 11 | + private String name; | ||
| 12 | + | ||
| 13 | + private String subjectCode; | ||
| 14 | + | ||
| 15 | + private List<Point> children ; | ||
| 16 | + | ||
| 17 | + public String getCode() { | ||
| 18 | + return code; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public void setCode(String code) { | ||
| 22 | + this.code = code; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public String getName() { | ||
| 26 | + return name; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setName(String name) { | ||
| 30 | + this.name = name; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public List<Point> getChildren() { | ||
| 34 | + return children; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public void setChildren(List<Point> children) { | ||
| 38 | + this.children = children; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + public String getSubjectCode() { | ||
| 44 | + return subjectCode; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setSubjectCode(String subjectCode) { | ||
| 48 | + this.subjectCode = subjectCode; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public static Point parse(String json){ | ||
| 52 | + Gson gson = new Gson(); | ||
| 53 | + return gson.fromJson(json, Point.class); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public String toJson(){ | ||
| 57 | + Gson gson = new Gson(); | ||
| 58 | + return gson.toJson(this); | ||
| 59 | + } | ||
| 60 | +} |
src/com/fh/controller/api/ResponseGson.java
| 1 | package com.fh.controller.api; | 1 | package com.fh.controller.api; |
| 2 | 2 | ||
| 3 | +import java.lang.reflect.ParameterizedType; | ||
| 4 | +import java.lang.reflect.Type; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +import com.fh.bean.Point; | ||
| 3 | import com.google.gson.Gson; | 8 | import com.google.gson.Gson; |
| 9 | +import com.google.gson.GsonBuilder; | ||
| 10 | +import com.google.gson.reflect.TypeToken; | ||
| 4 | 11 | ||
| 5 | public class ResponseGson<T> { | 12 | public class ResponseGson<T> { |
| 6 | 13 | ||
| @@ -8,7 +15,7 @@ public class ResponseGson<T> { | @@ -8,7 +15,7 @@ public class ResponseGson<T> { | ||
| 8 | 15 | ||
| 9 | private String message = "success"; | 16 | private String message = "success"; |
| 10 | 17 | ||
| 11 | - private Object data; | 18 | + private T data; |
| 12 | 19 | ||
| 13 | public String getCode() { | 20 | public String getCode() { |
| 14 | return code; | 21 | return code; |
| @@ -26,7 +33,7 @@ public class ResponseGson<T> { | @@ -26,7 +33,7 @@ public class ResponseGson<T> { | ||
| 26 | this.message = message; | 33 | this.message = message; |
| 27 | } | 34 | } |
| 28 | 35 | ||
| 29 | - public Object getData() { | 36 | + public T getData() { |
| 30 | return data; | 37 | return data; |
| 31 | } | 38 | } |
| 32 | 39 | ||
| @@ -35,10 +42,7 @@ public class ResponseGson<T> { | @@ -35,10 +42,7 @@ public class ResponseGson<T> { | ||
| 35 | } | 42 | } |
| 36 | 43 | ||
| 37 | public String toJson(){ | 44 | public String toJson(){ |
| 38 | - if(data == null){ | ||
| 39 | - data = new Object(); | ||
| 40 | - } | ||
| 41 | - Gson gson = new Gson(); | 45 | + Gson gson = new GsonBuilder().serializeNulls().create(); |
| 42 | return gson.toJson(this); | 46 | return gson.toJson(this); |
| 43 | } | 47 | } |
| 44 | 48 | ||
| @@ -48,6 +52,39 @@ public class ResponseGson<T> { | @@ -48,6 +52,39 @@ public class ResponseGson<T> { | ||
| 48 | + ", data=" + data + "]"; | 52 | + ", data=" + data + "]"; |
| 49 | } | 53 | } |
| 50 | 54 | ||
| 55 | + public static <T> ResponseGson<T> parse(String json) { | ||
| 56 | + Gson gson = new Gson(); | ||
| 57 | + Type objectType = new TypeToken<ResponseGson<T>>() {}.getType(); | ||
| 58 | + return gson.fromJson(json, objectType); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public static <T> ResponseGson<T> parse(String json,Class clazz) { | ||
| 62 | + Gson gson = new Gson(); | ||
| 63 | + if(clazz == Point.class){ | ||
| 64 | + Type objectType = new TypeToken<ResponseGson<List<Point>>>() {}.getType(); | ||
| 65 | + return gson.fromJson(json, objectType); | ||
| 66 | + } | ||
| 67 | + return null; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + | ||
| 72 | + static ParameterizedType type(final Class raw, final Type... args) { | ||
| 73 | + return new ParameterizedType() { | ||
| 74 | + public Type getRawType() { | ||
| 75 | + return raw; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public Type[] getActualTypeArguments() { | ||
| 79 | + return args; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public Type getOwnerType() { | ||
| 83 | + return null; | ||
| 84 | + } | ||
| 85 | + }; | ||
| 86 | + } | ||
| 87 | + | ||
| 51 | 88 | ||
| 52 | public void setSuccess(){ | 89 | public void setSuccess(){ |
| 53 | code = "0" ; | 90 | code = "0" ; |
src/com/fh/controller/api/V1.java
| @@ -2,7 +2,9 @@ package com.fh.controller.api; | @@ -2,7 +2,9 @@ package com.fh.controller.api; | ||
| 2 | 2 | ||
| 3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
| 4 | import java.util.Date; | 4 | import java.util.Date; |
| 5 | +import java.util.Iterator; | ||
| 5 | import java.util.List; | 6 | import java.util.List; |
| 7 | +import java.util.Map; | ||
| 6 | 8 | ||
| 7 | import javax.annotation.Resource; | 9 | import javax.annotation.Resource; |
| 8 | import javax.servlet.http.HttpServletRequest; | 10 | import javax.servlet.http.HttpServletRequest; |
| @@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
| 14 | import org.springframework.web.bind.annotation.ResponseBody; | 16 | import org.springframework.web.bind.annotation.ResponseBody; |
| 15 | 17 | ||
| 16 | import com.fh.bean.Paper; | 18 | import com.fh.bean.Paper; |
| 19 | +import com.fh.bean.Point; | ||
| 17 | import com.fh.bean.Question; | 20 | import com.fh.bean.Question; |
| 18 | import com.fh.bean.StudentAnswer; | 21 | import com.fh.bean.StudentAnswer; |
| 19 | import com.fh.bean.TestPaper; | 22 | import com.fh.bean.TestPaper; |
| @@ -27,6 +30,7 @@ import com.fh.service.feedback.problemphenomenon.ProblemPhenomenonManager; | @@ -27,6 +30,7 @@ import com.fh.service.feedback.problemphenomenon.ProblemPhenomenonManager; | ||
| 27 | import com.fh.service.software.softwareversion.SoftwareVersionManager; | 30 | import com.fh.service.software.softwareversion.SoftwareVersionManager; |
| 28 | import com.fh.service.sunvote.attachkeyboard.AttachKeyboardManager; | 31 | import com.fh.service.sunvote.attachkeyboard.AttachKeyboardManager; |
| 29 | import com.fh.service.sunvote.basestation.BasestationManager; | 32 | import com.fh.service.sunvote.basestation.BasestationManager; |
| 33 | +import com.fh.service.sunvote.cache.CacheManager; | ||
| 30 | import com.fh.service.sunvote.chapter.ChapterManager; | 34 | import com.fh.service.sunvote.chapter.ChapterManager; |
| 31 | import com.fh.service.sunvote.classbasetation.ClassBasetationManager; | 35 | import com.fh.service.sunvote.classbasetation.ClassBasetationManager; |
| 32 | import com.fh.service.sunvote.classroster.ClassRosterManager; | 36 | import com.fh.service.sunvote.classroster.ClassRosterManager; |
| @@ -52,10 +56,10 @@ import com.fh.service.sunvote.student.StudentManager; | @@ -52,10 +56,10 @@ import com.fh.service.sunvote.student.StudentManager; | ||
| 52 | import com.fh.service.sunvote.studenttest.StudentTestManager; | 56 | import com.fh.service.sunvote.studenttest.StudentTestManager; |
| 53 | import com.fh.service.sunvote.subject.SubjectManager; | 57 | import com.fh.service.sunvote.subject.SubjectManager; |
| 54 | import com.fh.service.sunvote.teacher.TeacherManager; | 58 | import com.fh.service.sunvote.teacher.TeacherManager; |
| 59 | +import com.fh.service.sunvote.teachingmaterial.TeachingMaterialManager; | ||
| 55 | import com.fh.service.sunvote.testpaper.TestPaperManager; | 60 | import com.fh.service.sunvote.testpaper.TestPaperManager; |
| 56 | import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager; | 61 | import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager; |
| 57 | import com.fh.service.system.user.UserManager; | 62 | import com.fh.service.system.user.UserManager; |
| 58 | -import com.fh.util.Jurisdiction; | ||
| 59 | import com.fh.util.PageData; | 63 | import com.fh.util.PageData; |
| 60 | import com.fh.util.Tools; | 64 | import com.fh.util.Tools; |
| 61 | 65 | ||
| @@ -149,22 +153,28 @@ public class V1 extends BaseController { | @@ -149,22 +153,28 @@ public class V1 extends BaseController { | ||
| 149 | 153 | ||
| 150 | @Resource(name = "v1Service") | 154 | @Resource(name = "v1Service") |
| 151 | private V1Manager v1Service; | 155 | private V1Manager v1Service; |
| 152 | - | ||
| 153 | - @Resource(name="softwareversionService") | 156 | + |
| 157 | + @Resource(name = "softwareversionService") | ||
| 154 | private SoftwareVersionManager softwareversionService; | 158 | private SoftwareVersionManager softwareversionService; |
| 155 | - | ||
| 156 | - @Resource(name="attachkeyboardService") | 159 | + |
| 160 | + @Resource(name = "attachkeyboardService") | ||
| 157 | private AttachKeyboardManager attachkeyboardService; | 161 | private AttachKeyboardManager attachkeyboardService; |
| 158 | - | ||
| 159 | - @Resource(name="networkstatisticsService") | 162 | + |
| 163 | + @Resource(name = "networkstatisticsService") | ||
| 160 | private NetworkStatisticsManager networkstatisticsService; | 164 | private NetworkStatisticsManager networkstatisticsService; |
| 161 | - | ||
| 162 | - @Resource(name="eventService") | 165 | + |
| 166 | + @Resource(name = "eventService") | ||
| 163 | private EventManager eventService; | 167 | private EventManager eventService; |
| 164 | - | ||
| 165 | - @Resource(name="userService") | 168 | + |
| 169 | + @Resource(name = "userService") | ||
| 166 | private UserManager userService; | 170 | private UserManager userService; |
| 167 | 171 | ||
| 172 | + @Resource(name = "teachingmaterialService") | ||
| 173 | + private TeachingMaterialManager teachingmaterialService; | ||
| 174 | + | ||
| 175 | + @Resource(name="cacheService") | ||
| 176 | + private CacheManager cacheService; | ||
| 177 | + | ||
| 168 | @RequestMapping(value = "/login", produces = "application/json;charset=UTF-8") | 178 | @RequestMapping(value = "/login", produces = "application/json;charset=UTF-8") |
| 169 | @ResponseBody | 179 | @ResponseBody |
| 170 | public Object login() throws Exception { | 180 | public Object login() throws Exception { |
| @@ -174,8 +184,9 @@ public class V1 extends BaseController { | @@ -174,8 +184,9 @@ public class V1 extends BaseController { | ||
| 174 | if (!pd.containsKey("ACCOUT")) { | 184 | if (!pd.containsKey("ACCOUT")) { |
| 175 | pd.put("ACCOUT", pd.get("USERNAME")); | 185 | pd.put("ACCOUT", pd.get("USERNAME")); |
| 176 | } | 186 | } |
| 177 | - if (((pd.containsKey("USERNAME") || (pd.containsKey("ACCOUT") && pd.get("ACCOUT") != null)) && pd | ||
| 178 | - .containsKey("PASSWORD")) || pd.containsKey("KEYPAD_ID")) { | 187 | + if (((pd.containsKey("USERNAME") || (pd.containsKey("ACCOUT") && pd |
| 188 | + .get("ACCOUT") != null)) && pd.containsKey("PASSWORD")) | ||
| 189 | + || pd.containsKey("KEYPAD_ID")) { | ||
| 179 | PageData pageData = teacherService.getUserInfo(pd); | 190 | PageData pageData = teacherService.getUserInfo(pd); |
| 180 | if (pageData != null && pageData.getString("ID") != null) { | 191 | if (pageData != null && pageData.getString("ID") != null) { |
| 181 | pageData.put("PASSWORD", "");// 返回参数中不返回密码 | 192 | pageData.put("PASSWORD", "");// 返回参数中不返回密码 |
| @@ -193,19 +204,19 @@ public class V1 extends BaseController { | @@ -193,19 +204,19 @@ public class V1 extends BaseController { | ||
| 193 | pageData.put("subjectList", subjectList); | 204 | pageData.put("subjectList", subjectList); |
| 194 | 205 | ||
| 195 | pageData.remove("SUBJECT_IDS"); | 206 | pageData.remove("SUBJECT_IDS"); |
| 196 | - | 207 | + |
| 197 | PageData eventPd = new PageData(); | 208 | PageData eventPd = new PageData(); |
| 198 | eventPd.put("EVENT_ID", get32UUID()); | 209 | eventPd.put("EVENT_ID", get32UUID()); |
| 199 | eventPd.put("EVENT_NAME", "login"); | 210 | eventPd.put("EVENT_NAME", "login"); |
| 200 | eventPd.put("EVENT_USER", pageData.getString("ID")); | 211 | eventPd.put("EVENT_USER", pageData.getString("ID")); |
| 201 | eventPd.put("EVENT_TYPE", "0"); | 212 | eventPd.put("EVENT_TYPE", "0"); |
| 202 | - eventPd.put("EVENT_START_TIME",Tools.date2Str(new Date())); | ||
| 203 | - if(pd.getString("CLIENT_ID") != null){ | 213 | + eventPd.put("EVENT_START_TIME", Tools.date2Str(new Date())); |
| 214 | + if (pd.getString("CLIENT_ID") != null) { | ||
| 204 | eventPd.put("CLIENT_ID", pd.getString("CLIENT_ID")); | 215 | eventPd.put("CLIENT_ID", pd.getString("CLIENT_ID")); |
| 205 | - }else{ | 216 | + } else { |
| 206 | eventPd.put("CLIENT_ID", "CLIENT"); | 217 | eventPd.put("CLIENT_ID", "CLIENT"); |
| 207 | } | 218 | } |
| 208 | - eventPd.put("EVENT_IP",getRemoteIp()); | 219 | + eventPd.put("EVENT_IP", getRemoteIp()); |
| 209 | eventService.save(eventPd); | 220 | eventService.save(eventPd); |
| 210 | 221 | ||
| 211 | res.setData(pageData); | 222 | res.setData(pageData); |
| @@ -235,23 +246,26 @@ public class V1 extends BaseController { | @@ -235,23 +246,26 @@ public class V1 extends BaseController { | ||
| 235 | List<PageData> studentList = v1Service.getClassStudent(pt); | 246 | List<PageData> studentList = v1Service.getClassStudent(pt); |
| 236 | pageData.put("studentList", studentList); | 247 | pageData.put("studentList", studentList); |
| 237 | pt.put("CLASS_ID", pageData.get("ID")); | 248 | pt.put("CLASS_ID", pageData.get("ID")); |
| 238 | - List<PageData> keyboards = attachkeyboardService.listAllClassId(pt); | 249 | + List<PageData> keyboards = attachkeyboardService |
| 250 | + .listAllClassId(pt); | ||
| 239 | pageData.put("keyboards", keyboards); | 251 | pageData.put("keyboards", keyboards); |
| 240 | res.setData(pageData); | 252 | res.setData(pageData); |
| 241 | } else { | 253 | } else { |
| 242 | res.set2Error(); | 254 | res.set2Error(); |
| 243 | } | 255 | } |
| 244 | - logger.info("class cost time : " + (System.currentTimeMillis() - cur)); | 256 | + logger.info("class cost time : " |
| 257 | + + (System.currentTimeMillis() - cur)); | ||
| 245 | return res.toJson(); | 258 | return res.toJson(); |
| 246 | } else { | 259 | } else { |
| 247 | ResponseGson<List<PageData>> res = new ResponseGson(); | 260 | ResponseGson<List<PageData>> res = new ResponseGson(); |
| 248 | List<PageData> list = sclassService.listAll(pd); | 261 | List<PageData> list = sclassService.listAll(pd); |
| 249 | res.setData(list); | 262 | res.setData(list); |
| 250 | - logger.info("class cost time : " + (System.currentTimeMillis() - cur)); | 263 | + logger.info("class cost time : " |
| 264 | + + (System.currentTimeMillis() - cur)); | ||
| 251 | return res.toJson(); | 265 | return res.toJson(); |
| 252 | } | 266 | } |
| 253 | } | 267 | } |
| 254 | - | 268 | + |
| 255 | @RequestMapping(value = "/questiontype", produces = "application/json;charset=UTF-8") | 269 | @RequestMapping(value = "/questiontype", produces = "application/json;charset=UTF-8") |
| 256 | @ResponseBody | 270 | @ResponseBody |
| 257 | public Object questiontype() throws Exception { | 271 | public Object questiontype() throws Exception { |
| @@ -261,10 +275,11 @@ public class V1 extends BaseController { | @@ -261,10 +275,11 @@ public class V1 extends BaseController { | ||
| 261 | ResponseGson<List<PageData>> res = new ResponseGson(); | 275 | ResponseGson<List<PageData>> res = new ResponseGson(); |
| 262 | List<PageData> list = questiontypeService.listAll(pd); | 276 | List<PageData> list = questiontypeService.listAll(pd); |
| 263 | res.setData(list); | 277 | res.setData(list); |
| 264 | - logger.info("questiontype cost time : " + (System.currentTimeMillis() - cur)); | 278 | + logger.info("questiontype cost time : " |
| 279 | + + (System.currentTimeMillis() - cur)); | ||
| 265 | return res.toJson(); | 280 | return res.toJson(); |
| 266 | } | 281 | } |
| 267 | - | 282 | + |
| 268 | @RequestMapping(value = "/classtype", produces = "application/json;charset=UTF-8") | 283 | @RequestMapping(value = "/classtype", produces = "application/json;charset=UTF-8") |
| 269 | @ResponseBody | 284 | @ResponseBody |
| 270 | public Object classtype() throws Exception { | 285 | public Object classtype() throws Exception { |
| @@ -274,10 +289,11 @@ public class V1 extends BaseController { | @@ -274,10 +289,11 @@ public class V1 extends BaseController { | ||
| 274 | ResponseGson<List<PageData>> res = new ResponseGson(); | 289 | ResponseGson<List<PageData>> res = new ResponseGson(); |
| 275 | List<PageData> list = classtypeService.listAll(pd); | 290 | List<PageData> list = classtypeService.listAll(pd); |
| 276 | res.setData(list); | 291 | res.setData(list); |
| 277 | - logger.info("classtype cost time : " + (System.currentTimeMillis() - cur)); | 292 | + logger.info("classtype cost time : " |
| 293 | + + (System.currentTimeMillis() - cur)); | ||
| 278 | return res.toJson(); | 294 | return res.toJson(); |
| 279 | } | 295 | } |
| 280 | - | 296 | + |
| 281 | @RequestMapping(value = "/grade", produces = "application/json;charset=UTF-8") | 297 | @RequestMapping(value = "/grade", produces = "application/json;charset=UTF-8") |
| 282 | @ResponseBody | 298 | @ResponseBody |
| 283 | public Object grade() throws Exception { | 299 | public Object grade() throws Exception { |
| @@ -295,7 +311,7 @@ public class V1 extends BaseController { | @@ -295,7 +311,7 @@ public class V1 extends BaseController { | ||
| 295 | logger.info("class cost time : " + (System.currentTimeMillis() - cur)); | 311 | logger.info("class cost time : " + (System.currentTimeMillis() - cur)); |
| 296 | return res.toJson(); | 312 | return res.toJson(); |
| 297 | } | 313 | } |
| 298 | - | 314 | + |
| 299 | @RequestMapping(value = "/subject", produces = "application/json;charset=UTF-8") | 315 | @RequestMapping(value = "/subject", produces = "application/json;charset=UTF-8") |
| 300 | @ResponseBody | 316 | @ResponseBody |
| 301 | public Object subject() throws Exception { | 317 | public Object subject() throws Exception { |
| @@ -313,8 +329,6 @@ public class V1 extends BaseController { | @@ -313,8 +329,6 @@ public class V1 extends BaseController { | ||
| 313 | logger.info("subject cost time : " + (System.currentTimeMillis() - cur)); | 329 | logger.info("subject cost time : " + (System.currentTimeMillis() - cur)); |
| 314 | return res.toJson(); | 330 | return res.toJson(); |
| 315 | } | 331 | } |
| 316 | - | ||
| 317 | - | ||
| 318 | 332 | ||
| 319 | @RequestMapping(value = "/keypadscan", produces = "application/json;charset=UTF-8") | 333 | @RequestMapping(value = "/keypadscan", produces = "application/json;charset=UTF-8") |
| 320 | @ResponseBody | 334 | @ResponseBody |
| @@ -333,7 +347,8 @@ public class V1 extends BaseController { | @@ -333,7 +347,8 @@ public class V1 extends BaseController { | ||
| 333 | } catch (Exception ex) { | 347 | } catch (Exception ex) { |
| 334 | res.setDataError(); | 348 | res.setDataError(); |
| 335 | } | 349 | } |
| 336 | - logger.info("keypadScan cost time : " + (System.currentTimeMillis() - cur)); | 350 | + logger.info("keypadScan cost time : " |
| 351 | + + (System.currentTimeMillis() - cur)); | ||
| 337 | return res.toJson(); | 352 | return res.toJson(); |
| 338 | } | 353 | } |
| 339 | 354 | ||
| @@ -418,9 +433,9 @@ public class V1 extends BaseController { | @@ -418,9 +433,9 @@ public class V1 extends BaseController { | ||
| 418 | question.setQuestion_from(qpd | 433 | question.setQuestion_from(qpd |
| 419 | .getString("QUESTION_FROM")); | 434 | .getString("QUESTION_FROM")); |
| 420 | question.setScore(qpd.getString("SCORE")); | 435 | question.setScore(qpd.getString("SCORE")); |
| 421 | - question.setPart_score(qpd | ||
| 422 | - .getString("PART_SCORE")); | ||
| 423 | - question.setQuestionType(qpd.getString("PROBLEM_TYPE_ID")); | 436 | + question.setPart_score(qpd.getString("PART_SCORE")); |
| 437 | + question.setQuestionType(qpd | ||
| 438 | + .getString("PROBLEM_TYPE_ID")); | ||
| 424 | question.setRank(qpd.getString("RANK")); | 439 | question.setRank(qpd.getString("RANK")); |
| 425 | question.setNo_name(qpd.getString("NO_NAME")); | 440 | question.setNo_name(qpd.getString("NO_NAME")); |
| 426 | if ("-1".equals("" + qpd.getString("P_ID"))) { | 441 | if ("-1".equals("" + qpd.getString("P_ID"))) { |
| @@ -449,9 +464,9 @@ public class V1 extends BaseController { | @@ -449,9 +464,9 @@ public class V1 extends BaseController { | ||
| 449 | qq.setQuestion_from(q | 464 | qq.setQuestion_from(q |
| 450 | .getString("QUESTION_FROM")); | 465 | .getString("QUESTION_FROM")); |
| 451 | qq.setScore(q.getString("SCORE")); | 466 | qq.setScore(q.getString("SCORE")); |
| 452 | - qq.setPart_score(q | ||
| 453 | - .getString("PART_SCORE")); | ||
| 454 | - qq.setQuestionType(qpd.getString("PROBLEM_TYPE_ID")); | 467 | + qq.setPart_score(q.getString("PART_SCORE")); |
| 468 | + qq.setQuestionType(qpd | ||
| 469 | + .getString("PROBLEM_TYPE_ID")); | ||
| 455 | qq.setRank(q.getString("RANK")); | 470 | qq.setRank(q.getString("RANK")); |
| 456 | qq.setNo_name(q.getString("NO_NAME")); | 471 | qq.setNo_name(q.getString("NO_NAME")); |
| 457 | question.getQuestions().add(qq); | 472 | question.getQuestions().add(qq); |
| @@ -477,7 +492,8 @@ public class V1 extends BaseController { | @@ -477,7 +492,8 @@ public class V1 extends BaseController { | ||
| 477 | } else { | 492 | } else { |
| 478 | res.setOtherError(); | 493 | res.setOtherError(); |
| 479 | } | 494 | } |
| 480 | - logger.info("paperInfo cost time : " + (System.currentTimeMillis() - cur)); | 495 | + logger.info("paperInfo cost time : " |
| 496 | + + (System.currentTimeMillis() - cur)); | ||
| 481 | return res.toJson(); | 497 | return res.toJson(); |
| 482 | } | 498 | } |
| 483 | 499 | ||
| @@ -488,10 +504,11 @@ public class V1 extends BaseController { | @@ -488,10 +504,11 @@ public class V1 extends BaseController { | ||
| 488 | long cur = System.currentTimeMillis(); | 504 | long cur = System.currentTimeMillis(); |
| 489 | PageData pd = this.getPageData(); | 505 | PageData pd = this.getPageData(); |
| 490 | ResponseGson<PageData> res = new ResponseGson(); | 506 | ResponseGson<PageData> res = new ResponseGson(); |
| 491 | - logger.info("paperquestion cost time : " + (System.currentTimeMillis() - cur)); | 507 | + logger.info("paperquestion cost time : " |
| 508 | + + (System.currentTimeMillis() - cur)); | ||
| 492 | return res.toJson(); | 509 | return res.toJson(); |
| 493 | } | 510 | } |
| 494 | - | 511 | + |
| 495 | @RequestMapping(value = "/question", produces = "application/json;charset=UTF-8") | 512 | @RequestMapping(value = "/question", produces = "application/json;charset=UTF-8") |
| 496 | @ResponseBody | 513 | @ResponseBody |
| 497 | public Object question() throws Exception { | 514 | public Object question() throws Exception { |
| @@ -499,17 +516,18 @@ public class V1 extends BaseController { | @@ -499,17 +516,18 @@ public class V1 extends BaseController { | ||
| 499 | long cur = System.currentTimeMillis(); | 516 | long cur = System.currentTimeMillis(); |
| 500 | PageData pd = this.getPageData(); | 517 | PageData pd = this.getPageData(); |
| 501 | ResponseGson<PageData> res = new ResponseGson(); | 518 | ResponseGson<PageData> res = new ResponseGson(); |
| 502 | - if(pd.containsKey("ID")){ | 519 | + if (pd.containsKey("ID")) { |
| 503 | pd.put("QUESTION_ID", pd.get("ID")); | 520 | pd.put("QUESTION_ID", pd.get("ID")); |
| 504 | PageData data = questionService.findById(pd); | 521 | PageData data = questionService.findById(pd); |
| 505 | res.setData(data); | 522 | res.setData(data); |
| 506 | - }else{ | 523 | + } else { |
| 507 | res.setDataError(); | 524 | res.setDataError(); |
| 508 | } | 525 | } |
| 509 | - logger.info("question cost time : " + (System.currentTimeMillis() - cur)); | 526 | + logger.info("question cost time : " |
| 527 | + + (System.currentTimeMillis() - cur)); | ||
| 510 | return res.toJson(); | 528 | return res.toJson(); |
| 511 | } | 529 | } |
| 512 | - | 530 | + |
| 513 | @RequestMapping(value = "/question/add", produces = "application/json;charset=UTF-8") | 531 | @RequestMapping(value = "/question/add", produces = "application/json;charset=UTF-8") |
| 514 | @ResponseBody | 532 | @ResponseBody |
| 515 | public Object questionAdd() throws Exception { | 533 | public Object questionAdd() throws Exception { |
| @@ -519,10 +537,11 @@ public class V1 extends BaseController { | @@ -519,10 +537,11 @@ public class V1 extends BaseController { | ||
| 519 | ResponseGson<PageData> res = new ResponseGson(); | 537 | ResponseGson<PageData> res = new ResponseGson(); |
| 520 | pd.put("QUESTION_ID", this.get32UUID()); | 538 | pd.put("QUESTION_ID", this.get32UUID()); |
| 521 | questionService.save(pd); | 539 | questionService.save(pd); |
| 522 | - logger.info("questionAdd cost time : " + (System.currentTimeMillis() - cur)); | 540 | + logger.info("questionAdd cost time : " |
| 541 | + + (System.currentTimeMillis() - cur)); | ||
| 523 | return res.toJson(); | 542 | return res.toJson(); |
| 524 | } | 543 | } |
| 525 | - | 544 | + |
| 526 | @RequestMapping(value = "/uploadpaper", produces = "application/json;charset=UTF-8") | 545 | @RequestMapping(value = "/uploadpaper", produces = "application/json;charset=UTF-8") |
| 527 | @ResponseBody | 546 | @ResponseBody |
| 528 | public Object uploadpaper() throws Exception { | 547 | public Object uploadpaper() throws Exception { |
| @@ -552,8 +571,7 @@ public class V1 extends BaseController { | @@ -552,8 +571,7 @@ public class V1 extends BaseController { | ||
| 552 | paperPd.put("CREATE_DATE", Tools.date2Str(new Date())); | 571 | paperPd.put("CREATE_DATE", Tools.date2Str(new Date())); |
| 553 | paperPd.put("MODIFY_DATE", Tools.date2Str(new Date())); | 572 | paperPd.put("MODIFY_DATE", Tools.date2Str(new Date())); |
| 554 | 573 | ||
| 555 | - int questionNum = 0 ; | ||
| 556 | - | 574 | + int questionNum = 0; |
| 557 | 575 | ||
| 558 | List<Question> questions = paper.getQuestions(); | 576 | List<Question> questions = paper.getQuestions(); |
| 559 | if (questions != null) { | 577 | if (questions != null) { |
| @@ -565,12 +583,14 @@ public class V1 extends BaseController { | @@ -565,12 +583,14 @@ public class V1 extends BaseController { | ||
| 565 | && question.getQuestions().size() > 0) { | 583 | && question.getQuestions().size() > 0) { |
| 566 | qPd.put("P_ID", "-1"); | 584 | qPd.put("P_ID", "-1"); |
| 567 | } else { | 585 | } else { |
| 568 | - questionNum ++ ; | 586 | + questionNum++; |
| 569 | qPd.put("P_ID", "0"); | 587 | qPd.put("P_ID", "0"); |
| 570 | } | 588 | } |
| 571 | qPd.put("SUBJECT_ID", paper.getSubject_id()); | 589 | qPd.put("SUBJECT_ID", paper.getSubject_id()); |
| 572 | qPd.put("CHAPTER_ID", question.getChapter_id()); | 590 | qPd.put("CHAPTER_ID", question.getChapter_id()); |
| 573 | - qPd.put("PROBLEM_TYPE_ID", question.getProblem_type_id() == null ? "1" : question.getProblem_type_id()); | 591 | + qPd.put("PROBLEM_TYPE_ID", |
| 592 | + question.getProblem_type_id() == null ? "1" | ||
| 593 | + : question.getProblem_type_id()); | ||
| 574 | qPd.put("TEACHER_ID", paper.getUser_id()); | 594 | qPd.put("TEACHER_ID", paper.getUser_id()); |
| 575 | qPd.put("SCHOOL_ID", schoolID); | 595 | qPd.put("SCHOOL_ID", schoolID); |
| 576 | qPd.put("KNOWLEDGE_ID", question.getKnowledge_id()); | 596 | qPd.put("KNOWLEDGE_ID", question.getKnowledge_id()); |
| @@ -607,7 +627,9 @@ public class V1 extends BaseController { | @@ -607,7 +627,9 @@ public class V1 extends BaseController { | ||
| 607 | cqPd.put("P_ID", questionID); | 627 | cqPd.put("P_ID", questionID); |
| 608 | cqPd.put("SUBJECT_ID", paper.getSubject_id()); | 628 | cqPd.put("SUBJECT_ID", paper.getSubject_id()); |
| 609 | cqPd.put("CHAPTER_ID", q.getChapter_id()); | 629 | cqPd.put("CHAPTER_ID", q.getChapter_id()); |
| 610 | - cqPd.put("PROBLEM_TYPE_ID", question.getProblem_type_id() == null ? "1" : question.getProblem_type_id()); | 630 | + cqPd.put("PROBLEM_TYPE_ID", question |
| 631 | + .getProblem_type_id() == null ? "1" | ||
| 632 | + : question.getProblem_type_id()); | ||
| 611 | cqPd.put("TEACHER_ID", paper.getUser_id()); | 633 | cqPd.put("TEACHER_ID", paper.getUser_id()); |
| 612 | cqPd.put("SCHOOL_ID", schoolID); | 634 | cqPd.put("SCHOOL_ID", schoolID); |
| 613 | cqPd.put("KNOWLEDGE_ID", q.getKnowledge_id()); | 635 | cqPd.put("KNOWLEDGE_ID", q.getKnowledge_id()); |
| @@ -636,7 +658,7 @@ public class V1 extends BaseController { | @@ -636,7 +658,7 @@ public class V1 extends BaseController { | ||
| 636 | cpqPd.put("PAPERQUESTION_ID", this.get32UUID()); | 658 | cpqPd.put("PAPERQUESTION_ID", this.get32UUID()); |
| 637 | 659 | ||
| 638 | paperquestionService.save(cpqPd); | 660 | paperquestionService.save(cpqPd); |
| 639 | - questionNum ++ ; | 661 | + questionNum++; |
| 640 | } | 662 | } |
| 641 | } | 663 | } |
| 642 | } | 664 | } |
| @@ -647,7 +669,37 @@ public class V1 extends BaseController { | @@ -647,7 +669,37 @@ public class V1 extends BaseController { | ||
| 647 | } else { | 669 | } else { |
| 648 | res.setDataError(); | 670 | res.setDataError(); |
| 649 | } | 671 | } |
| 650 | - logger.info("uploadpaper cost time : " + (System.currentTimeMillis() - cur)); | 672 | + logger.info("uploadpaper cost time : " |
| 673 | + + (System.currentTimeMillis() - cur)); | ||
| 674 | + return res.toJson(); | ||
| 675 | + } | ||
| 676 | + | ||
| 677 | + @RequestMapping(value = "/uploadpoint", produces = "application/json;charset=UTF-8") | ||
| 678 | + @ResponseBody | ||
| 679 | + public Object uploadpoint() throws Exception { | ||
| 680 | + event("uploadpoint"); | ||
| 681 | + long cur = System.currentTimeMillis(); | ||
| 682 | + PageData pd = this.getPageData(); | ||
| 683 | + ResponseGson<String> res = new ResponseGson(); | ||
| 684 | + | ||
| 685 | + if (!StringUtils.isEmpty(pd.getJsonString())) { | ||
| 686 | + try { | ||
| 687 | + ResponseGson<List<Point>> req = ResponseGson.parse( | ||
| 688 | + pd.getJsonString(), Point.class); | ||
| 689 | + List<Point> list = req.getData(); | ||
| 690 | + if (list != null && list.size() > 0) { | ||
| 691 | + for (Point point : list) { | ||
| 692 | + savePoint(point, null); | ||
| 693 | + } | ||
| 694 | + } | ||
| 695 | + } catch (Exception e) { | ||
| 696 | + res.setError(); | ||
| 697 | + } | ||
| 698 | + } else { | ||
| 699 | + res.setDataError(); | ||
| 700 | + } | ||
| 701 | + logger.info("uploadpoint cost time : " | ||
| 702 | + + (System.currentTimeMillis() - cur)); | ||
| 651 | return res.toJson(); | 703 | return res.toJson(); |
| 652 | } | 704 | } |
| 653 | 705 | ||
| @@ -747,7 +799,7 @@ public class V1 extends BaseController { | @@ -747,7 +799,7 @@ public class V1 extends BaseController { | ||
| 747 | } | 799 | } |
| 748 | testpaperinfoService.batchSave(testInfoPdList); | 800 | testpaperinfoService.batchSave(testInfoPdList); |
| 749 | } | 801 | } |
| 750 | - }else{ | 802 | + } else { |
| 751 | testPaperId = listData.get(0).getString("TESTPAPER_ID"); | 803 | testPaperId = listData.get(0).getString("TESTPAPER_ID"); |
| 752 | } | 804 | } |
| 753 | res.setData(testPaperId); | 805 | res.setData(testPaperId); |
| @@ -759,13 +811,13 @@ public class V1 extends BaseController { | @@ -759,13 +811,13 @@ public class V1 extends BaseController { | ||
| 759 | } else { | 811 | } else { |
| 760 | res.setDataError(); | 812 | res.setDataError(); |
| 761 | } | 813 | } |
| 762 | - logger.info("uploadtestpaper cost time:" + (System.currentTimeMillis() - cur)); | 814 | + logger.info("uploadtestpaper cost time:" |
| 815 | + + (System.currentTimeMillis() - cur)); | ||
| 763 | 816 | ||
| 764 | return res.toJson(); | 817 | return res.toJson(); |
| 765 | 818 | ||
| 766 | } | 819 | } |
| 767 | - | ||
| 768 | - | 820 | + |
| 769 | // 上传测验成绩 | 821 | // 上传测验成绩 |
| 770 | @RequestMapping(value = "/uploadupdatetestpaper", produces = "application/json;charset=UTF-8") | 822 | @RequestMapping(value = "/uploadupdatetestpaper", produces = "application/json;charset=UTF-8") |
| 771 | @ResponseBody | 823 | @ResponseBody |
| @@ -879,6 +931,74 @@ public class V1 extends BaseController { | @@ -879,6 +931,74 @@ public class V1 extends BaseController { | ||
| 879 | 931 | ||
| 880 | } | 932 | } |
| 881 | 933 | ||
| 934 | + @RequestMapping(value = "/point", produces = "application/json;charset=UTF-8") | ||
| 935 | + @ResponseBody | ||
| 936 | + public Object point() throws Exception { | ||
| 937 | + ResponseGson<List<PageData>> res = new ResponseGson(); | ||
| 938 | + | ||
| 939 | + PageData pd = getPageData(); | ||
| 940 | + String key = this.getRequestKey(pd,"point"); | ||
| 941 | + PageData pagedata = new PageData(); | ||
| 942 | + pagedata.put("KEY", key); | ||
| 943 | + if(!"".equals(key.trim())){ | ||
| 944 | + PageData ret = cacheService.findById(pagedata); | ||
| 945 | + if(ret != null && ret.get("CACHE") != null){ | ||
| 946 | + return ret.get("CACHE"); | ||
| 947 | + } | ||
| 948 | + } | ||
| 949 | + List<PageData> list = knowledgeService.listAllknowledge(pd); | ||
| 950 | + String depth = pd.getString("DEPTH"); | ||
| 951 | + int end = 3 ; | ||
| 952 | + if(depth != null){ | ||
| 953 | + try{ | ||
| 954 | + end = Integer.parseInt(depth); | ||
| 955 | + }catch(Exception e){ | ||
| 956 | + | ||
| 957 | + } | ||
| 958 | + } | ||
| 959 | + roundPointData(list,1,end); | ||
| 960 | + res.setData(list); | ||
| 961 | + String str = res.toJson(); | ||
| 962 | + str = str.replaceAll("[^\\u0000-\\uFFFF]", ""); | ||
| 963 | + pagedata.put("CACHE", str); | ||
| 964 | + cacheService.save(pagedata); | ||
| 965 | + return str; | ||
| 966 | + } | ||
| 967 | + | ||
| 968 | + private void roundPointData(List<PageData> list,int dept , int end) throws Exception { | ||
| 969 | + if (list != null) { | ||
| 970 | + for (PageData pd : list) { | ||
| 971 | + pd.put("P_ID", pd.getString("KNOWLEDGE_ID")); | ||
| 972 | + if (pd.getString("P_ID") != null | ||
| 973 | + && !"".equals(pd.getString("P_ID")) && dept < end) { | ||
| 974 | + List<PageData> ret = knowledgeService.listAllknowledge(pd); | ||
| 975 | + if (ret != null && ret.size() > 0) { | ||
| 976 | + roundPointData(ret,dept + 1,end); | ||
| 977 | + pd.put("CHILDREN", ret); | ||
| 978 | + } | ||
| 979 | + } | ||
| 980 | + pd.remove("P_ID"); | ||
| 981 | + } | ||
| 982 | + } | ||
| 983 | + } | ||
| 984 | + | ||
| 985 | + private void roundChapterData(List<PageData> list,int dept,int end) throws Exception { | ||
| 986 | + if (list != null && dept < end) { | ||
| 987 | + for (PageData pd : list) { | ||
| 988 | + pd.put("P_ID", pd.getString("ID")); | ||
| 989 | + if (pd.getString("P_ID") != null | ||
| 990 | + && !"".equals(pd.getString("P_ID"))) { | ||
| 991 | + List<PageData> ret = chapterService.listAllChapter(pd); | ||
| 992 | + if (ret != null && ret.size() > 0) { | ||
| 993 | + roundChapterData(ret,dept+1,end); | ||
| 994 | + pd.put("CHILDREN", ret); | ||
| 995 | + } | ||
| 996 | + } | ||
| 997 | + pd.remove("P_ID"); | ||
| 998 | + } | ||
| 999 | + } | ||
| 1000 | + } | ||
| 1001 | + | ||
| 882 | // 下载测验成绩 | 1002 | // 下载测验成绩 |
| 883 | @RequestMapping(value = "/downloadtestpaper", produces = "application/json;charset=UTF-8") | 1003 | @RequestMapping(value = "/downloadtestpaper", produces = "application/json;charset=UTF-8") |
| 884 | @ResponseBody | 1004 | @ResponseBody |
| @@ -960,7 +1080,8 @@ public class V1 extends BaseController { | @@ -960,7 +1080,8 @@ public class V1 extends BaseController { | ||
| 960 | res.setError(); | 1080 | res.setError(); |
| 961 | } | 1081 | } |
| 962 | } | 1082 | } |
| 963 | - logger.info("downloadtestpaper cost time:" + (System.currentTimeMillis() - cur)); | 1083 | + logger.info("downloadtestpaper cost time:" |
| 1084 | + + (System.currentTimeMillis() - cur)); | ||
| 964 | return res.toJson(); | 1085 | return res.toJson(); |
| 965 | 1086 | ||
| 966 | } | 1087 | } |
| @@ -1006,20 +1127,18 @@ public class V1 extends BaseController { | @@ -1006,20 +1127,18 @@ public class V1 extends BaseController { | ||
| 1006 | return res.toJson(); | 1127 | return res.toJson(); |
| 1007 | 1128 | ||
| 1008 | } | 1129 | } |
| 1009 | - | ||
| 1010 | - | 1130 | + |
| 1011 | @RequestMapping(value = "/schooladmin", produces = "application/json;charset=UTF-8") | 1131 | @RequestMapping(value = "/schooladmin", produces = "application/json;charset=UTF-8") |
| 1012 | @ResponseBody | 1132 | @ResponseBody |
| 1013 | - public void schoolAdmin(){ | 1133 | + public void schoolAdmin() { |
| 1014 | event("schoolAdmin"); | 1134 | event("schoolAdmin"); |
| 1015 | PageData pd = this.getPageData(); | 1135 | PageData pd = this.getPageData(); |
| 1016 | this.getUserID(); | 1136 | this.getUserID(); |
| 1017 | } | 1137 | } |
| 1018 | - | ||
| 1019 | - | 1138 | + |
| 1020 | @RequestMapping(value = "/network", produces = "application/json;charset=UTF-8") | 1139 | @RequestMapping(value = "/network", produces = "application/json;charset=UTF-8") |
| 1021 | @ResponseBody | 1140 | @ResponseBody |
| 1022 | - public Object network() throws Exception{ | 1141 | + public Object network() throws Exception { |
| 1023 | event("network"); | 1142 | event("network"); |
| 1024 | PageData pd = this.getPageData(); | 1143 | PageData pd = this.getPageData(); |
| 1025 | ResponseGson<PageData> res = new ResponseGson(); | 1144 | ResponseGson<PageData> res = new ResponseGson(); |
| @@ -1033,7 +1152,7 @@ public class V1 extends BaseController { | @@ -1033,7 +1152,7 @@ public class V1 extends BaseController { | ||
| 1033 | .getString("SUCCESS_COUNT")); | 1152 | .getString("SUCCESS_COUNT")); |
| 1034 | spd.put("SUCCESS_COUNT", ++successCount + ""); | 1153 | spd.put("SUCCESS_COUNT", ++successCount + ""); |
| 1035 | int fail = seq - successCount; | 1154 | int fail = seq - successCount; |
| 1036 | - if(fail < 0 ){ | 1155 | + if (fail < 0) { |
| 1037 | fail = 0; | 1156 | fail = 0; |
| 1038 | } | 1157 | } |
| 1039 | spd.put("FAIL_COUNT", fail + ""); | 1158 | spd.put("FAIL_COUNT", fail + ""); |
| @@ -1047,7 +1166,7 @@ public class V1 extends BaseController { | @@ -1047,7 +1166,7 @@ public class V1 extends BaseController { | ||
| 1047 | pd.put("SUCCESS_COUNT", "1"); | 1166 | pd.put("SUCCESS_COUNT", "1"); |
| 1048 | pd.put("CLIENT_IP", getRemoteIp()); | 1167 | pd.put("CLIENT_IP", getRemoteIp()); |
| 1049 | int fail = seq - 1; | 1168 | int fail = seq - 1; |
| 1050 | - if(fail < 0 ){ | 1169 | + if (fail < 0) { |
| 1051 | fail = 0; | 1170 | fail = 0; |
| 1052 | } | 1171 | } |
| 1053 | pd.put("FAIL_COUNT", fail + ""); | 1172 | pd.put("FAIL_COUNT", fail + ""); |
| @@ -1059,14 +1178,13 @@ public class V1 extends BaseController { | @@ -1059,14 +1178,13 @@ public class V1 extends BaseController { | ||
| 1059 | pd.remove("NETWORKSTATISTICS_ID"); | 1178 | pd.remove("NETWORKSTATISTICS_ID"); |
| 1060 | res.setData(pd); | 1179 | res.setData(pd); |
| 1061 | } | 1180 | } |
| 1062 | - }else{ | 1181 | + } else { |
| 1063 | res.setDataError(); | 1182 | res.setDataError(); |
| 1064 | } | 1183 | } |
| 1065 | return res.toJson(); | 1184 | return res.toJson(); |
| 1066 | } | 1185 | } |
| 1067 | - | ||
| 1068 | - | ||
| 1069 | - public String getRemoteIp(){ | 1186 | + |
| 1187 | + public String getRemoteIp() { | ||
| 1070 | HttpServletRequest request = getRequest(); | 1188 | HttpServletRequest request = getRequest(); |
| 1071 | String ip = ""; | 1189 | String ip = ""; |
| 1072 | if (request.getHeader("x-forwarded-for") == null) { | 1190 | if (request.getHeader("x-forwarded-for") == null) { |
| @@ -1076,70 +1194,264 @@ public class V1 extends BaseController { | @@ -1076,70 +1194,264 @@ public class V1 extends BaseController { | ||
| 1076 | } | 1194 | } |
| 1077 | return ip; | 1195 | return ip; |
| 1078 | } | 1196 | } |
| 1079 | - | 1197 | + |
| 1080 | @RequestMapping(value = "/newversion", produces = "application/json;charset=UTF-8") | 1198 | @RequestMapping(value = "/newversion", produces = "application/json;charset=UTF-8") |
| 1081 | @ResponseBody | 1199 | @ResponseBody |
| 1082 | - public Object getNewVersion(HttpServletRequest request) throws Exception{ | 1200 | + public Object getNewVersion(HttpServletRequest request) throws Exception { |
| 1083 | event("getNewVersion"); | 1201 | event("getNewVersion"); |
| 1084 | PageData pd = this.getPageData(); | 1202 | PageData pd = this.getPageData(); |
| 1085 | String softId = pd.getString("SOFTID"); | 1203 | String softId = pd.getString("SOFTID"); |
| 1086 | String path = request.getContextPath(); | 1204 | String path = request.getContextPath(); |
| 1087 | - String basePath = request.getScheme() + "://" | ||
| 1088 | - + request.getServerName() + ":" + request.getServerPort() | ||
| 1089 | - + path + "/"; | 1205 | + String basePath = request.getScheme() + "://" + request.getServerName() |
| 1206 | + + ":" + request.getServerPort() + path + "/"; | ||
| 1090 | ResponseGson<PageData> res = new ResponseGson(); | 1207 | ResponseGson<PageData> res = new ResponseGson(); |
| 1091 | - if(softId != null && !"".equals(softId)){ | 1208 | + if (softId != null && !"".equals(softId)) { |
| 1092 | pd.put("SOFTWARE_ID", softId); | 1209 | pd.put("SOFTWARE_ID", softId); |
| 1093 | PageData result = softwareversionService.findNewVersion(pd); | 1210 | PageData result = softwareversionService.findNewVersion(pd); |
| 1094 | - if(result != null){ | 1211 | + if (result != null) { |
| 1095 | result.remove("SOFTWAREVERSION_ID"); | 1212 | result.remove("SOFTWAREVERSION_ID"); |
| 1096 | result.remove("SOFTWARE_ID"); | 1213 | result.remove("SOFTWARE_ID"); |
| 1097 | - result.put("VERSION_PATH",basePath + "uploadFiles/uploadFile/" + result.getString("VERSION_PATH")); | 1214 | + result.put("VERSION_PATH", basePath + "uploadFiles/uploadFile/" |
| 1215 | + + result.getString("VERSION_PATH")); | ||
| 1098 | res.setData(result); | 1216 | res.setData(result); |
| 1099 | - }else{ | 1217 | + } else { |
| 1100 | res.setDataError(); | 1218 | res.setDataError(); |
| 1101 | } | 1219 | } |
| 1102 | - }else{ | 1220 | + } else { |
| 1103 | res.setDataError(); | 1221 | res.setDataError(); |
| 1104 | } | 1222 | } |
| 1105 | return res.toJson(); | 1223 | return res.toJson(); |
| 1106 | } | 1224 | } |
| 1225 | + | ||
| 1226 | + /** | ||
| 1227 | + * 获取教材版本 | ||
| 1228 | + * | ||
| 1229 | + * @return | ||
| 1230 | + * @throws Exception | ||
| 1231 | + */ | ||
| 1232 | + @RequestMapping(value = "/teachingmaterial", produces = "application/json;charset=UTF-8") | ||
| 1233 | + @ResponseBody | ||
| 1234 | + public Object teachingmaterial() throws Exception { | ||
| 1235 | + PageData pd = getPageData(); | ||
| 1236 | + ResponseGson<List<PageData>> ret = new ResponseGson<List<PageData>>(); | ||
| 1237 | + List<PageData> lpd = new ArrayList<PageData>(); | ||
| 1238 | + List<PageData> list = teachingmaterialService.listAll(pd); | ||
| 1239 | + String subjectID = pd.getString("SUBJECT_ID"); | ||
| 1240 | + if (subjectID != null && !"".equals(subjectID)) { | ||
| 1241 | + for (PageData pad : list) { | ||
| 1242 | + String subis = pad.getString("SUBJECT_ID"); | ||
| 1243 | + if (subis != null) { | ||
| 1244 | + String[] subs = subis.split(","); | ||
| 1245 | + if (subs != null) { | ||
| 1246 | + for (String sub : subs) { | ||
| 1247 | + if (subjectID.trim().equals(sub.trim())) { | ||
| 1248 | + pad.remove("SUBJECT_ID"); | ||
| 1249 | + pad.put("VERSION_CODE", pad.getString("VERSION_CODE")); | ||
| 1250 | + lpd.add(pad); | ||
| 1251 | + break; | ||
| 1252 | + } | ||
| 1253 | + } | ||
| 1254 | + } | ||
| 1255 | + } | ||
| 1256 | + } | ||
| 1257 | + } else { | ||
| 1258 | + for (PageData pad : list) { | ||
| 1259 | + pad.remove("SUBJECT_ID"); | ||
| 1260 | + pad.put("VERSION_CODE", pad.getString("VERSION_CODE")); | ||
| 1261 | + lpd.add(pad); | ||
| 1262 | + } | ||
| 1263 | + } | ||
| 1264 | + ret.setData(lpd); | ||
| 1265 | + return ret.toJson(); | ||
| 1266 | + } | ||
| 1267 | + | ||
| 1268 | + /** | ||
| 1269 | + * 获取教材版本 | ||
| 1270 | + * | ||
| 1271 | + * @return | ||
| 1272 | + * @throws Exception | ||
| 1273 | + */ | ||
| 1274 | + @RequestMapping(value = "/chapter", produces = "application/json;charset=UTF-8") | ||
| 1275 | + @ResponseBody | ||
| 1276 | + public Object chapter() throws Exception { | ||
| 1277 | + PageData pd = getPageData(); | ||
| 1278 | + String key = this.getRequestKey(pd,"chapter"); | ||
| 1279 | + PageData pagedata = new PageData(); | ||
| 1280 | + pagedata.put("KEY", key); | ||
| 1281 | + if(!"".equals(key.trim())){ | ||
| 1282 | + PageData ret = cacheService.findById(pagedata); | ||
| 1283 | + if(ret != null && ret.get("CACHE") != null){ | ||
| 1284 | + return ret.get("CACHE"); | ||
| 1285 | + } | ||
| 1286 | + } | ||
| 1287 | + ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>(); | ||
| 1288 | + List<PageData> list = chapterService.listAllChapter(pd); | ||
| 1289 | + String depth = pd.getString("DEPTH"); | ||
| 1290 | + int end = 3 ; | ||
| 1291 | + if(depth != null){ | ||
| 1292 | + try{ | ||
| 1293 | + end = Integer.parseInt(depth); | ||
| 1294 | + }catch(Exception e){ | ||
| 1295 | + | ||
| 1296 | + } | ||
| 1297 | + } | ||
| 1298 | + roundChapterData(list,1,end); | ||
| 1299 | + res.setData(list); | ||
| 1300 | + String str = res.toJson(); | ||
| 1301 | + str = str.replaceAll("[^\\u0000-\\uFFFF]", ""); | ||
| 1302 | + pagedata.put("CACHE", str); | ||
| 1303 | + cacheService.save(pagedata); | ||
| 1304 | + return str; | ||
| 1305 | + } | ||
| 1306 | + | ||
| 1307 | + /** | ||
| 1308 | + * 获取试题 | ||
| 1309 | + * | ||
| 1310 | + * @return | ||
| 1311 | + * @throws Exception | ||
| 1312 | + */ | ||
| 1313 | + @RequestMapping(value = "/questions", produces = "application/json;charset=UTF-8") | ||
| 1314 | + @ResponseBody | ||
| 1315 | + public Object questions() throws Exception { | ||
| 1316 | + PageData pd = getPageData(); | ||
| 1317 | + ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>(); | ||
| 1318 | + String teachingmaterialId = pd.getString("TEACHINGMATERIAL_ID"); | ||
| 1319 | + String chapterId = pd.getString("CHAPTER_ID"); | ||
| 1320 | + if(teachingmaterialId != null && !teachingmaterialId.equals("") && chapterId == null){ | ||
| 1321 | + PageData chapterPd = new PageData(); | ||
| 1322 | + chapterPd.put("TEACHINGMATERIAL_ID", teachingmaterialId); | ||
| 1323 | + List<PageData> chapterList = chapterService.listAllChapter(chapterPd); | ||
| 1324 | + roundChapterData(chapterList, 1, 3); | ||
| 1325 | + List<String> ids = getIds(chapterList,"ID"); | ||
| 1326 | + pd.put("CHAPTER_IDS", ids); | ||
| 1327 | + }else{ | ||
| 1328 | + List<String> ids = new ArrayList<String>(); | ||
| 1329 | + if(chapterId != null && !"".equals(chapterId.trim())){ | ||
| 1330 | + ids.add(chapterId); | ||
| 1331 | + } | ||
| 1332 | + pd.put("CHAPTER_IDS", ids); | ||
| 1333 | + } | ||
| 1334 | + pd.remove("CHAPTER_ID"); | ||
| 1335 | + String knowledge = pd.getString("KNOWLEDGE_ID"); | ||
| 1336 | + if(knowledge != null && !"".equals(knowledge.trim())){ | ||
| 1337 | + PageData knowPd = new PageData(); | ||
| 1338 | + knowPd.put("P_ID", knowledge); | ||
| 1339 | + List<PageData> knowlist = knowledgeService.listAllknowledge(knowPd); | ||
| 1340 | + roundPointData(knowlist, 1, 3); | ||
| 1341 | + List<String> ids = getIds(knowlist,"KNOWLEDGE_ID"); | ||
| 1342 | + ids.add(knowledge); | ||
| 1343 | + pd.put("KNOWLEDGE_IDS",ids); | ||
| 1344 | + pd.remove("KNOWLEDGE_ID"); | ||
| 1345 | + } | ||
| 1346 | + List<PageData> list = questionService.listAllquestion(pd); | ||
| 1347 | + res.setData(list); | ||
| 1348 | + return res.toJson(); | ||
| 1349 | + } | ||
| 1107 | 1350 | ||
| 1351 | + /** | ||
| 1352 | + * 随机获取试题 | ||
| 1353 | + * | ||
| 1354 | + * @return | ||
| 1355 | + * @throws Exception | ||
| 1356 | + */ | ||
| 1357 | + @RequestMapping(value = "/randquestions", produces = "application/json;charset=UTF-8") | ||
| 1358 | + @ResponseBody | ||
| 1359 | + public Object randquestions() throws Exception { | ||
| 1360 | + PageData pd = getPageData(); | ||
| 1361 | + ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>(); | ||
| 1362 | + String teachingmaterialId = pd.getString("TEACHINGMATERIAL_ID"); | ||
| 1363 | + String chapterId = pd.getString("CHAPTER_ID"); | ||
| 1364 | + if(teachingmaterialId != null && !teachingmaterialId.equals("") && chapterId == null){ | ||
| 1365 | + PageData chapterPd = new PageData(); | ||
| 1366 | + chapterPd.put("TEACHINGMATERIAL_ID", teachingmaterialId); | ||
| 1367 | + List<PageData> chapterList = chapterService.listAllChapter(chapterPd); | ||
| 1368 | + roundChapterData(chapterList, 1, 3); | ||
| 1369 | + List<String> ids = getIds(chapterList,"ID"); | ||
| 1370 | + pd.put("CHAPTER_IDS", ids); | ||
| 1371 | + }else{ | ||
| 1372 | + List<String> ids = new ArrayList<String>(); | ||
| 1373 | + if(chapterId != null && !"".equals(chapterId.trim())){ | ||
| 1374 | + ids.add(chapterId); | ||
| 1375 | + } | ||
| 1376 | + pd.put("CHAPTER_IDS", ids); | ||
| 1377 | + } | ||
| 1378 | + pd.remove("CHAPTER_ID"); | ||
| 1379 | + String knowledge = pd.getString("KNOWLEDGE_ID"); | ||
| 1380 | + if(knowledge != null && !"".equals(knowledge.trim())){ | ||
| 1381 | + PageData knowPd = new PageData(); | ||
| 1382 | + knowPd.put("P_ID", knowledge); | ||
| 1383 | + List<PageData> knowlist = knowledgeService.listAllknowledge(knowPd); | ||
| 1384 | + roundPointData(knowlist, 1, 3); | ||
| 1385 | + List<String> ids = getIds(knowlist,"KNOWLEDGE_ID"); | ||
| 1386 | + ids.add(knowledge); | ||
| 1387 | + pd.put("KNOWLEDGE_IDS",ids); | ||
| 1388 | + pd.remove("KNOWLEDGE_ID"); | ||
| 1389 | + } | ||
| 1390 | + List<PageData> list = questionService.listAllRandquestion(pd); | ||
| 1391 | + res.setData(list); | ||
| 1392 | + return res.toJson(); | ||
| 1393 | + } | ||
| 1394 | + | ||
| 1395 | + public List<String> getIds(List<PageData> chapterList,String key){ | ||
| 1396 | + List<String> ids = new ArrayList<String>(); | ||
| 1397 | + if(chapterList != null && chapterList.size() > 0){ | ||
| 1398 | + for(PageData pd : chapterList){ | ||
| 1399 | + String chapterid = pd.getString(key); | ||
| 1400 | + if(chapterid != null && !"".equals(chapterid)){ | ||
| 1401 | + ids.add(chapterid); | ||
| 1402 | + } | ||
| 1403 | + Object obj = pd.get("CHILDREN"); | ||
| 1404 | + if(obj != null && (obj instanceof List)){ | ||
| 1405 | + @SuppressWarnings("unchecked") | ||
| 1406 | + List<PageData> list = (List<PageData>)obj ; | ||
| 1407 | + List<String> ret = getIds(list,key); | ||
| 1408 | + if(ret != null && ret.size() > 0){ | ||
| 1409 | + ids.addAll(ret); | ||
| 1410 | + } | ||
| 1411 | + } | ||
| 1412 | + } | ||
| 1413 | + } | ||
| 1414 | + | ||
| 1415 | + return ids; | ||
| 1416 | + | ||
| 1417 | + } | ||
| 1418 | + | ||
| 1108 | @RequestMapping(value = "/tempcreateUser", produces = "application/json;charset=UTF-8") | 1419 | @RequestMapping(value = "/tempcreateUser", produces = "application/json;charset=UTF-8") |
| 1109 | @ResponseBody | 1420 | @ResponseBody |
| 1110 | - public Object tempCreateUser() throws Exception{ | 1421 | + public Object tempCreateUser() throws Exception { |
| 1111 | PageData pd = new PageData(); | 1422 | PageData pd = new PageData(); |
| 1112 | pd = this.getPageData(); | 1423 | pd = this.getPageData(); |
| 1113 | pd.put("ID", this.get32UUID()); | 1424 | pd.put("ID", this.get32UUID()); |
| 1114 | teacherService.save(pd); | 1425 | teacherService.save(pd); |
| 1115 | - pd.put("USER_ID", pd.getString("ID")); //ID 主键 | ||
| 1116 | - pd.put("LAST_LOGIN", ""); //最后登录时间 | ||
| 1117 | - pd.put("IP", ""); //IP | ||
| 1118 | - pd.put("STATUS", "0"); //状态 | 1426 | + pd.put("USER_ID", pd.getString("ID")); // ID 主键 |
| 1427 | + pd.put("LAST_LOGIN", ""); // 最后登录时间 | ||
| 1428 | + pd.put("IP", ""); // IP | ||
| 1429 | + pd.put("STATUS", "0"); // 状态 | ||
| 1119 | pd.put("SKIN", "default"); | 1430 | pd.put("SKIN", "default"); |
| 1120 | - pd.put("RIGHTS", ""); | 1431 | + pd.put("RIGHTS", ""); |
| 1121 | pd.put("USERNAME", pd.getString("ACCOUT")); | 1432 | pd.put("USERNAME", pd.getString("ACCOUT")); |
| 1122 | - pd.put("ROLE_ID", "57bb1e6f138247a0b05cc721a5da1b64"); | ||
| 1123 | - pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("ACCOUT"), pd.getString("PASSWORD")).toString()); //密码加密 | ||
| 1124 | - | ||
| 1125 | - if(null == userService.findByUsername(pd)){ //判断用户名是否存在 | ||
| 1126 | - userService.saveU(pd); //执行保存 | 1433 | + pd.put("ROLE_ID", "57bb1e6f138247a0b05cc721a5da1b64"); |
| 1434 | + pd.put("PASSWORD", | ||
| 1435 | + new SimpleHash("SHA-1", pd.getString("ACCOUT"), pd | ||
| 1436 | + .getString("PASSWORD")).toString()); // 密码加密 | ||
| 1437 | + | ||
| 1438 | + if (null == userService.findByUsername(pd)) { // 判断用户名是否存在 | ||
| 1439 | + userService.saveU(pd); // 执行保存 | ||
| 1127 | } | 1440 | } |
| 1128 | - | ||
| 1129 | - //ID, TEACHER_ID, CLASS_ID, SUBJECT_ID, START_DATE, END_DATE, GRADE_ID, TERM_ID, REMARK | 1441 | + |
| 1442 | + // ID, TEACHER_ID, CLASS_ID, SUBJECT_ID, START_DATE, END_DATE, GRADE_ID, | ||
| 1443 | + // TERM_ID, REMARK | ||
| 1130 | pd.put("TEACHER_ID", pd.get("ID")); | 1444 | pd.put("TEACHER_ID", pd.get("ID")); |
| 1131 | pd.put("CLASS_ID", "bc33389101ec46e6b7d47daa8adf58ac"); | 1445 | pd.put("CLASS_ID", "bc33389101ec46e6b7d47daa8adf58ac"); |
| 1132 | pd.put("SUBJECT_ID", "1"); | 1446 | pd.put("SUBJECT_ID", "1"); |
| 1133 | pd.put("GRADE_ID", "1"); | 1447 | pd.put("GRADE_ID", "1"); |
| 1134 | - pd.put("TERM_ID","0d8ea2efdef74accbd0d00e9bc07dfbb"); | 1448 | + pd.put("TERM_ID", "0d8ea2efdef74accbd0d00e9bc07dfbb"); |
| 1135 | coursemanagementService.save(pd); | 1449 | coursemanagementService.save(pd); |
| 1136 | - | 1450 | + |
| 1137 | return "{'res':'success'}"; | 1451 | return "{'res':'success'}"; |
| 1138 | } | 1452 | } |
| 1139 | - | ||
| 1140 | - | ||
| 1141 | 1453 | ||
| 1142 | - private void event(String apiName){ | 1454 | + private void event(String apiName) { |
| 1143 | PageData eventPd = new PageData(); | 1455 | PageData eventPd = new PageData(); |
| 1144 | eventPd.put("EVENT_ID", get32UUID()); | 1456 | eventPd.put("EVENT_ID", get32UUID()); |
| 1145 | eventPd.put("EVENT_NAME", apiName); | 1457 | eventPd.put("EVENT_NAME", apiName); |
| @@ -1148,11 +1460,218 @@ public class V1 extends BaseController { | @@ -1148,11 +1460,218 @@ public class V1 extends BaseController { | ||
| 1148 | eventPd.put("EVENT_START_TIME", Tools.date2Str(new Date())); | 1460 | eventPd.put("EVENT_START_TIME", Tools.date2Str(new Date())); |
| 1149 | eventPd.put("CLIENT_ID", "SERVER"); | 1461 | eventPd.put("CLIENT_ID", "SERVER"); |
| 1150 | eventPd.put("EVENT_IP", getRemoteIp()); | 1462 | eventPd.put("EVENT_IP", getRemoteIp()); |
| 1151 | - try{ | 1463 | + try { |
| 1152 | eventService.save(eventPd); | 1464 | eventService.save(eventPd); |
| 1153 | - }catch(Exception e){ | ||
| 1154 | - | 1465 | + } catch (Exception e) { |
| 1466 | + | ||
| 1467 | + } | ||
| 1468 | + } | ||
| 1469 | + | ||
| 1470 | + static int index = 0; | ||
| 1471 | + | ||
| 1472 | + private void savePoint(Point point, String pid) { | ||
| 1473 | + List<Point> children = point.getChildren(); | ||
| 1474 | + if (children != null && children.size() > 0) { | ||
| 1475 | + for (Point p : children) { | ||
| 1476 | + savePoint(p, point.getCode()); | ||
| 1477 | + } | ||
| 1478 | + } | ||
| 1479 | + PageData pageData = new PageData(); | ||
| 1480 | + pageData.put("KNOWLEDGE_ID", point.getCode()); | ||
| 1481 | + pageData.put("NAME", point.getName()); | ||
| 1482 | + pageData.put("P_ID", pid); | ||
| 1483 | + pageData.put("RANK", ++index); | ||
| 1484 | + try { | ||
| 1485 | + knowledgeService.save(pageData); | ||
| 1486 | + } catch (Exception e) { | ||
| 1487 | + e.printStackTrace(); | ||
| 1488 | + } | ||
| 1489 | + } | ||
| 1490 | + | ||
| 1491 | + @RequestMapping(value = "/uploadbook", produces = "application/json;charset=UTF-8") | ||
| 1492 | + @ResponseBody | ||
| 1493 | + public Object uploadbook() throws Exception { | ||
| 1494 | + event("uploadbook"); | ||
| 1495 | + long cur = System.currentTimeMillis(); | ||
| 1496 | + PageData pd = this.getPageData(); | ||
| 1497 | + ResponseGson<String> res = new ResponseGson(); | ||
| 1498 | + | ||
| 1499 | + if (!StringUtils.isEmpty(pd.getJsonString())) { | ||
| 1500 | + try { | ||
| 1501 | + ResponseGson<List<Point>> req = ResponseGson.parse( | ||
| 1502 | + pd.getJsonString(), Point.class); | ||
| 1503 | + List<Point> list = req.getData(); | ||
| 1504 | + if (list != null && list.size() > 0) { | ||
| 1505 | + for (Point point : list) { | ||
| 1506 | + saveBook(point); | ||
| 1507 | + } | ||
| 1508 | + } | ||
| 1509 | + } catch (Exception e) { | ||
| 1510 | + res.setError(); | ||
| 1511 | + } | ||
| 1512 | + } else { | ||
| 1513 | + res.setDataError(); | ||
| 1514 | + } | ||
| 1515 | + logger.info("uploadpoint cost time : " | ||
| 1516 | + + (System.currentTimeMillis() - cur)); | ||
| 1517 | + return res.toJson(); | ||
| 1518 | + } | ||
| 1519 | + | ||
| 1520 | + private void saveBook(Point point) { | ||
| 1521 | + | ||
| 1522 | + PageData pd = new PageData(); | ||
| 1523 | + pd.put("ID", point.getCode()); | ||
| 1524 | + pd.put("NAME", point.getName()); | ||
| 1525 | + pd.put("SUBJECT_ID", point.getSubjectCode()); | ||
| 1526 | + try { | ||
| 1527 | + teachingmaterialService.save(pd); | ||
| 1528 | + } catch (Exception e) { | ||
| 1529 | + // TODO Auto-generated catch block | ||
| 1530 | + e.printStackTrace(); | ||
| 1531 | + } | ||
| 1532 | + } | ||
| 1533 | + | ||
| 1534 | + | ||
| 1535 | + @RequestMapping(value = "/uploadyuncelianquestion", produces = "application/json;charset=UTF-8") | ||
| 1536 | + @ResponseBody | ||
| 1537 | + public Object uploadyuncelianquestion() throws Exception { | ||
| 1538 | + event("uploadyuncelianquestion"); | ||
| 1539 | + long cur = System.currentTimeMillis(); | ||
| 1540 | + PageData pd = this.getPageData(); | ||
| 1541 | + ResponseGson<Object> res = new ResponseGson(); | ||
| 1542 | + | ||
| 1543 | + if (!StringUtils.isEmpty(pd.getJsonString())) { | ||
| 1544 | + try { | ||
| 1545 | + ResponseGson<Object> req = ResponseGson.parse( | ||
| 1546 | + pd.getJsonString()); | ||
| 1547 | + Object data = req.getData(); | ||
| 1548 | + if(data instanceof List){ | ||
| 1549 | + List<Object> list = (List)data; | ||
| 1550 | + for(Object obj : list){ | ||
| 1551 | + if(obj instanceof Map){ | ||
| 1552 | + Map map = (Map)obj; | ||
| 1553 | + | ||
| 1554 | + PageData pageData = new PageData(); | ||
| 1555 | + pageData.put("QUESTION_ID", map.get("id")); | ||
| 1556 | + Object cateObj = map.get("cate"); | ||
| 1557 | + if(cateObj != null){ | ||
| 1558 | + String cate = cateObj.toString(); | ||
| 1559 | + float catef = Float.parseFloat(cate); | ||
| 1560 | + pageData.put("QUESTION_TYPE_ID", (int)catef); | ||
| 1561 | + } | ||
| 1562 | + Object contentObj = map.get("content"); | ||
| 1563 | + if(contentObj != null){ | ||
| 1564 | + String content = contentObj.toString(); | ||
| 1565 | + content = replaceWebUrl(content); | ||
| 1566 | + pageData.put("CONTENT", content); | ||
| 1567 | + } | ||
| 1568 | + Object subjectCodeObj = map.get("subjectCode"); | ||
| 1569 | + if(subjectCodeObj != null){ | ||
| 1570 | + String subjectCode = subjectCodeObj.toString(); | ||
| 1571 | + pageData.put("SUBJECT_ID",subjectCode); | ||
| 1572 | + } | ||
| 1573 | + Object optionsObj = map.get("options"); | ||
| 1574 | + if(optionsObj instanceof List){ | ||
| 1575 | + List ss = (List)optionsObj; | ||
| 1576 | + pageData.put("OPTION_CONTENT", optionsObj.toString()); | ||
| 1577 | + pageData.put("OPTION_NUM", "" + ss.size()); | ||
| 1578 | + } | ||
| 1579 | + Object answersObj = map.get("answers"); | ||
| 1580 | + if(answersObj instanceof List){ | ||
| 1581 | + List answers = (List)answersObj; | ||
| 1582 | + StringBuilder sb = new StringBuilder(); | ||
| 1583 | + for(Object as:answers){ | ||
| 1584 | + sb.append(as.toString()); | ||
| 1585 | + } | ||
| 1586 | + pageData.put("ANSWER", sb.toString()); | ||
| 1587 | + } | ||
| 1588 | + Object difficulty = map.get("difficulty"); | ||
| 1589 | + try{ | ||
| 1590 | + if (difficulty != null) { | ||
| 1591 | + float fdifficulty = Float | ||
| 1592 | + .parseFloat(difficulty.toString()); | ||
| 1593 | + pageData.put("DIFFICULTY", | ||
| 1594 | + (int) fdifficulty); | ||
| 1595 | + } | ||
| 1596 | + }catch(Exception ex){ | ||
| 1597 | + ex.printStackTrace(); | ||
| 1598 | + } | ||
| 1599 | + Object discussObj = map.get("discuss"); | ||
| 1600 | + if(discussObj != null){ | ||
| 1601 | + String discuss = discussObj.toString(); | ||
| 1602 | + discuss = replaceWebUrl(discuss); | ||
| 1603 | + pageData.put("REMARK", discuss); | ||
| 1604 | + } | ||
| 1605 | + Object analyseObj = map.get("analyse"); | ||
| 1606 | + if(analyseObj != null){ | ||
| 1607 | + String analyse = analyseObj.toString(); | ||
| 1608 | + analyse = replaceWebUrl(analyse); | ||
| 1609 | + pageData.put("ANALYSIS", analyse); | ||
| 1610 | + } | ||
| 1611 | + Object methodObj = map.get("method"); | ||
| 1612 | + if(methodObj != null){ | ||
| 1613 | + String method = methodObj.toString(); | ||
| 1614 | + method = replaceWebUrl(method); | ||
| 1615 | + pageData.put("METHOD", method); | ||
| 1616 | + } | ||
| 1617 | + Object points = map.get("points"); | ||
| 1618 | + StringBuilder sb = new StringBuilder(); | ||
| 1619 | + if(points instanceof List){ | ||
| 1620 | + List pointsList = (List)points; | ||
| 1621 | + for(Object pObject : pointsList){ | ||
| 1622 | + if(pObject instanceof Map){ | ||
| 1623 | + Map pMap = (Map)pObject; | ||
| 1624 | + sb.append(pMap.get("code")).append(","); | ||
| 1625 | + } | ||
| 1626 | + } | ||
| 1627 | + | ||
| 1628 | + if(sb.toString().length() > 1){ | ||
| 1629 | + sb.deleteCharAt(sb.length() - 1); | ||
| 1630 | + } | ||
| 1631 | + pageData.put("KNOWLEDGE_ID", sb.toString()); | ||
| 1632 | + } | ||
| 1633 | + pageData.put("QUESTION_FROM", "101"); | ||
| 1634 | + try{ | ||
| 1635 | + questionService.save(pageData); | ||
| 1636 | + }catch(Exception e){ | ||
| 1637 | + logger.error("save fail:" + map.get("id"),e); | ||
| 1638 | + } | ||
| 1639 | + } | ||
| 1640 | + } | ||
| 1641 | + } | ||
| 1642 | + } catch (Exception e) { | ||
| 1643 | + res.setError(); | ||
| 1644 | + } | ||
| 1645 | + } else { | ||
| 1646 | + res.setDataError(); | ||
| 1155 | } | 1647 | } |
| 1648 | + logger.info("uploadyuncelianquestion cost time : " | ||
| 1649 | + + (System.currentTimeMillis() - cur)); | ||
| 1650 | + return res.toJson(); | ||
| 1156 | } | 1651 | } |
| 1652 | + | ||
| 1157 | 1653 | ||
| 1654 | + private String replaceWebUrl(String content){ | ||
| 1655 | + if(content != null){ | ||
| 1656 | + content = content.replaceAll("http://image.yuncelian.com/1/analysis/", "http://image.yuncelian.com/1/analysis/"); | ||
| 1657 | + } | ||
| 1658 | + return content; | ||
| 1659 | + } | ||
| 1660 | + | ||
| 1661 | + | ||
| 1662 | + public String getRequestKey(PageData pd,String methodName){ | ||
| 1663 | + StringBuilder key = new StringBuilder() ; | ||
| 1664 | + key.append(methodName).append("{"); | ||
| 1665 | + if (pd != null) { | ||
| 1666 | + Iterator iterator = pd.keySet().iterator(); | ||
| 1667 | + while (iterator.hasNext()) { | ||
| 1668 | + Object obj = iterator.next(); | ||
| 1669 | + key.append(obj.toString()).append(":") | ||
| 1670 | + .append(pd.get(obj).toString()).append(";"); | ||
| 1671 | + } | ||
| 1672 | + } | ||
| 1673 | + key.append("}"); | ||
| 1674 | + | ||
| 1675 | + return key.toString(); | ||
| 1676 | + } | ||
| 1158 | } | 1677 | } |
src/com/fh/controller/sunvote/Myelfun.java
| @@ -105,13 +105,25 @@ public class Myelfun { | @@ -105,13 +105,25 @@ public class Myelfun { | ||
| 105 | public static String findSubjectCName(String type) throws Exception{ | 105 | public static String findSubjectCName(String type) throws Exception{ |
| 106 | SubjectService subjectService = (SubjectService)SpringBeanFactoryUtils.getBean("subjectService"); | 106 | SubjectService subjectService = (SubjectService)SpringBeanFactoryUtils.getBean("subjectService"); |
| 107 | PageData pageData = new PageData(); | 107 | PageData pageData = new PageData(); |
| 108 | - pageData.put("ID", type); | ||
| 109 | - pageData = subjectService.findById(pageData); | ||
| 110 | - if(pageData != null){ | ||
| 111 | - return pageData.getString("CNAME"); | 108 | + StringBuilder sb = new StringBuilder(); |
| 109 | + if(type.contains(",")){ | ||
| 110 | + String[] types = type.split(","); | ||
| 111 | + for (String t : types) { | ||
| 112 | + pageData.put("ID", t); | ||
| 113 | + pageData = subjectService.findById(pageData); | ||
| 114 | + if (pageData != null) { | ||
| 115 | + sb.append(pageData.getString("CNAME") + "; "); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + sb.delete(sb.length() -3, sb.length()); | ||
| 112 | }else{ | 119 | }else{ |
| 113 | - return "" ; | 120 | + pageData.put("ID", type); |
| 121 | + pageData = subjectService.findById(pageData); | ||
| 122 | + if (pageData != null) { | ||
| 123 | + return pageData.getString("CNAME"); | ||
| 124 | + } | ||
| 114 | } | 125 | } |
| 126 | + return sb.toString() ; | ||
| 115 | } | 127 | } |
| 116 | 128 | ||
| 117 | /** | 129 | /** |
src/com/fh/controller/sunvote/cache/CacheController.java
0 → 100644
| 1 | +package com.fh.controller.sunvote.cache; | ||
| 2 | + | ||
| 3 | +import java.io.PrintWriter; | ||
| 4 | +import java.text.DateFormat; | ||
| 5 | +import java.text.SimpleDateFormat; | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.Date; | ||
| 8 | +import java.util.HashMap; | ||
| 9 | +import java.util.List; | ||
| 10 | +import java.util.Map; | ||
| 11 | +import javax.annotation.Resource; | ||
| 12 | +import org.springframework.beans.propertyeditors.CustomDateEditor; | ||
| 13 | +import org.springframework.stereotype.Controller; | ||
| 14 | +import org.springframework.web.bind.WebDataBinder; | ||
| 15 | +import org.springframework.web.bind.annotation.InitBinder; | ||
| 16 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 17 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 18 | +import org.springframework.web.servlet.ModelAndView; | ||
| 19 | +import com.fh.controller.base.BaseController; | ||
| 20 | +import com.fh.entity.Page; | ||
| 21 | +import com.fh.util.AppUtil; | ||
| 22 | +import com.fh.util.ObjectExcelView; | ||
| 23 | +import com.fh.util.PageData; | ||
| 24 | +import com.fh.util.Jurisdiction; | ||
| 25 | +import com.fh.util.Tools; | ||
| 26 | +import com.fh.service.sunvote.cache.CacheManager; | ||
| 27 | + | ||
| 28 | +/** | ||
| 29 | + * 说明:缓存管理 | ||
| 30 | + * 创建人:FH Q313596790 | ||
| 31 | + * 创建时间:2018-08-08 | ||
| 32 | + */ | ||
| 33 | +@Controller | ||
| 34 | +@RequestMapping(value="/cache") | ||
| 35 | +public class CacheController extends BaseController { | ||
| 36 | + | ||
| 37 | + String menuUrl = "cache/list.do"; //菜单地址(权限用) | ||
| 38 | + @Resource(name="cacheService") | ||
| 39 | + private CacheManager cacheService; | ||
| 40 | + | ||
| 41 | + /**保存 | ||
| 42 | + * @param | ||
| 43 | + * @throws Exception | ||
| 44 | + */ | ||
| 45 | + @RequestMapping(value="/save") | ||
| 46 | + public ModelAndView save() throws Exception{ | ||
| 47 | + logBefore(logger, Jurisdiction.getUsername()+"新增Cache"); | ||
| 48 | + ModelAndView mv = this.getModelAndView(); | ||
| 49 | + PageData pd = new PageData(); | ||
| 50 | + pd = this.getPageData(); | ||
| 51 | + pd.put("KEY", ""); //key | ||
| 52 | + pd.put("CACHE", ""); //cache | ||
| 53 | + cacheService.save(pd); | ||
| 54 | + mv.addObject("msg","success"); | ||
| 55 | + mv.setViewName("save_result"); | ||
| 56 | + return mv; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /**删除 | ||
| 60 | + * @param out | ||
| 61 | + * @throws Exception | ||
| 62 | + */ | ||
| 63 | + @RequestMapping(value="/delete") | ||
| 64 | + public void delete(PrintWriter out) throws Exception{ | ||
| 65 | + logBefore(logger, Jurisdiction.getUsername()+"删除Cache"); | ||
| 66 | + PageData pd = new PageData(); | ||
| 67 | + pd = this.getPageData(); | ||
| 68 | + cacheService.delete(pd); | ||
| 69 | + out.write("success"); | ||
| 70 | + out.close(); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + | ||
| 74 | + | ||
| 75 | +} |
src/com/fh/controller/sunvote/grade/GradeController.java
| @@ -49,6 +49,7 @@ public class GradeController extends BaseController { | @@ -49,6 +49,7 @@ public class GradeController extends BaseController { | ||
| 49 | ModelAndView mv = this.getModelAndView(); | 49 | ModelAndView mv = this.getModelAndView(); |
| 50 | PageData pd = new PageData(); | 50 | PageData pd = new PageData(); |
| 51 | pd = this.getPageData(); | 51 | pd = this.getPageData(); |
| 52 | + pd.put("ID",get32UUID()); | ||
| 52 | gradeService.save(pd); | 53 | gradeService.save(pd); |
| 53 | mv.addObject("msg","success"); | 54 | mv.addObject("msg","success"); |
| 54 | mv.setViewName("save_result"); | 55 | mv.setViewName("save_result"); |
src/com/fh/service/sunvote/cache/CacheManager.java
0 → 100644
| 1 | +package com.fh.service.sunvote.cache; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import com.fh.entity.Page; | ||
| 5 | +import com.fh.util.PageData; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 说明: 缓存管理接口 | ||
| 9 | + * 创建人:FH Q313596790 | ||
| 10 | + * 创建时间:2018-08-08 | ||
| 11 | + * @version | ||
| 12 | + */ | ||
| 13 | +public interface CacheManager{ | ||
| 14 | + | ||
| 15 | + /**新增 | ||
| 16 | + * @param pd | ||
| 17 | + * @throws Exception | ||
| 18 | + */ | ||
| 19 | + public void save(PageData pd)throws Exception; | ||
| 20 | + | ||
| 21 | + /**删除 | ||
| 22 | + * @param pd | ||
| 23 | + * @throws Exception | ||
| 24 | + */ | ||
| 25 | + public void delete(PageData pd)throws Exception; | ||
| 26 | + | ||
| 27 | + /**修改 | ||
| 28 | + * @param pd | ||
| 29 | + * @throws Exception | ||
| 30 | + */ | ||
| 31 | + public void edit(PageData pd)throws Exception; | ||
| 32 | + | ||
| 33 | + /**列表 | ||
| 34 | + * @param page | ||
| 35 | + * @throws Exception | ||
| 36 | + */ | ||
| 37 | + public List<PageData> list(Page page)throws Exception; | ||
| 38 | + | ||
| 39 | + /**列表(全部) | ||
| 40 | + * @param pd | ||
| 41 | + * @throws Exception | ||
| 42 | + */ | ||
| 43 | + public List<PageData> listAll(PageData pd)throws Exception; | ||
| 44 | + | ||
| 45 | + /**通过id获取数据 | ||
| 46 | + * @param pd | ||
| 47 | + * @throws Exception | ||
| 48 | + */ | ||
| 49 | + public PageData findById(PageData pd)throws Exception; | ||
| 50 | + | ||
| 51 | + /**批量删除 | ||
| 52 | + * @param ArrayDATA_IDS | ||
| 53 | + * @throws Exception | ||
| 54 | + */ | ||
| 55 | + public void deleteAll(String[] ArrayDATA_IDS)throws Exception; | ||
| 56 | + | ||
| 57 | +} | ||
| 58 | + |
src/com/fh/service/sunvote/cache/impl/CacheService.java
0 → 100644
| 1 | +package com.fh.service.sunvote.cache.impl; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import javax.annotation.Resource; | ||
| 5 | +import org.springframework.stereotype.Service; | ||
| 6 | +import com.fh.dao.DaoSupport; | ||
| 7 | +import com.fh.entity.Page; | ||
| 8 | +import com.fh.util.PageData; | ||
| 9 | +import com.fh.service.sunvote.cache.CacheManager; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 说明: 缓存管理 | ||
| 13 | + * 创建人:FH Q313596790 | ||
| 14 | + * 创建时间:2018-08-08 | ||
| 15 | + * @version | ||
| 16 | + */ | ||
| 17 | +@Service("cacheService") | ||
| 18 | +public class CacheService implements CacheManager{ | ||
| 19 | + | ||
| 20 | + @Resource(name = "daoSupport") | ||
| 21 | + private DaoSupport dao; | ||
| 22 | + | ||
| 23 | + /**新增 | ||
| 24 | + * @param pd | ||
| 25 | + * @throws Exception | ||
| 26 | + */ | ||
| 27 | + public void save(PageData pd)throws Exception{ | ||
| 28 | + dao.save("CacheMapper.save", pd); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /**删除 | ||
| 32 | + * @param pd | ||
| 33 | + * @throws Exception | ||
| 34 | + */ | ||
| 35 | + public void delete(PageData pd)throws Exception{ | ||
| 36 | + dao.delete("CacheMapper.delete", pd); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /**修改 | ||
| 40 | + * @param pd | ||
| 41 | + * @throws Exception | ||
| 42 | + */ | ||
| 43 | + public void edit(PageData pd)throws Exception{ | ||
| 44 | + dao.update("CacheMapper.edit", pd); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /**列表 | ||
| 48 | + * @param page | ||
| 49 | + * @throws Exception | ||
| 50 | + */ | ||
| 51 | + @SuppressWarnings("unchecked") | ||
| 52 | + public List<PageData> list(Page page)throws Exception{ | ||
| 53 | + return (List<PageData>)dao.findForList("CacheMapper.datalistPage", page); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /**列表(全部) | ||
| 57 | + * @param pd | ||
| 58 | + * @throws Exception | ||
| 59 | + */ | ||
| 60 | + @SuppressWarnings("unchecked") | ||
| 61 | + public List<PageData> listAll(PageData pd)throws Exception{ | ||
| 62 | + return (List<PageData>)dao.findForList("CacheMapper.listAll", pd); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /**通过id获取数据 | ||
| 66 | + * @param pd | ||
| 67 | + * @throws Exception | ||
| 68 | + */ | ||
| 69 | + public PageData findById(PageData pd)throws Exception{ | ||
| 70 | + return (PageData)dao.findForObject("CacheMapper.findById", pd); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /**批量删除 | ||
| 74 | + * @param ArrayDATA_IDS | ||
| 75 | + * @throws Exception | ||
| 76 | + */ | ||
| 77 | + public void deleteAll(String[] ArrayDATA_IDS)throws Exception{ | ||
| 78 | + dao.delete("CacheMapper.deleteAll", ArrayDATA_IDS); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | +} | ||
| 82 | + |
src/com/fh/service/sunvote/chapter/ChapterManager.java
| 1 | package com.fh.service.sunvote.chapter; | 1 | package com.fh.service.sunvote.chapter; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 4 | import com.fh.entity.Page; | 5 | import com.fh.entity.Page; |
| 5 | import com.fh.util.PageData; | 6 | import com.fh.util.PageData; |
| 6 | 7 | ||
| @@ -54,5 +55,8 @@ public interface ChapterManager{ | @@ -54,5 +55,8 @@ public interface ChapterManager{ | ||
| 54 | */ | 55 | */ |
| 55 | public void deleteAll(String[] ArrayDATA_IDS)throws Exception; | 56 | public void deleteAll(String[] ArrayDATA_IDS)throws Exception; |
| 56 | 57 | ||
| 58 | + | ||
| 59 | + public List<PageData> listAllChapter(PageData pd)throws Exception; | ||
| 60 | + | ||
| 57 | } | 61 | } |
| 58 | 62 |
src/com/fh/service/sunvote/chapter/impl/ChapterService.java
| @@ -58,6 +58,15 @@ public class ChapterService implements ChapterManager{ | @@ -58,6 +58,15 @@ public class ChapterService implements ChapterManager{ | ||
| 58 | * @throws Exception | 58 | * @throws Exception |
| 59 | */ | 59 | */ |
| 60 | @SuppressWarnings("unchecked") | 60 | @SuppressWarnings("unchecked") |
| 61 | + public List<PageData> listAllChapter(PageData pd)throws Exception{ | ||
| 62 | + return (List<PageData>)dao.findForList("ChapterMapper.listAllChapter", pd); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /**列表(全部) | ||
| 66 | + * @param pd | ||
| 67 | + * @throws Exception | ||
| 68 | + */ | ||
| 69 | + @SuppressWarnings("unchecked") | ||
| 61 | public List<PageData> listAll(PageData pd)throws Exception{ | 70 | public List<PageData> listAll(PageData pd)throws Exception{ |
| 62 | return (List<PageData>)dao.findForList("ChapterMapper.listAll", pd); | 71 | return (List<PageData>)dao.findForList("ChapterMapper.listAll", pd); |
| 63 | } | 72 | } |
src/com/fh/service/sunvote/knowledge/KnowledgeManager.java
| 1 | package com.fh.service.sunvote.knowledge; | 1 | package com.fh.service.sunvote.knowledge; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 4 | import com.fh.entity.Page; | 5 | import com.fh.entity.Page; |
| 5 | import com.fh.util.PageData; | 6 | import com.fh.util.PageData; |
| 6 | 7 | ||
| @@ -53,5 +54,13 @@ public interface KnowledgeManager{ | @@ -53,5 +54,13 @@ public interface KnowledgeManager{ | ||
| 53 | */ | 54 | */ |
| 54 | public void deleteAll(String[] ArrayDATA_IDS)throws Exception; | 55 | public void deleteAll(String[] ArrayDATA_IDS)throws Exception; |
| 55 | 56 | ||
| 57 | + /** | ||
| 58 | + * | ||
| 59 | + * @param pd | ||
| 60 | + * @return | ||
| 61 | + * @throws Exception | ||
| 62 | + */ | ||
| 63 | + public List<PageData> listAllknowledge(PageData pd)throws Exception; | ||
| 64 | + | ||
| 56 | } | 65 | } |
| 57 | 66 |
src/com/fh/service/sunvote/knowledge/impl/KnowledgeService.java
| @@ -61,6 +61,15 @@ public class KnowledgeService implements KnowledgeManager{ | @@ -61,6 +61,15 @@ public class KnowledgeService implements KnowledgeManager{ | ||
| 61 | return (List<PageData>)dao.findForList("KnowledgeMapper.listAll", pd); | 61 | return (List<PageData>)dao.findForList("KnowledgeMapper.listAll", pd); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | + /**列表(全部) | ||
| 65 | + * @param pd | ||
| 66 | + * @throws Exception | ||
| 67 | + */ | ||
| 68 | + @SuppressWarnings("unchecked") | ||
| 69 | + public List<PageData> listAllknowledge(PageData pd)throws Exception{ | ||
| 70 | + return (List<PageData>)dao.findForList("KnowledgeMapper.listAllknowledge", pd); | ||
| 71 | + } | ||
| 72 | + | ||
| 64 | /**通过id获取数据 | 73 | /**通过id获取数据 |
| 65 | * @param pd | 74 | * @param pd |
| 66 | * @throws Exception | 75 | * @throws Exception |
src/com/fh/service/sunvote/question/QuestionManager.java
| 1 | package com.fh.service.sunvote.question; | 1 | package com.fh.service.sunvote.question; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 4 | import com.fh.entity.Page; | 5 | import com.fh.entity.Page; |
| 5 | import com.fh.util.PageData; | 6 | import com.fh.util.PageData; |
| 6 | 7 | ||
| @@ -53,5 +54,15 @@ public interface QuestionManager{ | @@ -53,5 +54,15 @@ public interface QuestionManager{ | ||
| 53 | */ | 54 | */ |
| 54 | public void deleteAll(String[] ArrayDATA_IDS)throws Exception; | 55 | public void deleteAll(String[] ArrayDATA_IDS)throws Exception; |
| 55 | 56 | ||
| 57 | + /** | ||
| 58 | + * | ||
| 59 | + * @param pd | ||
| 60 | + * @return | ||
| 61 | + * @throws Exception | ||
| 62 | + */ | ||
| 63 | + public List<PageData> listAllquestion(PageData pd)throws Exception; | ||
| 64 | + | ||
| 65 | + public List<PageData> listAllRandquestion(PageData pd)throws Exception; | ||
| 66 | + | ||
| 56 | } | 67 | } |
| 57 | 68 |
src/com/fh/service/sunvote/question/impl/QuestionService.java
| @@ -60,6 +60,22 @@ public class QuestionService implements QuestionManager{ | @@ -60,6 +60,22 @@ public class QuestionService implements QuestionManager{ | ||
| 60 | public List<PageData> listAll(PageData pd)throws Exception{ | 60 | public List<PageData> listAll(PageData pd)throws Exception{ |
| 61 | return (List<PageData>)dao.findForList("QuestionMapper.listAll", pd); | 61 | return (List<PageData>)dao.findForList("QuestionMapper.listAll", pd); |
| 62 | } | 62 | } |
| 63 | + /**列表(全部) | ||
| 64 | + * @param pd | ||
| 65 | + * @throws Exception | ||
| 66 | + */ | ||
| 67 | + @SuppressWarnings("unchecked") | ||
| 68 | + public List<PageData> listAllquestion(PageData pd)throws Exception{ | ||
| 69 | + return (List<PageData>)dao.findForList("QuestionMapper.listAllquestion", pd); | ||
| 70 | + } | ||
| 71 | + /**列表(全部) | ||
| 72 | + * @param pd | ||
| 73 | + * @throws Exception | ||
| 74 | + */ | ||
| 75 | + @SuppressWarnings("unchecked") | ||
| 76 | + public List<PageData> listAllRandquestion(PageData pd)throws Exception{ | ||
| 77 | + return (List<PageData>)dao.findForList("QuestionMapper.listAllRandquestion", pd); | ||
| 78 | + } | ||
| 63 | 79 | ||
| 64 | /**通过id获取数据 | 80 | /**通过id获取数据 |
| 65 | * @param pd | 81 | * @param pd |