Преглед изворни кода

Merge branch 'master' of http://47.110.251.215:3000/java_org/bladex

huangtf пре 2 година
родитељ
комит
8d49b964cb
13 измењених фајлова са 162 додато и 56 уклоњено
  1. 10 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/CopyContractTreeNodeVO.java
  2. 4 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ContractClient.java
  3. 17 13
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java
  4. 5 15
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  5. 8 1
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileUtils.java
  6. 84 27
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  7. 5 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java
  8. 6 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  9. 6 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ContractClientImpl.java
  10. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java
  11. 9 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml
  12. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java
  13. 6 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

+ 10 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/CopyContractTreeNodeVO.java

@@ -55,6 +55,8 @@ public class CopyContractTreeNodeVO {
 
         private Integer isSameNode; //是否同节点(多份复制 同节点=1,不同节点/跨节点=0)
 
+        private String title;
+
         public CopyBatch() {
         }
 
@@ -65,6 +67,14 @@ public class CopyContractTreeNodeVO {
             this.isSameNode = isSameNode;
         }
 
+        public CopyBatch(String title,String primaryKeyId, String nodeName, String partitionCode, Integer isSameNode) {
+            this.title = title;
+            this.primaryKeyId = primaryKeyId;
+            this.nodeName = nodeName;
+            this.partitionCode = partitionCode;
+            this.isSameNode = isSameNode;
+        }
+
     }
 
 }

+ 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 + "文件不存在");
                     /*用来占位置空*/

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

@@ -1653,17 +1653,27 @@ public class InformationWriteQueryController extends BladeController {
                         //更新redis缓存
                         informationQueryService.delAsyncWbsTree(contractId);
                     }
-                    String nodeName = vo.getNeedCopyNodeName();
+                    //拼接操作记录
+                    List<CopyContractTreeNodeVO.CopyBatch> list = vo.getCopyBatchToPaths();
+                    Set<String> titles = new HashSet<>();
+                    list.stream().forEach(l->titles.add(l.getTitle()));
                     StringBuilder addNames = new StringBuilder();
-                    addNames.append(nodeName+"-");
-                    addNames.append("[");
-                    for (WbsTreeContract node : toCopyNodes) {
-                        addNames.append(node.getNodeName() + "-");
+                    addNames.append("{");
+                    for (String title : titles) {
+                        addNames.append(title+"-[");
+                        for (CopyContractTreeNodeVO.CopyBatch li : list) {
+                            if (title.equals(li.getTitle())){
+                                addNames.append(li.getNodeName()+",");
+                            }
+                        }
+                        addNames.setLength(addNames.length()-1);
+                        addNames.append("],");
                     }
-                    String substring = addNames.substring(0, addNames.length() - 1);
-                    needCopyNodeRoot.setNodeName(substring + "]");
+                    addNames.setLength(addNames.length()-1);
+                    addNames.append("}");
+                    needCopyNodeRoot.setNodeName(addNames.toString());
 //                    return R.success("操作成功");
-                    return this.saveOrCopyNodeTree(addNodeList, null, 32, needCopyNodeRoot);
+                    return this.saveOrCopyNodeTree2(addNodeList, null, 32, needCopyNodeRoot);
                 } else {
                     throw new ServiceException("没有找到需要复制的节点信息,请联系管理员");
                 }
