Commit 338594c886548116e4237a91a30e6b973567cdd1

Authored by 孙向锦
1 parent 279ff322

添加教师端页面

.settings/org.eclipse.core.resources.prefs
1 eclipse.preferences.version=1 1 eclipse.preferences.version=1
  2 +encoding//WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp=UTF-8
2 encoding//WebRoot/WEB-INF/jsp/system/appuser/appuser_list.jsp=UTF-8 3 encoding//WebRoot/WEB-INF/jsp/system/appuser/appuser_list.jsp=UTF-8
3 encoding//WebRoot/WEB-INF/jsp/system/fhsms/fhsms_list.jsp=UTF-8 4 encoding//WebRoot/WEB-INF/jsp/system/fhsms/fhsms_list.jsp=UTF-8
4 encoding//WebRoot/WEB-INF/jsp/system/index/head.jsp=UTF-8 5 encoding//WebRoot/WEB-INF/jsp/system/index/head.jsp=UTF-8
WebRoot/WEB-INF/jsp/sunvote/images/head_pic.jpg 0 → 100644

23.8 KB

WebRoot/WEB-INF/jsp/sunvote/paper/paper_edit2.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  3 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  4 +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  8 +%>
  9 +<!DOCTYPE html>
  10 +<html lang="en">
  11 + <head>
  12 + <base href="<%=basePath%>">
  13 + <!-- 下拉框 -->
  14 + <link rel="stylesheet" href="static/ace/css/chosen.css" />
  15 + <!-- jsp文件头和头部 -->
  16 + <%@ include file="../../system/index/top.jsp"%>
  17 + <!-- 日期框 -->
  18 + <link rel="stylesheet" href="static/ace/css/datepicker.css" />
  19 +</head>
  20 +<body class="no-skin">
  21 +<!-- /section:basics/navbar.layout -->
  22 +<div class="main-container" id="main-container">
  23 + <!-- /section:basics/sidebar -->
  24 + <div class="main-content">
  25 + <div class="main-content-inner">
  26 + <div class="page-content">
  27 + <div class="row">
  28 + <div class="col-xs-12">
  29 +
  30 + <form action="paper/${msg }.do" name="Form" id="Form" method="post">
  31 + <input type="hidden" name="PAPER_ID" id="PAPER_ID" value="${pd.PAPER_ID}"/>
  32 + <div id="zhongxin" style="padding-top: 13px;">
  33 + <table id="table_report" class="table table-striped table-bordered table-hover">
  34 + <tr>
  35 + <td style="width:75px;text-align: right;padding-top: 13px;">试卷标题:</td>
  36 + <td><input type="text" name="TITLE" id="TITLE" value="${pd.TITLE}" maxlength="255" placeholder="这里输入试卷标题" title="试卷标题" style="width:98%;"/></td>
  37 + </tr>
  38 + <tr>
  39 + <td style="width:75px;text-align: right;padding-top: 13px;">建议考试时长:</td>
  40 + <td><input type="text" name="EXAM_TIME" id="EXAM_TIME" value="${pd.EXAM_TIME}" maxlength="255" placeholder="这里输入建议考试时长" title="建议考试时长" style="width:98%;"/></td>
  41 + </tr>
  42 + <tr>
  43 + <td style="text-align: center;" colspan="10">
  44 + <a class="btn btn-mini btn-primary" onclick="save();">保存</a>
  45 + <a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
  46 + </td>
  47 + </tr>
  48 + </table>
  49 + </div>
  50 + <div id="zhongxin2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div>
  51 + </form>
  52 + </div>
  53 + <!-- /.col -->
  54 + </div>
  55 + <!-- /.row -->
  56 + </div>
  57 + <!-- /.page-content -->
  58 + </div>
  59 + </div>
  60 + <!-- /.main-content -->
  61 +</div>
  62 +<!-- /.main-container -->
  63 +
  64 +
  65 + <!-- 页面底部js¨ -->
  66 + <%@ include file="../../system/index/foot.jsp"%>
  67 + <!-- 下拉框 -->
  68 + <script src="static/ace/js/chosen.jquery.js"></script>
  69 + <!-- 日期框 -->
  70 + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
  71 + <!--提示框-->
  72 + <script type="text/javascript" src="static/js/jquery.tips.js"></script>
  73 + <script type="text/javascript">
  74 + $(top.hangge());
  75 + //保存
  76 + function save(){
  77 + if($("#TITLE").val()==""){
  78 + $("#TITLE").tips({
  79 + side:3,
  80 + msg:'请输入试卷标题',
  81 + bg:'#AE81FF',
  82 + time:2
  83 + });
  84 + $("#TITLE").focus();
  85 + return false;
  86 + }
  87 +
  88 +
  89 +
  90 + if($("#EXAM_TIME").val()==""){
  91 + $("#EXAM_TIME").tips({
  92 + side:3,
  93 + msg:'请输入建议考试时长',
  94 + bg:'#AE81FF',
  95 + time:2
  96 + });
  97 + $("#EXAM_TIME").focus();
  98 + return false;
  99 + }
  100 +
  101 + $("#Form").submit();
  102 + $("#zhongxin").hide();
  103 + $("#zhongxin2").show();
  104 + }
  105 +
  106 + $(function() {
  107 + //日期框
  108 + $('.date-picker').datepicker({autoclose: true,todayHighlight: true});
  109 + });
  110 + </script>
  111 +</body>
  112 +</html>
0 \ No newline at end of file 113 \ No newline at end of file
WebRoot/WEB-INF/jsp/sunvote/paper/paper_list2.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  3 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme() + "://"
  7 + + request.getServerName() + ":" + request.getServerPort()
  8 + + path + "/";
  9 +%>
  10 +<!DOCTYPE html>
  11 +<html lang="en">
  12 +<head>
  13 +<base href="<%=basePath%>">
  14 +<!-- 下拉框 -->
  15 +<link rel="stylesheet" href="static/ace/css/chosen.css" />
  16 +<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  17 +<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
  18 +<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  19 +<!-- jsp文件头和头部 -->
  20 +<%@ include file="../../system/index/top.jsp"%>
  21 +<!-- 日期框 -->
  22 +<link rel="stylesheet" href="static/ace/css/datepicker.css" />
  23 +</head>
  24 +<body class="no-skin">
  25 +
  26 + <!-- /section:basics/navbar.layout -->
  27 + <div class="main-container" id="main-container">
  28 + <!-- /section:basics/sidebar -->
  29 + <div class="main-content">
  30 + <div class="main-content-inner">
  31 + <div class="page-content">
  32 + <div class="row">
  33 + <div class="col-xs-12">
  34 +
  35 + <!-- 检索 -->
  36 + <form action="paper/list2.do" method="post" name="Form" id="Form">
  37 + <table style="margin-top:5px;">
  38 + <tr>
  39 + <%-- <td>
  40 + <div class="nav-search">
  41 + <span class="input-icon">
  42 + <input type="text" placeholder="这里输入关键词" class="nav-search-input" id="nav-search-input" autocomplete="off" name="keywords" value="${pd.keywords }" placeholder="这里输入关键词"/>
  43 + <i class="ace-icon fa fa-search nav-search-icon"></i>
  44 + </span>
  45 + </div>
  46 + </td> --%>
  47 + <td style="padding-left:2px;"><input class="span10 date-picker" name="lastStart" id="lastStart" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="开始日期" title="开始日期"/></td>
  48 + <td style="padding-left:2px;"><input class="span10 date-picker" name="lastEnd" name="lastEnd" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="结束日期" title="结束日期"/></td>
  49 + <td style="vertical-align:top;padding-left:2px"><a class="btn btn-light btn-xs" onclick="tosearch();" title="检索"><i id="nav-search-icon" class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td>
  50 + <c:if test="${QX.cha == 1 }">
  51 + </c:if>
  52 + <%-- <c:if test="${QX.toExcel == 1 }"><td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="toExcel();" title="导出到EXCEL"><i id="nav-search-icon" class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a></td></c:if>
  53 + --%> </tr>
  54 + </table>
  55 + <!-- 检索 -->
  56 +
  57 + <table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;">
  58 + <thead>
  59 + <tr>
  60 + <th class="center" style="width:35px;">
  61 + <label class="pos-rel"><input type="checkbox" class="ace" id="zcheckbox" /><span class="lbl"></span></label>
  62 + </th>
  63 + <th class="center" style="width:50px;">序号</th>
  64 + <th class="center">测验标题</th>
  65 + <th class="center">创建时间</th>
  66 + <th class="center">建议考试时长</th>
  67 + <th class="center">总分</th>
  68 + <th class="center">操作</th>
  69 + </tr>
  70 + </thead>
  71 +
  72 + <tbody>
  73 + <!-- 开始循环 -->
  74 + <c:choose>
  75 + <c:when test="${not empty varList}">
  76 + <c:forEach items="${varList}" var="var" varStatus="vs">
  77 + <tr>
  78 + <td class='center'>
  79 + <label class="pos-rel"><input type='checkbox' name='ids' value="${var.PAPER_ID}" class="ace" /><span class="lbl"></span></label>
  80 + </td>
  81 + <td class='center' style="width: 30px;">${vs.index+1}</td>
  82 + <td class='center'><a target="_blank" href="<%=basePath%>paper/iteminfo.do?paper_id=${var.PAPER_ID}">${var.TITLE}</a></td>
  83 + <td class='center'>${var.CREATE_DATE}</td>
  84 + <td class='center'>${var.EXAM_TIME}</td>
  85 + <td class='center'>${var.SCORE}</td>
  86 + <td class="center">
  87 + <div >
  88 + <a class="btn btn-xs btn-danger" onclick="del('${var.PAPER_ID}');">
  89 + <i class="ace-icon fa fa-trash-o bigger-120" title="删除"></i>
  90 + </a>
  91 + </div>
  92 + </td>
  93 + </tr>
  94 +
  95 + </c:forEach>
  96 + </c:when>
  97 + <c:otherwise>
  98 + <tr class="main_info">
  99 + <td colspan="100" class="center" >没有相关数据</td>
  100 + </tr>
  101 + </c:otherwise>
  102 + </c:choose>
  103 + </tbody>
  104 + </table>
  105 + <div class="page-header position-relative">
  106 + <table style="width:100%;">
  107 + <tr>
  108 + <td style="vertical-align:top;">
  109 + <a class="btn btn-mini btn-success" onclick="parent.$('.title_time').modal('show');">新建试卷</a>
  110 + <a class="btn btn-mini btn-danger" onclick="makeAll('确定要删除选中的数据吗?');" title="批量删除" ><i class='ace-icon fa fa-trash-o bigger-120'></i></a>
  111 + </td>
  112 + <td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
  113 + </tr>
  114 + </table>
  115 + </div>
  116 + </form>
  117 +
  118 + </div>
  119 + <!-- /.col -->
  120 + </div>
  121 + <!-- /.row -->
  122 + </div>
  123 + <!-- /.page-content -->
  124 + </div>
  125 + </div>
  126 + <!-- /.main-content -->
  127 +
  128 + <!-- 返回顶部 -->
  129 + <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
  130 + <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
  131 + </a>
  132 +
  133 + </div>
  134 +
  135 +
  136 +
  137 + <!-- /.main-container -->
  138 +
  139 + <!-- basic scripts -->
  140 + <!-- 页面底部js¨ -->
  141 + <%@ include file="../../system/index/foot.jsp"%>
  142 + <!-- 删除时确认窗口 -->
  143 + <script src="static/ace/js/bootbox.js"></script>
  144 + <!-- ace scripts -->
  145 + <script src="static/ace/js/ace/ace.js"></script>
  146 + <!-- 下拉框 -->
  147 + <script src="static/ace/js/chosen.jquery.js"></script>
  148 + <!-- 日期框 -->
  149 + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
  150 + <!--提示框-->
  151 + <script type="text/javascript" src="static/js/jquery.tips.js"></script>
  152 + <script type="text/javascript">
  153 + $(top.hangge());//关闭加载状态
  154 + //检索
  155 + function tosearch(){
  156 + top.jzts();
  157 + $("#Form").submit();
  158 + }
  159 + $(function() {
  160 +
  161 + //日期框
  162 + $('.date-picker').datepicker({
  163 + autoclose: true,
  164 + todayHighlight: true
  165 + });
  166 +
  167 + //下拉框
  168 + if(!ace.vars['touch']) {
  169 + $('.chosen-select').chosen({allow_single_deselect:true});
  170 + $(window)
  171 + .off('resize.chosen')
  172 + .on('resize.chosen', function() {
  173 + $('.chosen-select').each(function() {
  174 + var $this = $(this);
  175 + $this.next().css({'width': $this.parent().width()});
  176 + });
  177 + }).trigger('resize.chosen');
  178 + $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
  179 + if(event_name != 'sidebar_collapsed') return;
  180 + $('.chosen-select').each(function() {
  181 + var $this = $(this);
  182 + $this.next().css({'width': $this.parent().width()});
  183 + });
  184 + });
  185 + $('#chosen-multiple-style .btn').on('click', function(e){
  186 + var target = $(this).find('input[type=radio]');
  187 + var which = parseInt(target.val());
  188 + if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
  189 + else $('#form-field-select-4').removeClass('tag-input-style');
  190 + });
  191 + }
  192 +
  193 +
  194 + //复选框全选控制
  195 + var active_class = 'active';
  196 + $('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
  197 + var th_checked = this.checked;//checkbox inside "TH" table header
  198 + $(this).closest('table').find('tbody > tr').each(function(){
  199 + var row = this;
  200 + if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
  201 + else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
  202 + });
  203 + });
  204 + });
  205 +
  206 + //新增
  207 + function add(){
  208 + top.jzts();
  209 + var diag = new top.Dialog();
  210 + diag.Drag=true;
  211 + diag.Title ="新增";
  212 + diag.URL = '<%=basePath%>paper/goAddTest.do';
  213 + diag.Width = 450;
  214 + diag.Height = 355;
  215 + diag.Modal = true; //有无遮罩窗口
  216 + diag. ShowMaxButton = true; //最大化按钮
  217 + diag.ShowMinButton = true; //最小化按钮
  218 + diag.CancelEvent = function(){ //关闭事件
  219 + if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
  220 + if('${page.currentPage}' == '0'){
  221 + tosearch();
  222 + }else{
  223 + tosearch();
  224 + }
  225 + }
  226 + diag.close();
  227 + };
  228 + diag.show();
  229 + }
  230 +
  231 + //删除
  232 + function del(Id){
  233 + bootbox.confirm("确定要删除吗?", function(result) {
  234 + if(result) {
  235 + top.jzts();
  236 + var url = "<%=basePath%>paper/delete.do?PAPER_ID="+Id+"&tm="+new Date().getTime();
  237 + $.get(url,function(data){
  238 + tosearch();
  239 + });
  240 + }
  241 + });
  242 + }
  243 +
  244 + //修改
  245 + function edit(Id){
  246 + top.jzts();
  247 + var diag = new top.Dialog();
  248 + diag.Drag=true;
  249 + diag.Title ="编辑";
  250 + diag.URL = '<%=basePath%>paper/goEdit.do?PAPER_ID='+Id;
  251 + diag.Width = 450;
  252 + diag.Height = 355;
  253 + diag.Modal = true; //有无遮罩窗口
  254 + diag. ShowMaxButton = true; //最大化按钮
  255 + diag.ShowMinButton = true; //最小化按钮
  256 + diag.CancelEvent = function(){ //关闭事件
  257 + if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
  258 + tosearch();
  259 + }
  260 + diag.close();
  261 + };
  262 + diag.show();
  263 + }
  264 +
  265 + //批量操作
  266 + function makeAll(msg){
  267 + bootbox.confirm(msg, function(result) {
  268 + if(result) {
  269 + var str = '';
  270 + for(var i=0;i < document.getElementsByName('ids').length;i++){
  271 + if(document.getElementsByName('ids')[i].checked){
  272 + if(str=='') str += document.getElementsByName('ids')[i].value;
  273 + else str += ',' + document.getElementsByName('ids')[i].value;
  274 + }
  275 + }
  276 + if(str==''){
  277 + bootbox.dialog({
  278 + message: "<span class='bigger-110'>您没有选择任何内容!</span>",
  279 + buttons:
  280 + { "button":{ "label":"确定", "className":"btn-sm btn-success"}}
  281 + });
  282 + $("#zcheckbox").tips({
  283 + side:1,
  284 + msg:'点这里全选',
  285 + bg:'#AE81FF',
  286 + time:8
  287 + });
  288 + return;
  289 + }else{
  290 + if(msg == '确定要删除选中的数据吗?'){
  291 + top.jzts();
  292 + $.ajax({
  293 + type: "POST",
  294 + url: '<%=basePath%>paper/deleteAll.do?tm='+new Date().getTime(),
  295 + data: {DATA_IDS:str},
  296 + dataType:'json',
  297 + //beforeSend: validateData,
  298 + cache: false,
  299 + success: function(data){
  300 + $.each(data.list, function(i, list){
  301 + tosearch();
  302 + });
  303 + }
  304 + });
  305 + }
  306 + }
  307 + }
  308 + });
  309 + };
  310 +
  311 + //导出excel
  312 + function toExcel(){
  313 + window.location.href='<%=basePath%>paper/excel.do';
  314 + }
  315 +
  316 + function click(item){
  317 + window.location.href='<%=basePath%>paper/iteminfo.do?paper_id=' + item ;
  318 + }
  319 + </script>
  320 +
  321 +
  322 +</body>
  323 +</html>
