|
|
|
@ -149,10 +149,10 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
|
|
|
|
|
if (profitDistribution.getUserAvailableFunds() == null) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请输入可用资金!");
|
|
|
|
|
}
|
|
|
|
|
ProfitDistributionExample example =new ProfitDistributionExample();
|
|
|
|
|
ProfitDistributionExample example = new ProfitDistributionExample();
|
|
|
|
|
example.createCriteria().andFlowIdEqualTo(profitDistribution.getFlowId());
|
|
|
|
|
List<ProfitDistribution> profitDistributions = profitDistributionMapper.selectByExample(example);
|
|
|
|
|
if (!profitDistributions.isEmpty()){
|
|
|
|
|
if (!profitDistributions.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请勿重复提交!");
|
|
|
|
|
}
|
|
|
|
|
//校验优先级LP和自有资金
|
|
|
|
@ -295,16 +295,24 @@ 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) {
|
|
|
|
|
performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
|
|
|
|
|
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());
|
|
|
|
@ -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);
|
|
|
|
@ -498,7 +506,7 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
|
|
|
|
|
ProfitDistributionExample profitDistributionExample = new ProfitDistributionExample();
|
|
|
|
|
profitDistributionExample.createCriteria().andFlowIdEqualTo(flowId);
|
|
|
|
|
List<ProfitDistribution> profitDistributions = profitDistributionMapper.selectByExample(profitDistributionExample);
|
|
|
|
|
if (profitDistributions.isEmpty()){
|
|
|
|
|
if (profitDistributions.isEmpty()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return profitDistributions.get(0);
|
|
|
|
|