错题统计

pull/1/head
huan.xu 5 years ago
parent d80ddc1d4b
commit c20fd31bba
  1. 16
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java
  2. 152
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
  3. 14
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java
  4. 19
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentTargetErrorStatisticsDto.java
  5. 22
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java
  6. 5
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java
  7. 19
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTaskMapper.java
  8. 60
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java
  9. 3
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java
  10. 18
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTaskService.java
  11. 45
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java
  12. 5
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java
  13. 28
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTaskServiceImpl.java
  14. 223
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml
  15. 85
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml
  16. 130
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTask.xml

@ -85,7 +85,14 @@ public class LoginController {
//做考试和练习
if (0 == reqType || 1 == reqType) {
if (0 == reqType) {
//如果考试他提交了,库里有信息了,不允许他再次进入了。
if (this.assessUserService.selectScore(examId, userId) != null) {
yyyfLoginDto.setStatus(2);
yyyfLoginDto.setMsg(YyyfConstant.SUBMITTED);
return handleAfterLogin(yyyfLoginDto, yyyfUserDto);
}
}
AssessUser assessUser = this.assessUserService.selectAssessUserByUserIdAndissueIdForNotEnd(userId, examId);
if (assessUser == null) {
String assessUserId = IdGenerator.uuid();
@ -125,13 +132,6 @@ public class LoginController {
//判断考试缓存中是否存在这张卷子
if (0 == reqType) {
//如果他提交了,库里有信息了,不允许他再次进入了。
if (this.assessUserService.selectScore(examId, userId) != null) {
yyyfLoginDto.setStatus(2);
yyyfLoginDto.setMsg(YyyfConstant.SUBMITTED);
return handleAfterLogin(yyyfLoginDto, yyyfUserDto);
}
ExamDto examDto = examDtoOpsForHash.get(YyyfConstant.EXAM_KEY, examId);
if (examDto == null) {
examDto = new ExamDto();

@ -1,22 +1,26 @@
package com.blockchain.server.yyyf.controller;
import com.alibaba.fastjson.JSONObject;
import com.blockchain.common.base.constant.YyyfConstant;
import com.blockchain.server.train.dto.ExamPaperDto;
import com.blockchain.server.train.dto.TrainCaseTargetDto;
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.entity.AssessUserTarget;
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.service.AssessUserTargetService;
import com.blockchain.server.yyyf.utils.ResponseUtils;
import io.swagger.annotations.ApiParam;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
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.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@ -24,17 +28,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
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.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author huan.xu
@ -48,12 +49,17 @@ import java.util.*;
public class TeachingGradeController {
protected Logger logger = LoggerFactory.getLogger(TeachingGradeController.class);
@Autowired
private RedisTemplate redisTemplate;
private static final String SYS_CODE = "102";
@Autowired
private AssessUserService assessUserService;
@Autowired
private AssessUserTaskService assessUserTaskService;
private AssessUserTargetService assessUserTargetService;
// @Autowired
// private ScoreSynchroService scoreSynchroService;
@ -67,7 +73,7 @@ public class TeachingGradeController {
* @author huan.xu
* @date 2019-11-08 18:03:39
**/
@GetMapping(value = "/getGradeData"/*,produces = {"application/text;charset=UTF-8"}*/)
@GetMapping(value = "/getGradeData",produces = {"application/text;charset=UTF-8"})
@ResponseBody
@SuppressWarnings("all")
public void getGradeData(HttpServletRequest request, HttpServletResponse response) {
@ -78,16 +84,18 @@ public class TeachingGradeController {
Integer totalNum = Integer.valueOf(totalNumStr);
JSONObject json = new JSONObject();
try {/*
//根据考核id 查询所有的有成绩的学生考核概览信息
List<AssessUser> assessUserList = this.assessUserService.selectAssessUserListByIssueId(issueId);
try {
int answerCount= assessUserService.selectCountByByIssueId(issueId);
Map<String, Object> wrongStatistics = null;//错误信息
//无人考试 时封装错误率
if (assessUserList == null || (assessUserList != null && assessUserList.size() == 0)) {
if (answerCount==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);
//获取案例信息
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash();
ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, projectId);
List<TrainCaseTargetDto> trainCaseTargeList = examPaperDto.getTrainCaseTargeList();
wrongStatistics = new HashMap<>();
@ -95,49 +103,24 @@ public class TeachingGradeController {
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;
}
for (TrainCaseTargetDto trainCaseTargetDto : trainCaseTargeList) {
taskNames.add(trainCaseTargetDto.getName());
errorRates.add(Double.valueOf(100));
if (maxErrorRateInfo.size() == 0) {
maxErrorRateInfo.put("headCount", totalNum);
maxErrorRateInfo.put("taskName", trainCaseTargetDto.getName());
maxErrorRateInfo.put("errorRate", Double.valueOf(100));
maxErrorRateInfo.put("projectName",trainCaseTargetDto.getName());
maxErrorRateInfo.put("errorCount", totalNum);
continue;
}
if (minErrorRateInfo.size() == 0) {
minErrorRateInfo.put("headCount", totalNum);
minErrorRateInfo.put("taskName", trainCaseTargetDto.getName());
minErrorRateInfo.put("errorRate", Double.valueOf(100));
minErrorRateInfo.put("projectName", trainCaseTargetDto.getName());
minErrorRateInfo.put("errorCount", totalNum);
continue;
}
}
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo);
@ -146,12 +129,12 @@ public class TeachingGradeController {
wrongStatistics.put("errorRates", errorRates);
} else {
wrongStatistics = getWrongStatistics(issueId, totalNum - assessUserList.size());
wrongStatistics = getWrongStatistics(issueId, totalNum - answerCount);
}
json.put("result", true);
json.put("wrongStatistics", wrongStatistics);*/
json.put("wrongStatistics", wrongStatistics);
} catch (Exception e) {
json.put("result", false);
json.put("msg", "获取成绩报表数据失败");
@ -170,30 +153,9 @@ public class TeachingGradeController {
**/
private 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;
}
}
List<AssessUserTarget> list = this.assessUserTargetService.selectAllStudentAssessUserTargetByIssueId(issueId);
/*
Map<String, Object> maxErrorRateInfo = null;//最大错误率信息记录
Map<String, Object> minErrorRateInfo = null;//最小错误率信息记录
//记录考核点名称
@ -203,10 +165,10 @@ public class TeachingGradeController {
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>();
*//*Map<String,Object> con = new HashMap<String,Object>();
con.put("issueId", issueId);
con.put("classId", classId);
con.put("appTaskId", task.get("appTaskId"));*/
con.put("appTaskId", task.get("appTaskId"));*//*
//获取该考核点用户的答题情况
List<Map<String, Object>> userTasks = new ArrayList<Map<String, Object>>();
userTasks = userTasksMap.get(task.get("appTaskId"));
@ -264,7 +226,7 @@ public class TeachingGradeController {
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo);
wrongStatistics.put("minErrorRateInfo", minErrorRateInfo);
wrongStatistics.put("taskNames", taskNames);
wrongStatistics.put("errorRates", errorRates);
wrongStatistics.put("errorRates", errorRates);*/
return wrongStatistics;
}
@ -368,7 +330,7 @@ public class TeachingGradeController {
* @date 2019-11-08 18:38:41
**/
public void cratePractiseProDtosForNotNull(AssessUser assessUser, Model model) {
List<PractiseProDto> practiseProDtos = this.assessUserService.selectPractiseProList(assessUser.getId());
List<PractiseProDto> practiseProDtos = null;//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));

@ -0,0 +1,14 @@
package com.blockchain.server.yyyf.controller.api;
/**
* @author huan.xu
* @version 1.0
* @className TeachingGradeApi
* @description
* @date 2020-05-15 8:59
*/
public class TeachingGradeApi {
public static final String CONTROLLER_API = "项目答题情况控制器";
}

@ -0,0 +1,19 @@
package com.blockchain.server.yyyf.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @className StudentTargetErrorStatisticsDto
* @description 指标错误率统计
* @date 2020-05-15 17:05
*/
@Data
public class StudentTargetErrorStatisticsDto implements Serializable {
private static final long serialVersionUID = -8613879083537364104L;
/**错误个数*/
private Integer number;
/**指标id*/
private String targetId;
}

@ -15,13 +15,6 @@ import java.util.Map;
@Repository
public interface AssessUserMapper extends Mapper<AssessUser> {
// int 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);
@ -29,19 +22,6 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
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);
List<AssessUser> selectAssessUserListByIssueId(@Param("issueId") String issueId);
void delAssessUserByIssueId(@Param("issueId") String issueId);
/**
* @description 通过AssessUserDtoLis批量更新AssessUser
* @author Mr.Xu
@ -50,4 +30,6 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
* @return void
**/
void batchUpdateTotalScoreByAssessUserDtoList(@Param("assessUserDtoList") List<AssessUserDto> assessUserDtoList);
List<AssessUserDto> selectAssessUserDtoByIssueId(@Param("issueId") String issueId);
}

@ -1,6 +1,7 @@
package com.blockchain.server.yyyf.mapper;
import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.StudentTargetErrorStatisticsDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -22,5 +23,7 @@ public interface AssessUserTargetMapper extends Mapper<AssessUserTarget> {
**/
void batchInsert(@Param("list")List<AssessUserTarget> list);
List<AssessUserDto> selectAssessUserDtoByIssueId(@Param("issueId") String issueId);
List<AssessUserTarget> selectAllStudentAssessUserTargetByIssueId(@Param("issueId")String issueId);
List<StudentTargetErrorStatisticsDto> getStudentTargetErrorStatisticsDtoListByIssueId(@Param("issueId")String issueId);
}

@ -1,19 +0,0 @@
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);
}

@ -6,10 +6,9 @@ import com.blockchain.server.train.dto.TrainCaseTargetDto;
import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.PractiseProDto;
import com.blockchain.server.yyyf.entity.AssessUser;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
/**
* @param
@ -21,38 +20,10 @@ import java.util.Map;
public interface AssessUserService {
public AssessUser selectAssessUserByUserIdAndissueIdForNotEnd(Integer userId, String issueId);
/**
* @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]
@ -60,30 +31,8 @@ public interface AssessUserService {
**/
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);
/**
* @description 查找未结束的记录
* @author Mr.Xu
* @date 2020-05-13 22:26:38
* @param []
* @return com.blockchain.server.yyyf.entity.AssessUser
**/
AssessUser selectAssessUserByUserIdAndissueIdForNotEnd(Integer userId,String examId);
/**
* @description 插入
@ -129,4 +78,9 @@ public interface AssessUserService {
* @return void
**/
void synchronousScore(String issueId);
AssessUser selectScore(String examId, Integer userId);
int selectCountByByIssueId(String issueId);
}

@ -26,4 +26,7 @@ public interface AssessUserTargetService{
* @return java.util.List<com.blockchain.server.yyyf.entity.AssessUserTarget>
**/
List<AssessUserTarget> selectAssessUserTargetByAssessUserId(String assessUserId);
List<AssessUserTarget> selectAllStudentAssessUserTargetByIssueId(String issueId);
}

@ -1,18 +0,0 @@
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);
}

@ -54,8 +54,6 @@ public class AssessUserServiceImpl implements AssessUserService {
private AssessUserMapper assessUserMapper;
@Autowired
private AssessUserTargetMapper assessUserTargetMapper;
@Autowired
private AssessUserTaskMapper assessUserTaskMapper;
@Value("${yyyf.url}")
@ -69,20 +67,6 @@ public class AssessUserServiceImpl implements AssessUserService {
@Value("${yyyf.assessmentList}")
private String assessmentList;
@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) {
@ -90,16 +74,7 @@ public class AssessUserServiceImpl implements AssessUserService {
return this.assessUserMapper.selectByPrimaryKey(assessUserId);
}
@Override
public List<AssessUser> selectAssessUserListByIssueId(String issueId) {
return this.assessUserMapper.selectAssessUserListByIssueId(issueId);
}
@Transactional
@Override
public void delAssessUserByIssueId(String examId) {
this.assessUserMapper.delAssessUserByIssueId(examId);
}
@Override
public AssessUser selectAssessUserByUserIdAndissueIdForNotEnd(Integer userId, String issueId) {
@ -190,7 +165,7 @@ public class AssessUserServiceImpl implements AssessUserService {
@SneakyThrows
@Override
public void synchronousScore(String issueId) {
List<AssessUserDto> assessUserDtoList = this.assessUserTargetMapper.selectAssessUserDtoByIssueId(issueId);
List<AssessUserDto> assessUserDtoList = this.assessUserMapper.selectAssessUserDtoByIssueId(issueId);
List<AssessUserDto> updateAssessUserDtoList = new ArrayList<>();
List<YyyfStudentAnswerDto> yyyfStudentAnswerDtoList = new ArrayList<>(assessUserDtoList.size());
@ -237,5 +212,23 @@ public class AssessUserServiceImpl implements AssessUserService {
}
@Override
public AssessUser selectScore(String issueId, Integer userId) {
Example example = new Example(AssessUser.class);
Example.Criteria criteria = example.createCriteria();
criteria.andCondition(" user_id =", userId)
.andCondition(" issue_id = ", issueId)
.andCondition(" end_time is not null ");
return this.assessUserMapper.selectOneByExample(example);
}
@Override
public int selectCountByByIssueId(String issueId) {
Example example=new Example(AssessUser.class);
Example.Criteria criteria = example.createCriteria();
criteria.andCondition("issue_id = ",issueId);
return this.assessUserMapper.selectCountByExample(example);
}
}

@ -43,4 +43,9 @@ public class AssessUserTargetServiceImpl implements AssessUserTargetService {
return this.assessUserTargetMapper.selectByExample(example);
}
@Override
public List<AssessUserTarget> selectAllStudentAssessUserTargetByIssueId(String issueId) {
return this.assessUserTargetMapper.selectAllStudentAssessUserTargetByIssueId(issueId);
}
}

@ -1,28 +0,0 @@
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);
}
}

@ -1,135 +1,45 @@
<?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"/>
<resultMap id="AssessUserDtoMap" type="com.blockchain.server.yyyf.dto.AssessUserDto">
<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="user_name" jdbcType="VARCHAR" property="userName" />
<result column="user_type" jdbcType="INTEGER" property="userType" />
<result column="total_score" jdbcType="DECIMAL" 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" />
<collection property="assessUserTargetList" column="assess_user_id" ofType="com.blockchain.server.yyyf.entity.AssessUserTarget" javaType="ArrayList">
<result column="assessUser_target_id" jdbcType="VARCHAR" property="id" />
<result column="assess_user_id" jdbcType="VARCHAR" property="assessUserId" />
<result column="target_name" jdbcType="VARCHAR" property="targetName" />
<result column="target_id" jdbcType="VARCHAR" property="targetId" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="task_operate" jdbcType="TINYINT" property="taskOperate" />
<result column="task_rate" jdbcType="DECIMAL" property="taskRate" />
<result column="task_score" jdbcType="DECIMAL" property="taskScore" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="student_rate" jdbcType="DECIMAL" property="studentRate" />
<result column="answer" jdbcType="INTEGER" property="answer" />
</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="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>
<update id="batchUpdateTotalScoreByAssessUserDtoList" parameterType="list">
<foreach collection="assessUserDtoList" item="item" separator=";" close=";">
update yyyf_server_assess_user
@ -138,13 +48,6 @@
</foreach>
</update>
<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,
@ -159,36 +62,42 @@
</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="selectAssessUserListByIssueId" resultMap="YfServerAssessUserResultMap">
select * from yyyf_server_assess_user where issue_id=#{issueId} and achieve_ment_type = 1
<select id="selectAssessUserDtoByIssueId" resultMap="AssessUserDtoMap">
SELECT
u.id,
u.train_id,
u.issue_id,
u.ss_practise_id,
u.user_id,
u.user_name,
u.user_type,
u.total_score,
u.duration,
u.duration_unit,
u.start_time,
u.end_time,
u.case_id,
u.achieve_ment_type,
u.class_id,
u.course_id,
t.id as assessUser_target_id,
t.assess_user_id,
t.target_name,
t.target_id,
t. code,
t.task_operate,
t.task_rate,
t.task_score,
t.sort,
t.student_rate,
t.answer
FROM
yyyf_server_assess_user u,
yyyf_server_assess_user_target t
WHERE
u.id = t.assess_user_id and u.issue_id=#{issueId}
</select>
<!-- <select id="getAssessUserByIssueId" resultMap="YfServerAssessUserResultMap">
SELECT * from yyyf_server_assess_user
</select>-->
</mapper>

@ -1,34 +1,7 @@
<?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.AssessUserTargetMapper">
<resultMap id="YfServerAssessUserProjectResultMap" type="com.blockchain.server.yyyf.entity.AssessUserTarget">
<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>
<resultMap id="AssessUserDtoMap" type="com.blockchain.server.yyyf.dto.AssessUserDto">
<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="user_name" jdbcType="VARCHAR" property="userName" />
<result column="user_type" jdbcType="INTEGER" property="userType" />
<result column="total_score" jdbcType="DECIMAL" 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" />
<collection property="assessUserTargetList" column="assess_user_id" ofType="com.blockchain.server.yyyf.entity.AssessUserTarget" javaType="ArrayList">
<resultMap id="AssessUserTargetMap" type="com.blockchain.server.yyyf.entity.AssessUserTarget">
<result column="assessUser_target_id" jdbcType="VARCHAR" property="id" />
<result column="assess_user_id" jdbcType="VARCHAR" property="assessUserId" />
<result column="target_name" jdbcType="VARCHAR" property="targetName" />
@ -40,45 +13,25 @@
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="student_rate" jdbcType="DECIMAL" property="studentRate" />
<result column="answer" jdbcType="INTEGER" property="answer" />
</collection>
</resultMap>
<insert id="batchInsert" parameterType="java.util.List">
insert into yyyf_server_assess_user_target
(id,assess_user_id, target_name, target_id, code, task_operate, task_rate,task_score, sort)
(id,assess_user_id, target_name, target_id, code, task_operate, task_rate,task_score, sort,student_rate,answer)
values
<foreach collection ="list" item="item" index= "index" separator =",">
( #{item.id,jdbcType=VARCHAR},
#{item.assessUserId,jdbcType=VARCHAR}, #{item.targetName,jdbcType=VARCHAR}, #{item.targetId,jdbcType=VARCHAR},
#{item.code,jdbcType=VARCHAR}, #{item.taskOperate,jdbcType=TINYINT}, #{item.taskRate,jdbcType=DECIMAL},
#{item.taskScore,jdbcType=DECIMAL}, #{item.sort,jdbcType=INTEGER}
#{item.taskScore,jdbcType=DECIMAL}, #{item.sort,jdbcType=INTEGER}, #{item.studentRate,jdbcType=DECIMAL},#{item.answer,jdbcType=INTEGER}
)
</foreach >
</insert>
<select id="selectAssessUserDtoByIssueId" resultMap="AssessUserDtoMap">
SELECT
u.id,
u.train_id,
u.issue_id,
u.ss_practise_id,
u.user_id,
u.user_name,
u.user_type,
u.total_score,
u.duration,
u.duration_unit,
u.start_time,
u.end_time,
u.case_id,
u.achieve_ment_type,
u.class_id,
u.course_id,
<select id="selectAllStudentAssessUserTargetByIssueId"
resultMap="AssessUserTargetMap">
SELECT
t.id as assessUser_target_id,
t.assess_user_id,
t.target_name,
@ -90,11 +43,27 @@
t.sort,
t.student_rate,
t.answer
FROM
yyyf_server_assess_user u,
yyyf_server_assess_user_target t
WHERE
u.id = t.assess_user_id and u.issue_id=#{issueId}
FROM
yyyf_server_assess_user u,
yyyf_server_assess_user_target t
WHERE
u.id = t.assess_user_id and u.issue_id=#{issueId}
</select>
<select id="getStudentTargetErrorStatisticsDtoListByIssueId"
resultType="com.blockchain.server.yyyf.dto.StudentTargetErrorStatisticsDto">
SELECT
count(t.target_id) AS number,
t.target_id AS targetId
FROM
yyyf_server_assess_user u,
yyyf_server_assess_user_target t
WHERE
u.id = t.assess_user_id
AND t.answer = 1
AND u.issue_id = #{issueId}
GROUP BY
t.target_id
</select>
</mapper>

@ -1,130 +0,0 @@
<?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…
Cancel
Save