hongchuangyanfa vor 2 Jahren
Ursprung
Commit
63cd189fea
15 geänderte Dateien mit 398 neuen und 84 gelöschten Zeilen
  1. 0 6
      blade-ops/blade-resource/pom.xml
  2. 16 3
      blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java
  3. 85 8
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  4. 95 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  5. 2 2
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java
  6. 22 27
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  7. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FirstController.java
  8. 7 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FormulaController.java
  9. 0 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java
  10. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExcelTabService.java
  11. 1 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/ITextdictInfoService.java
  12. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  13. 25 23
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  14. 63 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  15. 75 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

+ 0 - 6
blade-ops/blade-resource/pom.xml

@@ -115,12 +115,6 @@
             <artifactId>pdfbox</artifactId>
             <version>2.0.20</version>
         </dependency>
-        <dependency>
-            <groupId>org.springblade</groupId>
-            <artifactId>blade-business</artifactId>
-            <version>2.9.1.RELEASE</version>
-            <scope>compile</scope>
-        </dependency>
     </dependencies>
 
     <build>

+ 16 - 3
blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java

@@ -36,9 +36,11 @@ import org.springblade.resource.vo.NewBladeFile;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
-import org.springblade.business.utils.FileUtils;
-
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.util.Objects;
 
 /**
@@ -183,7 +185,18 @@ public class OssEndpoint {
 		//压缩文件大小
 		while (bytes.length > targetSize) {
 			float reduceMultiple = 0.5f;
-			bytes = FileUtils.resizeImage2(bytes, reduceMultiple);
+			BufferedImage bi = ImageIO.read(new ByteArrayInputStream(bytes));
+			int width = (int) (bi.getWidth() * reduceMultiple);
+			int height = (int) (bi.getHeight() * reduceMultiple);
+			Image image = bi.getScaledInstance(width, height, Image.SCALE_SMOOTH);
+			BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+			Graphics g = tag.getGraphics();
+			g.setColor(Color.RED);
+			g.drawImage(image, 0, 0, null);
+			g.dispose();
+			ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+			ImageIO.write(tag, "JPEG", bOut);
+			bytes =bOut.toByteArray();
 		}
 		ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
 		//上传文件

+ 85 - 8
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -27,8 +27,10 @@ import org.springblade.business.socket.WebSocket;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.*;
 import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.constant.LauncherConstant;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
@@ -50,8 +52,14 @@ import org.springblade.system.cache.ParamCache;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springframework.beans.BeanUtils;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.cache.annotation.Caching;
+import org.springframework.data.redis.core.RedisConnectionUtils;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springblade.core.boot.ctrl.BladeController;
@@ -60,6 +68,8 @@ import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
+
 /**
  * 资料填报及查询控制器
  *
@@ -110,6 +120,8 @@ public class InformationWriteQueryController extends BladeController {
 
     private final ITreeContractFirstService treeContractFirstService;
 
+    private static final String CONTRACT_CACHE_WBSTREE = "contract:wbstree:";
+
     /**
      * 获取文件题名
      */
@@ -1857,9 +1869,9 @@ public class InformationWriteQueryController extends BladeController {
 
         if (queryProcess != null && queryProcess.size() > 0) {
             //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
-            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus())).collect(Collectors.toList());
+            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
             //
