[转]学生成绩统计分析表

 

 
  1.  
    <!DOCTYPE html>
  2.  
    <!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
  3.  
    <!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
  4.  
    <!--[if !IE]><!-->
  5.  
    <html lang="en" class="no-js">
  6.  
    <!--<![endif]-->
  7.  
    <!-- BEGIN HEAD -->
  8.  
     
  9.  
    <head>
  10.  
    <meta charset="utf-8" />
  11.  
    <title> 学生单科成绩统计分析表</title>
  12.  
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  13.  
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
  14.  
    <meta content="" name="description" />
  15.  
    <meta content="" name="author" />
  16.  
    <meta name="MobileOptimized" content="320">
  17.  
     
  18.  
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
  19.  
    <link rel="stylesheet" type="text/css" href="../../../assets/plugins/font-awesome/css/font-awesome.min.css" />
  20.  
    <link rel="stylesheet" type="text/css" href="../../../assets/plugins/bootstrap/css/bootstrap.min.css" />
  21.  
    <link rel="stylesheet" type="text/css" href="../../../assets/plugins/data-tables/dataTables.bootstrap.css" />
  22.  
    <link rel="stylesheet" type="text/css" href="../../../assets/plugins/data-tables/css/fixedHeader.bootstrap.min.css" />
  23.  
     
  24.  
    <link rel="stylesheet" type="text/css" href="../../../assets/css/report.css" />
  25.  
    <link rel="stylesheet" type="text/css" href="../../../assets/css/report_udr.css" />
  26.  
    </head>
  27.  
    <style>
  28.  
    body {
  29.  
    background: #fff !important;
  30.  
    padding: 5px;
  31.  
    overflow-x: hidden;
  32.  
    }
  33.  
     
  34.  
    .search input{
  35.  
    width:50px;
  36.  
    }
  37.  
    .search2 input{
  38.  
    width:70px;
  39.  
    }
  40.  
    .red{
  41.  
    color:red;
  42.  
    }
  43.  
    .green{
  44.  
    color:green;
  45.  
    }
  46.  
    .table{
  47.  
    text-align: center;
  48.  
    }
  49.  
    .search{
  50.  
    margin-bottom: 20px;
  51.  
    }
  52.  
    .wrong{
  53.  
    position: absolute;
  54.  
    top:226px;
  55.  
    left:360px;
  56.  
    display: none;
  57.  
    }
  58.  
    .form-control{
  59.  
    width:120px;
  60.  
    display: inline-block;
  61.  
    }
  62.  
    th{
  63.  
    white-space: nowrap;
  64.  
    vertical-align: middle !important;
  65.  
    }
  66.  
    .btn{
  67.  
    margin-left: 20px;
  68.  
    }
  69.  
     
  70.  
     
  71.  
    </style>
  72.  
     
  73.  
    <body>
  74.  
    <div class="rpt_header">
  75.  
    <h4 class="rpt_title"></h4>
  76.  
    <h4 class="rpt_title_ext"></h4>
  77.  
    </div>
  78.  
    <div class="page-container">
  79.  
    <div class="search">
  80.  
    <p class="range" style="text-align:center;font-size:18px;padding-top:10px;"></p>
  81.  
         请选择学科 :
  82.  
    <select class="select form-control">
  83.  
    <option selected value="1">语文</option>
  84.  
    <option value="2">数学</option>
  85.  
    <option value="3">英语</option>
  86.  
    <option value="4">物理</option>
  87.  
    <option value="5">化学</option>
  88.  
    <option value="6">历史</option>
  89.  
    <option value="7">地理</option>
  90.  
    <option value="8">政治</option>
  91.  
    <option value="9">生物</option>
  92.  
    </select>
  93.  
         请选择试卷类别 :
  94.  
    <select class="select1 form-control">
  95.  
    <option selected value="0">全卷</option>
  96.  
    <option value="1">A卷</option>
  97.  
    <option value="2">B卷</option>
  98.  
    </select>
  99.  
    <div class="wrong"><span style="padding:20px;color:#999;font-size:30px;">没有检索到数据.</span></div>
  100.  
    </div>
  101.  
    <div class="search2" style="margin-top: 10px;">
  102.  
         高线 : <input type="text" class="high form-control"/>
  103.  
       中线 : <input type="text" class="mid form-control"/>
  104.  
    <button type="button" class="btn btn-primary" style="margin-left: 30px">查询</button>
  105.  
    </div>
  106.  
     
  107.  
    <div class="page-content" style="margin-left: 0px;">
  108.  
    <div class="rpt_chart" id="rptChart"></div>
  109.  
    <table class="table table-striped table-bordered table-hover rpt_table" align='center'>
  110.  
    </table>
  111.  
    </div>
  112.  
    </div>
  113.  
    <script type="text/javascript" src="../../../assets/lib/jquery-3.0.0.min.js"></script>
  114.  
    <script type="text/javascript" src="../../../assets/plugins/backbone/underscore.js"></script>
  115.  
    <script type="text/javascript" src="../../../assets/plugins/backbone/backbone.js"></script>
  116.  
    <script type="text/javascript" src="../../../assets/plugins/jquery.cookie.min.js"></script>
  117.  
     
  118.  
    <script type="text/javascript" src="../../../assets/plugins/data-tables/jquery.dataTables.js"></script>
  119.  
    <script type="text/javascript" src="../../../assets/plugins/data-tables/dataTables.bootstrap.min.js"></script>
  120.  
    <script type="text/javascript" src="../../../assets/plugins/data-tables/dataTables.fixedHeader.min.js"></script>
  121.  
    <script type="text/javascript" src="../../../assets/plugins/bootstrap/js/bootstrap.js"></script>
  122.  
    <script type="text/javascript" src="../../../assets/plugins/purl.js"></script>
  123.  
    <script type="text/javascript" src="../../../assets/plugins/pace/pace.min.js"></script>
  124.  
    <script type="text/javascript" src="../../../assets/plugins/echart/echarts-all.js"></script>
  125.  
     
  126.  
    <script type="text/javascript" src="../../../assets/lib/zxt.js"></script>
  127.  
    <script type="text/javascript" src="../../../assets/scripts/app.js"></script>
  128.  
    <script type="text/javascript" src="../../../assets/scripts/app_udr.js"></script>
  129.  
    <script id="rpt_table" type="text/template">
  130.  
    <thead>
  131.  
    <tr>
  132.  
    <th rowspan="2">学校</th>
  133.  
    <th rowspan="2">参考人数</th>
  134.  
    <th rowspan="1" colspan="2" style="text-align:center">优秀(80%)</th>
  135.  
    <th rowspan="1" colspan="2" style="text-align:center">及格(60%)</th>
  136.  
    <th rowspan="1" colspan="2" style="text-align:center">学困(40%)</th>
  137.  
    <th rowspan="1" colspan="2" style="text-align:center">高线(<%=data[0].highScore%></th>
  138.  
    <th rowspan="1" colspan="2" style="text-align:center">中线(<%=data[0].midScore%>)</th>
  139.  
    </tr>
  140.  
    <tr>
  141.  
    <th>人数</th>
  142.  
    <th>比例</th>
  143.  
    <th>人数</th>
  144.  
    <th>比例</th>
  145.  
    <th>人数</th>
  146.  
    <th>比例</th>
  147.  
    <th>人数</th>
  148.  
    <th>比例</th>
  149.  
    <th>人数</th>
  150.  
    <th>比例</th
  151.  
    </tr>
  152.  
    </thead>
  153.  
    <tbody>
  154.  
    <%_.each(data[0].data, function(d){%>
  155.  
    <tr>
  156.  
    <%for(var i=0;i<d.length;i++){%>
  157.  
    <%if(i==0){%>
  158.  
    <th><%=d[i]%></th>
  159.  
    <%}else{%>
  160.  
    <% if(i > 1 && i % 2 == 1 && d[i] != ""){%>
  161.  
    <th style="text-align:right;"><%=(d[i]*100).toFixed(2) + '%'%></th>
  162.  
    <%}else{%>
  163.  
    <th style="text-align:right;"><%=d[i]%></th>
  164.  
    <%}%>
  165.  
    <%}%>
  166.  
    <%}%>
  167.  
    </tr>
  168.  
    <%})%>
  169.  
    </tbody>
  170.  
    </script>
  171.  
     
  172.  
    <script>
  173.  
    jQuery(document).ready(function() {
  174.  
    var xkId = $('body', window.parent.document).attr('xkId');
  175.  
    if( xkId != undefined && xkId != null && xkId.length!=0){
  176.  
    $(".select").attr('disabled','true');
  177.  
    $(".select option[value='"+xkId+"']").attr('selected',true);
  178.  
    }
  179.  
    var exam = appUtils.getExamInfo();
  180.  
    var totalScore;
  181.  
    function getTotalScore(){
  182.  
    ZX.getDataByAjax(
  183.  
    "../../../rpt/single/rpt2008/tbl/"+exam.uid+"/"+exam.examId+"/"+$(".select").val(),
  184.  
    'json',
  185.  
    function(res){
  186.  
    $('.wrong').css('display','none');
  187.  
    $(".btn").removeAttr('disabled');
  188.  
    totalScore = res[0].paperScore;
  189.  
    $(".range").html('').html('自定义分数档 /分 (0 - '+totalScore+'): ');
  190.  
     
  191.  
    },
  192.  
    function(){
  193.  
    //判断dom节点是否被datatable了
  194.  
    if ($.fn.DataTable.isDataTable($('.rpt_table'))) {
  195.  
    //构建datatable的dom对象进行销毁
  196.  
    $('.rpt_table').DataTable().destroy(true);
  197.  
    //销毁后 dom也会一并销毁,此处需要还原dom节点
  198.  
    $('.page-content').append('<table class="table table-striped table-bordered table-hover rpt_table" align="center"></table>');
  199.  
    }
  200.  
    $('.wrong').css('display','block');
  201.  
    $(".range").html('未查到该考试的分数信息');
  202.  
    $(".btn").attr('disabled',true);
  203.  
    $.zxtloading.close();
  204.  
    }
  205.  
    );
  206.  
    }
  207.  
    getTotalScore();
  208.  
     
  209.  
     
  210.  
     
  211.  
    var url = "";
  212.  
    var xkId = $(".select").val();
  213.  
    $(".select").change(function(){
  214.  
    var high = $(".high").val().trim();
  215.  
    var mid = $(".mid").val().trim();
  216.  
    if (high == '' || mid == ''){
  217.  
    alert("不能有空值!");
  218.  
    }else{
  219.  
    if(isNaN(high)){
  220.  
    alert("高线请输入数字!");
  221.  
    }else if(isNaN(mid)){
  222.  
    alert("中线请输入数字!");
  223.  
    }
  224.  
    else if(parseFloat(high)<0 || parseFloat(high)>totalScore){
  225.  
    alert("高线超出分数范围!");
  226.  
    }else if(parseFloat(mid)<0 || parseFloat(mid)>totalScore){
  227.  
    alert("中线超出分数范围!");
  228.  
    }
  229.  
    else{
  230.  
    high = parseFloat(parseFloat($(".high").val().trim()).toFixed(2));
  231.  
    $(".high").val(high);
  232.  
    mid = parseFloat(parseFloat($(".mid").val().trim()).toFixed(2));
  233.  
    $(".mid").val(mid);
  234.  
    var xkId = $(".select").val();
  235.  
    var section = $(".select1").val();
  236.  
    url = "../../../rpt/single/rpt2039/tbl/"+exam.uid+"/"+exam.examId+"/"+xkId+"/"+high+"/"+mid+"/"+section;
  237.  
    RptController.renderRptTable();
  238.  
    getTotalScore();
  239.  
    }
  240.  
    }
  241.  
    });
  242.  
     
  243.  
    $(".select1").change(function(){
  244.  
    var high = $(".high").val().trim();
  245.  
    var mid = $(".mid").val().trim();
  246.  
    if (high == '' || mid == ''){
  247.  
    alert("不能有空值!");
  248.  
    }else{
  249.  
    if(isNaN(high)){
  250.  
    alert("高线请输入数字!");
  251.  
    }else if(isNaN(mid)){
  252.  
    alert("中线请输入数字!");
  253.  
    }
  254.  
    else if(parseFloat(high)<0 || parseFloat(high)>totalScore){
  255.  
    alert("高线超出分数范围!");
  256.  
    }else if(parseFloat(mid)<0 || parseFloat(mid)>totalScore){
  257.  
    alert("中线超出分数范围!");
  258.  
    }
  259.  
    else{
  260.  
    high = parseFloat(parseFloat($(".high").val().trim()).toFixed(2));
  261.  
    $(".high").val(high);
  262.  
    mid = parseFloat(parseFloat($(".mid").val().trim()).toFixed(2));
  263.  
    $(".mid").val(mid);
  264.  
    var xkId = $(".select").val();
  265.  
    var section = $(".select1").val();
  266.  
    url = "../../../rpt/single/rpt2039/tbl/"+exam.uid+"/"+exam.examId+"/"+xkId+"/"+high+"/"+mid+"/"+section;
  267.  
    RptController.renderRptTable();
  268.  
    getTotalScore();
  269.  
    }
  270.  
    }
  271.  
    });
  272.  
     
  273.  
    $(".btn").click(function(){
  274.  
    var high = $(".high").val().trim();
  275.  
    var mid = $(".mid").val().trim();
  276.  
    if (high == '' || mid == ''){
  277.  
    alert("不能有空值!");
  278.  
    }else{
  279.  
    if(isNaN(high)){
  280.  
    alert("高线请输入数字!");
  281.  
    }else if(isNaN(mid)){
  282.  
    alert("中线请输入数字!");
  283.  
    }
  284.  
    else if(parseFloat(high)<0 || parseFloat(high)>totalScore){
  285.  
    alert("高线超出分数范围!");
  286.  
    }else if(parseFloat(mid)<0 || parseFloat(mid)>totalScore){
  287.  
    alert("中线超出分数范围!");
  288.  
    }
  289.  
    else{
  290.  
    high = parseFloat(parseFloat($(".high").val().trim()).toFixed(2));
  291.  
    $(".high").val(high);
  292.  
    mid = parseFloat(parseFloat($(".mid").val().trim()).toFixed(2));
  293.  
    $(".mid").val(mid);
  294.  
    var xkId = $(".select").val();
  295.  
    var section = $(".select1").val();
  296.  
    url = "../../../rpt/single/rpt2039/tbl/"+exam.uid+"/"+exam.examId+"/"+xkId+"/"+high+"/"+mid+"/"+section;
  297.  
    RptController.renderRptTable();
  298.  
    getTotalScore();
  299.  
    }
  300.  
    }
  301.  
    });
  302.  
    var RptController = function() {
  303.  
     
  304.  
    var renderRptTable = function() {
  305.  
    //获取数据
  306.  
    $('.wrong').css('display','none');
  307.  
    ZX.getDataByAjax(
  308.  
    url,
  309.  
    'json',
  310.  
    function(res){
  311.  
    if(res.length==1 && _.isEmpty(res[0]) || res==null || res==undefined || res.length==0){
  312.  
    //判断dom节点是否被datatable了
  313.  
    if ($.fn.DataTable.isDataTable($('.rpt_table'))) {
  314.  
    //构建datatable的dom对象进行销毁
  315.  
    $('.rpt_table').DataTable().destroy(true);
  316.  
    //销毁后 dom也会一并销毁,此处需要还原dom节点
  317.  
    $('.page-content').append('<table class="table table-striped table-bordered table-hover rpt_table" align="center"></table>');
  318.  
    }
  319.  
    $('.wrong').css('display','block');
  320.  
    $.zxtloading.close();
  321.  
    }else{
  322.  
    var data = {};
  323.  
    data["data"] = res;
  324.  
    var high = $(".high").val().trim();
  325.  
    var mid = $(".mid").val().trim();
  326.  
    var section = $(".select1").val();
  327.  
    //判断dom节点是否被datatable了
  328.  
    if ($.fn.DataTable.isDataTable($('.rpt_table'))) {
  329.  
    //构建datatable的dom对象进行销毁
  330.  
    $('.rpt_table').DataTable().destroy(true);
  331.  
    //销毁后 dom也会一并销毁,此处需要还原dom节点
  332.  
    $('.page-content').append('<table class="table table-striped table-bordered table-hover rpt_table" align="center"></table>');
  333.  
    }
  334.  
     
  335.  
    var xkId = $(".select").val();
  336.  
    $('.rpt_table').zxtable({
  337.  
    //url: url,
  338.  
    data: data,
  339.  
    template: '#rpt_table',
  340.  
    exportURL: '../../../rpt/single/rpt2039/export/'+exam.uid+'/'+exam.examId+'/'+exam.examName+'/'+exam.yearIn+'/'+xkId+'/'+high+'/'+mid+'/'+section,
  341.  
     
  342.  
    needDataTable: true,
  343.  
    renderTbody:false,
  344.  
    orderby: [[ 0, "asc" ]],
  345.  
    fixedHeader: true,
  346.  
     
  347.  
    callBack: function(){
  348.  
    $.zxtloading.close();
  349.  
    }
  350.  
    });
  351.  
    }
  352.  
     
  353.  
    },
  354.  
    function(){
  355.  
    //判断dom节点是否被datatable了
  356.  
    if ($.fn.DataTable.isDataTable($('.rpt_table'))) {
  357.  
    //构建datatable的dom对象进行销毁
  358.  
    $('.rpt_table').DataTable().destroy(true);
  359.  
    //销毁后 dom也会一并销毁,此处需要还原dom节点
  360.  
    $('.page-content').append('<table class="table table-striped table-bordered table-hover rpt_table" align="center"></table>');
  361.  
    }
  362.  
    $('.wrong').css('display','block');
  363.  
    $.zxtloading.close();
  364.  
    }
  365.  
    );
  366.  
    };
  367.  
    return {
  368.  
    renderRptTable: function() {
  369.  
    renderRptTable();
  370.  
    }
  371.  
    }
  372.  
    }();
  373.  
    var initView = function() {
  374.  
    return {
  375.  
    init: function() {
  376.  
    $.cookie.json = true;
  377.  
    //启动加载进度条
  378.  
    if( exam.uid == undefined){
  379.  
    alert("参数非法.");
  380.  
    $.zxtloading.close();
  381.  
    return false;
  382.  
    }
  383.  
    if( exam.examId == undefined){
  384.  
    alert("请先选择考试.");
  385.  
    $.zxtloading.close();
  386.  
    return false;
  387.  
    }
  388.  
    Pace.start();
  389.  
    }
  390.  
    }
  391.  
    }();
  392.  
    initView.init();
  393.  
     
  394.  
    });
  395.  
     
  396.  
    </script>
  397.  
    <!-- END JAVASCRIPTS -->
  398.  
    </body>
  399.  
    <!-- END BODY -->
  400.  
     
  401.  
    </html>
 

 

 
  1.  
    package cn.doofen.udr.controller.single;
  2.  
     
  3.  
    import javax.servlet.http.HttpServletRequest;
  4.  
    import javax.servlet.http.HttpServletResponse;
  5.  
     
  6.  
    import org.springframework.stereotype.Controller;
  7.  
    import org.springframework.web.bind.annotation.PathVariable;
  8.  
    import org.springframework.web.bind.annotation.RequestMapping;
  9.  
    import org.springframework.web.bind.annotation.RequestMethod;
  10.  
    import org.springframework.web.bind.annotation.ResponseBody;
  11.  
     
  12.  
    import cn.doofen.udr.UDRBaseConst;
  13.  
    import cn.doofen.udr.bo.single.ISingleBo;
  14.  
    import cn.doofen.udr.bo.single.impl.Rpt2039Bo;
  15.  
    import cn.doofen.udr.controller.SingleController;
  16.  
    import cn.doofen.udr.controller.UDRBaseParam;
  17.  
    import cn.doofen.udr.utils.Unit2Utils;
  18.  
     
  19.  
    import com.alibaba.fastjson.JSONArray;
  20.  
    import com.alibaba.fastjson.JSONObject;
  21.  
     
  22.  
    /**
  23.  
    *
  24.  
    * @Package cn.doofen.udr.controller.multi
  25.  
    * @ClassName: Rpt2039Controller
  26.  
    * @Description: 学生单科成绩统计分析表
  27.  
    * @author fyq
  28.  
    * @date 2018年05月04日
  29.  
    *
  30.  
    */
  31.  
     
  32.  
    @Controller
  33.  
    @RequestMapping("/rpt/single/rpt2039")
  34.  
    public class Rpt2039Controller extends SingleController {
  35.  
     
  36.  
    private static ISingleBo bo = new Rpt2039Bo();
  37.  
     
  38.  
    /**
  39.  
    *
  40.  
    * @Title: rpt2039_tble
  41.  
    * @Description: 获取报表列表数据
  42.  
    * @param uid
  43.  
    * @param examId
  44.  
    * @param yearIn
  45.  
    * @return 参数
  46.  
    * @return JSONObject
  47.  
    * @throws
  48.  
    */
  49.  
    @RequestMapping(value = "/tbl/{orgId}/{examId}/{xkId}/{high}/{mid}/{section}", method = RequestMethod.GET)
  50.  
    @ResponseBody
  51.  
    public JSONObject rpt2035_tble(@PathVariable(value = "orgId") Long orgId,
  52.  
    @PathVariable(value = "examId") Long examId,
  53.  
    @PathVariable(value = "high") Double high,
  54.  
    @PathVariable(value = "mid") Double mid,
  55.  
    @PathVariable(value = "section") Integer section,
  56.  
    @PathVariable(value = "xkId") Integer xkId) {
  57.  
    try {
  58.  
    UDRBaseParam param = new UDRBaseParam();
  59.  
    param.setExamId(examId);
  60.  
    param.setOrgId(orgId);
  61.  
    param.setXkId(xkId);
  62.  
    param.setHigh(high);
  63.  
    param.setMid(mid);
  64.  
    param.setSection(section);
  65.  
    JSONArray rjarr = loadTblData(param);
  66.  
     
  67.  
    return getSuccessResult(rjarr);
  68.  
    } catch (Exception e) {
  69.  
    return getErrorResult("");
  70.  
    }
  71.  
    }
  72.  
     
  73.  
     
  74.  
     
  75.  
    /**
  76.  
    *
  77.  
    * @Title: exportExcel
  78.  
    * @Description: 导出excel
  79.  
    * @param request
  80.  
    * @param response
  81.  
    * @param uid
  82.  
    * @param examName
  83.  
    * @param examId
  84.  
    * @param yearIn
  85.  
    * 参数
  86.  
    * @return void
  87.  
    * @throws
  88.  
    */
  89.  
    @RequestMapping(value = "/export/{orgId}/{examId}/{examName}/{yearIn}/{xkId}/{high}/{mid}/{section}", method = RequestMethod.GET)
  90.  
    @ResponseBody
  91.  
    public void exportExcel(HttpServletRequest request,
  92.  
    HttpServletResponse response,
  93.  
    @PathVariable(value = "orgId") Long orgId,
  94.  
    @PathVariable(value = "examName") String examName,
  95.  
    @PathVariable(value = "examId") Long examId,
  96.  
    @PathVariable(value = "yearIn") Integer yearIn,
  97.  
    @PathVariable(value = "high") Double high,
  98.  
    @PathVariable(value = "mid") Double mid,
  99.  
    @PathVariable(value = "section") Integer section,
  100.  
    @PathVariable(value = "xkId") Integer xkId) {
  101.  
     
  102.  
    try {
  103.  
    // 注意协议头有字节数限制,所以fileName不能超长
  104.  
    Unit2Utils u2u = new Unit2Utils();
  105.  
    String xkName = u2u.excelXKChange(xkId);
  106.  
    String secName = "";
  107.  
    if(section == 0){
  108.  
    secName = "全卷";
  109.  
    }else if (section == 1){
  110.  
    secName = "A卷";
  111.  
    }else if (section == 2){
  112.  
    secName = "B卷";
  113.  
    }
  114.  
    String fileName = getExcelName(request, UDRBaseConst.RPT_2035_NAME+"_"+xkName+"("+secName+")"+"_"+examName);
  115.  
     
  116.  
    response.reset();
  117.  
    response.setContentType("application/vnd.ms-excel"); // 改成输出excel文件
  118.  
    response.setHeader("Content-disposition", "attachment; filename="
  119.  
    + fileName);
  120.  
     
  121.  
    UDRBaseParam param = new UDRBaseParam();
  122.  
    param.setExamId(examId);
  123.  
    param.setOrgId(orgId);
  124.  
    param.setYearIn(yearIn);
  125.  
    param.setXkId(xkId);
  126.  
    param.setExamName(examName);
  127.  
    param.setXkName(xkName);
  128.  
    param.setHigh(high);
  129.  
    param.setMid(mid);
  130.  
    param.setSection(section);
  131.  
    exportExcel(request, response, param);
  132.  
     
  133.  
    } catch (Exception e) {
  134.  
    logger.warn(e.getMessage());
  135.  
    }
  136.  
    }
  137.  
     
  138.  
    /**
  139.  
    *
  140.  
    * @Title: loadTblData
  141.  
    * @Description: 获取页面table数据
  142.  
    * @param param
  143.  
    * 参数
  144.  
    * @return 参数
  145.  
    * @return JSONObject
  146.  
    * @throws
  147.  
    */
  148.  
    protected JSONArray loadTblData(UDRBaseParam param) throws Exception {
  149.  
    if (param.getOrgId() != null && param.getExamId() != null
  150.  
    && param.getXkId() != null) {
  151.  
    return bo.loadTblData(param);
  152.  
    }
  153.  
     
  154.  
    return null;
  155.  
    }
  156.  
     
  157.  
    /**
  158.  
    *
  159.  
    * @Title: loadChartData
  160.  
    * @Description: 获取页面chart的数据
  161.  
    * @param param
  162.  
    * @return 参数
  163.  
    * @return JSONObject
  164.  
    * @throws
  165.  
    */
  166.  
    protected JSONArray loadChartData(UDRBaseParam param) throws Exception {
  167.  
    if (param.getOrgId() != null && param.getExamId() != null
  168.  
    && param.getXkId() != null) {
  169.  
    return bo.loadChartData(param);
  170.  
    }
  171.  
    return null;
  172.  
    }
  173.  
     
  174.  
    /**
  175.  
    *
  176.  
    * @Title: exportExcel
  177.  
    * @Description: 导出Excel
  178.  
    * @param param
  179.  
    * @return 参数
  180.  
    * @return void
  181.  
    * @throws
  182.  
    */
  183.  
    protected void exportExcel(HttpServletRequest request,
  184.  
    HttpServletResponse response, UDRBaseParam param) throws Exception {
  185.  
    if (param.getOrgId() != null && param.getExamId() != null
  186.  
    && param.getExamName() != null && param.getYearIn() != null
  187.  
    && param.getXkId() != null && param.getXkName()!=null) {
  188.  
    bo.exportExcel(request, response, param);
  189.  
    }
  190.  
     
  191.  
    }
  192.  
    }
 

 

 
  1.  
    package cn.doofen.udr.bo.single.impl;
  2.  
     
  3.  
    import java.io.OutputStream;
  4.  
    import java.util.ArrayList;
  5.  
    import java.util.List;
  6.  
     
  7.  
    import javax.servlet.http.HttpServletRequest;
  8.  
    import javax.servlet.http.HttpServletResponse;
  9.  
     
  10.  
    import org.apache.poi.hssf.usermodel.HSSFCell;
  11.  
    import org.apache.poi.hssf.usermodel.HSSFCellStyle;
  12.  
    import org.apache.poi.hssf.usermodel.HSSFRow;
  13.  
    import org.apache.poi.hssf.usermodel.HSSFSheet;
  14.  
    import org.apache.poi.ss.util.CellRangeAddress;
  15.  
     
  16.  
    import cn.doofen.udr.UDRBaseConfig;
  17.  
    import cn.doofen.udr.UDRBaseConst;
  18.  
    import cn.doofen.udr.bo.single.ISingleBo;
  19.  
    import cn.doofen.udr.controller.UDRBaseParam;
  20.  
    import cn.doofen.udr.utils.Unit2Utils;
  21.  
     
  22.  
    import com.alibaba.fastjson.JSONArray;
  23.  
    import com.alibaba.fastjson.JSONObject;
  24.  
    import com.zxt.framework.export.RptExcelDomain;
  25.  
    import com.zxt.framework.utils.PropertiesConfigUtils;
  26.  
     
  27.  
    /**
  28.  
    *
  29.  
    * @Package cn.doofen.udr.bo.multi.impl
  30.  
    * @ClassName: Rpt2035Bo
  31.  
    * @Description: rpt2035的业务接口 学校分类的单学科总体分析
  32.  
    * @author Zed
  33.  
    * @date 2016年11月29日
  34.  
    *
  35.  
    */
  36.  
    public class Rpt2039Bo extends SingleBoImpl implements ISingleBo {
  37.  
     
  38.  
    private static final String DSI_EXT_RPT_TBL_2039 = PropertiesConfigUtils
  39.  
    .getString("dsi.ext.rpt.tbl.2039");
  40.  
     
  41.  
     
  42.  
    private static final String logo = PropertiesConfigUtils
  43.  
    .getString("logo");
  44.  
     
  45.  
    /**
  46.  
    *
  47.  
    * @Title: loadTblData
  48.  
    * @Description: 获取页面table数据
  49.  
    * @param param
  50.  
    * 参数
  51.  
    * @return 参数
  52.  
    * @return JSONArray
  53.  
    * @throws
  54.  
    */
  55.  
    public JSONArray loadTblData(UDRBaseParam param) throws Exception {
  56.  
    JSONObject uparam = new JSONObject();
  57.  
    uparam.put("xkId", param.getXkId());
  58.  
    uparam.put("orgId", param.getOrgId());
  59.  
    uparam.put("examId", param.getExamId());
  60.  
    uparam.put("high", param.getHigh());
  61.  
    uparam.put("mid", param.getMid());
  62.  
    uparam.put("section", param.getSection());
  63.  
    JSONArray resJarr = null;
  64.  
    if (UDRBaseConfig.SYS_DEBUG) {
  65.  
    Unit2Utils u2u = new Unit2Utils();
  66.  
    resJarr = u2u.getTestJSONArray("TestJSONArray1035.txt");
  67.  
     
  68.  
    } else {
  69.  
    String url = getHttpDSIRestUri4Report(DSI_EXT_RPT_TBL_2039);
  70.  
    JSONObject rjo = httpRestGet(url, uparam.toString(), null);
  71.  
    if (rjo != null && !rjo.isEmpty()
  72.  
    && rjo.getBooleanValue("success") == true) {
  73.  
    JSONObject job = rjo.getJSONObject("data");
  74.  
    resJarr = new JSONArray();
  75.  
    resJarr.add(job);
  76.  
    } else if (rjo != null && !rjo.isEmpty()) {
  77.  
    throw new Exception("Load chart data failed, beacause : "
  78.  
    + rjo.getString("error"));
  79.  
    } else {
  80.  
    throw new Exception(
  81.  
    "Load chart data failed, beacause dsi response is null.");
  82.  
    }
  83.  
    }
  84.  
    return resJarr;
  85.  
    }
  86.  
     
  87.  
    /**
  88.  
    *
  89.  
    * @Title: loadChartData
  90.  
    * @Description: 获取页面chart的数据
  91.  
    * @param param
  92.  
    * @return 参数
  93.  
    * @return JSONOArray
  94.  
    * @throws
  95.  
    */
  96.  
    public JSONArray loadChartData(UDRBaseParam param) throws Exception {
  97.  
    return null;
  98.  
    }
  99.  
     
  100.  
    /**
  101.  
    *
  102.  
    * @Title: exportExcel
  103.  
    * @Description: 导出Excel
  104.  
    * @param param
  105.  
    * @return 参数
  106.  
    * @return void
  107.  
    * @throws
  108.  
    */
  109.  
    public void exportExcel(HttpServletRequest request,
  110.  
    HttpServletResponse response, UDRBaseParam param) throws Exception {
  111.  
    //输出表格的头部名称
  112.  
    Unit2Utils unit2=new Unit2Utils();
  113.  
    String xkName=unit2.excelXKChange(param.getXkId());
  114.  
    int sec = param.getSection();
  115.  
    String secName = null;
  116.  
    if(sec == 0){
  117.  
    secName = "全卷";
  118.  
    }else if (sec == 1){
  119.  
    secName = "A卷";
  120.  
    }else if (sec == 2){
  121.  
    secName = "B卷";
  122.  
    }
  123.  
    String title = UDRBaseConst.RPT_2039_NAME ;
  124.  
    String logo=PropertiesConfigUtils.getString("logo")+SHEET_TITLE;
  125.  
    OutputStream os = null;
  126.  
    try{
  127.  
    os = response.getOutputStream();
  128.  
    //获取数据
  129.  
    JSONObject jo =loadTblData(param).getJSONObject(0);
  130.  
    RptExcelDomain rptDo = new RptExcelDomain();
  131.  
    rptDo.setSheetName( logo+title);
  132.  
    rptDo.setSheetTitle( logo+title+","+xkName+"("+secName+")");
  133.  
    //所有数据的JSONArray
  134.  
    JSONArray ja = new JSONArray();
  135.  
    ja.add( jo);
  136.  
    rptDo.setSheetData( ja);
  137.  
    List<RptExcelDomain> sheets = new ArrayList<RptExcelDomain>();
  138.  
    sheets.add( rptDo);
  139.  
    setSheets( sheets);
  140.  
    //写入数据
  141.  
    writeExcel(os,true);
  142.  
     
  143.  
    } catch (Exception e) {
  144.  
    throw new Exception("Export Excel failed, beacause"
  145.  
    + e.getMessage());
  146.  
    } finally {
  147.  
    os.close();
  148.  
    }
  149.  
    }
  150.  
     
  151.  
    /**
  152.  
    * 重载excel创建
  153.  
    *
  154.  
    */
  155.  
    protected void writeExcelSheetSelf( RptExcelDomain rptDomain){
  156.  
    // 创建Excel的工作sheet,对应到一个excel文档的tab
  157.  
    HSSFSheet sheet = wb.createSheet( rptDomain.getSheetName());
  158.  
    // 设置excel每列宽度
  159.  
    sheet.setColumnWidth(0, 6000);
  160.  
    sheet.setColumnWidth(1, 2500);
  161.  
    // 创建Excel的sheet的一行
  162.  
    HSSFRow row =null;
  163.  
    String[] titleDefault = {"学校", "参考人数"};
  164.  
    String[] headers = {"人数", "比例"};
  165.  
    /*---------------------------------------
  166.  
    * 创建sheet的数据
  167.  
    *--------------------------------------*/
  168.  
    JSONArray datas = rptDomain.getSheetData();
  169.  
    Object[] titles = datas.getJSONObject(0).getJSONArray( "head").toArray();
  170.  
    Integer xkMerg = (titles.length-titleDefault.length)*headers.length;
  171.  
    JSONArray rowDatas = datas.getJSONObject(0).getJSONArray( "data");
  172.  
    //装第一行的表头数据
  173.  
    JSONArray ja=new JSONArray();
  174.  
    ja.add("学校");
  175.  
    ja.add("参考人数");
  176.  
    for(int i=titleDefault.length;i<titles.length;i++){
  177.  
    String schName=datas.getJSONObject(0).getJSONArray( "head").getJSONObject(i).getString("itemName");
  178.  
    ja.add(schName);
  179.  
    }
  180.  
    titles=ja.toArray();
  181.  
    //拿出副标题和主标题
  182.  
    String str=rptDomain.getSheetTitle();
  183.  
    String [] strs=new String[2];
  184.  
    strs=str.split(",");
  185.  
    String head1=strs[0];
  186.  
    String head2=strs[1];
  187.  
     
  188.  
    // 创建Excel的sheet的一行
  189.  
    row = sheet.createRow(0);
  190.  
    row.setHeight((short) rptDomain.getSheetTitleHeight());// 设定行的高度
  191.  
    // 创建一个Excel的单元格
  192.  
    HSSFCell cell_title = row.createCell(0);
  193.  
    // 合并单元格(startRow,endRow,startColumn,endColumn)
  194.  
    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, xkMerg+titleDefault.length-1));
  195.  
    // 给Excel的单元格设置样式和赋值
  196.  
    cell_title.setCellStyle( this.getStyleTitle());
  197.  
    cell_title.setCellValue( head1);
  198.  
     
  199.  
     
  200.  
    //副标题
  201.  
    row = sheet.createRow(1);
  202.  
    // 创建一个Excel的单元格
  203.  
    HSSFCell cell_title1 = row.createCell(0);
  204.  
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, xkMerg+titleDefault.length-1));
  205.  
    //给单元格设置样式和赋值
  206.  
    cell_title1.setCellType(HSSFCellStyle.ALIGN_LEFT);
  207.  
     
  208.  
    cell_title1.setCellValue(head2);
  209.  
    //构建表头
  210.  
    //第一行
  211.  
    HSSFCellStyle headerStyle = this.getStyleHeader();
  212.  
    row = sheet.createRow(2);
  213.  
    HSSFCell cell_header = null;
  214.  
    for( int i = 0; i <titleDefault.length; i++ ){
  215.  
    cell_header = row.createCell( i );
  216.  
    sheet.addMergedRegion(new CellRangeAddress( 2, 3, i,i));
  217.  
    cell_header.setCellStyle( headerStyle);
  218.  
    cell_header.setCellValue( titleDefault[i]);
  219.  
    }
  220.  
    int startHcl = titleDefault.length;
  221.  
    for( int i = 2; i < titles.length; i++){
  222.  
    cell_header = row.createCell( startHcl );
  223.  
    sheet.addMergedRegion(new CellRangeAddress( 2, 2, startHcl, startHcl+headers.length-1 ));
  224.  
    cell_header.setCellStyle( headerStyle);
  225.  
    cell_header.setCellValue((String)titles[i]);
  226.  
    startHcl = startHcl + headers.length;
  227.  
    }
  228.  
    //第二行
  229.  
    row = sheet.createRow(3);
  230.  
    int startCol = titleDefault.length;
  231.  
    for( int i = 2; i < titles.length; i++){
  232.  
    for( int j = 0; j < headers.length; j++){
  233.  
    cell_header = row.createCell( startCol );
  234.  
    cell_header.setCellStyle( headerStyle);
  235.  
    cell_header.setCellValue( (String)headers[j]);
  236.  
    startCol = startCol + 1;
  237.  
    }
  238.  
    }
  239.  
    int startRow = 3;
  240.  
    //构建独立表的数据
  241.  
    for( int d =0; d <rowDatas.size(); d++ ){
  242.  
    startRow = startRow + 1;
  243.  
    row = sheet.createRow( startRow );
  244.  
    JSONArray _cellDatas = rowDatas.getJSONArray(d);
  245.  
    HSSFCell cell_Data = null;
  246.  
    for(int j = 0; j < _cellDatas.size(); j++){
  247.  
    cell_Data = row.createCell(j);
  248.  
    if(j > 1 && j % 2 == 1 && !_cellDatas.getString(j).equals("")){
  249.  
    cell_Data.setCellValue(String.format("%.2f",_cellDatas.getDouble(j)*100)+"%");
  250.  
    }else{
  251.  
    cell_Data.setCellValue(_cellDatas.getString(j));
  252.  
    }
  253.  
    }
  254.  
     
  255.  
    }
  256.  
    }
  257.  
    }
 
 
  1.  
    package cn.doofen.dsi.core.bo.org.impl.or;
  2.  
     
  3.  
    import cn.doofen.dsi.core.bo.BOException;
  4.  
    import cn.doofen.dsi.core.bo.DsiBOImpl;
  5.  
    import cn.doofen.dsi.core.bo.check.BaseCheck;
  6.  
    import cn.doofen.dsi.core.bo.org.ior.IOrgRpt0028;
  7.  
    import cn.doofen.dsi.core.ctrl.pub.data.DataErrorCode;
  8.  
    import cn.doofen.dsi.core.eao.BxoEAO;
  9.  
    import cn.doofen.dsi.core.eao.BxoEAOImpl;
  10.  
    import cn.doofen.dsi.core.eao.CicadaEAO;
  11.  
    import cn.doofen.dsi.core.eao.CicadaEAOImpl;
  12.  
    import cn.doofen.dsi.core.eao.OrgEAO;
  13.  
    import cn.doofen.dsi.core.eao.OrgEAOImpl;
  14.  
     
  15.  
    import com.alibaba.fastjson.JSONArray;
  16.  
    import com.alibaba.fastjson.JSONObject;
  17.  
    import com.doofen.dict.core.bbo.dto.BBOOrg;
  18.  
    import com.doofen.dict.core.beo.dto.BEOExam;
  19.  
     
  20.  
    /**
  21.  
    *
  22.  
    * @Package cn.doofen.dsi.core.bo.org.impl.or
  23.  
    * @ClassName: OrgRpt0028Impl
  24.  
    * @Description: 获取报表单科/全科学校分类分析
  25.  
    * @author fyq
  26.  
    * @date 2018年05月03日
  27.  
    *
  28.  
    */
  29.  
    public class OrgRpt0028Impl extends DsiBOImpl implements IOrgRpt0028 {
  30.  
     
  31.  
    @Override
  32.  
    /**
  33.  
    *
  34.  
    * @Title: get
  35.  
    * @Description: 获取报表 学校分类单科/全科分析
  36.  
    * @param orgId
  37.  
    * @param examId
  38.  
    * @param xkId
  39.  
    * @return {"width":11,head:[],data:[[],..]}
  40.  
    * @throws Exception 参数
  41.  
    * @return JSONObject
  42.  
    * @throws
  43.  
    */
  44.  
    public JSONObject get(Long orgId, Double high, Double mid, Long examId, Integer xkId, Integer section) throws Exception {
  45.  
    BaseCheck checkH = new BaseCheck();
  46.  
    // 获取基础数据
  47.  
    BBOOrg org = checkH.checkOrg(orgId);
  48.  
    BEOExam exam = checkH.checkExamOrg(examId, orgId);
  49.  
    if (xkId == 0) {
  50.  
     
  51.  
    } else {
  52.  
    checkH.checkExamPaper(examId, xkId);
  53.  
    }
  54.  
     
  55.  
    // 获取index
  56.  
    String index = getOrgIndex(exam.getExamDate());
  57.  
     
  58.  
    // 获取数据
  59.  
    return getData(index, org, exam, xkId, high, mid,section);
  60.  
    }
  61.  
     
  62.  
    /**
  63.  
    *
  64.  
    * @Title: getData
  65.  
    * @Description: 获取具体数据
  66.  
    * @param index
  67.  
    * @param orgId
  68.  
    * @param exam
  69.  
    * @param xkId
  70.  
    * @return {"width":11,"head":[],"data":[..],..}
  71.  
    * @throws Exception
  72.  
    * 参数
  73.  
    * @return JSONObject
  74.  
    * @throws
  75.  
    */
  76.  
    private JSONObject getData(String index, BBOOrg org, BEOExam exam, Integer xkId, Double high, Double mid, Integer section) throws Exception {
  77.  
    JSONObject jo = new JSONObject();
  78.  
    OrgEAO eao = new OrgEAOImpl(index);
  79.  
    Long examId = exam.getExamId();
  80.  
    Long orgId = org.getOrgId();
  81.  
    JSONObject Data = new JSONObject();
  82.  
    if (xkId.intValue() == 0) {
  83.  
    Data = eao.getStatOrgScoreMix(orgId, examId);
  84.  
    } else {
  85.  
    Data = eao.getStatOrgScore(orgId, examId, xkId);
  86.  
    }
  87.  
    if ((Data == null) || (Data.isEmpty())) {
  88.  
    throw new BOException(DataErrorCode.ECODE_DATA_LACK, "考试(" + examId + ")" + "机构分析数据没有找到");
  89.  
    }
  90.  
    JSONArray examSches = Data.getJSONArray("examSches");
  91.  
     
  92.  
    JSONObject schInfo = getSchIds(examSches);
  93.  
    JSONArray datas = pre_data(schInfo, xkId, exam, examId, eao, orgId, high, mid, section);
  94.  
     
  95.  
    JSONArray head = new JSONArray();
  96.  
    head.add("学校");
  97.  
    head.add("参考人数");
  98.  
    JSONObject headContent = new JSONObject();
  99.  
    headContent.put("itemName", "优秀");
  100.  
    headContent.put("subNum", 2);
  101.  
    JSONArray subHead = new JSONArray();
  102.  
    subHead.add("人数");
  103.  
    subHead.add("比例");
  104.  
    headContent.put("subHead", subHead);
  105.  
    head.add(headContent);
  106.  
    headContent = new JSONObject();
  107.  
    headContent.put("itemName", "及格");
  108.  
    headContent.put("subNum", 2);
  109.  
    subHead = new JSONArray();
  110.  
    subHead.add("人数");
  111.  
    subHead.add("比例");
  112.  
    headContent.put("subHead", subHead);
  113.  
    head.add(headContent);
  114.  
    headContent = new JSONObject();
  115.  
    headContent.put("itemName", "学困");
  116.  
    headContent.put("subNum", 2);
  117.  
    subHead = new JSONArray();
  118.  
    subHead.add("人数");
  119.  
    subHead.add("比例");
  120.  
    headContent.put("subHead", subHead);
  121.  
    head.add(headContent);
  122.  
    headContent = new JSONObject();
  123.  
    headContent.put("itemName", "高线("+high+")");
  124.  
    headContent.put("subNum", 2);
  125.  
    subHead = new JSONArray();
  126.  
    subHead.add("人数");
  127.  
    subHead.add("比例");
  128.  
    headContent.put("subHead", subHead);
  129.  
    head.add(headContent);
  130.  
    headContent = new JSONObject();
  131.  
    headContent.put("itemName", "中线("+mid+")");
  132.  
    headContent.put("subNum", 2);
  133.  
    subHead = new JSONArray();
  134.  
    subHead.add("人数");
  135.  
    subHead.add("比例");
  136.  
    headContent.put("subHead", subHead);
  137.  
    head.add(headContent);
  138.  
     
  139.  
    jo.put("head", head);
  140.  
    jo.put("data", datas);
  141.  
    jo.put("highScore", high);
  142.  
    jo.put("midScore", mid);
  143.  
    return jo;
  144.  
    }
  145.  
     
  146.  
    /**
  147.  
    *
  148.  
    * @Title: getSchIds
  149.  
    * @Description:获取参加考试的学校id
  150.  
    * @param examSches
  151.  
    * @return 参数
  152.  
    * @return {schIds:[],shName:[]}
  153.  
    * @throws
  154.  
    */
  155.  
    private JSONObject getSchIds(JSONArray examSches) {
  156.  
    JSONObject jo = new JSONObject();
  157.  
    Long[] schIds = new Long[examSches.size()];
  158.  
    String[] schNames = new String[examSches.size()];
  159.  
    for (int i = 0; i < examSches.size(); i++) {
  160.  
    JSONObject sch = examSches.getJSONObject(i);
  161.  
    schIds[i] = sch.getLong("schId");
  162.  
    schNames[i] = sch.getString("schName");
  163.  
    }
  164.  
    jo.put("schIds", schIds);
  165.  
    jo.put("schNames", schNames);
  166.  
    return jo;
  167.  
    }
  168.  
     
  169.  
    /**
  170.  
    * @throws Exception
  171.  
    *
  172.  
    * @Title: pre_data
  173.  
    * @Description: 拿每一个学校的数据
  174.  
    * @param schInfo
  175.  
    * @return 参数
  176.  
    * @return JSONArray
  177.  
    * @throws
  178.  
    */
  179.  
    private JSONArray pre_data(JSONObject schInfo, Integer xkId, BEOExam exam, Long examId, OrgEAO eao, Long orgId, Double high, Double mid, Integer section) throws Exception {
  180.  
    // TODO Auto-generated method stub
  181.  
    JSONObject schData = new JSONObject();
  182.  
    JSONArray datas = new JSONArray();
  183.  
    if (xkId == 0) {
  184.  
    schData = eao.getExtStatSchScoreMix(orgId, examId);
  185.  
    } else {
  186.  
    schData = eao.getExtStatSchScore(orgId, examId, xkId);
  187.  
    }
  188.  
    Long[] schIds = schInfo.getObject("schIds", Long[].class);
  189.  
    JSONObject OrgBase = new JSONObject();
  190.  
    JSONArray CicadaEAO = new JSONArray();
  191.  
    Long highNum = null;
  192.  
    Long midNum = null;
  193.  
    Long passNum = null;
  194.  
    if (xkId == 0) {
  195.  
    OrgBase = eao.getStatSchScoreMix(orgId, examId);
  196.  
    for (int i = 0; i < schIds.length; i++) {
  197.  
    JSONArray tmp = new JSONArray();
  198.  
    JSONObject data = schData.getJSONObject(schIds[i].toString());
  199.  
    if (data == null || data.isEmpty()) {
  200.  
    continue;
  201.  
    }
  202.  
    String schName = data.getString("schName");
  203.  
    JSONObject schBase = OrgBase.getJSONObject(schIds[i].toString());
  204.  
    int schStuNum = schBase.getInteger("schStuNum");
  205.  
    double totalScore = data.getDoubleValue("paperScore");
  206.  
    double pass = totalScore*0.6;
  207.  
    int schEStuNum = schBase.getIntValue("schEStuNum");
  208.  
    double schEStuPer = schBase.getDoubleValue("schEStuPer");
  209.  
    int schDStuNum = schBase.getIntValue("schDStuNum");
  210.  
    double schDStuPer = schBase.getDoubleValue("schDStuPer");
  211.  
    highNum = eao.getExtStatStuMixHighNum(orgId, examId, schIds[i], high);
  212.  
    double highPer = (double)highNum/schStuNum;
  213.  
    midNum = eao.getExtStatStuMixMidNum(orgId, examId, schIds[i], mid);
  214.  
    double midPer = (double)midNum/schStuNum;
  215.  
    passNum = eao.getExtStatStuPassNum(orgId, examId, schIds[i], pass);
  216.  
    double passPer = (double)passNum/schStuNum;
  217.  
    tmp.add(schName);
  218.  
    tmp.add(schStuNum);
  219.  
    tmp.add(schEStuNum);
  220.  
    tmp.add(schEStuPer);
  221.  
    tmp.add(passNum);
  222.  
    tmp.add(passPer);
  223.  
    tmp.add(schDStuNum);
  224.  
    tmp.add(schDStuPer);
  225.  
    tmp.add(highNum);
  226.  
    tmp.add(highPer);
  227.  
    tmp.add(midNum);
  228.  
    tmp.add(midPer);
  229.  
    datas.add(tmp);
  230.  
    }
  231.  
     
  232.  
    } else {
  233.  
    OrgBase = eao.getStatSchScore(orgId, examId, xkId);
  234.  
     
  235.  
    for (int i = 0; i < schIds.length; i++) {
  236.  
    JSONArray tmp = new JSONArray();
  237.  
    JSONObject data = schData.getJSONObject(schIds[i].toString());
  238.  
    if (data == null || data.isEmpty()) {
  239.  
    continue;
  240.  
    }
  241.  
    BxoEAO beao = new BxoEAOImpl();
  242.  
    String schName = data.getString("schName");
  243.  
     
  244.  
    JSONObject schBase = OrgBase.getJSONObject(schIds[i].toString());
  245.  
    int schStuNum = schBase.getInteger("schStuNum");
  246.  
     
  247.  
    if(section == 0){
  248.  
    int schEStuNum = schBase.getIntValue("schEStuNum");
  249.  
    double schEStuPer = schBase.getDoubleValue("schEStuPer");
  250.  
    int schPassNum = schBase.getIntValue("schPassNum");
  251.  
    double schPassPer = schBase.getDoubleValue("schPassPer");
  252.  
    int schDStuNum = schBase.getIntValue("schDStuNum");
  253.  
    double schDStuPer = schBase.getDoubleValue("schDStuPer");
  254.  
    highNum = eao.getExtStatStuHighNum(orgId, examId, schIds[i], high, xkId);
  255.  
    double highPer = (double)highNum/schStuNum;
  256.  
    midNum = eao.getExtStatStuMidNum(orgId, examId, schIds[i], mid, xkId);
  257.  
    double midPer = (double)midNum/schStuNum;
  258.  
    tmp.add(schName);
  259.  
    tmp.add(schStuNum);
  260.  
    tmp.add(schEStuNum);
  261.  
    tmp.add(schEStuPer);
  262.  
    tmp.add(schPassNum);
  263.  
    tmp.add(schPassPer);
  264.  
    tmp.add(schDStuNum);
  265.  
    tmp.add(schDStuPer);
  266.  
    tmp.add(highNum);
  267.  
    tmp.add(highPer);
  268.  
    tmp.add(midNum);
  269.  
    tmp.add(midPer);
  270.  
    datas.add(tmp);
  271.  
    } else if(section == 1){
  272.  
    long paperId = data.getLongValue("paperId");
  273.  
    JSONArray secArr = beao.getSectionScore(paperId);
  274.  
    JSONObject secObj = secArr.getJSONObject(0);
  275.  
    JSONArray ABscores = secObj.getJSONArray("sectionPaperScores");
  276.  
    JSONObject Ascores = ABscores.getJSONObject(0);
  277.  
    double Ascore = Ascores.getDoubleValue("disScore");
  278.  
    double Escore = Ascore*0.8;
  279.  
    double Pscore = Ascore*0.6;
  280.  
    double Dscore = Ascore*0.4;
  281.  
    int Enum = 0;
  282.  
    int Pnum = 0;
  283.  
    int Dnum = 0;
  284.  
    String index = getCicadaIndex(exam.getExamDate(), schIds[i]);
  285.  
    CicadaEAO ceao = new CicadaEAOImpl(index);
  286.  
    CicadaEAO = ceao.getStatStuScoreNum(examId, xkId);
  287.  
    for(int j = 0; j < CicadaEAO.size(); j++){
  288.  
    JSONObject stuscores = CicadaEAO.getJSONObject(j);
  289.  
    JSONArray abscores = stuscores.getJSONArray("stuSections");
  290.  
    if(abscores != null ){
  291.  
    JSONObject ascores = abscores.getJSONObject(0);
  292.  
    double ascore = ascores.getDoubleValue("disStuScore");
  293.  
    if (ascore >= Escore ){
  294.  
    ++Enum;
  295.  
    }
  296.  
    if (ascore >= Pscore){
  297.  
    ++Pnum;
  298.  
    }
  299.  
    if (ascore < Dscore){
  300.  
    ++Dnum;
  301.  
    }
  302.  
    }
  303.  
     
  304.  
    }
  305.  
    double schEStuPer = (double)Enum/schStuNum;
  306.  
    double schPassPer = (double)Pnum/schStuNum;;
  307.  
    double schDStuPer = (double)Dnum/schStuNum;;
  308.  
    tmp.add(schName);
  309.  
    tmp.add(schStuNum);
  310.  
    tmp.add(Enum);
  311.  
    tmp.add(schEStuPer);
  312.  
    tmp.add(Pnum);
  313.  
    tmp.add(schPassPer);
  314.  
    tmp.add(Dnum);
  315.  
    tmp.add(schDStuPer);
  316.  
    tmp.add("");
  317.  
    tmp.add("");
  318.  
    tmp.add("");
  319.  
    tmp.add("");
  320.  
    datas.add(tmp);
  321.  
     
  322.  
    }else if(section == 2){
  323.  
    long paperId = data.getLongValue("paperId");
  324.  
    JSONArray secArr = beao.getSectionScore(paperId);
  325.  
    JSONObject secObj = secArr.getJSONObject(0);
  326.  
    JSONArray ABscores = secObj.getJSONArray("sectionPaperScores");
  327.  
    JSONObject Bscores = ABscores.getJSONObject(1);
  328.  
    double Bscore = Bscores.getDoubleValue("disScore");
  329.  
    double Escore = Bscore*0.8;
  330.  
    double Pscore = Bscore*0.6;
  331.  
    double Dscore = Bscore*0.4;
  332.  
    int Enum = 0;
  333.  
    int Pnum = 0;
  334.  
    int Dnum = 0;
  335.  
    String index = getCicadaIndex(exam.getExamDate(), schIds[i]);
  336.  
    CicadaEAO ceao = new CicadaEAOImpl(index);
  337.  
    CicadaEAO = ceao.getStatStuScoreNum(examId, xkId);
  338.  
    for(int j = 0; j < CicadaEAO.size(); j++){
  339.  
    JSONObject stuscores = CicadaEAO.getJSONObject(j);
  340.  
    JSONArray abscores = stuscores.getJSONArray("stuSections");
  341.  
    if(abscores != null ){
  342.  
    JSONObject bscores = abscores.getJSONObject(1);
  343.  
    double bscore = bscores.getDoubleValue("disStuScore");
  344.  
    if (bscore >= Escore ){
  345.  
    ++Enum;
  346.  
    }
  347.  
    if (bscore >= Pscore){
  348.  
    ++Pnum;
  349.  
    }
  350.  
    if (bscore < Dscore){
  351.  
    ++Dnum;
  352.  
    }
  353.  
    }
  354.  
     
  355.  
    }
  356.  
    double schEStuPer = (double)Enum/schStuNum;
  357.  
    double schPassPer = (double)Pnum/schStuNum;;
  358.  
    double schDStuPer = (double)Dnum/schStuNum;;
  359.  
    tmp.add(schName);
  360.  
    tmp.add(schStuNum);
  361.  
    tmp.add(Enum);
  362.  
    tmp.add(schEStuPer);
  363.  
    tmp.add(Pnum);
  364.  
    tmp.add(schPassPer);
  365.  
    tmp.add(Dnum);
  366.  
    tmp.add(schDStuPer);
  367.  
    tmp.add("");
  368.  
    tmp.add("");
  369.  
    tmp.add("");
  370.  
    tmp.add("");
  371.  
    datas.add(tmp);
  372.  
    }
  373.  
     
  374.  
    }
  375.  
    }
  376.  
     
  377.  
    return datas;
  378.  
    }
  379.  
     
  380.  
    }
 

 

 


---------------------
作者:Fengyq0507
来源:优快云
原文:https://blog.youkuaiyun.com/qq_24192465/article/details/80270828
版权声明:本文为作者原创文章,转载请附上博文链接!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值