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

master
xiaoCJ 1 year ago
parent 1b494a5d31
commit 041ad7a15a

@ -1,7 +1,6 @@
package com.sztzjy.fund_investment.controller; package com.sztzjy.fund_investment.controller;
import com.sztzjy.fund_investment.annotation.AnonymousAccess; import com.sztzjy.fund_investment.annotation.AnonymousAccess;
import com.sztzjy.fund_investment.entity.Fundraising;
import com.sztzjy.fund_investment.entity.ProfitDistribution; import com.sztzjy.fund_investment.entity.ProfitDistribution;
import com.sztzjy.fund_investment.service.ISysFundraisingService; import com.sztzjy.fund_investment.service.ISysFundraisingService;
import com.sztzjy.fund_investment.service.ProfitDistributionService; import com.sztzjy.fund_investment.service.ProfitDistributionService;
@ -23,12 +22,12 @@ public class ProfitDistributionController {
@Autowired @Autowired
private ProfitDistributionService profitDistributionService; private ProfitDistributionService profitDistributionService;
@Autowired @Autowired
ISysFundraisingService fundraisingService; private ISysFundraisingService fundraisingService;
@AnonymousAccess @AnonymousAccess
@PostMapping("/submit") @PostMapping("/submit")
@ApiOperation("页面提交") @ApiOperation("页面提交")
public ResultEntity submit(@ApiParam("传id(UUID),flowID,用户输入8个框的内容(可用资金,自有资金和优先级LP必传)") ProfitDistribution profitDistribution) { public ResultEntity<String> submit(@ApiParam("传id(UUID),flowID,用户输入7个框的内容(可用资金,自有资金和优先级LP必传)") @RequestBody ProfitDistribution profitDistribution) {
return profitDistributionService.submit(profitDistribution); return profitDistributionService.submit(profitDistribution);
} }

@ -8,12 +8,14 @@ import com.sztzjy.fund_investment.mapper.FlowMapper;
import com.sztzjy.fund_investment.mapper.PerformanceScoreMapper; import com.sztzjy.fund_investment.mapper.PerformanceScoreMapper;
import com.sztzjy.fund_investment.mapper.TopicsMapper; import com.sztzjy.fund_investment.mapper.TopicsMapper;
import com.sztzjy.fund_investment.mapper.UserMapper; import com.sztzjy.fund_investment.mapper.UserMapper;
import com.sztzjy.fund_investment.service.PerformanceScoreService;
import com.sztzjy.fund_investment.service.TopicService; import com.sztzjy.fund_investment.service.TopicService;
import com.sztzjy.fund_investment.util.ResultEntity; import com.sztzjy.fund_investment.util.ResultEntity;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -37,6 +39,8 @@ public class TopicController {
@Autowired @Autowired
private PerformanceScoreMapper performanceScoreMapper; private PerformanceScoreMapper performanceScoreMapper;
@Autowired @Autowired
private PerformanceScoreService performanceScoreService;
@Autowired
private UserMapper userMapper; private UserMapper userMapper;
@Autowired @Autowired
private FlowMapper flowMapper; private FlowMapper flowMapper;
@ -62,8 +66,9 @@ public class TopicController {
@GetMapping("getRandomTopic") @GetMapping("getRandomTopic")
@ApiOperation("知识测评,项目估值,项目尽调,答题页面返回随机6条数据") @ApiOperation("知识测评,项目估值,项目尽调,答题页面返回随机6条数据")
@AnonymousAccess @AnonymousAccess
public ResultEntity<List<TopicsWithBLOBs>> getRandomTopic(@ApiParam("题目来源模块:知识测评题库,项目尽调题库,项目估值题库") @RequestParam String module) { public ResultEntity<List<TopicsWithBLOBs>> getRandomTopic(@ApiParam("题目来源模块:知识测评题库,项目尽调题库,项目估值题库") @RequestParam String module,
return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getRandomTopic(module)); @RequestParam String flowId) {
return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getRandomTopic(module, flowId));
} }
@ -71,11 +76,11 @@ public class TopicController {
* @author xcj * @author xcj
* @Date 2023/11/21 * @Date 2023/11/21
*/ */
@GetMapping("getIPOTopicTwo") @PostMapping("getIPOTopicTwo")
@ApiOperation("IPO页面弹窗2使用返回随机6条数据") @ApiOperation("IPO页面弹窗2使用返回随机6条数据")
@AnonymousAccess @AnonymousAccess
public ResultEntity<List<TopicsWithBLOBs>> getIPOTopicTwo() { public ResultEntity<List<TopicsWithBLOBs>> getIPOTopicTwo(@RequestParam String flowId) {
return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getIPOTopicTwo()); return new ResultEntity<List<TopicsWithBLOBs>>(topicService.getIPOTopicTwo(flowId));
} }
@ -86,8 +91,8 @@ public class TopicController {
@PostMapping("getRightScore/{flowId}") @PostMapping("getRightScore/{flowId}")
@ApiOperation("知识测评,项目估值,项目尽调,IPO申请,判断答案对错算分") @ApiOperation("知识测评,项目估值,项目尽调,IPO申请,判断答案对错算分")
@AnonymousAccess @AnonymousAccess
public ResultEntity<List<String>> getRightScore(@ApiParam("需要ID和用户填写的答案") @PathVariable("flowId") String flowId, public ResultEntity<List<String>> getRightScore(@PathVariable("flowId") String flowId,
@RequestBody List<TopicsWithBLOBs> topics) { @ApiParam("需要ID和用户填写的答案、和module") @RequestBody List<TopicsWithBLOBs> topics) {
return topicService.getRightScore(topics, flowId); return topicService.getRightScore(topics, flowId);
} }
@ -99,8 +104,9 @@ public class TopicController {
@PostMapping("getTopicRecord") @PostMapping("getTopicRecord")
@ApiOperation("知识测评、项目估值、项目尽调,IPO申请,回显答题记录") @ApiOperation("知识测评、项目估值、项目尽调,IPO申请,回显答题记录")
@AnonymousAccess @AnonymousAccess
public ResultEntity<List<TopicRecord>> getTopicRecord(@ApiParam("getRightScore返回的ID集合") @RequestBody List<String> ids) { public ResultEntity<List<TopicRecord>> getTopicRecord(@ApiParam("参考导入接口") @RequestParam String module,
return new ResultEntity<List<TopicRecord>>(topicService.getTopicRecord(ids)); @RequestParam String flowId) {
return new ResultEntity<List<TopicRecord>>(topicService.getTopicRecord(flowId, module));
} }
/* /*
@ -134,9 +140,13 @@ public class TopicController {
@RequestParam String flowId, @RequestParam String flowId,
@RequestParam String schoolId) { @RequestParam String schoolId) {
//不允许重复提交
PerformanceScore byFlowId = performanceScoreService.getByFlowId(flowId);
if (byFlowId != null) {
return;
}
//系统的第一个流程,新增一个得分对象 //系统的第一个流程,新增一个得分对象
PerformanceScore performanceScore = new PerformanceScore(); PerformanceScore performanceScore = new PerformanceScore();
//观看2分钟以上得满分5分否则不得分 //观看2分钟以上得满分5分否则不得分
BigDecimal score; BigDecimal score;
if (time >= 120) { if (time >= 120) {
@ -155,7 +165,7 @@ public class TopicController {
User userTable = userMapper.selectByPrimaryKey(flow.getUserid()); User userTable = userMapper.selectByPrimaryKey(flow.getUserid());
performanceScore.setClassId(userTable.getClassId()); performanceScore.setClassId(userTable.getClassId());
performanceScore.setPracticalCognitionTime(new Date()); performanceScore.setPracticalCognitionTime(new Date());
performanceScore.setTotalScore(BigDecimal.ZERO);
//防止后面算分有问题在第一个步骤初始化成0 //防止后面算分有问题在第一个步骤初始化成0
// performanceScore.setKnowledgeAssessmentScore(BigDecimal.ZERO); // performanceScore.setKnowledgeAssessmentScore(BigDecimal.ZERO);
// performanceScore.setFundraisingScore(BigDecimal.ZERO); // performanceScore.setFundraisingScore(BigDecimal.ZERO);

@ -8,7 +8,7 @@ import com.sztzjy.fund_investment.util.ResultEntity;
* @Date 2023/12/6 * @Date 2023/12/6
*/ */
public interface ProfitDistributionService { public interface ProfitDistributionService {
ResultEntity submit(ProfitDistribution profitDistribution); ResultEntity<String> submit(ProfitDistribution profitDistribution);
ProfitDistribution echo(String flowId); ProfitDistribution echo(String flowId);
} }

@ -15,11 +15,11 @@ import java.util.List;
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(); List<TopicsWithBLOBs> getIPOTopicTwo(String flowId);
List<TopicsWithBLOBs> getRandomTopic(String module); List<TopicsWithBLOBs> getRandomTopic(String module,String flowId);
List<TopicRecord> getTopicRecord(List<String> ids); List<TopicRecord> getTopicRecord(String flowId,String module);
int importFile(MultipartFile file,String schoolId,String module); int importFile(MultipartFile file,String schoolId,String module);
} }

@ -145,11 +145,17 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
* + LP+*10% LP * + LP+*10% LP
*/ */
@Override @Override
public ResultEntity submit(ProfitDistribution profitDistribution) { public ResultEntity<String> submit(ProfitDistribution profitDistribution) {
//校验可用资金 //校验可用资金
if (profitDistribution.getUserAvailableFunds() == null) { if (profitDistribution.getUserAvailableFunds() == null) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请输入可用资金!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请输入可用资金!");
} }
ProfitDistributionExample example =new ProfitDistributionExample();
example.createCriteria().andFlowIdEqualTo(profitDistribution.getFlowId());
List<ProfitDistribution> profitDistributions = profitDistributionMapper.selectByExample(example);
if (!profitDistributions.isEmpty()){
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复提交!");
}
//校验优先级LP和自有资金 //校验优先级LP和自有资金
if (profitDistribution.getUserRemainingOwnFunds() == null || profitDistribution.getUserRoundOwnFunds() == null || if (profitDistribution.getUserRemainingOwnFunds() == null || profitDistribution.getUserRoundOwnFunds() == null ||
profitDistribution.getUserRoundPreferredLp() == null || profitDistribution.getUserRemainingEarningsPreferredLp() == null) { profitDistribution.getUserRoundPreferredLp() == null || profitDistribution.getUserRemainingEarningsPreferredLp() == null) {
@ -478,6 +484,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
ProfitDistributionExample profitDistributionExample = new ProfitDistributionExample(); ProfitDistributionExample profitDistributionExample = new ProfitDistributionExample();
profitDistributionExample.createCriteria().andFlowIdEqualTo(flowId); profitDistributionExample.createCriteria().andFlowIdEqualTo(flowId);
List<ProfitDistribution> profitDistributions = profitDistributionMapper.selectByExample(profitDistributionExample); List<ProfitDistribution> profitDistributions = profitDistributionMapper.selectByExample(profitDistributionExample);
if (profitDistributions.isEmpty()){
return null;
}
return profitDistributions.get(0); return profitDistributions.get(0);
} }
} }

