学生成绩统计分析表

学生成绩统计分析表_第1张图片







    
    

    
        
         学生单科成绩统计分析表
        
        
        
        
        

        
        
        
        
        

        
        
    
    

    
        

     高线 :    中线 :


package cn.doofen.udr.controller.single;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.doofen.udr.UDRBaseConst;
import cn.doofen.udr.bo.single.ISingleBo;
import cn.doofen.udr.bo.single.impl.Rpt2039Bo;
import cn.doofen.udr.controller.SingleController;
import cn.doofen.udr.controller.UDRBaseParam;
import cn.doofen.udr.utils.Unit2Utils;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * 
 * @Package cn.doofen.udr.controller.multi
 * @ClassName: Rpt2039Controller
 * @Description: 学生单科成绩统计分析表
 * @author fyq
 * @date 2018年05月04日
 * 
 */

@Controller
@RequestMapping("/rpt/single/rpt2039")
public class Rpt2039Controller extends SingleController {

	private static ISingleBo bo = new Rpt2039Bo();

	/**
	 * 
	 * @Title: rpt2039_tble
	 * @Description: 获取报表列表数据
	 * @param uid
	 * @param examId
	 * @param yearIn
	 * @return 参数
	 * @return JSONObject
	 * @throws
	 */
	@RequestMapping(value = "/tbl/{orgId}/{examId}/{xkId}/{high}/{mid}/{section}", method = RequestMethod.GET)
	@ResponseBody
	public JSONObject rpt2035_tble(@PathVariable(value = "orgId") Long orgId,
			@PathVariable(value = "examId") Long examId,
			@PathVariable(value = "high") Double high,
			@PathVariable(value = "mid") Double mid,
			@PathVariable(value = "section") Integer section,
			@PathVariable(value = "xkId") Integer xkId) {
		try {
			UDRBaseParam param = new UDRBaseParam();
			param.setExamId(examId);
			param.setOrgId(orgId);
			param.setXkId(xkId);
			param.setHigh(high);
			param.setMid(mid);
			param.setSection(section);
			JSONArray rjarr = loadTblData(param);

			return getSuccessResult(rjarr);
		} catch (Exception e) {
			return getErrorResult("");
		}
	}



	/**
	 * 
	 * @Title: exportExcel
	 * @Description: 导出excel
	 * @param request
	 * @param response
	 * @param uid
	 * @param examName
	 * @param examId
	 * @param yearIn
	 *            参数
	 * @return void
	 * @throws
	 */
	@RequestMapping(value = "/export/{orgId}/{examId}/{examName}/{yearIn}/{xkId}/{high}/{mid}/{section}", method = RequestMethod.GET)
	@ResponseBody
	public void exportExcel(HttpServletRequest request,
			HttpServletResponse response,
			@PathVariable(value = "orgId") Long orgId,
			@PathVariable(value = "examName") String examName,
			@PathVariable(value = "examId") Long examId,
			@PathVariable(value = "yearIn") Integer yearIn,
			@PathVariable(value = "high") Double high,
			@PathVariable(value = "mid") Double mid,
			@PathVariable(value = "section") Integer section,
			@PathVariable(value = "xkId") Integer xkId) {

		try {
			// 注意协议头有字节数限制,所以fileName不能超长
			Unit2Utils u2u = new Unit2Utils();
			String xkName = u2u.excelXKChange(xkId);
			String secName = "";
			if(section == 0){
				secName = "全卷";
			}else if (section == 1){
				secName = "A卷";
			}else if (section == 2){
				secName = "B卷";
			}
			String fileName = getExcelName(request, UDRBaseConst.RPT_2035_NAME+"_"+xkName+"("+secName+")"+"_"+examName);

			response.reset();
			response.setContentType("application/vnd.ms-excel"); // 改成输出excel文件
			response.setHeader("Content-disposition", "attachment; filename="
					+ fileName);

			UDRBaseParam param = new UDRBaseParam();
			param.setExamId(examId);
			param.setOrgId(orgId);
			param.setYearIn(yearIn);
			param.setXkId(xkId);
			param.setExamName(examName);
			param.setXkName(xkName);
			param.setHigh(high);
			param.setMid(mid);
			param.setSection(section);
			exportExcel(request, response, param);

		} catch (Exception e) {
			logger.warn(e.getMessage());
		}
	}

