Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

zzw vor 1 Monat
Ursprung
Commit
f6e47358dc

+ 18 - 22
assistMg/src/main/java/com/hotent/project/manager/impl/CostProjectDocumentManagerImpl.java

@@ -221,7 +221,7 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
         costProjectDocument.setDocumentType(costDocumentTemplate.getType());
         costProjectDocument.setProjectId(costProjectApproval.getProjectId());
         super.create(costProjectDocument);
-        if (costProjectDocument.getDocumentAlias().equals("cbjstzs")) {
+        /*if (costProjectDocument.getDocumentAlias().equals("cbjstzs")) {
 
             CostDocumentTemplate templateManagerById = costDocumentTemplateManager.getByAlias("sdhz");
             if (templateManagerById==null) {
@@ -285,34 +285,30 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
                 arrayList.add(costProjectDocumentFile);
             });
             costProjectDocumentFileManager.saveBatch(arrayList);
-        }
+        }*/
         //文件关联信息赋值
-        /*req.getCostProjectDocumentFiles().forEach(costProjectDocumentFile -> {
+        req.getCostProjectDocumentFiles().forEach(costProjectDocumentFile -> {
             costProjectDocumentFile.setDocumentId(costProjectDocument.getDocumentId());
             costProjectDocumentFile.setProjectId(costProjectDocument.getProjectId());
-            //送达回证特殊处理字段 后期在说
-            if ("送达回证".equals(costProjectDocument.getDocumentName())) {
-                if (costProjectDocumentFile.getPinyin().equals("SongDaWenShuMingCheng")){
-                    costProjectDocumentFile.setDataValue(costDocumentTemplate.getDocumentName());
-                }
-                if (costProjectDocumentFile.getPinyin().equals("SongDaWenShuWenHao")){
+            switch (costProjectDocumentFile.getPinyin()) {
+                case "SongDaWenShuWenHao":
                     costProjectDocumentFile.setDataValue(whNo);
+                    break;
+            }
+            if (StringUtils.isNotBlank(costProjectDocumentFile.getTableName())){
+                if(StringUtil.isEmpty(costProjectDocumentFile.getWhereValue())){
+                    costProjectDocumentFile.setWhereValue(costProjectApproval.getProjectId());
+                }else {
+                    String whereValue1 = costProjectDocumentFile.getWhereValue();
+                    String replace = whereValue1.replace("?", "'" + costProjectApproval.getProjectId() + "'");
+                    costProjectDocumentFile.setWhereValue(replace);
                 }
-                if (costProjectDocumentFile.getPinyin().equals("SongDaWenShuMingCheng")){
-                    costProjectDocumentFile.setDataValue(costDocumentTemplate.getDocumentName());
-                }
-                if (costProjectDocumentFile.getPinyin().equals("TongZhiSongDaShiJian")){
-                    costProjectDocumentFile.setDataValue(DateUtils.format(new Date(),"yyyy-MM-dd"));
-                }
-                if (costProjectDocumentFile.getPinyin().equals("BeiJianShenDanWeiBanGongDiDian")){
-                    costProjectDocumentFile.setDataValue(auditedUnit.getAddress());
-                }
-                if (costProjectDocumentFile.getPinyin().equals("ShouSongDaRen")){
-                    costProjectDocumentFile.setDataValue(auditedUnit.getContactName());
-                }
+                String colValue = costTemplateFileManager.getColValue(costProjectDocumentFile.getTableName(), costProjectDocumentFile.getColName(), costProjectDocumentFile.getWhereName(), costProjectDocumentFile.getWhereValue());
+                //获取whereValue字段值
+                costProjectDocumentFile.setDataValue(colValue);
             }
 
-        });*/
+        });
         //保存解析出的文件内容
         costProjectDocumentFileManager.saveBatch(req.getCostProjectDocumentFiles());
 

+ 4 - 0
assistMg/src/main/java/com/hotent/util/wordexcelutils/WordProcessor.java

@@ -1,5 +1,6 @@
 package com.hotent.util.wordexcelutils;
 
+import com.hotent.base.util.StringUtil;
 import org.apache.poi.util.Units;
 import org.apache.poi.xwpf.usermodel.*;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -59,6 +60,9 @@ public class WordProcessor {
                     // 替换文本占位符
                     for (Map.Entry<String, String> entry : textReplacements.entrySet()) {
                         if (text.contains(entry.getKey())) {
+                            if (StringUtil.isEmpty(entry.getValue())) {
+                                continue;
+                            }
                             text = text.replace(entry.getKey(), entry.getValue());
                             run.setText(text, 0);
                         }