|
|
|
@ -48,7 +48,7 @@ public class FundraisingController {
|
|
|
|
|
@ApiParam("自有资金") @RequestParam BigDecimal ownFunds,
|
|
|
|
|
@ApiParam("银行借款") @RequestParam (required = false)BigDecimal bankLoan,
|
|
|
|
|
@ApiParam("优先级LP") @RequestParam BigDecimal priorityLP,
|
|
|
|
|
@ApiParam("劣后级LP") @RequestParam(required = false) BigDecimal subordinatedLP,
|
|
|
|
|
@ApiParam("劣后级LP") @RequestParam(required = false) BigDecimal subordinatedLp,
|
|
|
|
|
@ApiParam("基金募资金额(为前面四个参数之和)") @RequestParam BigDecimal fundraisingAmount) {
|
|
|
|
|
if (ownFunds.add(priorityLP).compareTo(BigDecimal.valueOf(1000000))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
@ -59,60 +59,60 @@ public class FundraisingController {
|
|
|
|
|
}
|
|
|
|
|
Fundraising fundraising = new Fundraising();
|
|
|
|
|
//判断基金募集类型 1:自有资金/优先级LP、2:自有资金/优先级LP/劣后级LP、3:自有资金/优先级LP/银行借款、4:自有资金/优先级LP/劣后级LP/银行借款
|
|
|
|
|
if(subordinatedLP!=null){
|
|
|
|
|
if(bankLoan!=null){
|
|
|
|
|
if(subordinatedLp.compareTo(BigDecimal.ZERO)!=0){
|
|
|
|
|
if(bankLoan.compareTo(BigDecimal.ZERO)!=0){
|
|
|
|
|
fundraising.setType(4);
|
|
|
|
|
BigDecimal totalFunds = priorityLP.add(ownFunds).add(subordinatedLP).add(bankLoan);
|
|
|
|
|
if(ownFunds.divide(totalFunds).compareTo(new BigDecimal("0.05"))>0){
|
|
|
|
|
BigDecimal totalFunds = priorityLP.add(ownFunds).add(subordinatedLp).add(bankLoan);
|
|
|
|
|
if(ownFunds.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.05"))>0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型4,自有资金不能超过总资金的5%");
|
|
|
|
|
}
|
|
|
|
|
if(priorityLP.divide(totalFunds).compareTo(new BigDecimal("0.6"))<0){
|
|
|
|
|
if(priorityLP.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.6"))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型4,优先级LP不能低于总资金的60%");
|
|
|
|
|
}
|
|
|
|
|
if(subordinatedLP.divide(totalFunds).compareTo(new BigDecimal("0.3"))<0){
|
|
|
|
|
if(subordinatedLp.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.3"))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型4,劣后级LP不能低于总资金的30%");
|
|
|
|
|
}
|
|
|
|
|
if(bankLoan.divide(totalFunds).compareTo(new BigDecimal("0.05"))<0){
|
|
|
|
|
if(bankLoan.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.05"))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型4,银行借款不能低于总资金的5%");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
BigDecimal totalFunds = priorityLP.add(ownFunds).add(subordinatedLP);
|
|
|
|
|
if(ownFunds.divide(totalFunds).compareTo(new BigDecimal("0.1"))>0){
|
|
|
|
|
BigDecimal totalFunds = priorityLP.add(ownFunds).add(subordinatedLp);
|
|
|
|
|
if(ownFunds.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.1"))>0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型2,自有资金不能超过总资金的10%");
|
|
|
|
|
}
|
|
|
|
|
if(priorityLP.divide(totalFunds).compareTo(new BigDecimal("0.6"))<0){
|
|
|
|
|
if(priorityLP.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.6"))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型2,优先级LP不能低于总资金的60%");
|
|
|
|
|
}
|
|
|
|
|
if(subordinatedLP.divide(totalFunds).compareTo(new BigDecimal("0.3"))<0){
|
|
|
|
|
if(subordinatedLp.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.3"))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型2,劣后级LP不能低于总资金的30%");
|
|
|
|
|
}
|
|
|
|
|
fundraising.setType(2);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if(bankLoan!=null){
|
|
|
|
|
if(bankLoan.compareTo(BigDecimal.ZERO)!=0){
|
|
|
|
|
BigDecimal totalFunds = priorityLP.add(ownFunds).add(bankLoan);
|
|
|
|
|
if(ownFunds.divide(totalFunds).compareTo(new BigDecimal("0.1"))>0){
|
|
|
|
|
if(ownFunds.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.1"))>0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型3,自有资金不能超过总资金的10%");
|
|
|
|
|
}
|
|
|
|
|
if(priorityLP.divide(totalFunds).compareTo(new BigDecimal("0.6"))<0){
|
|
|
|
|
if(priorityLP.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.6"))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型3,优先级LP不能低于总资金的60%");
|
|
|
|
|
}
|
|
|
|
|
if(bankLoan.divide(totalFunds).compareTo(new BigDecimal("0.3"))<0){
|
|
|
|
|
if(bankLoan.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.3"))<0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型3,银行借款不能低于总资金的30%");
|
|
|
|
|
}
|
|
|
|
|
fundraising.setType(3);
|
|
|
|
|
}else {
|
|
|
|
|
if(ownFunds.divide(priorityLP.add(ownFunds)).compareTo(new BigDecimal("0.1"))>0){
|
|
|
|
|
if(ownFunds.divide(priorityLP.add(ownFunds),4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.1"))>0){
|
|
|
|
|
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型1,自有资金不能超过总资金的10%");
|
|
|
|
|
}
|
|
|
|
@ -124,7 +124,7 @@ public class FundraisingController {
|
|
|
|
|
fundraising.setOwnFunds(ownFunds);
|
|
|
|
|
fundraising.setBankLoan(bankLoan);
|
|
|
|
|
fundraising.setPriorityLp(priorityLP);
|
|
|
|
|
fundraising.setSubordinatedLp(subordinatedLP);
|
|
|
|
|
fundraising.setSubordinatedLp(subordinatedLp);
|
|
|
|
|
fundraising.setFundraisingAmount(fundraisingAmount);
|
|
|
|
|
Boolean aBoolean = fundraisingService.insertFundraising(fundraising);
|
|
|
|
|
if(aBoolean){
|
|
|
|
|