diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java index f3f156b..76599b1 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java +++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java @@ -59,7 +59,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService private InquiryParticipationMapper inquiryParticipationMapper; @Autowired - private IssuanceParameterInputMapper issuanceParameterInputMapper; + private IssuanceParameterInputMapper issuanceParameterInputMapper; @Autowired private PerformanceScoreMapper performanceScoreMapper; @@ -71,7 +71,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService * 上传尽调报告 */ @Override - public ResultEntity uploadDueDiligenceReport(List files , ReportUploadDto reportNameType) { + public ResultEntity uploadDueDiligenceReport(List files, ReportUploadDto reportNameType) { int count = 0; for (MultipartFile file : files) { @@ -91,8 +91,8 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService //一个两个做判断 - if ("尽调报告".equals(reportNameType.getReportNameType())){ - if (trainingReports.size() > 0 ) { + if ("尽调报告".equals(reportNameType.getReportNameType())) { + if (trainingReports.size() > 0) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!"); } else { //只允许提交一次 TrainingReport trainingReport = new TrainingReport(); @@ -106,16 +106,16 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService trainingReport.setStep(reportNameType.getReportNameType()); trainingReportMapper.insert(trainingReport); //(每个2分,共4分) - if ("尽调报告".equals(reportNameType.getReportNameType())){ + if ("尽调报告".equals(reportNameType.getReportNameType())) { //investmentSigningDiligenceReportScore performanceScoreService.calculateScoreByModule("investmentSigningDiligenceReportScore", 2, reportNameType.getFlowId()); + } } - } - }else if ("估值报告".equals(reportNameType.getReportNameType())){ - if (trainingReports.size() >= 2 ) { + } else if ("估值报告".equals(reportNameType.getReportNameType())) { + if (trainingReports.size() >= 2) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!"); - }else { + } else { TrainingReport trainingReport = new TrainingReport(); trainingReport.setId(IdUtil.fastSimpleUUID()); trainingReport.setFlowId(reportNameType.getFlowId()); @@ -127,8 +127,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService trainingReport.setStep(reportNameType.getReportNameType()); trainingReportMapper.insert(trainingReport); count++; - if (count == 1) - { + if (count == 1) { performanceScoreService.calculateScoreByModule("investmentSigningVlauationReportScore", 2, reportNameType.getFlowId()); } } @@ -175,12 +174,12 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService 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()); //注册地址 @@ -211,7 +210,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService investmentAgreementDto.setIncreaseCapitalShare(profitManagement.getInvestmentAmount().toString()); long v = profitManagement.getInvestmentAmount().longValue(); Long aLong = Convert.toLong(latestValuation); - Long sum = aLong+v; + Long sum = aLong + v; //增资后公司总股本 investmentAgreementDto.setTotalShareCapital(String.valueOf(sum)); @@ -230,7 +229,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService //hutool工具转换金额 String s = Convert.digitToChinese(aDouble); //第三条注册资本大写金额 - investmentAgreementDto.setRegisteredCapitalAmount(s+"人民币"); + investmentAgreementDto.setRegisteredCapitalAmount(s + "人民币"); //投资金额 BigDecimal investmentAmount = profitManagement.getInvestmentAmount(); @@ -240,8 +239,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService 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); //第三条注册资本增加至大写金额 - investmentAgreementDto.setRegisteredCapitalIncreaseAmount(s2+"人民币"); + investmentAgreementDto.setRegisteredCapitalIncreaseAmount(s2 + "人民币"); //第三条增资股份等于投资金额 investmentAgreementDto.setCapitalIncreaseShares(String.valueOf(investmentAmount)); @@ -279,7 +277,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService investmentAgreementDto.setSigningAddress(businessInfoList.get(0).getRegisteredAddress()); - return investmentAgreementDto; + return investmentAgreementDto; } @@ -289,6 +287,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService /** * 承销商新建发行申请 + * * @return */ @Override @@ -302,18 +301,16 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService issuanceInfoExample.createCriteria().andFlowIdEqualTo(issuanceInfo.getFlowId()); List issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); //查询有无第一次录入的数据 - if (issuanceInfos.size()>0) - { + if (issuanceInfos.size() > 0) { //获取上一次录入的数据和这一次录入的做对比 - String s = compareFields(issuanceInfo,issuanceInfos.get(0)); - if (!s.isEmpty()) - { + String s = compareFields(issuanceInfo, issuanceInfos.get(0)); + if (!s.isEmpty()) { issuanceInfoMapper.deleteByExample(issuanceInfoExample); - return new ResultEntity<>(HttpStatus.OK,s,"两次输入的"+s+":"+"值不同!"); + return new ResultEntity<>(HttpStatus.OK, s, "两次输入的" + s + ":" + "值不同!"); } //完成新建发行申请3分 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; //判断估值和4亿比较 //估值小于4亿的,发行总量大于等于估值的25%,估值大于4亿的,发行总量大于估值的10% - if(aLong > max){ + if (aLong > max) { - if (info/aLong >0.1) { + if (info / aLong > 0.1) { issuanceInfo.setId(IdUtil.fastSimpleUUID()); //插入数据 issuanceInfoMapper.insert(issuanceInfo); return new ResultEntity(HttpStatus.OK); - }else { + } else { return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的10%"); } - }else if (aLong < max){ - if (info/aLong >0.25) { + } else if (aLong < max) { + if (info / aLong > 0.25) { issuanceInfo.setId(IdUtil.fastSimpleUUID()); //插入数据 issuanceInfoMapper.insert(issuanceInfo); return new ResultEntity(HttpStatus.OK); - }else { + } else { return new ResultEntity(HttpStatus.BAD_REQUEST, "发行总量小于估值的25%"); } } @@ -373,7 +370,8 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService } /** - *发行参数录入基本信息 + * 发行参数录入基本信息 + * * @param flowId * @return */ @@ -433,14 +431,12 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(issuanceParameterInput.getFlowId()); List issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample); //查询有无第一次录入的数据 - if (issuanceParameterInputList.size()>0) - { + if (issuanceParameterInputList.size() > 0) { //获取上一次录入的数据和这一次录入的做对比 - String s = compareFieldsTwo(issuanceParameterInput,issuanceParameterInputList.get(0)); - if (!s.isEmpty()) - { + String s = compareFieldsTwo(issuanceParameterInput, issuanceParameterInputList.get(0)); + if (!s.isEmpty()) { issuanceParameterInputMapper.deleteByExample(issuanceParameterInputExample); - return new ResultEntity<>(HttpStatus.OK,s,"两次输入的"+s+":"+"值不同!"); + return new ResultEntity<>(HttpStatus.OK, s, "两次输入的" + s + ":" + "值不同!"); } //询价结果查询及发行参数录入2分 performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 2, issuanceParameterInput.getFlowId()); @@ -450,7 +446,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService performanceScore.setPricingIssuanceTime(new Date()); performanceScoreMapper.updateByPrimaryKey(performanceScore); - return new ResultEntity<>(HttpStatus.OK,s,"添加成功"); + return new ResultEntity<>(HttpStatus.OK, s, "添加成功"); } //第一次录入和估值做计算 else { @@ -465,6 +461,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService /** * 网下初步配售发行价格发行总量 + * * @param flowId * @return */ @@ -485,7 +482,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService // 比较两个Student对象的字段,返回不相同的字段 - public String compareFieldsTwo(IssuanceParameterInput newInfo ,IssuanceParameterInput other) { + public String compareFieldsTwo(IssuanceParameterInput newInfo, IssuanceParameterInput other) { IssuanceParameterInputExample issuanceParameterInputExample = new IssuanceParameterInputExample(); issuanceParameterInputExample.createCriteria().andFlowIdEqualTo(newInfo.getFlowId()); List issuanceParameterInputList = issuanceParameterInputMapper.selectByExample(issuanceParameterInputExample); @@ -530,8 +527,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService if (!formattedThisValue.equals(formattedOtherValue)) { differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n"); } - } - else { + } else { // 对于非浮点数,直接使用 equals 进行比较 if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); @@ -547,10 +543,8 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService } - - // 比较两个Student对象的字段,返回不相同的字段 - public String compareFields(IssuanceInfo newInfo ,IssuanceInfo other) { + public String compareFields(IssuanceInfo newInfo, IssuanceInfo other) { IssuanceInfoExample issuanceInfoExample = new IssuanceInfoExample(); issuanceInfoExample.createCriteria().andFlowIdEqualTo(other.getFlowId()); List issuanceInfos = issuanceInfoMapper.selectByExample(issuanceInfoExample); @@ -594,8 +588,7 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService if (!formattedThisValue.equals(formattedOtherValue)) { differences.append(field.getName()).append(": ").append(formattedThisValue).append(" -> ").append(formattedOtherValue).append("/n"); } - } - else { + } else { // 对于非浮点数,直接使用 equals 进行比较 if ((thisValue == null && otherValue != null) || (thisValue != null && !thisValue.equals(otherValue))) { differences.append(field.getName()).append(": ").append(thisValue).append(" -> ").append(otherValue).append("/n"); @@ -611,19 +604,13 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService } + public List getTrainingReports(String flowId, String reportName) { + TrainingReportExample trainingReportExample = new TrainingReportExample(); + trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(reportName); + return trainingReportMapper.selectByExample(trainingReportExample); + } - - - - - - public List getTrainingReports (String flowId, String reportName){ - TrainingReportExample trainingReportExample = new TrainingReportExample(); - trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(reportName); - return trainingReportMapper.selectByExample(trainingReportExample); - } - - } +} diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InvestmentReportServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InvestmentReportServiceImpl.java index 6f4a96c..273472e 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InvestmentReportServiceImpl.java +++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InvestmentReportServiceImpl.java @@ -92,7 +92,7 @@ public class InvestmentReportServiceImpl implements InvestmentReportService { @Override public List getTrainingReports(String flowId) { TrainingReportExample trainingReportExample = new TrainingReportExample(); - trainingReportExample.createCriteria().andFlowIdEqualTo(flowId); + trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(Constant.TZBG); return trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample); } diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java index 23ae5dc..29fdfcd 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java +++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java @@ -179,8 +179,8 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService BigDecimal userRemainingEarningsPreferredLp = profitDistribution.getRemainingEarningsPreferredLp();//用户/第二轮优先级LP BigDecimal rightOwnFunds = fundraising.getOwnFunds();//正确/第一轮自有资金 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); //设置可用资金 if (profitDistribution.getUserAvailableFunds().compareTo(rightAvailableFunds) == 0) { performanceScoreService.calculateScoreByModule("profitDistributionAvailablefundsScore", 1, flowId);