Browse Source

补偿协议基本接口

qianxb 1 year ago
parent
commit
c6dc9808ff
19 changed files with 1620 additions and 4 deletions
  1. 48 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/AgreementLinkTable.java
  2. 54 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/CompensationInfo.java
  3. 25 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/vo/TableDataVO.java
  4. 20 0
      blade-service/blade-land/pom.xml
  5. 139 0
      blade-service/blade-land/src/main/java/org/springblade/land/controller/CompensationInfoController.java
  6. 1 1
      blade-service/blade-land/src/main/java/org/springblade/land/controller/PolicyInfoController.java
  7. 36 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementLinkTableMapper.java
  8. 7 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementLinkTableMapper.xml
  9. 64 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.java
  10. 47 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.xml
  11. 2 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/CropsInfoMapper.java
  12. 3 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/CropsInfoMapper.xml
  13. 42 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/IAgreementLinkTableService.java
  14. 58 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/ICompensationInfoService.java
  15. 47 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AgreementLinkTableServiceImpl.java
  16. 923 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CompensationInfoServiceImpl.java
  17. 23 1
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CropsInfoServiceImpl.java
  18. 5 1
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/LandRoleServiceImpl.java
  19. 76 1
      blade-service/blade-land/src/main/java/org/springblade/land/utils/FileUtils.java

+ 48 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/AgreementLinkTable.java

@@ -0,0 +1,48 @@
+package org.springblade.land.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2023/9/25 11:04
+ **/
+@Data
+@TableName("l_agreement_link_table")
+@EqualsAndHashCode(callSuper = true)
+public class AgreementLinkTable extends BaseEntity {
+
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+
+    @ApiModelProperty(value = "补偿协议id")
+    private Long agreementId;
+
+    @ApiModelProperty(value = "表单数据id")
+    private Long tableDataId;
+
+    @ApiModelProperty(value = "表单id")
+    private Long tableId;
+
+    @ApiModelProperty(value = "单表保存PDF")
+    private String pdfUrl;
+
+    @ApiModelProperty(value = "对应项目级id")
+    private Long privateId;
+
+    @ApiModelProperty(value = "清表id")
+    private Long excelId;
+
+    @ApiModelProperty(value = "清表htmlUrl")
+    private String htmlUrl;
+
+    @ApiModelProperty(value = "表单名字")
+    private String tableName;
+
+    @ApiModelProperty(value = "排序")
+    private Integer sort;
+}

+ 54 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/CompensationInfo.java

@@ -0,0 +1,54 @@
+package org.springblade.land.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+import java.math.BigDecimal;
+
+/**
+ * @Param   补偿协议表,几个补偿协议共用
+ * @Author wangwl
+ * @Date 2023/9/22 15:58
+ **/
+@Data
+@TableName("l_compensation_info")
+@EqualsAndHashCode(callSuper = true)
+public class CompensationInfo extends BaseEntity {
+
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+
+    @ApiModelProperty(value = "协议编号")
+    private String number;
+
+    @ApiModelProperty(value = "协议名称")
+    private String name;
+
+    @ApiModelProperty(value = "地类金额")
+    private BigDecimal landMoney;
+
+    @ApiModelProperty(value = "青苗金额")
+    private BigDecimal cropsMoney;
+
+    @ApiModelProperty(value = "补偿总额")
+    private BigDecimal allMoney;
+
+    @ApiModelProperty(value = "协议PDF路径")
+    private String mergePdfUrl;
+
+    @ApiModelProperty(value = "1征地2坟地3专项设施")
+    private Integer type;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "被拆迁单位")
+    private String removeUnit;
+
+    @ApiModelProperty(value = "区域id")
+    private Long areaId;
+
+}

+ 25 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/vo/TableDataVO.java

@@ -0,0 +1,25 @@
+package org.springblade.land.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.system.user.entity.User;
+
+import java.util.List;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2023/9/26 10:23
+ **/
+@Data
+public class TableDataVO {
+
+    @ApiModelProperty(value = "数据id")
+    private Long pKeyId;
+
+    @ApiModelProperty(value = "表单字段key")
+    private String tabKey;
+
+    @ApiModelProperty(value = "表单字段值")
+    private String tabVal;
+}

+ 20 - 0
blade-service/blade-land/pom.xml

@@ -63,6 +63,26 @@
             <version>${bladex.project.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.jsoup</groupId>
+            <artifactId>jsoup</artifactId>
+            <version>1.10.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.aspose</groupId>
+            <artifactId>aspose-cells</artifactId>
+            <version>20.4</version>
+            <scope>compile</scope>
+        </dependency>
+
     </dependencies>
 
     <properties>

+ 139 - 0
blade-service/blade-land/src/main/java/org/springblade/land/controller/CompensationInfoController.java

@@ -0,0 +1,139 @@
+package org.springblade.land.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.*;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tool.api.R;
+
+import org.springblade.land.entity.AgreementLinkTable;
+import org.springblade.land.service.ICompensationInfoService;
+import org.springblade.manager.entity.WbsTreeContract;
+import org.springblade.manager.entity.WbsTreePrivate;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.io.FileNotFoundException;
+import java.util.List;
+
+/**
+ * @author yangyj
+ * @Date 2023/2/17 10:40
+ * @description TODO
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/compensationInfo")
+@Api(value = "补偿协议", tags = "补偿协议接口")
+public class CompensationInfoController extends BladeController {
+
+    private final ICompensationInfoService compensationInfoService;
+
+    /**
+     * 新增时获取补偿协议表单
+     */
+    @GetMapping("addGetTables")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "新增获取补偿协议表单", notes = "传入项目id和协议类型1征地补偿2坟地补偿3专项设施")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
+            @ApiImplicitParam(name = "type", value = "协议类型1征地补偿2坟地补偿3专项设施", required = true)
+    })
+    public R<List<WbsTreePrivate>> addGetTables(Long projectId,Integer type){
+        return R.data(compensationInfoService.getTables(projectId,type));
+    }
+
+    /**
+     * 修改时获取补偿协议表单
+     */
+    @GetMapping("updateGetTables")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "修改获取补偿协议表单", notes = "传入协议id")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "agreementId", value = "协议id", required = true),
+    })
+    public R<List<AgreementLinkTable>> updateGetTables(Long agreementId){
+        return R.data(compensationInfoService.updateGetTables(agreementId));
+    }
+
+
+    /**
+     * 协议表单 获取html接口
+     */
+    @GetMapping("/get-excel-html_buss")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "协议表单-生成html", notes = "协议表单-生成html")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "pkeyId", value = "新增传pkeyId,编辑传id", required = true),
+            @ApiImplicitParam(name = "type", value = "新增1编辑2", required = true)
+    })
+    public R getExcelHtmlByBuss(Long pkeyId,Integer type) throws Exception {
+        return compensationInfoService.getExcelHtmlByBuss(pkeyId,type);
+    }
+
+
+    /**
+     * 协议表单 获取坐标位置
+     */
+    @GetMapping("/get-html-buss-cols")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "协议表单-获取坐标位置", notes = "协议表单-获取坐标位置")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "pkeyId", value = "当前表单pkeyId", required = true),
+            @ApiImplicitParam(name = "type", value = "新增1编辑2", required = true)
+    })
+    public R getHtmlBussCols(Long pkeyId,Integer type) throws Exception {
+        return compensationInfoService.getHtmlBussCols(pkeyId,type);
+    }
+
+    /**
+     * 协议表单获取用户保存数据
+     */
+    @GetMapping("/get-buss-dataInfo")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "协议表单-获取用户保存数据", notes = "协议表单-获取用户保存数据")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "linkId", value = "当前表单的id,新增的传null", required = true),
+    })
+    public R getBussDataInfo(Long linkId) throws FileNotFoundException {
+        return compensationInfoService.getBussDataInfo(linkId);
+    }
+
+    /**
+     * 用户保存接口
+     * @param dataInfo
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/save_buss_data")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
+            @ApiImplicitParam(name = "agreementId", value = "协议的id,新增协议为null", required = true),
+            @ApiImplicitParam(name = "linkId", value = "当前表单的id,新增协议为null", required = true),
+            @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
+            @ApiImplicitParam(name = "tableId", value = "表单的tableId", required = true),
+            @ApiImplicitParam(name = "nodeType", value = "新增有值,修改为null", required = true)
+    })
+    public R saveBussData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
+        return compensationInfoService.saveBussData(dataInfo);
+    }
+
+    @GetMapping("/get-buss-pdfInfo")
+    @ApiOperationSupport(order = 18)
+    @ApiOperation(value = "单表pdf预览", notes = "单表pdf预览")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "agreementId", value = "协议的id,新增的传null", required = true),
+            @ApiImplicitParam(name = "tableId", value = "表单的tableId", required = true)
+    })
+    public R getBussPdfDataInfo(Long agreementId,Long tableId)  {
+        return compensationInfoService.getBussPdfDataInfo(agreementId,tableId);
+    }
+
+
+
+}

+ 1 - 1
blade-service/blade-land/src/main/java/org/springblade/land/controller/PolicyInfoController.java

@@ -37,7 +37,7 @@ public class PolicyInfoController extends BladeController {
      */
     @PostMapping("/addOrUpdate")
     @ApiOperationSupport(order = 1)