0 \ No newline at end of file 324 \ No newline at end of file
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <title>创建试卷</title>
  5 + <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
  6 + <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  7 + <link rel="stylesheet" href="../static/css/style.css"/>
  8 + <script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
  9 + <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
  10 + <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  11 +</head>
  12 +<body>
  13 + <div class="page-header">
  14 + <div class="header_box container">
  15 + <h1 class="text-center"></h1>
  16 + <div class="btn_group">
  17 + <div class="time text-center" data-toggle="modal" data-target=".test_time"><h3>测验时长:<span class="bg-primary" id="time">45</span><span class="bg-primary">分钟</span></h3></div>
  18 + <div class="btn_box pull-right">
  19 + <input type="button" class="btn btn-success btn-lg" name="save" value="保存" id="save"/>
  20 + <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".fast" id="fast">快速出题</button>
  21 + <!-- <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".addQuestion" id="addQuestion">添加试题</button> -->
  22 + <div class="clearfix"></div>
  23 + </div>
  24 + </div>
  25 + </div>
  26 + </div>
  27 +
  28 + <div class="content container">
  29 + <!--<div class="section section-1">
  30 + <div class="title">
  31 + <h3>一、单选</h3>
  32 + <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" />
  33 + </div>
  34 + <div class="question_list">
  35 + <div class="question question1">
  36 + <span>1、</span>
  37 + <ul>
  38 + <li class="btn btn-default on">A</li>
  39 + <li class="btn btn-default">B</li>
  40 + <li class="btn btn-default">C</li>
  41 + <li class="btn btn-default">D</li>
  42 + </ul>
  43 + </div>
  44 + <div class="question question2">
  45 + <span>2、</span>
  46 + <ul>
  47 + <li class="btn btn-default">A</li>
  48 + <li class="btn btn-default on">B</li>
  49 + <li class="btn btn-default">C</li>
  50 + <li class="btn btn-default">D</li>
  51 + </ul>
  52 + </div>
  53 + </div>
  54 + </div>-->
  55 + </div>
  56 +
  57 +<!-- 快速出题 -->
  58 +
  59 +<div class="modal fade fast" tabindex="-1" role="dialog">
  60 + <div class="modal-dialog" role="document">
  61 + <div class="modal-content">
  62 + <div class="modal-header">
  63 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  64 + <h4 class="modal-title">快速出题</h4>
  65 + </div>
  66 + <div class="modal-body">
  67 + <div class="form-group">
  68 + <label for="inputEmail3" class="col-sm-2 control-label">试题答案</label>
  69 + <div class="col-sm-10">
  70 + <input type="text" class="form-control" id="answer" placeholder="输入题目答案,以分号隔开">
  71 + </div>
  72 + <div class="clearfix"></div>
  73 + </div>
  74 + <div class="form-group">
  75 + <label for="inputEmail3" class="col-sm-2 control-label">选项个数</label>
  76 + <div class="col-sm-10">
  77 + <select class="form-control" id="num_ans">
  78 + <option value="2">2</option>
  79 + <option value="3">3</option>
  80 + <option value="4" selected>4</option>
  81 + <option value="5">5</option>
  82 + <option value="6">6</option>
  83 + <option value="7">7</option>
  84 + <option value="8">8</option>
  85 + </select>
  86 + </div>
  87 + <div class="clearfix"></div>
  88 + </div>
  89 + <div class="form-group">
  90 + <label for="inputEmail3" class="col-sm-2 control-label">单题分数</label>
  91 + <div class="col-sm-10">
  92 + <input type="number" class="form-control" id="fraction" placeholder="">
  93 + </div>
  94 + <div class="clearfix"></div>
  95 + </div>
  96 + </div>
  97 + <div class="modal-footer">
  98 + <button type="button" class="btn btn-default" id="fast_submit">确定</button>
  99 + <button type="button" class="btn btn-primary" data-dismiss="fast">取消</button>
  100 + </div>
  101 + </div><!-- /.modal-content -->
  102 + </div><!-- /.modal-dialog -->
  103 +</div><!-- /.modal -->
  104 +
  105 +<!--添加试题-->
  106 +<div class="modal fade addQuestion" tabindex="-1" role="dialog">
  107 + <div class="modal-dialog" role="document">
  108 + <div class="modal-content">
  109 + <div class="modal-header">
  110 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  111 + <h4 class="modal-title">添加试题</h4>
  112 + </div>
  113 + <div class="modal-body">
  114 + <div class="form-group">
  115 + <label for="type" class="col-sm-2 control-label">题目名称</label>
  116 + <div class="col-sm-10">
  117 + <select class="form-control" id="type">
  118 + <option value="1" selected>单选题</option>
  119 + <option value="2">完形填空</option>
  120 + <option value="3">阅读理解</option>
  121 + <option value="4">判断题</option>
  122 + <option value="5">多选题</option>
  123 + </select>
  124 + </div>
  125 + <div class="clearfix"></div>
  126 + </div>
  127 + <div class="form-group">
  128 + <label for="index_s_2" class="col-sm-2 control-label">题号</label>
  129 + <div class="col-sm-4">
  130 + <input type="number" class="form-control" id="index_s_2" placeholder="">
  131 + </div>
  132 + <div class="col-sm-1"><span style="line-height:34px;">——</span></div>
  133 + <div class="col-sm-4">
  134 + <input type="number" class="form-control" id="index_e_2" placeholder="">
  135 + </div>
  136 + <div class="clearfix"></div>
  137 + </div>
  138 + <div class="form-group">
  139 + <label for="answer_2" class="col-sm-2 control-label">试题答案</label>
  140 + <div class="col-sm-10">
  141 + <input type="text" class="form-control" id="answer_2" placeholder="输入题目答案,以分号隔开">
  142 + </div>
  143 + <div class="clearfix"></div>
  144 + </div>
  145 + <div class="form-group">
  146 + <label for="num_ans_2" class="col-sm-2 control-label">选项个数</label>
  147 + <div class="col-sm-10">
  148 + <select class="form-control" id="num_ans_2">
  149 + <option value="2">2</option>
  150 + <option value="3">3</option>
  151 + <option value="4" selected>4</option>
  152 + <option value="5">5</option>
  153 + <option value="6">6</option>
  154 + <option value="7">7</option>
  155 + <option value="8">8</option>
  156 + </select>
  157 + </div>
  158 + <div class="clearfix"></div>
  159 + </div>
  160 + <div class="form-group">
  161 + <label for="fraction2" class="col-sm-2 control-label">单题分数</label>
  162 + <div class="col-sm-10">
  163 + <input type="number" class="form-control" id="fraction2" placeholder="">
  164 + </div>
  165 + <div class="clearfix"></div>
  166 + </div>
  167 + </div>
  168 + <div class="modal-footer">
  169 + <button type="button" class="btn btn-default" id="addQuestion_submit">确定</button>
  170 + <button type="button" class="btn btn-primary" data-dismiss="addQuestion">取消</button>
  171 + </div>
  172 + </div><!-- /.modal-content -->
  173 + </div><!-- /.modal-dialog -->
  174 +</div><!-- /.modal -->
  175 +
  176 +<!-- 考试时间 -->
  177 +
  178 +<div class="modal fade test_time" tabindex="-1" role="dialog">
  179 + <div class="modal-dialog" role="document">
  180 + <div class="modal-content">
  181 + <div class="modal-header">
  182 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  183 + <h4 class="modal-title">考试时间</h4>
  184 + </div>
  185 + <div class="modal-body">
  186 + <div class="form-group">
  187 + <label for="enter_time" class="col-sm-4 control-label">考试时间(分钟)</label>
  188 + <div class="col-sm-6">
  189 + <input type="number" class="form-control" id="enter_time" placeholder="输入考试时间">
  190 + </div>
  191 + <div class="clearfix"></div>
  192 + </div>
  193 +
  194 + </div>
  195 + <div class="modal-footer">
  196 + <button type="button" class="btn btn-default" id="time_submit">确定</button>
  197 + <button type="button" class="btn btn-primary" data-dismiss="test_time">取消</button>
  198 + </div>
  199 + </div><!-- /.modal-content -->
  200 + </div><!-- /.modal-dialog -->
  201 +</div><!-- /.modal -->
  202 +<script>
  203 + var testData = ${pd.JSON};
  204 + //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"单选","option_num":"","option_content":"","answer":"","difficulty":"","analysis":"","question_from":"","score":1,"part_score":"","remark":"","rank":"1","no_name":"一、","questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.1"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"B","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.2"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"C","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.3"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"D","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.4"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.5"}]}]};
  205 + //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[]};
  206 +</script>
  207 +<script type="text/javascript" src="../static/js/control.js"></script>
  208 +
  209 +
  210 +</body>
  211 +</html>
