|
|
|
@ -3,6 +3,7 @@ package com.sztzjy.fund_investment.service.serviceImpl;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import com.sztzjy.fund_investment.config.Constant;
|
|
|
|
|
import com.sztzjy.fund_investment.entity.*;
|
|
|
|
|
import com.sztzjy.fund_investment.entity.query.TopicQuery;
|
|
|
|
|
import com.sztzjy.fund_investment.mapper.PerformanceScoreMapper;
|
|
|
|
|
import com.sztzjy.fund_investment.mapper.TopicRecordMapper;
|
|
|
|
|
import com.sztzjy.fund_investment.mapper.TopicsMapper;
|
|
|
|
@ -148,9 +149,9 @@ public class TopicServiceImpl implements TopicService {
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity<List<String>> getRightScore(List<TopicsWithBLOBs> topics, String flowId) {
|
|
|
|
|
String module1 = topics.get(0).getModule();
|
|
|
|
|
List<TopicRecord> topicRecord1 = getTopicRecord(flowId,module1);
|
|
|
|
|
if (!topicRecord1.isEmpty()){
|
|
|
|
|
return new ResultEntity<List<String>>(HttpStatus.BAD_REQUEST,"请勿重复提交!");
|
|
|
|
|
List<TopicRecord> topicRecord1 = getTopicRecord(flowId, module1);
|
|
|
|
|
if (!topicRecord1.isEmpty()) {
|
|
|
|
|
return new ResultEntity<List<String>>(HttpStatus.BAD_REQUEST, "请勿重复提交!");
|
|
|
|
|
}
|
|
|
|
|
int score = 0;
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
@ -284,14 +285,16 @@ public class TopicServiceImpl implements TopicService {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<TopicsWithBLOBs> getRandomTopic(String module, String flowId) {
|
|
|
|
|
public List<TopicsWithBLOBs> getRandomTopic(String module, String flowId, String schoolId) {
|
|
|
|
|
List<TopicRecord> topicRecord = getTopicRecord(flowId, module);
|
|
|
|
|
if (!topicRecord.isEmpty()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
TopicsExample topicsExample = new TopicsExample();
|
|
|
|
|
topicsExample.createCriteria().andModuleEqualTo(module);
|
|
|
|
|
List<TopicsWithBLOBs> topics = topicsMapper.selectByExampleWithBLOBs(topicsExample);
|
|
|
|
|
TopicQuery topicQuery = new TopicQuery();
|
|
|
|
|
topicQuery.setCount(6);
|
|
|
|
|
topicQuery.setModule(module);
|
|
|
|
|
topicQuery.setSchoolId(schoolId);
|
|
|
|
|
List<TopicsWithBLOBs> topics = topicsMapper.selectRandomTopics(topicQuery);
|
|
|
|
|
//随机取6道题目
|
|
|
|
|
Collections.shuffle(topics);
|
|
|
|
|
int size = Math.min(6, topics.size());
|
|
|
|
@ -320,15 +323,23 @@ public class TopicServiceImpl implements TopicService {
|
|
|
|
|
* @Date 2023/11/21 IPO上市板块题目,IPO上市条件题目
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<TopicsWithBLOBs> getIPOTopicTwo(String flow) {
|
|
|
|
|
public List<TopicsWithBLOBs> getIPOTopicTwo(String flow, String schoolId) {
|
|
|
|
|
List<TopicRecord> IPOBKList = getTopicRecord(flow, Constant.IPOBK);
|
|
|
|
|
List<TopicRecord> IPOTJList = getTopicRecord(flow, Constant.IPOTJ);
|
|
|
|
|
if (!(IPOBKList.isEmpty()) || !(IPOTJList.isEmpty())) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
int topicCountPerModule = 3;
|
|
|
|
|
List<TopicsWithBLOBs> topics = getRandomTopicsByModule(Constant.IPOBK, topicCountPerModule);
|
|
|
|
|
List<TopicsWithBLOBs> topics1 = getRandomTopicsByModule(Constant.IPOTJ, topicCountPerModule);
|
|
|
|
|
TopicQuery topicQuery = new TopicQuery();
|
|
|
|
|
topicQuery.setCount(3);
|
|
|
|
|
topicQuery.setModule(Constant.IPOBK);
|
|
|
|
|
topicQuery.setSchoolId(schoolId);
|
|
|
|
|
List<TopicsWithBLOBs> topics = topicsMapper.selectRandomTopics(topicQuery);
|
|
|
|
|
TopicQuery topicQuery1 = new TopicQuery();
|
|
|
|
|
topicQuery1.setCount(3);
|
|
|
|
|
topicQuery1.setModule(Constant.IPOTJ);
|
|
|
|
|
topicQuery1.setSchoolId(schoolId);
|
|
|
|
|
List<TopicsWithBLOBs> topics1 = topicsMapper.selectRandomTopics(topicQuery1);
|
|
|
|
|
topics.addAll(topics1);
|
|
|
|
|
// List<TopicsDto> list = toTopicsDtoList(topics);
|
|
|
|
|
// list.addAll(toTopicsDtoList(topics1));
|
|
|
|
@ -340,14 +351,7 @@ public class TopicServiceImpl implements TopicService {
|
|
|
|
|
* @author xcj
|
|
|
|
|
* @Date 2023/11/21
|
|
|
|
|
*/
|
|
|
|
|
private List<TopicsWithBLOBs> getRandomTopicsByModule(String module, int count) {
|
|
|
|
|
TopicsExample topicsExample = new TopicsExample();
|
|
|
|
|
topicsExample.createCriteria().andModuleEqualTo(module);
|
|
|
|
|
List<TopicsWithBLOBs> topics = topicsMapper.selectByExampleWithBLOBs(topicsExample);
|
|
|
|
|
Collections.shuffle(topics);
|
|
|
|
|
int size = Math.min(count, topics.size());
|
|
|
|
|
return topics.subList(0, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 选项转Map,对象转Dto返回
|
|
|
|
|