	/**
	 * 
	 * @Title: loadTblData
	 * @Description: 获取页面table数据
	 * @param param
	 *            参数
	 * @return 参数
	 * @return JSONObject
	 * @throws
	 */
	protected JSONArray loadTblData(UDRBaseParam param) throws Exception {
		if (param.getOrgId() != null && param.getExamId() != null
				&& param.getXkId() != null) {
			return bo.loadTblData(param);
		}

		return null;
	}

	/**
	 * 
	 * @Title: loadChartData
	 * @Description: 获取页面chart的数据
	 * @param param
	 * @return 参数
	 * @return JSONObject
	 * @throws
	 */
	protected JSONArray loadChartData(UDRBaseParam param) throws Exception {
		if (param.getOrgId() != null && param.getExamId() != null
				&& param.getXkId() != null) {
			return bo.loadChartData(param);
		}
		return null;
	}

	/**
	 * 
	 * @Title: exportExcel
	 * @Description: 导出Excel
	 * @param param
	 * @return 参数
	 * @return void
	 * @throws
	 */
	protected void exportExcel(HttpServletRequest request,
			HttpServletResponse response, UDRBaseParam param) throws Exception {
		if (param.getOrgId() != null && param.getExamId() != null
				&& param.getExamName() != null && param.getYearIn() != null
				&& param.getXkId() != null && param.getXkName()!=null) {
			bo.exportExcel(request, response, param);
		}

	}
}


package cn.doofen.udr.bo.single.impl;

import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.ss.util.CellRangeAddress;

import cn.doofen.udr.UDRBaseConfig;
import cn.doofen.udr.UDRBaseConst;
import cn.doofen.udr.bo.single.ISingleBo;
import cn.doofen.udr.controller.UDRBaseParam;
import cn.doofen.udr.utils.Unit2Utils;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zxt.framework.export.RptExcelDomain;
import com.zxt.framework.utils.PropertiesConfigUtils;

/**
 * 
 * @Package cn.doofen.udr.bo.multi.impl
 * @ClassName: Rpt2035Bo
 * @Description: rpt2035的业务接口 学校分类的单学科总体分析
 * @author Zed
 * @date 2016年11月29日
 * 
 */
public class Rpt2039Bo extends SingleBoImpl implements ISingleBo {

	private static final String DSI_EXT_RPT_TBL_2039 = PropertiesConfigUtils
			.getString("dsi.ext.rpt.tbl.2039");

	
	private static final String logo = PropertiesConfigUtils
			.getString("logo");	

	/**
	 * 
	 * @Title: loadTblData
	 * @Description: 获取页面table数据
	 * @param param
	 *            参数
	 * @return 参数
	 * @return JSONArray
	 * @throws
	 */
	public JSONArray loadTblData(UDRBaseParam param) throws Exception {
		JSONObject uparam = new JSONObject();
		uparam.put("xkId", param.getXkId());
		uparam.put("orgId", param.getOrgId());
		uparam.put("examId", param.getExamId());
		uparam.put("high", param.getHigh());
		uparam.put("mid", param.getMid());
		uparam.put("section", param.getSection());
		JSONArray resJarr = null;
		if (UDRBaseConfig.SYS_DEBUG) {
			Unit2Utils u2u = new Unit2Utils();
			resJarr = u2u.getTestJSONArray("TestJSONArray1035.txt");

		} else {
			String url = getHttpDSIRestUri4Report(DSI_EXT_RPT_TBL_2039);
			JSONObject rjo = httpRestGet(url, uparam.toString(), null);
			if (rjo != null && !rjo.isEmpty()
					&& rjo.getBooleanValue("success") == true) {
				JSONObject job = rjo.getJSONObject("data");
				resJarr = new JSONArray();
				resJarr.add(job);
			} else if (rjo != null && !rjo.isEmpty()) {
				throw new Exception("Load chart data failed, beacause : "
						+ rjo.getString("error"));
			} else {
				throw new Exception(
						"Load chart data failed, beacause dsi response is null.");
			}
		}
		return resJarr;
	}

	/**
	 * 
	 * @Title: loadChartData
	 * @Description: 获取页面chart的数据
	 * @param param
	 * @return 参数
	 * @return JSONOArray
	 * @throws
	 */
	public JSONArray loadChartData(UDRBaseParam param) throws Exception {
		return null;
	}