-            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus())).collect(Collectors.toList());
+            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
             if (approvalList.size() > 0 || runTaskList.size() > 0) {
                 //说明存在已经审批或已经上报的节点,不允许删除
                 return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
@@ -2389,7 +2401,25 @@ public class InformationWriteQueryController extends BladeController {
         if (StringUtils.isNotEmpty(primaryKeyId)) {
             parentId = primaryKeyId;
         }
-        return R.data(this.queryContractTree(parentId, contractId, contractIdRelation, classifyType));
+        String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
+        queryContractWbsTreeByContractIdAndType2(primaryKeyId,parentId,contractId,contractIdRelation,classifyType);
+        List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = CacheUtil.get(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, List.class);
+        if (wbsTreeContractTreeVOS == null) {
+            wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
+            CacheUtil.put(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, wbsTreeContractTreeVOS);
+        }
+        return R.data(wbsTreeContractTreeVOS);
+    }
+
+    @Async
+    public void queryContractWbsTreeByContractIdAndType2(String primaryKeyId,
+                                                                                   String parentId,
+                                                                                   String contractId,
+                                                                                   String contractIdRelation,
+                                                                                   String classifyType) {
+        String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
+        List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
+            CacheUtil.put(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, wbsTreeContractTreeVOS);
     }
 
     /**
@@ -2441,6 +2471,7 @@ public class InformationWriteQueryController extends BladeController {
         return R.data(rootTreeNode);
     }
 
+
     /**
      * 查询合同段划分树公共代码
      */
@@ -2454,17 +2485,64 @@ public class InformationWriteQueryController extends BladeController {
             //监理/业主合同段,需要获取关联的施工方合同段根节点数据
             List<String> contractIds = new ArrayList<>();
             if (StringUtils.isEmpty(parentId)) {
+                // 获取 有几个合同段主键Id
                 contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
             } else {
                 contractIds.add(contractIdRelation);
             }
             if (contractIds.size() > 0) {
-
                 //监理复制加载树问题
                 if (StringUtils.isEmpty(classifyType)) {
                     classifyType = "2";
                 }
+                if (StringUtils.isNotEmpty(parentId)) {
+                    //子节点
+                    rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
+                } else {
+                    //根节点
+                    rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, "0", Integer.parseInt(classifyType));
+                    //设置根节点数量统计
+                    for (WbsTreeContractTreeVOS root : rootTreeNode) {
+                        List<WbsTreeContractTreeVOS> rootZi = this.informationQueryService.queryContractTreeSupervision(Func.toStrList(root.getContractIdRelation()), root.getId().toString(), Integer.parseInt(classifyType));
+                        List<Long> collect = rootZi.stream().map(WbsTreeContractTreeVOS::getSubmitCounts).collect(Collectors.toList());
+                        Long reduce = collect.stream().reduce(0L, Long::sum);
+                        root.setSubmitCounts(reduce);
+                    }
+                }
+            } else {
+                rootTreeNode = new ArrayList<>();
+            }
+        } else {
+            //施工合同段
+            rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
+        }
+        return rootTreeNode;
+    }
+ /*
+    *//**
+     * 查询合同段划分树公共代码
+     *//*
+    private List<WbsTreeContractTreeVOS> queryContractTree(String parentId, String contractId, String contractIdRelation, String classifyType) {
+        List<WbsTreeContractTreeVOS> rootTreeNode;
 
+        //获取合同段,检查是否是监理合同段
+        ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
+
+        if (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) {
+            //监理/业主合同段,需要获取关联的施工方合同段根节点数据
+            List<String> contractIds = new ArrayList<>();
+            if (StringUtils.isEmpty(parentId)) {
+                // 获取 有几个合同段主键Id
+                contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
+            } else {
+                contractIds.add(contractIdRelation);
+            }
+            if (contractIds.size() > 0) {
+
+                //监理复制加载树问题
+                if (StringUtils.isEmpty(classifyType)) {
+                    classifyType = "2";
+                }
                 if (StringUtils.isNotEmpty(parentId)) {
                     //子节点
                     rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
@@ -2480,7 +2558,6 @@ public class InformationWriteQueryController extends BladeController {
                         root.setSubmitCounts(reduce);
                     }
                 }
-
             } else {
                 rootTreeNode = new ArrayList<>();
             }
@@ -2488,14 +2565,14 @@ public class InformationWriteQueryController extends BladeController {
         } else {
             //施工合同段
             rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
-            rootTreeNode.stream().forEach(rtn->{
+            *//*rootTreeNode.stream().forEach(rtn->{
                 if (rtn.getSubmitCounts() > 0L && rtn.getColorStatus() <= 1 && rtn.getNotExsitChild() == false){
                     rtn.setColorStatus(2);
                 }
-            });
+            });*//*
         }
 
         return rootTreeNode;
     }
-
+*/
 }

+ 95 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -86,6 +86,99 @@
             where p_key_id = #{item.pKeyId}
         </foreach>
     </update>
