|
@@ -10,6 +10,7 @@ import com.github.junrar.exception.RarException;
|
|
import com.github.junrar.rarfile.FileHeader;
|
|
import com.github.junrar.rarfile.FileHeader;
|
|
import com.simuwang.base.common.conts.DateConst;
|
|
import com.simuwang.base.common.conts.DateConst;
|
|
import com.simuwang.base.common.conts.EmailDataDirectionConst;
|
|
import com.simuwang.base.common.conts.EmailDataDirectionConst;
|
|
|
|
+import com.simuwang.base.pojo.vo.*;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.pdfbox.Loader;
|
|
import org.apache.pdfbox.Loader;
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
@@ -536,4 +537,333 @@ public class ExcelUtil {
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
return localDate.format(formatter);
|
|
return localDate.format(formatter);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static HSSFWorkbook getProductHSSFWorkbook(List<ProductDataVO> productDataVOList) {
|
|
|
|
+
|
|
|
|
+ // 第一步,创建一个HSSFWorkbook,对应一个Excel文件
|
|
|
|
+ HSSFWorkbook wb = new HSSFWorkbook();
|
|
|
|
+ try {
|
|
|
|
+ createProductInfoSheet(wb,productDataVOList);
|
|
|
|
+ createProductContractSheet(wb,productDataVOList);
|
|
|
|
+ createProductDetailSheet(wb,productDataVOList);
|
|
|
|
+ createInvestmentManagerSheet(wb,productDataVOList);
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
+ logger.error(e.getMessage(),e);
|
|
|
|
+ }
|
|
|
|
+ return wb;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static void createInvestmentManagerSheet(HSSFWorkbook wb, List<ProductDataVO> productDataVOList) {
|
|
|
|
+ try{
|
|
|
|
+ HSSFSheet sheet = wb.createSheet("投资经理信息");
|
|
|
|
+ List<String> title = new ArrayList<>();
|
|
|
|
+ title.add("编号");
|
|
|
|
+ title.add("中基协基金编号");
|
|
|
|
+ title.add("投资经理任职起始时间");
|
|
|
|
+ title.add("投资经理任职结束时间");
|
|
|
|
+ title.add("投资经理");
|
|
|
|
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
|
|
|
|
+ HSSFRow row = sheet.createRow(0);
|
|
|
|
+ // 第四步,创建单元格,并设置值表头 设置表头居中
|
|
|
|
+ HSSFCellStyle style = wb.createCellStyle();
|
|
|
|
+ style.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
+ style.setWrapText(true);
|
|
|
|
+ sheet.setColumnWidth(0, 1000);
|
|
|
|
+ sheet.setColumnWidth(1, 5000);
|
|
|
|
+ sheet.setColumnWidth(2, 5000);
|
|
|
|
+ sheet.setColumnWidth(3, 8000);
|
|
|
|
+ sheet.setColumnWidth(4, 10000);
|
|
|
|
+ //声明列对象
|
|
|
|
+ HSSFCell cell = null;
|
|
|
|
+ //创建标题
|
|
|
|
+ for (int i = 0; i < title.size(); i++) {
|
|
|
|
+ cell = row.createCell(i);
|
|
|
|
+ cell.setCellValue(title.get(i));
|
|
|
|
+ cell.setCellStyle(style);
|
|
|
|
+ }
|
|
|
|
+ int count = 65500;
|
|
|
|
+ List<List<String>> values = new ArrayList<>();
|
|
|
|
+ for (ProductDataVO productDataVO : productDataVOList) {
|
|
|
|
+ List<InvestmentManagerVO> investmentManagerVOList = productDataVO.getInvestmentManagerVOList();
|
|
|
|
+ for (InvestmentManagerVO investmentManagerVO : investmentManagerVOList) {
|
|
|
|
+ List<String> valueList = new ArrayList<>();
|
|
|
|
+ valueList.add(String.valueOf(investmentManagerVO.getId()));
|
|
|
|
+ valueList.add(investmentManagerVO.getRegisterNumber());
|
|
|
|
+ valueList.add(investmentManagerVO.getStartDate());
|
|
|
|
+ valueList.add(investmentManagerVO.getEndDate());
|
|
|
|
+ valueList.add(investmentManagerVO.getManagerName());
|
|
|
|
+ values.add(valueList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //创建内容
|
|
|
|
+ for (int i = 0; i < values.size(); i++) {
|
|
|
|
+ row = sheet.createRow(i + 1);
|
|
|
|
+ for (int j = 0; j < values.get(i).size(); j++) {
|
|
|
|
+ //将内容按顺序赋给对应的列对象
|
|
|
|
+ row.createCell(j).setCellValue(values.get(i).get(j));
|
|
|
|
+ }
|
|
|
|
+ if(i > count){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static void createProductContractSheet(HSSFWorkbook wb, List<ProductDataVO> productDataVOList) {
|
|
|
|
+ try{
|
|
|
|
+ HSSFSheet sheet = wb.createSheet("产品合同信息");
|
|
|
|
+ List<String> title = new ArrayList<>();
|
|
|
|
+ title.add("编号");
|
|
|
|
+ title.add("中基协基金编号");
|
|
|
|
+ title.add("基金产品全名");
|
|
|
|
+ title.add("基金合同");
|
|
|
|
+ title.add("投资范围");
|
|
|
|
+ title.add("投资限制");
|
|
|
|
+ title.add("投资策略");
|
|
|
|
+ title.add("投资方式");
|
|
|
|
+ title.add("业绩比较基准");
|
|
|
|
+ title.add("业绩报酬计提方式");
|
|
|
|
+ title.add("备注");
|
|
|
|
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
|
|
|
|
+ HSSFRow row = sheet.createRow(0);
|
|
|
|
+ // 第四步,创建单元格,并设置值表头 设置表头居中
|
|
|
|
+ HSSFCellStyle style = wb.createCellStyle();
|
|
|
|
+ style.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
+ style.setWrapText(true);
|
|
|
|
+ sheet.setColumnWidth(0, 1000);
|
|
|
|
+ sheet.setColumnWidth(1, 5000);
|
|
|
|
+ sheet.setColumnWidth(2, 10000);
|
|
|
|
+ sheet.setColumnWidth(3, 8000);
|
|
|
|
+ sheet.setColumnWidth(4, 8000);
|
|
|
|
+ sheet.setColumnWidth(5, 5000);
|
|
|
|
+ sheet.setColumnWidth(6, 5000);
|
|
|
|
+ sheet.setColumnWidth(7, 5000);
|
|
|
|
+ sheet.setColumnWidth(8, 5000);
|
|
|
|
+ sheet.setColumnWidth(9, 5000);
|
|
|
|
+ sheet.setColumnWidth(10, 5000);
|
|
|
|
+ //声明列对象
|
|
|
|
+ HSSFCell cell = null;
|
|
|
|
+ //创建标题
|
|
|
|
+ for (int i = 0; i < title.size(); i++) {
|
|
|
|
+ cell = row.createCell(i);
|
|
|
|
+ cell.setCellValue(title.get(i));
|
|
|
|
+ cell.setCellStyle(style);
|
|
|
|
+ }
|
|
|
|
+ int count = 65500;
|
|
|
|
+ List<List<String>> values = new ArrayList<>();
|
|
|
|
+ for (ProductDataVO productDataVO : productDataVOList) {
|
|
|
|
+ ProductContractVO productContractVO = productDataVO.getProductContractVO();
|
|
|
|
+ List<String> valueList = new ArrayList<>();
|
|
|
|
+ valueList.add(String.valueOf(productContractVO.getId()));
|
|
|
|
+ valueList.add(productContractVO.getRegisterNumber());
|
|
|
|
+ valueList.add(productContractVO.getProductName());
|
|
|
|
+ valueList.add(productContractVO.getProductContract());
|
|
|
|
+ valueList.add(productContractVO.getInvestmentScope());
|
|
|
|
+ valueList.add(productContractVO.getInvestmentLimit());
|
|
|
|
+ valueList.add(productContractVO.getInvestmentStrategy());
|
|
|
|
+ valueList.add(productContractVO.getInvestmentMethod());
|
|
|
|
+ valueList.add(productContractVO.getPerformanceBasic());
|
|
|
|
+ valueList.add(productContractVO.getAccruedMethod());
|
|
|
|
+ valueList.add(productContractVO.getRemark());
|
|
|
|
+ values.add(valueList);
|
|
|
|
+ }
|
|
|
|
+ //创建内容
|
|
|
|
+ for (int i = 0; i < values.size(); i++) {
|
|
|
|
+ row = sheet.createRow(i + 1);
|
|
|
|
+ for (int j = 0; j < values.get(i).size(); j++) {
|
|
|
|
+ //将内容按顺序赋给对应的列对象
|
|
|
|
+ row.createCell(j).setCellValue(values.get(i).get(j));
|
|
|
|
+ }
|
|
|
|
+ if(i > count){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static void createProductDetailSheet(HSSFWorkbook wb, List<ProductDataVO> productDataVOList) {
|
|
|
|
+ try{
|
|
|
|
+ HSSFSheet sheet = wb.createSheet("产品其他信息");
|
|
|
|
+ List<String> title = new ArrayList<>();
|
|
|
|
+ title.add("编号");
|
|
|
|
+ title.add("中基协基金编号");
|
|
|
|
+ title.add("基金产品全名");
|
|
|
|
+ title.add("成立分红拆分清算公告");
|
|
|
|
+ title.add("复权净值");
|
|
|
|
+ title.add("产品份额");
|
|
|
|
+ title.add("产品总资产");
|
|
|
|
+ title.add("估值表");
|
|
|
|
+ title.add("投资经理投资年限起始日(即最早对外募集资金并投资之日)");
|
|
|
|
+ title.add("投资经理从业经历");
|
|
|
|
+ title.add("投资经理在管数量");
|
|
|
|
+ title.add("公司总管理规模");
|
|
|
|
+ title.add("申购/赎回费率");
|
|
|
|
+ title.add("管理人费率");
|
|
|
|
+ title.add("托管费率");
|
|
|
|
+ title.add("外包费率");
|
|
|
|
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
|
|
|
|
+ HSSFRow row = sheet.createRow(0);
|
|
|
|
+ // 第四步,创建单元格,并设置值表头 设置表头居中
|
|
|
|
+ HSSFCellStyle style = wb.createCellStyle();
|
|
|
|
+ style.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
+ style.setWrapText(true);
|
|
|
|
+ sheet.setColumnWidth(0, 1000);
|
|
|
|
+ sheet.setColumnWidth(1, 5000);
|
|
|
|
+ sheet.setColumnWidth(2, 10000);
|
|
|
|
+ sheet.setColumnWidth(3, 8000);
|
|
|
|
+ sheet.setColumnWidth(4, 8000);
|
|
|
|
+ sheet.setColumnWidth(5, 5000);
|
|
|
|
+ sheet.setColumnWidth(6, 5000);
|
|
|
|
+ sheet.setColumnWidth(7, 5000);
|
|
|
|
+ sheet.setColumnWidth(8, 15000);
|
|
|
|
+ sheet.setColumnWidth(9, 5000);
|
|
|
|
+ sheet.setColumnWidth(10, 5000);
|
|
|
|
+ sheet.setColumnWidth(11, 5000);
|
|
|
|
+ sheet.setColumnWidth(12, 5000);
|
|
|
|
+ sheet.setColumnWidth(13, 5000);
|
|
|
|
+ sheet.setColumnWidth(14, 5000);
|
|
|
|
+ sheet.setColumnWidth(15, 5000);
|
|
|
|
+ //声明列对象
|
|
|
|
+ HSSFCell cell = null;
|
|
|
|
+ //创建标题
|
|
|
|
+ for (int i = 0; i < title.size(); i++) {
|
|
|
|
+ cell = row.createCell(i);
|
|
|
|
+ cell.setCellValue(title.get(i));
|
|
|
|
+ cell.setCellStyle(style);
|
|
|
|
+ }
|
|
|
|
+ int count = 65500;
|
|
|
|
+ List<List<String>> values = new ArrayList<>();
|
|
|
|
+ for (ProductDataVO productDataVO : productDataVOList) {
|
|
|
|
+ ProductDerivativeVO productDerivativeVO = productDataVO.getProductDerivativeVO();
|
|
|
|
+ List<String> valueList = new ArrayList<>();
|
|
|
|
+ valueList.add(String.valueOf(productDerivativeVO.getId()));
|
|
|
|
+ valueList.add(productDerivativeVO.getRegisterNumber());
|
|
|
|
+ valueList.add(productDerivativeVO.getProductName());
|
|
|
|
+ valueList.add(productDerivativeVO.getDistributeReport());
|
|
|
|
+ valueList.add(productDerivativeVO.getCumulativeNav());
|
|
|
|
+ valueList.add(productDerivativeVO.getProductShare());
|
|
|
|
+ valueList.add(productDerivativeVO.getProductAsset());
|
|
|
|
+ valueList.add(productDerivativeVO.getProductValuation());
|
|
|
|
+ valueList.add(productDerivativeVO.getStartDate());
|
|
|
|
+ valueList.add(productDerivativeVO.getInvestmentManagerDesc());
|
|
|
|
+ valueList.add(productDerivativeVO.getProductCount());
|
|
|
|
+ valueList.add(productDerivativeVO.getManageAsset());
|
|
|
|
+ valueList.add(productDerivativeVO.getFeeNote());
|
|
|
|
+ valueList.add(productDerivativeVO.getManagementfeeTrust());
|
|
|
|
+ valueList.add(productDerivativeVO.getManagementfeeBank());
|
|
|
|
+ valueList.add(productDerivativeVO.getOutsourceFee());
|
|
|
|
+ values.add(valueList);
|
|
|
|
+ }
|
|
|
|
+ //创建内容
|
|
|
|
+ for (int i = 0; i < values.size(); i++) {
|
|
|
|
+ row = sheet.createRow(i + 1);
|
|
|
|
+ for (int j = 0; j < values.get(i).size(); j++) {
|
|
|
|
+ //将内容按顺序赋给对应的列对象
|
|
|
|
+ row.createCell(j).setCellValue(values.get(i).get(j));
|
|
|
|
+ }
|
|
|
|
+ if(i > count){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private static void createProductInfoSheet(HSSFWorkbook wb, List<ProductDataVO> productDataVOList) {
|
|
|
|
+ try{
|
|
|
|
+ HSSFSheet sheet = wb.createSheet("产品基本信息");
|
|
|
|
+ List<String> title = new ArrayList<>();
|
|
|
|
+ title.add("编号");
|
|
|
|
+ title.add("中基协基金编号");
|
|
|
|
+ title.add("基金产品全名");
|
|
|
|
+ title.add("成立日期");
|
|
|
|
+ title.add("清盘日期");
|
|
|
|
+ title.add("母子基金标签");
|
|
|
|
+ title.add("是否结构化产品");
|
|
|
|
+ title.add("基金一级分类");
|
|
|
|
+ title.add("基金二级分类");
|
|
|
|
+ title.add("基金三级分类");
|
|
|
|
+ title.add("投资策略变更情况说明");
|
|
|
|
+ title.add("现任投资经理");
|
|
|
|
+ title.add("任职起始日期");
|
|
|
|
+ title.add("净值数据提供频率");
|
|
|
|
+ title.add("基金资产净值提供频率");
|
|
|
|
+ title.add("定期报告");
|
|
|
|
+ title.add("备注");
|
|
|
|
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
|
|
|
|
+ HSSFRow row = sheet.createRow(0);
|
|
|
|
+ // 第四步,创建单元格,并设置值表头 设置表头居中
|
|
|
|
+ HSSFCellStyle style = wb.createCellStyle();
|
|
|
|
+ style.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
+ style.setWrapText(true);
|
|
|
|
+ sheet.setColumnWidth(0, 1000);
|
|
|
|
+ sheet.setColumnWidth(1, 5000);
|
|
|
|
+ sheet.setColumnWidth(2, 10000);
|
|
|
|
+ sheet.setColumnWidth(3, 8000);
|
|
|
|
+ sheet.setColumnWidth(4, 8000);
|
|
|
|
+ sheet.setColumnWidth(5, 5000);
|
|
|
|
+ sheet.setColumnWidth(6, 5000);
|
|
|
|
+ sheet.setColumnWidth(7, 5000);
|
|
|
|
+ sheet.setColumnWidth(8, 5000);
|
|
|
|
+ sheet.setColumnWidth(9, 5000);
|
|
|
|
+ sheet.setColumnWidth(10, 15000);
|
|
|
|
+ sheet.setColumnWidth(11, 5000);
|
|
|
|
+ sheet.setColumnWidth(12, 5000);
|
|
|
|
+ sheet.setColumnWidth(13, 5000);
|
|
|
|
+ sheet.setColumnWidth(14, 5000);
|
|
|
|
+ sheet.setColumnWidth(15, 5000);
|
|
|
|
+ sheet.setColumnWidth(16, 5000);
|
|
|
|
+ //声明列对象
|
|
|
|
+ HSSFCell cell = null;
|
|
|
|
+ //创建标题
|
|
|
|
+ for (int i = 0; i < title.size(); i++) {
|
|
|
|
+ cell = row.createCell(i);
|
|
|
|
+ cell.setCellValue(title.get(i));
|
|
|
|
+ cell.setCellStyle(style);
|
|
|
|
+ }
|
|
|
|
+ int count = 65500;
|
|
|
|
+ List<List<String>> values = new ArrayList<>();
|
|
|
|
+ for (ProductDataVO productDataVO : productDataVOList) {
|
|
|
|
+ ProductInformationVO productInformationVO = productDataVO.getProductInformationVO();
|
|
|
|
+ List<String> valueList = new ArrayList<>();
|
|
|
|
+ valueList.add(String.valueOf(productInformationVO.getId()));
|
|
|
|
+ valueList.add(productInformationVO.getRegisterNumber());
|
|
|
|
+ valueList.add(productInformationVO.getProductName());
|
|
|
|
+ valueList.add(productInformationVO.getInceptionDate());
|
|
|
|
+ valueList.add(productInformationVO.getLiquidateDate());
|
|
|
|
+ valueList.add(productInformationVO.getMsLabel());
|
|
|
|
+ valueList.add(productInformationVO.getIsStruct());
|
|
|
|
+ valueList.add(productInformationVO.getFirstStrategy());
|
|
|
|
+ valueList.add(productInformationVO.getSecondStrategy());
|
|
|
|
+ valueList.add(productInformationVO.getThirdStrategy());
|
|
|
|
+ valueList.add(productInformationVO.getInvestmentStrategyDesc());
|
|
|
|
+ valueList.add(productInformationVO.getInvestmentManager());
|
|
|
|
+ valueList.add(productInformationVO.getStartDate());
|
|
|
|
+ valueList.add(productInformationVO.getNavFrequency());
|
|
|
|
+ valueList.add(productInformationVO.getAssetFrequency());
|
|
|
|
+ valueList.add(productInformationVO.getReportFrequency());
|
|
|
|
+ valueList.add(productInformationVO.getRemark());
|
|
|
|
+ values.add(valueList);
|
|
|
|
+ }
|
|
|
|
+ //创建内容
|
|
|
|
+ for (int i = 0; i < values.size(); i++) {
|
|
|
|
+ row = sheet.createRow(i + 1);
|
|
|
|
+ for (int j = 0; j < values.get(i).size(); j++) {
|
|
|
|
+ //将内容按顺序赋给对应的列对象
|
|
|
|
+ row.createCell(j).setCellValue(values.get(i).get(j));
|
|
|
|
+ }
|
|
|
|
+ if(i > count){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|