|
@@ -2,6 +2,7 @@ package com.ytpm.lemonios.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.ytpm.agent.enums.UserStatusEnum;
|
|
import com.ytpm.agent.enums.UserStatusEnum;
|
|
|
import com.ytpm.app.model.YtDyzAnswerRecord;
|
|
import com.ytpm.app.model.YtDyzAnswerRecord;
|
|
@@ -18,6 +19,7 @@ import com.ytpm.lemonios.dao.AppUserMapper;
|
|
|
import com.ytpm.lemonios.dao.QuestionMapper;
|
|
import com.ytpm.lemonios.dao.QuestionMapper;
|
|
|
import com.ytpm.lemonios.service.QuestionService;
|
|
import com.ytpm.lemonios.service.QuestionService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
@@ -34,6 +36,8 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
private QuestionMapper questionMapper;
|
|
private QuestionMapper questionMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AppUserMapper appUserMapper;
|
|
private AppUserMapper appUserMapper;
|
|
|
|
|
+ @Value("${spring.application.name:}")
|
|
|
|
|
+ private String applicationName;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取题库
|
|
* 获取题库
|
|
@@ -55,9 +59,12 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
if(!UserStatusEnum.NORMAL.getCode().equals(user.getUserStatus())){
|
|
if(!UserStatusEnum.NORMAL.getCode().equals(user.getUserStatus())){
|
|
|
return new Result<>(StatusCode.ACCESS_ERR,"当前用户处于风控中");
|
|
return new Result<>(StatusCode.ACCESS_ERR,"当前用户处于风控中");
|
|
|
}
|
|
}
|
|
|
-// if (user.getPower() == null || user.getPower() <= 0) {
|
|
|
|
|
-// return new Result<>(StatusCode.ACCESS_ERR, "用户体力不足,无法答题");
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // lemonios gollumios 需要校验体力
|
|
|
|
|
+ if (StrUtil.containsAny(applicationName, "lemonios-service","gollumios-service")) {
|
|
|
|
|
+ if (user.getPower() == null || user.getPower() <= 0) {
|
|
|
|
|
+ return new Result<>(StatusCode.ACCESS_ERR, "用户体力不足,无法答题");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
YtDyzAnswerRecord record = new YtDyzAnswerRecord();
|
|
YtDyzAnswerRecord record = new YtDyzAnswerRecord();
|
|
|
BeanUtil.copyProperties(param,record);
|
|
BeanUtil.copyProperties(param,record);
|
|
|
record.setRecordId(IdUtil.fastSimpleUUID());
|
|
record.setRecordId(IdUtil.fastSimpleUUID());
|