diff --git a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java index 098ee51..6be1326 100644 --- a/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java +++ b/blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java @@ -23,9 +23,11 @@ public class YyyfUserDtoUtils { public static YyyfUserDto getYyyfUserDto(HttpServletRequest request, RedisTemplate redisTemplate) { YyyfUserDto yyyfUserDto = null; String yyyfTtoken = request.getHeader(BaseConstant.YYYF_TOKEN_HEADER); - //如果有token,拿到用户信息,与以渔有方进行绑定 - if (redisTemplate.hasKey(yyyfTtoken)) { - yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(yyyfTtoken); + if(yyyfTtoken!=null) { + //如果有token,拿到用户信息,与以渔有方进行绑定 + if (redisTemplate.hasKey(yyyfTtoken)) { + yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(yyyfTtoken); + } } return yyyfUserDto; } 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 1627172..e38ed44 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 @@ -76,12 +76,9 @@ public class TeachingGradeController { @GetMapping(value = "/getGradeData",produces = {"application/text;charset=UTF-8"}) @ResponseBody @SuppressWarnings("all") - public void getGradeData(HttpServletRequest request, HttpServletResponse response) { + public void getGradeData( String issueId,Integer totalNum, String caseId, 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 { @@ -89,7 +86,7 @@ public class TeachingGradeController { int answerCount= assessUserService.selectCountByByIssueId(issueId); //获取案例信息 HashOperations examPaperOpsForHash = redisTemplate.opsForHash(); - ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, projectId); + ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, caseId); List trainCaseTargeList = examPaperDto.getTrainCaseTargeList(); Map wrongStatistics = null;//错误信息 @@ -177,7 +174,7 @@ public class TeachingGradeController { errorCount++; break; } - } + } double errorRate = (double) (errorCount) / (double) (totalNum) * 100;//计算错误率 errorRate = Double.valueOf(String.format("%.2f", errorRate));//四舍五入保留两位小数 @@ -221,6 +218,7 @@ public class TeachingGradeController { minErrorRateInfo.put("errorRate", errorRate); } } + i++; } wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo); wrongStatistics.put("minErrorRateInfo", minErrorRateInfo); 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 ff9ec07..1e59b48 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 @@ -1,11 +1,9 @@ package com.blockchain.server.yyyf.service.impl; 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.AssessUserDto; import com.blockchain.server.yyyf.dto.ExamDto; -import com.blockchain.server.yyyf.dto.PractiseProDto; import com.blockchain.server.yyyf.dto.YyyfStudentAnswerDto; import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUserTarget; @@ -13,10 +11,8 @@ import com.blockchain.server.yyyf.enums.UserEnums; import com.blockchain.server.yyyf.exceprion.UserException; import com.blockchain.server.yyyf.mapper.AssessUserMapper; import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper; -import com.blockchain.server.yyyf.mapper.AssessUserTaskMapper; import com.blockchain.server.yyyf.service.AssessUserService; import com.blockchain.server.yyyf.utils.HttpClientUtil; -import io.swagger.models.auth.In; import lombok.SneakyThrows; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,7 +25,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import tk.mybatis.mapper.entity.Example; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; diff --git a/spring-cloud/spring-cloud-config/src/main/resources/properties/dbconf-dev.yml b/spring-cloud/spring-cloud-config/src/main/resources/properties/dbconf-dev.yml index 85cf5d1..3ec8b61 100644 --- a/spring-cloud/spring-cloud-config/src/main/resources/properties/dbconf-dev.yml +++ b/spring-cloud/spring-cloud-config/src/main/resources/properties/dbconf-dev.yml @@ -1,8 +1,8 @@ spring: datasource: url: jdbc:mysql://127.0.0.1:3306/zhixinlian?useUnicode=true&characterEncoding=UTF-8&useSSL=false - username: zhixinlian - password: zhixinlian123coin!678 + username: root + password: 123456 driver-class-name: com.mysql.jdbc.Driver druid: initial-size: 1