浏览代码

Merge remote-tracking branch 'origin/master' into master

yangyj 2 年之前
父节点
当前提交
f455f699e0

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ArchiveFile.java

@@ -270,4 +270,7 @@ public class ArchiveFile extends BaseEntity {
 	 */
 	 */
 	@ApiModelProperty("是否案卷四要素,0否,1是")
 	@ApiModelProperty("是否案卷四要素,0否,1是")
 	private Integer isElement;
 	private Integer isElement;
+
+	@ApiModelProperty("卷内索引")
+	private Integer fid;
 }
 }

+ 3 - 1
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileAutoController.java

@@ -85,6 +85,8 @@ public class ArchiveFileAutoController extends BladeController {
                                 saveVo.setFileType((long) FileUtils.getFileType(name));
                                 saveVo.setFileType((long) FileUtils.getFileType(name));
                             }
                             }
                             saveVo.setSourceType(2);
                             saveVo.setSourceType(2);
+                            saveVo.setProjectId(archive.getProjectId() == null?"":archive.getProjectId().toString());
+                            saveVo.setContractId(archive.getContractId()==null?"":archive.getContractId().toString());
                             list.add(saveVo);
                             list.add(saveVo);
                             if(saveVo.getFilePage() != null && !saveVo.getFilePage().equals("")){
                             if(saveVo.getFilePage() != null && !saveVo.getFilePage().equals("")){
                                 pageN = pageN + saveVo.getFilePage();
                                 pageN = pageN + saveVo.getFilePage();
@@ -107,7 +109,7 @@ public class ArchiveFileAutoController extends BladeController {
                     archive.setAutoFileSort(l+archive.getAutoFileSort());
                     archive.setAutoFileSort(l+archive.getAutoFileSort());
                     //待修改
                     //待修改
                     archive.setIsDeleted(0);
                     archive.setIsDeleted(0);
-                    archive.setIsArchive(0);
+                    archive.setIsArchive(1);
                     archive.setIsAutoFile(1);
                     archive.setIsAutoFile(1);
                     archivesAutoService.save(archive);
                     archivesAutoService.save(archive);
                 }else{
                 }else{

+ 20 - 1
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -77,6 +77,17 @@
         <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
         <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
             and is_auto_file = #{vo.isAutoFile}
             and is_auto_file = #{vo.isAutoFile}
         </if>
         </if>
+        <choose>
+            <when test="vo.isArchive != null and vo.isArchive != ''">
+                and  is_auto_file = #{vo.isArchive}
+            </when>
+            <otherwise>
+                and (is_auto_file is null or is_auto_file != 1)
+            </otherwise>
+        </choose>
+        <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
+            and is_auto_file = #{vo.isAutoFile}
+        </if>
         <if test="vo.nodeIds != null and vo.nodeIds != ''">
         <if test="vo.nodeIds != null and vo.nodeIds != ''">
             and node_id in
             and node_id in
             <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
             <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
@@ -86,13 +97,21 @@
     </select>
     </select>
 
 
     <select id="selectArchivesAutoFilePage" resultMap="archivesAutoResultMap">
     <select id="selectArchivesAutoFilePage" resultMap="archivesAutoResultMap">
-        select * from u_archives_auto where is_deleted = 0  and is_archive = 1
+        select * from u_archives_auto where is_deleted = 0
         <if test="vo.projectId != null and vo.projectId != ''">
         <if test="vo.projectId != null and vo.projectId != ''">
             and project_id = #{vo.projectId}
             and project_id = #{vo.projectId}
         </if>
         </if>
         <if test="vo.contractId != null and vo.contractId != ''">
         <if test="vo.contractId != null and vo.contractId != ''">
             and contract_id = #{vo.contractId}
             and contract_id = #{vo.contractId}
         </if>
         </if>
+        <choose>
+            <when test="vo.isArchive != null and vo.isArchive != ''">
+                and  is_auto_file = #{vo.isArchive}
+            </when>
+            <otherwise>
+                and (is_auto_file is null or is_auto_file != 1)
+            </otherwise>
+        </choose>
         <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
         <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
             and is_auto_file = #{vo.isAutoFile}
             and is_auto_file = #{vo.isAutoFile}
         </if>
         </if>

+ 30 - 21
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java

@@ -82,27 +82,36 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
 //        List<String> files = new ArrayList<>();
 //        List<String> files = new ArrayList<>();
 //        files.add(file2);
 //        files.add(file2);
 //        BladeFile bladeFile = newIOSSClient.uploadFile1(file2,"123");
 //        BladeFile bladeFile = newIOSSClient.uploadFile1(file2,"123");
+        String urls1 = "https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com/upload/20230427/ed4305eb971b062046c1ffd4e2da3c32.pdf";
+        String urls2 = "https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com/upload/20230427/f1ddb3bd25c076824ef366a9e242ff23.pdf";
+        List<String> urls = new ArrayList<>();
+        String localPath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        urls.add(urls1);
+        urls.add(urls2);
+        List<String> pageUrls = FileUtils.doForPageNumberUseItextpdf(urls,localPath,newIOSSClient,1578599210897772545L);
+        System.out.println();
 
 
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        boolean flag = FileUtils.LocalPath.equals(file_path);
-        String excelUrl = file_path +  "\\备考表.xlsx";
-
-        Map<String, Object> DataInfo = new HashMap<>();
-
-        DataVO dataVO = FormulaUtil.convertCellToIndex("C2");
-        String key =  "1__"+ dataVO.getY() + "_" + dataVO.getX();
-        DataInfo.put(key,"档号123456");
-
-        DataVO dataVO1 = FormulaUtil.convertCellToIndex("A9");
-        String key1 =  "2__"+ dataVO1.getY() + "_" + dataVO1.getX();
-        DataInfo.put(key1,"hahahahaa");
-        try {
-            String url = getBussPdfInfo(pkeyId.toString(),DataInfo,excelUrl,file_path,null,null);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
 
 
-        System.out.println();
+//        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+//        boolean flag = FileUtils.LocalPath.equals(file_path);
+//        String excelUrl = file_path +  "\\备考表.xlsx";
+//
+//        Map<String, Object> DataInfo = new HashMap<>();
+//
+//        DataVO dataVO = FormulaUtil.convertCellToIndex("C2");
+//        String key =  "1__"+ dataVO.getY() + "_" + dataVO.getX();
+//        DataInfo.put(key,"档号123456");
+//
+//        DataVO dataVO1 = FormulaUtil.convertCellToIndex("A9");
+//        String key1 =  "2__"+ dataVO1.getY() + "_" + dataVO1.getX();
+//        DataInfo.put(key1,"hahahahaa");
+//        try {
+//            String url = getBussPdfInfo(pkeyId.toString(),DataInfo,excelUrl,file_path,null,null);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//
+//        System.out.println();
 
 
 
 
     }
     }
@@ -269,7 +278,7 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
             urls.add(url);
             urls.add(url);
         }
         }
         String localPath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         String localPath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        List<String> pageUrls = FileUtils.doForPageNumberUseItextpdf(urls,localPath,newIOSSClient);