@@ -2552,25 +2562,25 @@ public class InformationWriteQueryController extends BladeController {
         //获取被删除节点名称
         //String nodeName = StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName() + "," + removeNodeList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getNodeName()).collect(Collectors.joining());
 
-        //获取当前节点下所有填报节点
-        List<QueryProcessDataVO> queryProcess = new ArrayList<>();
-        if (!Arrays.asList("1,2,3,4".split(",")).contains(removeNode.getMajorDataType().toString())) {
-            queryProcess = this.informationQueryService.queryProcessDataByParentIdAndContractId(removeNode.getId().toString(), 1, removeNode.getContractId());
-            if (queryProcess == null || queryProcess.size() == 0) {
-                //填报节点
-                queryProcess = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(removeNode.getPKeyId().toString(), 1);
-            }
-        }
-
-        if (queryProcess != null && queryProcess.size() > 0) {
-            //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
-            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId() != null).collect(Collectors.toList());
-            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus()) && vo.getInformationQueryId() != null).collect(Collectors.toList());
-            if (approvalList.size() > 0 || runTaskList.size() > 0) {
-                //说明存在已经审批或已经上报的节点,不允许删除
-                return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
-            }
-        }
+//        //获取当前节点下所有填报节点
+//        List<QueryProcessDataVO> queryProcess = new ArrayList<>();
+//        if (!Arrays.asList("1,2,3,4".split(",")).contains(removeNode.getMajorDataType().toString())) {
+//            queryProcess = this.informationQueryService.queryProcessDataByParentIdAndContractId2(removeNode.getId().toString(), 1, removeNode.getContractId());
+//            if (queryProcess == null || queryProcess.size() == 0) {
+//                //填报节点
+//                queryProcess = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(removeNode.getPKeyId().toString(), 1);
+//            }
+//        }
+//
+//        if (queryProcess != null && queryProcess.size() > 0) {
+//            //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
+//            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId() != null).collect(Collectors.toList());
+//            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus()) && vo.getInformationQueryId() != null).collect(Collectors.toList());
+//            if (approvalList.size() > 0 || runTaskList.size() > 0) {
+//                //说明存在已经审批或已经上报的节点,不允许删除
+//                return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
+//            }
+//        }
 
         //保存操作记录
         List<String> idArray = JSONArray.parseArray(JSONObject.toJSONString(ids.split(",")), String.class);
@@ -2882,6 +2892,53 @@ public class InformationWriteQueryController extends BladeController {
         return R.data(false);
     }
 
+    @NotNull
+    private R<Boolean> saveOrCopyNodeTree2
+            (List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger, Integer
+                    operationType, WbsTreeContract currentNode) {
+
+        if (saveList.size() > 0) {
+//            StringBuilder str = new StringBuilder();
+//            str.append("-" + saveList.get(0).getFullName());
+            //保存施工日志
+            /*if (saveLedger.size() > 0) {
+                this.constructionLedgerService.saveBatch(saveLedger, 1000);
+                str.append("-[");
+                for (ConstructionLedger ledger : saveLedger) {
+                    str.append(ledger.getSite() + ",");
+                }
+                str.deleteCharAt(str.length() - 1);
+                str.append("]");
+            }*/
+
+            try {
+                //获取当前节点的所有父节点
+                List<WbsTreeContract> result = new ArrayList<>();
+                result.add(currentNode);
+                this.queryParentNode(currentNode, result);
+                StringBuilder pathName = new StringBuilder();
+                for (int i = 1, l = result.size()-1; i < l; i++) {
+                    WbsTreeContract node = result.get(result.size() - i);
+                    pathName.append("-").append(StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
+                }
+                pathName.append("-" + currentNode.getNodeName());
+                JSONObject json = new JSONObject();
+                json.put("operationObjIds", JSONArray.parseArray(JSONObject.toJSONString(saveList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList())), String.class));
+                json.put("operationObjName", pathName.substring(1));
+                //保存操作记录
+                this.operationLogClient.saveUserOperationLog(operationType, "资料管理", "工序资料", json);
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            //保存节点(10s)
+            Boolean aBoolean = this.wbsTreeContractClient.saveBatch(saveList);
+            return R.data(aBoolean);
+        }
+
+        return R.data(false);
+    }
+
     private void queryParentNode(WbsTreeContract currentNode, List<WbsTreeContract> result) {
         WbsTreeContract parentNode = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(currentNode.getParentId(), Long.parseLong(currentNode.getContractId()));
         if (parentNode != null) {

+ 5 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java

@@ -63,6 +63,11 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
      */
     List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId(String parentId, Integer classify, String contractId);
 
+    /**
+     * 查询工序节点的填报记录
+     */
+    List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId2(String parentId, Integer classify, String contractId);
+
     /**
      * 查询工序节点的填报记录,简化
      */

+ 6 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -148,6 +148,12 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
         }
         return result;
     }
+    //删除节点用
+    @Override
+    public List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId2(String parentId, Integer classify, String contractId) {
+        List<QueryProcessDataVO> result = this.baseMapper.queryProcessDataByParentIdAndContractId(parentId, classify, contractId);
+        return result;
+    }
 
     //简化
     @Override

+ 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));