wanghb 1 year ago
commit 0ecfbf3168

@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -72,6 +73,13 @@ public class InvestmentReportController {
return investmentReportService.commitExperience(trainingReport);
}
@AnonymousAccess
@PostMapping("saveExperience")
@ApiOperation("保存心得")
public ResultEntity<HttpStatus> saveExperience(@ApiParam("用户填写的心得") @RequestParam String text, @RequestParam String flowId, @RequestParam String schoolId) {
return investmentReportService.saveExperience(text,flowId,schoolId);
}
@AnonymousAccess
@GetMapping("getExperience")
@ApiOperation("心得回显")
@ -81,10 +89,12 @@ public class InvestmentReportController {
return null;
}
TrainingReport trainingReport = trainingReports.get(0);
if (StringUtils.isBlank(trainingReport.getExperience())) {
return null;
}
if (!StringUtils.isBlank(trainingReport.getExperience())) {
return new ResultEntity<>(trainingReport.getExperience());
} if (!StringUtils.isBlank(trainingReport.getVersion())) {
return new ResultEntity<>(trainingReport.getVersion());
}
return null;
}
@AnonymousAccess

@ -12,6 +12,10 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* @Author xcj
* @Date 2023/12/6
@ -41,11 +45,13 @@ public class ProfitDistributionController {
@AnonymousAccess
@PostMapping("/getType")
@ApiOperation("返回基金募集的类型")
public Integer submit(@RequestParam String flowId) {
@ApiOperation("返回基金募集的类型和总金额")
public ResultEntity<Map<Integer, BigDecimal>> submit(@RequestParam String flowId) {
Fundraising fundraising = fundraisingService.selectByFlowId(flowId);
Map<Integer, BigDecimal> map = new HashMap<>();
if (fundraising != null) {
return fundraising.getType();
map.put(fundraising.getType(), fundraising.getFundraisingAmount());
return new ResultEntity<>(map);
}
return null;
}

@ -9,12 +9,14 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Random;
@ -54,12 +56,14 @@ public class ProfitManagementController {
@ApiOperation("退出时机弹窗/随机获取股票价格")
@AnonymousAccess
@GetMapping("/getRandomPrice")
public ResultEntity getRandomPrice(@ApiParam("getLineChart返回的Id") @RequestParam String id) {
public ResultEntity<BigDecimal> getRandomPrice(@ApiParam("getLineChart返回的Id") @RequestParam String id) {
Random random = new Random();
double randomValue = 0.01 + random.nextDouble() * 19.99; // 生成0到20之间的随机数不包括0
return new ResultEntity<>(randomValue);
BigDecimal bigDecimal = BigDecimal.valueOf(randomValue).setScale(2, RoundingMode.HALF_UP);
return new ResultEntity<>(bigDecimal);
}
@ApiOperation("退出时机弹窗/判断市值和基金收益对错,计算错误则返回正确答案")
@AnonymousAccess
@GetMapping("/getExitTimeRightMarketValueAndFundEarnings")
@ -85,7 +89,7 @@ public class ProfitManagementController {
@ApiOperation("判断市值和基金收益对错,计算错误则返回正确答案")
@AnonymousAccess
@GetMapping("/getRightMarketValueAndFundEarnings")
public ResultEntity getStockInfo(@RequestParam @ApiParam("getLineChart返回的Id") String id,
public ResultEntity<HttpStatus> getStockInfo(@RequestParam @ApiParam("getLineChart返回的Id") String id,
@ApiParam("用户输入的市值") @RequestParam BigDecimal userMarketValue,
@ApiParam("用户输入的基金收益") @RequestParam BigDecimal userFundEarnings) {
return profitManagementService.getRightMarketValueAndFundEarnings(id, userMarketValue, userFundEarnings);

@ -254,12 +254,13 @@ public class UserController {
int index2 = random.nextInt(2);
Map<String, List<String>> map = evaluatePerformanceLevel(trainingScore, maxScoresMap);
evaluationLevel.setLevelMap(map);
String[] evaluationLevelArr = {"恭喜你完成实验,你本次实验总体" + level + ",实验过程充满挑战,能够完成实验已经很棒了,接下来我们看下实验完成情况吧。实验中你完成的" + arr1[index1] + "的步骤有"
+ String.join("", map.get("非常好")) + "步骤," + "你对这些步骤知识掌提的非常" + arr2[index2] + ",相信你一定做了不少努力,这些对你以后参与股权基金投资相关工作非常有帮助。实验中你完成的一般的步骤有"
+ String.join("", map.get("一般")) + "步骤,你初步" + arr4[index2] + "了这部分内容,相信你通过学习" + arr5[index2] + "做的更好,这些都是股权基金投资实务业务知识,跟理论还是有一定差距的,努力学习吧! "
+ "实验中你完成的" + arr6[index2] + "的步骤有" + String.join("", map.get("较差")) + "步骤,是不是没有认真实验呢?这是个" + arr3[index2] + "的实验,要认真对待哦,不会的业务知识去搜集资料或者请教下同学和老师吧,争取早日掌握它们! "
+ "如果你对实验过程有什么疑问,可以通过系统场景右下角的答疑按钮进行提问哦,会有人回复的,如果你对实验有什么意见,也欢迎提出,我们一起改进,让这个实验越来越好帮助更多的人!"};
String s = "<p>恭喜你完成实验,你本次实验总体" + level + ",实验过程充满挑战,能够完成实验已经很棒了,接下来我们看下实验完成情况吧。</p><p>实验中你完成的" + arr1[index1] + "的步骤有"
+ String.join("", map.get("非常好")) + "步骤," + "你对这些步骤知识掌提的非常" + arr2[index2] + ",相信你一定做了不少努力,这些对你以后参与股权基金投资相关工作非常有帮助。</p><p>实验中你完成的一般的步骤有"
+ String.join("", map.get("一般")) + "步骤,你初步" + arr4[index2] + "了这部分内容,相信你通过学习" + arr5[index2] + "做的更好,这些都是股权基金投资实务业务知识,跟理论还是有一定差距的,努力学习吧!</p>"
+ "<p>实验中你完成的" + arr6[index2] + "的步骤有" + String.join("", map.get("较差")) + "步骤,是不是没有认真实验呢?这是个" + arr3[index2] + "的实验,要认真对待哦,不会的业务知识去搜集资料或者请教下同学和老师吧,争取早日掌握它们!<p/>"
+ "<p>如果你对实验过程有什么疑问,可以通过系统场景右下角的答疑按钮进行提问哦,会有人回复的,如果你对实验有什么意见,也欢迎提出,我们一起改进,让这个实验越来越好帮助更多的人!</p>";
String trim = s.trim();
String[] evaluationLevelArr = {trim};
evaluationLevel.setEvaluation(evaluationLevelArr);
return new ResultEntity<EvaluationLevel>(evaluationLevel);
}

@ -2,6 +2,7 @@ package com.sztzjy.fund_investment.service;
import com.sztzjy.fund_investment.entity.TrainingReport;
import com.sztzjy.fund_investment.util.ResultEntity;
import org.springframework.http.HttpStatus;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -16,4 +17,6 @@ public interface InvestmentReportService {
List<TrainingReport> getTrainingReports(String flowId);
ResultEntity<String> commitExperience(TrainingReport trainingReport);
ResultEntity<HttpStatus> saveExperience(String text, String flowId, String schoolId);
}

@ -3,6 +3,7 @@ package com.sztzjy.fund_investment.service;
import com.sztzjy.fund_investment.entity.ExitTime;
import com.sztzjy.fund_investment.entity.ProfitManagement;
import com.sztzjy.fund_investment.util.ResultEntity;
import org.springframework.http.HttpStatus;
import java.math.BigDecimal;
import java.util.List;
@ -16,9 +17,9 @@ public interface ProfitManagementService {
ProfitManagement getStockInfo(String id);
ResultEntity getRightMarketValueAndFundEarnings(String id, BigDecimal userMarketValue, BigDecimal userFundEarnings);
ResultEntity<HttpStatus> getRightMarketValueAndFundEarnings(String id, BigDecimal userMarketValue, BigDecimal userFundEarnings);
ExitTime getExitTime(String flowId);
ResultEntity getExitTimeRightMarketValueAndFundEarnings(String flowId, String exitTime, BigDecimal price, BigDecimal userMarketValue, BigDecimal userFundEarnings);
ResultEntity<HttpStatus> getExitTimeRightMarketValueAndFundEarnings(String flowId, String exitTime, BigDecimal price, BigDecimal userMarketValue, BigDecimal userFundEarnings);
}

@ -127,8 +127,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
trainingReport.setStep(reportNameType.getReportNameType());
trainingReportMapper.insert(trainingReport);
count++;
if (count == 1)
{
if (count == 1) {
performanceScoreService.calculateScoreByModule("investmentSigningVlauationReportScore", 2, reportNameType.getFlowId());
}
}
@ -243,7 +242,6 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
long sumMoney = aLong1 + aDouble1;
//第三条注册资本增加至
investmentAgreementDto.setRegisteredCapitalIncrease(String.valueOf(sumMoney));
@ -289,6 +287,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
/**
*
*
* @return
*/
@Override
@ -302,12 +301,10 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
issuanceInfoExample.createCriteria().andFlowIdEqualTo(issuanceInfo.getFlowId());
List<IssuanceInfo> issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample);
//查询有无第一次录入的数据
if (issuanceInfos.size()>0)
{
if (issuanceInfos.size() > 0) {
//获取上一次录入的数据和这一次录入的做对比
String s = compareFields(issuanceInfo, issuanceInfos.get(0));
if (!s.isEmpty())
{
if (!s.isEmpty()) {
issuanceInfoMapper.deleteByExample(issuanceInfoExample);
return new ResultEntity<>(HttpStatus.OK, s, "两次输入的" + s + ":" + "值不同!");
}
@ -374,6 +371,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
/**
*
*
* @param flowId
* @return
*/
@ -433,12 +431,10 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(issuanceParameterInput.getFlowId());
List<IssuanceParameterInput> issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample);
//查询有无第一次录入的数据
if (issuanceParameterInputList.size()>0)
{
if (issuanceParameterInputList.size() > 0) {
//获取上一次录入的数据和这一次录入的做对比
String s = compareFieldsTwo(issuanceParameterInput, issuanceParameterInputList.get(0));
if (!s.isEmpty())
{
if (!s.isEmpty()) {
issuanceParameterInputMapper.deleteByExample(issuanceParameterInputExample);
return new ResultEntity<>(HttpStatus.OK, s, "两次输入的" + s + ":" + "值不同!");
}
@ -465,6 +461,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
/**
*
*
* @param flowId
* @return
*/
@ -530,8 +527,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
if (!formattedThisValue.equals(formattedOtherValue)) {
differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n");
}
}
else {
} else {
// 对于非浮点数,直接使用 equals 进行比较
if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) {
differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n");
@ -547,8 +543,6 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
}
// 比较两个Student对象的字段返回不相同的字段
public String compareFields(IssuanceInfo newInfo, IssuanceInfo other) {
IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample();
@ -594,8 +588,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
if (!formattedThisValue.equals(formattedOtherValue)) {
differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n");
}
}
else {
} else {
// 对于非浮点数,直接使用 equals 进行比较
if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) {
differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n");
@ -611,12 +604,6 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
}
public List<TrainingReport> getTrainingReports(String flowId, String reportName) {
TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(reportName);

@ -92,7 +92,7 @@ public class InvestmentReportServiceImpl implements InvestmentReportService {
@Override
public List<TrainingReport> getTrainingReports(String flowId) {
TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andFlowIdEqualTo(flowId);
trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(Constant.TZBG);
return trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample);
}
@ -106,7 +106,7 @@ public class InvestmentReportServiceImpl implements InvestmentReportService {
if (StringUtils.isBlank(trainingReport.getExperience())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请先填写心得再提交!");
}
if (StringUtils.isBlank(trainingReport.getId()) || StringUtils.isBlank(trainingReport.getFlowId()) || StringUtils.isBlank(trainingReport.getSchoolId())) {
if (StringUtils.isBlank(trainingReport.getFlowId()) || StringUtils.isBlank(trainingReport.getSchoolId())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "提交失败缺少所需的ID");
}
TrainingReportExample trainingReportExample = new TrainingReportExample();
@ -122,10 +122,44 @@ public class InvestmentReportServiceImpl implements InvestmentReportService {
trainingReportMapper.updateByPrimaryKeyWithBLOBs(dataTrainingReport);
}
} else { //为空新增
trainingReport.setId(IdUtil.simpleUUID());
trainingReport.setUploadtime(new Date());
trainingReport.setStep(Constant.TZBG);
trainingReportMapper.insert(trainingReport);
}
return new ResultEntity<>(HttpStatus.OK, "提交成功!");
}
/*
* @author xcj
* @Date 2024/1/31
*/
@Override
public ResultEntity<HttpStatus> saveExperience(String text,String flowId,String schoolId) {
TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(Constant.TZBG);
List<TrainingReport> trainingReports = trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample);
//为空代表没有提交或保存过,新增一条
if (trainingReports.isEmpty()){
TrainingReport trainingReport = new TrainingReport();
trainingReport.setFlowId(flowId);
trainingReport.setId(IdUtil.simpleUUID());
trainingReport.setSchoolId(schoolId);
trainingReport.setUploadtime(new Date());
trainingReport.setStep(Constant.TZBG);
trainingReport.setVersion(text); //新增保存功能,使用版本字段,没有再添加字段
trainingReportMapper.insert(trainingReport);
return new ResultEntity<>(HttpStatus.OK,"保存成功!");
}else {
TrainingReport trainingReport = trainingReports.get(0);
if (trainingReport.getExperience()!=null){
return new ResultEntity<>(HttpStatus.BAD_REQUEST,"提交过不允许再保存!");
}
trainingReport.setVersion(text);
trainingReportMapper.updateByPrimaryKeyWithBLOBs(trainingReport);
return new ResultEntity<>(HttpStatus.OK,"保存成功!");
}
}
}

@ -179,8 +179,8 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
BigDecimal userRemainingEarningsPreferredLp = profitDistribution.getRemainingEarningsPreferredLp();//用户/第二轮优先级LP
BigDecimal rightOwnFunds = fundraising.getOwnFunds();//正确/第一轮自有资金
Integer type = fundraising.getType();
//计算可用资金是否正确
BigDecimal rightAvailableFunds = fundraisingAmount.add(exitFundEarnings).setScale(2, RoundingMode.HALF_UP);//可用资金
//计算可用资金是否正确 基金募集总金额-投资金额+退出时投资收益
BigDecimal rightAvailableFunds = fundraisingAmount.subtract(exitTime.getInvestmentAmount()).add(exitFundEarnings).setScale(2, RoundingMode.HALF_UP);//可用资金
profitDistribution.setAvailableFunds(rightAvailableFunds); //设置可用资金
if (profitDistribution.getUserAvailableFunds().compareTo(rightAvailableFunds) == 0) {
performanceScoreService.calculateScoreByModule("profitDistributionAvailablefundsScore", 1, flowId);
@ -295,17 +295,25 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
residualIncome = residualIncome.subtract(subordinatedLp); //剩余收益
// 2.剩余收益分配比例为自有资金25%优先级LP 30%劣后级LP 45%
BigDecimal twoRightOwnFunds = residualIncome.multiply(BigDecimal.valueOf(0.25)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金
BigDecimal twoRightFundraisingAmount = residualIncome.multiply(BigDecimal.valueOf(0.35)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金
BigDecimal twoRightFundraisingAmount = residualIncome.multiply(BigDecimal.valueOf(0.3)).setScale(2, RoundingMode.HALF_UP);//剩余优先级
BigDecimal twoRightSubordinatedLp = residualIncome.subtract(twoRightOwnFunds).subtract(twoRightFundraisingAmount); //剩余劣后级LP
profitDistribution.setRemainingOwnFunds(twoRightOwnFunds);
profitDistribution.setRemainingEarningsPreferredLp(twoRightFundraisingAmount);
profitDistribution.setRemainingEarningsSubordinatedLp(twoRightSubordinatedLp);
profitDistributionMapper.insert(profitDistribution);
if (rightOwnFunds.compareTo(userRoundOwnFunds) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 &&
twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 && twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0 &&
userRoundSubordinatedLp.compareTo(subordinatedLp) == 0 && userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) {
if (rightOwnFunds != null && userRoundOwnFunds != null &&
userRoundPreferredLp != null &&
userRoundSubordinatedLp != null && subordinatedLp != null &&
userRemainingEarningsSubordinatedLp != null) {
if (rightOwnFunds.compareTo(userRoundOwnFunds) == 0 &&
rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 &&
twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 &&
twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0 &&
userRoundSubordinatedLp.compareTo(subordinatedLp) == 0 &&
userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) {
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
}
}
PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId);
performanceScore.setProfitDistributionTime(new Date());
performanceScoreMapper.updateByPrimaryKey(performanceScore);
@ -469,7 +477,7 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
residualIncome = residualIncome.subtract(subordinatedLp).subtract(rightBankLoan); //剩余收益
//2.剩余收益分配比例为自有资金25%优先级LP 30%劣后级LP 45%
BigDecimal twoRightOwnFunds = residualIncome.multiply(BigDecimal.valueOf(0.25)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金
BigDecimal twoRightFundraisingAmount = residualIncome.multiply(BigDecimal.valueOf(0.35)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金
BigDecimal twoRightFundraisingAmount = residualIncome.multiply(BigDecimal.valueOf(0.3)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金
BigDecimal twoRightSubordinatedLp = residualIncome.subtract(twoRightOwnFunds).subtract(twoRightFundraisingAmount); //剩余劣后级LP
profitDistribution.setRemainingOwnFunds(twoRightOwnFunds);
profitDistribution.setRemainingEarningsPreferredLp(twoRightFundraisingAmount);

@ -74,12 +74,12 @@ public class ProfitManagementServiceImpl implements ProfitManagementService {
profitManagementMapper.updateByPrimaryKey(profitManagement);
if (!(userMarketValue.compareTo(marketValue) == 0)) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "市值计算错误!", marketValue);
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "市值计算错误!", marketValue);
} else {
performanceScoreService.calculateScoreByModule("profitManagementMarketValueScore", 2, profitManagement.getFlowId());
}
if (!(userFundEarnings.compareTo(fundEarnings) == 0)) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "收益计算错误!", fundEarnings);
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "收益计算错误!", fundEarnings);
} else {
performanceScoreService.calculateScoreByModule("profitManagementFundScore", 2, profitManagement.getFlowId());
}
@ -93,25 +93,7 @@ public class ProfitManagementServiceImpl implements ProfitManagementService {
*/
@Override
public ExitTime getExitTime(String flowId) {
ExitTime dataExitTime = exitTimeMapper.selectByPrimaryKey(flowId);
if (dataExitTime != null) {
return dataExitTime;
} else {
ExitTime exitTime = new ExitTime();
List<ProfitManagement> profitManagementList = getLineChart(flowId);
if (profitManagementList.isEmpty()){
return null;
}
ProfitManagement profitManagement = profitManagementList.get(0);
exitTime.setFlowId(flowId);
exitTime.setProjectName(profitManagement.getProjectName());
exitTime.setInvestmentAmount(profitManagement.getInvestmentAmount());
exitTime.setShareRatio(profitManagement.getShareRatio());
exitTime.setTotalEquity(profitManagement.getTotalEquity());
exitTime.setShareCount(profitManagement.getShareCount());
exitTimeMapper.insert(exitTime);
return exitTime;
}
return exitTimeMapper.selectByPrimaryKey(flowId);
}
@ -122,37 +104,42 @@ public class ProfitManagementServiceImpl implements ProfitManagementService {
@Override
public ResultEntity getExitTimeRightMarketValueAndFundEarnings(String flowId, String exitTime, BigDecimal price,
BigDecimal userMarketValue, BigDecimal userFundEarnings) {
ExitTime exitTimeEntity = exitTimeMapper.selectByPrimaryKey(flowId);
ExitTime exitTimeEntity = new ExitTime();
List<ProfitManagement> profitManagementList = getLineChart(flowId);
if (profitManagementList.isEmpty()) {
return null;
}
ProfitManagement profitManagement = profitManagementList.get(0);
exitTimeEntity.setFlowId(flowId);
exitTimeEntity.setProjectName(profitManagement.getProjectName());
exitTimeEntity.setInvestmentAmount(profitManagement.getInvestmentAmount());
exitTimeEntity.setShareRatio(profitManagement.getShareRatio());
exitTimeEntity.setTotalEquity(profitManagement.getTotalEquity());
exitTimeEntity.setShareCount(profitManagement.getShareCount());
exitTimeEntity.setExitTiming(exitTime);
exitTimeEntity.setExitStockPrice(price);
exitTimeEntity.setUserMarketValue(userMarketValue);
exitTimeEntity.setUserFundEarnings(userFundEarnings);
//公司市值=股票价格*总股本
BigDecimal marketValue = exitTimeEntity.getExitStockPrice().multiply(exitTimeEntity.getTotalEquity()).setScale(2, RoundingMode.HALF_UP);
BigDecimal marketValue = price.multiply(exitTimeEntity.getTotalEquity()).setScale(2, RoundingMode.HALF_UP);
exitTimeEntity.setExitMarketValue(marketValue);
exitTimeEntity.setUserMarketValue(userMarketValue);
//基金收益=持股数量*股票价格-投资金额
BigDecimal fundEarnings = exitTimeEntity.getShareCount().multiply(exitTimeEntity.getExitStockPrice()).subtract(exitTimeEntity.getInvestmentAmount()).setScale(2, RoundingMode.HALF_UP);
exitTimeEntity.setUserFundEarnings(userFundEarnings);
BigDecimal fundEarnings = exitTimeEntity.getShareCount().multiply(price).subtract(exitTimeEntity.getInvestmentAmount()).setScale(2, RoundingMode.HALF_UP);
exitTimeEntity.setExitFundEarnings(fundEarnings);
// 退出时收益率 = 基金收益 / 投资金额
BigDecimal exitYield = exitTimeEntity.getExitFundEarnings().divide(exitTimeEntity.getInvestmentAmount(), 2, RoundingMode.HALF_UP);
BigDecimal exitYield = profitManagement.getFundEarnings().divide(exitTimeEntity.getInvestmentAmount(), 2, RoundingMode.HALF_UP);
exitTimeEntity.setExitYield(exitYield);
exitTimeMapper.updateByPrimaryKey(exitTimeEntity);
if (!(userMarketValue.compareTo(marketValue) == 0)) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "市值计算错误!", marketValue);
} else {
performanceScoreService.calculateScoreByModule("profitManagementFundExitScore", 3, flowId);
}
if (!(userFundEarnings.compareTo(fundEarnings) == 0)) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "收益计算错误!", fundEarnings);
} else {
performanceScoreService.calculateScoreByModule("profitManagementMarketValueExitScore", 3, flowId);
}
exitTimeMapper.insert(exitTimeEntity);
//标记页面完成时间
PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId);
performanceScore.setProfitManagementTime(new Date());
performanceScoreMapper.updateByPrimaryKey(performanceScore);
if (userMarketValue.compareTo(marketValue) == 0) {
performanceScoreService.calculateScoreByModule("profitManagementFundExitScore", 3, flowId);
}
if (userFundEarnings.compareTo(fundEarnings) == 0) {
performanceScoreService.calculateScoreByModule("profitManagementMarketValueExitScore", 3, flowId);
}
return null;
}
}

Loading…
Cancel
Save