新增相对估值法生成报告

master
yz 1 year ago
parent d274faf3e8
commit 065cf10932

@ -83,7 +83,7 @@ public class FundraisingController {
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%");
return new ResultEntity(HttpStatus.BAD_REQUEST,"新增基金募资失败,类型2,自有资金不f能超过总资金的10%");
}
if(priorityLP.divide(totalFunds,4,BigDecimal.ROUND_HALF_UP).compareTo(new BigDecimal("0.6"))<0){
performanceScoreService.calculateScoreByModule("fundraisingScore",0,flowId);

@ -376,7 +376,7 @@ public class ProjectDueDiligenceController {
Document document = new Document();
// 创建 PdfWriter 对象 第一个参数是对文档对象的引用,第二个参数是文件的实际名称,在该名称中还会给出其输出路径。
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(("output" + "." + "pdf"), CharsetUtil.UTF_8));
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(("财务尽调生成报告" + "." + "pdf"), CharsetUtil.UTF_8));
PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream());
writer.setPageEvent(new HeaderAndFooterEvent());
document.open();

@ -3,6 +3,8 @@ package com.sztzjy.fund_investment.controller;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.IdUtil;
import com.itextpdf.text.*;
import com.itextpdf.text.Font;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.*;
@ -589,4 +592,220 @@ public class ProjectValuationController {
}
@GetMapping("exportRelativeValuationPDF")
@ApiOperation("项目估值-相对估值生成报告")
@AnonymousAccess
public void exportFinanceDueDiligencePDF(HttpServletResponse response, @ApiParam("流程ID") @RequestParam String flowId,@ApiParam("传 PE/PB/PS")String method) throws IOException, DocumentException {
String projectPoolId = foundProjectMapper.selectByPrimaryKey(flowId).getProjectPoolId();
String projectPoolName = projectPoolMapper.selectByPrimaryKey(projectPoolId).getCompanyName();
Document document = new Document();
// 创建 PdfWriter 对象 第一个参数是对文档对象的引用,第二个参数是文件的实际名称,在该名称中还会给出其输出路径。
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(("相对估值报告" + "." + "pdf"), CharsetUtil.UTF_8));
PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream());
writer.setPageEvent(new HeaderAndFooterEvent());
document.open();
HeaderAndFooterEvent.tpl = writer.getDirectContent().createTemplate(500, 500);
HeaderAndFooterEvent.PAGE_NUMBER = true;//实现页眉跟页脚
HeaderAndFooterEvent.HeaderLeft = "";//左上角
HeaderAndFooterEvent.HeaderRight = "";//右上角
HeaderAndFooterEvent.FooterLeft = "";//左下角
HeaderAndFooterEvent.FooterRight = "深圳市天择教育科技有限公司";//右下角
HeaderAndFooterEvent.SetFont(BaseColor.BLACK, "宋体", 25, Font.BOLD);
//添加一个空段落来占位五个参数分别为内容对齐方式1为居中0为居左2为居右段后空行数段前空行数行间距
document.add(HeaderAndFooterEvent.AddParagraph(" ", 1, 200, 0, 1.5f));
document.add(HeaderAndFooterEvent.AddParagraph("天择投资银行业务教学系统", 1, 1.5f));
HeaderAndFooterEvent.SetFont(BaseColor.GRAY, "宋体", 18, Font.BOLD);
document.add(HeaderAndFooterEvent.AddParagraph("相对估值分析报告-"+method, 1, 1.5f));
document.newPage(); //换第二页 目录
PdfPTable table = new PdfPTable(7);
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell1= new PdfPCell(HeaderAndFooterEvent.AddParagraph("公司名称", 0, 1.5f));
cell1.setColspan(4); // 设置单元格跨两行
table.addCell(cell1);
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell2= new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectPoolName, 0, 1.5f));
cell2.setColspan(3); // 设置单元格跨两行
table.addCell(cell2);
PdfPTable pdfPTable = returnPdfPTable(table, method, flowId);
document.add(pdfPTable);
document.close();
}
public PdfPTable returnPdfPTable(PdfPTable table,String method,String flowId) {
List<String> headList=new ArrayList(); //存第一个表头
if("PE".equals(method)){
List<EduProjectValuation> projectValuationList=projectValuationService.getPE(flowId);
BigDecimal valuePerShare = projectValuationAnswerSerivce.selectByFlowIdAndMethod(flowId, method);
headList.add("公司名称");
headList.add("每股市价");
headList.add("每股收益");
headList.add("增长率");
headList.add("增长率");
headList.add("每股收益");
headList.add("每股价值");
for (int i = 0; i < headList.size(); i++) {
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(headList.get(i), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
}
for (int i = 0; i < projectValuationList.size(); i++) {
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getCompanyid(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getMarketPrice().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getEarnings().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getGrowthRate().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getGrowthRate1().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getEarnings1().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(valuePerShare.toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
}
}else if("PB".equals(method)){
List<EduProjectValuation> projectValuationList=projectValuationService.getPB(flowId);
BigDecimal valuePerShare = projectValuationAnswerSerivce.selectByFlowIdAndMethod(flowId, method);
headList.add("公司名称");
headList.add("每股市价");
headList.add("每股净资产");
headList.add("权益净利率");
headList.add("权益净利率");
headList.add("每股净资产");
headList.add("每股价值");
for (int i = 0; i < headList.size(); i++) {
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(headList.get(i), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
}
for (int i = 0; i < projectValuationList.size(); i++) {
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getCompanyid(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getMarketPrice().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getNetWorth().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getNetInterest().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getNetInterest1().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getNetWorth1().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(valuePerShare.toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
}
}else {
List<EduProjectValuation> projectValuationList=projectValuationService.getPS(flowId);
BigDecimal valuePerShare = projectValuationAnswerSerivce.selectByFlowIdAndMethod(flowId, method);
headList.add("公司名称");
headList.add("每股市价");
headList.add("每股营业收入");
headList.add("营业净利率");
headList.add("营业净利率");
headList.add("每股营业收入");
headList.add("每股价值");
for (int i = 0; i < headList.size(); i++) {
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(headList.get(i), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
}
for (int i = 0; i < projectValuationList.size(); i++) {
HeaderAndFooterEvent.SetFont(BaseColor.DARK_GRAY, "黑体", 12, Font.BOLD);
PdfPCell cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getCompanyid(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getMarketPrice().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getOperatingIncome().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getNetOperatinginterestRate().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getNetOperatinginterestRate1().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(projectValuationList.get(i).getOperatingIncome1().toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
cell_data = new PdfPCell(HeaderAndFooterEvent.AddParagraph(valuePerShare.toString(), 0, 1.5f));
cell_data.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); //垂直居中
cell_data.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);//水平居中
table.addCell(cell_data);
}
}
return table;
}
}

Loading…
Cancel
Save