@ -13,6 +13,7 @@ import org.apache.poi.ss.usermodel.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -146,6 +147,11 @@ 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();
List<TopicRecord> topicRecord1 = getTopicRecord(flowId,module1);
if (!topicRecord1.isEmpty()){
return new ResultEntity<List<String>>(HttpStatus.BAD_REQUEST,"请勿重复提交!");
}
int score = 0; int score = 0;
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
String module = ""; String module = "";
@ -278,7 +284,11 @@ public class TopicServiceImpl implements TopicService {
// } // }
@Override @Override
public List<TopicsWithBLOBs> getRandomTopic(String module) { public List<TopicsWithBLOBs> getRandomTopic(String module, String flowId) {
List<TopicRecord> topicRecord = getTopicRecord(flowId, module);
if (!topicRecord.isEmpty()) {
return null;
}
TopicsExample topicsExample = new TopicsExample(); TopicsExample topicsExample = new TopicsExample();
topicsExample.createCriteria().andModuleEqualTo(module); topicsExample.createCriteria().andModuleEqualTo(module);
List<TopicsWithBLOBs> topics = topicsMapper.selectByExampleWithBLOBs(topicsExample); List<TopicsWithBLOBs> topics = topicsMapper.selectByExampleWithBLOBs(topicsExample);
@ -298,22 +308,24 @@ public class TopicServiceImpl implements TopicService {
* @Date 2023/11/21 * @Date 2023/11/21
*/ */
@Override @Override
public List<TopicRecord> getTopicRecord(List<String> ids) { public List<TopicRecord> getTopicRecord(String flowId, String module) {
List<TopicRecord> list = new ArrayList<>(); TopicRecordExample example = new TopicRecordExample();
for (String id : ids) { example.createCriteria().andModuleEqualTo(module).andFlowIdEqualTo(flowId);
TopicRecord topicRecord = topicRecordMapper.selectByPrimaryKey(id); return topicRecordMapper.selectByExample(example);
list.add(topicRecord);
}
return list;
} }
/* IPO2使6 /* IPO2使6
* @author xcj * @author xcj
* @Date 2023/11/21 * @Date 2023/11/21 IPO,IPO
*/ */
@Override @Override
public List<TopicsWithBLOBs> getIPOTopicTwo() { public List<TopicsWithBLOBs> getIPOTopicTwo(String flow) {
List<TopicRecord> IPOBKList = getTopicRecord(flow, Constant.IPOBK);
List<TopicRecord> IPOTJList = getTopicRecord(flow, Constant.IPOTJ);
if (!(IPOBKList.isEmpty()) || !(IPOTJList.isEmpty())) {
return null;
}
int topicCountPerModule = 3; int topicCountPerModule = 3;
List<TopicsWithBLOBs> topics = getRandomTopicsByModule(Constant.IPOBK, topicCountPerModule); List<TopicsWithBLOBs> topics = getRandomTopicsByModule(Constant.IPOBK, topicCountPerModule);
List<TopicsWithBLOBs> topics1 = getRandomTopicsByModule(Constant.IPOTJ, topicCountPerModule); List<TopicsWithBLOBs> topics1 = getRandomTopicsByModule(Constant.IPOTJ, topicCountPerModule);

Loading…
Cancel
Save