luok vor 2 Jahren
Ursprung
Commit
b8cddf754f

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ContractClient.java

@@ -64,4 +64,8 @@ public interface ContractClient {
     R saveUserInfoByProjectThree(@RequestBody List<SaveUserInfoByProjectDTO> list);
 
 
+    @GetMapping(API_PREFIX + "/getContractListByProjectId")
+    List<ContractInfo> getContractListByProjectId(@RequestParam Long projectId);
+
+
 }

+ 17 - 13
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.itextpdf.text.Element;
 import com.itextpdf.text.pdf.*;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.util.IOUtils;
@@ -44,6 +45,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+@Slf4j
 @Service
 @AllArgsConstructor
 public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
@@ -315,13 +317,16 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
             String coords = config.getCoords();
             String formula = config.getFormula();
 
-            if("Archive['startDate']~Archive['endDate']".equals(formula)){
+            /*if("Archive['startDate']~Archive['endDate']".equals(formula)){
                 Object archive = variables.get("Archive");
-                ArchivesAuto auto=(ArchivesAuto)archive;
-                if(auto.getStartDate()==null && auto.getEndDate()==null){
+                Map auto=(Map)archive;
+                log.info(auto.get("name")+"-时间调试 s:"+auto.get("startDate") +"e:"+auto.get("endDate"));
+                if((auto.get("startDate")==null || StringUtils.isEmpty(auto.get("startDate").toString()))
+                        && (auto.get("endDate")==null || StringUtils.isEmpty(auto.get("endDate").toString())))
+                {
                     formula="";
                 }
-            }
+            }*/
 
             if(variables.containsKey("ArchiveFile") && variables.get("ArchiveFile") instanceof List
                     && formula.indexOf("ArchiveFile") >= 0){
@@ -338,15 +343,6 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         if (multiLineconfig != null) {
             String coords = multiLineconfig.getCoords();
             String formula = multiLineconfig.getFormula();
-
-            if("Archive['startDate']~Archive['endDate']".equals(formula)){
-                Object archive = variables.get("Archive");
-                ArchivesAuto auto=(ArchivesAuto)archive;
-                if(auto.getStartDate()==null && auto.getEndDate()==null){
-                    formula="";
-                }
-            }
-
             handleArchiveFile(coords, formula, variables, file_path, excelUrl, dataInfo,urls,fileName, archivesAuto.getProjectId());
 
         }else {
@@ -486,6 +482,14 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
 
 
         String key = config.getId() + "__" + dataVO.getY() + "_" + dataVO.getX();
+
+
+        if("Archive['startDate']~Archive['endDate']".equals(formula)){
+            log.info("起止时间object:"+object.toString());
+            if("null~null".equals(object)){
+                object="";
+            }
+        }
         dataInfo.put(key, object);
     }
 

+ 5 - 15
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -556,9 +556,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		String treeCode = node.getTreeCode();
 		if(StringUtils.isEmpty(treeCode)){
 			//treeCode为null的是业主的节点
-			List<Long> pids = new ArrayList<>();
-			pids.add(node.getProjectId());
-			List<ContractInfo> contractInfos = contractClient.getContractByIds(pids);
+			List<ContractInfo> contractInfos = contractClient.getContractListByProjectId(node.getProjectId());
 			for(ContractInfo contract:contractInfos){
 				if(contract.getContractType()==3){
 					unit=contract.archivesUnit();
@@ -603,10 +601,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 				}
 				storageTime = nodeContract.getStoragePeriod().toString();
 			}else{
-				List<Long> pids= new ArrayList<>();
-				pids.add(archivesAuto.getProjectId());
 				if(contracts==null){
-					contracts = contractClient.queryContractListByIds(pids);
+					contracts = contractClient.getContractListByProjectId(archivesAuto.getProjectId());
 				}
 				for(ContractInfo c:contracts){
 					if(c.getContractType()==3){
@@ -632,10 +628,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 					secretLevel = nodeContract.getSecurityLevel().toString();
 				}
 			}else{
-				List<Long> pids= new ArrayList<>();
-				pids.add(archivesAuto.getProjectId());
 				if(contracts==null){
-					contracts = contractClient.queryContractListByIds(pids);
+					contracts = contractClient.getContractListByProjectId(archivesAuto.getProjectId());
 				}
 				for(ContractInfo c:contracts){
 					if(c.getContractType()==3){
@@ -661,10 +655,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 				}
 				rollor = nodeContract.getFiler();
 			}else{
-				List<Long> pids= new ArrayList<>();
-				pids.add(archivesAuto.getProjectId());
 				if(contracts==null){
-					contracts = contractClient.queryContractListByIds(pids);
+					contracts = contractClient.getContractListByProjectId(archivesAuto.getProjectId());
 				}
 				for(ContractInfo c:contracts){
 					if(c.getContractType()==3){
@@ -686,10 +678,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 				}
 				reviewer = nodeContract.getReviewer();
 			}else{
-				List<Long> pids= new ArrayList<>();
-				pids.add(archivesAuto.getProjectId());
 				if(contracts==null){
-					contracts = contractClient.queryContractListByIds(pids);
+					contracts = contractClient.getContractListByProjectId(archivesAuto.getProjectId());
 				}
 				for(ContractInfo c:contracts){
 					if(c.getContractType()==3){

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

@@ -7,6 +7,7 @@ import com.itextpdf.text.Element;
 import com.itextpdf.text.pdf.*;
 import com.sun.image.codec.jpeg.JPEGCodec;
 import com.sun.image.codec.jpeg.JPEGImageEncoder;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.ListUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
@@ -45,7 +46,7 @@ import java.util.regex.Matcher;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
-
+@Slf4j
 public class FileUtils {
     public static final String DOMAIN_REG = "https?://[^\\.]*\\.oss-cn-shenzhen\\.aliyuncs\\.com/";
 
@@ -447,7 +448,11 @@ public class FileUtils {
                         String suffix = url.substring(lastIndexOf + 1);
                         url = prefix + URLEncoder.encode(suffix, "UTF-8");
                     }
+                    long s = System.currentTimeMillis();
                     PdfReader pdfReader = new PdfReader(url);
+                    long e = System.currentTimeMillis();
+                    log.info("读取pdf耗时:"+(e-s));
+                    s = System.currentTimeMillis();
                     ByteArrayOutputStream out = new ByteArrayOutputStream();
                     PdfStamper pdfStamper = new PdfStamper(pdfReader, out);
                     int index = 1;
@@ -508,6 +513,8 @@ public class FileUtils {
                     }
 
                     out.close();
+                    e = System.currentTimeMillis();
+                    log.info("pdf打码耗时:"+(e-s));
                 } catch (Exception e) {
                     System.out.println(url + "文件不存在");
                     /*用来占位置空*/

+ 6 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ContractClientImpl.java

@@ -80,5 +80,11 @@ public class ContractClientImpl implements ContractClient {
         return R.fail("保存失败");
     }
 
+    @Override
+    public List<ContractInfo> getContractListByProjectId(Long projectId) {
+        List<ContractInfo> list=contractInfoService.getContractListByProjectId(projectId);
+        return list;
+    }
+
 
 }

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

@@ -68,4 +68,5 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
     List<TrialRecordZJTreeLazyVO> trialRelationTreeLazy(String projectId, String contractId, String wbsId, String id);
 
+    List<ContractInfo> getContractListByProjectId(Long projectId);
 }

+ 9 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -399,6 +399,15 @@
               1
     </select>
 
+
+    <select id="getContractListByProjectId" resultType="org.springblade.manager.entity.ContractInfo">
+        SELECT *
+        FROM m_contract_info
+        WHERE p_id = #{projectId}
+          AND is_deleted = 0
+          AND status = 1
+    </select>
+
     <select id="tree4" resultType="org.springblade.manager.vo.WbsTreeContractVO">
         SELECT
         d.*

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

@@ -77,4 +77,5 @@ public interface IContractInfoService extends BaseService<ContractInfo> {
     List<WbsTreeContractVO> addNodeTree(String pKeyId);
 
 
+    List<ContractInfo> getContractListByProjectId(Long projectId);
 }

+ 6 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -204,6 +204,12 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
         return null;
     }
 
+    @Override
+    public List<ContractInfo> getContractListByProjectId(Long projectId) {
+        List<ContractInfo> list=contractInfoMapper.getContractListByProjectId(projectId);
+        return list;
+    }
+
     public List<WbsTreeContractVO> buildWbsTreeByStreamChildNodeTree(List<WbsTreeContractVO> nodes, WbsTreeContract parentNodeRoot) {
         List<WbsTreeContractVO> list = nodes.stream().filter(f -> f.getId().equals(parentNodeRoot.getId())).collect(Collectors.toList());
         Map<Long, List<WbsTreeContractVO>> map = nodes.stream().collect(Collectors.groupingBy(WbsTreeContractVO::getParentId));