修复Bug

master
yz
parent 94992317b4
commit b0b97c5d61

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

@ -41,7 +41,8 @@ public class HeaderAndFooterEvent extends PdfPageEventHelper {
@SneakyThrows @SneakyThrows
public static void SetFont(BaseColor color, String fontName, float size, int style) { public static void SetFont(BaseColor color, String fontName, float size, int style) {
BaseFont baseFont; BaseFont baseFont;
String FONT_PATH="C:/Windows/Fonts/"; // String FONT_PATH="C:/Windows/Fonts/";
String FONT_PATH="/usr/share/fonts/";
switch (fontName) { switch (fontName) {
case "黑体": case "黑体":
// baseFont = BaseFont.createFont("SIMHEI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); // baseFont = BaseFont.createFont("SIMHEI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

Loading…
Cancel
Save