|
|
@ -1,10 +1,8 @@
|
|
|
|
package com.sztzjy.fund_investment.service.serviceImpl;
|
|
|
|
package com.sztzjy.fund_investment.service.serviceImpl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.fund_investment.entity.ExitTime;
|
|
|
|
import com.sztzjy.fund_investment.entity.*;
|
|
|
|
import com.sztzjy.fund_investment.entity.Fundraising;
|
|
|
|
|
|
|
|
import com.sztzjy.fund_investment.entity.ProfitDistribution;
|
|
|
|
|
|
|
|
import com.sztzjy.fund_investment.entity.ProfitDistributionExample;
|
|
|
|
|
|
|
|
import com.sztzjy.fund_investment.mapper.ExitTimeMapper;
|
|
|
|
import com.sztzjy.fund_investment.mapper.ExitTimeMapper;
|
|
|
|
|
|
|
|
import com.sztzjy.fund_investment.mapper.PerformanceScoreMapper;
|
|
|
|
import com.sztzjy.fund_investment.mapper.ProfitDistributionMapper;
|
|
|
|
import com.sztzjy.fund_investment.mapper.ProfitDistributionMapper;
|
|
|
|
import com.sztzjy.fund_investment.service.ISysFundraisingService;
|
|
|
|
import com.sztzjy.fund_investment.service.ISysFundraisingService;
|
|
|
|
import com.sztzjy.fund_investment.service.PerformanceScoreService;
|
|
|
|
import com.sztzjy.fund_investment.service.PerformanceScoreService;
|
|
|
@ -16,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -32,8 +31,8 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
|
|
|
|
private ExitTimeMapper exitTimeMapper;
|
|
|
|
private ExitTimeMapper exitTimeMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private PerformanceScoreService performanceScoreService;
|
|
|
|
private PerformanceScoreService performanceScoreService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private PerformanceScoreMapper performanceScoreMapper;
|
|
|
|
/* 收益分配计算提交
|
|
|
|
/* 收益分配计算提交
|
|
|
|
* @author xcj
|
|
|
|
* @author xcj
|
|
|
|
* @Date 2023/12/11
|
|
|
|
* @Date 2023/12/11
|
|
|
@ -231,6 +230,10 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
|
|
|
|
twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 && twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0) {
|
|
|
|
twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 && twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0) {
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId);
|
|
|
|
|
|
|
|
performanceScore.setProfitDistributionTime(new Date());
|
|
|
|
|
|
|
|
performanceScoreMapper.updateByPrimaryKey(performanceScore);
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "分配完成!");
|
|
|
|
} else if (type == 2) { //2:自有资金/优先级LP/劣后级LP
|
|
|
|
} else if (type == 2) { //2:自有资金/优先级LP/劣后级LP
|
|
|
|
if (profitDistribution.getUserRemainingEarningsSubordinatedLp() == null || profitDistribution.getUserRoundSubordinatedLp() == null) {
|
|
|
|
if (profitDistribution.getUserRemainingEarningsSubordinatedLp() == null || profitDistribution.getUserRoundSubordinatedLp() == null) {
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请填写劣后级LP分配金额!");
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请填写劣后级LP分配金额!");
|
|
|
@ -303,6 +306,10 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
|
|
|
|
userRoundSubordinatedLp.compareTo(subordinatedLp) == 0 && userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) {
|
|
|
|
userRoundSubordinatedLp.compareTo(subordinatedLp) == 0 && userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) {
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId);
|
|
|
|
|
|
|
|
performanceScore.setProfitDistributionTime(new Date());
|
|
|
|
|
|
|
|
performanceScoreMapper.updateByPrimaryKey(performanceScore);
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "分配完成!");
|
|
|
|
} else if (type == 3) { //3:银行借款/自有资金/优先级LP
|
|
|
|
} else if (type == 3) { //3:银行借款/自有资金/优先级LP
|
|
|
|
if (profitDistribution.getUserRoundBankLoan() == null) {
|
|
|
|
if (profitDistribution.getUserRoundBankLoan() == null) {
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请填写银行借款分配金额!");
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请填写银行借款分配金额!");
|
|
|
@ -372,6 +379,10 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
|
|
|
|
rightBankLoan.compareTo(userRoundBankLoan) == 0) {
|
|
|
|
rightBankLoan.compareTo(userRoundBankLoan) == 0) {
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId);
|
|
|
|
|
|
|
|
performanceScore.setProfitDistributionTime(new Date());
|
|
|
|
|
|
|
|
performanceScoreMapper.updateByPrimaryKey(performanceScore);
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "分配完成!");
|
|
|
|
} else { //4:银行借款/优先级LP/劣后级LP/自有资金
|
|
|
|
} else { //4:银行借款/优先级LP/劣后级LP/自有资金
|
|
|
|
if (profitDistribution.getUserRemainingEarningsSubordinatedLp() == null || profitDistribution.getUserRoundSubordinatedLp() == null) {
|
|
|
|
if (profitDistribution.getUserRemainingEarningsSubordinatedLp() == null || profitDistribution.getUserRoundSubordinatedLp() == null) {
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请填写劣后级LP分配金额!");
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请填写劣后级LP分配金额!");
|
|
|
@ -470,8 +481,11 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
|
|
|
|
userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) {
|
|
|
|
userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) {
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PerformanceScore performanceScore = performanceScoreService.getByFlowId(flowId);
|
|
|
|
|
|
|
|
performanceScore.setProfitDistributionTime(new Date());
|
|
|
|
|
|
|
|
performanceScoreMapper.updateByPrimaryKey(performanceScore);
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "分配完成!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|