|
@ -13,8 +13,8 @@ import io.swagger.annotations.ApiModel; |
|
|
import io.swagger.annotations.ApiModelProperty; |
|
|
import io.swagger.annotations.ApiModelProperty; |
|
|
import lombok.Data; |
|
|
import lombok.Data; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.List; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @description: |
|
|
* @description: |
|
@ -22,6 +22,103 @@ import java.util.List; |
|
|
* @time: 2022/3/25 9:01 |
|
|
* @time: 2022/3/25 9:01 |
|
|
*/ |
|
|
*/ |
|
|
public class BrainVo { |
|
|
public class BrainVo { |
|
|
|
|
|
@Data |
|
|
|
|
|
@ApiModel("脑力筛查报告-返回") |
|
|
|
|
|
public static class ActiveUserScore { |
|
|
|
|
|
@ApiModelProperty("活动用户ID") |
|
|
|
|
|
private Long activeUserId; |
|
|
|
|
|
@ApiModelProperty("头像,无,则给默认头像") |
|
|
|
|
|
private String avatarUrl; |
|
|
|
|
|
@ApiModelProperty("测评时间") |
|
|
|
|
|
private Date trainTime; |
|
|
|
|
|
@ApiModelProperty("测评分数") |
|
|
|
|
|
private BigDecimal totalScore; |
|
|
|
|
|
@ApiModelProperty("8维得分") |
|
|
|
|
|
private List<CapacityScore> scores; |
|
|
|
|
|
@ApiModelProperty("专家点评") |
|
|
|
|
|
private String comment; |
|
|
|
|
|
@ApiModelProperty("完成状态 0:创建 1:完成 2:中断") |
|
|
|
|
|
@JsonIgnore |
|
|
|
|
|
private Byte finishStatus; |
|
|
|
|
|
|
|
|
|
|
|
public BigDecimal getTotalScore() { |
|
|
|
|
|
if (totalScore != null || CollectionUtil.isEmpty(scores)) { |
|
|
|
|
|
return totalScore; |
|
|
|
|
|
} |
|
|
|
|
|
totalScore = new BigDecimal(0); |
|
|
|
|
|
scores.forEach(score -> totalScore = totalScore.add(score.score)); |
|
|
|
|
|
return totalScore; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getComment() { |
|
|
|
|
|
if (StrUtil.isNotEmpty(comment) || CollectionUtil.isEmpty(scores)) { |
|
|
|
|
|
return comment; |
|
|
|
|
|
} |
|
|
|
|
|
List<CapacityScore> dest = new ArrayList<>(scores.size()); |
|
|
|
|
|
scores.forEach(score->dest.add(score)); |
|
|
|
|
|
Collections.sort(dest, (t1,t2) -> t1.realScore().subtract(t2.realScore()).compareTo(new BigDecimal(0))); |
|
|
|
|
|
BigDecimal goodScore = new BigDecimal(4); |
|
|
|
|
|
if (dest.get(0).realScore().compareTo(goodScore) >= 0) { |
|
|
|
|
|
comment = BrainTrainingConstant.Train.COMMENT_GOOD; |
|
|
|
|
|
} else { |
|
|
|
|
|
StringBuilder builder = new StringBuilder(dest.get(0).getCapacityName()); |
|
|
|
|
|
BigDecimal prevScore = dest.get(0).realScore(); |
|
|
|
|
|
int index = 2; |
|
|
|
|
|
for (int i = 1; i < dest.size() ; i++) { |
|
|
|
|
|
CapacityScore capacityScore = dest.get(i); |
|
|
|
|
|
BigDecimal score = capacityScore.realScore(); |
|
|
|
|
|
boolean lowScore = score.compareTo(goodScore) < 0 && (score.compareTo(prevScore) == 0 || i < index); |
|
|
|
|
|
if (!lowScore) { |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
builder.append(BrainTrainingConstant.Train.SYMBOL_DOT).append(capacityScore.getCapacityName()); |
|
|
|
|
|
prevScore = score; |
|
|
|
|
|
} |
|
|
|
|
|
comment = StrUtil.format(BrainTrainingConstant.Train.COMMENT_GENERAL, builder.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
return comment; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
@Data |
|
|
|
|
|
@ApiModel("脑力维度分数-返回") |
|
|
|
|
|
public static class CapacityScore { |
|
|
|
|
|
@ApiModelProperty("关联能力 1:执行力 2:抽象力 3:空间定向力 4:时间定向力 5:即刻记忆 6:延迟回忆 7:注意力 8:计算力") |
|
|
|
|
|
private Byte capacity; |
|
|
|
|
|
@ApiModelProperty("测评分数") |
|
|
|
|
|
private BigDecimal score; |
|
|
|
|
|
@ApiModelProperty("关联能力名字") |
|
|
|
|
|
private String capacityName; |
|
|
|
|
|
|
|
|
|
|
|
public BigDecimal realScore(){ |
|
|
|
|
|
return score; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public BigDecimal getScore() { |
|
|
|
|
|
if(score == null) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
return score.compareTo(new BigDecimal(0)) > 0 ? score : new BigDecimal(0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getCapacityName() { |
|
|
|
|
|
if (StrUtil.isNotEmpty(capacityName)) { |
|
|
|
|
|
return capacityName; |
|
|
|
|
|
} |
|
|
|
|
|
switch (capacity) { |
|
|
|
|
|
case 1: capacityName = "执行力";break; |
|
|
|
|
|
case 2: capacityName = "抽象力";break; |
|
|
|
|
|
case 3: capacityName = "空间定向力";break; |
|
|
|
|
|
case 4: capacityName = "时间定向力";break; |
|
|
|
|
|
case 5: capacityName = "即刻记忆";break; |
|
|
|
|
|
case 6: capacityName = "延迟回忆";break; |
|
|
|
|
|
case 7: capacityName = "注意力";break; |
|
|
|
|
|
case 8: capacityName = "计算力";break; |
|
|
|
|
|
default: break; |
|
|
|
|
|
} |
|
|
|
|
|
return capacityName; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Data |
|
|
@Data |
|
|
@ApiModel("脑力测评活动-返回") |
|
|
@ApiModel("脑力测评活动-返回") |
|
|
public static class Active { |
|
|
public static class Active { |
|
@ -97,21 +194,11 @@ public class BrainVo { |
|
|
@ApiModelProperty("共多少道题") |
|
|
@ApiModelProperty("共多少道题") |
|
|
private Integer total; |
|
|
private Integer total; |
|
|
@ApiModelProperty("分类,仅抽象分类使用") |
|
|
@ApiModelProperty("分类,仅抽象分类使用") |
|
|
private List<RuleGenerateVo.ChildRandom> classifies; |
|
|
private List<RuleGenerateVo.ClassifyMsg> classifies; |
|
|
|
|
|
|
|
|
public List<RuleGenerateVo.ChildRandom> getClassifies() { |
|
|
public String generateParamReal(){ |
|
|
if (classifies != null) { |
|
|
return generateParam; |
|
|
return classifies; |
|
|
|
|
|
} |
|
|
|
|
|
if (generate == null || StrUtil.isEmpty(generateParam)) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
if (generate == BrainTrainingConstant.Train.RULE_GENERATE_CHILD_RANDOM) { |
|
|
|
|
|
classifies = JSONArray.parseArray(generateParam, RuleGenerateVo.ChildRandom.class); |
|
|
|
|
|
} |
|
|
|
|
|
return classifies; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String getGenerateParam() { |
|
|
public String getGenerateParam() { |
|
|
return generate == BrainTrainingConstant.Train.RULE_GENERATE_CONTINUE_SUB ? generateParam : null; |
|
|
return generate == BrainTrainingConstant.Train.RULE_GENERATE_CONTINUE_SUB ? generateParam : null; |
|
|
} |
|
|
} |
|
@ -158,8 +245,20 @@ public class BrainVo { |
|
|
private List<QuestionContent> contents; |
|
|
private List<QuestionContent> contents; |
|
|
@ApiModelProperty("选项") |
|
|
@ApiModelProperty("选项") |
|
|
private List<QuestionOption> options; |
|
|
private List<QuestionOption> options; |
|
|
|
|
|
@ApiModelProperty("答案") |
|
|
|
|
|
private List<AnswerSort> answers; |
|
|
|
|
|
|
|
|
|
|
|
public List<AnswerSort> getAnswers() { |
|
|
|
|
|
if ( answers== null || answers.size() <= 1) { |
|
|
|
|
|
return answers; |
|
|
|
|
|
} |
|
|
|
|
|
Collections.sort(answers, Comparator.comparingInt(answer -> answer.sort)); |
|
|
|
|
|
return answers; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Data |
|
|
@Data |
|
|
@ApiModel("题干-返回") |
|
|
@ApiModel("题干-返回") |
|
|
public static class QuestionContent { |
|
|
public static class QuestionContent { |
|
@ -193,7 +292,7 @@ public class BrainVo { |
|
|
private String userName; |
|
|
private String userName; |
|
|
@ApiModelProperty("总分数") |
|
|
@ApiModelProperty("总分数") |
|
|
private Integer totalScore; |
|
|
private Integer totalScore; |
|
|
@ApiModelProperty("操作时间") |
|
|
@ApiModelProperty("操作时间,单位:毫秒") |
|
|
private Long operationTime; |
|
|
private Long operationTime; |
|
|
} |
|
|
} |
|
|
@Data |
|
|
@Data |
|
@ -217,4 +316,13 @@ public class BrainVo { |
|
|
public static final byte ANSWER_RIGHT = 1; |
|
|
public static final byte ANSWER_RIGHT = 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiModel("答案和排序") |
|
|
|
|
|
@Data |
|
|
|
|
|
private static class AnswerSort { |
|
|
|
|
|
@ApiModelProperty("答案") |
|
|
|
|
|
private String answer; |
|
|
|
|
|
@JsonIgnore |
|
|
|
|
|
@ApiModelProperty("排序") |
|
|
|
|
|
private Integer sort; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|