+<!--
+    <select id="queryContractTreeSupervision" resultMap="queryContractTreeMap">
+        SELECT c.*,
+        CASE
+        WHEN c.allCount = c.savaCont THEN 2
+        WHEN c.allCount = c.submitCounts THEN 3
+        WHEN c.allCount = c.appCount THEN 4
+        WHEN c.savaCont &gt;=1 or c.submitCounts &gt;=1 or c.appCount &gt;=1 THEN 2
+        ELSE 1 END AS colorStatus
+        from (
+        SELECT
+        wtc.is_concealed_works_node AS "isConcealedWorksNode",
+        wtc.p_key_id AS primaryKeyId,
+        wtc.id,
+        CASE wtc.parent_id WHEN 0 THEN (select ci.contract_name from m_contract_info AS ci where wtc.contract_id = ci.id) ELSE IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name),wtc.node_name) END AS title,
+        wtc.parent_id AS parentId,
+        wtc.partition_code AS partitionCode,
+        wtc.contract_id AS contractId,
+        wtc.old_id AS oldId,
+        wtc.major_data_type AS majorDataType,
+        wtc.node_type AS `type`,
+        wtc.node_type AS nodeType,
+        CASE wtc.node_type WHEN 6 THEN 'true' ELSE 'false' END AS leaf,
+        CASE (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id = wtc.contract_id and tc.type = 1 and tc.is_deleted = 0 and tc.node_type != 111)
+        WHEN 0 THEN 'true' ELSE 'false' END AS notExsitChild,
+        ctd.file_url AS fileUrl,
+        ctd.id AS drawingsId,
+        CASE (select count(tcf.id) from u_tree_contract_first AS tcf where tcf.is_deleted = 0 and tcf.wbs_node_id = wtc.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,
+        (SELECT count(1) from m_wbs_tree_contract where id in(SELECT parent_id from m_wbs_tree_contract a where a.contract_id=#{contractId} and a.is_deleted=0 and a.type=2 and table_owner in(1,2,3)
+        ) and contract_id=wtc.contract_id and type =1 and is_deleted=0 and FIND_IN_SET(wtc.id,ancestors)) as allCount,
+        (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=0 and b.classify=1) as savaCont,
+        (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=1 and b.classify=1) as submitCounts,
+        (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=2 and b.classify=1) as appCount
+        FROM
+        m_wbs_tree_contract AS wtc
+        LEFT JOIN u_contract_tree_drawings AS ctd ON ctd.is_deleted = 0 and ctd.process_id = wtc.p_key_id
+        WHERE wtc.type = 1
+        AND wtc.is_deleted= 0
+        AND wtc.node_type != 111
+        AND wtc.parent_id = #{parentId}
+        and wtc.contract_id IN
+        <foreach collection="contractIds" item="contractId" open="(" separator="," close=")">
+            #{contractId}
+        </foreach>
+        ORDER BY wtc.sort,wtc.create_time
+        ) c
+    </select>
+
+
+    <select id="queryContractTree" resultMap="queryContractTreeMap">
+        SELECT c.*,
+               CASE
+                   WHEN c.allCount = c.savaCont THEN 2
+                   WHEN c.allCount = c.submitCount THEN 3
+                   WHEN c.allCount = c.appCount THEN 4
+                   WHEN c.savaCont>=1 or c.submitCount>=1 or c.appCount>=1 THEN 2
+                   ELSE 1 END AS colorStatus
+        from (
+                 SELECT
+                     wtc.is_concealed_works_node AS "isConcealedWorksNode",
+                     wtc.p_key_id AS primaryKeyId,
+                     wtc.id,
+                     CASE wtc.parent_id WHEN 0 THEN (select ci.contract_name from m_contract_info AS ci where wtc.contract_id = ci.id) ELSE IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name),wtc.node_name) END AS title,
+                     wtc.parent_id AS parentId,
+                     wtc.partition_code AS partitionCode,
+                     wtc.contract_id AS contractId,
+                     wtc.old_id AS oldId,
+                     wtc.major_data_type AS majorDataType,
+                     wtc.node_type AS `type`,
+                     wtc.node_type AS nodeType,
+                     CASE wtc.node_type WHEN 6 THEN 'true' ELSE 'false' END AS leaf,
+                     CASE (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id =wtc.contract_id and tc.type = 1 and tc.is_deleted = 0 and tc.node_type != 111)
+            WHEN 0 THEN 'true' ELSE 'false' END AS notExsitChild,
+        ctd.file_url AS fileUrl,
+        ctd.id AS drawingsId,
+        CASE (select count(tcf.id) from u_tree_contract_first AS tcf where tcf.is_deleted = 0 and tcf.wbs_node_id = wtc.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,
+			 (SELECT count(1) from m_wbs_tree_contract where id in(SELECT parent_id from m_wbs_tree_contract a where a.is_deleted=0 and a.type=2 and table_owner in(1,2,3)
+				) and contract_id=wtc.contract_id and type =1 and is_deleted=0 and FIND_IN_SET(wtc.id,ancestors)) as allCount,
+			 (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=0 and b.classify=1) as savaCont,
+			 (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=1 and b.classify=1) as submitCount,
+			 (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=2 and b.classify=1) as appCount
+				FROM
+        m_wbs_tree_contract AS wtc
+        LEFT JOIN u_contract_tree_drawings AS ctd ON ctd.is_deleted = 0 and ctd.process_id = wtc.p_key_id
+        WHERE wtc.type = 1
+        AND wtc.is_deleted= 0
+        AND wtc.node_type != 111
+        AND wtc.parent_id = #{parentId}
+        AND wtc.contract_id = #{contractId}
+        ORDER BY wtc.sort,wtc.create_time
+		) c
+    </select>-->
+
 
     <select id="queryContractTreeSupervision" resultMap="queryContractTreeMap">
         SELECT
