Эх сурвалжийг харах

附件保存和关联数据签字问题

zhuwei 2 өдөр өмнө
parent
commit
ce558c2545

+ 34 - 2
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java

@@ -454,10 +454,42 @@ public class EVDataServiceImpl implements EVDataService {
                 taskApp.setPdfDataType(type);
                 if (StringUtils.isNotEmpty(pdfTrialUrlPosition) || StringUtils.isNotEmpty(pdfTrialUrl) || StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
                     if ("1".equals(type)) {
-                        String approvalPdf = eVisaPdfUrl.length() >= 10 ? eVisaPdfUrl : pdfUrl;
+                       /* String approvalPdf = eVisaPdfUrl.length() >= 10 ? eVisaPdfUrl : pdfUrl;
                         approvalPdf = pdfTrialUrl.length() >= 10 ? pdfTrialUrl : approvalPdf;
                         approvalPdf = pdfTrialUrlPosition.length() >= 10 ? pdfTrialUrlPosition : approvalPdf;
-                        taskApp.setSignPdfUrl(getHppsToHttp(approvalPdf));
+                        taskApp.setSignPdfUrl(getHppsToHttp(approvalPdf));*/
+                        String nodeDdfUrl = map.get("node_pdf_url") + "";
+                        if(pdfTrialUrlPosition!=null && pdfTrialUrlPosition.length()>=10){
+                            taskApp.setSignPdfUrl(getHppsToHttp(pdfTrialUrlPosition));
+                        }else if(pdfTrialUrl!=null && pdfTrialUrl.length()>=10 ){
+                            if(eVisaPdfUrl!=null && eVisaPdfUrl.length()>=10){
+                                taskApp.setSignPdfUrl(getHppsToHttp(eVisaPdfUrl));
+                            }else{
+                                if(nodeDdfUrl!=null && nodeDdfUrl.length()>=10){
+                                    taskApp.setSignPdfUrl(getHppsToHttp(nodeDdfUrl));
+                                }else{
+                                    List<String> pdfList = new ArrayList<>();
+                                    pdfList.add(pdfUrl);
+                                    pdfList.add(pdfTrialUrl);
+                                    String file_path = FileUtils.getSysLocalFileUrl();
+                                    Long id = SnowFlakeUtil.getId();
+                                    String listPdf = file_path + "/pdf/" +id + ".pdf";
+                                    File pdf2 = ResourceUtil.getFile(listPdf);
+                                    if (pdf2.exists()) {
+                                        pdf2.delete();
+                                    }
+                                    FileUtils.mergePdfPublicMethods(pdfList, file_path);
+                                    BladeFile bladeFile = newIOSSClient.uploadFile(id+".pdf", file_path);
+                                    if (bladeFile != null) {
+                                        taskApp.setSignPdfUrl(getHppsToHttp(bladeFile.getLink()));
+                                    }
+                                }
+                            }
+                        }else if (eVisaPdfUrl!=null && eVisaPdfUrl.length()>=10){
+                            taskApp.setSignPdfUrl(getHppsToHttp(eVisaPdfUrl));
+                        }else if (pdfUrl!=null && pdfUrl.length()>=10){
+                            taskApp.setSignPdfUrl(getHppsToHttp(pdfUrl));
+                        }
                     } else if ("2".equals(type)) {
                         if (StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
                             //试验原始pdf

+ 0 - 1
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVisaServiceImpl.java

@@ -94,7 +94,6 @@ import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.stream.Collectors;
-
 @Service
 @AllArgsConstructor
 public class EVisaServiceImpl implements EVisaService {

+ 45 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/SubTable.java

@@ -114,12 +114,13 @@ public class SubTable {
 
 
     /**将项目信息写入附表元素*/
-    public void flush() {
+    public void flush(boolean isUpdate) {
         if(!checked()){
             return;
         }
+
         /*获取项目数据*/
-        List<Item> itemList =getPutOutList();
+        List<Item> itemList =getPutOutList(isUpdate);
         if (itemList.size() > 0) {
             /*行号,起始为0,当前行号整除列大小余0就是每页首行*/
             AtomicInteger index=new AtomicInteger(0);
@@ -178,9 +179,9 @@ public class SubTable {
     }
 
     /*获取最终输出的项目信息*/
-    public List<Item> getPutOutList(){
+    public List<Item> getPutOutList(boolean isUpdate){
         /*初始化group,保留原先内容,只做同KEY覆盖*/
-        initOriginal();
+        initOriginal(isUpdate);
         List<Item> itemList = new ArrayList<>(group.values());
         if(this.mainList!=null){
             List<String> itemNameIndex = this.mainList.stream().map(e->FormulaUtils.parseItemName(e.getEName()).trim()).collect(Collectors.toList());
@@ -194,14 +195,51 @@ public class SubTable {
         return itemList;
     }
     /*用原有数据初始化*/
-    private void initOriginal(){
-        List<String> itemName = this.itemName.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
+    private void initOriginal(boolean isUpdate){
+        List<String> itemName = new ArrayList<>();
+
+        if(isUpdate){
+            List<String>  itemName2= this.itemName.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
+            for(String name : itemName2){
+                if(StringUtils.isEmpty(name)){
+                    itemName.add(name);
+                    continue;
+                }
+                String lastName = "";
+                int count = 0;
+                for(FormData df :this.mainList){
+                    //箍筋、构造钢筋、螺旋筋间距(mm)
+                    String test = df.getEName().replaceAll("、","").trim();
+                    if(test.indexOf(name)>=0){
+                        lastName = null;
+                        count = 11;
+                        break;
+                    }
+                }
+                if(count==11){
+                    itemName.add(lastName);
+                }else{
+                    itemName.add(name);
+                }
+
+            }
+        }else{
+            itemName = this.itemName.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
+        }
+
         List<String> designs=null;
         if(this.design!=null) {
              designs = this.design.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
         }
         List<Object> data = this.data.getRawValue();
-        String name = itemName.get(0);
+        String name = "";
+        for (int i = 0; i < itemName.size(); i++) {
+            name = itemName.get(i);
+            if (StringUtils.isNotEmpty( name)) {
+                break;
+            }
+        }
+
         if(StringUtils.isNotEmpty(name)) {
             int head = 0;
             //计算 最后一行之前的数据

+ 10 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -1833,11 +1833,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             List<FormData> inspectionList = new ArrayList<>();
             /*1检验表5评定表*/
             List<NodeTable> mainTable = tec.getTableAll().stream().filter(e -> (e.getTableType().equals(1) || e.getTableType().equals(5)) && !e.getNodeName().contains("附表") && tec.getCurrentNode().getNodeType() > 3).collect(Collectors.toList());
+            List<NodeTable> mainFBTable = tec.getTableAll().stream().filter(e -> (e.getTableType().equals(1) || e.getTableType().equals(5)) && e.getNodeName().contains("附表") && tec.getCurrentNode().getNodeType() > 3).collect(Collectors.toList());
             if (Func.isEmpty(mainTable)) {
                 return;
             }
             List<NodeTable> mainTableList = mainTable.stream().collect(Collectors.groupingBy(NodeTable::getInitTableName)).values().stream().map(l -> l.get(0)).collect(Collectors.toList());
-            /*NodeTable main = mainTable.get(0);*/
+            // 删除多少的主表信息
             List<Long> pkeyIdsMain = mainTableList.stream().map(NodeTable::getPKeyId).collect(Collectors.toList());
             if (mainTable.size() > 1) {
                 List<Long> removeIds = mainTable.stream().map(NodeTable::getPKeyId).filter(x -> !pkeyIdsMain.contains(x)).collect(Collectors.toList());
@@ -1854,6 +1855,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     /*this.wbsTreeContractMapper.deleteLogicByIds(removeIds);*/
                 }
             }
+
+
             /*多余的表删除之后需要,裁剪多余表头数据保留全部实测数据然后重新设置增页大小*/
             for (NodeTable mt : mainTableList) {
                 tec.getKeyMappers().stream().filter(e -> e.getPkId().equals(mt.getPKeyId())).map(KeyMapper::getCode).forEach(e -> {
@@ -1877,7 +1880,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     }
                 });
             }
-            if (Func.isNotEmpty(inspectionList)) {
+            // 校验附表的数据
                 /*检查是否存在附表,不存在挂载*/
                 List<NodeTable> subTabList = tec.getTableAll().stream().filter(e -> e.getNodeName().contains("附表") && (e.getTableType() == 1 || e.getTableType() == 5)).collect(Collectors.toList());
                 if (subTabList.size() == 0) {
@@ -1894,13 +1897,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                 SubTable sta = new SubTable(subTableFds, tec, mainTableList);
                 sta.put(inspectionList);
                 /*把附表数据刷入对应的附表元素对象*/
-                sta.flush();
+                sta.flush(inspectionList.size()==0);
                 /*把主表的表头表尾信息拷贝*/
                 headerFooterSub(subTableFds, tec);
                 /*如果识别到手填内容需要在附表写入数据后,更新评定关联数据*/
-
+            /*if (Func.isNotEmpty(inspectionList)) {
             }else {
-                if(StringUtils.isNotEmpty(tec.getIsRemoveForSubTab())&&"1".equals(tec.getIsRemoveForSubTab())){
+               // if(StringUtils.isNotEmpty(tec.getIsRemoveForSubTab())&&"1".equals(tec.getIsRemoveForSubTab())){
                     List<NodeTable> subTabList = tec.getTableAll().stream().filter(e -> e.getNodeName().contains("附表") && (e.getTableType() == 1 || e.getTableType() == 5)).collect(Collectors.toList());
                     if(!subTabList.isEmpty()){
                         String queryIds = subTabList.stream().map(e -> e.getPKeyId() + "").collect(Collectors.joining(","));
@@ -1911,8 +1914,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                             this.wbsTreeContractMapper.deleteLogicByIds(ids);
                         }
                     }
-                }
-            }
+              //  }
+            }*/
         } catch (Exception e) {
             e.printStackTrace();
         }