loading登录,以及获取用户成绩

pull/1/head
unclekh 5 years ago
parent 4de1e30a99
commit 73d71eb491
  1. 8
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java
  2. 12
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
  3. 5
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java
  4. 4
      spring-cloud/spring-cloud-config/src/main/resources/properties/dbconf-dev.yml

@ -23,9 +23,11 @@ public class YyyfUserDtoUtils {
public static YyyfUserDto getYyyfUserDto(HttpServletRequest request, RedisTemplate redisTemplate) { public static YyyfUserDto getYyyfUserDto(HttpServletRequest request, RedisTemplate redisTemplate) {
YyyfUserDto yyyfUserDto = null; YyyfUserDto yyyfUserDto = null;
String yyyfTtoken = request.getHeader(BaseConstant.YYYF_TOKEN_HEADER); String yyyfTtoken = request.getHeader(BaseConstant.YYYF_TOKEN_HEADER);
//如果有token,拿到用户信息,与以渔有方进行绑定 if(yyyfTtoken!=null) {
if (redisTemplate.hasKey(yyyfTtoken)) { //如果有token,拿到用户信息,与以渔有方进行绑定
yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(yyyfTtoken); if (redisTemplate.hasKey(yyyfTtoken)) {
yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(yyyfTtoken);
}
} }
return yyyfUserDto; return yyyfUserDto;
} }

@ -76,12 +76,9 @@ public class TeachingGradeController {
@GetMapping(value = "/getGradeData",produces = {"application/text;charset=UTF-8"}) @GetMapping(value = "/getGradeData",produces = {"application/text;charset=UTF-8"})
@ResponseBody @ResponseBody
@SuppressWarnings("all") @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(); JSONObject json = new JSONObject();
try { try {
@ -89,7 +86,7 @@ public class TeachingGradeController {
int answerCount= assessUserService.selectCountByByIssueId(issueId); int answerCount= assessUserService.selectCountByByIssueId(issueId);
//获取案例信息 //获取案例信息
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash(); HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash();
ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, projectId); ExamPaperDto examPaperDto = examPaperOpsForHash.get(YyyfConstant.EXAM_PAPER_KEY, caseId);
List<TrainCaseTargetDto> trainCaseTargeList = examPaperDto.getTrainCaseTargeList(); List<TrainCaseTargetDto> trainCaseTargeList = examPaperDto.getTrainCaseTargeList();
Map<String, Object> wrongStatistics = null;//错误信息 Map<String, Object> wrongStatistics = null;//错误信息
@ -177,7 +174,7 @@ public class TeachingGradeController {
errorCount++; errorCount++;
break; break;
} }
} }
double errorRate = (double) (errorCount) / (double) (totalNum) * 100;//计算错误率 double errorRate = (double) (errorCount) / (double) (totalNum) * 100;//计算错误率
errorRate = Double.valueOf(String.format("%.2f", errorRate));//四舍五入保留两位小数 errorRate = Double.valueOf(String.format("%.2f", errorRate));//四舍五入保留两位小数
@ -221,6 +218,7 @@ public class TeachingGradeController {
minErrorRateInfo.put("errorRate", errorRate); minErrorRateInfo.put("errorRate", errorRate);
} }
} }
i++;
} }
wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo); wrongStatistics.put("maxErrorRateInfo", maxErrorRateInfo);
wrongStatistics.put("minErrorRateInfo", minErrorRateInfo); wrongStatistics.put("minErrorRateInfo", minErrorRateInfo);

@ -1,11 +1,9 @@
package com.blockchain.server.yyyf.service.impl; package com.blockchain.server.yyyf.service.impl;
import com.blockchain.common.base.constant.YyyfConstant; 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.train.dto.TrainCaseTargetDto;
import com.blockchain.server.yyyf.dto.AssessUserDto; import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.ExamDto; 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.dto.YyyfStudentAnswerDto;
import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUser;
import com.blockchain.server.yyyf.entity.AssessUserTarget; 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.exceprion.UserException;
import com.blockchain.server.yyyf.mapper.AssessUserMapper; import com.blockchain.server.yyyf.mapper.AssessUserMapper;
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper; 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.service.AssessUserService;
import com.blockchain.server.yyyf.utils.HttpClientUtil; import com.blockchain.server.yyyf.utils.HttpClientUtil;
import io.swagger.models.auth.In;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -29,7 +25,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;

@ -1,8 +1,8 @@
spring: spring:
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/zhixinlian?useUnicode=true&characterEncoding=UTF-8&useSSL=false url: jdbc:mysql://127.0.0.1:3306/zhixinlian?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: zhixinlian username: root
password: zhixinlian123coin!678 password: 123456
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
druid: druid:
initial-size: 1 initial-size: 1

Loading…
Cancel
Save