@@ -177,7 +270,7 @@
         ORDER BY wtc.sort,wtc.create_time
     </select>
 
-    <select id="queryContractTree" resultMap="queryContractTreeMap">
+ <select id="queryContractTree" resultMap="queryContractTreeMap">
         SELECT
             wtc.is_concealed_works_node AS "isConcealedWorksNode",
             wtc.p_key_id AS primaryKeyId,
@@ -254,6 +347,7 @@
                 group by wtc.p_key_id
             ) AS querys
         ) AS querys ON wtc.p_key_id = querys.pKeyId
+
         WHERE wtc.type = 1
         AND wtc.is_deleted= 0
         AND wtc.node_type != 111

+ 2 - 2
blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java

@@ -2796,14 +2796,14 @@ public class CustomFunction {
 		return "";
 	}
 
-	public static void main(String[] args) {
+/*	public static void main(String[] args) {
 	     Map<String,Object> map =new HashMap<>();
 	     map.put("A","13.3*13.6");
 		map.put("B","13.5*13.5");
 		Expression.parse("A-B").calculate(map);
 		System.out.println();
 
-	}
+	}*/
 
 
 }

+ 22 - 27
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -1,6 +1,5 @@
 package org.springblade.manager.controller;
 
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -10,8 +9,10 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-
-import com.spire.xls.*;
+import com.spire.xls.CellRange;
+import com.spire.xls.ExcelPicture;
+import com.spire.xls.Workbook;
+import com.spire.xls.Worksheet;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
@@ -24,8 +25,6 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
-import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
-import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.vo.SaveContractLogVO;
@@ -34,8 +33,9 @@ import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.MathUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.boot.ctrl.BladeController;
-import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -44,7 +44,6 @@ import org.springblade.core.tool.constant.BladeConstant;
 import org.springblade.core.tool.utils.*;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.entity.*;
-import org.springblade.manager.excel.WbsFormElementBatchExcel;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.service.*;
 import org.springblade.manager.utils.FileUtils;
@@ -57,32 +56,23 @@ import org.springblade.resource.feign.IOSSClient;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.resource.vo.NewBladeFile;
 import org.springblade.system.cache.ParamCache;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
-import org.springblade.core.mp.support.Query;
-import org.springblade.core.log.exception.ServiceException;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.net.URLEncoder;
-import java.util.*;
 import java.util.List;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
