diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java index aa51335..3d555f8 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java @@ -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(); diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java index d609786..7eb9154 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java @@ -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 assessUserList = this.assessUserService.selectAssessUserListByIssueId(issueId); + try { + + int answerCount= assessUserService.selectCountByByIssueId(issueId); + Map 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 tiftrnDtoList = JedisUtil.getMapValueForList(JedisUtil.bulidKey(Const.TIFTRN_KEY), projectId, TiftrnDto.class); + //获取案例信息 + HashOperations examPaperOpsForHash = redisTemplate.opsForHash(); + ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, projectId); + List trainCaseTargeList = examPaperDto.getTrainCaseTargeList(); wrongStatistics = new HashMap<>(); @@ -95,49 +103,24 @@ public class TeachingGradeController { Map minErrorRateInfo = new HashMap<>();//最小错误率信息记录 List taskNames = new ArrayList<>(); List errorRates = new ArrayList<>(); - for (TiftrnDto tifDtotrn : tiftrnDtoList) { - List 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 getWrongStatistics(String issueId, Integer notExamNum) { Map wrongStatistics = new HashMap(); - //根据考核发布id,获取考核点信息 - List> taskListDb = assessUserTaskService.selectYHTaskInfoByIssueId(issueId); - List> taskList = new ArrayList<>(); - String appTaskIdStrs = ","; - - //key 考核点id(无考核点则是交易的id),value为答题情况集合 - Map>> userTasksMap = new HashMap<>(); - - for (Map map : taskListDb) { - String appTaskId = (String) map.get("appTaskId"); - List> 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 list = this.assessUserTargetService.selectAllStudentAssessUserTargetByIssueId(issueId); +/* Map maxErrorRateInfo = null;//最大错误率信息记录 Map minErrorRateInfo = null;//最小错误率信息记录 //记录考核点名称 @@ -203,10 +165,10 @@ public class TeachingGradeController { for (int i = 0; i < taskList.size(); i++) { Map task = taskList.get(i); taskNames[i] = task.get("taskName").toString(); - /*Map con = new HashMap(); + *//*Map con = new HashMap(); con.put("issueId", issueId); con.put("classId", classId); - con.put("appTaskId", task.get("appTaskId"));*/ + con.put("appTaskId", task.get("appTaskId"));*//* //获取该考核点用户的答题情况 List> userTasks = new ArrayList>(); 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 practiseProDtos = this.assessUserService.selectPractiseProList(assessUser.getId()); + List 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)); diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java new file mode 100644 index 0000000..6db907f --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/TeachingGradeApi.java @@ -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 = "项目答题情况控制器"; + + +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentTargetErrorStatisticsDto.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentTargetErrorStatisticsDto.java new file mode 100644 index 0000000..715bea6 --- /dev/null +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/StudentTargetErrorStatisticsDto.java @@ -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; +} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java index c6a0082..db0cb65 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java @@ -15,13 +15,6 @@ import java.util.Map; @Repository public interface AssessUserMapper extends Mapper { - // int insert(AssessUser assessUser); - - void batchInsert(List assessUserList); - - - AssessUser selectScore( @Param("assessmentId") String assessmentId, @Param("userId") Integer userId); - Map selectUserGradeCase(Map con); @@ -29,19 +22,6 @@ public interface AssessUserMapper extends Mapper { List> selectUserGradeListByClassIdAndIssueId(Map con); - List selectPractiseProList (@Param("assessUserId") String assessUserId); - - - List selectAssessUserListByIssuerIdAndUserId(@Param("issueId") String issueId, @Param("userId") Integer userId); - - - - - - List 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 { * @return void **/ void batchUpdateTotalScoreByAssessUserDtoList(@Param("assessUserDtoList") List assessUserDtoList); + + List selectAssessUserDtoByIssueId(@Param("issueId") String issueId); } \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java index 94764a3..8a7e55f 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java @@ -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 { **/ void batchInsert(@Param("list")List list); - List selectAssessUserDtoByIssueId(@Param("issueId") String issueId); + List selectAllStudentAssessUserTargetByIssueId(@Param("issueId")String issueId); + + List getStudentTargetErrorStatisticsDtoListByIssueId(@Param("issueId")String issueId); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTaskMapper.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTaskMapper.java deleted file mode 100644 index 2d39bf9..0000000 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTaskMapper.java +++ /dev/null @@ -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 assessUserTaskList); - - - List> selectYHTaskInfoByIssueId(@Param("issueId") String issueId); -} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java index 3dfad42..4588f22 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java @@ -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 - **/ - public List 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 - **/ - List 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 - * @description 根据考核id 查询所有的有成绩的学生考核概览信息,这一块可做优化,将其封装成成绩同步的DTO, - * 在TeachingGradeController的406 行就无需遍历封装。由于时间原因暂不优化 - **/ - List 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); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java index 7fc8a3f..c876774 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTargetService.java @@ -26,4 +26,7 @@ public interface AssessUserTargetService{ * @return java.util.List **/ List selectAssessUserTargetByAssessUserId(String assessUserId); + + + List selectAllStudentAssessUserTargetByIssueId(String issueId); } diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTaskService.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTaskService.java deleted file mode 100644 index 91f74e8..0000000 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserTaskService.java +++ /dev/null @@ -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> - **/ - List> selectYHTaskInfoByIssueId(String issueId); -} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java index dea29ed..ff9ec07 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java @@ -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 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 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 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 assessUserDtoList = this.assessUserTargetMapper.selectAssessUserDtoByIssueId(issueId); + List assessUserDtoList = this.assessUserMapper.selectAssessUserDtoByIssueId(issueId); List updateAssessUserDtoList = new ArrayList<>(); List 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); + } + } \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java index 5bde63d..79b418c 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java +++ b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTargetServiceImpl.java @@ -43,4 +43,9 @@ public class AssessUserTargetServiceImpl implements AssessUserTargetService { return this.assessUserTargetMapper.selectByExample(example); } + @Override + public List selectAllStudentAssessUserTargetByIssueId(String issueId) { + return this.assessUserTargetMapper.selectAllStudentAssessUserTargetByIssueId(issueId); + } + } \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTaskServiceImpl.java b/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTaskServiceImpl.java deleted file mode 100644 index c0ec653..0000000 --- a/blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserTaskServiceImpl.java +++ /dev/null @@ -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> selectYHTaskInfoByIssueId(String issueId) { - return this.assessUserTaskMapper.selectYHTaskInfoByIssueId(issueId); - } - - -} \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml index ec64404..1996a94 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml @@ -1,135 +1,45 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - and t.id=#{id,jdbcType=VARCHAR} - - - and t.train_id=#{trainId,jdbcType=VARCHAR} - - - and t.issue_id=#{issueId,jdbcType=VARCHAR} - - - and t.ss_practise_id=#{ssPractiseId,jdbcType=VARCHAR} - - - and t.user_id=#{userId,jdbcType=INTEGER} - - - and t.total_score=#{totalScore,jdbcType=NUMERIC} - - - and t.customer_story=#{customerStory,jdbcType=VARCHAR} - - - and t.duration=#{duration,jdbcType=INTEGER} - - - and t.duration_unit=#{durationUnit,jdbcType=VARCHAR} - - - and t.start_time=#{startTime,jdbcType=TIMESTAMP} - - - and t.end_time=#{endTime,jdbcType=TIMESTAMP} - - - and t.case_id=#{caseId,jdbcType=VARCHAR} - - - and t.achieve_ment_type=#{achieveMentType,jdbcType=INTEGER} - - - and t.class_id=#{classId,jdbcType=VARCHAR} - - - and t.course_id=#{courseId,jdbcType=VARCHAR} - - - and t.group_id=#{groupId,jdbcType=INTEGER} - - - - - 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, - - - insert into yyyf_server_assess_user - values - - - ( - #{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}, - ) - - - update yyyf_server_assess_user @@ -138,13 +48,6 @@ - - delete from yyyf_server_assess_user where issue_id=#{issueId} - - - - - - + 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} - + diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml index f110943..9da14d4 100644 --- a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml +++ b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml @@ -1,34 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -40,45 +13,25 @@ - - - - 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 ( #{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} ) - - + 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} + + \ No newline at end of file diff --git a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTask.xml b/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTask.xml deleted file mode 100644 index a57b760..0000000 --- a/blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTask.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - and t.id=#{id,jdbcType=VARCHAR} - - - and t.assess_project_id=#{assessProjectId,jdbcType=VARCHAR} - - - and t.task_id=#{taskId,jdbcType=VARCHAR} - - - and t.task_name=#{taskName,jdbcType=VARCHAR} - - - and t.task_score=#{taskScore,jdbcType=NUMERIC} - - - and t.answer=#{answer,jdbcType=INTEGER} - - - - and t.serial_number=#{serialNumber,jdbcType=INTEGER} - - - and t.right_answer=#{rightAnswer,jdbcType=VARCHAR} - - - and t.stu_answer=#{stuAnswer,jdbcType=VARCHAR} - - - - - 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, - - - - 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 into yyyf_server_assess_user_task - values - - ( - #{item.id}, - #{item.assessProjectId}, - #{item.taskId}, - #{item.taskName}, - #{item.taskScore}, - #{item.answer}, - #{item.serialNumber}, - #{item.rightAnswer}, - #{item.stuAnswer} - ) - - - - - -