	/**
	 * 
	 * @Title: exportExcel
	 * @Description: 导出Excel
	 * @param param
	 * @return 参数
	 * @return void
	 * @throws
	 */
	public void exportExcel(HttpServletRequest request,
			HttpServletResponse response, UDRBaseParam param) throws Exception {
			//输出表格的头部名称
				Unit2Utils unit2=new Unit2Utils();
				String xkName=unit2.excelXKChange(param.getXkId());
				int sec = param.getSection();
				String secName = null;
				if(sec == 0){
					secName = "全卷";
				}else if (sec == 1){
					secName = "A卷";
				}else if (sec == 2){
					secName = "B卷";
				}
				String title = UDRBaseConst.RPT_2039_NAME ;
				String logo=PropertiesConfigUtils.getString("logo")+SHEET_TITLE;
				OutputStream os = null;
				try{
				os = response.getOutputStream();
				//获取数据
				JSONObject jo =loadTblData(param).getJSONObject(0);
				RptExcelDomain rptDo = new RptExcelDomain();
				rptDo.setSheetName( logo+title);
				rptDo.setSheetTitle( logo+title+","+xkName+"("+secName+")");
				//所有数据的JSONArray
				JSONArray ja = new JSONArray();
				ja.add( jo);
				rptDo.setSheetData( ja);
				List sheets = new ArrayList();
				sheets.add( rptDo);
				setSheets( sheets);
				//写入数据
				writeExcel(os,true);

		} catch (Exception e) {
			throw new Exception("Export Excel failed, beacause"
					+ e.getMessage());
		} finally {
			os.close();
		}
	}
	
	/**
	 * 重载excel创建
	 *
	 */
	protected void writeExcelSheetSelf( RptExcelDomain rptDomain){
		// 创建Excel的工作sheet,对应到一个excel文档的tab
		HSSFSheet sheet = wb.createSheet( rptDomain.getSheetName());
		// 设置excel每列宽度
		sheet.setColumnWidth(0, 6000);
		sheet.setColumnWidth(1, 2500);
		// 创建Excel的sheet的一行
		HSSFRow row =null;
		String[] titleDefault = {"学校", "参考人数"}; 
		String[] headers = {"人数", "比例"};
		/*---------------------------------------
		 * 创建sheet的数据
		 *--------------------------------------*/
		JSONArray datas = rptDomain.getSheetData();
		Object[] titles = datas.getJSONObject(0).getJSONArray( "head").toArray();
		Integer xkMerg =  (titles.length-titleDefault.length)*headers.length;
		JSONArray rowDatas = datas.getJSONObject(0).getJSONArray( "data");
		//装第一行的表头数据
		JSONArray ja=new JSONArray();
		ja.add("学校");
		ja.add("参考人数");
		for(int i=titleDefault.length;i 1 && j % 2 == 1 && !_cellDatas.getString(j).equals("")){
					cell_Data.setCellValue(String.format("%.2f",_cellDatas.getDouble(j)*100)+"%");
				}else{
					cell_Data.setCellValue(_cellDatas.getString(j));
				}
			}

		}
	}
}
package cn.doofen.dsi.core.bo.org.impl.or;

import cn.doofen.dsi.core.bo.BOException;
import cn.doofen.dsi.core.bo.DsiBOImpl;
import cn.doofen.dsi.core.bo.check.BaseCheck;
import cn.doofen.dsi.core.bo.org.ior.IOrgRpt0028;
import cn.doofen.dsi.core.ctrl.pub.data.DataErrorCode;
import cn.doofen.dsi.core.eao.BxoEAO;
import cn.doofen.dsi.core.eao.BxoEAOImpl;
import cn.doofen.dsi.core.eao.CicadaEAO;
import cn.doofen.dsi.core.eao.CicadaEAOImpl;
import cn.doofen.dsi.core.eao.OrgEAO;
import cn.doofen.dsi.core.eao.OrgEAOImpl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.doofen.dict.core.bbo.dto.BBOOrg;
import com.doofen.dict.core.beo.dto.BEOExam;

/**
 * 
 * @Package cn.doofen.dsi.core.bo.org.impl.or
 * @ClassName: OrgRpt0028Impl
 * @Description: 获取报表单科/全科学校分类分析
 * @author fyq
 * @date 2018年05月03日
 * 
 */
public class OrgRpt0028Impl extends DsiBOImpl implements IOrgRpt0028 {