0 \ No newline at end of file 212 \ No newline at end of file
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://"
  8 + + request.getServerName() + ":" + request.getServerPort()
  9 + + path + "/";
  10 +%>
  11 +<!DOCTYPE html>
  12 +<html lang="en">
  13 +<head>
  14 +<base href="<%=basePath%>">
  15 +
  16 +<!-- jsp文件头和头部 -->
  17 +<%@ include file="../../system/index/top.jsp"%>
  18 +<style type="text/css">
  19 +.content_l{width:30%;min-width:300px;height:100%;background:#fff;float:left;}
  20 +.info_box{width:100%;height:300px;background:#36c345;color:#fff;position:relative;}
  21 +.info{display:table;width:70%;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;}
  22 +.info_l{width:120px;height:120px;float:left;border-radius:100px;overflow:hidden;position:relative;}
  23 +.info_l img{width:100%;position:absolute;top:0;min-height:100%;}
  24 +.info_r{margin-left:150px;}
  25 +.info_r p{width:100%;text-align:left;}
  26 +.info_r p:first-child{font-size:24px;}
  27 +.class{background:#36c333;color:#fff;margin-top:12px;}
  28 +.class p{margin:0;line-height:3em;box-sizing:border-box;padding-left:3em;font-size:20px;}
  29 +.test{background:#36b733;font-size:32px;text-align:center;color:#fff;padding:3% 0;letter-spacing:1em;margin-top:12px;}
  30 +.analysis{background:#36a733;font-size:32px;text-align:center;color:#fff;padding:3% 0;letter-spacing:1em;margin-top:12px;}
  31 +.commitopacity {
  32 + position: absolute;
  33 + width: 100%;
  34 + height: 100px;
  35 + background: #7f7f7f;
  36 + filter: alpha(opacity = 50);
  37 + -moz-opacity: 0.8;
  38 + -khtml-opacity: 0.5;
  39 + opacity: 0.5;
  40 + top: 0px;
  41 + z-index: 99999;
  42 +}
  43 +
  44 +.jzts {
  45 + position: fixed;
  46 + left: 50%;
  47 + top: 50%;
  48 + width: 100%;
  49 + height: 200px;
  50 + margin: -45px 190px 0px 0px;
  51 +}
  52 +</style>
  53 +
  54 +<!-- 即时通讯 -->
  55 +<link rel="stylesheet" type="text/css"
  56 + href="plugins/websocketInstantMsg/ext4/resources/css/ext-all.css">
  57 +<link rel="stylesheet" type="text/css"
  58 + href="plugins/websocketInstantMsg/css/websocket.css" />
  59 +<script type="text/javascript"
  60 + src="plugins/websocketInstantMsg/ext4/ext-all-debug.js"></script>
  61 +<script type="text/javascript"
  62 + src="plugins/websocketInstantMsg/websocket.js"></script>
  63 +<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  64 +<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
  65 +<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  66 +<!-- 即时通讯 -->
  67 +
  68 +</head>
  69 +<body class="no-skin">
  70 + <!-- #section:basics/navbar.layout -->
  71 +
  72 + <!-- 页面顶部¨ -->
  73 +
  74 +
  75 + <div style="width:1200px;margin:0 auto;">
  76 + <%@ include file="../../system/index/head.jsp"%>
  77 + <div class="content_l">
  78 +
  79 + <div class="info_box">
  80 + <div class="info">
  81 + <div class="info_l">
  82 + <img src="static/ace/avatars/user.jpg" />
  83 + </div>
  84 + <div class="info_r">
  85 + <p>${pd.TEACHER[0].TEACHER_NAME }</p>
  86 + <p>${pd.TEACHER[0].SCHOOL_NAME }</p>
  87 + </div>
  88 + </div>
  89 + </div>
  90 + <div class="class">
  91 + <p>${pd.TEACHER[0].GRADE_NAME}${pd.TEACHER[0].SUBJECT_NAME} <span>${pd.TEACHER[0].CLASS_NAME}</span></p>
  92 + </div>
  93 + <div class="test">测验</div>
  94 + <div class="analysis">分析</div>
  95 + </div>
  96 + <div style="width:70%;height:100%;margin-left:30%;">
  97 + <iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" ></iframe>
  98 + </div>
  99 +</div>
  100 +
  101 +
  102 +
  103 + <%@ include file="../../system/index/foot.jsp"%>
  104 +
  105 + <!-- page specific plugin scripts -->
  106 +
  107 + <!-- ace scripts -->
  108 + <script src="static/ace/js/ace/elements.scroller.js"></script>
  109 + <script src="static/ace/js/ace/elements.colorpicker.js"></script>
  110 + <script src="static/ace/js/ace/elements.fileinput.js"></script>
  111 + <script src="static/ace/js/ace/elements.typeahead.js"></script>
  112 + <script src="static/ace/js/ace/elements.wysiwyg.js"></script>
  113 + <script src="static/ace/js/ace/elements.spinner.js"></script>
  114 + <script src="static/ace/js/ace/elements.treeview.js"></script>
  115 + <script src="static/ace/js/ace/elements.wizard.js"></script>
  116 + <script src="static/ace/js/ace/elements.aside.js"></script>
  117 + <script src="static/ace/js/ace/ace.js"></script>
  118 + <script src="static/ace/js/ace/ace.ajax-content.js"></script>
  119 + <script src="static/ace/js/ace/ace.touch-drag.js"></script>
  120 + <script src="static/ace/js/ace/ace.sidebar.js"></script>
  121 + <script src="static/ace/js/ace/ace.sidebar-scroll-1.js"></script>
  122 + <script src="static/ace/js/ace/ace.submenu-hover.js"></script>
  123 + <script src="static/ace/js/ace/ace.widget-box.js"></script>
  124 + <script src="static/ace/js/ace/ace.settings.js"></script>
  125 + <script src="static/ace/js/ace/ace.settings-rtl.js"></script>
  126 + <script src="static/ace/js/ace/ace.settings-skin.js"></script>
  127 + <script src="static/ace/js/ace/ace.widget-on-reload.js"></script>
  128 + <script src="static/ace/js/ace/ace.searchbox-autocomplete.js"></script>
  129 + <!-- inline scripts related to this page -->
  130 +
  131 + <!-- the following scripts are used in demo only for onpage help and you don't need them -->
  132 + <link rel="stylesheet" href="static/ace/css/ace.onpage-help.css" />
  133 +
  134 + <script type="text/javascript"> ace.vars['base'] = '..'; </script>
  135 + <script src="static/ace/js/ace/elements.onpage-help.js"></script>
  136 + <script src="static/ace/js/ace/ace.onpage-help.js"></script>
  137 +
  138 + <!--引入属于此页面的js -->
  139 + <script type="text/javascript" src="static/js/myjs/head.js"></script>
  140 + <!--引入属于此页面的js -->
  141 + <script type="text/javascript" src="static/js/myjs/index.js"></script>
  142 +
  143 + <!--引入弹窗组件1start-->
  144 + <!--<script type="text/javascript" src="plugins/attention/zDialog/zDrag.js"></script>-->
  145 + <!--<script type="text/javascript" src="plugins/attention/zDialog/zDialog.js"></script>-->
  146 + <!--引入弹窗组件1end-->
  147 +
  148 + <!--引入弹窗组件2start-->
  149 + <script type="text/javascript" src="plugins/attention/drag/drag.js"></script>
  150 + <script type="text/javascript" src="plugins/attention/drag/dialog.js"></script>
  151 + <link type="text/css" rel="stylesheet"
  152 + href="plugins/attention/drag/style.css" />
  153 + <!--引入弹窗组件2end-->
  154 +
  155 + <!--提示框-->
  156 + <script type="text/javascript" src="static/js/jquery.tips.js"></script>
  157 + <script>
  158 + $(".content_l").height($("#mainFrame").height());
  159 + </script>
  160 + <!-- 考试时间 -->
  161 + <div class="modal fade title_time" tabindex="-1" role="dialog">
  162 + <div class="modal-dialog" role="document" style="z-index:1400">
  163 + <div class="modal-content">
  164 + <div class="modal-header">
  165 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  166 + <h4 class="modal-title">考试时间</h4>
  167 + </div>
  168 + <div class="modal-body">
  169 + <div class="form-group">
  170 + <label for="enter_title" class="col-sm-4 control-label">测验标题</label>
  171 + <div class="col-sm-6">
  172 + <input type="text" class="form-control" id="enter_title" placeholder="输入测验标题">
  173 + </div>
  174 + <div class="clearfix"></div>
  175 + </div>
  176 + <div class="form-group">
  177 + <label for="enter_time" class="col-sm-4 control-label">测验时长(分钟)</label>
  178 + <div class="col-sm-6">
  179 + <input type="number" class="form-control" id="enter_time" placeholder="输入测验时长">
  180 + </div>
  181 + <div class="clearfix"></div>
  182 + </div>
  183 +
  184 + </div>
  185 + <div class="modal-footer">
  186 + <button type="button" class="btn btn-primary" id="time_submit">确定</button>
  187 + <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
  188 + </div>
  189 + </div><!-- /.modal-content -->
  190 + </div><!-- /.modal-dialog -->
  191 + </div><!-- /.modal -->
  192 + <script>
  193 + $("#time_submit").click(function(){
  194 + $(".title_time").modal("hide");
  195 + var name = $("#enter_title").val();
  196 + var time = $("#enter_time").val();
  197 + window.open("<%=basePath%>" + "paper/npaper.do?" + "name=" + name + "&time=" + time);
  198 + });
  199 + </script>
  200 +
  201 +</body>
  202 +</html>
0 \ No newline at end of file 203 \ No newline at end of file
WebRoot/WEB-INF/jsp/system/index/login.jsp
@@ -259,7 +259,11 @@ @@ -259,7 +259,11 @@
259 success: function(data){ 259 success: function(data){
260 if("success" == data.result){ 260 if("success" == data.result){
261 saveCookie(); 261 saveCookie();
262 - window.location.href="main/index"; 262 + if(data.teacher != null){
  263 + window.location.href="main/teacher";
  264 + }else{
  265 + window.location.href="main/index";
  266 + }
263 }else if("usererror" == data.result){ 267 }else if("usererror" == data.result){
264 $("#loginname").tips({ 268 $("#loginname").tips({
265 side : 1, 269 side : 1,
WebRoot/afterService/index.html
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
19 <body> 19 <body>
20 <div class="container column" > 20 <div class="container column" >
21 <h2>产品问题反馈</h2> 21 <h2>产品问题反馈</h2>
  22 + <p style="font-size:16px;color:#ccc;">点击对应产品进行反馈</p>
22 <div class="col-md-8"> 23 <div class="col-md-8">
23 <div class="class1"> 24 <div class="class1">
24 <h3><img src="images/jz.png" />基站</h3> 25 <h3><img src="images/jz.png" />基站</h3>
WebRoot/static/css/index-style.css 0 → 100644
  1 +.content_l{width:30%;min-width:400px;}
  2 +.info_box{width:100%;height:300px;background:#36c345;color:#fff;position:relative;}
  3 +.info{display:table;width:70%;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;}
  4 +.info_l{width:120px;height:120px;float:left;border-radius:100px;overflow:hidden;position:relative;}
  5 +.info_l img{width:100%;position:absolute;top:0;min-height:100%;}
  6 +.info_r{margin-left:150px;}
  7 +.info_r p{width:100%;text-align:left;}
  8 +.info_r p:first-child{font-size:24px;}
  9 +.class{background:#36c333;color:#fff;margin-top:12px;}
  10 +.class p{margin:0;line-height:3em;box-sizing:border-box;padding-left:3em;font-size:20px;}
  11 +.test{background:#36b733;font-size:32px;text-align:center;color:#fff;padding:3% 0;letter-spacing:1em;margin-top:12px;}
  12 +.analysis{background:#36a733;font-size:32px;text-align:center;color:#fff;padding:3% 0;letter-spacing:1em;margin-top:12px;}
WebRoot/static/css/style.css 0 → 100644
  1 +input[type="number"]{-moz-appearance:textfield;}
  2 +input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance: none !important;}
  3 +.page-header{margin-top:0;background:#fff;position:fixed;top:0;width:100%;}
  4 +.page-header .time .bg-primary{padding:5px 10px;}
  5 +.content{padding-top:180px;padding-bottom:60px;}
  6 +.content .section .title{border-bottom:1px dashed #ccc;padding:10px 0;}
  7 +.content .section h3{display:inline-block;margin: 0;line-height:34px;vertical-align: bottom;}
  8 +.content .section .title input[type="button"]{margin-left:10px;}
  9 +.content .question_list .question{margin:10px 0;}
  10 +.content .question_list .question li{margin:0 20px;}
  11 +.content .question_list .question .on{background:#5cb85c;color:#fff;}
  12 +.content .question_list .question span{float:left;display:inline-block;line-height:34px;font-size:20px;}
  13 +.modal-body label{line-height:34px;}
0 \ No newline at end of file 14 \ No newline at end of file
WebRoot/static/images/head_pic.jpg 0 → 100644

23.8 KB

WebRoot/static/js/control.js 0 → 100644
  1 +$(function(){
  2 + /*创建答案列表*/
  3 + var score=0;
  4 + function creat(str_ans,a_num,fraction){
  5 + $(".section").remove();
  6 + $(".content").append('<div class="section section-1 single" data-fraction="'+fraction+'"> <div class="title"> <h3><span class="que_num">一、</span><span class="que_name">单选</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>')
  7 + var str=str_ans.split(',');
  8 + q_num=str.length;
  9 + for(var i=0;i<q_num;i++){
  10 + str_temp=str[i];
  11 + str_temp=str_temp.toUpperCase()
  12 + code = str_temp.charCodeAt();
  13 + on_index=code-65;
  14 +
  15 + if(code<(65+a_num)){
  16 + console.log(str_temp);
  17 + $(".question_list").append('<div class="question question'+(i+1)+'"><span>'+(i+1)+'、</span><ul></ul></div>');
  18 + for(var j=0;j<a_num;j++){
  19 + option=String.fromCharCode(0x41+j);
  20 + if(on_index==j){
  21 + console.log(on_index+"---"+j);
  22 + $(".question"+(i+1)+' ul').append('<li class="btn btn-default on">'+option+'</li>');
  23 + }else
  24 + $(".question"+(i+1)+' ul').append('<li class="btn btn-default">'+option+'</li>');
  25 + }
  26 + }else{
  27 + alert("题目"+(i+1)+":"+String.fromCharCode(code)+"答案错误,超出选项数");
  28 + //return;
  29 + }
  30 + }
  31 + }
  32 +
  33 + /***********
  34 + *1、单选题
  35 + *2、完形填空
  36 + *3、阅读理解
  37 + *4、判断题
  38 + *5、多选题
  39 + ***********/
  40 + var type_2=1;
  41 + var index_s_2=1;
  42 + var index_e_2=5;
  43 + var answer_2='a,b,c,d,a';
  44 + var num_ans_2=4;
  45 +
  46 + function addQuestion(type,str_ans,a_num,index_s_2,index_e_2){
  47 + console.log($(".section").length);
  48 + var question_num=SectionToChinese($(".section").length+1);
  49 + switch(type){
  50 + case 1: //单选题
  51 + $(".content").append('<div class="section section-1 single"> <div class="title"> <h3><span class="que_num">'+question_num+'、</span>'+'<span class="que_name">单选</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>');
  52 + var str=str_ans.split(',');
  53 + q_num=str.length;
  54 + if(q_num!==(index_e_2-index_s_2+1)){
  55 + alert("答案长度错误,请检查后重新填写");
  56 + return;
  57 + }
  58 + for(var i=index_s_2;i<=index_e_2;i++){
  59 + str_temp=str[i-index_s_2];
  60 + str_temp=str_temp.toUpperCase()
  61 + code = str_temp.charCodeAt();
  62 + on_index=code-65;
  63 + if(code<(65+a_num)){
  64 + console.log(str_temp);
  65 + $(".section-1 .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>');
  66 + for(var j=0;j<a_num;j++){
  67 + option=String.fromCharCode(0x41+j);
  68 + if(on_index==j){
  69 + console.log(on_index+"---"+j);
  70 + $(".question"+i+' ul').append('<li class="btn btn-default on">'+option+'</li>');
  71 + }else
  72 + $(".question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>');
  73 + }
  74 + }else{
  75 + alert("题目"+(i)+":"+String.fromCharCode(code)+"答案错误,超出选项数");
  76 + //return;
  77 + }
  78 + }
  79 + break;
  80 + case 2: //完形填空
  81 + $(".content").append('<div class="section section-2 single"> <div class="title"> <h3><span class="que_num">'+question_num+'、</span><span class="que_name">完形填空</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>');
  82 + var str=str_ans.split(',');
  83 + q_num=str.length;
  84 + if(q_num!==(index_e_2-index_s_2+1)){
  85 + alert("答案长度错误,请检查后重新填写");
  86 + return;
  87 + }
  88 + for(var i=index_s_2;i<=index_e_2;i++){
  89 + str_temp=str[i-index_s_2];
  90 + str_temp=str_temp.toUpperCase()
  91 + code = str_temp.charCodeAt();
  92 + on_index=code-65;
  93 + if(code<(65+a_num)){
  94 + console.log(str_temp);
  95 + $(".section-2 .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>');
  96 + for(var j=0;j<a_num;j++){
  97 + option=String.fromCharCode(0x41+j);
  98 + if(on_index==j){
  99 + console.log(on_index+"---"+j);
  100 + $(".question"+i+' ul').append('<li class="btn btn-default on">'+option+'</li>');
  101 + }else
  102 + $(".question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>');
  103 + }
  104 + }else{
  105 + alert("题目"+(i)+":"+String.fromCharCode(code)+"答案错误,超出选项数");
  106 + //return;
  107 + }
  108 + }
  109 + break;
  110 + case 3: //阅读理解
  111 + $(".content").append('<div class="section section-3 single"> <div class="title"> <h3><span class="que_num">'+question_num+'、</span><span class="que_name">阅读理解</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>');
  112 + var str=str_ans.split(',');
  113 + q_num=str.length;
  114 + if(q_num!==(index_e_2-index_s_2+1)){
  115 + alert("答案长度错误,请检查后重新填写");
  116 + return;
  117 + }
  118 + for(var i=index_s_2;i<=index_e_2;i++){
  119 + str_temp=str[i-index_s_2];
  120 + str_temp=str_temp.toUpperCase()
  121 + code = str_temp.charCodeAt();
  122 + on_index=code-65;
  123 + if(code<(65+a_num)){
  124 + console.log(str_temp);
  125 + $(".section-3 .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>');
  126 + for(var j=0;j<a_num;j++){
  127 + option=String.fromCharCode(0x41+j);
  128 + if(on_index==j){
  129 + console.log(on_index+"---"+j);
  130 + $(".question"+i+' ul').append('<li class="btn btn-default on">'+option+'</li>');
  131 + }else
  132 + $(".question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>');
  133 + }
  134 + }else{
  135 + alert("题目"+(i)+":"+String.fromCharCode(code)+"答案错误,超出选项数");
  136 + //return;
  137 + }
  138 + }
  139 + break;
  140 + }
  141 + }
  142 + //addQuestion(1,answer_2,num_ans_2,index_s_2,index_e_2);
  143 + //addQuestion(2,answer_2,num_ans_2,6,10);
  144 + //addQuestion(3,answer_2,num_ans_2,11,15);
  145 + //addQuestion(1);
  146 + //creat("A,B,a,D,C,E,b",4);
  147 +
  148 + $(document).on('click','.remove',function(){ //删除按钮
  149 + $(this).parent().parent().remove();
  150 + })
  151 + $("#fast_submit").click(function(){ //点击确定,创建答案列表
  152 + $("#addQuestion").attr("disabled","disabled");
  153 + var answer=$("#answer").val();
  154 + var num_ans=$("#num_ans").val();
  155 + var fraction=$("#fraction").val();
  156 + if(answer==''){
  157 + alert("请输入题目答案,以分号隔开");
  158 + return;
  159 + }else if(fraction==''){
  160 + alert("请输入题目分数");
  161 + return;
  162 + }
  163 + //$(".fast").toggle();
  164 + //$(".modal-backdrop").remove();
  165 + $('.fast').modal('hide');
  166 + score += parseInt(fraction)*answer.split(",").length;
  167 + creat(answer,num_ans,fraction);
  168 + })
  169 +
  170 + var type_2=1;
  171 + var index_s_2=1;
  172 + var index_e_2=5;
  173 + var answer_2='a,b,c,d,a';
  174 + var num_ans_2=4;
  175 + /*添加试题的确定按钮*/
  176 + $("#addQuestion_submit").click(function(){
  177 + $("#fast").attr("disabled","disabled");
  178 + var type_2=$("#type").val();
  179 + var index_s_2=$("#index_s_2").val();
  180 + var index_e_2=$("#index_e_2").val();
  181 + var answer_2=$("#answer_2").val();
  182 + var num_ans_2=$("#num_ans_2").val();
  183 + var fraction2=$("#fraction2").val();
  184 + if(index_s_2==''){
  185 + alert("请输入题目开始序号");
  186 + return;
  187 + }else if(index_e_2==''){
  188 + alert("请输入题目结束序号");
  189 + return;
  190 + }
  191 +
  192 + $('.addQuestion').modal('hide');
  193 + })
  194 + /*更改考试时长*/
  195 + $("#time_submit").click(function(){
  196 + var test_time=$("#enter_time").val();
  197 + if(test_time==''){
  198 + alert("请输入考试时间");
  199 + return;
  200 + }
  201 + $("#time").html(test_time);
  202 + $('.test_time').modal('hide');
  203 + })
  204 + /*更改单选答案*/
  205 + $(document).on('click','.single li',function(){
  206 + $(this).siblings().removeClass("on");
  207 + $(this).addClass("on");
  208 + })
  209 + /*提交保存数据*/
  210 + $("#save").click(function(){
  211 + var url="http://192.168.0.240:8080/SunvoteEducation/api/v1/uploadpaper";
  212 + var data={
  213 + title: $(".text-center").text(),
  214 + exam_time: parseInt($("#time").text()),
  215 + paper_type: "1",
  216 + subject_id: "1",
  217 + grade_id: "1",
  218 + user_id: "1",
  219 + score:score,
  220 + questions:[]
  221 + }
  222 + var rank=0;
  223 + if($(".section").length>0){
  224 + for(i=0;i<$(".section").length;i++){
  225 + rank++;
  226 + data.questions[i]={
  227 + chapter_id: "0",
  228 + problem_type_id: "0",
  229 + knowledge_id: "0",
  230 + content: $(".que_name").text(),
  231 + option_num: "",
  232 + option_content: "",
  233 + answer: "",
  234 + difficulty: "",
  235 + analysis: "",
  236 + question_from: "",
  237 + score:parseInt($(".section").eq(i).attr("data-fraction")),
  238 + part_score: "",
  239 + remark: "",
  240 + rank: rank,
  241 + no_name: $(".que_num").text(),
  242 + questions:[]
  243 + }
  244 + for(j=0;j<$(".section").eq(i).find(".question_list").children(".question").length;j++){
  245 + rank++;
  246 + data.questions[i].questions[j]={
  247 + chapter_id: "0",
  248 + problem_type_id: "0",
  249 + knowledge_id: "0",
  250 + content: "",
  251 + option_num: $(".question").eq(j).find("li").length,
  252 + option_content: "",
  253 + answer: $(".question").eq(j).find(".on").text(),
  254 + difficulty: "0",
  255 + analysis: "",
  256 + question_from: "1",
  257 + score: parseInt($(".section").eq(i).attr("data-fraction")),
  258 + part_score: "0",
  259 + remark: "",
  260 + rank: rank,
  261 + no_name: (i+1)+'.'+(j+1),
  262 + }
  263 + }
  264 + }
  265 + }
  266 +
  267 + if(data.questions.length>0){
  268 + data=JSON.stringify(data);
  269 + dataJson={"json":data};
  270 + console.log(data);
  271 + ajax_submit(url,dataJson);
  272 + var suc=ajax_submit(url,dataJson);
  273 +// alert(suc);
  274 + if(suc==1){
  275 +
  276 + }
  277 + }
  278 + else
  279 + alert("请添加试题");
  280 + })
  281 +})
  282 +
  283 +/*ajax封装函数*/
  284 +function ajax_submit(url,data){
  285 + var flag=0;
  286 + $.ajax({
  287 + url:url,
  288 + type:"POST",
  289 + async:false,
  290 + data:data,
  291 + dataType:"json",
  292 + success:function(data){
  293 + flag=1;
  294 + alert("保存成功");
  295 + window.close();
  296 + }
  297 + })
  298 + return flag;
  299 +}
  300 +
  301 +
  302 + creatHtml(testData);
  303 +function creatHtml(data){
  304 + console.log(data);
  305 + if(data.questions.length>0){
  306 + $(".btn_box").remove();
  307 + }
  308 + $(".header_box h1").html(data.title);
  309 + $("#time").html(data.exam_time);
  310 + for(var i=0;i<data.questions.length;i++){
  311 + $(".content").append('<div class="section section-'+i+' single" data-fraction="'+data.questions[i].score+'"> <h3><span class="que_num">'+data.questions[i].no_name+'</span>'+'<span class="que_name">'+data.questions[i].content+'</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>')
  312 + if(data.questions.length>0){$(".remove").remove();}
  313 + for(var j=0;j<data.questions[i].questions.length;j++){
  314 + $(".question_list").append('<div class="question question'+(j+1)+'"><span>'+(j+1)+'、</span><ul></ul></div>');
  315 + for(var k=0;k<parseInt(data.questions[i].questions[j].option_num);k++){
  316 + str_temp=data.questions[i].questions[j].answer;
  317 + code=str_temp.charCodeAt();
  318 + on_index=code-65;
  319 + if(on_index==k){
  320 + console.log(on_index+"---"+j);
  321 + $(".question"+(j+1)+' ul').append('<li class="btn btn-default on">'+String.fromCharCode(0x41+k)+'</li>');
  322 + }else
  323 + $(".question"+(j+1)+' ul').append('<li class="btn btn-default">'+String.fromCharCode(0x41+k)+'</li>');
  324 + }
  325 + }
  326 + }
  327 + }
  328 +
  329 +/*数字转汉字数字*/
  330 +var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];
  331 + var chnUnitSection = ["","万","亿","万亿","亿亿"];
  332 + var chnUnitChar = ["","十","百","千"];
  333 +
  334 + function SectionToChinese(section){
  335 + var strIns = '', chnStr = '';
  336 + var unitPos = 0;
  337 + var zero = true;
  338 + while(section > 0){
  339 + var v = section % 10;
  340 + if(v === 0){
  341 + if(!zero){
  342 + zero = true;
  343 + chnStr = chnNumChar[v] + chnStr;
  344 + }
  345 + }else{
  346 + zero = false;
  347 + strIns = chnNumChar[v];
  348 + strIns += chnUnitChar[unitPos];
  349 + chnStr = strIns + chnStr;
  350 + }
  351 + unitPos++;
  352 + section = Math.floor(section / 10);
  353 + }
  354 + return chnStr;
  355 + }
  356 +
  357 + //alert(SectionToChinese(123));
  358 +
  359 +
  360 + // <div class="question question1">
  361 + // <span>1、</span>
  362 + // <ul>
  363 + // <li class="btn btn-default on">A</li>
  364 + // <li class="btn btn-default">B</li>
  365 + // <li class="btn btn-default">C</li>
  366 + // <li class="btn btn-default">D</li>
  367 + // </ul>
  368 + // </div>
  369 + // <div class="section section-1"> <div class="title"> <h3>一、单选</h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list">
  370 +
  371 +
resources/mybatis1/api/V1Mapper.xml
@@ -34,7 +34,8 @@ @@ -34,7 +34,8 @@
34 <select id="getClassStudent" parameterType="pd" resultType="pd"> 34 <select id="getClassStudent" parameterType="pd" resultType="pd">
35 SELECT 35 SELECT
36 STUDENT_ID, 36 STUDENT_ID,
37 - sv_student.`NAME` 37 + sv_student.`NAME`,
  38 + sv_student.`KEYPAD_ID`
38 FROM 39 FROM
39 sv_classroster 40 sv_classroster
40 LEFT JOIN sv_term ON sv_classroster.TEAMID = sv_term.TERM_ID 41 LEFT JOIN sv_term ON sv_classroster.TEAMID = sv_term.TERM_ID
@@ -45,10 +46,20 @@ @@ -45,10 +46,20 @@
45 AND SCLASS_ID = #{SCLASS_ID} 46 AND SCLASS_ID = #{SCLASS_ID}
46 </select> 47 </select>
47 48
48 - <!-- 通过教师ID获取科目数据 --> 49 + <!-- 通过教师ID获取科目数据
49 <select id="getTestPaperInfo" parameterType="pd" resultType="pd"> 50 <select id="getTestPaperInfo" parameterType="pd" resultType="pd">
50 SELECT 51 SELECT
51 - * 52 + sv_question.OPTION_NUM,
  53 + sv_paperquestion.SCORE,
  54 + sv_paperquestion.PART_SCORE,
  55 + sv_paperquestion.RANK,
  56 + sv_paperquestion.NO_NAME,
  57 + sv_question.ANALYSIS,
  58 + sv_question.DIFFICULTY,
  59 + sv_question.QUESTION_ID,
  60 + sv_question.CONTENT,
  61 + sv_question.ANSWER,
  62 + sv_question.OPTION_CONTENT
52 FROM 63 FROM
53 sv_paper 64 sv_paper
54 LEFT JOIN sv_paperquestion ON sv_paper.PAPER_ID = sv_paperquestion.PAPER_ID 65 LEFT JOIN sv_paperquestion ON sv_paper.PAPER_ID = sv_paperquestion.PAPER_ID
@@ -58,6 +69,85 @@ @@ -58,6 +69,85 @@
58 and sv_paper.PAPER_ID = #{PAPER_ID} 69 and sv_paper.PAPER_ID = #{PAPER_ID}
59 </if> 70 </if>
60 71
  72 + </select> -->
  73 +
  74 +
  75 + <!-- 通过教师ID获取科目数据 -->
  76 + <select id="getTestPaperInfo" parameterType="pd" resultType="pd">
  77 + SELECT
  78 + sv_question.OPTION_NUM,
  79 + sv_paperquestion.SCORE,
  80 + sv_paperquestion.PART_SCORE,
  81 + sv_paperquestion.RANK,
  82 + sv_paperquestion.NO_NAME,
  83 + sv_question.ANALYSIS,
  84 + sv_question.DIFFICULTY,
  85 + sv_question.QUESTION_ID,
  86 + sv_question.CONTENT,
  87 + sv_question.ANSWER,
  88 + sv_question.OPTION_CONTENT,
  89 + sv_question.P_ID
  90 + FROM
  91 + sv_paperquestion
  92 + LEFT JOIN sv_question ON sv_paperquestion.QUESTION_ID = sv_question.QUESTION_ID
  93 + where 1 = 1 and (sv_question.P_ID = '-1' or sv_question.P_ID = '0')
  94 + <if test="PAPER_ID != null and PAPER_ID != ''">
  95 + and sv_paperquestion.PAPER_ID = #{PAPER_ID}
  96 + </if>
  97 +
61 </select> 98 </select>
62 99
  100 +
  101 + <!-- 通过教师ID获取科目数据 -->
  102 + <select id="getQuestionsByPID" parameterType="pd" resultType="pd">
  103 + SELECT
  104 + sv_question.OPTION_NUM,
  105 + sv_paperquestion.SCORE,
  106 + sv_paperquestion.PART_SCORE,
  107 + sv_paperquestion.RANK,
  108 + sv_paperquestion.NO_NAME,
  109 + sv_question.ANALYSIS,
  110 + sv_question.DIFFICULTY,
  111 + sv_question.QUESTION_ID,
  112 + sv_question.CONTENT,
  113 + sv_question.ANSWER,
  114 + sv_question.OPTION_CONTENT
  115 + FROM
  116 + sv_paperquestion
  117 + LEFT JOIN sv_question ON sv_paperquestion.QUESTION_ID = sv_question.QUESTION_ID
  118 + where 1 = 1
  119 + <if test="PID != null and PID != ''">
  120 + and sv_question.P_ID = #{PID}
  121 + </if>
  122 +
  123 + </select>
  124 +
  125 + <!-- 通过教师ID获取科目数据 -->
  126 + <select id="getTeacherInfo" parameterType="pd" resultType="pd">
  127 + SELECT
  128 + sv_teacher.`NAME` AS TEACHER_NAME,
  129 + sv_grade.`NAME` AS GRADE_NAME,
  130 + sv_sclass.CLASS_NAME AS CLASS_NAME,
  131 + sv_subject.CNAME AS SUBJECT_NAME,
  132 + sv_school.`NAME` as SCHOOL_NAME
  133 + FROM
  134 + sv_coursemanagement AS couse
  135 + LEFT JOIN sv_term AS term ON couse.TERM_ID = term.TERM_ID
  136 + LEFT JOIN sv_grade ON couse.GRADE_ID = sv_grade.ID
  137 + LEFT JOIN sv_teacher ON sv_teacher.ID = couse.TEACHER_ID
  138 + LEFT JOIN sv_sclass ON couse.CLASS_ID = sv_sclass.ID
  139 + LEFT JOIN sv_subject ON couse.SUBJECT_ID = sv_subject.ID
  140 + LEFT JOIN sv_school ON sv_teacher.SCHOOL_ID = sv_school.ID
  141 + WHERE
  142 + TEACHER_ID = #{ID}
  143 + AND term.START_DATE &lt; now()
  144 + AND term.END_DATE &gt; now();
  145 +
  146 + </select>
  147 +
  148 +
  149 +
  150 +
  151 +
  152 +
63 </mapper> 153 </mapper>
64 \ No newline at end of file 154 \ No newline at end of file
resources/mybatis1/sunvote/PaperMapper.xml
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
20 EXAM_TIME, 20 EXAM_TIME,
21 PAPER_STATE, 21 PAPER_STATE,
22 REMARK, 22 REMARK,
  23 + SCORE,
23 PAPER_ID 24 PAPER_ID
24 </sql> 25 </sql>
25 26
@@ -36,6 +37,7 @@ @@ -36,6 +37,7 @@
36 #{EXAM_TIME}, 37 #{EXAM_TIME},
37 #{PAPER_STATE}, 38 #{PAPER_STATE},
38 #{REMARK}, 39 #{REMARK},
  40 + #{SCORE},
39 #{PAPER_ID} 41 #{PAPER_ID}
40 </sql> 42 </sql>
41 43
@@ -74,6 +76,7 @@ @@ -74,6 +76,7 @@
74 EXAM_TIME = #{EXAM_TIME}, 76 EXAM_TIME = #{EXAM_TIME},
75 PAPER_STATE = #{PAPER_STATE}, 77 PAPER_STATE = #{PAPER_STATE},
76 REMARK = #{REMARK}, 78 REMARK = #{REMARK},
  79 + SCORE = #{SCORE},
77 PAPER_ID = PAPER_ID 80 PAPER_ID = PAPER_ID
78 where 81 where
79 PAPER_ID = #{PAPER_ID} 82 PAPER_ID = #{PAPER_ID}
@@ -96,9 +99,10 @@ @@ -96,9 +99,10 @@
96 from 99 from
97 <include refid="tableName"></include> 100 <include refid="tableName"></include>
98 where 1=1 101 where 1=1
99 - <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 --> 102 + <if test="pd.LASTSTART != null and pd.LASTSTARt != ''"><!-- 关键词检索 -->
100 and 103 and
101 ( 104 (
  105 + CREATE_DATE &gt; #{pd.LASTSTART}
102 <!-- 根据需求自己加检索条件 106 <!-- 根据需求自己加检索条件
103 字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%') 107 字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
104 or 108 or
@@ -106,6 +110,19 @@ @@ -106,6 +110,19 @@
106 --> 110 -->
107 ) 111 )
108 </if> 112 </if>
  113 + <if test="pd.LASTEND != null and pd.LASTEND != ''"><!-- 关键词检索 -->
  114 + and
  115 + (
  116 + CREATE_DATE &lt; CONCAT(#{pd.LASTEND},'A')
  117 + <!-- 根据需求自己加检索条件
  118 + 字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
  119 + or
  120 + 字段2 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
  121 + -->
  122 + )
  123 + </if>
  124 +
  125 + order by CREATE_DATE DESC
109 </select> 126 </select>
110 127
111 <!-- 列表(全部) --> 128 <!-- 列表(全部) -->
@@ -114,10 +131,12 @@ @@ -114,10 +131,12 @@
114 <include refid="Field"></include> 131 <include refid="Field"></include>
115 from 132 from
116 <include refid="tableName"></include> 133 <include refid="tableName"></include>
  134 +
  135 + order by CREATE_DATE DESC
117 </select> 136 </select>
118 137
119 <!-- 指定类型列表(全部) --> 138 <!-- 指定类型列表(全部) -->
120 - <select id="listAllByType" parameterType="page" resultType="pd"> 139 + <select id="listAllByTypelistPage" parameterType="page" resultType="pd">
121 select 140 select
122 <include refid="Field"></include> 141 <include refid="Field"></include>
123 from 142 from
@@ -131,6 +150,7 @@ @@ -131,6 +150,7 @@
131 and USER_ID = #{pd.USER_ID} 150 and USER_ID = #{pd.USER_ID}
132 </if> 151 </if>
133 152
  153 + order by CREATE_DATE DESC
134 </select> 154 </select>
135 155
136 <!-- 批量删除 --> 156 <!-- 批量删除 -->
resources/mybatis1/sunvote/PaperQuestionMapper.xml
@@ -112,5 +112,16 @@ @@ -112,5 +112,16 @@
112 </foreach> 112 </foreach>
113 </delete> 113 </delete>
114 114
  115 + <!-- 批量删除 -->
  116 + <delete id="deleteAllPaper" parameterType="String">
  117 + delete from
  118 + <include refid="tableName"></include>
  119 + where
  120 + PAPER_ID in
  121 + <foreach item="item" index="index" collection="array" open="(" separator="," close=")">
  122 + #{item}
  123 + </foreach>
  124 + </delete>
  125 +
115 <!-- fh313596790qq(青苔) --> 126 <!-- fh313596790qq(青苔) -->
116 </mapper> 127 </mapper>
117 \ No newline at end of file 128 \ No newline at end of file
src/com/fh/bean/Paper.java 0 → 100644
  1 +package com.fh.bean;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import com.google.gson.Gson;
  7 +
  8 +public class Paper {
  9 + private String title = "";
  10 +
  11 + private String exam_time = "";
  12 +
  13 + private String paper_type = "";
  14 +
  15 + private String subject_id = "";
  16 +
  17 + private String grade_id = "";
  18 +
  19 + private String user_id = "";
  20 +
  21 + private List<Question> questions = new ArrayList<Question>();
  22 +
  23 + private String score = "";
  24 +
  25 + public void setTitle(String title) {
  26 + this.title = title;
  27 + }
  28 +
  29 + public String getTitle() {
  30 + return this.title;
  31 + }
  32 +
  33 + public void setExam_time(String exam_time) {
  34 + this.exam_time = exam_time;
  35 + }
  36 +
  37 + public String getExam_time() {
  38 + return this.exam_time;
  39 + }
  40 +
  41 + public void setPaper_type(String paper_type) {
  42 + this.paper_type = paper_type;
  43 + }
  44 +
  45 + public String getPaper_type() {
  46 + return this.paper_type;
  47 + }
  48 +
  49 + public void setSubject_id(String subject_id) {
  50 + this.subject_id = subject_id;
  51 + }
  52 +
  53 + public String getSubject_id() {
  54 + return this.subject_id;
  55 + }
  56 +
  57 + public void setGrade_id(String grade_id) {
  58 + this.grade_id = grade_id;
  59 + }
  60 +
  61 + public String getGrade_id() {
  62 + return this.grade_id;
  63 + }
  64 +
  65 + public void setUser_id(String user_id) {
  66 + this.user_id = user_id;
  67 + }
  68 +
  69 + public String getUser_id() {
  70 + return this.user_id;
  71 + }
  72 +
  73 + public void setQuestions(List<Question> questions) {
  74 + this.questions = questions;
  75 + }
  76 +
  77 + public List<Question> getQuestions() {
  78 + return this.questions;
  79 + }
  80 +
  81 +
  82 +
  83 +
  84 + public String getScore() {
  85 + return score;
  86 + }
  87 +
  88 + public void setScore(String score) {
  89 + this.score = score;
  90 + }
  91 +
  92 + public static Paper parse(String json){
  93 + Gson gson = new Gson();
  94 + return gson.fromJson(json, Paper.class);
  95 + }
  96 +
  97 + public String toJson(){
  98 + Gson gson = new Gson();
  99 + return gson.toJson(this);
  100 + }
  101 +}
src/com/fh/bean/Question.java 0 → 100644
  1 +package com.fh.bean;
  2 +
  3 +import java.util.List;
  4 +
  5 +public class Question {
  6 +
  7 + private String question_id ;
  8 +
  9 + private String subject_id;
  10 +
  11 + private String chapter_id;
  12 +
  13 + private String problem_type_id;
  14 +
  15 + private String knowledge_id;
  16 +
  17 + private String content;
  18 +
  19 + private String option_num;
  20 +
  21 + private String option_content;
  22 +
  23 + private String answer;
  24 +
  25 + private String difficulty;
  26 +
  27 + private String analysis;
  28 +
  29 + private String question_from;
  30 +
  31 + private String score;
  32 +
  33 + private String part_score;
  34 +
  35 + private String remark;
  36 +
  37 + private String rank;
  38 +
  39 + private String no_name;
  40 +
  41 + private String sug_score;
  42 +
  43 + private String sug_part_score;
  44 +
  45 + private List<Question> questions;
  46 +
  47 + public void setSubject_id(String subject_id) {
  48 + this.subject_id = subject_id;
  49 + }
  50 +
  51 + public String getSubject_id() {
  52 + return this.subject_id;
  53 + }
  54 +
  55 + public void setChapter_id(String chapter_id) {
  56 + this.chapter_id = chapter_id;
  57 + }
  58 +
  59 + public String getChapter_id() {
  60 + return this.chapter_id;
  61 + }
  62 +
  63 + public void setProblem_type_id(String problem_type_id) {
  64 + this.problem_type_id = problem_type_id;
  65 + }
  66 +
  67 + public String getProblem_type_id() {
  68 + return this.problem_type_id;
  69 + }
  70 +
  71 + public void setKnowledge_id(String knowledge_id) {
  72 + this.knowledge_id = knowledge_id;
  73 + }
  74 +
  75 + public String getKnowledge_id() {
  76 + return this.knowledge_id;
  77 + }
  78 +
  79 + public void setContent(String content) {
  80 + this.content = content;
  81 + }
  82 +
  83 + public String getContent() {
  84 + return this.content;
  85 + }
  86 +
  87 + public void setOption_num(String option_num) {
  88 + this.option_num = option_num;
  89 + }
  90 +
  91 + public String getOption_num() {
  92 + return this.option_num;
  93 + }
  94 +
  95 + public void setOption_content(String option_content) {
  96 + this.option_content = option_content;
  97 + }
  98 +
  99 + public String getOption_content() {
  100 + return this.option_content;
  101 + }
  102 +
  103 + public void setAnswer(String answer) {
  104 + this.answer = answer;
  105 + }
  106 +
  107 + public String getAnswer() {
  108 + return this.answer;
  109 + }
  110 +
  111 + public void setDifficulty(String difficulty) {
  112 + this.difficulty = difficulty;
  113 + }
  114 +
  115 + public String getDifficulty() {
  116 + return this.difficulty;
  117 + }
  118 +
  119 + public void setAnalysis(String analysis) {
  120 + this.analysis = analysis;
  121 + }
  122 +
  123 + public String getAnalysis() {
  124 + return this.analysis;
  125 + }
  126 +
  127 + public void setQuestion_from(String question_from) {
  128 + this.question_from = question_from;
  129 + }
  130 +
  131 + public String getQuestion_from() {
  132 + return this.question_from;
  133 + }
  134 +
  135 + public void setScore(String score) {
  136 + this.score = score;
  137 + }
  138 +
  139 + public String getScore() {
  140 + return this.score;
  141 + }
  142 +
  143 + public void setPart_score(String part_score) {
  144 + this.part_score = part_score;
  145 + }
  146 +
  147 + public String getPart_score() {
  148 + return this.part_score;
  149 + }
  150 +
  151 + public void setRemark(String remark) {
  152 + this.remark = remark;
  153 + }
  154 +
  155 + public String getRemark() {
  156 + return this.remark;
  157 + }
  158 +
  159 + public void setRank(String rank) {
  160 + this.rank = rank;
  161 + }
  162 +
  163 + public String getRank() {
  164 + return this.rank;
  165 + }
  166 +
  167 + public void setNo_name(String no_rank) {
  168 + this.no_name = no_rank;
  169 + }
  170 +
  171 + public String getNo_name() {
  172 + return this.no_name;
  173 + }
  174 +
  175 + public void setSug_score(String sug_score){
  176 + this.sug_score = sug_score ;
  177 + }
  178 + public void setSug_part_score(String sug_part_score){
  179 + this.sug_part_score = sug_part_score ;
  180 + }
  181 +
  182 + public String getSug_score(){
  183 + return this.sug_score;
  184 + }
  185 + public String getSug_part_score(){
  186 + return this.sug_part_score;
  187 + }
  188 +
  189 +
  190 +
  191 + public String getQuestion_id() {
  192 + return question_id;
  193 + }
  194 +
  195 + public void setQuestion_id(String question_id) {
  196 + this.question_id = question_id;
  197 + }
  198 +
  199 + public void setQuestions(List<Question> questions) {
  200 + this.questions = questions;
  201 + }
  202 +
  203 + public List<Question> getQuestions() {
  204 + return this.questions;
  205 + }
  206 +
  207 +}
src/com/fh/controller/api/ResponseGson.java
@@ -8,7 +8,7 @@ public class ResponseGson&lt;T&gt; { @@ -8,7 +8,7 @@ public class ResponseGson&lt;T&gt; {
8 8
9 private String message = "success"; 9 private String message = "success";
10 10
11 - private T data; 11 + private Object data;
12 12
13 public String getCode() { 13 public String getCode() {
14 return code; 14 return code;
@@ -26,7 +26,7 @@ public class ResponseGson&lt;T&gt; { @@ -26,7 +26,7 @@ public class ResponseGson&lt;T&gt; {
26 this.message = message; 26 this.message = message;
27 } 27 }
28 28
29 - public T getData() { 29 + public Object getData() {
30 return data; 30 return data;
31 } 31 }
32 32
@@ -35,6 +35,9 @@ public class ResponseGson&lt;T&gt; { @@ -35,6 +35,9 @@ public class ResponseGson&lt;T&gt; {
35 } 35 }
36 36
37 public String toJson(){ 37 public String toJson(){
  38 + if(data == null){
  39 + data = new Object();
  40 + }
38 Gson gson = new Gson(); 41 Gson gson = new Gson();
39 return gson.toJson(this); 42 return gson.toJson(this);
40 } 43 }
src/com/fh/controller/api/V.java 0 → 100644
  1 +package com.fh.controller.api;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.annotation.Resource;
  6 +
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.ResponseBody;
  10 +
  11 +import com.fh.controller.base.BaseController;
  12 +import com.fh.service.feedback.feedback.FeedbackManager;
  13 +import com.fh.service.feedback.problemphenomenon.ProblemPhenomenonManager;
  14 +import com.fh.service.sunvote.basestation.BasestationManager;
  15 +import com.fh.service.sunvote.chapter.ChapterManager;
  16 +import com.fh.service.sunvote.classbasetation.ClassBasetationManager;
  17 +import com.fh.service.sunvote.classroster.ClassRosterManager;
  18 +import com.fh.service.sunvote.classtype.ClassTypeManager;
  19 +import com.fh.service.sunvote.coursemanagement.CourseManagementManager;
  20 +import com.fh.service.sunvote.grade.GradeManager;
  21 +import com.fh.service.sunvote.keypad.KeypadManager;
  22 +import com.fh.service.sunvote.keypadcheck.KeypadCheckManager;
  23 +import com.fh.service.sunvote.knowledge.KnowledgeManager;
  24 +import com.fh.service.sunvote.knowledgechapter.KnowledgeChapterManager;
  25 +import com.fh.service.sunvote.paper.PaperManager;
  26 +import com.fh.service.sunvote.paperclassteacher.PaperClassTeacherManager;
  27 +import com.fh.service.sunvote.paperquestion.PaperQuestionManager;
  28 +import com.fh.service.sunvote.papertype.PaperTypeManager;
  29 +import com.fh.service.sunvote.question.QuestionManager;
  30 +import com.fh.service.sunvote.questiontype.QuestionTypeManager;
  31 +import com.fh.service.sunvote.school.SchoolManager;
  32 +import com.fh.service.sunvote.schoolgradesubject.SchoolGradeSubjectManager;
  33 +import com.fh.service.sunvote.sclass.SClassManager;
  34 +import com.fh.service.sunvote.student.StudentManager;
  35 +import com.fh.service.sunvote.subject.SubjectManager;
  36 +import com.fh.service.sunvote.teacher.TeacherManager;
  37 +import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager;
  38 +import com.fh.util.PageData;
  39 +
  40 +
  41 +@Controller
  42 +@RequestMapping(value = "/api/v")
  43 +public class V extends BaseController {
  44 +
  45 + @Resource(name = "schoolService")
  46 + private SchoolManager schoolService;
  47 +
  48 + @RequestMapping(value = "/school/list", produces = "application/json;charset=UTF-8")
  49 + @ResponseBody
  50 + public Object schoolList() throws Exception {
  51 + PageData pd = this.getPageData();
  52 + String id = pd.getString("ID");
  53 + if (id != null && !"".equals(id)) {
  54 + PageData ret = schoolService.findById(pd);
  55 + ResponseGson<PageData> res = new ResponseGson();
  56 + res.setData(ret);
  57 + return res.toJson();
  58 + } else {
  59 + List<PageData> ret = schoolService.listAll(pd);
  60 + ResponseGson<List<PageData>> res = new ResponseGson();
  61 + res.setData(ret);
  62 + return res.toJson();
  63 + }
  64 + }
  65 + @RequestMapping(value = "/school/add", produces = "application/json;charset=UTF-8")
  66 + @ResponseBody
  67 + public Object schoolAdd() throws Exception {
  68 + PageData pd = this.getPageData();
  69 + String id = pd.getString("ID");
  70 + if (id != null && !"".equals(id)) {
  71 + PageData ret = schoolService.findById(pd);
  72 + ResponseGson<PageData> res = new ResponseGson();
  73 + res.setData(ret);
  74 + return res.toJson();
  75 + } else {
  76 + List<PageData> ret = schoolService.listAll(pd);
  77 + ResponseGson<List<PageData>> res = new ResponseGson();
  78 + res.setData(ret);
  79 + return res.toJson();
  80 + }
  81 + }
  82 +
  83 + @Resource(name = "basestationService")
  84 + private BasestationManager basestationService;
  85 +
  86 + @Resource(name="chapterService")
  87 + private ChapterManager chapterService;
  88 +
  89 + @Resource(name="classbasetationService")
  90 + private ClassBasetationManager classbasetationService;
  91 +
  92 + @Resource(name="classrosterService")
  93 + private ClassRosterManager classrosterService;
  94 +
  95 + @Resource(name="classtypeService")
  96 + private ClassTypeManager classtypeService;
  97 +
  98 + @Resource(name="gradeService")
  99 + private GradeManager gradeService;
  100 +
  101 + @Resource(name="coursemanagementService")
  102 + private CourseManagementManager coursemanagementService;
  103 +
  104 + @Resource(name = "keypadService")
  105 + private KeypadManager keypadService;
  106 +
  107 + @Resource(name="keypadcheckService")
  108 + private KeypadCheckManager keypadcheckService;
  109 +
  110 + @Resource(name="knowledgeService")
  111 + private KnowledgeManager knowledgeService;
  112 +
  113 + @Resource(name="knowledgechapterService")
  114 + private KnowledgeChapterManager knowledgechapterService;
  115 +
  116 + @Resource(name="paperService")
  117 + private PaperManager paperService;
  118 +
  119 + @Resource(name="paperclassteacherService")
  120 + private PaperClassTeacherManager paperclassteacherService;
  121 +
  122 + @Resource(name="paperquestionService")
  123 + private PaperQuestionManager paperquestionService;
  124 +
  125 + @Resource(name="papertypeService")
  126 + private PaperTypeManager papertypeService;
  127 +
  128 + @Resource(name="questionService")
  129 + private QuestionManager questionService;
  130 +
  131 + @Resource(name="questiontypeService")
  132 + private QuestionTypeManager questiontypeService;
  133 +
  134 + @Resource(name="schoolgradesubjectService")
  135 + private SchoolGradeSubjectManager schoolgradesubjectService;
  136 +
  137 + @Resource(name="sclassService")
  138 + private SClassManager sclassService;
  139 +
  140 + @Resource(name="studentService")
  141 + private StudentManager studentService;
  142 +
  143 + @Resource(name="subjectService")
  144 + private SubjectManager subjectService;
  145 +
  146 + @Resource(name="teacherService")
  147 + private TeacherManager teacherService;
  148 +
  149 + @Resource(name="testpaperinfoService")
  150 + private TestPaperInfoManager testpaperinfoService;
  151 +
  152 + @Resource(name = "feedbackService")
  153 + private FeedbackManager feedbackService;
  154 +
  155 + @Resource(name = "problemphenomenonService")
  156 + private ProblemPhenomenonManager problemphenomenonService;
  157 +
  158 +
  159 +}
src/com/fh/controller/api/V1.java
1 package com.fh.controller.api; 1 package com.fh.controller.api;
2 2
  3 +import java.util.ArrayList;
3 import java.util.Date; 4 import java.util.Date;
4 import java.util.List; 5 import java.util.List;
5 6
6 import javax.annotation.Resource; 7 import javax.annotation.Resource;
7 8
  9 +import org.apache.commons.lang.StringUtils;
8 import org.springframework.stereotype.Controller; 10 import org.springframework.stereotype.Controller;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.ResponseBody; 12 import org.springframework.web.bind.annotation.ResponseBody;
11 13
  14 +import com.fh.bean.Paper;
  15 +import com.fh.bean.Question;
12 import com.fh.controller.base.BaseController; 16 import com.fh.controller.base.BaseController;
  17 +import com.fh.controller.sunvote.Myelfun;
13 import com.fh.entity.Page; 18 import com.fh.entity.Page;
14 import com.fh.service.api.V1Manager; 19 import com.fh.service.api.V1Manager;
15 import com.fh.service.feedback.feedback.FeedbackManager; 20 import com.fh.service.feedback.feedback.FeedbackManager;
@@ -227,6 +232,8 @@ public class V1 extends BaseController { @@ -227,6 +232,8 @@ public class V1 extends BaseController {
227 } 232 }
228 List<PageData> pageList = paperService.listAllByType(page); 233 List<PageData> pageList = paperService.listAllByType(page);
229 res.setData(pageList); 234 res.setData(pageList);
  235 + }else{
  236 + res.setParmError();
230 } 237 }
231 return res.toJson(); 238 return res.toJson();
232 } 239 }
@@ -235,13 +242,75 @@ public class V1 extends BaseController { @@ -235,13 +242,75 @@ public class V1 extends BaseController {
235 @ResponseBody 242 @ResponseBody
236 public Object testpaper() throws Exception { 243 public Object testpaper() throws Exception {
237 PageData pd = this.getPageData(); 244 PageData pd = this.getPageData();
238 - ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>(); 245 + ResponseGson<Paper> res = new ResponseGson<Paper>();
239 if(pd.containsKey("PAPER_ID")){ 246 if(pd.containsKey("PAPER_ID")){
240 try{ 247 try{
  248 + Paper paper = new Paper();
  249 + PageData ppd = paperService.findById(pd);
  250 + if(ppd != null){
  251 + paper.setTitle(ppd.getString("TITLE"));
  252 + paper.setExam_time(ppd.getString("EXAM_TIME"));
  253 + paper.setTitle(ppd.getString("USER_ID"));
  254 + paper.setPaper_type(ppd.getString("PAPER_TYPE"));
  255 + paper.setSubject_id(ppd.getString("SUBJECT_ID"));
  256 + paper.setGrade_id(ppd.getString("GRADE_ID"));
  257 + paper.setScore(ppd.getString("SCORE"));
  258 + paper.setQuestions(new ArrayList<Question>());
  259 +
241 List<PageData> questList = v1Service.getTestPaperInfo(pd); 260 List<PageData> questList = v1Service.getTestPaperInfo(pd);
242 - res.setData(questList); 261 + for(PageData qpd : questList){
  262 + Question question = new Question();
  263 + question.setAnswer(qpd.getString("ANSWER"));
  264 + question.setQuestion_id(qpd.getString("QUESTION_ID"));
  265 + question.setSubject_id(qpd.getString("SUBJECT_ID"));
  266 + question.setChapter_id(qpd.getString("CHAPTER_ID"));
  267 + question.setProblem_type_id(qpd.getString("PROBLEM_TYPE_ID"));
  268 + question.setKnowledge_id(qpd.getString("KNOWLEDGE_ID"));
  269 + question.setContent(qpd.getString("CONTENT"));
  270 + question.setOption_num(qpd.getString("OPTION_NUM"));
  271 + question.setOption_content(qpd.getString("OPTION_CONTENT"));
  272 + question.setDifficulty(qpd.getString("DIFFICULTY"));
  273 + question.setAnalysis(qpd.getString("ANALYSIS"));
  274 + question.setQuestion_from(qpd.getString("QUESTION_FROM"));
  275 + question.setSug_score(qpd.getString("SUG_SCORE"));
  276 + question.setSug_part_score(qpd.getString("SUG_PART_SCORE"));
  277 + question.setRank(qpd.getString("RANK"));
  278 + question.setNo_name(qpd.getString("NO_NAME"));
  279 + if("-1".equals(qpd.getString("PID"))){
  280 + PageData pidPd = new PageData();
  281 + pidPd.put("PID", question.getQuestion_id());
  282 + question.setQuestions(new ArrayList<Question>());
  283 + List<PageData> qs = v1Service.getQuestionsByPID(pidPd);
  284 + for(PageData q : qs){
  285 + Question qq = new Question();
  286 + qq.setAnswer(q.getString("ANSWER"));
  287 + qq.setQuestion_id(q.getString("QUESTION_ID"));
  288 + qq.setSubject_id(q.getString("SUBJECT_ID"));
  289 + qq.setChapter_id(q.getString("CHAPTER_ID"));
  290 + qq.setProblem_type_id(q.getString("PROBLEM_TYPE_ID"));
  291 + qq.setKnowledge_id(q.getString("KNOWLEDGE_ID"));
  292 + qq.setContent(q.getString("CONTENT"));
  293 + qq.setOption_num(q.getString("OPTION_NUM"));
  294 + qq.setOption_content(q.getString("OPTION_CONTENT"));
  295 + qq.setDifficulty(q.getString("DIFFICULTY"));
  296 + qq.setAnalysis(q.getString("ANALYSIS"));
  297 + qq.setQuestion_from(q.getString("QUESTION_FROM"));
  298 + qq.setSug_score(q.getString("SUG_SCORE"));
  299 + qq.setSug_part_score(q.getString("SUG_PART_SCORE"));
  300 + qq.setRank(q.getString("RANK"));
  301 + qq.setNo_name(q.getString("NO_NAME"));
  302 + question.getQuestions().add(qq);
  303 + }
  304 + }
  305 + paper.getQuestions().add(question);
  306 + }
  307 +
  308 +
  309 + res.setData(paper);
  310 + }
243 }catch(Exception ex){ 311 }catch(Exception ex){
244 - res.setOtherError(); 312 + ex.printStackTrace();
  313 + res.setError();
245 } 314 }
246 }else{ 315 }else{
247 res.setOtherError(); 316 res.setOtherError();
@@ -258,4 +327,125 @@ public class V1 extends BaseController { @@ -258,4 +327,125 @@ public class V1 extends BaseController {
258 return res.toJson(); 327 return res.toJson();
259 } 328 }
260 329
  330 +
  331 + @RequestMapping(value = "/uploadpaper", produces = "application/json;charset=UTF-8")
  332 + @ResponseBody
  333 + public Object uploadpaper() throws Exception {
  334 + PageData pd = this.getPageData();
  335 + ResponseGson<String> res = new ResponseGson();
  336 +
  337 + if(!StringUtils.isEmpty(pd.getJsonString())){
  338 + Paper paper = Paper.parse(pd.getJsonString());
  339 + PageData paperPd = new PageData();
  340 + String paperID = this.get32UUID();
  341 + res.setData(paperID);
  342 + paperPd.put("PAPER_ID", paperID);
  343 + paperPd.put("TITLE", paper.getTitle());
  344 + paperPd.put("USER_ID", paper.getUser_id());
  345 + paperPd.put("PAPER_TYPE", paper.getPaper_type());
  346 + paperPd.put("SUBJECT_ID", paper.getSubject_id());
  347 + paperPd.put("GRADE_ID", paper.getGrade_id());
  348 + paperPd.put("EXAM_TIME", paper.getExam_time());
  349 + paperPd.put("SCORE", paper.getScore());
  350 + paperPd.put("PAPER_STATE", "0");
  351 + paperPd.put("REMARK", "");
  352 + String schoolID = Myelfun.getUserID(paper.getUser_id());
  353 + paperPd.put("SCHOOL_ID", schoolID);
  354 + paperPd.put("CREATE_DATE", Tools.date2Str(new Date()));
  355 + paperPd.put("MODIFY_DATE", Tools.date2Str(new Date()));
  356 +
  357 + paperService.save(paperPd);
  358 +
  359 + List<Question> questions = paper.getQuestions();
  360 + if(questions != null){
  361 + for(Question question : questions){
  362 + String questionID = this.get32UUID();
  363 + PageData qPd = new PageData();
  364 + qPd.put("QUESTION_ID", questionID);
  365 + if(question.getQuestions() != null && question.getQuestions().size() > 0){
  366 + qPd.put("P_ID", "-1");
  367 + }else{
  368 + qPd.put("P_ID", "0");
  369 + }
  370 + qPd.put("SUBJECT_ID", paper.getSubject_id());
  371 + qPd.put("CHAPTER_ID", question.getChapter_id());
  372 + qPd.put("PROBLEM_TYPE_ID", question.getProblem_type_id());
  373 + qPd.put("TEACHER_ID", paper.getUser_id());
  374 + qPd.put("SCHOOL_ID", schoolID);
  375 + qPd.put("KNOWLEDGE_ID", question.getKnowledge_id());
  376 + qPd.put("CONTENT", question.getContent());
  377 + qPd.put("OPTION_NUM", question.getOption_num());
  378 + qPd.put("OPTION_CONTENT", question.getOption_content());
  379 + qPd.put("ANSWER", question.getAnswer());
  380 + qPd.put("DIFFICULTY", question.getDifficulty());
  381 + qPd.put("ANALYSIS", question.getAnalysis());
  382 + qPd.put("QUESTION_FROM", question.getQuestion_from());
  383 + qPd.put("SUG_SCORE", question.getScore());
  384 + qPd.put("SUG_PART_SCORE", question.getPart_score());
  385 + qPd.put("USER_ID", paper.getUser_id());
  386 + qPd.put("CREATE_DATE", Tools.date2Str(new Date()));
  387 + qPd.put("REMARK", "");
  388 + questionService.save(qPd);
  389 +
  390 + PageData pqPd = new PageData();
  391 + pqPd.put("PAPER_ID",paperID);
  392 + pqPd.put("QUESTION_ID",questionID);
  393 + pqPd.put("SCORE",question.getScore());
  394 + pqPd.put("PART_SCORE","0");
  395 + pqPd.put("RANK",question.getRank());
  396 + pqPd.put("NO_NAME",question.getNo_name());
  397 + pqPd.put("PAPERQUESTION_ID",this.get32UUID());
  398 + paperquestionService.save(pqPd);
  399 +
  400 +
  401 + if(question.getQuestions() != null){
  402 + List<Question> qs = question.getQuestions();
  403 + for(Question q : qs){
  404 + String qID = this.get32UUID();
  405 + PageData cqPd = new PageData();
  406 + cqPd.put("QUESTION_ID", qID);
  407 + cqPd.put("P_ID", questionID);
  408 + cqPd.put("SUBJECT_ID", paper.getSubject_id());
  409 + cqPd.put("CHAPTER_ID", q.getChapter_id());
  410 + cqPd.put("PROBLEM_TYPE_ID", q.getProblem_type_id());
  411 + cqPd.put("TEACHER_ID", paper.getUser_id());
  412 + cqPd.put("SCHOOL_ID", schoolID);
  413 + cqPd.put("KNOWLEDGE_ID", q.getKnowledge_id());
  414 + cqPd.put("CONTENT", q.getContent());
  415 + cqPd.put("OPTION_NUM", q.getOption_num());
  416 + cqPd.put("OPTION_CONTENT", q.getOption_content());
  417 + cqPd.put("ANSWER", q.getAnswer());
  418 + cqPd.put("DIFFICULTY", q.getDifficulty());
  419 + cqPd.put("ANALYSIS", q.getAnalysis());
  420 + cqPd.put("QUESTION_FROM", q.getQuestion_from());
  421 + cqPd.put("SUG_SCORE", q.getScore());
  422 + cqPd.put("SUG_PART_SCORE", q.getSug_part_score());
  423 + cqPd.put("USER_ID", paper.getUser_id());
  424 + cqPd.put("CREATE_DATE", Tools.date2Str(new Date()));
  425 + cqPd.put("REMARK", "");
  426 +
  427 + questionService.save(cqPd);
  428 +
  429 + PageData cpqPd = new PageData();
  430 + cpqPd.put("PAPER_ID",paperID);
  431 + cpqPd.put("QUESTION_ID",qID);
  432 + cpqPd.put("SCORE",q.getScore());
  433 + cpqPd.put("PART_SCORE","0");
  434 + cpqPd.put("RANK",q.getRank());
  435 + cpqPd.put("NO_NAME",q.getNo_name());
  436 + cpqPd.put("PAPERQUESTION_ID",this.get32UUID());
  437 +
  438 + paperquestionService.save(cpqPd);
  439 + }
  440 + }
  441 + }
  442 + }
  443 +
  444 + }else{
  445 + res.setDataError();
  446 + }
  447 +
  448 + return res.toJson();
  449 + }
  450 +
261 } 451 }
src/com/fh/controller/api/V2.java 0 → 100644
  1 +package com.fh.controller.api;
  2 +
  3 +import org.springframework.stereotype.Controller;
  4 +import org.springframework.web.bind.annotation.RequestMapping;
  5 +
  6 +import com.fh.controller.base.BaseController;
  7 +
  8 +@Controller
  9 +@RequestMapping(value = "/api/v2")
  10 +public class V2 extends BaseController {
  11 +
  12 +
  13 +
  14 +}
src/com/fh/controller/base/BaseController.java
@@ -81,4 +81,6 @@ public class BaseController { @@ -81,4 +81,6 @@ public class BaseController {
81 } 81 }
82 return "ERROR"; 82 return "ERROR";
83 } 83 }
  84 +
  85 +
84 } 86 }
src/com/fh/controller/sunvote/Myelfun.java
@@ -9,6 +9,7 @@ import com.fh.service.sunvote.questiontype.QuestionTypeManager; @@ -9,6 +9,7 @@ import com.fh.service.sunvote.questiontype.QuestionTypeManager;
9 import com.fh.service.sunvote.school.impl.SchoolService; 9 import com.fh.service.sunvote.school.impl.SchoolService;
10 import com.fh.service.sunvote.sclass.impl.SClassService; 10 import com.fh.service.sunvote.sclass.impl.SClassService;
11 import com.fh.service.sunvote.subject.impl.SubjectService; 11 import com.fh.service.sunvote.subject.impl.SubjectService;
  12 +import com.fh.service.sunvote.teacher.TeacherManager;
12 import com.fh.service.sunvote.teacher.impl.TeacherService; 13 import com.fh.service.sunvote.teacher.impl.TeacherService;
13 import com.fh.service.sunvote.teachingmaterial.impl.TeachingMaterialService; 14 import com.fh.service.sunvote.teachingmaterial.impl.TeachingMaterialService;
14 import com.fh.util.PageData; 15 import com.fh.util.PageData;
@@ -197,4 +198,20 @@ public class Myelfun { @@ -197,4 +198,20 @@ public class Myelfun {
197 } 198 }
198 } 199 }
199 200
  201 + public static String getUserID(String user_id){
  202 + TeacherManager teacherService = (TeacherManager)SpringBeanFactoryUtils.getBean("teacherService");
  203 + PageData pd = new PageData();
  204 + pd.put("ID", user_id);
  205 + try {
  206 + pd = teacherService.findById(pd);
  207 + } catch (Exception e) {
  208 + e.printStackTrace();
  209 + }
  210 + if(pd != null){
  211 + return pd.getString("SCHOOL_ID");
  212 + }else{
  213 + return "" ;
  214 + }
  215 + }
  216 +
200 } 217 }
src/com/fh/controller/sunvote/paper/PaperController.java
@@ -8,7 +8,10 @@ import java.util.Date; @@ -8,7 +8,10 @@ import java.util.Date;
8 import java.util.HashMap; 8 import java.util.HashMap;
9 import java.util.List; 9 import java.util.List;
10 import java.util.Map; 10 import java.util.Map;
  11 +
11 import javax.annotation.Resource; 12 import javax.annotation.Resource;
  13 +
  14 +import org.apache.shiro.session.Session;
12 import org.springframework.beans.propertyeditors.CustomDateEditor; 15 import org.springframework.beans.propertyeditors.CustomDateEditor;
13 import org.springframework.stereotype.Controller; 16 import org.springframework.stereotype.Controller;
14 import org.springframework.web.bind.WebDataBinder; 17 import org.springframework.web.bind.WebDataBinder;
@@ -16,14 +19,21 @@ import org.springframework.web.bind.annotation.InitBinder; @@ -16,14 +19,21 @@ import org.springframework.web.bind.annotation.InitBinder;
16 import org.springframework.web.bind.annotation.RequestMapping; 19 import org.springframework.web.bind.annotation.RequestMapping;
17 import org.springframework.web.bind.annotation.ResponseBody; 20 import org.springframework.web.bind.annotation.ResponseBody;
18 import org.springframework.web.servlet.ModelAndView; 21 import org.springframework.web.servlet.ModelAndView;
  22 +
  23 +import com.fh.bean.Paper;
  24 +import com.fh.bean.Question;
19 import com.fh.controller.base.BaseController; 25 import com.fh.controller.base.BaseController;
20 import com.fh.entity.Page; 26 import com.fh.entity.Page;
  27 +import com.fh.entity.system.User;
21 import com.fh.util.AppUtil; 28 import com.fh.util.AppUtil;
  29 +import com.fh.util.Const;
22 import com.fh.util.ObjectExcelView; 30 import com.fh.util.ObjectExcelView;
23 import com.fh.util.PageData; 31 import com.fh.util.PageData;
24 import com.fh.util.Jurisdiction; 32 import com.fh.util.Jurisdiction;
25 import com.fh.util.Tools; 33 import com.fh.util.Tools;
  34 +import com.fh.service.api.V1Manager;
26 import com.fh.service.sunvote.paper.PaperManager; 35 import com.fh.service.sunvote.paper.PaperManager;
  36 +import com.fh.service.sunvote.paperquestion.PaperQuestionManager;
27 37
28 /** 38 /**
29 * 说明:试卷 39 * 说明:试卷
@@ -37,6 +47,12 @@ public class PaperController extends BaseController { @@ -37,6 +47,12 @@ public class PaperController extends BaseController {
37 @Resource(name="paperService") 47 @Resource(name="paperService")
38 private PaperManager paperService; 48 private PaperManager paperService;
39 49
  50 + @Resource(name="paperquestionService")
  51 + private PaperQuestionManager paperquestionService;
  52 +
  53 + @Resource(name = "v1Service")
  54 + private V1Manager v1Service ;
  55 +
40 /**保存 56 /**保存
41 * @param 57 * @param
42 * @throws Exception 58 * @throws Exception
@@ -55,6 +71,20 @@ public class PaperController extends BaseController { @@ -55,6 +71,20 @@ public class PaperController extends BaseController {
55 return mv; 71 return mv;
56 } 72 }
57 73
  74 + /**保存
  75 + * @param
  76 + * @throws Exception
  77 + */
  78 + @RequestMapping(value="/newpaper")
  79 + public ModelAndView newPaper() throws Exception{
  80 + logBefore(logger, Jurisdiction.getUsername()+"新增Paper");
  81 + ModelAndView mv = this.getModelAndView();
  82 +
  83 + mv.addObject("msg","success");
  84 + mv.setViewName("save_result");
  85 + return mv;
  86 + }
  87 +
58 /**删除 88 /**删除
59 * @param out 89 * @param out
60 * @throws Exception 90 * @throws Exception
@@ -62,9 +92,11 @@ public class PaperController extends BaseController { @@ -62,9 +92,11 @@ public class PaperController extends BaseController {
62 @RequestMapping(value="/delete") 92 @RequestMapping(value="/delete")
63 public void delete(PrintWriter out) throws Exception{ 93 public void delete(PrintWriter out) throws Exception{
64 logBefore(logger, Jurisdiction.getUsername()+"删除Paper"); 94 logBefore(logger, Jurisdiction.getUsername()+"删除Paper");
65 - if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限 95 +// if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限
66 PageData pd = new PageData(); 96 PageData pd = new PageData();
67 pd = this.getPageData(); 97 pd = this.getPageData();
  98 + String[] ArrayDATA_IDS = new String[]{pd.getString("PAPER_ID")};
  99 + paperquestionService.deleteAllPaper(ArrayDATA_IDS);
68 paperService.delete(pd); 100 paperService.delete(pd);
69 out.write("success"); 101 out.write("success");
70 out.close(); 102 out.close();
@@ -111,6 +143,173 @@ public class PaperController extends BaseController { @@ -111,6 +143,173 @@ public class PaperController extends BaseController {
111 return mv; 143 return mv;
112 } 144 }
113 145
  146 + @RequestMapping(value="/iteminfo")
  147 + public ModelAndView iteminfo() throws Exception{
  148 + logBefore(logger, Jurisdiction.getUsername()+"Paper详细信息");
  149 + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
  150 + ModelAndView mv = this.getModelAndView();
  151 + PageData pd = new PageData();
  152 + pd = this.getPageData();
  153 +
  154 + if(pd.containsKey("PAPER_ID")){
  155 + try{
  156 + Paper paper = new Paper();
  157 + PageData ppd = paperService.findById(pd);
  158 + if(ppd != null){
  159 + paper.setTitle(ppd.getString("TITLE"));
  160 + paper.setExam_time(ppd.getString("EXAM_TIME"));
  161 + paper.setUser_id(ppd.getString("USER_ID"));
  162 + paper.setPaper_type(ppd.getString("PAPER_TYPE"));
  163 + paper.setSubject_id(ppd.getString("SUBJECT_ID"));
  164 + paper.setGrade_id(ppd.getString("GRADE_ID"));
  165 + paper.setScore(ppd.getString("SCORE"));
  166 + paper.setQuestions(new ArrayList<Question>());
  167 +
  168 + List<PageData> questList = v1Service.getTestPaperInfo(pd);
  169 + for(PageData qpd : questList){
  170 + Question question = new Question();
  171 + question.setAnswer(qpd.getString("ANSWER"));
  172 + question.setQuestion_id(qpd.getString("QUESTION_ID"));
  173 + question.setSubject_id(qpd.getString("SUBJECT_ID"));
  174 + question.setChapter_id(qpd.getString("CHAPTER_ID"));
  175 + question.setProblem_type_id(qpd.getString("PROBLEM_TYPE_ID"));
  176 + question.setKnowledge_id(qpd.getString("KNOWLEDGE_ID"));
  177 + question.setContent(qpd.getString("CONTENT"));
  178 + question.setOption_num(qpd.getString("OPTION_NUM"));
  179 + question.setOption_content(qpd.getString("OPTION_CONTENT"));
  180 + question.setDifficulty(qpd.getString("DIFFICULTY"));
  181 + question.setAnalysis(qpd.getString("ANALYSIS"));
  182 + question.setQuestion_from(qpd.getString("QUESTION_FROM"));
  183 + question.setSug_score(qpd.getString("SUG_SCORE"));
  184 + question.setSug_part_score(qpd.getString("SUG_PART_SCORE"));
  185 + question.setRank(qpd.getString("RANK"));
  186 + question.setNo_name(qpd.getString("NO_NAME"));
  187 + if("-1".equals("" + qpd.getString("P_ID"))){
  188 + PageData pidPd = new PageData();
  189 + pidPd.put("PID", question.getQuestion_id());
  190 + question.setQuestions(new ArrayList<Question>());
  191 + List<PageData> qs = v1Service.getQuestionsByPID(pidPd);
  192 + for(PageData q : qs){
  193 + Question qq = new Question();
  194 + qq.setAnswer(q.getString("ANSWER"));
  195 + qq.setQuestion_id(q.getString("QUESTION_ID"));
  196 + qq.setSubject_id(q.getString("SUBJECT_ID"));
  197 + qq.setChapter_id(q.getString("CHAPTER_ID"));
  198 + qq.setProblem_type_id(q.getString("PROBLEM_TYPE_ID"));
  199 + qq.setKnowledge_id(q.getString("KNOWLEDGE_ID"));
  200 + qq.setContent(q.getString("CONTENT"));
  201 + qq.setOption_num(q.getString("OPTION_NUM"));
  202 + qq.setOption_content(q.getString("OPTION_CONTENT"));
  203 + qq.setDifficulty(q.getString("DIFFICULTY"));
  204 + qq.setAnalysis(q.getString("ANALYSIS"));
  205 + qq.setQuestion_from(q.getString("QUESTION_FROM"));
  206 + qq.setSug_score(q.getString("SUG_SCORE"));
  207 + qq.setSug_part_score(q.getString("SUG_PART_SCORE"));
  208 + qq.setRank(q.getString("RANK"));
  209 + qq.setNo_name(q.getString("NO_NAME"));
  210 + question.getQuestions().add(qq);
  211 + }
  212 + }
  213 + if("-1".equals(qpd.getString("P_ID")) || "0".equals(qpd.getString("P_ID"))){
  214 + paper.getQuestions().add(question);
  215 + }
  216 + }
  217 + pd.put("JSON", paper.toJson());
  218 + logger.info(paper.toJson());
  219 +
  220 + }
  221 + }catch(Exception ex){
  222 + ex.printStackTrace();
  223 + }
  224 + }
  225 + mv.setViewName("sunvote/teacher/creat_question");
  226 + mv.addObject("pd", pd);
  227 + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
  228 + return mv;
  229 + }
  230 +
  231 +
  232 + @RequestMapping(value="/npaper")
  233 + public ModelAndView newpaper() throws Exception{
  234 + logBefore(logger, Jurisdiction.getUsername()+"Paper详细信息");
  235 + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
  236 + ModelAndView mv = this.getModelAndView();
  237 + PageData pd = new PageData();
  238 + pd = this.getPageData();
  239 + Paper paper = new Paper();
  240 + paper.setTitle(pd.getString("NAME"));
  241 + paper.setExam_time(pd.getString("TIME"));
  242 + Session session = Jurisdiction.getSession();
  243 + User user = (User)session.getAttribute(Const.SESSION_USER);
  244 + paper.setUser_id(user.getUSER_ID());
  245 + paper.setPaper_type("1");
  246 + paper.setSubject_id("1");
  247 + paper.setGrade_id("1");
  248 + paper.setQuestions(new ArrayList<Question>());
  249 + pd.put("JSON", paper.toJson());
  250 + logger.info(paper.toJson());
  251 +
  252 + mv.setViewName("sunvote/teacher/creat_question");
  253 + mv.addObject("pd", pd);
  254 + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
  255 + return mv;
  256 + }
  257 +
  258 +
  259 +
  260 + /**列表
  261 + * @param page
  262 + * @throws Exception
  263 + */
  264 + @RequestMapping(value="/list2")
  265 + public ModelAndView list2(Page page) throws Exception{
  266 + logBefore(logger, Jurisdiction.getUsername()+"列表Paper");
  267 + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
  268 + ModelAndView mv = this.getModelAndView();
  269 + PageData pd = new PageData();
  270 + pd = this.getPageData();
  271 + String keywords = pd.getString("keywords"); //关键词检索条件
  272 + if(null != keywords && !"".equals(keywords)){
  273 + pd.put("keywords", keywords.trim());
  274 + }
  275 + page.setPd(pd);
  276 + List<PageData> varList = paperService.list(page); //列出Paper列表
  277 + mv.setViewName("sunvote/paper/paper_list2");
  278 +
  279 + for(PageData p:varList){
  280 + String examTime = p.getString("EXAM_TIME");
  281 + if(examTime != null){
  282 + try{
  283 + int et = Integer.parseInt(examTime);
  284 + String min = (et / 60 ) + "" ;
  285 + if(min.length() < 2){
  286 + min = "0" + min ;
  287 + }
  288 + String sec = (et % 60 ) + "" ;
  289 + if(sec.length() < 2){
  290 + sec = "0" + sec ;
  291 + }
  292 + if(et > 60){
  293 + examTime = min + ":" + sec;
  294 + }else{
  295 + examTime = "00:" + sec;
  296 + }
  297 + }catch(Exception e){
  298 + e.printStackTrace();
  299 + }
  300 + }
  301 + if(examTime == null){
  302 + examTime = "00:00";
  303 + }
  304 + p.put("EXAM_TIME", examTime);
  305 + }
  306 +
  307 + mv.addObject("varList", varList);
  308 + mv.addObject("pd", pd);
  309 + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
  310 + return mv;
  311 + }
  312 +
114 /**去新增页面 313 /**去新增页面
115 * @param 314 * @param
116 * @throws Exception 315 * @throws Exception
@@ -126,6 +325,21 @@ public class PaperController extends BaseController { @@ -126,6 +325,21 @@ public class PaperController extends BaseController {
126 return mv; 325 return mv;
127 } 326 }
128 327
  328 + /**去新增页面
  329 + * @param
  330 + * @throws Exception
  331 + */
  332 + @RequestMapping(value="/goAddTest")
  333 + public ModelAndView goAddTest()throws Exception{
  334 + ModelAndView mv = this.getModelAndView();
  335 + PageData pd = new PageData();
  336 + pd = this.getPageData();
  337 + mv.setViewName("sunvote/paper/paper_edit2");
  338 + mv.addObject("msg", "newpaper");
  339 + mv.addObject("pd", pd);
  340 + return mv;
  341 + }
  342 +
129 /**去修改页面 343 /**去修改页面
130 * @param 344 * @param
131 * @throws Exception 345 * @throws Exception
@@ -150,7 +364,7 @@ public class PaperController extends BaseController { @@ -150,7 +364,7 @@ public class PaperController extends BaseController {
150 @ResponseBody 364 @ResponseBody
151 public Object deleteAll() throws Exception{ 365 public Object deleteAll() throws Exception{
152 logBefore(logger, Jurisdiction.getUsername()+"批量删除Paper"); 366 logBefore(logger, Jurisdiction.getUsername()+"批量删除Paper");
153 - if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限 367 +// if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限
154 PageData pd = new PageData(); 368 PageData pd = new PageData();
155 Map<String,Object> map = new HashMap<String,Object>(); 369 Map<String,Object> map = new HashMap<String,Object>();
156 pd = this.getPageData(); 370 pd = this.getPageData();
@@ -159,6 +373,7 @@ public class PaperController extends BaseController { @@ -159,6 +373,7 @@ public class PaperController extends BaseController {
159 if(null != DATA_IDS && !"".equals(DATA_IDS)){ 373 if(null != DATA_IDS && !"".equals(DATA_IDS)){
160 String ArrayDATA_IDS[] = DATA_IDS.split(","); 374 String ArrayDATA_IDS[] = DATA_IDS.split(",");
161 paperService.deleteAll(ArrayDATA_IDS); 375 paperService.deleteAll(ArrayDATA_IDS);
  376 + paperquestionService.deleteAllPaper(ArrayDATA_IDS);
162 pd.put("msg", "ok"); 377 pd.put("msg", "ok");
163 }else{ 378 }else{
164 pd.put("msg", "no"); 379 pd.put("msg", "no");
src/com/fh/controller/system/login/LoginController.java
@@ -21,7 +21,10 @@ import org.springframework.web.bind.annotation.ResponseBody; @@ -21,7 +21,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
21 import org.springframework.web.servlet.ModelAndView; 21 import org.springframework.web.servlet.ModelAndView;
22 22
23 import com.fh.controller.base.BaseController; 23 import com.fh.controller.base.BaseController;
  24 +import com.fh.service.api.V1Manager;
24 import com.fh.service.fhoa.datajur.DatajurManager; 25 import com.fh.service.fhoa.datajur.DatajurManager;
  26 +import com.fh.service.sunvote.school.SchoolManager;
  27 +import com.fh.service.sunvote.teacher.TeacherManager;
25 import com.fh.service.system.appuser.AppuserManager; 28 import com.fh.service.system.appuser.AppuserManager;
26 import com.fh.service.system.buttonrights.ButtonrightsManager; 29 import com.fh.service.system.buttonrights.ButtonrightsManager;
27 import com.fh.service.system.fhbutton.FhbuttonManager; 30 import com.fh.service.system.fhbutton.FhbuttonManager;
@@ -70,6 +73,13 @@ public class LoginController extends BaseController { @@ -70,6 +73,13 @@ public class LoginController extends BaseController {
70 private FHlogManager FHLOG; 73 private FHlogManager FHLOG;
71 @Resource(name = "loginimgService") 74 @Resource(name = "loginimgService")
72 private LogInImgManager loginimgService; 75 private LogInImgManager loginimgService;
  76 + @Resource(name="teacherService")
  77 + private TeacherManager teacherService;
  78 + @Resource(name="schoolService")
  79 + private SchoolManager schoolService;
  80 +
  81 + @Resource(name = "v1Service")
  82 + private V1Manager v1Service ;
73 83
74 /** 84 /**
75 * 访问登录页 85 * 访问登录页
@@ -124,6 +134,9 @@ public class LoginController extends BaseController { @@ -124,6 +134,9 @@ public class LoginController extends BaseController {
124 user.setNAME(pd.getString("NAME")); 134 user.setNAME(pd.getString("NAME"));
125 user.setRIGHTS(pd.getString("RIGHTS")); 135 user.setRIGHTS(pd.getString("RIGHTS"));
126 user.setROLE_ID(pd.getString("ROLE_ID")); 136 user.setROLE_ID(pd.getString("ROLE_ID"));
  137 + if("57bb1e6f138247a0b05cc721a5da1b64".equals(pd.getString("ROLE_ID"))){
  138 + map.put("teacher", pd.getString("RIGHTS"));
  139 + }
127 user.setLAST_LOGIN(pd.getString("LAST_LOGIN")); 140 user.setLAST_LOGIN(pd.getString("LAST_LOGIN"));
128 user.setIP(pd.getString("IP")); 141 user.setIP(pd.getString("IP"));
129 user.setSTATUS(pd.getString("STATUS")); 142 user.setSTATUS(pd.getString("STATUS"));
@@ -166,6 +179,7 @@ public class LoginController extends BaseController { @@ -166,6 +179,7 @@ public class LoginController extends BaseController {
166 ModelAndView mv = this.getModelAndView(); 179 ModelAndView mv = this.getModelAndView();
167 PageData pd = new PageData(); 180 PageData pd = new PageData();
168 pd = this.getPageData(); 181 pd = this.getPageData();
  182 +
169 try { 183 try {
170 Session session = Jurisdiction.getSession(); 184 Session session = Jurisdiction.getSession();
171 User user = (User) session.getAttribute(Const.SESSION_USER); // 读取session中的用户信息(单独用户信息) 185 User user = (User) session.getAttribute(Const.SESSION_USER); // 读取session中的用户信息(单独用户信息)
@@ -189,16 +203,25 @@ public class LoginController extends BaseController { @@ -189,16 +203,25 @@ public class LoginController extends BaseController {
189 allmenuList = this.getAttributeMenu(session, USERNAME, 203 allmenuList = this.getAttributeMenu(session, USERNAME,
190 roleRights, getArrayRoleRights(ROLE_IDS)); // 菜单缓存 204 roleRights, getArrayRoleRights(ROLE_IDS)); // 菜单缓存
191 List<Menu> menuList = new ArrayList<Menu>(); 205 List<Menu> menuList = new ArrayList<Menu>();
192 - menuList = this.changeMenuF(allmenuList, session, USERNAME,  
193 - changeMenu); // 切换菜单  
194 - if (null == session.getAttribute(USERNAME + Const.SESSION_QX)) { 206 + if (null == session.getAttribute(USERNAME
  207 + + Const.SESSION_QX)) {
195 session.setAttribute(USERNAME + Const.SESSION_QX, 208 session.setAttribute(USERNAME + Const.SESSION_QX,
196 this.getUQX(USERNAME)); // 主职角色按钮权限放到session中 209 this.getUQX(USERNAME)); // 主职角色按钮权限放到session中
197 session.setAttribute(USERNAME + Const.SESSION_QX2, 210 session.setAttribute(USERNAME + Const.SESSION_QX2,
198 this.getUQX2(USERNAME)); // 副职角色按钮权限放到session中 211 this.getUQX2(USERNAME)); // 副职角色按钮权限放到session中
199 } 212 }
200 this.getRemortIP(USERNAME); // 更新登录IP 213 this.getRemortIP(USERNAME); // 更新登录IP
201 - mv.setViewName("system/index/main"); 214 + menuList = this.changeMenuF(allmenuList, session, USERNAME,
  215 + changeMenu); // 切换菜单
  216 + if (!"teacher".equals(changeMenu)) {
  217 + mv.setViewName("system/index/main");
  218 + } else {
  219 + PageData tpd = new PageData();
  220 + tpd.put("ID", user.getUSER_ID());
  221 + List<PageData> teacherInfos = v1Service.getTeacherInfo(tpd);
  222 + pd.put("TEACHER", teacherInfos);
  223 + mv.setViewName("sunvote/teacher/teacher_main");
  224 + }
202 mv.addObject("user", user); 225 mv.addObject("user", user);
203 mv.addObject("menuList", menuList); 226 mv.addObject("menuList", menuList);
204 } else { 227 } else {
@@ -358,6 +381,11 @@ public class LoginController extends BaseController { @@ -358,6 +381,11 @@ public class LoginController extends BaseController {
358 session.removeAttribute("changeMenu"); 381 session.removeAttribute("changeMenu");
359 session.setAttribute("changeMenu", "4"); 382 session.setAttribute("changeMenu", "4");
360 menuList = menuList4; 383 menuList = menuList4;
  384 + }else if("teacher".equals(changeMenu)){
  385 + session.setAttribute(USERNAME + Const.SESSION_menuList,
  386 + menuList2);
  387 + session.removeAttribute("changeMenu");
  388 + session.setAttribute("changeMenu", "index");
361 } 389 }
362 } else { 390 } else {
363 menuList = (List<Menu>) session.getAttribute(USERNAME 391 menuList = (List<Menu>) session.getAttribute(USERNAME
src/com/fh/service/api/V1Manager.java
@@ -15,4 +15,9 @@ public interface V1Manager { @@ -15,4 +15,9 @@ public interface V1Manager {
15 public List<PageData> getTestPaperInfo(PageData pd) throws Exception; 15 public List<PageData> getTestPaperInfo(PageData pd) throws Exception;
16 16
17 17
  18 + public List<PageData> getQuestionsByPID(PageData pd) throws Exception;
  19 +
  20 + public List<PageData> getTeacherInfo(PageData pd) throws Exception;
  21 +
  22 +
18 } 23 }
src/com/fh/service/api/impl/V1Service.java
@@ -36,4 +36,14 @@ public class V1Service implements V1Manager { @@ -36,4 +36,14 @@ public class V1Service implements V1Manager {
36 return (List<PageData>)dao.findForList("V1Mapper.getTestPaperInfo", pd); 36 return (List<PageData>)dao.findForList("V1Mapper.getTestPaperInfo", pd);
37 } 37 }
38 38
  39 + @Override
  40 + public List<PageData> getQuestionsByPID(PageData pd) throws Exception {
  41 + return (List<PageData>)dao.findForList("V1Mapper.getQuestionsByPID", pd);
  42 + }
  43 +
  44 + @Override
  45 + public List<PageData> getTeacherInfo(PageData pd) throws Exception {
  46 + return (List<PageData>)dao.findForList("V1Mapper.getTeacherInfo", pd);
  47 + }
  48 +
39 } 49 }
src/com/fh/service/sunvote/paper/impl/PaperService.java
@@ -67,7 +67,7 @@ public class PaperService implements PaperManager{ @@ -67,7 +67,7 @@ public class PaperService implements PaperManager{
67 */ 67 */
68 @SuppressWarnings("unchecked") 68 @SuppressWarnings("unchecked")
69 public List<PageData> listAllByType(Page pd)throws Exception{ 69 public List<PageData> listAllByType(Page pd)throws Exception{
70 - return (List<PageData>)dao.findForList("PaperMapper.listAllByType", pd); 70 + return (List<PageData>)dao.findForList("PaperMapper.listAllByTypelistPage", pd);//.*listPage.*
71 } 71 }
72 72
73 /**通过id获取数据 73 /**通过id获取数据
src/com/fh/service/sunvote/paperquestion/PaperQuestionManager.java
1 package com.fh.service.sunvote.paperquestion; 1 package com.fh.service.sunvote.paperquestion;
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,12 @@ public interface PaperQuestionManager{ @@ -53,5 +54,12 @@ public interface PaperQuestionManager{
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 ArrayDATA_IDS
  60 + * @throws Exception
  61 + */
  62 + public void deleteAllPaper(String[] ArrayDATA_IDS)throws Exception;
  63 +
56 } 64 }
57 65
src/com/fh/service/sunvote/paperquestion/impl/PaperQuestionService.java
@@ -77,5 +77,13 @@ public class PaperQuestionService implements PaperQuestionManager{ @@ -77,5 +77,13 @@ public class PaperQuestionService implements PaperQuestionManager{
77 dao.delete("PaperQuestionMapper.deleteAll", ArrayDATA_IDS); 77 dao.delete("PaperQuestionMapper.deleteAll", ArrayDATA_IDS);
78 } 78 }
79 79
  80 + /**批量删除
  81 + * @param ArrayDATA_IDS
  82 + * @throws Exception
  83 + */
  84 + public void deleteAllPaper(String[] ArrayDATA_IDS)throws Exception{
  85 + dao.delete("PaperQuestionMapper.deleteAllPaper", ArrayDATA_IDS);
  86 + }
  87 +
80 } 88 }
81 89
src/com/fh/util/PageData.java
1 package com.fh.util; 1 package com.fh.util;
2 2
3 import java.io.BufferedReader; 3 import java.io.BufferedReader;
  4 +import java.io.InputStreamReader;
4 import java.io.Reader; 5 import java.io.Reader;
5 import java.util.Collection; 6 import java.util.Collection;
6 import java.util.HashMap; 7 import java.util.HashMap;
@@ -11,6 +12,7 @@ import java.util.Set; @@ -11,6 +12,7 @@ import java.util.Set;
11 import javax.servlet.http.HttpServletRequest; 12 import javax.servlet.http.HttpServletRequest;
12 13
13 import com.alibaba.druid.proxy.jdbc.ClobProxyImpl; 14 import com.alibaba.druid.proxy.jdbc.ClobProxyImpl;
  15 +import com.alibaba.fastjson.JSONObject;
14 public class PageData extends HashMap implements Map{ 16 public class PageData extends HashMap implements Map{
15 17
16 private static final long serialVersionUID = 1L; 18 private static final long serialVersionUID = 1L;
@@ -18,7 +20,7 @@ public class PageData extends HashMap implements Map{ @@ -18,7 +20,7 @@ public class PageData extends HashMap implements Map{
18 Map map = null; 20 Map map = null;
19 HttpServletRequest request; 21 HttpServletRequest request;
20 public PageData(HttpServletRequest request){ 22 public PageData(HttpServletRequest request){
21 - this.request = request; 23 + this.request = request;
22 Map properties = request.getParameterMap(); 24 Map properties = request.getParameterMap();
23 Map returnMap = new HashMap(); 25 Map returnMap = new HashMap();
24 Iterator entries = properties.entrySet().iterator(); 26 Iterator entries = properties.entrySet().iterator();
@@ -42,6 +44,19 @@ public class PageData extends HashMap implements Map{ @@ -42,6 +44,19 @@ public class PageData extends HashMap implements Map{
42 } 44 }
43 returnMap.put(name.toUpperCase(), value); 45 returnMap.put(name.toUpperCase(), value);
44 } 46 }
  47 + try {
  48 + BufferedReader streamReader = new BufferedReader( new InputStreamReader(request.getInputStream(), "UTF-8"));
  49 + StringBuilder responseStrBuilder = new StringBuilder();
  50 + String body = "";
  51 + while ((body = streamReader.readLine()) != null){
  52 + responseStrBuilder.append(body);
  53 + }
  54 + if(!returnMap.containsKey("JSON")){
  55 + returnMap.put("JSON",responseStrBuilder.toString());
  56 + }
  57 + } catch (Exception e) {
  58 + e.printStackTrace();
  59 + }
45 map = returnMap; 60 map = returnMap;
46 } 61 }
47 62
@@ -49,6 +64,16 @@ public class PageData extends HashMap implements Map{ @@ -49,6 +64,16 @@ public class PageData extends HashMap implements Map{
49 map = new HashMap(); 64 map = new HashMap();
50 } 65 }
51 66
  67 +
  68 + public String getJsonString(){
  69 + Object obj = "";
  70 + if(map != null){
  71 + obj = map.get("JSON");
  72 + }
  73 +
  74 + return obj.toString() ;
  75 + }
  76 +
52 @Override 77 @Override
53 public Object get(Object key) { 78 public Object get(Object key) {
54 Object obj = null; 79 Object obj = null;