答题详情查看

pull/1/head
huan.xu 5 years ago
parent 32e3f3b9db
commit 6589203e13
  1. 1
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/constant/BaseConstant.java
  2. 4
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/SSOHelper.java
  3. 21
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/util/YyyfUserDtoUtils.java
  4. 5
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java
  5. 1
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
  6. 3
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/ExamDetailsDto.java
  7. 4
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfLoginDto.java
  8. 1
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java
  9. 3
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java
  10. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java

@ -18,4 +18,5 @@ public class BaseConstant {
public static final String YYYF_TOKEN_HEADER = "X-Requested-YyyfToken";//yyyfToken
public static final String USER_ID_YYYF_USER_KEY= "userIdYyyfUserKey";//通过当前用户id与以渔有方用户关联key
}

@ -113,6 +113,10 @@ public class SSOHelper {
}
if (redisTemplate.hasKey(key)) {
redisTemplate.delete(key);
String userIdYyyfUserKey = BaseConstant.USER_ID_YYYF_USER_KEY.concat(user.getId());
if (redisTemplate.hasKey(key)) {
redisTemplate.delete(userIdYyyfUserKey);
}
}
}
}

@ -1,5 +1,6 @@
package com.blockchain.common.base.util;
import com.aliyuncs.utils.StringUtils;
import com.blockchain.common.base.constant.BaseConstant;
import com.blockchain.common.base.dto.YyyfUserDto;
import org.springframework.data.redis.core.RedisTemplate;
@ -31,4 +32,24 @@ public class YyyfUserDtoUtils {
}
return yyyfUserDto;
}
/**
* @description 通过userId获取以渔有方用户信息
* @author huan.xu
* @date 2020-05-20 15:42:47
* @param [userId, redisTemplate]
* @return com.blockchain.common.base.dto.YyyfUserDto
**/
public static YyyfUserDto getYyyfUserDtoByUserId(String userId, RedisTemplate redisTemplate) {
YyyfUserDto yyyfUserDto = null;
if(StringUtils.isNotEmpty(userId)) {
//如果有token,拿到用户信息,与以渔有方进行绑定
String key=BaseConstant.USER_ID_YYYF_USER_KEY.concat(userId);
if (redisTemplate.hasKey(key)) {
yyyfUserDto = (YyyfUserDto) redisTemplate.opsForValue().get(key);
}
}
return yyyfUserDto;
}
}

@ -324,7 +324,6 @@ public class LoginController {
**/
private Integer dealBindYyyfAccount(String userId, String tel, HttpServletRequest request) {
Integer yyyfUserId = null;
String yyyfTtoken = request.getHeader(BaseConstant.YYYF_TOKEN_HEADER);
YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDto(request, redisTemplate);
//如果有token,拿到用户信息,与以渔有方进行绑定
if (yyyfUserDto != null) {
@ -332,12 +331,14 @@ public class LoginController {
YyyfUser yyyfUser = this.yyyfUserService.selectByYyyfUserIdAndTel(yyyfUserId, tel);
if (yyyfUser == null) {
this.yyyfUserService.saveUser(yyyfUserId, userId, yyyfUserDto.getUserName());
this.redisTemplate.delete(yyyfTtoken);
// this.redisTemplate.delete(yyyfTtoken);
} else {
if (!yyyfUser.getUserId().equals(userId)) {
throw new UserException(UserEnums.USER_NOT_FORBID_OTHER_USER);
}
}
//通过当前用户id与以渔有方用户关联
redisTemplate.opsForValue().set(BaseConstant.USER_ID_YYYF_USER_KEY.concat(userId),yyyfUserDto);
} else {
throw new UserException(UserEnums.USER_NOT_BIND_YYYF);
}

@ -284,6 +284,7 @@ public class TeachingGradeController {
public ResultDTO<ExamDetailsDto> getExamDetails(@ApiParam(TeachingGradeApi.GetExamDetails.METHOD_ASSESSUSER_ID)@RequestParam("assessUserId") String assessUserId,
@ApiParam(TeachingGradeApi.GetExamDetails.METHOD_IS_FIRST)@RequestParam("isFirst") int isFirst) {
ExamDetailsDto examDetailsDto = new ExamDetailsDto();
examDetailsDto.setIsFirst(isFirst);
try {
if (isFirst != 0) {
AssessUser assessUser = this.assessUserService.selectById(assessUserId);

@ -29,4 +29,7 @@ public class ExamDetailsDto implements Serializable {
private Double totalScore;
@ApiModelProperty("学生答题指标集合")
private List<AssessUserTarget> assessUserTargetList;
@ApiModelProperty("是否是第一个答题记录")
private Integer isFirst;
}

@ -17,8 +17,8 @@ public class YyyfLoginDto implements Serializable {
@ApiModelProperty("状态:0,失败,1成功,2 考试提交后重复进入,3 练习未提交提醒")
private int status;
@ApiModelProperty("练习重新开始参数封装")
private PractiseTipDto practiseTipDto;
/*@ApiModelProperty("练习重新开始参数封装")
private PractiseTipDto practiseTipDto;*/
@ApiModelProperty("以渔有方用户token")
private String yyyfUserToken;

@ -2,7 +2,6 @@ package com.blockchain.server.yyyf.mapper;
import com.blockchain.server.yyyf.dto.AssessUserDto;
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;

@ -1,12 +1,9 @@
package com.blockchain.server.yyyf.service;
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.util.List;

@ -13,6 +13,7 @@ import com.blockchain.server.yyyf.mapper.AssessUserMapper;
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper;
import com.blockchain.server.yyyf.service.AssessUserService;
import com.blockchain.server.yyyf.utils.HttpClientUtil;
import com.blockchain.server.yyyf.utils.IdGenerator;
import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -100,6 +101,7 @@ public class AssessUserServiceImpl implements AssessUserService {
assessUserTarget.setTargetName(trainCaseTargetDto.getName());
assessUserTarget.setSort(j++);
assessUserTarget.setAnswer(1);
assessUserTarget.setId(IdGenerator.uuid());
list.add(assessUserTarget);
}
this.assessUserMapper.insert(assessUser);

Loading…
Cancel
Save