wanghb 1 year ago
commit 0ecfbf3168

@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
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;
@ -72,6 +73,13 @@ public class InvestmentReportController {
return investmentReportService.commitExperience(trainingReport); 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 @AnonymousAccess
@GetMapping("getExperience") @GetMapping("getExperience")
@ApiOperation("心得回显") @ApiOperation("心得回显")
@ -81,10 +89,12 @@ public class InvestmentReportController {
return null; return null;
} }
TrainingReport trainingReport = trainingReports.get(0); TrainingReport trainingReport = trainingReports.get(0);
if (StringUtils.isBlank(trainingReport.getExperience())) { if (!StringUtils.isBlank(trainingReport.getExperience())) {
return null; return new ResultEntity<>(trainingReport.getExperience());
} if (!StringUtils.isBlank(trainingReport.getVersion())) {
return new ResultEntity<>(trainingReport.getVersion());
} }
return new ResultEntity<>(trainingReport.getExperience()); return null;
} }
@AnonymousAccess @AnonymousAccess

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

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

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

@ -59,7 +59,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
private InquiryParticipationMapper inquiryParticipationMapper; private InquiryParticipationMapper inquiryParticipationMapper;
@Autowired @Autowired
private IssuanceParameterInputMapper issuanceParameterInputMapper; private IssuanceParameterInputMapper issuanceParameterInputMapper;
@Autowired @Autowired
private PerformanceScoreMapper performanceScoreMapper; private PerformanceScoreMapper performanceScoreMapper;
@ -71,7 +71,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
* *
*/ */
@Override @Override
public ResultEntity<String> uploadDueDiligenceReport(List<MultipartFile> files , ReportUploadDto reportNameType) { public ResultEntity<String> uploadDueDiligenceReport(List<MultipartFile> files, ReportUploadDto reportNameType) {
int count = 0; int count = 0;
for (MultipartFile file : files) { for (MultipartFile file : files) {
@ -91,8 +91,8 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
//一个两个做判断 //一个两个做判断
if ("尽调报告".equals(reportNameType.getReportNameType())){ if ("尽调报告".equals(reportNameType.getReportNameType())) {
if (trainingReports.size() > 0 ) { if (trainingReports.size() > 0) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!");
} else { //只允许提交一次 } else { //只允许提交一次
TrainingReport trainingReport = new TrainingReport(); TrainingReport trainingReport = new TrainingReport();
@ -106,16 +106,16 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
trainingReport.setStep(reportNameType.getReportNameType()); trainingReport.setStep(reportNameType.getReportNameType());
trainingReportMapper.insert(trainingReport); trainingReportMapper.insert(trainingReport);
//每个2分共4分 //每个2分共4分
if ("尽调报告".equals(reportNameType.getReportNameType())){ if ("尽调报告".equals(reportNameType.getReportNameType())) {
//investmentSigningDiligenceReportScore //investmentSigningDiligenceReportScore
performanceScoreService.calculateScoreByModule("investmentSigningDiligenceReportScore", 2, reportNameType.getFlowId()); performanceScoreService.calculateScoreByModule("investmentSigningDiligenceReportScore", 2, reportNameType.getFlowId());
}
} }
} } else if ("估值报告".equals(reportNameType.getReportNameType())) {
}else if ("估值报告".equals(reportNameType.getReportNameType())){ if (trainingReports.size() >= 2) {
if (trainingReports.size() >= 2 ) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!");
}else { } else {
TrainingReport trainingReport = new TrainingReport(); TrainingReport trainingReport = new TrainingReport();
trainingReport.setId(IdUtil.fastSimpleUUID()); trainingReport.setId(IdUtil.fastSimpleUUID());
trainingReport.setFlowId(reportNameType.getFlowId()); trainingReport.setFlowId(reportNameType.getFlowId());
@ -127,8 +127,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
trainingReport.setStep(reportNameType.getReportNameType()); trainingReport.setStep(reportNameType.getReportNameType());
trainingReportMapper.insert(trainingReport); trainingReportMapper.insert(trainingReport);
count++; count++;
if (count == 1) if (count == 1) {
{
performanceScoreService.calculateScoreByModule("investmentSigningVlauationReportScore", 2, reportNameType.getFlowId()); performanceScoreService.calculateScoreByModule("investmentSigningVlauationReportScore", 2, reportNameType.getFlowId());
} }
} }
@ -175,12 +174,12 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
ProjectPool projectPool = projectPools.get(0); ProjectPool projectPool = projectPools.get(0);
//项目估值 //项目估值
latestValuation = Double.valueOf(projectPool.getLatestValuation()); latestValuation = Double.valueOf(projectPool.getLatestValuation());
//获取公司名 //获取公司名
companyName = projectPool.getCompanyName(); companyName = projectPool.getCompanyName();
} }
//公司名 //公司名
investmentAgreementDto.setCorporateName(companyName+"有限公司"); investmentAgreementDto.setCorporateName(companyName + "有限公司");
//法定代表人 //法定代表人
investmentAgreementDto.setLegalRepresentativePartA(list.get(0).getLegalPerson()); investmentAgreementDto.setLegalRepresentativePartA(list.get(0).getLegalPerson());
//注册地址 //注册地址
@ -211,7 +210,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
investmentAgreementDto.setIncreaseCapitalShare(profitManagement.getInvestmentAmount().toString()); investmentAgreementDto.setIncreaseCapitalShare(profitManagement.getInvestmentAmount().toString());
long v = profitManagement.getInvestmentAmount().longValue(); long v = profitManagement.getInvestmentAmount().longValue();
Long aLong = Convert.toLong(latestValuation); Long aLong = Convert.toLong(latestValuation);
Long sum = aLong+v; Long sum = aLong + v;
//增资后公司总股本 //增资后公司总股本
investmentAgreementDto.setTotalShareCapital(String.valueOf(sum)); investmentAgreementDto.setTotalShareCapital(String.valueOf(sum));
@ -230,7 +229,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
//hutool工具转换金额 //hutool工具转换金额
String s = Convert.digitToChinese(aDouble); String s = Convert.digitToChinese(aDouble);
//第三条注册资本大写金额 //第三条注册资本大写金额
investmentAgreementDto.setRegisteredCapitalAmount(s+"人民币"); investmentAgreementDto.setRegisteredCapitalAmount(s + "人民币");
//投资金额 //投资金额
BigDecimal investmentAmount = profitManagement.getInvestmentAmount(); BigDecimal investmentAmount = profitManagement.getInvestmentAmount();
@ -240,8 +239,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
Long aLong1 = Convert.toLong(registeredCapital); Long aLong1 = Convert.toLong(registeredCapital);
//注册资本加上投资金额 //注册资本加上投资金额
long sumMoney = aLong1+ aDouble1; long sumMoney = aLong1 + aDouble1;
//第三条注册资本增加至 //第三条注册资本增加至
@ -252,7 +250,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
String s2 = Convert.digitToChinese(sumMoney); String s2 = Convert.digitToChinese(sumMoney);
//第三条注册资本增加至大写金额 //第三条注册资本增加至大写金额
investmentAgreementDto.setRegisteredCapitalIncreaseAmount(s2+"人民币"); investmentAgreementDto.setRegisteredCapitalIncreaseAmount(s2 + "人民币");
//第三条增资股份等于投资金额 //第三条增资股份等于投资金额
investmentAgreementDto.setCapitalIncreaseShares(String.valueOf(investmentAmount)); investmentAgreementDto.setCapitalIncreaseShares(String.valueOf(investmentAmount));
@ -279,7 +277,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
investmentAgreementDto.setSigningAddress(businessInfoList.get(0).getRegisteredAddress()); investmentAgreementDto.setSigningAddress(businessInfoList.get(0).getRegisteredAddress());
return investmentAgreementDto; return investmentAgreementDto;
} }
@ -289,6 +287,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
/** /**
* *
*
* @return * @return
*/ */
@Override @Override
@ -302,18 +301,16 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
issuanceInfoExample.createCriteria().andFlowIdEqualTo(issuanceInfo.getFlowId()); issuanceInfoExample.createCriteria().andFlowIdEqualTo(issuanceInfo.getFlowId());
List<IssuanceInfo> issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); List<IssuanceInfo> issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample);
//查询有无第一次录入的数据 //查询有无第一次录入的数据
if (issuanceInfos.size()>0) if (issuanceInfos.size() > 0) {
{
//获取上一次录入的数据和这一次录入的做对比 //获取上一次录入的数据和这一次录入的做对比
String s = compareFields(issuanceInfo,issuanceInfos.get(0)); String s = compareFields(issuanceInfo, issuanceInfos.get(0));
if (!s.isEmpty()) if (!s.isEmpty()) {
{
issuanceInfoMapper.deleteByExample(issuanceInfoExample); issuanceInfoMapper.deleteByExample(issuanceInfoExample);
return new ResultEntity<>(HttpStatus.OK,s,"两次输入的"+s+":"+"值不同!"); return new ResultEntity<>(HttpStatus.OK, s, "两次输入的" + s + ":" + "值不同!");
} }
//完成新建发行申请3分 //完成新建发行申请3分
performanceScoreService.calculateScoreByModule("newPricingIssuanceScore", 3, issuanceInfo.getFlowId()); performanceScoreService.calculateScoreByModule("newPricingIssuanceScore", 3, issuanceInfo.getFlowId());
return new ResultEntity<>(HttpStatus.OK,s,"添加成功"); return new ResultEntity<>(HttpStatus.OK, s, "添加成功");
} }
@ -342,25 +339,25 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
long info = l * 100000; long info = l * 100000;
//判断估值和4亿比较 //判断估值和4亿比较
//估值小于4亿的发行总量大于等于估值的25%估值大于4亿的发行总量大于估值的10% //估值小于4亿的发行总量大于等于估值的25%估值大于4亿的发行总量大于估值的10%
if(aLong > max){ if (aLong > max) {
if (info/aLong >0.1) { if (info / aLong > 0.1) {
issuanceInfo.setId(IdUtil.fastSimpleUUID()); issuanceInfo.setId(IdUtil.fastSimpleUUID());
//插入数据 //插入数据
issuanceInfoMapper.insert(issuanceInfo); issuanceInfoMapper.insert(issuanceInfo);
return new ResultEntity(HttpStatus.OK); return new ResultEntity(HttpStatus.OK);
}else { } else {
return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的10%"); return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的10%");
} }
}else if (aLong < max){ } else if (aLong < max) {
if (info/aLong >0.25) { if (info / aLong > 0.25) {
issuanceInfo.setId(IdUtil.fastSimpleUUID()); issuanceInfo.setId(IdUtil.fastSimpleUUID());
//插入数据 //插入数据
issuanceInfoMapper.insert(issuanceInfo); issuanceInfoMapper.insert(issuanceInfo);
return new ResultEntity(HttpStatus.OK); return new ResultEntity(HttpStatus.OK);
}else { } else {
return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的25%"); return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的25%");
} }
} }
@ -373,7 +370,8 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
} }
/** /**
* *
*
* @param flowId * @param flowId
* @return * @return
*/ */
@ -433,14 +431,12 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(issuanceParameterInput.getFlowId()); issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(issuanceParameterInput.getFlowId());
List<IssuanceParameterInput> issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample); List<IssuanceParameterInput> issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample);
//查询有无第一次录入的数据 //查询有无第一次录入的数据
if (issuanceParameterInputList.size()>0) if (issuanceParameterInputList.size() > 0) {
{
//获取上一次录入的数据和这一次录入的做对比 //获取上一次录入的数据和这一次录入的做对比
String s = compareFieldsTwo(issuanceParameterInput,issuanceParameterInputList.get(0)); String s = compareFieldsTwo(issuanceParameterInput, issuanceParameterInputList.get(0));
if (!s.isEmpty()) if (!s.isEmpty()) {
{
issuanceParameterInputMapper.deleteByExample(issuanceParameterInputExample); issuanceParameterInputMapper.deleteByExample(issuanceParameterInputExample);
return new ResultEntity<>(HttpStatus.OK,s,"两次输入的"+s+":"+"值不同!"); return new ResultEntity<>(HttpStatus.OK, s, "两次输入的" + s + ":" + "值不同!");
} }
//询价结果查询及发行参数录入2分 //询价结果查询及发行参数录入2分
performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 2, issuanceParameterInput.getFlowId()); performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 2, issuanceParameterInput.getFlowId());
@ -450,7 +446,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
performanceScore.setPricingIssuanceTime(new Date()); performanceScore.setPricingIssuanceTime(new Date());
performanceScoreMapper.updateByPrimaryKey(performanceScore); performanceScoreMapper.updateByPrimaryKey(performanceScore);
return new ResultEntity<>(HttpStatus.OK,s,"添加成功"); return new ResultEntity<>(HttpStatus.OK, s, "添加成功");
} }
//第一次录入和估值做计算 //第一次录入和估值做计算
else { else {
@ -465,6 +461,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
/** /**
* *
*
* @param flowId * @param flowId
* @return * @return
*/ */
@ -485,7 +482,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
// 比较两个Student对象的字段返回不相同的字段 // 比较两个Student对象的字段返回不相同的字段
public String compareFieldsTwo(IssuanceParameterInput newInfo ,IssuanceParameterInput other) { public String compareFieldsTwo(IssuanceParameterInput newInfo, IssuanceParameterInput other) {
IssuanceParameterInputExample issuanceParameterInputExample = new IssuanceParameterInputExample(); IssuanceParameterInputExample issuanceParameterInputExample = new IssuanceParameterInputExample();
issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(newInfo.getFlowId()); issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(newInfo.getFlowId());
List<IssuanceParameterInput> issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample); List<IssuanceParameterInput> issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample);
@ -530,8 +527,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
if (!formattedThisValue.equals(formattedOtherValue)) { if (!formattedThisValue.equals(formattedOtherValue)) {
differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n"); differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n");
} }
} } else {
else {
// 对于非浮点数,直接使用 equals 进行比较 // 对于非浮点数,直接使用 equals 进行比较
if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) {
differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n");
@ -547,10 +543,8 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
} }
// 比较两个Student对象的字段返回不相同的字段 // 比较两个Student对象的字段返回不相同的字段
public String compareFields(IssuanceInfo newInfo ,IssuanceInfo other) { public String compareFields(IssuanceInfo newInfo, IssuanceInfo other) {
IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample(); IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample();
issuanceInfoExample.createCriteria().andFlowIdEqualTo(other.getFlowId()); issuanceInfoExample.createCriteria().andFlowIdEqualTo(other.getFlowId());
List<IssuanceInfo> issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); List<IssuanceInfo> issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample);
@ -594,8 +588,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
if (!formattedThisValue.equals(formattedOtherValue)) { if (!formattedThisValue.equals(formattedOtherValue)) {
differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n"); differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n");
} }
} } else {
else {
// 对于非浮点数,直接使用 equals 进行比较 // 对于非浮点数,直接使用 equals 进行比较
if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) {
differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n");
@ -611,19 +604,13 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
} }
public List<TrainingReport> getTrainingReports(String flowId, String reportName) {
TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(reportName);
return trainingReportMapper.selectByExample(trainingReportExample);
}
}
public List<TrainingReport> getTrainingReports (String flowId, String reportName){
TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(reportName);
return trainingReportMapper.selectByExample(trainingReportExample);
}
}