-    @ApiOperation(value = "新增或修改", notes = "传入对象")
+    @ApiOperation(value = "新增或修改", notes = "传入对象,type值:1政策法规2双方协议")
     public R add(@Valid @RequestBody PolicyInfoDTO dto) throws FileNotFoundException {
         policyInfoService.add(dto);
         return R.success("操作成功");

+ 36 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementLinkTableMapper.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.land.dto.PolicyInfoSearchDTO;
+import org.springblade.land.entity.AgreementLinkTable;
+import org.springblade.land.entity.PolicyInfo;
+
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface AgreementLinkTableMapper extends BaseMapper<AgreementLinkTable> {
+
+
+}

+ 7 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementLinkTableMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.land.mapper.AgreementLinkTableMapper">
+
+
+
+</mapper>

+ 64 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.java

@@ -0,0 +1,64 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.MapKey;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.land.dto.PolicyInfoSearchDTO;
+import org.springblade.land.entity.AgreementLinkTable;
+import org.springblade.land.entity.CompensationInfo;
+import org.springblade.land.entity.PolicyInfo;
+import org.springblade.land.vo.TableDataVO;
+import org.springblade.manager.entity.ExcelTab;
+import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.manager.entity.WbsFormElement;
+import org.springblade.manager.entity.WbsTreePrivate;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface CompensationInfoMapper extends BaseMapper<CompensationInfo> {
+
+
+    List<WbsTreePrivate> getTables(@Param("projectId") Long projectId,@Param("nodeType") Integer nodeType);
+
+    WbsTreePrivate getWbsPrivateTable(@Param("pkeyId") Long pkeyId);
+
+    ProjectInfo getProjectInfo(@Param("projectId") Long projectId);
+
+    @MapKey("id")
+    List<Map<String, Object>> getBussDataInfo(@Param("linkId") Long linkId);
+
+    void deleteOldData(@Param("dataId") Long dataId);
+
+    ExcelTab getExcelTab(@Param("excelId") Long excelId);
+
+    List<WbsFormElement> getTableElement(@Param("ids") List<Long> ids);
+
+    List<TableDataVO> getBussDataInfoByDataIds(@Param("ids") List<Long> collect);
+
+    List<AgreementLinkTable> getTablesByUpdate(@Param("id") Long agreementId);
+}

+ 47 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.land.mapper.CompensationInfoMapper">
+    <delete id="deleteOldData">
+        delete from table_data_info
+        where p_key_id = (select table_data_id from l_agreement_link_table where id = #{dataId} and is_deleted = 0)
+    </delete>
+
+
+    <select id="getTables" resultType="org.springblade.manager.entity.WbsTreePrivate">
+        SELECT * FROM m_wbs_tree_private
+        WHERE project_id = #{projectId} and wbs_type = 5 and `type` = 2 and node_type = #{nodeType}
+    </select>
+    <select id="getWbsPrivateTable" resultType="org.springblade.manager.entity.WbsTreePrivate">
+        select * from m_wbs_tree_private where p_key_id = #{pkeyId}
+    </select>
+    <select id="getProjectInfo" resultType="org.springblade.manager.entity.ProjectInfo">
+        select * from m_project_info where id = #{projectId}
+    </select>
+    <select id="getBussDataInfo" resultType="java.util.Map">
+        select id,tab_key as tableKey,key_val as tableValue from table_data_info
+        where p_key_id = (select table_data_id from l_agreement_link_table where id = #{linkId} and is_deleted = 0)
+
+    </select>
+    <select id="getExcelTab" resultType="org.springblade.manager.entity.ExcelTab">
+        select * from m_excel_tab where id = #{excelId}
+    </select>
+    <select id="getTableElement" resultType="org.springblade.manager.entity.WbsFormElement">
+        select * from m_wbs_form_element
+        where is_deleted = 0 and (dynamic_dict is not null or dynamic_dict > 0) and f_id in
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
+    <select id="getBussDataInfoByDataIds" resultType="org.springblade.land.vo.TableDataVO">
+        select p_key_id as pKeyId,tab_key as tabKey,key_val as tabVal from table_data_info
+        where p_key_id in
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
+    <select id="getTablesByUpdate" resultType="org.springblade.land.entity.AgreementLinkTable">
+        select * from l_agreement_link_table where agreement_id = #{id} and is_deleted = 0
+    </select>
+
+
+</mapper>

+ 2 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/CropsInfoMapper.java

@@ -40,4 +40,6 @@ public interface CropsInfoMapper extends BaseMapper<CropsInfo> {
     IPage<CropsInfoVO> page(IPage<CropsInfoVO> iPage,@Param("info") CropsInfo info);
 
     void remove(@Param("ids") List<Long> ids);
+
+    void removeChildren(@Param("id") Long id);
 }

+ 3 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/CropsInfoMapper.xml

@@ -13,6 +13,9 @@
             #{id}
         </foreach>
     </delete>
+    <delete id="removeChildren">
+        delete from l_crops_info where parent_id = #{id}
+    </delete>
 
 
     <select id="detail" resultType="org.springblade.land.vo.CropsInfoVO">

+ 42 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/IAgreementLinkTableService.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.service;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.mp.support.Query;
+import org.springblade.land.dto.PolicyInfoDTO;
+import org.springblade.land.dto.PolicyInfoSearchDTO;
+import org.springblade.land.entity.AgreementLinkTable;
+import org.springblade.land.entity.PolicyInfo;
+
+import java.io.FileNotFoundException;
+import java.util.List;
+
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface IAgreementLinkTableService extends BaseService<AgreementLinkTable> {
+
+
+    List<AgreementLinkTable> getByAgreementId(Long id);
+}

+ 58 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/ICompensationInfoService.java

@@ -0,0 +1,58 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.service;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.land.dto.PolicyInfoDTO;
+import org.springblade.land.dto.PolicyInfoSearchDTO;
+import org.springblade.land.entity.AgreementLinkTable;
+import org.springblade.land.entity.CompensationInfo;
+import org.springblade.land.entity.PolicyInfo;
+import org.springblade.manager.entity.WbsTreePrivate;
+
+import java.io.FileNotFoundException;
+import java.util.List;
+
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface ICompensationInfoService extends BaseService<CompensationInfo> {
+
+
+    List<WbsTreePrivate> getTables(Long projectId, Integer type);
+
+    R getExcelHtmlByBuss(Long pkeyId,Integer type) throws Exception;
+
+    R getHtmlBussCols(Long pkeyId,Integer type) throws Exception;
+
+    R getBussDataInfo(Long linkId);
+
+    R saveBussData(JSONObject dataInfo) throws Exception;
+
+    R getBussPdfDataInfo(Long agreementId, Long tableId);
+
+    List<AgreementLinkTable> updateGetTables(Long agreementId);
+}

+ 47 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AgreementLinkTableServiceImpl.java

@@ -0,0 +1,47 @@
+package org.springblade.land.service.impl;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.AllArgsConstructor;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.land.dto.PolicyInfoDTO;
+import org.springblade.land.dto.PolicyInfoSearchDTO;
+import org.springblade.land.entity.AgreementLinkTable;
+import org.springblade.land.entity.AttachmentInfo;
+import org.springblade.land.entity.PolicyInfo;
+import org.springblade.land.mapper.AgreementLinkTableMapper;
+import org.springblade.land.mapper.PolicyInfoMapper;
+import org.springblade.land.service.IAgreementLinkTableService;
+import org.springblade.land.service.IAttachmentInfoService;
+import org.springblade.land.service.IPolicyInfoService;
+import org.springblade.land.utils.FileUtils;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@AllArgsConstructor
+public class AgreementLinkTableServiceImpl extends BaseServiceImpl<AgreementLinkTableMapper, AgreementLinkTable> implements IAgreementLinkTableService {
+
+
+    @Override
+    public List<AgreementLinkTable> getByAgreementId(Long id) {
+        return baseMapper.selectList(new LambdaQueryWrapper<AgreementLinkTable>()
+                            .eq(AgreementLinkTable::getAgreementId,id));
+    }
+}

+ 923 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CompensationInfoServiceImpl.java

@@ -0,0 +1,923 @@
+package org.springblade.land.service.impl;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.common.vo.DataVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.*;
+import org.springblade.land.dto.PolicyInfoDTO;
+import org.springblade.land.dto.PolicyInfoSearchDTO;
+import org.springblade.land.entity.*;
+import org.springblade.land.mapper.CompensationInfoMapper;
+import org.springblade.land.mapper.PolicyInfoMapper;
+import org.springblade.land.service.*;
+import org.springblade.land.utils.FileUtils;
+import org.springblade.land.vo.TableDataVO;
+import org.springblade.manager.entity.*;
+import org.springblade.manager.vo.AppWbsTreeContractVO;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.cache.ParamCache;
+import org.springframework.beans.BeanUtils;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
+
+import java.io.*;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+@AllArgsConstructor
+public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInfoMapper, CompensationInfo> implements ICompensationInfoService {
+
+    private final IAgreementLinkTableService linkTableService;
+
+    private final JdbcTemplate jdbcTemplate;
+
+    private DataSourceTransactionManager transactionManager1;
+
+    private final NewIOSSClient newIOSSClient;
+
+    private final IRegionTreeInfoService treeInfoService;
+
+
+    /**
+     * 获取补偿表单
+     * @param projectId
+     * @param
+     * @return
+     */
+    @Override
+    public List<WbsTreePrivate> getTables(Long projectId, Integer nodeType ) {
+        return baseMapper.getTables(projectId,nodeType);
+    }
+
+    /**
+     * 协议表单 获取html接口
+     */
+    @Override
+    public R getExcelHtmlByBuss(Long pkeyId,Integer type) throws Exception {
+        //获取表单信息
+        String fileUrl = "";
+        Long projectId = null;
+        if (type == 1) {
+            WbsTreePrivate wbsTreePrivate = baseMapper.getWbsPrivateTable(pkeyId);
+            if (wbsTreePrivate == null) {
+                return R.fail("该数据下无此节点!");
+            }
+            if (wbsTreePrivate.getHtmlUrl() == null) {
+                return R.fail("暂无表单!");
+            }
+            fileUrl = wbsTreePrivate.getHtmlUrl();
+            projectId = Long.parseLong(wbsTreePrivate.getProjectId());
+        }else if (type == 2){
+            AgreementLinkTable table = linkTableService.getById(pkeyId);
+            fileUrl = table.getHtmlUrl();
+            projectId = table.getProjectId();
+        }
+//        fileUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1704045947043971072.html";
+        InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+
+        String htmlString = IoUtil.readToString(fileInputStream);
+        htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+        htmlString = htmlString.replaceAll("title", "titlexx");
+
+
+        Document doc = Jsoup.parse(htmlString);
+        Element table = doc.select("table").first();
+        // 添加标题显示
+        ProjectInfo projectInfo = baseMapper.getProjectInfo(projectId);
+        Elements trs = table.select("tr");
+        for (int i = 1; i < 6; i++) {
+            Element tr = trs.get(i);
+            Elements tds = tr.select("td");
+            for (int j = 0; j < tds.size(); j++) {
+                Element data = tds.get(j);
+                String style = data.attr("style");
+                if (style.indexOf("font-size") >= 0) {
+                    int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
+                    if (StringUtils.isNotEmpty(data.text()) && fontsize >= 14) {
+                        trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
+                    }
+                }
+            }
+        }
+
+        fileInputStream.close();
+        return R.data(table + "");
+    }
+
+    /**
+     * 协议表单 获取坐标位置
+     */
+    @Override
+    public R getHtmlBussCols(Long pkeyId,Integer type) throws Exception {
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        //获取表单信息
+        String fileUrl = "";
+        if (type == 1) {
+            WbsTreePrivate wbsTreePrivate = baseMapper.getWbsPrivateTable(pkeyId);
+            if (wbsTreePrivate == null) {
+                return R.fail("该数据下无此节点!");
+            }
+            if (wbsTreePrivate.getHtmlUrl() == null) {
+                return R.fail("暂无表单!");
+            }
+            fileUrl = wbsTreePrivate.getHtmlUrl();
+        }else if (type == 2){
+            AgreementLinkTable table = linkTableService.getById(pkeyId);
+            fileUrl = table.getHtmlUrl();
+        }
+
+//        fileUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1704045947043971072.html";
+        File file1 = ResourceUtil.getFile(fileUrl);
+        InputStream fileInputStream = null;
+        if (file1.exists()) {
+            fileInputStream = new FileInputStream(file1);
+        } else {
+            String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
+            fileInputStream = CommonUtil.getOSSInputStream(path);
+        }
+
+
+        String htmlString = IoUtil.readToString(fileInputStream);
+        // 解析 style
+        Document doc = Jsoup.parse(htmlString);
+        Element table = doc.select("table").first();
+        Elements trs = table.select("tr");
+
+        List<List<String>> redata = new ArrayList<>();
+        for (int i = 0; i < trs.size(); i++) {
+            Element tr = trs.get(i);
+            Elements tds = tr.select("td");
+            List<String> tdList = new ArrayList<>();
+            for (int j = 0; j < tds.size(); j++) {
+                Element element = tds.get(j);
+                if (element.html().indexOf("el-tooltip") >= 0) {
+                    element = element.children().get(0);
+                }
+                if (element.children().size() >= 1) {
+                    String keyname = element.children().get(0).attr("keyname");
+                    if (StringUtils.isNotEmpty(keyname)) {
+                        tdList.add(keyname);
+                    }
+                }
+            }
+            if (tdList != null && tdList.size() >= 1) {
+                redata.add(tdList);
+            }
+        }
+
+        String[][] res = new String[redata.size()][]; // 存放转换结果的 二维数组
+        for (int i = 0; i < res.length; i++) { // 转换方法
+            res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
+        }
+        return R.data(res);
+    }
+
+    /**
+     * 协议表单获取用户保存数据
+     */
+    @Override
+    public R getBussDataInfo(Long linkId) {
+        //当前是新增没有数据
+        if (linkId == null){
+            return R.data(null);
+        }
+        Map<String, Object> reData = new HashMap<>();
+        //获取表单数据
+        List<Map<String, Object>> mapList = baseMapper.getBussDataInfo(linkId);
+        //表单没有保存过
+        if (mapList == null || mapList.size() == 0){
+            return R.data(null);
+        }
+        reData = mapList.stream().collect(
+                Collectors.toMap(map1 -> (String) map1.get("tableKey"),
+                map2 ->  map2.get("tableValue")));
+        return R.data(reData);
+    }
+
+    /**
+     * 用户保存接口
+     */
+    @Override
+    @Transactional
+    public R saveBussData(JSONObject dataInfo) throws Exception {
+        JSONArray dataArray = new JSONArray();
+        if (dataInfo.containsKey("dataInfo")) { //节点保存
+            JSONObject jsonObject = dataInfo.getJSONObject("dataInfo");
+            dataArray = jsonObject.getJSONArray("orderList");
+        } else { //单个保存
+            dataArray.add(dataInfo);
+        }
+        JSONObject tableInfo1 = dataArray.getJSONObject(0);
+        Long id = tableInfo1.getLong("agreementId");
+        Long projectId = tableInfo1.getLong("projectId");
+        Long areaId = tableInfo1.getLong("areaId");
+        Integer nodeType = tableInfo1.getInteger("nodeType");
+        Boolean isUpdate = true;
+        List<AgreementLinkTable> linkTables = new ArrayList<>();
+        //中间表tableId与dataId的映射
+        Map<Long,Long> map = new HashMap<>();
+        //中间表tableId与linkId的映射
+        Map<Long,Long> map2 = new HashMap<>();
+        if (id == null){
+            Long agreeId = SnowFlakeUtil.getId();
+            isUpdate = false;
+            //新增建立协议与表单映射,新增复制时会直接在复制接口创建
+            List<WbsTreePrivate> tables = baseMapper.getTables(projectId, nodeType);
+            linkTables = tables.stream().map(l -> {
+                AgreementLinkTable table = new AgreementLinkTable();
+                table.setTableId(Long.parseLong(l.getInitTableId()));
+                table.setProjectId(projectId);
+                table.setTableDataId(SnowFlakeUtil.getId());
+                table.setId(SnowFlakeUtil.getId());
+                table.setAgreementId(agreeId);
+                table.setPrivateId(l.getId());
+                table.setSort(l.getSort());
+                table.setExcelId(l.getExcelId());
+                table.setHtmlUrl(l.getHtmlUrl());
+                table.setTableName(l.getNodeName());
+                map.put(table.getTableId(),table.getTableDataId());
+                map2.put(table.getTableId(),table.getId());
+                return table;
+            }).collect(Collectors.toList());
+            linkTableService.saveBatch(linkTables);
+            id = agreeId;
+        }else {
+            //获取表单id与数据id的映射
+            linkTables = linkTableService.getByAgreementId(id);
+            linkTables.stream().forEach(l->map.put(l.getTableId(),l.getTableDataId()));
+        }
+        for (int i=0; i<dataArray.size();i++) {
+            JSONObject jsonObject = dataArray.getJSONObject(i);
+            if (isUpdate){
+                //是修改,就先去删除原来保存的数据
+                baseMapper.deleteOldData(jsonObject.getLong("linkId"));
+            }else {
+                //新增时没有linkId,需要手动设置
+                jsonObject.put("linkId",map2.get(jsonObject.getLong("tableId")));
+            }
+            this.SaveOneTabInfo(jsonObject);
+        }
+        //合并PDF
+        this.mergePdfs(id);
+        //地类补偿金额
+        BigDecimal b1 = new BigDecimal(0);
+        //青苗
+        BigDecimal b2 = new BigDecimal(0);
+        //地面附着物
+        BigDecimal b3 = new BigDecimal(0);
+        //计算统计值
+        List<WbsFormElement> elementList = baseMapper.getTableElement(linkTables.stream().map(l -> l.getTableId()).collect(Collectors.toList()));
+        CompensationInfo info = new CompensationInfo();
+        info.setId(id);
+        //获取当前节点名称
+        RegionTreeInfo treeInfo = treeInfoService.getById(areaId);
+        info.setNumber(treeInfo.getAreaName()+"默认编号");
+        info.setAreaId(areaId);
+        info.setProjectId(projectId);
+        info.setType(nodeType);
+        if (elementList == null || elementList.size() == 0){
+            info.setName("未找到用户名称");
+            info.setLandMoney(b1);
+            info.setCropsMoney(b2);
+            info.setAllMoney(b3);
+
+        }else {
+            //获取所有表单填报值
+            List<TableDataVO> list = baseMapper.getBussDataInfoByDataIds(linkTables.stream().map(l -> l.getTableDataId()).collect(Collectors.toList()));
+            if (list != null && list.size() > 0) {
+                //按照表单分组
+                Map<Long, List<TableDataVO>> listMap = list.stream()
+                        .collect(Collectors.groupingBy(TableDataVO::getPKeyId));
+                for (WbsFormElement element : elementList) {
+                    //获取统计字段
+                    String fId = element.getFId();
+                    String eKey = element.getEKey();
+                    Integer dict = element.getDynamicDict();
+                    Long dataId = map.get(Long.parseLong(fId));
+                    if (listMap.get(dataId) != null && listMap.get(dataId).size() > 0){
+                        //当前表单有保存数据,统计值
+                        List<TableDataVO> dataVOS = listMap.get(dataId);
+                        try {
+                            for (TableDataVO dataVO : dataVOS) {
+                                if (dataVO.getTabKey().contains(eKey)) {
+                                    if (dict.equals(1)){
+                                        b1 = b1.add(new BigDecimal(dataVO.getTabVal()));
+                                    }else if (dict.equals(2)){
+                                        b2 = b2.add(new BigDecimal(dataVO.getTabVal()));
+                                    }else if (dict.equals(3)){
+                                        b3 = b3.add(new BigDecimal(dataVO.getTabVal()));
+                                    }
+                                }
+                            }
+                        }catch (Exception e){
+                            throw new ServiceException("金额字段不能包含其他字符,请重新填写");
+                        }
+                    }
+                }
+                info.setName("默认值");
+                info.setLandMoney(b1);
+                info.setCropsMoney(b2.add(b3));
+                info.setAllMoney(info.getLandMoney().add(info.getCropsMoney()));
+            }
+        }
+        //保存协议信息
+        if (isUpdate){
+            this.updateById(info);
+        }else {
+            this.save(info);
+        }
+
+        return R.data("保存成功");
+    }
+
+    @Override
+    public R getBussPdfDataInfo(Long agreementId, Long tableId) {
+        AgreementLinkTable one = linkTableService.getOne(new LambdaQueryWrapper<AgreementLinkTable>()
+                .eq(AgreementLinkTable::getAgreementId, agreementId)
+                .eq(AgreementLinkTable::getTableDataId, tableId));
+        if (one == null){
+            throw new ServiceException("未查询到表单,请联系管理员");
+        }
+        if (StringUtils.isBlank(one.getPdfUrl())){
+            throw new ServiceException("当前表单还未生成PDF");
+        }
+        return R.data(one.getPdfUrl());
+    }
+
+    /**
+     * 修改时获取表单
+     * @param agreementId
+     * @return
+     */
+    @Override
+    public List<AgreementLinkTable> updateGetTables(Long agreementId) {
+        return baseMapper.getTablesByUpdate(agreementId);
+    }
+
+    // 保存单表
+    public void SaveOneTabInfo(JSONObject tableInfo) throws Exception {
+        System.out.println("---------="+new Date().toLocaleString());
+        Long linkId = tableInfo.getLong("linkId");
+
+        tableInfo.fluentRemove("contractId")
+                .fluentRemove("pkeyId")
+                .fluentRemove("p_key_id")
+                .fluentRemove("projectId")
+                .fluentRemove("classify")
+                .fluentRemove("pickerKey")
+                .fluentRemove("id")
+                .fluentRemove("isFirst")
+                .fluentRemove("firstNodeId")
+                .fluentRemove("isTheLog")
+                .fluentRemove("theLogId")
+                .fluentRemove("linkTabIds")
+                .fluentRemove("recordTime")
+                .fluentRemove("businessId")
+                .fluentRemove("sourceUrl")
+                .fluentRemove("pdfUrl")
+                .fluentRemove("firstFileName")
+                .fluentRemove("");
+
+        // 获取excel 对象
+        AgreementLinkTable linkTable = linkTableService.getById(linkId);
+
+        ExcelTab excelTab = baseMapper.getExcelTab(linkTable.getExcelId());
+
+        //获取excel流 和 html流
+        InputStream exceInp = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
+
+        System.out.println("---------2="+new Date().toLocaleString());
+        Workbook workbook=null;
+        int index = excelTab.getFileUrl().lastIndexOf(".");
+        String suffix = excelTab.getFileUrl().substring(index);
+
+        if (".xls".equals(suffix)) {
+            workbook = new HSSFWorkbook(exceInp);
+        } else if (".xlsx".equals(suffix)) {
+            workbook = new XSSFWorkbook(exceInp);
+        }
+        //获取工作表
+        Sheet sheet = workbook.getSheetAt(0);
+        sheet.setForceFormulaRecalculation(true);
+
+
+
+        String sqll = " insert into table_data_info (id, p_key_id, tab_key,key_val) values (?, ?, ?,?)  ";
+        List<Object[]> list = new ArrayList<>();
+
+        if (StringUtils.isNotEmpty(linkTable.getHtmlUrl())) {
+            InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(linkTable.getHtmlUrl());
+//            InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1704045947043971072.html");
+            String htmlString = IoUtil.readToString(inputStreamByUrl);
+            Document doc = Jsoup.parse(htmlString);
+            Element table = doc.select("table").first();
+            if (ObjectUtil.isNotEmpty(tableInfo)) {
+                for(String key : tableInfo.keySet()){
+                    if(key.contains("key")&&key.contains("__")){
+                        Long id = SnowFlakeUtil.getId();
+                        list.add(new Object[]{id,linkTable.getTableDataId(),key,tableInfo.getString(key)});
+
+                        Elements datas = doc.getElementsByAttributeValue("keyname", key);
+                        Element data = null;
+                        if (datas.size() >= 1) {
+                            data = datas.get(0);
+                        }
+
+                        if (data != null) {
+                            if (data.hasAttr("x1") && data.hasAttr("y1")) {
+                                int x1 = 0;
+                                int x2 = 0;
+                                int y1 = 0;
+                                int y2 = 0;
+
+                                x1 = Integer.parseInt(data.attr("x1"));
+                                y1 = Integer.parseInt(data.attr("y1"));
+
+                                if (x1 == 0) {
+                                    x1 = 1;
+                                }
+
+                                String myData = tableInfo.get(key) + "";
+                                if ((myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) || (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0)) {
+
+                                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+                                    sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
+                                    SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
+
+                                    if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
+
+                                        myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
+                                        String[] dataVal = myData.split(",");
+                                        Date Start_dataStr = new Date();
+                                        Date end_dataStr = new Date();
+                                        try {
+                                            if(myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0){
+                                                Start_dataStr = sdf.parse(dataVal[0]);
+                                                end_dataStr = sdf.parse(dataVal[1]);
+                                            }else{
+                                                Start_dataStr = formatStr.parse(dataVal[0]);
+                                                end_dataStr = formatStr.parse(dataVal[1]);
+                                            }
+                                        }catch (ParseException e){
+                                            throw new ServiceException("日期绑定错误");
+                                        }
+                                        String StartDate = formatStr.format(Start_dataStr);
+                                        String endDate = formatStr.format(end_dataStr);
+                                        if (StartDate.equals(endDate)) {
+                                            myData = StartDate;
+                                        } else {
+                                            myData = StartDate + "-" + endDate;
+                                        }
+                                    } else {
+                                        String[] dataStr = myData.split("T")[0].split("-");
+                                        if (dataStr.length == 3) {
+                                            myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
+                                        }
+                                    }
+                                }
+
+                                if (myData.indexOf("lang.String") >= 0) {
+                                    Object obj = tableInfo.get(key);
+                                    if (obj instanceof String[]) {
+                                        String[] dataDate = (String[]) obj;
+                                        if ((dataDate[0].trim()).equals((dataDate[1].trim()))) {
+                                            myData = dataDate[0];
+                                        } else {
+                                            myData = dataDate[0] + "-" + dataDate[1].trim();
+                                        }
+                                    }
+                                }
+                                if (data.tagName().equals("hc-form-checkbox-group")) {
+                                    Row row = sheet.getRow(y1 - 1);
+                                    if (row != null) {
+                                        Cell cell = row.getCell(x1 - 1);
+                                        if (cell != null || ObjectUtils.isNotEmpty(cell)) {
+                                            String exceVal = cell.getStringCellValue().replaceAll(" ", "");
+                                            //如果有□ 代表 自动生成  如果没有 代表后期添加 需要显示html 中的值
+                                            if (exceVal.indexOf("□") >= 0) {
+                                                if (myData.equals("1")) {
+                                                    short fontIndex = cell.getCellStyle().getFontIndex();
+                                                    Font fontAt = workbook.getFontAt(fontIndex);
+                                                    fontAt.setFontName("EUDC");
+                                                    cell.setCellValue(exceVal.replace("□", "\u2611"));
+                                                }
+                                            } else {
+                                                String dataJson = data.attr(":objs");
+                                                if (StringUtils.isNotEmpty(dataJson)) {
+                                                    JSONArray jsonArray = JSONArray.parseArray(dataJson);
+                                                    List<Integer> idList = Func.toIntList(myData);
+                                                    int indexx = 0;
+                                                    if (idList.get(0) >= 1) {
+                                                        indexx = idList.get(0) - 1;
+                                                    }
+
+                                                    String dataInfo = jsonArray.getJSONObject(indexx).getString("name");
+                                                    for (int inx = 1; inx < idList.size(); inx++) {
+                                                        int valIndex = idList.get(inx) - 1;
+                                                        dataInfo = dataInfo + "," + jsonArray.getJSONObject(valIndex).getString("name");
+                                                    }
+                                                    cell.setCellValue(dataInfo);
+                                                }
+                                            }
+                                        }
+                                    }
+                                } else {
+                                    Row row = sheet.getRow(y1 - 1);
+                                    if (row != null) {
+                                        Cell cell = row.getCell(x1 - 1);
+                                        if (cell != null || ObjectUtils.isNotEmpty(cell)) {
+                                            short fontIndex = cell.getCellStyle().getFontIndex();
+                                            Font fontAt = workbook.getFontAt(fontIndex);
+                                            fontAt.setFontName("EUDC");
+                                            cell.setCellValue(myData);
+                                        }
+                                        boolean wrap = Optional.ofNullable(cell).map(Cell::getCellStyle).map(CellStyle::getWrapText).orElse(true);
+                                        if (!wrap) {
+                                            cell.getCellStyle().setShrinkToFit(true);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+
+            }
+        }
+
+        TransactionStatus transactionStatus = this.beginTransaction(transactionManager1);
+        try {
+            //新增
+            jdbcTemplate.batchUpdate(sqll, list);
+            //提交事务
+            transactionManager1.commit(transactionStatus);
+        } catch (Exception e) {
+            //回滚
+            transactionManager1.rollback(transactionStatus);
+            throw new RuntimeException("字段过长,新增失败");
+        }
+
+        String file_path = FileUtils.getSysLocalFileUrl();
+
+        String pdfPath = file_path + "/pdf//" + linkId + ".pdf";
+        String excelPath = file_path + "/pdf//" + linkId + ".xlsx";
+
+        File tabPdf = ResourceUtil.getFile(pdfPath);
+        if (tabPdf.exists()) {
+            tabPdf.delete();
+        }
+
+        //输出流
+        FileOutputStream outputStream = new FileOutputStream(excelPath);
+        workbook.write(outputStream);
+        FileUtils.excelToPdf(excelPath,pdfPath);
+
+        BladeFile bladeFile = newIOSSClient.uploadFile(linkId + ".pdf", pdfPath);
+        String fileUrl = bladeFile.getLink();
+        UpdateWrapper<AgreementLinkTable> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("agreement_id", linkTable.getAgreementId());
+        updateWrapper.eq("table_data_id", linkTable.getTableDataId());
+        updateWrapper.set("pdf_url", fileUrl);
+        linkTableService.update(updateWrapper);
+        tabPdf.delete();
+        ResourceUtil.getFile(excelPath);
+        //关闭流
+        IoUtil.closeQuietly(outputStream);
+        IoUtil.closeQuietly(exceInp);
+    }
+
+    //事务
+    public TransactionStatus beginTransaction(DataSourceTransactionManager transactionManager) {
+        DefaultTransactionDefinition def = new DefaultTransactionDefinition();//事务定义类
+        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+        return transactionManager.getTransaction(def);
+    }
+
+    //合并pdf
+    public void mergePdfs(Long agreementId) throws Exception {
+        String file_path = FileUtils.getSysLocalFileUrl();
+        List<String> data = new ArrayList<>();
+        //获取协议所有的表单
+        List<AgreementLinkTable> list = linkTableService.list(new LambdaQueryWrapper<AgreementLinkTable>()
+                .eq(AgreementLinkTable::getAgreementId, agreementId));
+        for (AgreementLinkTable table : list) {
+            if (StringUtils.isNotEmpty(table.getPdfUrl())) {
+                data.add(table.getPdfUrl());
+            } else {
+                R bussPdfInfo = this.getBussPdfInfo(table.getId());
+                if (bussPdfInfo.getCode() == 200) {
+                    if (StringUtils.isNotBlank(bussPdfInfo.getData() + "")) {
+                        data.add(bussPdfInfo.getData() + "");
+                    }
+                }
+            }
+        }
+        String listPdf = file_path + "/pdf/" + agreementId + ".pdf";
+        File tabpdf2 = ResourceUtil.getFile(listPdf);
+        if (tabpdf2.exists()) {
+            tabpdf2.delete();
+        }
+        if (data.size() >= 1) {
+            //资料填报原始pdf合并
+            FileUtils.mergePdfPublicMethods(data, listPdf);
+            BladeFile bladeFile = this.newIOSSClient.uploadFile(agreementId + ".pdf", listPdf);
+            CompensationInfo info = new CompensationInfo();
+            info.setId(agreementId);
+            info.setMergePdfUrl(bladeFile.getLink());
+            this.updateById(info);
+        }
+
+    }
+
+    /**
+     * 获取单个PDF,传入映射表主键
+     * @param id
+     * @return
+     * @throws Exception
+     */
+    public R getBussPdfInfo(Long id) throws Exception {
+        String file_path = FileUtils.getSysLocalFileUrl();
+
+        AgreementLinkTable linkTable = linkTableService.getById(id);
+
+        if (linkTable == null) {
+            return R.fail("未获取到该表单的信息");
+        }
+        if (linkTable.getHtmlUrl() == null) {
+            return R.fail("htmlUrl is null");
+        }
+
+        String pdfPath = file_path + "/pdf//" + id + ".pdf";
+        String excelPath = file_path + "/pdf//" + id + ".xlsx";
+
+        File tabPdf = ResourceUtil.getFile(pdfPath);
+        if (tabPdf.exists()) {
+            tabPdf.delete();
+        }
+
+        //获取清表信息
+        ExcelTab excelTab = baseMapper.getExcelTab(linkTable.getExcelId());
+        if (excelTab == null) {
+            return R.fail("未获取到清表信息");
+        }
+
+        Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(id).getData();
+
+        //获取excel流 和 html流
+        InputStream exceInp = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
+
+        Workbook workbook=null;
+        int index = excelTab.getFileUrl().lastIndexOf(".");
+        String suffix = excelTab.getFileUrl().substring(index);
+
+        if (".xls".equals(suffix)) {
+            workbook = new HSSFWorkbook(exceInp);
+        } else if (".xlsx".equals(suffix)) {
+            workbook = new XSSFWorkbook(exceInp);
+        }
+
+        //获取工作表
+        Sheet sheet = workbook.getSheetAt(0);
+        sheet.setForceFormulaRecalculation(true);
+
+        //标题添加
+        ProjectInfo projectInfo = baseMapper.getProjectInfo(linkTable.getProjectId());
+
+        int all = 0;
+        for (int i = 0; i < 10; i++) {
+            CellRangeAddress mergedCell = sheet.getMergedRegion(i);
+            int xx = mergedCell.getNumberOfCells();
+            if (xx >= all) {
+                all = xx;
+            }
+        }
+
+        for (int i = 0; i < 10; i++) {
+            CellRangeAddress mergedCell = sheet.getMergedRegion(i);
+            int xx = mergedCell.getNumberOfCells() + 2;
+            if (xx >= all) {
+                int fisRow = mergedCell.getFirstRow();
+                int firsrCol = mergedCell.getFirstColumn();
+
+                Cell cell = sheet.getRow(fisRow).getCell(firsrCol);
+                short fontIndex = cell.getCellStyle().getFontIndex();
+
+                Font oldfontAt = workbook.getFontAt(fontIndex);
+
+                Font redFont = workbook.createFont();
+                redFont.setFontHeightInPoints(oldfontAt.getFontHeightInPoints());//设置字体大小
+                redFont.setFontName(oldfontAt.getFontName());//设置字体
+
+                CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
+                newStyle.cloneStyleFrom(cell.getCellStyle());
+                if (StringUtils.isEmpty(cell.getStringCellValue()) && fisRow <= 8) {
+
+                    String title = projectInfo.getProjectName();
+                    if (title.length() >= 30) {
+                        sheet.getRow(fisRow).setHeight((short) 900);
+                        newStyle.setWrapText(true);
+                    }
+                    redFont.setBold(true);
+                    newStyle.setFont(redFont);
+                    cell.setCellStyle(newStyle);
+                    cell.setCellValue(title);
+                    break;
+                }
+            }
+        }
+
+        //数据不为空
+        if (StringUtils.isNotEmpty(linkTable.getHtmlUrl())) {
+            InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(linkTable.getHtmlUrl());
+            String htmlString = IoUtil.readToString(inputStreamByUrl);
+
+            Document doc = Jsoup.parse(htmlString);
+            Element table = doc.select("table").first();
+            Elements trs = table.select("tr");
+            if (ObjectUtil.isNotEmpty(DataInfo)) {
+                for (String val : DataInfo.keySet()) {
+                    Elements datas = doc.getElementsByAttributeValue("keyname", val);
+                    Element data = null;
+                    if (datas.size() >= 1) {
+                        data = datas.get(0);
+                    }
+
+                    if (data != null) {
+                        if (data.hasAttr("x1") && data.hasAttr("y1")) {
+                            int x1 = 0;
+                            int x2 = 0;
+                            int y1 = 0;
+                            int y2 = 0;
+
+                            x1 = Integer.parseInt(data.attr("x1"));
+                            y1 = Integer.parseInt(data.attr("y1"));
+
+                            if (x1 == 0) {
+                                x1 = 1;
+                            }
+
+                            String myData = DataInfo.get(val) + "";
+                            if ((myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) || (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0)) {
+
+                                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+                                sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
+                                SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
+
+                                if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
+
+                                    myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
+                                    String[] dataVal = myData.split(",");
+                                    Date Start_dataStr = new Date();
+                                    Date end_dataStr = new Date();
+                                    try {
+                                        if(myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0){
+                                            Start_dataStr = sdf.parse(dataVal[0]);
+                                            end_dataStr = sdf.parse(dataVal[1]);
+                                        }else{
+                                            Start_dataStr = formatStr.parse(dataVal[0]);
+                                            end_dataStr = formatStr.parse(dataVal[1]);
+                                        }
+                                    }catch (ParseException e){
+                                        throw new ServiceException("日期绑定错误");
+                                    }
+                                    String StartDate = formatStr.format(Start_dataStr);
+                                    String endDate = formatStr.format(end_dataStr);
+                                    if (StartDate.equals(endDate)) {
+                                        myData = StartDate;
+                                    } else {
+                                        myData = StartDate + "-" + endDate;
+                                    }
+                                } else {
+                                    String[] dataStr = myData.split("T")[0].split("-");
+                                    if (dataStr.length == 3) {
+                                        myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
+                                    }
+                                }
+                            }
+
+                            if (myData.indexOf("lang.String") >= 0) {
+                                Object obj = DataInfo.get(val);
+                                if (obj instanceof String[]) {
+                                    String[] dataDate = (String[]) obj;
+                                    if ((dataDate[0].trim()).equals((dataDate[1].trim()))) {
+                                        myData = dataDate[0];
+                                    } else {
+                                        myData = dataDate[0] + "-" + dataDate[1].trim();
+                                    }
+
+                                }
+                            }
+
+                            if (data.tagName().equals("hc-form-checkbox-group")) {
+                                Row row = sheet.getRow(y1 - 1);
+                                if (row != null) {
+                                    Cell cell = row.getCell(x1 - 1);
+                                    if (cell != null || ObjectUtils.isNotEmpty(cell)) {
+                                        String exceVal = cell.getStringCellValue().replaceAll(" ", "");
+                                        //如果有□ 代表 自动生成  如果没有 代表后期添加 需要显示html 中的值
+                                        if (exceVal.indexOf("□") >= 0) {
+                                            if (myData.equals("1")) {
+                                                short fontIndex = cell.getCellStyle().getFontIndex();
+                                                Font fontAt = workbook.getFontAt(fontIndex);
+                                                fontAt.setFontName("EUDC");
+                                                cell.setCellValue(exceVal.replace("□", "\u2611"));
+                                            }
+                                        } else {
+                                            String dataJson = data.attr(":objs");
+                                            if (StringUtils.isNotEmpty(dataJson)) {
+                                                JSONArray jsonArray = JSONArray.parseArray(dataJson);
+                                                List<Integer> idList = Func.toIntList(myData);
+                                                int indexx = 0;
+                                                if (idList.get(0) >= 1) {
+                                                    indexx = idList.get(0) - 1;
+                                                }
+
+                                                String dataInfo = jsonArray.getJSONObject(indexx).getString("name");
+                                                for (int inx = 1; inx < idList.size(); inx++) {
+                                                    int valIndex = idList.get(inx) - 1;
+                                                    dataInfo = dataInfo + "," + jsonArray.getJSONObject(valIndex).getString("name");
+                                                }
+                                                cell.setCellValue(dataInfo);
+                                            }
+                                        }
+                                    }
+                                }
+                            } else {
+                                Row row = sheet.getRow(y1 - 1);
+                                if (row != null) {
+                                    Cell cell = row.getCell(x1 - 1);
+                                    if (cell != null || ObjectUtils.isNotEmpty(cell)) {
+                                        short fontIndex = cell.getCellStyle().getFontIndex();
+                                        Font fontAt = workbook.getFontAt(fontIndex);
+                                        fontAt.setFontName("EUDC");
+                                        cell.setCellValue(myData);
+                                    }
+                                    boolean wrap = Optional.ofNullable(cell).map(Cell::getCellStyle).map(CellStyle::getWrapText).orElse(true);
+                                    if (!wrap) {
+                                        cell.getCellStyle().setShrinkToFit(true);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        //输出流
+        FileOutputStream outputStream = new FileOutputStream(excelPath);
+        workbook.write(outputStream);
+        FileUtils.excelToPdf(excelPath,pdfPath);
+
+        BladeFile bladeFile = newIOSSClient.uploadFile(id + ".pdf", pdfPath);
+
+        UpdateWrapper<AgreementLinkTable> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("id", id);
+        updateWrapper.set("pdf_url", bladeFile.getLink());
+        linkTableService.update(updateWrapper);
+
+        //关闭流
+        IoUtil.closeQuietly(outputStream);
+        IoUtil.closeQuietly(exceInp);
+
+        return R.data(bladeFile.getLink());
+    }
+
+}

+ 23 - 1
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CropsInfoServiceImpl.java

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang.StringUtils;
 import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Query;
 import org.springblade.land.dto.CropsInfoDTO;
@@ -28,13 +30,21 @@ public class CropsInfoServiceImpl extends BaseServiceImpl<CropsInfoMapper, Crops
     @Override
     @Transactional
     public void addOrUpdate(CropsInfoDTO dto) {
+        if (StringUtils.isBlank(dto.getName())){
+            throw new ServiceException("请输入名称");
+        }
+
+        if (dto.getCompensationType() == null){
+            throw new ServiceException("请选择补偿性质");
+        }
+
         dto.setParentId(0L);
         Boolean isExist = true;
         if (dto.getId() == null) {
             isExist = false;
             dto.setId(SnowFlakeUtil.getId());
         }else {
-            this.remove(new LambdaQueryWrapper<CropsInfo>().eq(CropsInfo::getParentId,dto.getId()));
+            baseMapper.removeChildren(dto.getId());
         }
         CropsInfo cropsInfo = new CropsInfo();
         BeanUtils.copyProperties(dto,cropsInfo);
@@ -46,6 +56,18 @@ public class CropsInfoServiceImpl extends BaseServiceImpl<CropsInfoMapper, Crops
         List<CropsInfo> childrenList = dto.getChildrenList();
         if (childrenList != null && childrenList.size() > 0){
             for (CropsInfo info : childrenList) {
+                if (StringUtils.isBlank(info.getSpecificationName())){
+                    throw new ServiceException("请输入规格名称");
+                }
+                if (StringUtils.isBlank(info.getUnitName())){
+                    throw new ServiceException("请输入单位名称");
+                }
+                if (StringUtils.isBlank(info.getGovernmentStand())){
+                    throw new ServiceException("请输入政府补偿标准");
+                }
+                if (StringUtils.isBlank(info.getAgreementStand())){
+                    throw new ServiceException("请输入协定补偿标准");
+                }
                 info.setParentId(dto.getId());
                 info.setProjectId(dto.getProjectId());
             }

+ 5 - 1
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/LandRoleServiceImpl.java

@@ -68,7 +68,11 @@ public class LandRoleServiceImpl extends BaseServiceImpl<LandRoleMapper, LandRol
      */
     @Override
     public Long getOwnerId(Long projectId) {
-        return baseMapper.getOwnerId(projectId);
+        Long id = baseMapper.getOwnerId(projectId);
+        if (id == null){
+            throw new ServiceException("当前项目没有配置业主方,无法获取人员信息");
+        }
+        return id;
     }
 
     @Override

+ 76 - 1
blade-service/blade-land/src/main/java/org/springblade/land/utils/FileUtils.java

@@ -1,16 +1,21 @@
 package org.springblade.land.utils;
 
 
+import com.aspose.cells.SaveFormat;
 import com.itextpdf.text.Document;
 import com.itextpdf.text.pdf.PdfCopy;
 import com.itextpdf.text.pdf.PdfReader;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.tool.utils.IoUtil;
+import org.springblade.core.tool.utils.ResourceUtil;
 import org.springblade.system.cache.ParamCache;
 
-import java.io.FileOutputStream;
+import java.io.*;
 import java.util.List;
 
 @Slf4j
@@ -70,5 +75,75 @@ public class FileUtils {
         return file_path;
     }
 
+    // 获取本地 或 远程工作流ParamCache
+    public static InputStream getInputStreamByUrl(String fileUrl) throws Exception {
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+
+        File file1 = new File(fileUrl);
+        InputStream fileInputStream = null;
+        if (file1.exists()) {
+            fileInputStream = new FileInputStream(file1);
+        } else {
+            String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
+            fileInputStream = CommonUtil.getOSSInputStream(path);
+        }
+        return fileInputStream;
+    }
+
+    /**
+     * excel 转pdf
+     *
+     * @param exUrl
+     * @param pdfUrl
+     */
+    public static void excelToPdf(String exUrl, String pdfUrl) {
+
+        org.apache.poi.ss.usermodel.Workbook ss = null;
+        ByteArrayInputStream byteArrayInputStream = null;
+        InputStream pdfInput = null;
+        ByteArrayOutputStream outReport = null, bos = null;
+        try {
+            File file1 = ResourceUtil.getFile(exUrl);
+            InputStream inputStream = new FileInputStream(file1);
+            ss = WorkbookFactory.create(inputStream);
+            for (int i = 0, l = ss.getNumberOfSheets(); i < l; i++) {
+                Sheet sheet = ss.getSheetAt(i);
+                //去掉表格虚线
+                sheet.setPrintGridlines(false);
+                //设置 整个工作表为一页
+                sheet.setFitToPage(true);
+
+            }
+            outReport = new ByteArrayOutputStream();
+            ss.write(outReport);
+            byteArrayInputStream = new ByteArrayInputStream(outReport.toByteArray());
+            com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook(byteArrayInputStream);
+            File pdfFile = new File(pdfUrl);
+            if (!pdfFile.exists()) {
+                pdfFile.mkdir();
+            }
+            wb.save(pdfUrl, SaveFormat.PDF);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (bos != null) {
+                IoUtil.closeQuietly(bos);
+            }
+            if (outReport != null) {
+                IoUtil.closeQuietly(outReport);
+            }
+            if (pdfInput != null) {
+                IoUtil.closeQuietly(pdfInput);
+            }
+            if (byteArrayInputStream != null) {
+                IoUtil.closeQuietly(byteArrayInputStream);
+            }
+            if (ss != null) {
+                IoUtil.closeQuietly(ss);
+            }
+        }
+    }
+
 
 }