-import static com.baomidou.mybatisplus.core.toolkit.Wrappers.lambdaQuery;
-import static com.baomidou.mybatisplus.core.toolkit.Wrappers.query;
-
 
 /**
  * 清表基础数据表 控制器
@@ -1358,7 +1348,7 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
     public R getBussDataInfo(Long pkeyId) throws FileNotFoundException {
-        return excelTabService.getBussDataInfo(pkeyId);
+        return excelTabService.getBussDataInfo(pkeyId,0);
     }
 
 
@@ -1382,20 +1372,19 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
     public R copeBussTab(Long pkeyId) {
-        WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
+        WbsTreeContract wbsInfo = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
         List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda()
-                .eq(WbsTreeContract::getId, wbsTreeContract.getId())
-                .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId())
-                .eq(WbsTreeContract::getParentId, wbsTreeContract.getParentId()));
+                .eq(WbsTreeContract::getId, wbsInfo.getId())
+                .eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
+                .eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
         List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
         long tabGroupId = SnowFlakeUtil.getId();
-        // 添加所有
-        wbsTreeContractList2.forEach(WbsTreeContract -> WbsTreeContract.setTabGroupId(tabGroupId));
-
 
         long newPkId = SnowFlakeUtil.getId();
+        WbsTreeContract wbsTreeContract = new WbsTreeContract();
+        BeanUtil.copy(wbsInfo,wbsTreeContract);
         wbsTreeContract.setPKeyId(newPkId);
         wbsTreeContract.setCreateTime(new Date());
         wbsTreeContract.setTabGroupId(tabGroupId);
@@ -1424,8 +1413,14 @@ public class ExcelTabController extends BladeController {
 
         String querySql = "insert into " + tabName + " (id,p_key_id," + colkeys + ") select '" + newPkId + "','" + newPkId + "'," + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
         jdbcTemplate.execute(querySql);
-        wbsTreeContractService.saveBatch(wbsTreeContractList2);
         wbsTreeContractService.save(wbsTreeContract);
+        for(WbsTreeContract wbsTreeCont:wbsTreeContractList2){
+
+            UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.in("p_key_id", wbsTreeCont.getPKeyId() + "");
+            updateWrapper.set("tab_group_id", tabGroupId);
+            wbsTreeContractService.update(updateWrapper);
+        }
         return R.data("成功");
     }
 
@@ -1641,7 +1636,7 @@ public class ExcelTabController extends BladeController {
             );
             if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
                 for (WbsTreeContract data : wbsTreeContractList) {
-                    R bussDataInfo = this.getBussDataInfo(data.getPKeyId());
+                    R bussDataInfo = this.excelTabService.getBussDataInfo(data.getPKeyId(),1);
                     Object data1 = bussDataInfo.getData();
                     dataArray.add(data1);
                 }

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FirstController.java

@@ -198,7 +198,7 @@ public class FirstController extends BladeController {
 
             //获取配置的路径
             String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-            //String file_path = "/Users/hongchuangyanfa/Desktop/";//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+            //String file_path = "/Users/hongchuangyanfa/Desktop/";
 
 
             //获取数据

+ 7 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FormulaController.java

@@ -53,6 +53,9 @@ public class FormulaController {
     private final IContractInfoService contractInfoService;
     private final ITextdictInfoService textdictInfoService;
     private final IFormulaOptionService formulaOptionService;
+
+    // 合同段服务-
+    private final IWbsTreeContractService wbsTreeContractService;
     /**
      * 新增或修改
      */
@@ -295,8 +298,10 @@ public class FormulaController {
                         break;
                     }
                 }
-                if(data.size()>dw.length-start){
-                    result.put("more",data.stream().skip(dw.length-start).map(StringUtils::handleNull).collect(Collectors.joining(StringPool.SEMICOLON)));
+                if(data.size()>dw.length){
+                  //  String moreData = data.stream().skip(dw.length).map(StringUtils::handleNull).collect(Collectors.joining(StringPool.SEMICOLON));
+                    // 频率添加表单
+                    this.wbsTreeContractService.addTabInfoByRan(info,data,dw.length);
                 }
             }
             /*保存实测值参数*/