+        List<String> pageUrls = FileUtils.doForPageNumberUseItextpdf(urls,localPath,newIOSSClient, archivesAuto.getProjectId());
         for(int i=0;i<waitArchiveFiles.size();i++){
         for(int i=0;i<waitArchiveFiles.size();i++){
             waitArchiveFiles.get(i).setPdfPageUrl(pageUrls.get(i));
             waitArchiveFiles.get(i).setPdfPageUrl(pageUrls.get(i));
         }
         }
@@ -588,7 +597,7 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         for (ArchiveFile file:  datas) {
         for (ArchiveFile file:  datas) {
             idx++;
             idx++;
             //设置序号
             //设置序号
-            file.setId(idx.longValue());
+            file.setFid(idx);
             //设置文件编号
             //设置文件编号
             if (StringUtil.isEmpty(file.getFileNumber())) {
             if (StringUtil.isEmpty(file.getFileNumber())) {
                 file.setFileNumber("\\");
                 file.setFileNumber("\\");

+ 8 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileUtils.java

@@ -426,7 +426,7 @@ public class FileUtils {
      * @Author yangyj
      * @Author yangyj
      * @Date 2021.12.17 14:21
      * @Date 2021.12.17 14:21
      **/
      **/
-    public static List<String> doForPageNumberUseItextpdf(List<String> uris, String localPath ,NewIOSSClient newIOSSClient)  {
+    public static List<String> doForPageNumberUseItextpdf(List<String> uris, String localPath ,NewIOSSClient newIOSSClient,Long projectId)  {
         List<String> result = new ArrayList<>();
         List<String> result = new ArrayList<>();
         if(uris!= null && uris.size() > 0){
         if(uris!= null && uris.size() > 0){
             int cursor=0;
             int cursor=0;
@@ -488,12 +488,16 @@ public class FileUtils {
                     page = page + "-" + cursor + ".pdf";
                     page = page + "-" + cursor + ".pdf";
                     String fileName = fileNameWithoutExtension +  "-" +  page;
                     String fileName = fileNameWithoutExtension +  "-" +  page;
                     String filePath = localPath + fileName;
                     String filePath = localPath + fileName;
+                    fos = new FileOutputStream(filePath);
+                    fos.write(out.toByteArray()); // 将数据写入到指定文件路径中
+                    fos.close();
                     if (newIOSSClient!= null ) {
                     if (newIOSSClient!= null ) {
-                        BladeFile bladeFile  = newIOSSClient.updateFile(out.toByteArray(),fileName);
+                        //BladeFile bladeFile  = newIOSSClient.updateFile(out.toByteArray(),fileName);
+                        BladeFile bladeFile  = newIOSSClient.uploadFile(fileName,filePath,OssConstant.ARCHIVE_DIRECTORY,projectId);
                         result.add(bladeFile.getLink());
                         result.add(bladeFile.getLink());
+//                        File f = new File(filePath);
+//                        f.deleteOnExit();
                     }else {
                     }else {
-                        fos = new FileOutputStream(filePath);
-                        fos.write(out.toByteArray()); // 将数据写入到指定文件路径中
                         result.add(filePath);
                         result.add(filePath);
                     }
                     }
 
 

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

@@ -2841,7 +2841,7 @@ public class InformationWriteQueryController extends BladeController {
             //List<WbsTreeContract> childS = this.wbsTreeContractClient.queryChildByParentId(parent, "", "");
             //List<WbsTreeContract> childS = this.wbsTreeContractClient.queryChildByParentId(parent, "", "");
 
 
             //只获取原始表,不获取复制的表(业务说是从项目wbs处取表,目前直接从当前合同段取原始表,也是一样的)
             //只获取原始表,不获取复制的表(业务说是从项目wbs处取表,目前直接从当前合同段取原始表,也是一样的)
-            List<WbsTreeContract> childS = jdbcTemplate.query("select * from m_wbs_tree_contract where old_id is null and is_cope_tab is null and is_deleted = 0 and parent_id = " + parent.getId() + " and contract_id = " + parent.getContractId(), new BeanPropertyRowMapper<>(WbsTreeContract.class));
+            List<WbsTreeContract> childS = jdbcTemplate.query("select * from m_wbs_tree_contract where is_cope_tab is null and is_deleted = 0 and parent_id = " + parent.getId() + " and contract_id = " + parent.getContractId(), new BeanPropertyRowMapper<>(WbsTreeContract.class));
             if (childS.size() > 0) {
             if (childS.size() > 0) {
                 //添加入结果集
                 //添加入结果集
                 childList.addAll(childS);
                 childList.addAll(childS);

+ 24 - 5
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -56,6 +56,7 @@
         <result column="source_type" property="sourceType"/>
         <result column="source_type" property="sourceType"/>
         <result column="is_element" property="isElement"/>
         <result column="is_element" property="isElement"/>
         <result column="pdf_page_url" property="pdfPageUrl"/>
         <result column="pdf_page_url" property="pdfPageUrl"/>
+        <result column="fid" property="fid"/>
     </resultMap>
     </resultMap>
     <update id="recoveryByIds">
     <update id="recoveryByIds">
         update u_archive_file set is_deleted = 0 where
         update u_archive_file set is_deleted = 0 where
@@ -66,7 +67,7 @@
     </update>
     </update>
 
 
     <select id="selectArchiveFileCount" resultType="java.lang.Integer">
     <select id="selectArchiveFileCount" resultType="java.lang.Integer">
-        select count(id) from u_archive_file where is_deleted = 0  and (is_auto_file is null or is_auto_file != 1)
+        select count(id) from u_archive_file where is_deleted = 0
         <if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
         <if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
             and status = #{vo.isApprovalValue}
             and status = #{vo.isApprovalValue}
         </if>
         </if>
@@ -79,7 +80,17 @@
         <if test="vo.contractId != null and vo.contractId != ''">
         <if test="vo.contractId != null and vo.contractId != ''">
             and contract_id = #{vo.contractId}
             and contract_id = #{vo.contractId}
         </if>
         </if>
-
+        <if test="vo.archiveId != null and vo.archiveId != ''">
+            and archive_id = #{vo.archiveId}
+        </if>
+        <choose>
+            <when test="vo.isArchive != null and vo.isArchive != ''">
+                and  is_auto_file = #{vo.isArchive}
+            </when>
+            <otherwise>
+                and (is_auto_file is null or is_auto_file != 1)
+            </otherwise>
+        </choose>
         <if test="vo.nodeIds != null and vo.nodeIds != ''">
         <if test="vo.nodeIds != null and vo.nodeIds != ''">
             and node_id in
             and node_id in
             <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
             <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
@@ -99,7 +110,7 @@
     </select>
     </select>
 
 
     <select id="selectArchiveFilePage" resultMap="archiveFileResultMap">
     <select id="selectArchiveFilePage" resultMap="archiveFileResultMap">
-        select * from u_archive_file where is_deleted = 0 and (is_auto_file is null or is_auto_file != 1)
+        select * from u_archive_file where is_deleted = 0
         <if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
         <if test="vo.isApprovalValue != null and vo.isApprovalValue != ''">
             and status = #{vo.isApprovalValue}
             and status = #{vo.isApprovalValue}
         </if>
         </if>
@@ -112,9 +123,17 @@
         <if test="vo.contractId != null and vo.contractId != ''">
         <if test="vo.contractId != null and vo.contractId != ''">
             and contract_id = #{vo.contractId}
             and contract_id = #{vo.contractId}
         </if>
         </if>
-        <if test="vo.archive_id != null and vo.archive_id != ''">
-            and archive_id = #{vo.archive_id}
+        <if test="vo.archiveId != null and vo.archiveId != ''">
+            and archive_id = #{vo.archiveId}
         </if>
         </if>
+        <choose>
+            <when test="vo.isArchive != null and vo.isArchive != ''">
+                and  is_auto_file = #{vo.isArchive}
+            </when>
+            <otherwise>
+                and (is_auto_file is null or is_auto_file != 1)
+            </otherwise>
+        </choose>
         <if test="vo.nodeIds != null and vo.nodeIds != ''">
         <if test="vo.nodeIds != null and vo.nodeIds != ''">
             and node_id in
             and node_id in
             <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
             <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">

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

@@ -135,9 +135,9 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 
 
 		ArchiveTreeContractVO2 newTree = arTreeContractInitService.getTree(archiveTreeContracts);
 		ArchiveTreeContractVO2 newTree = arTreeContractInitService.getTree(archiveTreeContracts);
 
 
-
-		List<ArchiveTreeContract> addNodes = arTreeContractInitService.getContractProcExtNodes(tenantId,projectId,wbsId,newTree);
-		archiveTreeContracts.addAll(addNodes);
+        //todo 等测试OK再打开,wbs contract树有很多数据错乱节点。
+//		List<ArchiveTreeContract> addNodes = arTreeContractInitService.getContractProcExtNodes(tenantId,projectId,wbsId,newTree);
+//		archiveTreeContracts.addAll(addNodes);
 
 
 		//初始化祖先节点和排序
 		//初始化祖先节点和排序
 		arTreeContractInitService.InitTreeSort(archiveTreeContracts,tree);
 		arTreeContractInitService.InitTreeSort(archiveTreeContracts,tree);

+ 30 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -194,8 +194,16 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     public List<WbsTreeContractVO> addNodeTree(String pKeyId) {
     public List<WbsTreeContractVO> addNodeTree(String pKeyId) {
         WbsTreeContract parentNodeRoot = wbsTreeContractMapper.selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pKeyId).eq(WbsTreeContract::getStatus, 1));
         WbsTreeContract parentNodeRoot = wbsTreeContractMapper.selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pKeyId).eq(WbsTreeContract::getStatus, 1));
         if (parentNodeRoot != null) {
         if (parentNodeRoot != null) {
+            //oldId不等于空,说明是复制节点,通过oldId,去获取原始树节点
+            if (parentNodeRoot.getOldId() != null) {
+                parentNodeRoot = this.recursionFindResourceRootNode(parentNodeRoot);
+            }
             List<WbsTreeContract> allNodes = this.getChildNodes(parentNodeRoot);
             List<WbsTreeContract> allNodes = this.getChildNodes(parentNodeRoot);
+            if (allNodes == null) {
+                allNodes = new ArrayList<>();
+            }
             allNodes.add(parentNodeRoot);
             allNodes.add(parentNodeRoot);
+
             List<WbsTreeContractVO> resultAllNodes = BeanUtil.copyProperties(allNodes, WbsTreeContractVO.class);
             List<WbsTreeContractVO> resultAllNodes = BeanUtil.copyProperties(allNodes, WbsTreeContractVO.class);
             return buildWbsTreeByStreamChildNodeTree(resultAllNodes, parentNodeRoot);
             return buildWbsTreeByStreamChildNodeTree(resultAllNodes, parentNodeRoot);
         }
         }
@@ -221,17 +229,32 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     }
     }
 
 
     private List<WbsTreeContract> getChildNodes(WbsTreeContract obj) {
     private List<WbsTreeContract> getChildNodes(WbsTreeContract obj) {
-        if (obj != null) {
-            List<WbsTreeContract> wbsTreeContracts = Collections.singletonList(obj);
-            List<WbsTreeContract> result = new ArrayList<>();
-            this.recursionGetChildNodes(wbsTreeContracts, result, obj.getContractId());
-            if (result.size() > 0) {
-                return result;
-            }
+        List<WbsTreeContract> wbsTreeContracts = Collections.singletonList(obj);
+        List<WbsTreeContract> result = new ArrayList<>();
+        this.recursionGetChildNodes(wbsTreeContracts, result, obj.getContractId());
+        if (result.size() > 0) {
+            return result;
         }
         }
         return null;
         return null;
     }
     }
 
 
+    private WbsTreeContract recursionFindResourceRootNode(WbsTreeContract obj) {
+        if (obj.getOldId() != null) {
+            WbsTreeContract obj1 = wbsTreeContractMapper.selectOne(Wrappers.<WbsTreeContract>lambdaQuery()
+                    .eq(WbsTreeContract::getId, obj.getOldId())
+                    .eq(WbsTreeContract::getContractId, obj.getContractId()));
+            if (obj1 != null && obj1.getOldId() != null) {
+                obj1 = this.recursionFindResourceRootNode(obj1);
+            } else {
+                // 已经到达原始节点,返回当前节点的id
+                return obj1 != null ? obj1 : obj;
+            }
+            obj = obj1;
+        }
+        return obj;
+    }
+
+
     private void recursionGetChildNodes(List<WbsTreeContract> list, List<WbsTreeContract> result, String contractId) {
     private void recursionGetChildNodes(List<WbsTreeContract> list, List<WbsTreeContract> result, String contractId) {
         List<Long> ids = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
         List<Long> ids = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
         if (ids.size() > 0) {
         if (ids.size() > 0) {