parent
64b507fb70
commit
7b1a99cbf0
33 changed files with 1760 additions and 83 deletions
@ -0,0 +1,619 @@ |
||||
package com.blockchain.server.yyyf.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.blockchain.server.yyyf.dto.PractiseProDto; |
||||
import com.blockchain.server.yyyf.dto.PractiseTaskDto; |
||||
import com.blockchain.server.yyyf.entity.AssessUser; |
||||
import com.blockchain.server.yyyf.service.AssessUserService; |
||||
import com.blockchain.server.yyyf.service.AssessUserTaskService; |
||||
import com.blockchain.server.yyyf.utils.MSExcelUtil; |
||||
import com.blockchain.server.yyyf.utils.ResponseUtils; |
||||
|
||||
import org.apache.poi.hssf.usermodel.*; |
||||
import org.apache.poi.hssf.util.HSSFColor; |
||||
import org.apache.poi.ss.util.CellRangeAddress; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.ui.Model; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
import sun.misc.BASE64Decoder; |
||||
|
||||
import javax.servlet.ServletOutputStream; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.math.BigDecimal; |
||||
import java.net.URLEncoder; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.*; |
||||
|
||||
/** |
||||
* @author huan.xu |
||||
* @version 1.0 |
||||
* @className TeachingGradeController |
||||
* @description 练习、考核成绩Controller |
||||
* @date 2019-11-05 16:23 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping("/teachingGrade") |
||||
public class TeachingGradeController { |
||||
protected Logger logger = LoggerFactory.getLogger(TeachingGradeController.class); |
||||
|
||||
private static final String SYS_CODE = "102"; |
||||
|
||||
@Autowired |
||||
private AssessUserService assessUserService; |
||||
@Autowired |
||||
private AssessUserTaskService assessUserTaskService; |
||||
// @Autowired
|
||||
// private ScoreSynchroService scoreSynchroService;
|
||||
|
||||
|
||||
/** |
||||
* http://10.10.17.93:8080/BankTrain/teachingGrade/getGradeData?issueId=7e027a96764b4749b2a2d65cdc4a5c92&totalNum=10&caseId=38
|
||||
* |
||||
* @param [request, response] |
||||
* @return void |
||||
* @description 教师端获取错误率 (issueId:考核id【即reqId】;totalNum:班级总人数;caseId:项目id) |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:03:39 |
||||
**/ |
||||
@RequestMapping(value = "/getGradeData"/*,produces = {"application/text;charset=UTF-8"}*/) |
||||
@ResponseBody |
||||
@SuppressWarnings("all") |
||||
public void getGradeData(HttpServletRequest request, HttpServletResponse response) { |
||||
|
||||
String issueId = request.getParameter("issueId"); |
||||
String totalNumStr = request.getParameter("totalNum"); |
||||
String projectId = request.getParameter("caseId");//项目id
|
||||
Integer totalNum = Integer.valueOf(totalNumStr); |
||||
|
||||
JSONObject json = new JSONObject(); |
||||
try {/* |
||||
//根据考核id 查询所有的有成绩的学生考核概览信息
|
||||
List<AssessUser> assessUserList = this.assessUserService.selectAssessUserListByIssueId(issueId); |
||||
Map<String, Object> wrongStatistics = null;//错误信息
|
||||
//无人考试 时封装错误率
|
||||
if (assessUserList == null || (assessUserList != null && assessUserList.size() == 0)) { |
||||
|
||||
//String projectName = JedisUtil.getMapValue(JedisUtil.bulidKey(Const.TIFPRO_KEY), projectId, TifPro.class).getProjectName();
|
||||
//获取所有交易关联信息
|
||||
List<TiftrnDto> tiftrnDtoList = JedisUtil.getMapValueForList(JedisUtil.bulidKey(Const.TIFTRN_KEY), projectId, TiftrnDto.class); |
||||
|
||||
wrongStatistics = new HashMap<>(); |
||||
|
||||
Map<String, Object> maxErrorRateInfo = new HashMap<>();//最大错误率信息记录
|
||||
Map<String, Object> minErrorRateInfo = new HashMap<>();//最小错误率信息记录
|
||||
List<String> taskNames = new ArrayList<>(); |
||||
List<Double> errorRates = new ArrayList<>(); |
||||
for (TiftrnDto tifDtotrn : tiftrnDtoList) { |
||||
List<TestPointDto> testPoints = tifDtotrn.getTestPoints(); |
||||
if (testPoints != null && testPoints.size() != 0) { |
||||
for (TestPointDto testPointDto : testPoints) { |
||||
taskNames.add(testPointDto.getPointName()); |
||||
errorRates.add(Double.valueOf(100)); |
||||
if (maxErrorRateInfo.size() == 0) { |
||||
maxErrorRateInfo.put("headCount", totalNum); |
||||
maxErrorRateInfo.put("taskName", testPointDto.getPointName()); |
||||
maxErrorRateInfo.put("errorRate", Double.valueOf(100)); |
||||
maxErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
||||
maxErrorRateInfo.put("errorCount", totalNum); |
||||
continue; |
||||
} |
||||
if (minErrorRateInfo.size() == 0) { |
||||
minErrorRateInfo.put("headCount", totalNum); |
||||
minErrorRateInfo.put("taskName", testPointDto.getPointName()); |
||||
minErrorRateInfo.put("errorRate", Double.valueOf(100)); |
||||
minErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
||||
minErrorRateInfo.put("errorCount", totalNum); |
||||
continue; |
||||
} |
||||
} |
||||
|
||||
} else { |
||||
taskNames.add(tifDtotrn.getTrxName()); |
||||
errorRates.add(Double.valueOf(100)); |
||||
if (maxErrorRateInfo.size() == 0) { |
||||
maxErrorRateInfo.put("headCount", totalNum); |
||||
maxErrorRateInfo.put("taskName", tifDtotrn.getTrxName()); |
||||
maxErrorRateInfo.put("errorRate", Double.valueOf(100)); |
||||
maxErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
||||
maxErrorRateInfo.put("errorCount", totalNum); |
||||
continue; |
||||
} |
||||
if (minErrorRateInfo.size() == 0) { |
||||
minErrorRateInfo.put("headCount", totalNum); |
||||
minErrorRateInfo.put("taskName", tifDtotrn.getTrxName()); |
||||
minErrorRateInfo.put("errorRate", Double.valueOf(100)); |
||||
minErrorRateInfo.put("projectName", tifDtotrn.getTrxName()); |
||||
minErrorRateInfo.put("errorCount", totalNum); |
||||
continue; |
||||
} |
||||
} |
||||
} |
||||
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo); |
||||
wrongStatistics.put("minErrorRateInfo", minErrorRateInfo); |
||||
wrongStatistics.put("taskNames", taskNames); |
||||
wrongStatistics.put("errorRates", errorRates); |
||||
|
||||
} else { |
||||
wrongStatistics = getWrongStatistics(issueId, totalNum - assessUserList.size()); |
||||
} |
||||
|
||||
|
||||
json.put("result", true); |
||||
json.put("wrongStatistics", wrongStatistics);*/ |
||||
} catch (Exception e) { |
||||
json.put("result", false); |
||||
json.put("msg", "获取成绩报表数据失败"); |
||||
logger.error("获取成绩报表数据失败: " + e.getMessage(), e); |
||||
} |
||||
|
||||
ResponseUtils.renderJson(response, json.toString()); |
||||
} |
||||
|
||||
/** |
||||
* @param [issueId, notExamNum] |
||||
* @return java.util.Map<java.lang.String, java.lang.Object> |
||||
* @description 封装错误率 |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:27:22 |
||||
**/ |
||||
public Map<String, Object> getWrongStatistics(String issueId, Integer notExamNum) { |
||||
Map<String, Object> wrongStatistics = new HashMap<String, Object>(); |
||||
//根据考核发布id,获取考核点信息
|
||||
List<Map<String, Object>> taskListDb = assessUserTaskService.selectYHTaskInfoByIssueId(issueId); |
||||
List<Map<String, Object>> taskList = new ArrayList<>(); |
||||
String appTaskIdStrs = ","; |
||||
|
||||
//key 考核点id(无考核点则是交易的id),value为答题情况集合
|
||||
Map<String, List<Map<String, Object>>> userTasksMap = new HashMap<>(); |
||||
|
||||
for (Map map : taskListDb) { |
||||
String appTaskId = (String) map.get("appTaskId"); |
||||
List<Map<String, Object>> mapList = userTasksMap.get(appTaskId); |
||||
if (mapList == null) { |
||||
mapList = new ArrayList<>(); |
||||
} |
||||
mapList.add(map); |
||||
userTasksMap.put(appTaskId, mapList); |
||||
String s = appTaskId + ","; |
||||
if (!appTaskIdStrs.contains("," + s)) { |
||||
taskList.add(map); |
||||
appTaskIdStrs += s; |
||||
} |
||||
} |
||||
|
||||
|
||||
Map<String, Object> maxErrorRateInfo = null;//最大错误率信息记录
|
||||
Map<String, Object> minErrorRateInfo = null;//最小错误率信息记录
|
||||
//记录考核点名称
|
||||
String[] taskNames = new String[taskList.size()]; |
||||
//记录错误率
|
||||
double[] errorRates = new double[taskList.size()]; |
||||
for (int i = 0; i < taskList.size(); i++) { |
||||
Map<String, Object> task = taskList.get(i); |
||||
taskNames[i] = task.get("taskName").toString(); |
||||
/*Map<String,Object> con = new HashMap<String,Object>(); |
||||
con.put("issueId", issueId); |
||||
con.put("classId", classId); |
||||
con.put("appTaskId", task.get("appTaskId"));*/ |
||||
//获取该考核点用户的答题情况
|
||||
List<Map<String, Object>> userTasks = new ArrayList<Map<String, Object>>(); |
||||
userTasks = userTasksMap.get(task.get("appTaskId")); |
||||
int errorCount = notExamNum;//错误人数
|
||||
for (Map<String, Object> userTask : userTasks) { |
||||
//答题错误记录人数
|
||||
if (Integer.valueOf(userTask.get("answer").toString()) == 1) { |
||||
errorCount++; |
||||
} |
||||
} |
||||
int totalNum = userTasks.size() + notExamNum; |
||||
double errorRate = (double) (errorCount) / (double) (totalNum) * 100;//计算错误率
|
||||
errorRate = Double.valueOf(String.format("%.2f", errorRate));//四舍五入保留两位小数
|
||||
errorRates[i] = errorRate; |
||||
//处理最大和最小错误率信息
|
||||
if (maxErrorRateInfo == null) { |
||||
maxErrorRateInfo = new HashMap<String, Object>(); |
||||
maxErrorRateInfo.put("projectName", task.get("projectName").toString()); |
||||
maxErrorRateInfo.put("taskName", task.get("taskName").toString()); |
||||
maxErrorRateInfo.put("headCount", totalNum); |
||||
maxErrorRateInfo.put("errorCount", errorCount); |
||||
maxErrorRateInfo.put("errorRate", errorRate); |
||||
} else { |
||||
//上一次最大错误率
|
||||
double prevMaxErrorRate = Double.valueOf(maxErrorRateInfo.get("errorRate").toString()); |
||||
if (errorRate > prevMaxErrorRate) { |
||||
//本次错误率大于上次,则记录本次信息
|
||||
maxErrorRateInfo.put("projectName", task.get("projectName").toString()); |
||||
maxErrorRateInfo.put("taskName", task.get("taskName").toString()); |
||||
maxErrorRateInfo.put("headCount", totalNum); |
||||
maxErrorRateInfo.put("errorCount", errorCount); |
||||
maxErrorRateInfo.put("errorRate", errorRate); |
||||
} |
||||
} |
||||
if (minErrorRateInfo == null) { |
||||
minErrorRateInfo = new HashMap<String, Object>(); |
||||
minErrorRateInfo.put("projectName", task.get("projectName").toString()); |
||||
minErrorRateInfo.put("taskName", task.get("taskName").toString()); |
||||
minErrorRateInfo.put("headCount", totalNum); |
||||
minErrorRateInfo.put("errorCount", errorCount); |
||||
minErrorRateInfo.put("errorRate", errorRate); |
||||
} else { |
||||
//上一次最小错误率
|
||||
double prevMinErrorRate = Double.valueOf(minErrorRateInfo.get("errorRate").toString()); |
||||
if (prevMinErrorRate > errorRate) { |
||||
//本次错误率小于上次最小错误率,则记录本次信息
|
||||
minErrorRateInfo.put("projectName", task.get("projectName").toString()); |
||||
minErrorRateInfo.put("taskName", task.get("taskName").toString()); |
||||
minErrorRateInfo.put("headCount", totalNum); |
||||
minErrorRateInfo.put("errorCount", errorCount); |
||||
minErrorRateInfo.put("errorRate", errorRate); |
||||
} |
||||
} |
||||
} |
||||
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo); |
||||
wrongStatistics.put("minErrorRateInfo", minErrorRateInfo); |
||||
wrongStatistics.put("taskNames", taskNames); |
||||
wrongStatistics.put("errorRates", errorRates); |
||||
return wrongStatistics; |
||||
} |
||||
|
||||
/** |
||||
* @param [reqType, issueId, userId, stuNo, userName, className, caseId, model] |
||||
* @return java.lang.String |
||||
* @description 获取考核详情 |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:27:50 |
||||
**/ |
||||
|
||||
@RequestMapping("/studyGrade/mygrade") |
||||
public String selectPractiseProList(String reqType, String issueId, String examName, Integer userId, String stuNo, String userName, String className, String caseId, Model model) { |
||||
try {/* |
||||
AssessUser assessUser = null; |
||||
List<String> assessUserIds = new ArrayList<String>(); |
||||
model.addAttribute("assessUserIds", assessUserIds); |
||||
model.addAttribute("reqType", reqType); |
||||
model.addAttribute("caseId", caseId); |
||||
if ("1".equals(reqType)) { //考核
|
||||
assessUser = this.assessUserService.selectScore(SYS_CODE, issueId, userId); |
||||
} else {//练习
|
||||
List<AssessUser> assessUserList = this.assessUserService.selectAssessUserListByIssuerIdAndUserId(issueId, userId); |
||||
for (AssessUser assessUserInner : assessUserList) { |
||||
if (assessUser == null) { |
||||
//取第一个,最新的
|
||||
assessUser = assessUserInner; |
||||
} |
||||
assessUserIds.add(assessUserInner.getId()); |
||||
} |
||||
} |
||||
if (assessUser != null) { //不为空,说明其做过
|
||||
cratePractiseProDtosForNotNull(assessUser, model); |
||||
} else { //为空,则生成一个,这个可不要,因为考核无答题的话,不会进入详情的页面
|
||||
List<PractiseProDto> practiseProDtos = new ArrayList<PractiseProDto>(); |
||||
//交易码
|
||||
List<TiftrnDto> tiftrnDtoList = JedisUtil.getMapValueForList(JedisUtil.bulidKey(Const.TIFTRN_KEY), caseId, TiftrnDto.class); //获取所有交易关联信息
|
||||
for (TiftrnDto tiftrnDto : tiftrnDtoList) { |
||||
PractiseProDto practiseProDto = new PractiseProDto(); |
||||
practiseProDto.setId(tiftrnDto.getTrxCode()); |
||||
practiseProDto.setProjectCaseDesc(String.valueOf(tiftrnDto.getSerNum())); |
||||
practiseProDto.setProjectScore(BigDecimal.ZERO); |
||||
practiseProDto.setProName(tiftrnDto.getTrxName()); |
||||
List<TestPointDto> testPoints = tiftrnDto.getTestPoints(); |
||||
if (testPoints != null && testPoints.size() > 0) { |
||||
List<PractiseTaskDto> taskList = new ArrayList<PractiseTaskDto>(); |
||||
for (TestPointDto testPointDto : testPoints) { |
||||
PractiseTaskDto practiseTaskDto = new PractiseTaskDto(); |
||||
practiseTaskDto.setId(String.valueOf(testPointDto.getPointId())); |
||||
practiseTaskDto.setAnswer(1); |
||||
practiseTaskDto.setProjectName(tiftrnDto.getTrxName()); |
||||
practiseTaskDto.setRightAnswer(testPointDto.getTestPointAnswer()); |
||||
practiseTaskDto.setStuAnswer("-"); |
||||
practiseTaskDto.setTaskName(testPointDto.getPointName()); |
||||
practiseTaskDto.setTaskScore(BigDecimal.valueOf(testPointDto.getTestPointScore())); |
||||
taskList.add(practiseTaskDto); |
||||
} |
||||
practiseProDto.setTaskList(taskList); |
||||
} |
||||
practiseProDtos.add(practiseProDto); |
||||
} |
||||
model.addAttribute("examDate", "-"); |
||||
model.addAttribute("useTime", "00:00:00"); |
||||
model.addAttribute("totalScore", BigDecimal.ZERO); |
||||
model.addAttribute("practiseProDtos", practiseProDtos); |
||||
} |
||||
|
||||
model.addAttribute("stuNo", stuNo); |
||||
model.addAttribute("userName", new String(new BASE64Decoder().decodeBuffer(userName.replaceAll(" ", "+")), "UTF-8")); |
||||
model.addAttribute("className", new String(new BASE64Decoder().decodeBuffer(className.replaceAll(" ", "+")), "UTF-8")); |
||||
model.addAttribute("examName", new String(new BASE64Decoder().decodeBuffer(examName.replaceAll(" ", "+")), "UTF-8")); |
||||
model.addAttribute("caseInfo", JedisUtil.getMapValue(JedisUtil.bulidKey(Const.TIFPRO_KEY), caseId, TifPro.class).getCaseInfo()); |
||||
*/} catch (Exception e) { |
||||
logger.error("获取成绩失败: " + e.getMessage(), e); |
||||
} |
||||
return "/yyyf/exam_mesaage"; |
||||
} |
||||
|
||||
/** |
||||
* @param [assessUserId, model] |
||||
* @return java.lang.String |
||||
* @description 练习用于上一次、下一次的页面切换 |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:46:05 |
||||
**/ |
||||
@RequestMapping("/studyGrade/examMesaageDetails") |
||||
public String examMesaageDetails(String assessUserId, Model model) { |
||||
AssessUser assessUser = this.assessUserService.selectAssessUserById(assessUserId.trim()); |
||||
cratePractiseProDtosForNotNull(assessUser, model); |
||||
return "/yyyf/exam_mesaage_details"; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param [assessUser, model] |
||||
* @return void |
||||
* @description 封装有成绩的答题详情 |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:38:41 |
||||
**/ |
||||
public void cratePractiseProDtosForNotNull(AssessUser assessUser, Model model) { |
||||
List<PractiseProDto> practiseProDtos = this.assessUserService.selectPractiseProList(assessUser.getId()); |
||||
double duration = assessUser.getEndTime().getTime() - assessUser.getStartTime().getTime(); |
||||
String h = String.format("%02d", (int) Math.floor(duration / 1000 / 60 / 60)); |
||||
String m = String.format("%02d", (int) Math.floor(duration / 1000 / 60 % 60)); |
||||
String s = String.format("%02d", (int) Math.floor(duration / 1000 % 60)); |
||||
model.addAttribute("useTime", h + ":" + m + ":" + s); |
||||
model.addAttribute("totalScore", assessUser.getTotalScore()); |
||||
model.addAttribute("examDate", new SimpleDateFormat("yyyy/MM/dd").format(assessUser.getStartTime())); |
||||
model.addAttribute("practiseProDtos", practiseProDtos); |
||||
model.addAttribute("assessUserId", assessUser.getId()); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param [issueId, authorization] |
||||
* @return java.util.Map<java.lang.String, java.lang.Object> |
||||
* @description 重新成绩同步 |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:39:55 |
||||
**/ |
||||
@RequestMapping("/studyGrade/reSynchroze") |
||||
@ResponseBody |
||||
@SuppressWarnings("all") |
||||
public Map<String, Object> reSynchroze(String issueId, String authorization) { |
||||
Map<String, Object> result = new HashMap<>(); |
||||
/* result.put("status", 0); |
||||
result.put("msg", "系统错误"); |
||||
try { |
||||
if ("87DIVy348Oxzj3ha".equals(authorization)) { |
||||
|
||||
result = this.scoreSynchroService.synchrozeScoreList(issueId); |
||||
|
||||
} else { |
||||
result.put("msg", "验证错误"); |
||||
} |
||||
} catch (Exception e) { |
||||
result.put("msg", "同步失败,请进行后台检查"); |
||||
logger.error(e.getMessage(), e); |
||||
}*/ |
||||
return result; |
||||
} |
||||
|
||||
|
||||
@RequestMapping("/export") |
||||
@ResponseBody |
||||
public void yhExport(HttpServletRequest request, HttpServletResponse response) {/* |
||||
String examName = request.getParameter("examName"); |
||||
String className = request.getParameter("className"); |
||||
String stuNo = request.getParameter("stuNo"); |
||||
String totalScore = request.getParameter("totalScore"); |
||||
String useTime = request.getParameter("useTime"); |
||||
String examDate = request.getParameter("examDate"); |
||||
String assessUserId = request.getParameter("assessUserId"); |
||||
String userName = request.getParameter("userName"); |
||||
String caseInfo = request.getParameter("caseInfo"); |
||||
String caseId = request.getParameter("caseId"); |
||||
// TifPro tifPro = JedisUtil.getMapValue(JedisUtil.bulidKey(Const.TIFPRO_KEY), caseId, TifPro.class);
|
||||
|
||||
//设置导出文件名称
|
||||
String fileName = ((new SimpleDateFormat("yyyyMMdd")).format(new Date()))+"-"+userName+ "-考核详情.xls"; |
||||
response.setContentType("application/x-download");//不同类型的文件对应不同的MIME类型
|
||||
try { |
||||
if (request.getHeader("USER-AGENT").toLowerCase().indexOf("firefox") > 0) { |
||||
fileName = new String(fileName.getBytes("GB2312"), "ISO-8859-1"); |
||||
} else { |
||||
fileName = URLEncoder.encode(fileName, "UTF-8"); |
||||
} |
||||
} catch (UnsupportedEncodingException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
response.setHeader("Content-Disposition", "attachment; filename=" + fileName); |
||||
HSSFWorkbook wb = new HSSFWorkbook(); |
||||
HSSFSheet sheet = wb.createSheet("成绩详情"); //创建table工作薄
|
||||
Object[][] datas = { |
||||
{"学生姓名:" + userName, |
||||
"班级:" + className, |
||||
"学号:" + stuNo, |
||||
"成绩:" + totalScore+" 分", |
||||
"日期:" + examDate, "用时:" + useTime}, |
||||
{"考核名称:" + examName,"","","","",""}, |
||||
{"项目名称:" + tifPro.getProjectName(),"","","","",""}, |
||||
{"项目背景:" + caseInfo,"","","","",""}, |
||||
{"成绩解析:","","","","",""}}; |
||||
|
||||
List<Object[]> cellDate = new ArrayList<Object[]>(); |
||||
for (Object[] data : datas) { |
||||
cellDate.add(data); |
||||
} |
||||
|
||||
List<PractiseProDto> practiseProDtos = this.assessUserService.selectPractiseProList(assessUserId); |
||||
|
||||
//合并单元格参数
|
||||
List<int[]> regionList = new ArrayList<int[]>(); |
||||
regionList.add(new int[]{1, 1, 0, 5}); |
||||
regionList.add(new int[]{2, 2, 0, 5}); |
||||
regionList.add(new int[]{3, 3, 0, 5}); |
||||
regionList.add(new int[]{4, 4, 0, 5}); |
||||
|
||||
|
||||
int reginonIndex = 4; |
||||
|
||||
HSSFRow row; |
||||
HSSFCell cell; |
||||
|
||||
|
||||
//regionList.add(new int[]{5,5,1,2});
|
||||
|
||||
|
||||
//靠左的行索引
|
||||
HashSet leftRowIndexSet=new HashSet(); |
||||
leftRowIndexSet.add(reginonIndex); |
||||
for (PractiseProDto practiseProDto : practiseProDtos) { |
||||
reginonIndex++; |
||||
leftRowIndexSet.add(reginonIndex); |
||||
|
||||
regionList.add(new int[]{reginonIndex, reginonIndex, 0, 5}); |
||||
Object[] trx = {practiseProDto.getProName()+("(得分:")+(practiseProDto.getProjectScore())+(")").toString()}; |
||||
cellDate.add(trx);//交易层次
|
||||
|
||||
//
|
||||
Object[] trxTitle = {"序号", "考核点", "正确答案", "学生答案", "考核点分值", "得分"}; |
||||
cellDate.add(trxTitle); |
||||
reginonIndex++; |
||||
|
||||
|
||||
*//*Object[] assess = {"",taskVo.getTaskName(),"",(taskVo.getAnswer()==0?"对":"错"),""};
|
||||
cellDate.add(assess);*//*
|
||||
List<PractiseTaskDto> taskList = practiseProDto.getTaskList(); |
||||
|
||||
if (taskList != null && taskList.size() > 0) { |
||||
int i = 1; |
||||
for (PractiseTaskDto taskDto : taskList) { |
||||
String rightAnswer = taskDto.getRightAnswer(); |
||||
if (rightAnswer == null) { |
||||
rightAnswer = "-"; |
||||
} |
||||
String stuAnswer = taskDto.getStuAnswer(); |
||||
if (stuAnswer == null) { |
||||
stuAnswer = "-"; |
||||
} |
||||
|
||||
BigDecimal studentScore = BigDecimal.ZERO; |
||||
|
||||
if (taskDto.getAnswer().intValue() == 0) { |
||||
studentScore = taskDto.getTaskScore(); |
||||
} |
||||
Object[] assess = {i, taskDto.getTaskName(), rightAnswer, stuAnswer, taskDto.getTaskScore(), studentScore}; |
||||
cellDate.add(assess); |
||||
reginonIndex++; |
||||
i++; |
||||
} |
||||
} else { |
||||
Object[] assess = {"-", "-", "-", "-", "-", "-"}; |
||||
cellDate.add(assess); |
||||
reginonIndex++; |
||||
} |
||||
|
||||
*//*regionList.add(new int[]{maxRow,maxRow,1,2});
|
||||
maxRow ++;*//*
|
||||
} |
||||
|
||||
int size = cellDate.size(); |
||||
for (int i = 0; i < size; i++) { |
||||
//居中标识
|
||||
short alignment=2; |
||||
if(leftRowIndexSet.contains(i)){ |
||||
//居左
|
||||
alignment=1; |
||||
} |
||||
row = sheet.createRow(i);//创建表格行
|
||||
int length = cellDate.get(i).length; |
||||
for (int j = 0; j <length ; j++) { |
||||
cell = row.createCell(j);//根据表格行创建单元格
|
||||
|
||||
String str = String.valueOf(cellDate.get(i)[j]); |
||||
if(i==0&&j==3){ |
||||
setFontColor(wb,cell,str,3,str.length()); |
||||
}else if(alignment==1 && i > 4 ){ |
||||
setFontColor(wb,cell,str,str.indexOf(":")+1,str.length()-1); |
||||
}else{ |
||||
cell.setCellValue(str); |
||||
} |
||||
|
||||
|
||||
|
||||
HSSFCellStyle cellStyle = wb.createCellStyle(); |
||||
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); |
||||
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); |
||||
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); |
||||
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); |
||||
cellStyle.setAlignment(alignment); |
||||
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); |
||||
if(i==3) |
||||
cellStyle.setWrapText(true); |
||||
cell.setCellStyle(cellStyle); |
||||
} |
||||
row = sheet.getRow(i); |
||||
if (i ==3) |
||||
row.setHeightInPoints(320); |
||||
else |
||||
row.setHeightInPoints(30); |
||||
} |
||||
|
||||
|
||||
int cellDate1Len = cellDate.get(0).length; |
||||
|
||||
for (int j = 0; j < cellDate1Len; j++) { |
||||
sheet.setColumnWidth(j, MSExcelUtil.pixel2WidthUnits(180)); |
||||
} |
||||
|
||||
for (int[] regions : regionList) { |
||||
//合并单元格
|
||||
CellRangeAddress region = new CellRangeAddress(regions[0], // first row
|
||||
regions[1], // last row
|
||||
regions[2], // first column
|
||||
regions[3] // last column
|
||||
); |
||||
sheet.addMergedRegion(region); |
||||
} |
||||
|
||||
ServletOutputStream sos = null; |
||||
|
||||
try { |
||||
sos = response.getOutputStream(); |
||||
wb.write(sos); |
||||
sos.close(); |
||||
} catch (Exception e) { |
||||
logger.error(e.getMessage(), e); |
||||
} finally { |
||||
if (sos != null) { |
||||
try { |
||||
sos.close(); |
||||
} catch (IOException e) { |
||||
logger.error(e.getMessage(), e); |
||||
} |
||||
|
||||
} |
||||
}*/ |
||||
} |
||||
|
||||
/** |
||||
* @description poi实现单元格中部分字体颜色设定 |
||||
* @author huan.xu |
||||
* @date 2019-12-10 16:19:48 |
||||
* @param [cell, wb, str, startIndex, endIndex] |
||||
* @return void |
||||
**/ |
||||
private void setFontColor(HSSFWorkbook wb, HSSFCell cell, String str, int startIndex, int endIndex ){ |
||||
HSSFFont font=wb.createFont(); |
||||
font.setColor(HSSFColor.RED.index); |
||||
HSSFRichTextString richString = new HSSFRichTextString(str); |
||||
richString.applyFont(startIndex, endIndex,font); |
||||
cell.setCellValue(richString); |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.blockchain.server.yyyf.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class PractiseProDto implements Serializable { |
||||
private static final long serialVersionUID = -6726051902592416723L; |
||||
|
||||
|
||||
//id
|
||||
private String id; |
||||
//项目名称
|
||||
private String proName; |
||||
//考核项目得分
|
||||
private BigDecimal projectScore; |
||||
//项目案例内容
|
||||
private String projectCaseDesc; |
||||
//案例集合
|
||||
private List<PractiseTaskDto> taskList; |
||||
|
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.blockchain.server.yyyf.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
|
||||
@Data |
||||
public class PractiseTaskDto implements Serializable { |
||||
private static final long serialVersionUID = 6752155834635874301L; |
||||
|
||||
//id
|
||||
private String id; |
||||
private String projectName; |
||||
//考核点名称
|
||||
private String taskName; |
||||
//考核点得分
|
||||
private BigDecimal taskScore; |
||||
//是否正确 0对 1错
|
||||
private Integer answer; |
||||
//考核点正确答案
|
||||
private String rightAnswer; |
||||
//学生答案
|
||||
private String stuAnswer; |
||||
|
||||
} |
@ -0,0 +1,23 @@ |
||||
package com.blockchain.server.yyyf.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
@Data |
||||
public class StudentScoreDto implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
private String authorization = "87DIVy348Oxzj3ha"; |
||||
private String sysType = "102";//
|
||||
private String userId; |
||||
private Float totalScore;//分数
|
||||
private Date startTime;//开始时间
|
||||
private Date endTime;//结束时间
|
||||
private String achievementType;//0 练习 1考核
|
||||
private String assessmentId;//考核id
|
||||
private String classId;//班级ID
|
||||
private String courseId;//课程ID
|
||||
private String caseId; |
||||
} |
@ -0,0 +1,97 @@ |
||||
package com.blockchain.server.yyyf.entity; |
||||
|
||||
|
||||
import lombok.Data; |
||||
|
||||
import javax.persistence.Column; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.Table; |
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
@Table(name = "yyyf_server_assess_user") |
||||
@Data |
||||
public class AssessUser implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@Column(name = "id") |
||||
private String id; |
||||
|
||||
/** |
||||
* 子系统id |
||||
*/ |
||||
@Column(name = "train_id") |
||||
private String trainId; |
||||
|
||||
/** |
||||
* 已发布id |
||||
*/ |
||||
@Column(name = "issue_id") |
||||
private String issueId; |
||||
|
||||
/** |
||||
* 子系统练习id(练习才会用到) |
||||
*/ |
||||
@Column(name = "ss_practise_id") |
||||
private String ssPractiseId; |
||||
|
||||
|
||||
/** |
||||
* 用户id |
||||
*/ |
||||
@Column(name = "user_id") |
||||
private Integer userId; |
||||
/** |
||||
* 得分 |
||||
*/ |
||||
@Column(name = "total_score") |
||||
private BigDecimal totalScore; |
||||
/** |
||||
* 时长 |
||||
*/ |
||||
@Column(name = "duration") |
||||
private Integer duration; |
||||
/** |
||||
* 时长单位 |
||||
*/ |
||||
@Column(name = "duration_unit") |
||||
private String durationUnit; |
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
@Column(name = "start_time") |
||||
private Date startTime; |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
@Column(name = "end_time") |
||||
private Date endTime; |
||||
/** |
||||
* 案例id |
||||
*/ |
||||
@Column(name = "case_id") |
||||
private String caseId; |
||||
|
||||
/** |
||||
* 0 练习 1考核 |
||||
*/ |
||||
@Column(name = "achieve_ment_type") |
||||
private Integer achieveMentType; |
||||
|
||||
/** |
||||
* 绑定班级 |
||||
*/ |
||||
@Column(name = "class_id") |
||||
private String classId; |
||||
|
||||
/** |
||||
* 绑定的课程id |
||||
*/ |
||||
@Column(name = "course_id") |
||||
private String courseId; |
||||
|
||||
|
||||
} |
@ -0,0 +1,46 @@ |
||||
package com.blockchain.server.yyyf.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import javax.persistence.Column; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.Table; |
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
@Table(name = "yyyf_server_assess_user_project") |
||||
@Data |
||||
public class AssessUserProject implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* uuid |
||||
*/ |
||||
@Id |
||||
@Column(name = "id") |
||||
private String id; |
||||
/** |
||||
* 用户考核主表id |
||||
*/ |
||||
@Column(name = "assess_user_id") |
||||
private String assessUserId; |
||||
/** |
||||
* 子系统项目id |
||||
*/ |
||||
@Column(name = "project_id") |
||||
private String projectId; |
||||
/** |
||||
* 子系统项目名称 |
||||
*/ |
||||
@Column(name = "project_name") |
||||
private String projectName; |
||||
/** |
||||
* 项目得分 |
||||
*/ |
||||
@Column(name = "project_score") |
||||
private BigDecimal projectScore; |
||||
|
||||
@Column(name = "project_case_desc") |
||||
private BigDecimal projectCaseDesc; |
||||
|
||||
} |
@ -0,0 +1,69 @@ |
||||
package com.blockchain.server.yyyf.entity; |
||||
|
||||
|
||||
import lombok.Data; |
||||
|
||||
import javax.persistence.Column; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.Table; |
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
@Table(name = "yyyf_server_assess_user_task") |
||||
@Data |
||||
public class AssessUserTask implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@Id |
||||
@Column(name = "id") |
||||
private String id; |
||||
/** |
||||
* 用户考核项目id |
||||
*/ |
||||
@Column(name = "assessProjectId") |
||||
private String assessProjectId; |
||||
/** |
||||
* 任务id |
||||
*/ |
||||
@Column(name = "taskId") |
||||
private String taskId; |
||||
/** |
||||
* 任务名 |
||||
*/ |
||||
@Column(name = "taskName") |
||||
private String taskName; |
||||
/** |
||||
* 答题对错0对 1错 |
||||
*/ |
||||
@Column(name = "answer") |
||||
private Integer answer; |
||||
/** |
||||
* 任务得分 |
||||
*/ |
||||
@Column(name = "taskScore") |
||||
private BigDecimal taskScore; |
||||
|
||||
|
||||
/** |
||||
* 排序字段 |
||||
*/ |
||||
@Column(name = "serialNumber") |
||||
private int serialNumber; |
||||
|
||||
/** |
||||
* 正确答案 |
||||
*/ |
||||
@Column(name = "rightAnswer") |
||||
private String rightAnswer; |
||||
|
||||
/** |
||||
* 学生答案 |
||||
*/ |
||||
@Column(name = "stuAnswer") |
||||
private String stuAnswer; |
||||
|
||||
|
||||
|
||||
} |
@ -1,16 +0,0 @@ |
||||
package com.blockchain.server.yyyf.feign; |
||||
|
||||
import com.blockchain.common.base.dto.ResultDTO; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
/** |
||||
* @author huangxl |
||||
* @create 2019-02-28 17:40 |
||||
*/ |
||||
@FeignClient("dapp-btc-server") |
||||
public interface BtcFeign { |
||||
@GetMapping("/inner/wallet/createWallet") |
||||
ResultDTO createWallet(@RequestParam("userOpenId") String userOpenId); |
||||
} |
@ -1,16 +0,0 @@ |
||||
package com.blockchain.server.yyyf.feign; |
||||
|
||||
import com.blockchain.common.base.dto.ResultDTO; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
/** |
||||
* @author huangxl |
||||
* @create 2019-02-28 17:39 |
||||
*/ |
||||
@FeignClient("dapp-eos-server") |
||||
public interface EosFeign { |
||||
@GetMapping("/inner/walletTx/initEosWallet") |
||||
ResultDTO initEosWallet(@RequestParam("userOpenId") String userOpenId); |
||||
} |
@ -1,16 +0,0 @@ |
||||
package com.blockchain.server.yyyf.feign; |
||||
|
||||
import com.blockchain.common.base.dto.ResultDTO; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
/** |
||||
* @author huangxl |
||||
* @create 2019-02-28 17:39 |
||||
*/ |
||||
@FeignClient("dapp-eth-server") |
||||
public interface EthFeign { |
||||
@GetMapping("/inner/wallet/initWallets") |
||||
ResultDTO initWallets(@RequestParam("userOpenId") String userOpenId); |
||||
} |
@ -0,0 +1,43 @@ |
||||
package com.blockchain.server.yyyf.mapper; |
||||
|
||||
|
||||
import com.blockchain.server.yyyf.dto.PractiseProDto; |
||||
import com.blockchain.server.yyyf.entity.AssessUser; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
|
||||
@Repository |
||||
public interface AssessUserMapper { |
||||
|
||||
void insert(AssessUser assessUser); |
||||
|
||||
void batchInsert(List<AssessUser> assessUserList); |
||||
|
||||
|
||||
AssessUser selectScore( @Param("assessmentId") String assessmentId, @Param("userId") Integer userId); |
||||
|
||||
|
||||
Map<String, Object> selectUserGradeCase(Map<String, Object> con); |
||||
|
||||
|
||||
List<Map<String, Object>> selectUserGradeListByClassIdAndIssueId(Map<String, Object> con); |
||||
|
||||
|
||||
List<PractiseProDto> selectPractiseProList (@Param("assessUserId") String assessUserId); |
||||
|
||||
|
||||
List<AssessUser> selectAssessUserListByIssuerIdAndUserId(@Param("issueId") String issueId, @Param("userId") Integer userId); |
||||
|
||||
|
||||
AssessUser selectAssessUserById(@Param("assessUserId") String assessUserId); |
||||
|
||||
|
||||
List<AssessUser> selectAssessUserListByIssueId(@Param("issueId") String issueId); |
||||
|
||||
void delAssessUserByIssueId(@Param("issueId") String issueId); |
||||
|
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.blockchain.server.yyyf.mapper; |
||||
|
||||
import com.blockchain.server.yyyf.entity.AssessUserProject; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Repository |
||||
public interface AssessUserProjectMapper { |
||||
|
||||
void insert(AssessUserProject assessUserProject); |
||||
|
||||
void batchInsert(List<AssessUserProject> assessUserProjectList); |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.blockchain.server.yyyf.mapper; |
||||
|
||||
import com.blockchain.server.yyyf.entity.AssessUserTask; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Repository |
||||
public interface AssessUserTaskMapper { |
||||
|
||||
void insert(AssessUserTask assessUserTask); |
||||
|
||||
void batchInsert(List<AssessUserTask> assessUserTaskList); |
||||
|
||||
|
||||
List<Map<String, Object>> selectYHTaskInfoByIssueId(@Param("issueId") String issueId); |
||||
} |
@ -0,0 +1,4 @@ |
||||
package com.blockchain.server.yyyf.service; |
||||
|
||||
public interface AssessUserProjectService{ |
||||
} |
@ -0,0 +1,74 @@ |
||||
package com.blockchain.server.yyyf.service; |
||||
|
||||
|
||||
|
||||
import com.blockchain.server.yyyf.dto.PractiseProDto; |
||||
import com.blockchain.server.yyyf.entity.AssessUser; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @param |
||||
* @author huan.xu |
||||
* @description 学生用户考核信息表 服务接口类 |
||||
* @date 2019-10-31 14:36:49 |
||||
* @return |
||||
**/ |
||||
public interface AssessUserService { |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* @description 根据 学生成绩id,查询答题详情 |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:39:11 |
||||
* @param [assessUserId] |
||||
* @return java.util.List<com.gtafeyyyf.dto.PractiseProDto> |
||||
**/ |
||||
public List<PractiseProDto> selectPractiseProList(String assessUserId); |
||||
|
||||
|
||||
/** |
||||
* @param [sysType, issueId, userId] |
||||
* @return com.gtafeyyyf.model.AssessUser |
||||
* @description 考核id,以及用户id 查询学生答题概览(考核) |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:28:30 |
||||
**/ |
||||
AssessUser selectScore( String issueId, Integer userId); |
||||
|
||||
/** |
||||
* @description 根据发布id,用户id 获取学生该练习的所有答题情况 |
||||
* @author huan.xu |
||||
* @date 2019-11-08 18:31:38 |
||||
* @param [issueId, userId] |
||||
* @return java.util.List<com.gtafeyyyf.model.AssessUser> |
||||
**/ |
||||
List<AssessUser> selectAssessUserListByIssuerIdAndUserId(String issueId, Integer userId); |
||||
|
||||
|
||||
/** |
||||
* @description 根据 assessUser 表的id查询assessUser |
||||
* @param [assessUserId] |
||||
* @return com.gtafeyyyf.model.AssessUser |
||||
**/ |
||||
AssessUser selectAssessUserById(String assessUserId); |
||||
|
||||
/** |
||||
* @param [issueId] |
||||
* @return java.util.List<com.gtafeyyyf.model.AssessUser> |
||||
* @description 根据考核id 查询所有的有成绩的学生考核概览信息,这一块可做优化,将其封装成成绩同步的DTO, |
||||
* 在TeachingGradeController的406 行就无需遍历封装。由于时间原因暂不优化 |
||||
**/ |
||||
List<AssessUser> selectAssessUserListByIssueId(String issueId); |
||||
|
||||
/*** |
||||
* @description 通过考试id删除该考试的所有学生成绩 |
||||
* @param [examId] |
||||
* @return void |
||||
**/ |
||||
void delAssessUserByIssueId(String examId); |
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.blockchain.server.yyyf.service; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @className AssessUserTaskService |
||||
* @description |
||||
*/ |
||||
public interface AssessUserTaskService { |
||||
/** |
||||
* @description 根据考核发布id,获取考核点信息 |
||||
* @param [issueId] |
||||
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
||||
**/ |
||||
List<Map<String, Object>> selectYHTaskInfoByIssueId(String issueId); |
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.blockchain.server.yyyf.service.impl; |
||||
|
||||
import com.blockchain.server.yyyf.service.AssessUserProjectService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author huan.xu |
||||
* @version 1.0 |
||||
* @className AssessUserProjectServiceImpl |
||||
* @description |
||||
* @date 2019-10-31 17:40 |
||||
*/ |
||||
@Service |
||||
public class AssessUserProjectServiceImpl implements AssessUserProjectService { |
||||
} |
@ -0,0 +1,74 @@ |
||||
package com.blockchain.server.yyyf.service.impl; |
||||
|
||||
import com.blockchain.server.yyyf.dto.PractiseProDto; |
||||
import com.blockchain.server.yyyf.entity.AssessUser; |
||||
import com.blockchain.server.yyyf.mapper.AssessUserMapper; |
||||
import com.blockchain.server.yyyf.mapper.AssessUserProjectMapper; |
||||
import com.blockchain.server.yyyf.mapper.AssessUserTaskMapper; |
||||
import com.blockchain.server.yyyf.service.AssessUserService; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author huan.xu |
||||
* @version 1.0 |
||||
* @className AssessUserServiceImpl |
||||
* @description 学生用户考核信息表 服务实现类 |
||||
* @date 2019-10-31 14:34 |
||||
*/ |
||||
@Service |
||||
public class AssessUserServiceImpl implements AssessUserService { |
||||
private static Logger LOG = LoggerFactory.getLogger(AssessUserServiceImpl.class); |
||||
|
||||
|
||||
@Autowired |
||||
private AssessUserMapper assessUserMapper; |
||||
@Autowired |
||||
private AssessUserProjectMapper assessUserProjectMapper; |
||||
@Autowired |
||||
private AssessUserTaskMapper assessUserTaskMapper; |
||||
|
||||
private static final String durationUnit = "m";//时长单位
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override |
||||
public List<PractiseProDto> selectPractiseProList (String assessUserId){ |
||||
return this.assessUserMapper.selectPractiseProList(assessUserId); |
||||
} |
||||
|
||||
@Override |
||||
public AssessUser selectScore(String issueId, Integer userId) { |
||||
return this.assessUserMapper.selectScore(issueId,userId); |
||||
} |
||||
|
||||
@Override |
||||
public List<AssessUser> selectAssessUserListByIssuerIdAndUserId(String issueId, Integer userId) { |
||||
return this.assessUserMapper.selectAssessUserListByIssuerIdAndUserId(issueId,userId); |
||||
} |
||||
|
||||
@Override |
||||
public AssessUser selectAssessUserById(String assessUserId) { |
||||
return this.assessUserMapper.selectAssessUserById(assessUserId); |
||||
} |
||||
|
||||
@Override |
||||
public List<AssessUser> selectAssessUserListByIssueId(String issueId) { |
||||
return this.assessUserMapper.selectAssessUserListByIssueId(issueId); |
||||
} |
||||
|
||||
@Transactional |
||||
@Override |
||||
public void delAssessUserByIssueId(String examId) { |
||||
this.assessUserMapper.delAssessUserByIssueId(examId); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,28 @@ |
||||
package com.blockchain.server.yyyf.service.impl; |
||||
|
||||
import com.blockchain.server.yyyf.mapper.AssessUserTaskMapper; |
||||
import com.blockchain.server.yyyf.service.AssessUserTaskService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author huan.xu |
||||
* @version 1.0 |
||||
* @className AssessUserTaskServiceImpl |
||||
* @description |
||||
* @date 2019-10-31 17:40 |
||||
*/ |
||||
@Service |
||||
public class AssessUserTaskServiceImpl implements AssessUserTaskService { |
||||
@Autowired |
||||
private AssessUserTaskMapper assessUserTaskMapper; |
||||
@Override |
||||
public List<Map<String, Object>> selectYHTaskInfoByIssueId(String issueId) { |
||||
return this.assessUserTaskMapper.selectYHTaskInfoByIssueId(issueId); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,27 @@ |
||||
package com.blockchain.server.yyyf.utils; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @className MSExcelUtil |
||||
* @description |
||||
*/ |
||||
public class MSExcelUtil { |
||||
public static final short EXCEL_COLUMN_WIDTH_FACTOR = 256; |
||||
public static final int UNIT_OFFSET_LENGTH = 7; |
||||
public static final int[] UNIT_OFFSET_MAP = new int[] { 0, 36, 73, 109, 146, 182, 219 }; |
||||
|
||||
public static short pixel2WidthUnits(int pxs) { |
||||
short widthUnits = (short) (EXCEL_COLUMN_WIDTH_FACTOR * (pxs / UNIT_OFFSET_LENGTH)); |
||||
widthUnits += UNIT_OFFSET_MAP[(pxs % UNIT_OFFSET_LENGTH)]; |
||||
return widthUnits; |
||||
} |
||||
|
||||
public static int widthUnits2Pixel(int widthUnits) { |
||||
int pixels = (widthUnits / EXCEL_COLUMN_WIDTH_FACTOR) * UNIT_OFFSET_LENGTH; |
||||
int offsetWidthUnits = widthUnits % EXCEL_COLUMN_WIDTH_FACTOR; |
||||
pixels += Math.round(offsetWidthUnits |
||||
/ ((float) EXCEL_COLUMN_WIDTH_FACTOR / UNIT_OFFSET_LENGTH)); |
||||
|
||||
return pixels; |
||||
} |
||||
} |
@ -0,0 +1,77 @@ |
||||
package com.blockchain.server.yyyf.utils; |
||||
|
||||
|
||||
import java.io.IOException; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
/** |
||||
* HttpServletResponse帮助 |
||||
* |
||||
* @author |
||||
* |
||||
*/ |
||||
public final class ResponseUtils { |
||||
public static final Logger logger = LoggerFactory |
||||
.getLogger(ResponseUtils.class); |
||||
|
||||
/** |
||||
* 发送文本。使用UTF-8编码。 |
||||
* |
||||
* @param response |
||||
* HttpServletResponse |
||||
* @param text |
||||
* 发送的字符串 |
||||
*/ |
||||
public static void renderText(HttpServletResponse response, String text) { |
||||
render(response, "text/plain;charset=UTF-8", text); |
||||
} |
||||
|
||||
/** |
||||
* 发送json。使用UTF-8编码。 |
||||
* |
||||
* @param response |
||||
* HttpServletResponse |
||||
* @param text |
||||
* 发送的字符串 |
||||
*/ |
||||
public static void renderJson(HttpServletResponse response, String text) { |
||||
render(response, "application/json;charset=UTF-8", text); |
||||
} |
||||
|
||||
/** |
||||
* 发送xml。使用UTF-8编码。 |
||||
* |
||||
* @param response |
||||
* HttpServletResponse |
||||
* @param text |
||||
* 发送的字符串 |
||||
*/ |
||||
public static void renderXml(HttpServletResponse response, String text) { |
||||
render(response, "text/xml;charset=UTF-8", text); |
||||
} |
||||
|
||||
/** |
||||
* 发送内容。使用UTF-8编码。 |
||||
* |
||||
* @param response |
||||
* @param contentType |
||||
* @param text |
||||
*/ |
||||
public static void render(HttpServletResponse response, String contentType, |
||||
String text) { |
||||
response.setContentType(contentType); |
||||
response.setHeader("Pragma", "No-cache"); |
||||
response.setHeader("Cache-Control", "no-cache"); |
||||
response.setDateHeader("Expires", 0); |
||||
try { |
||||
response.getWriter().write(text); |
||||
response.getWriter().flush(); |
||||
} catch (IOException e) { |
||||
logger.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,207 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.blockchain.server.yyyf.mapper.AssessUserMapper"> |
||||
<resultMap id="YfServerAssessUserResultMap" type="com.blockchain.server.yyyf.entity.AssessUser"> |
||||
<id column="id" jdbcType="VARCHAR" property="id"/> |
||||
<result column="train_id" jdbcType="VARCHAR" property="trainId"/> |
||||
<result column="issue_id" jdbcType="VARCHAR" property="issueId"/> |
||||
<result column="ss_practise_id" jdbcType="VARCHAR" property="ssPractiseId"/> |
||||
<result column="user_id" jdbcType="INTEGER" property="userId"/> |
||||
<result column="total_score" jdbcType="NUMERIC" property="totalScore"/> |
||||
<result column="duration" jdbcType="INTEGER" property="duration"/> |
||||
<result column="duration_unit" jdbcType="VARCHAR" property="durationUnit"/> |
||||
<result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> |
||||
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> |
||||
<result column="case_id" jdbcType="VARCHAR" property="caseId"/> |
||||
<result column="achieve_ment_type" jdbcType="INTEGER" property="achieveMentType"/> |
||||
<result column="class_id" jdbcType="VARCHAR" property="classId"/> |
||||
<result column="course_id" jdbcType="VARCHAR" property="courseId"/> |
||||
</resultMap> |
||||
|
||||
<resultMap id="PractiseProVoResultMap" type="com.blockchain.server.yyyf.dto.PractiseProDto"> |
||||
<id column="id" property="id" /> |
||||
<result column="project_name" property="proName" /> |
||||
<result column="project_score" property="projectScore" /> |
||||
<result column="project_case_desc" property="projectCaseDesc" /> |
||||
<collection property="taskList" ofType="com.blockchain.server.yyyf.dto.PractiseTaskDto"> |
||||
<id column="userTaskid" property="id"/> |
||||
<result column="task_name" property="taskName"/> |
||||
<result column="task_score" property="taskScore"/> |
||||
<result column="answer" property="answer"/> |
||||
<result column="right_answer" property="rightAnswer"/> |
||||
<result column="stu_answer" property="stuAnswer"/> |
||||
</collection> |
||||
</resultMap> |
||||
|
||||
|
||||
|
||||
|
||||
<sql id="YfServerAssessUser_Where_Clause"> |
||||
<if test="id != null "> |
||||
and t.id=#{id,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="trainId != null and trainId != ''"> |
||||
and t.train_id=#{trainId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="issueId != null and issueId != ''"> |
||||
and t.issue_id=#{issueId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="ssPractiseId != null and ssPractiseId != ''"> |
||||
and t.ss_practise_id=#{ssPractiseId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="userId != null and userId != ''"> |
||||
and t.user_id=#{userId,jdbcType=INTEGER} |
||||
</if> |
||||
<if test="totalScore != null and totalScore != ''"> |
||||
and t.total_score=#{totalScore,jdbcType=NUMERIC} |
||||
</if> |
||||
<if test="customerStory != null and customerStory != ''"> |
||||
and t.customer_story=#{customerStory,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="duration != null and duration != ''"> |
||||
and t.duration=#{duration,jdbcType=INTEGER} |
||||
</if> |
||||
<if test="durationUnit != null and durationUnit != ''"> |
||||
and t.duration_unit=#{durationUnit,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="startTime != null and startTime != ''"> |
||||
and t.start_time=#{startTime,jdbcType=TIMESTAMP} |
||||
</if> |
||||
<if test="endTime != null and endTime != ''"> |
||||
and t.end_time=#{endTime,jdbcType=TIMESTAMP} |
||||
</if> |
||||
<if test="caseId != null and caseId != ''"> |
||||
and t.case_id=#{caseId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="achieveMentType != null and achieveMentType != ''"> |
||||
and t.achieve_ment_type=#{achieveMentType,jdbcType=INTEGER} |
||||
</if> |
||||
<if test="classId != null and classId != ''"> |
||||
and t.class_id=#{classId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="courseId != null and courseId != ''"> |
||||
and t.course_id=#{courseId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="groupId != null and groupId != ''"> |
||||
and t.group_id=#{groupId,jdbcType=INTEGER} |
||||
</if> |
||||
</sql> |
||||
|
||||
<sql id="YfServerAssessUser_Column_List"> |
||||
t.id, |
||||
t.train_id, |
||||
t.issue_id, |
||||
t.ss_practise_id, |
||||
t.user_id, |
||||
t.total_score, |
||||
t.duration, |
||||
t.duration_unit, |
||||
t.start_time, |
||||
t.end_time, |
||||
t.case_id, |
||||
t.achieve_ment_type, |
||||
t.class_id, |
||||
t.course_id, |
||||
</sql> |
||||
|
||||
<insert id="insert" parameterType="com.blockchain.server.yyyf.entity.AssessUser"> |
||||
insert into yyyf_server_assess_user ( id, train_id, issue_id, ss_practise_id, user_id, total_score, duration, duration_unit, start_time, end_time, case_id, achieve_ment_type, class_id, course_id) |
||||
values( |
||||
#{id}, |
||||
#{trainId}, |
||||
#{issueId}, |
||||
#{ssPractiseId}, |
||||
#{userId}, |
||||
#{totalScore}, |
||||
#{duration}, |
||||
#{durationUnit}, |
||||
#{startTime}, |
||||
#{endTime}, |
||||
#{caseId}, |
||||
#{achieveMentType}, |
||||
#{classId}, |
||||
#{courseId} |
||||
) |
||||
</insert> |
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List"> |
||||
insert into yyyf_server_assess_user |
||||
values |
||||
|
||||
<foreach collection ="list" item="item" index= "index" separator =","> |
||||
( |
||||
#{item.id}, |
||||
#{item.trainId}, |
||||
#{item.issueId}, |
||||
#{item.ssPractiseId}, |
||||
#{item.userId}, |
||||
#{item.totalScore}, |
||||
#{item.duration}, |
||||
#{item.durationUnit}, |
||||
#{item.startTime}, |
||||
#{item.endTime}, |
||||
#{item.caseId}, |
||||
#{item.achieveMentType}, |
||||
#{item.classId}, |
||||
#{item.courseId}, |
||||
) |
||||
</foreach > |
||||
</insert> |
||||
|
||||
<delete id="delAssessUserByIssueId"> |
||||
delete from yyyf_server_assess_user where issue_id=#{issueId} |
||||
</delete> |
||||
|
||||
<select id="selectScore" resultMap="YfServerAssessUserResultMap"> |
||||
SELECT * from yyyf_server_assess_user where issue_id=#{assessmentId} and user_id=#{userId} and achieve_ment_type = 1 |
||||
</select> |
||||
|
||||
<select id="selectUserGradeCase" resultType="java.util.Map" > |
||||
select AVG(t.TOTAL_SCORE) as avg, |
||||
MAX(t.TOTAL_SCORE) as max, |
||||
MIN(t.TOTAL_SCORE) as min |
||||
from yyyf_server_assess_user t |
||||
where t.class_id= #{classId} and t.issue_id= #{issueId} |
||||
</select> |
||||
<select id="selectUserGradeListByClassIdAndIssueId" resultType="java.util.Map"> |
||||
SELECT t.user_id as userAId,t.TOTAL_SCORE AS totalScore from yyyf_server_assess_user t |
||||
where t.issue_id= #{issueId} |
||||
</select> |
||||
|
||||
|
||||
<select id="selectPractiseProList" resultMap="PractiseProVoResultMap"> |
||||
SELECT |
||||
p.id, |
||||
p.project_name, |
||||
p.project_score, |
||||
p.project_case_desc, |
||||
t.id AS userTaskid, |
||||
t.task_name, |
||||
t.task_score, |
||||
t.answer, |
||||
t.right_answer, |
||||
t.stu_answer |
||||
FROM |
||||
yyyf_server_assess_user u |
||||
LEFT JOIN yyyf_server_assess_user_project p ON u.id = p.assess_user_id |
||||
LEFT JOIN yyyf_server_assess_user_task t ON p.id = t.assess_project_id |
||||
WHERE |
||||
u.id=#{assessUserId} |
||||
ORDER BY CONVERT(p.project_id,SIGNED), t.serial_number,CONVERT(t.task_id,SIGNED) |
||||
</select> |
||||
<select id="selectAssessUserListByIssuerIdAndUserId" resultMap="YfServerAssessUserResultMap"> |
||||
select * from yyyf_server_assess_user |
||||
where achieve_ment_type=0 and issue_id=#{issueId} and user_id=#{userId} |
||||
ORDER BY start_time desc |
||||
</select> |
||||
<select id="selectAssessUserById" resultMap="YfServerAssessUserResultMap"> |
||||
select * from yyyf_server_assess_user where id=#{assessUserId} |
||||
</select> |
||||
|
||||
<select id="selectAssessUserListByIssueId" resultMap="YfServerAssessUserResultMap"> |
||||
select * from yyyf_server_assess_user where issue_id=#{issueId} and achieve_ment_type = 1 |
||||
</select> |
||||
<!-- <select id="getAssessUserByIssueId" resultMap="YfServerAssessUserResultMap"> |
||||
SELECT * from yyyf_server_assess_user |
||||
</select>--> |
||||
</mapper> |
@ -0,0 +1,82 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.blockchain.server.yyyf.mapper.AssessUserProjectMapper"> |
||||
<resultMap id="YfServerAssessUserProjectResultMap" type="com.blockchain.server.yyyf.entity.AssessUserProject"> |
||||
<id column="id" jdbcType="VARCHAR" property="id"/> |
||||
<result column="assess_user_id" jdbcType="VARCHAR" property="assessUserId"/> |
||||
<result column="project_name" jdbcType="VARCHAR" property="projectName"/> |
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId"/> |
||||
<result column="project_score" jdbcType="NUMERIC" property="projectScore"/> |
||||
<result column="project_case_desc" jdbcType="VARCHAR" property="projectCaseDesc"/> |
||||
</resultMap> |
||||
|
||||
<sql id="YfServerAssessUserProject_Where_Clause"> |
||||
<if test="id != null "> |
||||
and t.id=#{id,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="assessUserId != null and assessUserId != ''"> |
||||
and t.assess_user_id=#{assessUserId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="projectName != null and projectName != ''"> |
||||
and t.project_name=#{projectName,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="projectId != null and projectId != ''"> |
||||
and t.project_id=#{projectId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="projectScore != null and projectScore != ''"> |
||||
and t.project_score=#{projectScore,jdbcType=NUMERIC} |
||||
</if> |
||||
<if test="duration != null and duration != ''"> |
||||
and t.duration=#{duration,jdbcType=INTEGER} |
||||
</if> |
||||
<if test="durationUnit != null and durationUnit != ''"> |
||||
and t.duration_unit=#{durationUnit,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="projectCaseDesc != null and projectCaseDesc != ''"> |
||||
and t.project_case_desc=#{projectCaseDesc,jdbcType=VARCHAR} |
||||
</if> |
||||
</sql> |
||||
|
||||
<sql id="YfServerAssessUserProject_Column_List"> |
||||
t.id, |
||||
t.assess_user_id, |
||||
t.project_name, |
||||
t.project_id, |
||||
t.project_score, |
||||
t.duration, |
||||
t.duration_unit, |
||||
t.project_case_desc, |
||||
</sql> |
||||
|
||||
<insert id="insert" parameterType="com.blockchain.server.yyyf.entity.AssessUserProject"> |
||||
insert into yyyf_server_assess_user_project (id, assess_user_id, project_name, project_id, project_score, duration, duration_unit, project_case_desc) |
||||
values( |
||||
#{id}, |
||||
#{assessUserId}, |
||||
#{projectName}, |
||||
#{projectId}, |
||||
#{projectScore}, |
||||
#{duration}, |
||||
#{durationUnit}, |
||||
#{projectCaseDesc} |
||||
) |
||||
</insert> |
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List"> |
||||
insert into yyyf_server_assess_user_project ( id, assess_user_id, project_name, project_id, project_score, project_case_desc) |
||||
values |
||||
<foreach collection ="list" item="item" index= "index" separator =","> |
||||
( |
||||
#{item.id}, |
||||
#{item.assessUserId}, |
||||
#{item.projectName}, |
||||
#{item.projectId}, |
||||
#{item.projectScore}, |
||||
#{item.projectCaseDesc} |
||||
) |
||||
</foreach > |
||||
|
||||
|
||||
|
||||
</insert> |
||||
</mapper> |
@ -0,0 +1,130 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.blockchain.server.yyyf.mapper.AssessUserTaskMapper"> |
||||
|
||||
|
||||
<resultMap id="YfServerAssessUserTaskResultMap" type="com.blockchain.server.yyyf.entity.AssessUserTask"> |
||||
<id column="id" jdbcType="VARCHAR" property="id"/> |
||||
<result column="assess_project_id" jdbcType="VARCHAR" property="assessProjectId"/> |
||||
<result column="task_id" jdbcType="VARCHAR" property="taskId"/> |
||||
<result column="task_name" jdbcType="VARCHAR" property="taskName"/> |
||||
<result column="task_score" jdbcType="NUMERIC" property="taskScore"/> |
||||
<result column="answer" jdbcType="INTEGER" property="answer"/> |
||||
<result column="serial_number" jdbcType="INTEGER" property="serialNumber"/> |
||||
<result column="right_answer" jdbcType="VARCHAR" property="rightAnswer"/> |
||||
<result column="stu_answer" jdbcType="VARCHAR" property="stuAnswer"/> |
||||
</resultMap> |
||||
|
||||
|
||||
<sql id="YfServerAssessUserTask_Where_Clause"> |
||||
<if test="id != null "> |
||||
and t.id=#{id,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="assessProjectId != null and assessProjectId != ''"> |
||||
and t.assess_project_id=#{assessProjectId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="taskId != null and taskId != ''"> |
||||
and t.task_id=#{taskId,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="taskName != null and taskName != ''"> |
||||
and t.task_name=#{taskName,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="taskScore != null and taskScore != ''"> |
||||
and t.task_score=#{taskScore,jdbcType=NUMERIC} |
||||
</if> |
||||
<if test="answer != null and answer != ''"> |
||||
and t.answer=#{answer,jdbcType=INTEGER} |
||||
</if> |
||||
|
||||
<if test="serialNumber != null and serialNumber != ''"> |
||||
and t.serial_number=#{serialNumber,jdbcType=INTEGER} |
||||
</if> |
||||
<if test="rightAnswer != null and rightAnswer != ''"> |
||||
and t.right_answer=#{rightAnswer,jdbcType=VARCHAR} |
||||
</if> |
||||
<if test="stuAnswer != null and stuAnswer != ''"> |
||||
and t.stu_answer=#{stuAnswer,jdbcType=VARCHAR} |
||||
</if> |
||||
</sql> |
||||
|
||||
<sql id="YfServerAssessUserTask_Column_List"> |
||||
t.id, |
||||
t.assess_project_id, |
||||
t.task_id, |
||||
t.task_name, |
||||
t.task_score, |
||||
t.answer, |
||||
t.serial_number, |
||||
t.right_answer, |
||||
t.stu_answer, |
||||
</sql> |
||||
|
||||
<insert id="insert" parameterType="com.blockchain.server.yyyf.entity.AssessUserTask"> |
||||
insert into yyyf_server_assess_user_task ( id, assess_project_id, task_id, task_name, task_score, answer, serial_number, right_answer, stu_answer) |
||||
values( |
||||
#{id}, |
||||
#{assessProjectId}, |
||||
#{taskId}, |
||||
#{taskName}, |
||||
#{taskScore}, |
||||
#{answer}, |
||||
#{serialNumber}, |
||||
#{rightAnswer}, |
||||
#{stuAnswer} |
||||
) |
||||
</insert> |
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List"> |
||||
insert into yyyf_server_assess_user_task |
||||
values |
||||
<foreach collection ="list" item="item" index= "index" separator =","> |
||||
( |
||||
#{item.id}, |
||||
#{item.assessProjectId}, |
||||
#{item.taskId}, |
||||
#{item.taskName}, |
||||
#{item.taskScore}, |
||||
#{item.answer}, |
||||
#{item.serialNumber}, |
||||
#{item.rightAnswer}, |
||||
#{item.stuAnswer} |
||||
) |
||||
</foreach > |
||||
|
||||
</insert> |
||||
|
||||
<select id="selectYHTaskInfoByIssueId" resultType="java.util.Map"> |
||||
SELECT |
||||
u.user_id AS userId, |
||||
p.project_name projectName, |
||||
CASE |
||||
WHEN t.id IS NULL THEN |
||||
p.project_name |
||||
ELSE |
||||
t.task_name |
||||
END AS taskName, |
||||
CASE |
||||
WHEN t.id IS NULL THEN |
||||
p.project_id |
||||
ELSE |
||||
t.task_id |
||||
END AS appTaskId, |
||||
u.train_id taskId, |
||||
CASE |
||||
WHEN t.stu_answer IS NOT NULL THEN |
||||
t.answer |
||||
WHEN p.project_score = 0 THEN |
||||
'1' |
||||
ELSE |
||||
'0' |
||||
END AS answer |
||||
FROM |
||||
yyyf_server_assess_user u |
||||
LEFT JOIN yyyf_server_assess_user_project p ON u.id = p.assess_user_id |
||||
LEFT JOIN yyyf_server_assess_user_task t ON p.id = t.assess_project_id |
||||
WHERE |
||||
u.issue_id = #{issueId} |
||||
ORDER BY |
||||
t.serial_number |
||||
</select> |
||||
</mapper> |
Loading…
Reference in new issue