@ -92,7 +92,7 @@ public class InvestmentReportServiceImpl implements InvestmentReportService {
@Override @Override
public List<TrainingReport> getTrainingReports(String flowId) { public List<TrainingReport> getTrainingReports(String flowId) {
TrainingReportExample trainingReportExample = new TrainingReportExample(); TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andFlowIdEqualTo(flowId); trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(Constant.TZBG);
return trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample); return trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample);
} }
@ -106,7 +106,7 @@ public class InvestmentReportServiceImpl implements InvestmentReportService {
if (StringUtils.isBlank(trainingReport.getExperience())) { if (StringUtils.isBlank(trainingReport.getExperience())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请先填写心得再提交!"); 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"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "提交失败缺少所需的ID");
} }
TrainingReportExample trainingReportExample = new TrainingReportExample(); TrainingReportExample trainingReportExample = new TrainingReportExample();
@ -122,10 +122,44 @@ public class InvestmentReportServiceImpl implements InvestmentReportService {
trainingReportMapper.updateByPrimaryKeyWithBLOBs(dataTrainingReport); trainingReportMapper.updateByPrimaryKeyWithBLOBs(dataTrainingReport);
} }
} else { //为空新增 } else { //为空新增
trainingReport.setId(IdUtil.simpleUUID());
trainingReport.setUploadtime(new Date()); trainingReport.setUploadtime(new Date());
trainingReport.setStep(Constant.TZBG); trainingReport.setStep(Constant.TZBG);
trainingReportMapper.insert(trainingReport); trainingReportMapper.insert(trainingReport);
} }
return new ResultEntity<>(HttpStatus.OK, "提交成功!"); 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,"保存成功!");
}
}
} }