+ 0 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java

@@ -73,5 +73,4 @@ public interface IContractInfoService extends BaseService<ContractInfo> {
     Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId, String selfId);
 
     Map<Long, List<WbsTreeContractTreeAllVO>> treeAllJL(String contractId, Integer type);
-
 }

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExcelTabService.java

@@ -106,7 +106,7 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
     Map<String, String> getTablbCols(String pkeyid, String colkey) throws FileNotFoundException;
 
     // 获取用户端 单个表单接口数据
-    R getBussDataInfo(Long pkeyId);
+    R getBussDataInfo(Long pkeyId,int type);
 
     // 单个pdf 生成
     R getBussPdfInfo(Long pkeyId) throws Exception;

+ 1 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/ITextdictInfoService.java

@@ -18,6 +18,7 @@ package org.springblade.manager.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.core.tool.api.R;
+import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.entity.TextdictInfo;
 import org.springblade.manager.vo.TextdictDataInfoVO;
 import org.springblade.manager.vo.TextdictInfoVO;
@@ -42,7 +43,4 @@ public interface ITextdictInfoService extends IService<TextdictInfo> {
 	IPage<TextdictInfoVO> selectTextdictInfoPage(IPage<TextdictInfoVO> page, TextdictInfoVO textdictInfo);
 
 	void deleDataInfoById(String id);
-
-
-
 }

+ 5 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java

@@ -1,6 +1,7 @@
 package org.springblade.manager.service;
 
 import org.springblade.core.mp.base.BaseService;
+import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.ContractRelationJlyz;
@@ -9,6 +10,7 @@ import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.vo.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -51,4 +53,7 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 
     // 查询隐蔽工程节点
     List<WbsContractNodeVo> appSearchConcealedNodes(long primaryKeyId, Long contractId);
+
+    // 频率设计值  添加表单
+    boolean addTabInfoByRan(RangeInfo info,List<Object> moreData,Integer excLenght) throws FileNotFoundException;
 }

+ 25 - 23
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -18,7 +18,6 @@ package org.springblade.manager.service.impl;
 
 import cn.hutool.core.date.StopWatch;
 import cn.hutool.log.StaticLog;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -27,22 +26,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.RegexUtils;
-import com.spire.xls.*;
 import com.spire.xls.CellRange;
 import com.spire.xls.Workbook;
+import com.spire.xls.*;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.IOUtils;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
-import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.ContractLogClient;
@@ -60,8 +58,8 @@ import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
-import org.springblade.core.tool.utils.*;
 import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.formula.KeyMapper;
@@ -79,14 +77,9 @@ 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 org.springframework.web.bind.annotation.RequestParam;
 
 import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.awt.*;
 import java.awt.Color;
 import java.awt.image.BufferedImage;
 import java.io.*;
@@ -863,7 +856,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
 
     @Override
-    public R getBussDataInfo(Long pkeyId) {
+    public R getBussDataInfo(Long pkeyId,int type) {
 
         Map<String, Object> reData = new HashMap<>();
 
@@ -1065,20 +1058,25 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         }
 
         // 移除Id 和 p_key_id
-        reData.remove("id");
-        reData.remove("p_key_id");
-        reData.remove("classify");
-        reData.remove("contractId");
-        reData.remove("pkeyId");
-        reData.remove("projectId");
+        if(type==0){
+            reData.remove("id");
+            reData.remove("p_key_id");
+            reData.remove("classify");
+            reData.remove("contractId");
+            reData.remove("pkeyId");
+            reData.remove("projectId");
+        }
+        if(type==1){
+            reData.put("pkeyId",reData.get("p_key_id"));
+        }
         reData.put("tabGroupId", wbsTreeContract.getTabGroupId());
         return R.data(reData);
     }
 
     @Override
     public R getBussPdfInfo(Long pkeyId) throws Exception {
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        // String file_path = "/Users/hongchuangyanfa/Desktop/";
+        //String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = "/Users/hongchuangyanfa/Desktop/";
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
@@ -1103,7 +1101,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             return R.fail("失败");
         }
 
