ソースを参照

1.债权分析报告生成开发

GouGengquan 4 ヶ月 前
コミット
47dd86a8ce

+ 0 - 5
biz-base/src/test/java/com/dayou/ExcelSimpleTests.java

@@ -1,12 +1,10 @@
 package com.dayou;
 
-import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelReader;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.read.listener.PageReadListener;
 import com.alibaba.excel.read.metadata.ReadSheet;
-import com.dayou.dto.report.cr.CRReportBaseInfoDTO;
 import com.dayou.utils.EasyExcelUtil;
 import com.dayou.utils.ExcelConvertToHtmlUtil;
 import lombok.Data;
@@ -15,16 +13,13 @@ import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.junit.jupiter.api.Test;
 
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 public class ExcelSimpleTests {
 

+ 92 - 2
domain/src/main/java/com/dayou/bo/CRReportFillBO.java

@@ -1,9 +1,11 @@
 package com.dayou.bo;
 
-import com.dayou.dto.report.cr.CRReportBaseInfoDTO;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.dayou.dto.report.cr.CRReportBaseInfoBO;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 @Data
 public class CRReportFillBO {
@@ -91,7 +93,95 @@ public class CRReportFillBO {
     /**
      * 债权分析报告基础信息
      */
-    private CRReportBaseInfoDTO reportBaseInfo;
+    private CRReportBaseInfoBO reportBaseInfo;
+
+    /**
+     * 债权汇总万元表信息
+     */
+    private List<Consolidated> consolidatedList;
+
+    @Data
+    public static class Consolidated {
+
+        /**
+         * 借款人
+         */
+        @ExcelProperty("借款人")
+        private String debtorName;
+
+        /**
+         * 债权本金余额
+         */
+        @ExcelProperty("债权本金余额")
+        private String debtPrincipalBalance;
+
+        /**
+         * 债权利息及费用
+         */
+        @ExcelProperty("债权利息及费用")
+        private String debtInterestAndFees;
+
+        /**
+         * 实现债权费用
+         */
+        @ExcelProperty("实现债权费用")
+        private String creditorRealizationExpenses;
+
+        /**
+         * 债权合计
+         */
+        @ExcelProperty("债权合计")
+        private String CRTotal;
+
+        /**
+         * 优先受偿价值
+         */
+        @ExcelProperty("优先受偿价值")
+        private String priorityClaimValue;
+
+        /**
+         * 一般受偿价值
+         */
+        @ExcelProperty("一般受偿价值")
+        private String generalClaimValue;
+
+        /**
+         * 保证受偿价值
+         */
+        @ExcelProperty("保证受偿价值")
+        private String guaranteedClaimValue;
+
+        /**
+         * 债权可回收金额
+         */
+        @ExcelProperty("债权可回收金额")
+        private String recoverableAmount;
+
+        /**
+         * 债权清算折扣率
+         */
+        @ExcelProperty("债权清算折扣率")
+        private String creditorLiquidationDiscountRate;
+
+        /**
+         * 债权清算价值
+         */
+        @ExcelProperty("债权清算价值")
+        private String creditorLiquidationValue;
+
+        /**
+         * 本金受偿率
+         */
+        @ExcelProperty("本金受偿率")
+        private String principalRecoveryRate;
+
+        /**
+         * 债权综合受偿率
+         */
+        @ExcelProperty("债权综合受偿率")
+        private String comprehensiveRecoveryRate;
+
+    }
 
 
 }

+ 92 - 1
domain/src/main/java/com/dayou/dto/report/cr/CRReportBaseInfoDTO.java

@@ -1,11 +1,12 @@
 package com.dayou.dto.report.cr;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.Data;
 
 import java.util.List;
 
 @Data
-public class CRReportBaseInfoDTO {
+public class CRReportBaseInfoBO {
 
     /**
      * 债务人
@@ -53,6 +54,16 @@ public class CRReportBaseInfoDTO {
     private List<EnterpriseGuarantor> enterpriseGuarantorList;
 
     /**
+     * 资产情况
+     */
+    private List<Asset> assetList;
+
+    /**
+     * 诉讼情况
+     */
+    private List<Lawsuit> lawsuitList;
+
+    /**
      * 委托人概况
      */
     @Data
@@ -248,4 +259,84 @@ public class CRReportBaseInfoDTO {
         private String guarantorBusinessScope;
     }
 
+    /**
+     * 资产情况
+     */
+    @Data
+    public static class Asset {
+
+        /**
+         * 序号
+         */
+        private Integer sort;
+
+        /**
+         * 类型(债务人或保证人)
+         */
+        @ExcelProperty("债务人或保证人")
+        private String type;
+
+        /**
+         * 名字
+         */
+        @ExcelProperty("企业")
+        private String name;
+
+        /**
+         * 目前状态
+         */
+        private String status;
+
+        /**
+         * 房产
+         */
+        @ExcelProperty("房产")
+        private String realEstate;
+
+        /**
+         * 土地
+         */
+        @ExcelProperty("土地")
+        private String land;
+
+        /**
+         * 车辆
+         */
+        @ExcelProperty("车辆")
+        private String car;
+
+        /**
+         * 对外投资
+         */
+        @ExcelProperty("对外投资")
+        private String investment;
+
+        /**
+         * 其他资产
+         */
+        @ExcelProperty("其他资产")
+        private String other;
+    }
+
+    @Data
+    public static class Lawsuit {
+        /**
+         * 序号
+         */
+        @ExcelProperty("序号")
+        private Integer sort;
+
+        /**
+         * 债务人或保证人
+         */
+        @ExcelProperty("债务人或保证人")
+        private String name;
+
+        /**
+         * 诉讼信息
+         */
+        @ExcelProperty("诉讼信息")
+        private String info;
+    }
+
 }

+ 10 - 1
domain/src/main/java/com/dayou/dto/report/cr/DebtorInfoStrDTO.java

@@ -7,7 +7,10 @@ import lombok.Data;
  * excel里面每一个债务人信息在一个单元格,这个类用来装读取到的所有字符串信息
  */
 @Data
-public class DebtorInfoStrDTO {
+public class DebtorInfoStrBO {
+
+    @ExcelProperty("借款人")
+    private String name;
 
     /**
      * DebtorInfo字符串(所有债务人信息在一个excel单元格中,先读出来再分割)
@@ -15,4 +18,10 @@ public class DebtorInfoStrDTO {
     @ExcelProperty("企业基本信息")
     private String infoStr;
 
+    /**
+     * 借款企业现状
+     */
+    @ExcelProperty("借款企业现状")
+    private String statusStr;
+
 }

+ 15 - 1
domain/src/main/java/com/dayou/dto/report/cr/GuarantorInfoStr.java

@@ -7,7 +7,15 @@ import lombok.Data;
  * excel里面每一个保证人人信息在一个单元格,这个类用来装读取到的所有字符串信息
  */
 @Data
-public class GuarantorInfoStr {
+public class GuarantorInfoStrBO {
+
+    /**
+     * 序号
+     */
+    private Integer sort;
+
+    @ExcelProperty("保证企业")
+    private String name;
 
     /**
      * 保证人类型(企业/自然人)
@@ -21,4 +29,10 @@ public class GuarantorInfoStr {
     @ExcelProperty("保证企业基本信息")
     private String infoStr;
 
+    /**
+     * 保证企业现状
+     */
+    @ExcelProperty("保证企业现状")
+    private String statusStr;
+
 }

+ 5 - 1
domain/src/main/java/com/dayou/enums/CRReportTmplCode.java

@@ -9,7 +9,11 @@ public enum CRReportTmplCode {
     ANALYSIS_DIGEST("ANALYSIS_DIGEST", "债权分析报告-摘要-段落模板"),
     ANALYSIS_DEBTOR("ANALYSIS_DEBTOR", "债权分析报告-债务人信息-段落模板"),
     ANALYSIS_PERSON_GUARANTOR("ANALYSIS_PERSON_GUARANTOR", "债权分析报告-自然人保证人-段落模板"),
-    ANALYSIS_ENTERPRISE_GUARANTOR("ANALYSIS_ENTERPRISE_GUARANTOR", "债权分析报告-企业保证人-段落模板");
+    ANALYSIS_ENTERPRISE_GUARANTOR("ANALYSIS_ENTERPRISE_GUARANTOR", "债权分析报告-企业保证人-段落模板"),
+    ANALYSIS_DEBTOR_ASSET("ANALYSIS_DEBTOR_ASSET", "债权分析报告-债务人资产情况-段落模板"),
+    ANALYSIS_GUARANTOR_ASSET("ANALYSIS_GUARANTOR_ASSET", "债权分析报告-保证人资产情况-段落模板"),
+    ANALYSIS_LAWSUIT("ANALYSIS_LAWSUIT", "债权分析报告-诉讼情况-段落模板"),
+    ANALYSIS_GUARANTOR_ADDITIONAL_DEBT_REPAYMENT_SOURCES("ANALYSIS_GUARANTOR_ADDITIONAL_DEBT_REPAYMENT_SOURCES", "债权分析报告-保证人补充偿债来源分析-段落模板");
 
     private String code;
 

+ 129 - 26
service/src/main/java/com/dayou/service/impl/AssetsReportServiceImpl.java

@@ -13,9 +13,9 @@ import com.dayou.bo.CRReportFillBO;
 import com.dayou.bo.EqptReportFillBO;
 import com.dayou.config.FileNetConfig;
 import com.dayou.dto.report.ReportBaseInfoDTO;
-import com.dayou.dto.report.cr.CRReportBaseInfoDTO;
-import com.dayou.dto.report.cr.DebtorInfoStrDTO;
-import com.dayou.dto.report.cr.GuarantorInfoStr;
+import com.dayou.dto.report.cr.CRReportBaseInfoBO;
+import com.dayou.dto.report.cr.DebtorInfoStrBO;
+import com.dayou.dto.report.cr.GuarantorInfoStrBO;
 import com.dayou.dto.report.equipment.EqptReportBaseInfoDTO;
 import com.dayou.entity.AssetsReport;
 import com.dayou.entity.DocumentProduction;
@@ -43,6 +43,7 @@ import java.nio.file.Paths;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 import org.springframework.transaction.annotation.Transactional;
@@ -409,22 +410,22 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
         // 获取与设置基础报告信息
         ObjectMapper objectMapper = new ObjectMapper();
         CRReportFillBO crReportFillBO = assetsReportMapper.getCRReportFillBO(reportId);
-        CRReportBaseInfoDTO crReportBaseInfoDTO = objectMapper.readValue(getReportBaseInfo(reportId), CRReportBaseInfoDTO.class);
+        CRReportBaseInfoBO crReportBaseInfoBO = objectMapper.readValue(getReportBaseInfo(reportId), CRReportBaseInfoBO.class);
         // 获取测算表
         DocumentProduction calculateDoc = documentProductionService.getDocProdByBusinessId(crReportFillBO.getProjectId(), crReportFillBO.getCalculateId());
         // 读取债务人信息
-        List<DebtorInfoStrDTO> debtorInfoStrList = new ArrayList<>();
+        List<DebtorInfoStrBO> debtorInfoStrList = new ArrayList<>();
         ExcelReader calculateReader = EasyExcel.read(fileNetConfig.getBaseDir() + calculateDoc.getDocUrl()).build();
-        ReadSheet readDebtor = EasyExcel.readSheet("2.债务人分析明细表").head(DebtorInfoStrDTO.class).registerReadListener(new PageReadListener<DebtorInfoStrDTO>(debtorInfoStrList::addAll)).headRowNumber(4).build();
+        ReadSheet readDebtor = EasyExcel.readSheet("2.债务人分析明细表").head(DebtorInfoStrBO.class).registerReadListener(new PageReadListener<DebtorInfoStrBO>(debtorInfoStrList::addAll)).headRowNumber(4).build();
         calculateReader.read(readDebtor);
         // 去掉空的数据(excel表中因为有合计行等等,所以可能读出来空行)
         debtorInfoStrList = debtorInfoStrList.stream()
                 .filter(obj -> obj.getInfoStr() != null)
                 .collect(Collectors.toList());
         // 处理债务人信息
-        List<CRReportBaseInfoDTO.DebtorInfo> debtorInfoList = new ArrayList<>();
-        for (DebtorInfoStrDTO infoStr : debtorInfoStrList) {
-            CRReportBaseInfoDTO.DebtorInfo debtorInfo = new CRReportBaseInfoDTO.DebtorInfo();
+        List<CRReportBaseInfoBO.DebtorInfo> debtorInfoList = new ArrayList<>();
+        for (DebtorInfoStrBO infoStr : debtorInfoStrList) {
+            CRReportBaseInfoBO.DebtorInfo debtorInfo = new CRReportBaseInfoBO.DebtorInfo();
             String debtorStr = infoStr.getInfoStr();
             debtorInfo.setDebtorName(debtorStr.substring(debtorStr.indexOf("公司名称:") + "公司名称:".length(), debtorStr.indexOf("\n")));
             debtorStr = debtorStr.replaceFirst("\n", "");
@@ -446,25 +447,25 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
             // 设置债务人信息
             debtorInfoList.add(debtorInfo);
         }
-        crReportBaseInfoDTO.setDebtorInfoList(debtorInfoList);
+        crReportBaseInfoBO.setDebtorInfoList(debtorInfoList);
 
-        // 读取债务人信息
-        List<GuarantorInfoStr> guarantorInfoStrList = new ArrayList<>();
-        ReadSheet readGuarantor = EasyExcel.readSheet("3.保证人分析明细表").head(GuarantorInfoStr.class).registerReadListener(new PageReadListener<GuarantorInfoStr>(guarantorInfoStrList::addAll)).headRowNumber(4).build();
+        // 读取保证人信息
+        List<GuarantorInfoStrBO> guarantorInfoStrBOList = new ArrayList<>();
+        ReadSheet readGuarantor = EasyExcel.readSheet("3.保证人分析明细表").head(GuarantorInfoStrBO.class).registerReadListener(new PageReadListener<GuarantorInfoStrBO>(guarantorInfoStrBOList::addAll)).headRowNumber(4).build();
         calculateReader.read(readGuarantor);
         // 去掉空的数据(excel表中因为有合计行等等,所以可能读出来空行)
-        guarantorInfoStrList = guarantorInfoStrList.stream()
+        guarantorInfoStrBOList = guarantorInfoStrBOList.stream()
                 .filter(obj -> obj.getInfoStr() != null)
                 .collect(Collectors.toList());
         // 处理保证人信息
-        List<CRReportBaseInfoDTO.PersonGuarantor> personGuarantorList = new ArrayList<>();
-        List<CRReportBaseInfoDTO.EnterpriseGuarantor> enterpriseGuarantorList = new ArrayList<>();
-        for (GuarantorInfoStr infoStr : guarantorInfoStrList) {
+        List<CRReportBaseInfoBO.PersonGuarantor> personGuarantorList = new ArrayList<>();
+        List<CRReportBaseInfoBO.EnterpriseGuarantor> enterpriseGuarantorList = new ArrayList<>();
+        for (GuarantorInfoStrBO infoStr : guarantorInfoStrBOList) {
             if (ObjectUtil.isNull(infoStr.getGuarantorType())) {
                 throw new BusinessException("债权测算表_3.保证人分析明细表_保证人类型有为空的行,请检查后并重新上传后再试!");
             }
             if (infoStr.getGuarantorType().equals("企业")) {
-                CRReportBaseInfoDTO.EnterpriseGuarantor enterpriseGuarantor = new CRReportBaseInfoDTO.EnterpriseGuarantor();
+                CRReportBaseInfoBO.EnterpriseGuarantor enterpriseGuarantor = new CRReportBaseInfoBO.EnterpriseGuarantor();
                 String guarantorStr = infoStr.getInfoStr();
                 enterpriseGuarantor.setGuarantorName(guarantorStr.substring(guarantorStr.indexOf("公司名称:") + "公司名称:".length(), guarantorStr.indexOf("\n")));
                 guarantorStr = guarantorStr.replaceFirst("\n", "");
@@ -486,7 +487,7 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
                 // 设置保证人信息
                 enterpriseGuarantorList.add(enterpriseGuarantor);
             } else if (infoStr.getGuarantorType().equals("自然人")) {
-                CRReportBaseInfoDTO.PersonGuarantor personGuarantor = new CRReportBaseInfoDTO.PersonGuarantor();
+                CRReportBaseInfoBO.PersonGuarantor personGuarantor = new CRReportBaseInfoBO.PersonGuarantor();
                 String guarantorStr = infoStr.getInfoStr();
                 personGuarantor.setGuarantorName(guarantorStr.substring(guarantorStr.indexOf("姓名:") + "姓名:".length(), guarantorStr.indexOf("\n")));
                 guarantorStr = guarantorStr.replaceFirst("\n", "");
@@ -500,10 +501,36 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
                 personGuarantorList.add(personGuarantor);
             }
         }
-        crReportBaseInfoDTO.setPersonGuarantorList(personGuarantorList);
-        crReportBaseInfoDTO.setEnterpriseGuarantorList(enterpriseGuarantorList);
+        crReportBaseInfoBO.setPersonGuarantorList(personGuarantorList);
+        crReportBaseInfoBO.setEnterpriseGuarantorList(enterpriseGuarantorList);
+
+        // 读取资产情况
+        List<CRReportBaseInfoBO.Asset> assetList = new ArrayList<>();
+        ReadSheet readAsset = EasyExcel.readSheet("资产情况").head(CRReportBaseInfoBO.Asset.class).registerReadListener(new PageReadListener<CRReportBaseInfoBO.Asset>(assetList::addAll)).build();
+        calculateReader.read(readAsset);
+        // 从债务人和保证人分析表中获取当前状态并设置到资产信息中
+        for (CRReportBaseInfoBO.Asset asset : assetList) {
+            if (asset.getType().equals("债务人")) {
+                Optional<DebtorInfoStrBO> optionalDebtorInfoStrBO = debtorInfoStrList.stream()
+                        .filter(obj -> obj.getName().equals(asset.getName()))
+                        .findFirst();
+                optionalDebtorInfoStrBO.ifPresent(bo -> asset.setStatus(bo.getStatusStr()));
+            } else if (asset.getType().equals("保证人")) {
+                Optional<GuarantorInfoStrBO> optionalGuarantorInfoStrBO = guarantorInfoStrBOList.stream()
+                        .filter(obj -> obj.getName().equals(asset.getName()))
+                        .findFirst();
+                optionalGuarantorInfoStrBO.ifPresent(bo -> asset.setStatus(bo.getStatusStr()));
+            }
+        }
+        crReportBaseInfoBO.setAssetList(assetList);
 
-        crReportFillBO.setReportBaseInfo(crReportBaseInfoDTO);
+        // 读取诉讼情况
+        List<CRReportBaseInfoBO.Lawsuit> lawsuitList = new ArrayList<>();
+        ReadSheet readLawsuit = EasyExcel.readSheet("诉讼情况").head(CRReportBaseInfoBO.Lawsuit.class).registerReadListener(new PageReadListener<CRReportBaseInfoBO.Lawsuit>(lawsuitList::addAll)).build();
+        calculateReader.read(readLawsuit);
+        crReportBaseInfoBO.setLawsuitList(lawsuitList);
+
+        crReportFillBO.setReportBaseInfo(crReportBaseInfoBO);
 
         // 将评估报告日转换为中文并设置到中文评估报告日中
         crReportFillBO.setChineseReportDate(DateToChinese.dateStrConvertChinese(crReportFillBO.getReportBaseInfo().getReportDate()));
@@ -539,6 +566,13 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
             crReportFillBO.setCompositeRecoveryRatio(String.valueOf(compositeRecoveryRatioDouble * 100));
         }
 
+        // 读取汇总万元表
+        List<CRReportFillBO.Consolidated> consolidatedList = new ArrayList<>();
+        ReadSheet readConsolidated = EasyExcel.readSheet("汇总万元表").head(CRReportFillBO.Consolidated.class).registerReadListener(new PageReadListener<CRReportFillBO.Consolidated>(consolidatedList::addAll)).headRowNumber(4).build();
+        calculateReader.read(readConsolidated);
+        consolidatedList.remove(consolidatedList.size() - 1);
+        crReportFillBO.setConsolidatedList(consolidatedList);
+
         // 第一步:设置封面
         // 获取封面模板
         TmplAssetReportSection coverTmpl = reportSectionMapper.getTmplByCode(ANALYSIS_COVER.getCode());
@@ -584,7 +618,7 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
         String debtorTmplPath = fileNetConfig.getBaseDir() + debtorTmpl.getSectionFileUrl() + debtorTmpl.getSectionFileName();
         // 插入时会导致先插入的排在后插入的后面,所以把顺序反转一下
         for (int i = crReportFillBO.getReportBaseInfo().getDebtorInfoList().size(); i > 0; i--) {
-            CRReportBaseInfoDTO.DebtorInfo debtorInfo = crReportFillBO.getReportBaseInfo().getDebtorInfoList().get(i - 1);
+            CRReportBaseInfoBO.DebtorInfo debtorInfo = crReportFillBO.getReportBaseInfo().getDebtorInfoList().get(i - 1);
             debtorInfo.setSort(i);
             // 读取模板文件
             byte[] debtorTmplByte = Files.readAllBytes(Paths.get(debtorTmplPath));
@@ -603,7 +637,7 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
         // 插入时会导致先插入的排在后插入的后面,所以把顺序反转一下
         int enterpriseCount = crReportFillBO.getReportBaseInfo().getEnterpriseGuarantorList().size();
         for (int i = enterpriseCount; i > 0; i--) {
-            CRReportBaseInfoDTO.EnterpriseGuarantor enterpriseGuarantor = crReportFillBO.getReportBaseInfo().getEnterpriseGuarantorList().get(i - 1);
+            CRReportBaseInfoBO.EnterpriseGuarantor enterpriseGuarantor = crReportFillBO.getReportBaseInfo().getEnterpriseGuarantorList().get(i - 1);
             enterpriseGuarantor.setSort(i);
             // 读取模板文件
             byte[] enterpriseGuarantorTmplByte = Files.readAllBytes(Paths.get(enterpriseGuarantorTmplPath));
@@ -618,8 +652,8 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
         // 自然人保证人信息模板文件位置
         String personGuarantorTmplPath = fileNetConfig.getBaseDir() + personGuarantorTmpl.getSectionFileUrl() + personGuarantorTmpl.getSectionFileName();
         // 插入时会导致先插入的排在后插入的后面,所以把顺序反转一下(企业和自然人用同一个序号排序)
-        for (int i = crReportFillBO.getReportBaseInfo().getEnterpriseGuarantorList().size() + enterpriseCount; i > enterpriseCount; i--) {
-            CRReportBaseInfoDTO.PersonGuarantor personGuarantor = crReportFillBO.getReportBaseInfo().getPersonGuarantorList().get(enterpriseCount - 1);
+        for (int i = crReportFillBO.getReportBaseInfo().getPersonGuarantorList().size() + enterpriseCount; i > enterpriseCount; i--) {
+            CRReportBaseInfoBO.PersonGuarantor personGuarantor = crReportFillBO.getReportBaseInfo().getPersonGuarantorList().get(i - enterpriseCount - 1);
             personGuarantor.setSort(i);
             // 读取模板文件
             byte[] personGuarantorTmplByte = Files.readAllBytes(Paths.get(personGuarantorTmplPath));
@@ -630,6 +664,69 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
             personGuarantorIs.close();
         }
 
+        // 设置资产情况
+        TmplAssetReportSection debtorAssetTmpl = reportSectionMapper.getTmplByCode(ANALYSIS_DEBTOR_ASSET.getCode());
+        TmplAssetReportSection guarantorAssetTmpl = reportSectionMapper.getTmplByCode(ANALYSIS_GUARANTOR_ASSET.getCode());
+        String debtorAssetTmplPath = fileNetConfig.getBaseDir() + debtorAssetTmpl.getSectionFileUrl() + debtorAssetTmpl.getSectionFileName();
+        String guarantorAssetTmplPath = fileNetConfig.getBaseDir() + guarantorAssetTmpl.getSectionFileUrl() + guarantorAssetTmpl.getSectionFileName();
+        int guarantorAssetSort = crReportFillBO.getReportBaseInfo().getPersonGuarantorList().size() + enterpriseCount;
+        for (int i = crReportFillBO.getReportBaseInfo().getAssetList().size(); i > 0; i--) {
+            CRReportBaseInfoBO.Asset asset = crReportFillBO.getReportBaseInfo().getAssetList().get(i - 1);
+            if (asset.getType().equals("债务人")) {
+                // 读取模板文件
+                byte[] debtorAssetTmplByte = Files.readAllBytes(Paths.get(debtorAssetTmplPath));
+                // 获取填充数据后的文件
+                byte[] resultDebtorAssetByte = AsposeWordUtil.fillWordDataByDomain(debtorAssetTmplByte, asset);
+                InputStream debtorAssetIs = new ByteArrayInputStream(resultDebtorAssetByte);
+                detailDoc = AsposeWordUtil.insertDocumentAfterBookMark(detailDoc, new Document(debtorAssetIs), "insertDebtorAsset", false, false);
+                debtorAssetIs.close();
+            } else if (asset.getType().equals("保证人")) {
+                asset.setSort(guarantorAssetSort);
+                // 读取模板文件
+                byte[] guarantorAssetTmplByte = Files.readAllBytes(Paths.get(guarantorAssetTmplPath));
+                // 获取填充数据后的文件
+                byte[] resultGuarantorAssetByte = AsposeWordUtil.fillWordDataByDomain(guarantorAssetTmplByte, asset);
+                InputStream guarantorAssetIs = new ByteArrayInputStream(resultGuarantorAssetByte);
+                detailDoc = AsposeWordUtil.insertDocumentAfterBookMark(detailDoc, new Document(guarantorAssetIs), "insertGuarantorAsset", false, false);
+                guarantorAssetIs.close();
+                guarantorAssetSort--;
+            }
+        }
+
+        // 获取诉讼情况信息模板
+        TmplAssetReportSection lawsuitTmpl = reportSectionMapper.getTmplByCode(ANALYSIS_LAWSUIT.getCode());
+        // 诉讼情况信息模板文件位置
+        String lawsuitTmplPath = fileNetConfig.getBaseDir() + lawsuitTmpl.getSectionFileUrl() + lawsuitTmpl.getSectionFileName();
+        // 插入时会导致先插入的排在后插入的后面,所以把顺序反转一下(企业和自然人用同一个序号排序)
+        for (int i = crReportFillBO.getReportBaseInfo().getLawsuitList().size(); i > 0; i--) {
+            CRReportBaseInfoBO.Lawsuit lawsuit = crReportFillBO.getReportBaseInfo().getLawsuitList().get(i - 1);
+            lawsuit.setSort(i);
+            // 读取模板文件
+            byte[] lawsuitTmplByte = Files.readAllBytes(Paths.get(lawsuitTmplPath));
+            // 获取填充数据后的文件
+            byte[] resultLawsuitByte = AsposeWordUtil.fillWordDataByDomain(lawsuitTmplByte, lawsuit);
+            InputStream lawsuitIs = new ByteArrayInputStream(resultLawsuitByte);
+            detailDoc = AsposeWordUtil.insertDocumentAfterBookMark(detailDoc, new Document(lawsuitIs), "insertLawsuit", false, false);
+            lawsuitIs.close();
+        }
+
+        // 获取诉讼情况信息模板
+        TmplAssetReportSection guarantorAdditionalDebtRepaymentSourcesTmpl = reportSectionMapper.getTmplByCode(ANALYSIS_GUARANTOR_ADDITIONAL_DEBT_REPAYMENT_SOURCES.getCode());
+        // 诉讼情况信息模板文件位置
+        String guarantorAdditionalDebtRepaymentSourcesPath = fileNetConfig.getBaseDir() + guarantorAdditionalDebtRepaymentSourcesTmpl.getSectionFileUrl() + guarantorAdditionalDebtRepaymentSourcesTmpl.getSectionFileName();
+        // 插入时会导致先插入的排在后插入的后面,所以把顺序反转一下(企业和自然人用同一个序号排序)
+        for (int i = guarantorInfoStrBOList.size(); i > 0; i--) {
+            GuarantorInfoStrBO guarantorInfo = guarantorInfoStrBOList.get(i - 1);
+            guarantorInfo.setSort(i);
+            // 读取模板文件
+            byte[] guarantorAdditionalDebtRepaymentSourcesTmplByte = Files.readAllBytes(Paths.get(guarantorAdditionalDebtRepaymentSourcesPath));
+            // 获取填充数据后的文件
+            byte[] resultGuarantorAdditionalDebtRepaymentSourcesByte = AsposeWordUtil.fillWordDataByDomain(guarantorAdditionalDebtRepaymentSourcesTmplByte, guarantorInfo);
+            InputStream resultGuarantorAdditionalDebtRepaymentSourcesIs = new ByteArrayInputStream(resultGuarantorAdditionalDebtRepaymentSourcesByte);
+            detailDoc = AsposeWordUtil.insertDocumentAfterBookMark(detailDoc, new Document(resultGuarantorAdditionalDebtRepaymentSourcesIs), "insertGuarantorAdditionalDebtRepaymentSo", false, false);
+            resultGuarantorAdditionalDebtRepaymentSourcesIs.close();
+        }
+
         // 第六步:设置主体框架
         // 获取框架模板
         TmplAssetReport mainTmpl = tmplAssetReportMapper.getTmplByCode(ANALYSIS_MAIN.getCode());
@@ -674,6 +771,12 @@ public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, Ass
         mainBuilder.getCurrentParagraph().remove();
         mainBuilder.moveToBookmark("insertPersonGuarantor");
         mainBuilder.getCurrentParagraph().remove();
+        mainBuilder.moveToBookmark("insertDebtorAsset");
+        mainBuilder.getCurrentParagraph().remove();
+        mainBuilder.moveToBookmark("insertGuarantorAsset");
+        mainBuilder.getCurrentParagraph().remove();
+        mainBuilder.moveToBookmark("insertLawsuit");
+        mainBuilder.getCurrentParagraph().remove();
 
         // 第八步:生成并保存文档
         // 将封面和文档进行拼接

+ 11 - 1
sql/update_sql.sql

@@ -1013,4 +1013,14 @@ ALTER TABLE assets_calculate_eqpt_data MODIFY COLUMN quantity INT(11) NULL COMME
   修改人:苟耕铨
   已更新到prod
  */
-ALTER TABLE assets_calculate_eqpt_data MODIFY COLUMN storage_location VARCHAR(255) NULL COMMENT '存放地点';
+ALTER TABLE assets_calculate_eqpt_data MODIFY COLUMN storage_location VARCHAR(255) NULL COMMENT '存放地点';
+
+/**
+  日期:2025-03-17
+  修改人:苟耕铨
+  未更新到test-env
+ */
+ALTER TABLE tmpl_asset_calculate MODIFY COLUMN tmpl_code VARCHAR(100) NULL COMMENT '模板code';
+ALTER TABLE tmpl_asset_calculate_section MODIFY COLUMN tmpl_code VARCHAR(100) NULL COMMENT '模板code';
+ALTER TABLE tmpl_asset_report MODIFY COLUMN tmpl_code VARCHAR(100) NULL COMMENT '模板code';
+ALTER TABLE tmpl_asset_report_section MODIFY COLUMN tmpl_code VARCHAR(100) NULL COMMENT '模板code';