    @Override
    /**
     * 
     * @Title: get
     * @Description: 获取报表  学校分类单科/全科分析
     * @param orgId
     * @param examId
     * @param xkId
     * @return {"width":11,head:[],data:[[],..]}
     * @throws Exception    参数
     * @return JSONObject
     * @throws
     */
    public JSONObject get(Long orgId, Double high, Double mid, Long examId, Integer xkId, Integer section) throws Exception {
        BaseCheck checkH = new BaseCheck();
        // 获取基础数据
        BBOOrg org = checkH.checkOrg(orgId);
        BEOExam exam = checkH.checkExamOrg(examId, orgId);
        if (xkId == 0) {

        } else {
            checkH.checkExamPaper(examId, xkId);
        }

        // 获取index
        String index = getOrgIndex(exam.getExamDate());

        // 获取数据
        return getData(index, org, exam, xkId, high, mid,section);
    }

    /**
     * 
     * @Title: getData
     * @Description: 获取具体数据
     * @param index
     * @param orgId
     * @param exam
     * @param xkId
     * @return {"width":11,"head":[],"data":[..],..}
     * @throws Exception
     *             参数
     * @return JSONObject
     * @throws
     */
    private JSONObject getData(String index, BBOOrg org, BEOExam exam, Integer xkId, Double high, Double mid, Integer section) throws Exception {
        JSONObject jo = new JSONObject();
        OrgEAO eao = new OrgEAOImpl(index);
        Long examId = exam.getExamId();
        Long orgId = org.getOrgId();
        JSONObject Data = new JSONObject();
        if (xkId.intValue() == 0) {
            Data = eao.getStatOrgScoreMix(orgId, examId);
        } else {
            Data = eao.getStatOrgScore(orgId, examId, xkId);
        }
        if ((Data == null) || (Data.isEmpty())) {
            throw new BOException(DataErrorCode.ECODE_DATA_LACK, "考试(" + examId + ")" + "机构分析数据没有找到");
        }
        JSONArray examSches = Data.getJSONArray("examSches");

        JSONObject schInfo = getSchIds(examSches);
        JSONArray datas = pre_data(schInfo, xkId, exam, examId, eao, orgId, high, mid, section);

        JSONArray head = new JSONArray();
        head.add("学校");
        head.add("参考人数");
      	JSONObject headContent = new JSONObject();
      	headContent.put("itemName", "优秀");
      	headContent.put("subNum", 2);
      	JSONArray subHead = new JSONArray();
      	subHead.add("人数");
      	subHead.add("比例");
      	headContent.put("subHead", subHead);
      	head.add(headContent);
      	headContent = new JSONObject();
      	headContent.put("itemName", "及格");
      	headContent.put("subNum", 2);
      	subHead = new JSONArray();
      	subHead.add("人数");
      	subHead.add("比例");
      	headContent.put("subHead", subHead);
      	head.add(headContent);
      	headContent = new JSONObject();
      	headContent.put("itemName", "学困");
      	headContent.put("subNum", 2);
      	subHead = new JSONArray();
      	subHead.add("人数");
      	subHead.add("比例");
      	headContent.put("subHead", subHead);
      	head.add(headContent);
      	headContent = new JSONObject();
      	headContent.put("itemName", "高线("+high+")");
      	headContent.put("subNum", 2);
      	subHead = new JSONArray();
      	subHead.add("人数");
      	subHead.add("比例");
      	headContent.put("subHead", subHead);
      	head.add(headContent);
      	headContent = new JSONObject();
      	headContent.put("itemName", "中线("+mid+")");
      	headContent.put("subNum", 2);
      	subHead = new JSONArray();
      	subHead.add("人数");
      	subHead.add("比例");
      	headContent.put("subHead", subHead);
      	head.add(headContent);

        jo.put("head", head);
        jo.put("data", datas);
        jo.put("highScore", high);
        jo.put("midScore", mid);
        return jo;
    }

    /**
     * 
     * @Title: getSchIds
     * @Description:获取参加考试的学校id
     * @param examSches
     * @return 参数
     * @return {schIds:[],shName:[]}
     * @throws
     */
    private JSONObject getSchIds(JSONArray examSches) {
        JSONObject jo = new JSONObject();
        Long[] schIds = new Long[examSches.size()];
        String[] schNames = new String[examSches.size()];
        for (int i = 0; i < examSches.size(); i++) {
            JSONObject sch = examSches.getJSONObject(i);
            schIds[i] = sch.getLong("schId");
            schNames[i] = sch.getString("schName");
        }
        jo.put("schIds", schIds);
        jo.put("schNames", schNames);
        return jo;
    }