-        Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId).getData();
+        Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId,0).getData();
 
         // 获取excel流 和 html流
         InputStream exceInp = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
@@ -1287,6 +1285,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                 Elements tdsx = ytzData.select("td");
                                 if (Integer.parseInt(trtd[1]) < tdsx.size()) {
                                     Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
+                                    if(data.html().indexOf("el-tooltip") >= 0){
+                                        data = data.children().get(0);
+                                    }
+
                                     int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
                                     if (x1 == 0) {
                                         x1 = 1;
@@ -1324,7 +1326,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         //输出流
         FileOutputStream outputStream = new FileOutputStream(excelPath);
         workbook.write(outputStream);
-        FileUtils.excelToPdf(excelPath, pdfPath);
+        FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
         //
         TableFile tableFile1 = tableFileService.getBaseMapper().selectOne(Wrappers.<TableFile>query().lambda()
@@ -1378,8 +1380,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
     @Override
     public void getBussPdfs(String nodeId, String classify, String contractId, String projectId) throws Exception {
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        //String file_path = "/Users/hongchuangyanfa/Desktop/";
+        //String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = "/Users/hongchuangyanfa/Desktop/";
         // 获取有权限的节点信息
         List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
         List<String> data = new ArrayList<>();

+ 63 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -4,9 +4,12 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.springblade.business.entity.ConstructionLedger;
 import org.springblade.business.feign.ConstructionLedgerFeignClient;
 import org.springblade.common.utils.FileUtils;
@@ -15,9 +18,8 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.node.ForestNodeMerger;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.utils.*;
+import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.*;
@@ -34,6 +36,8 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -352,6 +356,62 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return ForestNodeMerger.merge(baseMapper.appSearchConcealedNodes(primaryKeyId, contractId));
     }
 
+    // 频率添加表单
+    @Override
+    public boolean addTabInfoByRan(RangeInfo info,List<Object> moreData,Integer excLenght) throws FileNotFoundException {
+        WbsTreeContract wbsInfo = this.baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda()
+                .eq(WbsTreeContract::getPKeyId, info.getPkId()));
+
+        //查询复制表有多少张
+        List<WbsTreeContract> wbsTreeContractList = this.baseMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
+                .eq(WbsTreeContract::getId, wbsInfo.getId())
+                .eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
+                .eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
+        List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().filter(wbsTreeContract -> wbsTreeContract.getIsCopeTab() ==null || wbsTreeContract.getIsCopeTab()!=2).sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
+        // 判读需要添加几张表
+        long tabGroupId = SnowFlakeUtil.getId();
+
+        List<WbsTreeContract> addList = new ArrayList<>();
+
+        double tabCount = moreData.size() / excLenght - wbsTreeContractList2.size()+1;
+        double tabsCount  = Math.ceil(tabCount);
+        if(tabsCount>=1){
+            for(int i =0 ;i<tabsCount;i++){
+                long newPkId = SnowFlakeUtil.getId();
+                WbsTreeContract wbsTreeContract = new WbsTreeContract();
+                BeanUtil.copy(wbsInfo,wbsTreeContract);
+                wbsTreeContract.setPKeyId(newPkId);
+                wbsTreeContract.setCreateTime(new Date());
+                wbsTreeContract.setTabGroupId(tabGroupId);
+                String nodeName = wbsTreeContractList2.get(0).getNodeName();
+
+                if (nodeName.indexOf("_PL_") >= 0) {
+                    String[] oldName = nodeName.split("_PL_");
+                    nodeName = oldName[0] + "_PL_" + (Integer.parseInt(oldName[1]) + 1);
+                } else {
+                    nodeName = nodeName + "_PL_" + 1;
+                }
+                wbsTreeContract.setNodeName(nodeName);
+                wbsTreeContract.setIsCopeTab(1);
+                wbsTreeContract.setIsTabPdf(1); // pdf 不能预览
+                wbsTreeContract.setIsBussShow(1); // 是否隐藏表
+                wbsTreeContract.setTabFileType(1);//没有上传附件
+                wbsTreeContract.setPdfUrl("");
+                addList.add(wbsTreeContract);
+            }
+            // 插入数据
+            this.baseMapper.insertBatchSomeColumn(addList);
+        }
+        for(WbsTreeContract wbsTreeCont:wbsTreeContractList2){
+            UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.in("p_key_id", wbsTreeCont.getPKeyId() + "");
+            updateWrapper.set("tab_group_id", tabGroupId);
+            wbsTreeCont.setTabGroupId(tabGroupId);
+            this.getBaseMapper().update(wbsTreeCont,updateWrapper);
+        }
+        return false;
+    }
+
     @Override
     public List<WbsTreeContract> updateAllNodeTabById(WbsTreePrivate aPrivate) {
         return baseMapper.updateAllNodeTabById(aPrivate);

+ 75 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

@@ -9,6 +9,7 @@ import com.spire.xls.*;
 import com.sun.image.codec.jpeg.JPEGCodec;
 import com.sun.image.codec.jpeg.JPEGImageEncoder;
 import org.apache.commons.lang.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.*;
@@ -16,12 +17,16 @@ import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.Units;
+import org.apache.poi.xssf.usermodel.XSSFPrintSetup;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.vo.DataVO;
+import org.springblade.core.tool.api.ResultCode;
 import org.springblade.core.tool.utils.FileUtil;
 import org.springblade.core.tool.utils.IoUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
@@ -231,6 +236,7 @@ public class FileUtils {
                 sheet.setPrintGridlines(false);
                 //设置 整个工作表为一页
                 sheet.setFitToPage(true);
+
             }
             outReport = new ByteArrayOutputStream();
             ss.write(outReport);
@@ -302,6 +308,71 @@ public class FileUtils {
 
 
 
+    /**
+     * excel设置 打印缩放比例
+     *
+     * @param inputPath
+     * @param outPath
+     */
+    public static void setExcelScaleToPdf(String inputPath, String outPath) {
+        //读取excel文件
+        XSSFWorkbook workbook = null;
+        ByteArrayOutputStream outReport = null, bos = null;
+        ByteArrayInputStream byteArrayInputStream = null;
+        try {
+            workbook = new XSSFWorkbook(new FileInputStream(inputPath));
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        OutputStream fos = null;
+        try {
+            for (int i = 0; i < workbook.getNumberOfSheets(); i++) {//获取每个Sheet表
+                XSSFSheet sheet = workbook.getSheetAt(i);
+                //打印设置
+                XSSFPrintSetup print = sheet.getPrintSetup();
+               // print.setLandscape(true); // 打印方向,true:横向,false:纵向(默认)
+             //   print.setFitHeight((short)0);//设置高度为自动分页
+                print.setFitWidth((short)1);//设置宽度为一页
+                print.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); //纸张类型
+//                print.setScale((short)55);//自定义缩放①,此处100为无缩放
+                //启用“适合页面”打印选项的标志
+                sheet.setFitToPage(true);
+            }
+            // Excel文件生成后存储的位置。
+            outReport = new ByteArrayOutputStream();
+            workbook.write(outReport);
+            byteArrayInputStream = new ByteArrayInputStream(outReport.toByteArray());
+            com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook(byteArrayInputStream);
+            File pdfFile = new File(outPath);
+            if(!pdfFile.exists()){
+                pdfFile.mkdir();
+            }
+            wb.save(outPath, SaveFormat.PDF);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (workbook != null) {
+                try {
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+
+
+
 
     public static void main123(String[] args) throws Exception {
 
@@ -337,8 +408,9 @@ public class FileUtils {
     }
 
 
-    public static void main23(String[] args) throws FileNotFoundException {
-        File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/fsdownload/1633774811681390592.html");
+    public static void main11(String[] args) throws FileNotFoundException {
+
+        /*File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/fsdownload/1633774811681390592.html");
         FileInputStream fileInputStream = new FileInputStream(file1);
         String htmlString = IoUtil.readToString(fileInputStream);
         // 解析 style
@@ -370,7 +442,7 @@ public class FileUtils {
         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()]);
-        }
+        }*/
 
     }
 }