新增退出时机表,完成投资报告页面接口

master
xiaoCJ
parent 84a6cdc1cc
commit 6ce77a293d

@ -67,8 +67,8 @@ public class TopicController {
@ApiOperation("知识测评,项目估值,项目尽调,答题页面返回随机6条数据") @ApiOperation("知识测评,项目估值,项目尽调,答题页面返回随机6条数据")
@AnonymousAccess @AnonymousAccess
public ResultEntity<List<TopicsWithBLOBs>> getRandomTopic(@ApiParam("题目来源模块:知识测评题库,项目尽调题库,项目估值题库") @RequestParam String module, public ResultEntity<List<TopicsWithBLOBs>> getRandomTopic(@ApiParam("题目来源模块:知识测评题库,项目尽调题库,项目估值题库") @RequestParam String module,
@RequestParam String flowId) { @RequestParam String flowId,String schoolId) {
return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getRandomTopic(module, flowId)); return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getRandomTopic(module, flowId,schoolId));
} }
@ -79,8 +79,8 @@ public class TopicController {
@PostMapping("getIPOTopicTwo") @PostMapping("getIPOTopicTwo")
@ApiOperation("IPO页面弹窗2使用返回随机6条数据") @ApiOperation("IPO页面弹窗2使用返回随机6条数据")
@AnonymousAccess @AnonymousAccess
public ResultEntity<List<TopicsWithBLOBs>> getIPOTopicTwo(@RequestParam String flowId) { public ResultEntity<List<TopicsWithBLOBs>> getIPOTopicTwo(@RequestParam String flowId,@RequestParam String schoolId) {
return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getIPOTopicTwo(flowId)); return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getIPOTopicTwo(flowId,schoolId));
} }

@ -0,0 +1,14 @@
package com.sztzjy.fund_investment.entity.query;
import lombok.Data;
/**
* @Author xcj
* @Date 2023/12/18
*/
@Data
public class TopicQuery {
private String module;
private String schoolId;
private int count;
}

@ -6,6 +6,7 @@ import com.sztzjy.fund_investment.entity.TopicsWithBLOBs;
import java.util.List; import java.util.List;
import com.sztzjy.fund_investment.entity.query.TopicQuery;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -42,4 +43,6 @@ public interface TopicsMapper {
void insertBatch(List<Topics> list); void insertBatch(List<Topics> list);
List<TopicsWithBLOBs> getTopicsByCondition(@Param("schoolId") String schoolId, @Param("module") String module, @Param("topicContent") String topicContent); List<TopicsWithBLOBs> getTopicsByCondition(@Param("schoolId") String schoolId, @Param("module") String module, @Param("topicContent") String topicContent);
List<TopicsWithBLOBs> selectRandomTopics(@Param("query") TopicQuery query);
} }

@ -13,13 +13,13 @@ import java.util.List;
* @Date 2023/11/15 * @Date 2023/11/15
*/ */
public interface TopicService { public interface TopicService {
ResultEntity<List<String>> getRightScore(List<TopicsWithBLOBs> topics,String flowId); ResultEntity<List<String>> getRightScore(List<TopicsWithBLOBs> topics, String flowId);
List<TopicsWithBLOBs> getIPOTopicTwo(String flowId); List<TopicsWithBLOBs> getIPOTopicTwo(String flowId, String schoolId);
List<TopicsWithBLOBs> getRandomTopic(String module,String flowId); List<TopicsWithBLOBs> getRandomTopic(String module, String flowId, String schoolId);
List<TopicRecord> getTopicRecord(String flowId,String module); List<TopicRecord> getTopicRecord(String flowId, String module);
int importFile(MultipartFile file,String schoolId,String module); int importFile(MultipartFile file, String schoolId, String module);
} }

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

@ -90,6 +90,13 @@
, analysis , analysis
</sql> </sql>
<select id="selectRandomTopics" parameterType="map" resultMap="ResultMapWithBLOBs">
SELECT * FROM sys_topics
WHERE module = #{query.module,jdbcType=VARCHAR}
AND school_id IN ('999',#{query.schoolId,jdbcType=VARCHAR})
ORDER BY RAND()
LIMIT #{query.count}
</select>
<select id="getTopicsByCondition" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="getTopicsByCondition" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select select

Loading…
Cancel
Save