Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/test-merge' into test-merge

LHB 1 mesiac pred
rodič
commit
d9ae1bd44e

+ 2 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/Task.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.business.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 
 import java.io.Serializable;
@@ -179,5 +180,6 @@ public class Task extends BaseEntity {
     private Integer isBuildAudit;
 
     @ApiModelProperty("电签状态")
+    @TableField(exist = false)
     private Integer eStatus;
 }

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

@@ -1476,8 +1476,9 @@ public R<String> batchDownloadFileToZip(String ids, HttpServletResponse response
                     String fileName = result.get(i).getName();
                     fileName = fileName == null ? "找不到文件题目" : fileName.replaceAll("\\\\", "_").replaceAll("/", "_");
                     if (nameMap.containsKey(fileName)) {
-                        fileName = fileName + "_" + nameMap.get(fileName);
-                        nameMap.put(fileName, nameMap.get(fileName) + 1);
+                        int num = nameMap.get(fileName) == null ? 1 : nameMap.get(fileName);
+                        nameMap.put(fileName, num + 1);
+                        fileName = fileName + "_" + num;
                     } else {
                         nameMap.put(fileName, 1);
                     }

+ 44 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -73,6 +73,7 @@ import org.springblade.resource.vo.NewBladeFile;
 import org.springblade.system.cache.ParamCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.ContentDisposition;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
@@ -94,6 +95,7 @@ import java.io.*;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
@@ -2034,6 +2036,48 @@ public class ExcelTabController extends BladeController {
         return pdfUrl;
     }
 
+    @GetMapping("/downBussPdf")
+    @ApiOperationSupport(order = 32)
+    @ApiOperation(value = "下载pdf数据")
+    @ApiImplicitParam(name = "id", value = "fileId")
+    public void downBussPdf(String id,HttpServletResponse response) throws Exception {
+        if (id == null || id.trim().isEmpty()) {
+            throw new ServiceException("暂无PDF数据");
+        }
+        //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
+        String sql = "select name,pdf_url,e_visa_pdf_url,node_pdf_url from u_information_query where id = " +  id;
+        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+        if (maps.isEmpty()) {
+            throw new ServiceException("暂无PDF数据");
+        } else  {
+            Map<String, Object> stringObjectMap = maps.get(0);
+            String pdfUrl = stringObjectMap.get("pdf_url") == null ? "" : stringObjectMap.get("pdf_url") + "";
+            String fileName = stringObjectMap.get("name") == null ? "找不到文件题名" : stringObjectMap.get("name") + "";
+            if (Func.isNotEmpty(stringObjectMap.get("node_pdf_url"))) {
+                pdfUrl = stringObjectMap.get("node_pdf_url") == null ? "" : stringObjectMap.get("node_pdf_url") + "";
+            } else if (Func.isNotEmpty(stringObjectMap.get("e_visa_pdf_url"))) {
+                //优先使用电签的pdf
+                pdfUrl = stringObjectMap.get("e_visa_pdf_url") == null ? "" : stringObjectMap.get("e_visa_pdf_url") + "";
+            }
+            if (pdfUrl.isEmpty()) {
+                throw new ServiceException("暂无PDF数据");
+            }
+//            fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
+            InputStream redio = CommonUtil.getOSSInputStream(pdfUrl);
+            byte[] buffer = IoUtil.readToByteArray(redio);
+            OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+            response.setContentType("application/pdf");
+            response.setCharacterEncoding("UTF-8");
+            fileName = fileName.replaceAll("/", "_");
+            String encode = URLEncoder.encode(fileName, "UTF-8");
+            encode = encode.replaceAll( "%2B", "+");
+            response.setHeader("Content-disposition", "attachment;filename=" + encode + ".pdf");
+            toClient.write(buffer);
+            toClient.flush();
+            toClient.close();
+        }
+    }
+
 
     /**
      * 用户端删除复制信息表

+ 0 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -12,8 +12,6 @@ import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Node;
 import org.jsoup.select.Elements;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springblade.business.dto.ReSigningEntrustDto;
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.ContractLog;

+ 1 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -19,7 +19,6 @@ import com.spire.xls.ExcelPicture;
 import com.spire.xls.FileFormat;
 import com.spire.xls.Worksheet;
 import com.spire.xls.collections.PicturesCollection;
-import io.swagger.models.auth.In;
 import lombok.AllArgsConstructor;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
@@ -1939,11 +1938,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         /*获取参数库数据*/
         Map<String, Object> nodeBaseInfo = nodeBaseInfoService.getAllNodeBaseInfoByPkeyId(pkeyId, nodeId);
         if(nodeBaseInfo!=null){
-            for (Map.Entry<String, Object> entry : nodeBaseInfo.entrySet()) {
-                if (reData.get(entry.getKey()) == null || reData.get(entry.getKey()).toString().isEmpty()) {
-                    reData.put(entry.getKey(), entry.getValue());
-                }
-            }
+            reData.putAll(nodeBaseInfo);
         }
 //        if(reData.size()>0){
 //            //处理key重复导致pdf数据错位

+ 15 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsFormElementServiceImpl.java

@@ -95,9 +95,21 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
 
     @Override
     public Boolean initTable(List<WbsFormElement> elementList, String tableName) {
-        String sql = createSQL(elementList);
+        List<WbsFormElement> collect = elementList.stream().filter(element -> {
+            String eKey = element.getEKey();
+            String[] split = eKey.split("_");
+            if (split.length > 1 && StringUtil.isNumeric(split[1])) {
+                int i = Integer.parseInt(split[1]);
+                return i <= 80;
+            }
+            return true;
+        }).collect(Collectors.toList());
+        String sql = createSQL(collect);
         try {
             boolean b = wbsFormElementMapper.createTable(sql, tableName) >= 0;
+            if (b) {
+                alterMTableOpsFiled(tableName);
+            }
             return b;
         } catch (Exception e) {
             return true;
@@ -195,6 +207,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             String fieldType = WbsElementUtil.getInitTableFiledType(wbsFormElement.getEType());
             if (newFiled > 80) {
                 alterMTableOpsFiled(tableName);
+                baseMapper.insert(wbsFormElement);
             } else {
                 if ("varchar".equals(fieldType)) {
                     if (wbsFormElement.getELength() > 1000 || wbsFormElement.getELength() < 10) {
@@ -922,6 +935,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                     long index = Long.parseLong(split[1]);
                     if (index > 80)  {
                         alterMTableOpsFiled(initTableName);
+                        continue;
                     };
                 }
                 //同步