@ -149,10 +149,10 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
if (profitDistribution.getUserAvailableFunds() == null) { if (profitDistribution.getUserAvailableFunds() == null) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请输入可用资金!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请输入可用资金!");
} }
ProfitDistributionExample example =new ProfitDistributionExample(); ProfitDistributionExample example = new ProfitDistributionExample();
example.createCriteria().andFlowIdEqualTo(profitDistribution.getFlowId()); example.createCriteria().andFlowIdEqualTo(profitDistribution.getFlowId());
List<ProfitDistribution> profitDistributions = profitDistributionMapper.selectByExample(example); List<ProfitDistribution> profitDistributions = profitDistributionMapper.selectByExample(example);
if (!profitDistributions.isEmpty()){ if (!profitDistributions.isEmpty()) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复提交!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复提交!");
} }
//校验优先级LP和自有资金 //校验优先级LP和自有资金
@ -179,8 +179,8 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
BigDecimal userRemainingEarningsPreferredLp = profitDistribution.getRemainingEarningsPreferredLp();//用户/第二轮优先级LP BigDecimal userRemainingEarningsPreferredLp = profitDistribution.getRemainingEarningsPreferredLp();//用户/第二轮优先级LP
BigDecimal rightOwnFunds = fundraising.getOwnFunds();//正确/第一轮自有资金 BigDecimal rightOwnFunds = fundraising.getOwnFunds();//正确/第一轮自有资金
Integer type = fundraising.getType(); 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); //设置可用资金 profitDistribution.setAvailableFunds(rightAvailableFunds); //设置可用资金
if (profitDistribution.getUserAvailableFunds().compareTo(rightAvailableFunds) == 0) { if (profitDistribution.getUserAvailableFunds().compareTo(rightAvailableFunds) == 0) {
performanceScoreService.calculateScoreByModule("profitDistributionAvailablefundsScore", 1, flowId); performanceScoreService.calculateScoreByModule("profitDistributionAvailablefundsScore", 1, flowId);
@ -295,16 +295,24 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
residualIncome = residualIncome.subtract(subordinatedLp); //剩余收益 residualIncome = residualIncome.subtract(subordinatedLp); //剩余收益
// 2.剩余收益分配比例为自有资金25%优先级LP 30%劣后级LP 45% // 2.剩余收益分配比例为自有资金25%优先级LP 30%劣后级LP 45%
BigDecimal twoRightOwnFunds = residualIncome.multiply(BigDecimal.valueOf(0.25)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金 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 BigDecimal twoRightSubordinatedLp = residualIncome.subtract(twoRightOwnFunds).subtract(twoRightFundraisingAmount); //剩余劣后级LP
profitDistribution.setRemainingOwnFunds(twoRightOwnFunds); profitDistribution.setRemainingOwnFunds(twoRightOwnFunds);
profitDistribution.setRemainingEarningsPreferredLp(twoRightFundraisingAmount); profitDistribution.setRemainingEarningsPreferredLp(twoRightFundraisingAmount);
profitDistribution.setRemainingEarningsSubordinatedLp(twoRightSubordinatedLp); profitDistribution.setRemainingEarningsSubordinatedLp(twoRightSubordinatedLp);
profitDistributionMapper.insert(profitDistribution); profitDistributionMapper.insert(profitDistribution);
if (rightOwnFunds.compareTo(userRoundOwnFunds) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && if (rightOwnFunds != null && userRoundOwnFunds != null &&
twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 && twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0 && userRoundPreferredLp != null &&
userRoundSubordinatedLp.compareTo(subordinatedLp) == 0 && userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) { userRoundSubordinatedLp != null && subordinatedLp != null &&
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); 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 performanceScore = performanceScoreService.getByFlowId(flowId);
performanceScore.setProfitDistributionTime(new Date()); performanceScore.setProfitDistributionTime(new Date());
@ -469,7 +477,7 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
residualIncome = residualIncome.subtract(subordinatedLp).subtract(rightBankLoan); //剩余收益 residualIncome = residualIncome.subtract(subordinatedLp).subtract(rightBankLoan); //剩余收益
//2.剩余收益分配比例为自有资金25%优先级LP 30%劣后级LP 45% //2.剩余收益分配比例为自有资金25%优先级LP 30%劣后级LP 45%
BigDecimal twoRightOwnFunds = residualIncome.multiply(BigDecimal.valueOf(0.25)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金 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 BigDecimal twoRightSubordinatedLp = residualIncome.subtract(twoRightOwnFunds).subtract(twoRightFundraisingAmount); //剩余劣后级LP
profitDistribution.setRemainingOwnFunds(twoRightOwnFunds); profitDistribution.setRemainingOwnFunds(twoRightOwnFunds);
profitDistribution.setRemainingEarningsPreferredLp(twoRightFundraisingAmount); profitDistribution.setRemainingEarningsPreferredLp(twoRightFundraisingAmount);
@ -498,7 +506,7 @@ 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()){ if (profitDistributions.isEmpty()) {
return null; return null;
} }
return profitDistributions.get(0); return profitDistributions.get(0);

@ -74,12 +74,12 @@ public class ProfitManagementServiceImpl implements ProfitManagementService {
profitManagementMapper.updateByPrimaryKey(profitManagement); profitManagementMapper.updateByPrimaryKey(profitManagement);
if (!(userMarketValue.compareTo(marketValue) == 0)) { if (!(userMarketValue.compareTo(marketValue) == 0)) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "市值计算错误!", marketValue); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "市值计算错误!", marketValue);
} else { } else {
performanceScoreService.calculateScoreByModule("profitManagementMarketValueScore", 2, profitManagement.getFlowId()); performanceScoreService.calculateScoreByModule("profitManagementMarketValueScore", 2, profitManagement.getFlowId());
} }
if (!(userFundEarnings.compareTo(fundEarnings) == 0)) { if (!(userFundEarnings.compareTo(fundEarnings) == 0)) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "收益计算错误!", fundEarnings); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "收益计算错误!", fundEarnings);
} else { } else {
performanceScoreService.calculateScoreByModule("profitManagementFundScore", 2, profitManagement.getFlowId()); performanceScoreService.calculateScoreByModule("profitManagementFundScore", 2, profitManagement.getFlowId());
} }
@ -93,25 +93,7 @@ public class ProfitManagementServiceImpl implements ProfitManagementService {
*/ */
@Override @Override
public ExitTime getExitTime(String flowId) { public ExitTime getExitTime(String flowId) {
ExitTime dataExitTime = exitTimeMapper.selectByPrimaryKey(flowId); return 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;
}
} }
@ -122,37 +104,42 @@ public class ProfitManagementServiceImpl implements ProfitManagementService {
@Override @Override
public ResultEntity getExitTimeRightMarketValueAndFundEarnings(String flowId, String exitTime, BigDecimal price, public ResultEntity getExitTimeRightMarketValueAndFundEarnings(String flowId, String exitTime, BigDecimal price,
BigDecimal userMarketValue, BigDecimal userFundEarnings) { 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.setExitTiming(exitTime);
exitTimeEntity.setExitStockPrice(price); exitTimeEntity.setExitStockPrice(price);
exitTimeEntity.setUserMarketValue(userMarketValue); exitTimeEntity.setUserMarketValue(userMarketValue);
exitTimeEntity.setUserFundEarnings(userFundEarnings); 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.setExitMarketValue(marketValue);
exitTimeEntity.setUserMarketValue(userMarketValue);
//基金收益=持股数量*股票价格-投资金额 //基金收益=持股数量*股票价格-投资金额
BigDecimal fundEarnings = exitTimeEntity.getShareCount().multiply(exitTimeEntity.getExitStockPrice()).subtract(exitTimeEntity.getInvestmentAmount()).setScale(2, RoundingMode.HALF_UP); BigDecimal fundEarnings = exitTimeEntity.getShareCount().multiply(price).subtract(exitTimeEntity.getInvestmentAmount()).setScale(2, RoundingMode.HALF_UP);
exitTimeEntity.setUserFundEarnings(userFundEarnings);
exitTimeEntity.setExitFundEarnings(fundEarnings); 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); exitTimeEntity.setExitYield(exitYield);
exitTimeMapper.updateByPrimaryKey(exitTimeEntity); exitTimeMapper.insert(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);
}
//标记页面完成时间 //标记页面完成时间
PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId); PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId);
performanceScore.setProfitManagementTime(new Date()); performanceScore.setProfitManagementTime(new Date());
performanceScoreMapper.updateByPrimaryKey(performanceScore); 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; return null;
} }
} }

Loading…
Cancel
Save