    /**
     * @throws Exception
     * 
     * @Title: pre_data
     * @Description: 拿每一个学校的数据
     * @param schInfo
     * @return 参数
     * @return JSONArray
     * @throws
     */
    private JSONArray pre_data(JSONObject schInfo, Integer xkId, BEOExam exam, Long examId, OrgEAO eao,  Long orgId, Double high, Double mid, Integer section) throws Exception {
        // TODO Auto-generated method stub
        JSONObject schData = new JSONObject();
        JSONArray datas = new JSONArray();
        if (xkId == 0) {
            schData = eao.getExtStatSchScoreMix(orgId, examId);
        } else {
            schData = eao.getExtStatSchScore(orgId, examId, xkId);
        }
        Long[] schIds = schInfo.getObject("schIds", Long[].class);
        JSONObject OrgBase = new JSONObject();
        JSONArray CicadaEAO = new JSONArray();
        Long highNum = null;
        Long midNum = null;
        Long passNum = null;
        if (xkId == 0) {
            OrgBase = eao.getStatSchScoreMix(orgId, examId);
            for (int i = 0; i < schIds.length; i++) {
                JSONArray tmp = new JSONArray();
                JSONObject data = schData.getJSONObject(schIds[i].toString());
                if (data == null || data.isEmpty()) {
                    continue;
                }
                String schName = data.getString("schName");
                JSONObject schBase = OrgBase.getJSONObject(schIds[i].toString());
                int schStuNum = schBase.getInteger("schStuNum");
                double totalScore = data.getDoubleValue("paperScore");
                double pass = totalScore*0.6;
                int schEStuNum = schBase.getIntValue("schEStuNum");
                double schEStuPer = schBase.getDoubleValue("schEStuPer");
                int schDStuNum = schBase.getIntValue("schDStuNum");
                double schDStuPer = schBase.getDoubleValue("schDStuPer");
                highNum = eao.getExtStatStuMixHighNum(orgId, examId, schIds[i], high);
                double highPer = (double)highNum/schStuNum;
                midNum = eao.getExtStatStuMixMidNum(orgId, examId, schIds[i], mid);
                double midPer = (double)midNum/schStuNum;
                passNum = eao.getExtStatStuPassNum(orgId, examId, schIds[i], pass);
                double passPer = (double)passNum/schStuNum;
                tmp.add(schName);
                tmp.add(schStuNum);
                tmp.add(schEStuNum);
                tmp.add(schEStuPer);
                tmp.add(passNum);
                tmp.add(passPer);
                tmp.add(schDStuNum);
                tmp.add(schDStuPer);
                tmp.add(highNum);
                tmp.add(highPer);
                tmp.add(midNum);
                tmp.add(midPer);
                datas.add(tmp);
            }

        } else {
            OrgBase = eao.getStatSchScore(orgId, examId, xkId);
           
            for (int i = 0; i < schIds.length; i++) {
                JSONArray tmp = new JSONArray();
                JSONObject data = schData.getJSONObject(schIds[i].toString());
                if (data == null || data.isEmpty()) {
                    continue;
                }
                BxoEAO beao = new BxoEAOImpl();
                String schName = data.getString("schName");
                
                JSONObject schBase = OrgBase.getJSONObject(schIds[i].toString());
                int schStuNum = schBase.getInteger("schStuNum");
                
                if(section == 0){ 
                    int schEStuNum = schBase.getIntValue("schEStuNum");
                    double schEStuPer = schBase.getDoubleValue("schEStuPer");
                    int schPassNum = schBase.getIntValue("schPassNum");
                    double schPassPer = schBase.getDoubleValue("schPassPer");
                    int schDStuNum = schBase.getIntValue("schDStuNum");
                    double schDStuPer = schBase.getDoubleValue("schDStuPer");
                    highNum = eao.getExtStatStuHighNum(orgId, examId, schIds[i], high, xkId);
                    double highPer = (double)highNum/schStuNum;
                    midNum = eao.getExtStatStuMidNum(orgId, examId, schIds[i], mid, xkId);
                    double midPer = (double)midNum/schStuNum;
                    tmp.add(schName);
                    tmp.add(schStuNum);
                    tmp.add(schEStuNum);
                    tmp.add(schEStuPer);
                    tmp.add(schPassNum);
                    tmp.add(schPassPer);
                    tmp.add(schDStuNum);
                    tmp.add(schDStuPer);
                    tmp.add(highNum);
                    tmp.add(highPer);
                    tmp.add(midNum);
                    tmp.add(midPer);
                    datas.add(tmp);
                } else if(section == 1){
                	long paperId = data.getLongValue("paperId");
                    JSONArray secArr = beao.getSectionScore(paperId);
                    JSONObject secObj = secArr.getJSONObject(0);
                    JSONArray ABscores = secObj.getJSONArray("sectionPaperScores");
                    JSONObject Ascores = ABscores.getJSONObject(0);
                    double Ascore = Ascores.getDoubleValue("disScore");
                    double Escore = Ascore*0.8;
                    double Pscore = Ascore*0.6;
                    double Dscore = Ascore*0.4;
                    int Enum = 0;
                    int Pnum = 0;
                    int Dnum = 0;
                	String index = getCicadaIndex(exam.getExamDate(), schIds[i]);
                	CicadaEAO ceao = new CicadaEAOImpl(index);
                	CicadaEAO = ceao.getStatStuScoreNum(examId, xkId);
                     for(int j = 0; j < CicadaEAO.size(); j++){
                    	 JSONObject stuscores = CicadaEAO.getJSONObject(j);
                    	 JSONArray abscores = stuscores.getJSONArray("stuSections");
                    	 if(abscores != null ){
	                    	 JSONObject ascores = abscores.getJSONObject(0);
	                    	 double ascore = ascores.getDoubleValue("disStuScore");
	                    	 if (ascore >= Escore ){
	                    		 ++Enum;
	                    	 }
	                    	 if (ascore >= Pscore){
	                    		 ++Pnum;
	                    	 }
	                    	 if (ascore < Dscore){
	                    		 ++Dnum;
	                    	 }
                    	 }
                    	 
                     }
                     double schEStuPer = (double)Enum/schStuNum;
                     double schPassPer = (double)Pnum/schStuNum;;
                     double schDStuPer = (double)Dnum/schStuNum;;
                     tmp.add(schName);
                     tmp.add(schStuNum);
                     tmp.add(Enum);
                     tmp.add(schEStuPer);
                     tmp.add(Pnum);
                     tmp.add(schPassPer);
                     tmp.add(Dnum);
                     tmp.add(schDStuPer);
                     tmp.add("");
                     tmp.add("");
                     tmp.add("");
                     tmp.add("");
                     datas.add(tmp);
                	
                }else if(section == 2){
                	long paperId = data.getLongValue("paperId");
                    JSONArray secArr = beao.getSectionScore(paperId);
                    JSONObject secObj = secArr.getJSONObject(0);
                    JSONArray ABscores = secObj.getJSONArray("sectionPaperScores");
                    JSONObject Bscores = ABscores.getJSONObject(1);
                    double Bscore = Bscores.getDoubleValue("disScore");
                    double Escore = Bscore*0.8;
                    double Pscore = Bscore*0.6;
                    double Dscore = Bscore*0.4;
                    int Enum = 0;
                    int Pnum = 0;
                    int Dnum = 0;
                	String index = getCicadaIndex(exam.getExamDate(), schIds[i]);
                	CicadaEAO ceao = new CicadaEAOImpl(index);
                	CicadaEAO = ceao.getStatStuScoreNum(examId, xkId);
                     for(int j = 0; j < CicadaEAO.size(); j++){
                    	 JSONObject stuscores = CicadaEAO.getJSONObject(j);
                    	 JSONArray abscores = stuscores.getJSONArray("stuSections");
                    	 if(abscores != null ){
	                    	 JSONObject bscores = abscores.getJSONObject(1);
	                    	 double bscore = bscores.getDoubleValue("disStuScore");
	                    	 if (bscore >= Escore ){
	                    		 ++Enum;
	                    	 }
	                    	 if (bscore >= Pscore){
	                    		 ++Pnum;
	                    	 }
	                    	 if (bscore < Dscore){
	                    		 ++Dnum;
	                    	 }
                    	 }
                    	 
                     }
                     double schEStuPer = (double)Enum/schStuNum;
                     double schPassPer = (double)Pnum/schStuNum;;
                     double schDStuPer = (double)Dnum/schStuNum;;
                     tmp.add(schName);
                     tmp.add(schStuNum);
                     tmp.add(Enum);
                     tmp.add(schEStuPer);
                     tmp.add(Pnum);
                     tmp.add(schPassPer);
                     tmp.add(Dnum);
                     tmp.add(schDStuPer);
                     tmp.add("");
                     tmp.add("");
                     tmp.add("");
                     tmp.add("");
                     datas.add(tmp);
                }
    
            }
        }
     
        return datas;
    }

}


你可能感兴趣的:(java,java)