瀏覽代碼

Merge remote-tracking branch 'origin/master' into master

yangyj 2 年之前
父節點
當前提交
0a602e0503
共有 14 個文件被更改,包括 305 次插入277 次删除
  1. 6 3
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ContractLog.java
  2. 9 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ContractLogClient.java
  3. 5 3
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/SaveContractLogVO.java
  4. 3 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeVOS.java
  5. 43 254
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  6. 80 3
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java
  7. 5 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.xml
  8. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java
  9. 81 6
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  10. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java
  11. 2 2
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  12. 2 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/bean/TableInfo.java
  13. 65 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  14. 2 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

+ 6 - 3
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ContractLog.java

@@ -83,10 +83,13 @@ public class ContractLog extends BaseEntity {
     @ApiModelProperty("填报人姓名")
     private String createUserName;
 
-    @ApiModelProperty("关联工序的ids")
-    private String correlationId;
-
     @ApiModelProperty("文件名称")
     private String fileName;
 
+    @ApiModelProperty("文件名称")
+    private String pdfUrl;
+
+    @ApiModelProperty("文件名称")
+    private String eVisaPdfUrl;
+
 }

+ 9 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ContractLogClient.java

@@ -1,10 +1,13 @@
 package org.springblade.business.feign;
 
+import com.alibaba.fastjson.JSONObject;
 import org.springblade.business.vo.SaveContractLogVO;
 import org.springblade.common.constant.BusinessConstant;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
 @FeignClient(value =
         BusinessConstant.APPLICATION_WEATHER_NAME
@@ -13,6 +16,12 @@ public interface ContractLogClient {
 
     String API_PREFIX = "/contractLog";
 
+    @GetMapping(API_PREFIX + "/queryContractLogByPrimaryKeyIdAndRecordTime")
+    JSONObject queryContractLogByPrimaryKeyIdAndRecordTime(@RequestParam String nodePrimaryKeyId, @RequestParam String recordTime);
+
+    @GetMapping(API_PREFIX + "/queryContractLogById")
+    JSONObject queryContractLogById(@RequestParam String theLogId);
+
     /**
      * 保存日志信息
      */

+ 5 - 3
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/SaveContractLogVO.java

@@ -1,11 +1,13 @@
 package org.springblade.business.vo;
 
+import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.apache.http.client.utils.DateUtils;
 import org.springblade.core.tool.utils.DateUtil;
 
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class SaveContractLogVO {
@@ -29,16 +31,16 @@ public class SaveContractLogVO {
     private String recordTime;
 
     @ApiModelProperty("关联工序的ids")
-    private String correlationId;
+    private List<JSONObject> correlationIds;
 
-    public SaveContractLogVO(Long businessId, String projectId, String contractId, Long wbsNodeId, Integer wbsNodeType, String recordTime, String correlationId){
+    public SaveContractLogVO(Long businessId, String projectId, String contractId, Long wbsNodeId, Integer wbsNodeType, String recordTime, List<JSONObject> correlationIds){
         this.dataId = businessId;
         this.projectId = Long.parseLong(projectId);
         this.contractId = Long.parseLong(contractId);
         this.wbsNodeId = wbsNodeId;
         this.wbsNodeType = wbsNodeType;
         this.recordTime = recordTime;
-        this.correlationId = correlationId;
+        this.correlationIds = correlationIds;
     }
 
     public SaveContractLogVO(){}

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeVOS.java

@@ -86,6 +86,9 @@ public class WbsTreeContractTreeVOS extends WbsTreeContract implements INode<Wbs
 
     private Long originallyPkeyId;
 
+    @ApiModelProperty("下级子节点数量")
+    private Integer childCount;
+
     @Override
     public List<WbsTreeContractTreeVOS> getChildren() {
         if (this.children == null) {

+ 43 - 254
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -19,10 +19,7 @@ import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.feign.OperationLogClient;
 import org.springblade.business.feign.RecycleBinClient;
 import org.springblade.business.feign.TaskClient;
-import org.springblade.business.feignClient.ClientTreePublicCodeClientImpl;
 import org.springblade.business.service.IConstructionLedgerService;
-import org.springblade.business.service.IContractTreeDrawingsService;
-import org.springblade.business.service.ITreeContractFirstService;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.*;
 import org.springblade.common.utils.CommonUtil;
@@ -77,12 +74,6 @@ public class InformationWriteQueryController extends BladeController {
 
 	private final IDictBizClient dictBizClient;
 
-	private final IContractTreeDrawingsService contractTreeDrawingsService;
-
-	private final ClientTreePublicCodeClientImpl clientTreePublicCodeClient;
-
-	private final ITreeContractFirstService treeContractFirstService;
-
 	private final IConstructionLedgerService constructionLedgerService;
 
 	private final TaskClient taskClient;
@@ -1015,147 +1006,44 @@ public class InformationWriteQueryController extends BladeController {
 			@ApiImplicitParam(name = "wbsType", value = "模板类型, 1质检,2试验", required = true),
 			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
 	})
-	public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam Integer wbsType, @RequestParam String contractId, @RequestParam String contractIdRelation){
-		List<WbsTreeContractTreeVOS> result;
-
-		//获取合同段,检查是否是监理合同段
-		ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
+	public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
+		List<WbsTreeContractTreeVOS> result = this.queryContractTree(parentId, contractId, contractIdRelation);
+		if(result.size() == 1){
+			//只有一个子节点,继续向下
+			int size;
+			WbsTreeContractTreeVOS vos = result.get(0);
+			do {
+				try{
+					List<WbsTreeContractTreeVOS> childResult = this.queryContractTree(vos.getId().toString(), contractId, vos.getContractIdRelation());
 
-		if(contractInfo.getContractType() != null && (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType()))){
-			//监理合同段
-			List<WbsTreeContractTreeVOS> childList = this.wbsTreeContractClient.lazyTree(StringUtils.isNotEmpty(parentId) ? Long.parseLong(parentId) : 0, contractId, contractIdRelation, contractInfo.getContractType());
-			//设置合同段根节点的名称
-			this.setRootNodeName(parentId, childList);
-			if(childList != null && childList.size() == 1){
-				//需要向下展开
-				this.foreachQueryChildNode(childList, contractId, childList.get(0).getContractIdRelation());
-			}
-			if(StringUtils.isEmpty(contractIdRelation) && "0".equals(parentId)){
-				//给个顶点
-				WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
-				vos.setTitle(contractInfo.getContractName());
-				vos.setChildren(childList);
-				result = new ArrayList<>();
-				result.add(vos);
-			} else {
-				result = childList;
-			}
+					vos.setChildren(childResult);
+					size = childResult.size();
+					if(size != 1){
+						break;
+					}
 
-		} else {
-			if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
-				//直接返回
-				result = this.clientTreePublicCodeClient.queryContractWbsTreeByContractIdAndType(contractId, wbsType, "0");
-			} else {
-				//不是根节点,则获取子节点
-				result = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
-				//判断当前节点下是不是只有一个子节点
-				if(result != null && result.size() == 1){
-					this.foreachQueryChildNode(result, contractId);
+					vos = childResult.get(0);
+				}catch (Exception e){
+					e.printStackTrace();
+					break;
 				}
-			}
-		}
 
-		if(result != null){
-			//获取当前父节点下所有工序节点及填报资料
-			List<QueryProcessDataVO> queryDataResult;
-			if(new Integer("2").equals(contractInfo.getContractType())){
-				queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 2, contractIdRelation);
-			} else {
-				queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
-			}
-
-			//删除掉首件工程
-			result.removeIf(vos -> vos.getNodeType() != null && vos.getNodeType() == 111);
-
-
-			result.forEach(vos -> {
-				if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
-					vos.setTitle(contractInfo.getContractName());
-				}
-				if(queryDataResult != null && queryDataResult.size() > 0){
-					//设置颜色
-					this.setNodeColor(vos, queryDataResult, false);
-				}
-				//处理子节点
-				if(vos.getChildren() != null && vos.getChildren().size() > 0){
-					// 去掉首件
-					List<WbsTreeContractTreeVOS> children = vos.getChildren();
-					children = children.stream().filter(vo->vo.getNodeType()!=111).collect(Collectors.toList());
-					vos.setChildren(children);
-					//循环处理节点颜色
-					this.foreachSetNodeColor(children, queryDataResult);
-				}
-			});
+			} while (true);
 		}
 
-		return R.data(result);
-	}
-
-	/**
-	 * 监理查询下级节点
-	 */
-	private void foreachQueryChildNode(List<WbsTreeContractTreeVOS> result, String contractId, String contractIdRelation){
-		result.forEach(vos -> {
-			//查询子节点
-			List<WbsTreeContractTreeVOS> childList = this.wbsTreeContractClient.lazyTree(Long.parseLong(vos.getPrimaryKeyId()), contractId, contractIdRelation, 2);
-			if(childList != null && childList.size() == 1){
-				this.foreachQueryChildNode(childList, contractId, contractIdRelation);
-			}
-			//判断当前节点是否被标记为首件
-			TreeContractFirst first = this.treeContractFirstService.getOne(Wrappers.<TreeContractFirst>lambdaQuery().eq(TreeContractFirst::getIsDeleted, 0).eq(TreeContractFirst::getWbsNodeId, vos.getId()));
-			vos.setIsFirst(first != null);
-
-			vos.setChildren(childList);
-		});
-	}
-
-	/**
-	 * 循环处理节点颜色
-	 */
-	private void foreachSetNodeColor(List<WbsTreeContractTreeVOS> children, List<QueryProcessDataVO> queryDataResult){
-		children.forEach(vos -> {
-			this.setNodeColor(vos, queryDataResult, false);
-			if(vos.getChildren() != null && vos.getChildren().size() > 0){
-				//进一步处理
-				this.foreachSetNodeColor(vos.getChildren(), queryDataResult);
-			}
-		});
-
-	}
+		//获取合同段,检查是否是监理/业主合同段
+		ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
 
-	/**
-	 * 监理合同段设置关联合同段的根节点名称
-	 */
-	private void setRootNodeName(@RequestParam String parentId, List<WbsTreeContractTreeVOS> childList) {
-		if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
-			if(childList != null && childList.size() > 0){
-				childList.forEach(treeNode -> {
-					ContractInfo clientContract = this.contractClient.getContractById(Long.parseLong(treeNode.getContractIdRelation()));
-					if(clientContract != null){
-						treeNode.setTitle(clientContract.getContractName());
-					}
-				});
-			}
+		if((new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) && StringUtils.isEmpty(contractIdRelation) && StringUtils.isEmpty(parentId)){
+			//给个顶点
+			WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
+			vos.setTitle(contractInfo.getContractName());
+			vos.setChildren(result);
+			result = new ArrayList<>();
+			result.add(vos);
 		}
-	}
 
-	/**
-	 * 如果子节点只有一个,则进一步查询该子节点的下级节点
-	 * @param result 子节点集合
-	 */
-	private void foreachQueryChildNode(List<WbsTreeContractTreeVOS> result, String contractId){
-		result.forEach(vos -> {
-			List<WbsTreeContractTreeVOS> child = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, vos.getId().toString());
-			if(child != null && child.size() == 1){
-				//如果子节点还是只有一个,则进一步向下查询
-				this.foreachQueryChildNode(child, contractId);
-			}
-			//判断当前节点是否被标记为首件
-			TreeContractFirst first = this.treeContractFirstService.getOne(Wrappers.<TreeContractFirst>lambdaQuery().eq(TreeContractFirst::getIsDeleted, 0).eq(TreeContractFirst::getWbsNodeId, vos.getPrimaryKeyId()));
-			vos.setIsFirst(first != null);
-
-			vos.setChildren(child);
-		});
+		return R.data(result);
 	}
 
 	/**
@@ -1719,91 +1607,7 @@ public class InformationWriteQueryController extends BladeController {
 		if (StringUtils.isNotEmpty(primaryKeyId)){
 			parentId = primaryKeyId;
 		}
-		List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
-		rootTreeNode = rootTreeNode.stream().filter(vo -> vo.getNodeType() != null && vo.getNodeType() != 111).collect(Collectors.toList());
-
-		return R.data(rootTreeNode);
-	}
-
-	/**
-	 * 设置节点颜色
-	 * 填报节点:
-	 * 未填报1 < 已填报-未上报2 < 已填报-待审批3 < 已审批4
-	 *
-	 * 非填报节点
-	 * 未填报1(其下所有工序节点均未填报) < 已填报2(未上报和待审批) < 已审批4(其下所有工序节点均审批)
-	 *
-	 */
-	private void setNodeColor(WbsTreeContractTreeVOS vos, List<QueryProcessDataVO> queryDataResult, boolean isRemove){
-		if(queryDataResult != null && queryDataResult.size() > 0){
-			Iterator<QueryProcessDataVO> iterator =  queryDataResult.iterator();
-			//默认均未填报
-			StringBuilder colorStatusValue = new StringBuilder();
-			while (iterator.hasNext()) {
-				QueryProcessDataVO query = iterator.next();
-				if(StringUtils.isNotEmpty(query.getAncestors()) && StringUtils.isNotEmpty(String.valueOf(vos.getId()))){
-					if(query.getAncestors().contains(vos.getId().toString()) || query.getAncestors().contains(vos.getPrimaryKeyId()) || query.getAncestors().startsWith(vos.getParentId() + ",") || query.getTreeId().equals(vos.getId().toString()) || query.getTreeId().equals(vos.getPrimaryKeyId())){
-						//如果为空,说明未填报
-						if(query.getStatus() == null || query.getStatus() == -1){
-							colorStatusValue.append("1");
-						} else {
-							switch (query.getStatus()){
-								case 0:
-								case 3:
-									//未上报
-									colorStatusValue.append("2");
-									break;
-								case 1:
-									//待审批
-									colorStatusValue.append("3");
-									break;
-								case 2:
-									//已审批
-									colorStatusValue.append("4");
-									break;
-								default:
-									colorStatusValue.append("1");
-									break;
-							}
-							if(isRemove){
-								iterator.remove();
-							}
-						}
-					}
-				} else {
-					colorStatusValue.append("1");
-				}
-			}
-			//检查字符串
-			if(StringUtils.isNotEmpty(colorStatusValue.toString())){
-				if(new Integer("6").equals(vos.getNodeType())){
-					//工序,则直接使用字符串的判断
-					vos.setColorStatus(new Integer(colorStatusValue.toString()));
-				} else {
-					if(colorStatusValue.toString().contains("1")){
-						//含有1
-						if(colorStatusValue.toString().contains("2") || colorStatusValue.toString().contains("3") || colorStatusValue.toString().contains("4")){
-							//同时含有2/3/4,取2
-							vos.setColorStatus(2);
-						} else {
-							//否则,取1
-							vos.setColorStatus(1);
-						}
-					} else {
-						//不含有1
-						if(colorStatusValue.toString().contains("4") && !colorStatusValue.toString().contains("2") && !colorStatusValue.toString().contains("3")){
-							//只含有4,取4
-							vos.setColorStatus(4);
-						} else {
-							//反之包含2/3,取2
-							vos.setColorStatus(2);
-						}
-					}
-				}
-			} else {
-				vos.setColorStatus(1);
-			}
-		}
+		return R.data(this.queryContractTree(parentId, contractId, contractIdRelation));
 	}
 
 	/**
@@ -1863,39 +1667,24 @@ public class InformationWriteQueryController extends BladeController {
 		//获取合同段,检查是否是监理合同段
 		ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
 		if(new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())){
-			//监理合同段,需要获取关联的施工方合同段根节点数据
-			rootTreeNode = this.wbsTreeContractClient.lazyTree(StringUtils.isNotEmpty(parentId) ? Long.parseLong(parentId) : 0, contractId, contractIdRelation, contractInfo.getContractType());
+			//监理/业主合同段,需要获取关联的施工方合同段根节点数据
+			List<String> contractIds = new ArrayList<>();
+			if(StringUtils.isEmpty(parentId)){
+				contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
+			} else {
+				contractIds.add(contractIdRelation);
+			}
+			if(contractIds.size() > 0){
+				rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, StringUtils.isNotEmpty(parentId) ? parentId : "0", 2);
+			} else {
+				rootTreeNode = new ArrayList<>();
+			}
+
 		} else {
 			//施工合同段
 			rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
 		}
 
-		//其他参数
-		if(rootTreeNode != null && rootTreeNode.size() > 0){
-			//获取当前父节点下所有工序节点及填报资料
-//			List<QueryProcessDataVO> queryDataResult;
-//			if(new Integer("2").equals(contractInfo.getContractType())){
-//				queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 2, contractIdRelation);
-//			} else {
-//				queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
-//			}
-
-			if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
-				rootTreeNode.forEach(vo -> {
-					if(new Integer("1").equals(contractInfo.getContractType())){
-						if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
-							vo.setTitle(contractInfo.getContractName());
-						}
-					}
-
-//				//处理颜色
-//				if(queryDataResult != null && queryDataResult.size() > 0){
-//					this.setNodeColor(vo, queryDataResult, true);
-//				}
-				});
-			}
-		}
-
 		return rootTreeNode;
 	}
 

+ 80 - 3
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java

@@ -1,11 +1,13 @@
 package org.springblade.business.feignClient;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
-import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.ContractLog;
+import org.springblade.business.entity.ContractLogWbs;
 import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.service.IContractLogService;
+import org.springblade.business.service.IContractLogWbsService;
 import org.springblade.business.vo.SaveContractLogVO;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -13,7 +15,10 @@ import org.springblade.core.tenant.annotation.NonDS;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
 
 @RestController
 @AllArgsConstructor
@@ -22,6 +27,20 @@ public class ContractLogClientImpl implements ContractLogClient {
 
     private final IContractLogService contractLogService;
 
+    private final IContractLogWbsService contractLogWbsService;
+
+    @Override
+    public JSONObject queryContractLogByPrimaryKeyIdAndRecordTime(String nodePrimaryKeyId, String recordTime) {
+        ContractLog log = this.contractLogService.getOne(Wrappers.<ContractLog>lambdaQuery().eq(ContractLog::getWbsNodeId, nodePrimaryKeyId).eq(ContractLog::getRecordTime, recordTime));
+        return log != null ? JSONObject.parseObject(JSONObject.toJSONString(log)) : null;
+    }
+
+    @Override
+    public JSONObject queryContractLogById(String theLogId) {
+        ContractLog log = this.contractLogService.getById(theLogId);
+        return log != null ? JSONObject.parseObject(JSONObject.toJSONString(log)) : null;
+    }
+
     @Override
     public void saveContractLog(SaveContractLogVO saveContractLogVO) {
         ContractLog contractLog = new ContractLog();
@@ -31,17 +50,75 @@ public class ContractLogClientImpl implements ContractLogClient {
         if(contractLog.getId() != null){
             //主键不为空,说明是修改
             //修改只修改关联的工序ids
-            if(StringUtils.isNotEmpty(contractLog.getCorrelationId())){
-                this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getContractId, contractLog.getCorrelationId()).set(ContractLog::getUpdateUser, AuthUtil.getUserId()).set(ContractLog::getUpdateTime, new Date()).eq(ContractLog::getId, contractLog.getId().toString()));
+            if(saveContractLogVO.getCorrelationIds() != null && saveContractLogVO.getCorrelationIds().size() > 0){
+                List<ContractLogWbs> oldLogWbsList = this.contractLogWbsService.list(Wrappers.<ContractLogWbs>lambdaQuery().eq(ContractLogWbs::getContractLogId, contractLog.getId()));
+                if(oldLogWbsList.size() > 0){
+                    List<ContractLogWbs> saveList = new ArrayList<>();
+
+                    //检查哪些数据是新增的
+                    List<JSONObject> jsonList = saveContractLogVO.getCorrelationIds();
+                    Iterator<JSONObject> iterator = jsonList.iterator();
+                    while (iterator.hasNext()){
+                        JSONObject next = iterator.next();
+                        for(ContractLogWbs oldWbs : oldLogWbsList){
+                            if(oldWbs.getTreePrimaryKeyId().toString().equals(next.getString("primaryKeyId"))){
+                                //存在则删除
+                                iterator.remove();
+                            }
+                        }
+                    }
+
+                    //检查哪些数据是删除的
+                    Iterator<ContractLogWbs> iterator1 = oldLogWbsList.iterator();
+                    while (iterator1.hasNext()){
+                        ContractLogWbs next = iterator1.next();
+                        for(JSONObject json : jsonList){
+                            if(json.getString("primaryKeyId").equals(next.getTreePrimaryKeyId().toString())){
+                                iterator1.remove();
+                            }
+                        }
+                    }
+
+                    //处理新增数据
+                    jsonList.forEach(json -> saveList.add(this.createContractLogWbs(json, contractLog)));
+                    //删除掉已经被取消的数据
+                    this.contractLogWbsService.removeBatchByIds(oldLogWbsList);
+                    //保存新增的数据
+                    this.contractLogWbsService.saveBatch(saveList);
+
+                }
             }
         } else {
             //新增
             contractLog.setId(SnowFlakeUtil.getId());
+            contractLog.setCreateTime(new Date());
             contractLog.setCreateUser(AuthUtil.getUserId());
             contractLog.setCreateUserName(AuthUtil.getUserName());
+            contractLog.setStatus(0);
+
+            if(saveContractLogVO.getCorrelationIds() != null && saveContractLogVO.getCorrelationIds().size() > 0){
+                List<JSONObject> list = saveContractLogVO.getCorrelationIds();
+                List<ContractLogWbs> logWbsList = new ArrayList<>();
+                //处理数据
+                list.forEach(json -> logWbsList.add(this.createContractLogWbs(json, contractLog)));
+                this.contractLogWbsService.saveBatch(logWbsList);
+            }
 
             this.contractLogService.save(contractLog);
         }
 
     }
+
+    private ContractLogWbs createContractLogWbs(JSONObject json, ContractLog contractLog){
+        ContractLogWbs newLogWbs = new ContractLogWbs();
+        newLogWbs.setId(SnowFlakeUtil.getId());
+        newLogWbs.setContractLogId(contractLog.getId());
+        newLogWbs.setTreePrimaryKeyId(Long.parseLong(json.getString("primaryKeyId")));
+        newLogWbs.setTitle(json.getString("path"));
+        newLogWbs.setCreateTime(new Date());
+        newLogWbs.setCreateUser(AuthUtil.getUserId());
+
+        return newLogWbs;
+    }
+
 }

+ 5 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.xml

@@ -23,6 +23,8 @@
         <result column="data_id" property="dataId"/>
         <result column="create_user_name" property="createUserName"/>
         <result column="file_name" property="fileName"/>
+        <result column="pdf_url" property="pdfUrl"/>
+        <result column="e_visa_pdf_url" property="eVisaPdfUrl"/>
     </resultMap>
 
     <select id="getSubmitLogDateList" resultType="java.lang.String">
@@ -43,7 +45,9 @@
           data_id,
           create_user_name,
           file_name,
-          status
+          status,
+          pdf_url,
+          e_visa_pdf_url
         from
           u_contract_log
         where

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java

@@ -33,7 +33,7 @@ import org.springblade.manager.vo.WbsTreeContractTreeVOS;
  */
 public interface InformationQueryMapper extends BaseMapper<InformationQuery> {
 
-	List<WbsTreeContractTreeVOS> queryContractTreeSupervision(@Param("contractId") String contractId, @Param("primaryKeyIds") List<String> primaryKeyIds, @Param("parentId") String parentId, @Param("classify") Integer classify);
+	List<WbsTreeContractTreeVOS> queryContractTreeSupervision(@Param("contractIds") List<String> contractIds, @Param("parentId") String parentId, @Param("classify") Integer classify);
 
 	List<WbsTreeContractTreeVOS> queryContractTree(@Param("contractId") String contractId, @Param("parentId") String parentId, @Param("classify") Integer classify);
 

+ 81 - 6
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -52,6 +52,8 @@
         <result column="title" property="title"/>
         <result column="parentId" property="parentId"/>
         <result column="contractId" property="contractId"/>
+        <result column="contractIdRelation" property="contractIdRelation"/>
+        <result column="childCount" property="childCount"/>
         <result column="oldId" property="oldId"/>
         <result column="majorDataType" property="majorDataType"/>
         <result column="leaf" property="leaf"/>
@@ -66,14 +68,86 @@
     <resultMap id="intResultMap" type="java.lang.Integer"/>
 
     <select id="queryContractTreeSupervision" resultMap="queryContractTreeMap">
-
+        SELECT
+            wtc.p_key_id AS primaryKeyId,
+            wtc.id,
+            CASE wtc.parent_id
+            WHEN 0 THEN (select ci.contract_name from m_contract_info AS ci where wtc.contract_id = ci.id)
+            ELSE IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.dept_name),wtc.dept_name) END AS title,
+            wtc.parent_id AS parentId,
+            wtc.contract_id AS contractIdRelation,
+            wtc.old_id AS oldId,
+            wtc.major_data_type AS majorDataType,
+            CASE
+                wtc.dept_category
+            WHEN 6 THEN 'true'
+            ELSE 'false' END AS leaf,
+            CASE
+                (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id = wtc.contract_id and tc.type = 1 and tc.is_deleted = 0 and tc.dept_category != 111)
+            WHEN 0 THEN 'true'
+            ELSE 'false' END AS notExsitChild,
+            (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id = wtc.contract_id and tc.type = 1 and tc.is_deleted = 0 and tc.dept_category != 111) AS childCount,
+            ctd.file_url AS fileUrl,
+            ctd.id AS drawingsId,
+            CASE
+                (select count(tcf.id) from u_tree_contract_first AS tcf where tcf.is_deleted = 0 and tcf.wbs_node_id = wtc.p_key_id)
+            WHEN 0 THEN 'false'
+            ELSE 'true' END AS isFirst,
+            querys.nodeStatus AS colorStatus
+        FROM
+            m_wbs_tree_contract AS wtc
+        LEFT JOIN u_contract_tree_drawings AS ctd ON ctd.is_deleted = 0 and ctd.process_id = wtc.p_key_id
+        LEFT JOIN (
+            SELECT
+                querys.pKeyId AS pKeyId,
+                CASE
+                WHEN querys.nodeStatus LIKE CONCAT('%',1,'%') AND (querys.nodeStatus NOT LIKE CONCAT('%',2,'%') AND querys.nodeStatus NOT LIKE CONCAT('%',3,'%') AND querys.nodeStatus NOT LIKE CONCAT('%',4,'%')) THEN 1
+                WHEN querys.nodeStatus LIKE CONCAT('%',1,'%') AND (querys.nodeStatus LIKE CONCAT('%',2,'%') OR querys.nodeStatus LIKE CONCAT('%',3,'%') OR querys.nodeStatus LIKE CONCAT('%',4,'%')) THEN 2
+                WHEN querys.nodeStatus NOT LIKE CONCAT('%',1,'%') AND querys.nodeStatus LIKE CONCAT('%',4,'%') AND (querys.nodeStatus LIKE CONCAT('%',2,'%') OR querys.nodeStatus LIKE CONCAT('%',3,'%')) THEN 4
+                ELSE 2 END AS nodeStatus
+            FROM
+            (
+                SELECT
+                    wtc.p_key_id AS pKeyId,
+                    group_concat(
+                                CASE
+                                WHEN iq.status is null THEN 1
+                                WHEN iq.status = 1 THEN 3
+                                WHEN iq.status = 2 THEN 4
+                                ELSE 2 END
+                            ) AS nodeStatus
+                FROM
+                    m_wbs_tree_contract AS wtc
+                LEFT JOIN m_wbs_tree_contract AS wtc1 ON wtc1.ancestors like concat('%', wtc.id, '%') AND wtc1.is_deleted = 0 and wtc1.contract_id = wtc.contract_id AND wtc1.major_data_type IN(1,2,3,4)
+                LEFT JOIN u_information_query AS iq ON (iq.wbs_id = wtc1.p_key_id OR iq.wbs_id = wtc.p_key_id) AND classify = #{classify}
+                WHERE
+                    wtc.contract_id IN
+                <foreach collection="contractIds" item="contractId" open="(" separator="," close=")">
+                    #{contractId}
+                </foreach>
+                and wtc.parent_id = #{parentId}
+                and wtc.is_deleted= '0'
+                group by wtc.p_key_id
+            ) AS querys
+        ) AS querys ON wtc.p_key_id = querys.pKeyId
+        where
+            wtc.contract_id IN
+        <foreach collection="contractIds" item="contractId" open="(" separator="," close=")">
+            #{contractId}
+        </foreach>
+        and wtc.parent_id = #{parentId}
+        and wtc.dept_category != 111
+        and wtc.type = 1
+        and wtc.is_deleted= '0'
     </select>
 
     <select id="queryContractTree" resultMap="queryContractTreeMap">
         SELECT
             wtc.p_key_id AS primaryKeyId,
             wtc.id,
-            IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name),wtc.node_name) AS title,
+            CASE wtc.parent_id
+            WHEN 0 THEN (select ci.contract_name from m_contract_info AS ci where wtc.contract_id = ci.id)
+            ELSE IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name),wtc.node_name) END AS title,
             wtc.parent_id AS parentId,
             wtc.contract_id AS contractId,
             wtc.old_id AS oldId,
@@ -84,7 +158,7 @@
             WHEN 6 THEN 'true'
             ELSE 'false' END AS leaf,
             CASE
-                (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id = #{contractId} and tc.type = 1 and tc.is_deleted = 0)
+                (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id = #{contractId} and tc.type = 1 and tc.is_deleted = 0 and tc.node_type != 111)
             WHEN 0 THEN 'true'
             ELSE 'false' END AS notExsitChild,
             ctd.file_url AS fileUrl,
@@ -120,19 +194,20 @@
                 FROM
                     m_wbs_tree_contract AS wtc
                 LEFT JOIN m_wbs_tree_contract AS wtc1 ON wtc1.ancestors like concat('%', wtc.id, '%') AND wtc1.is_deleted = 0 and wtc1.contract_id = wtc.contract_id AND wtc1.major_data_type IN(1,2,3,4)
-                LEFT JOIN u_information_query AS iq ON (iq.wbs_id = wtc1.p_key_id OR iq.wbs_id = wtc.p_key_id)
+                LEFT JOIN u_information_query AS iq ON (iq.wbs_id = wtc1.p_key_id OR iq.wbs_id = wtc.p_key_id) AND iq.classify = #{classify}
                 WHERE
                     wtc.contract_id = #{contractId}
                 and wtc.parent_id = #{parentId}
                 and wtc.is_deleted= '0'
-                AND wtc.type = #{classify}
+                AND wtc.type = 1
                 group by wtc.p_key_id
             ) AS querys
         ) AS querys ON wtc.p_key_id = querys.pKeyId
         WHERE
             wtc.contract_id = #{contractId}
-        AND wtc.type = #{classify}
+        AND wtc.type = 1
         AND wtc.parent_id = #{parentId}
+        AND wtc.node_type != 111
         AND wtc.is_deleted= '0'
         ORDER BY wtc.sort ASC
     </select>

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

@@ -44,7 +44,7 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
 	/**
 	 * 获取合同段树(监理方)
 	 */
-	List<WbsTreeContractTreeVOS> queryContractTreeSupervision(String contractId, List<String> primaryKeyIds, String parentId, Integer classify);
+	List<WbsTreeContractTreeVOS> queryContractTreeSupervision(List<String> contractIds, String parentId, Integer classify);
 
 	/**
 	 * 获取合同段树(施工方)

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

@@ -69,8 +69,8 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 	}
 
 	@Override
-	public List<WbsTreeContractTreeVOS> queryContractTreeSupervision(String contractId, List<String> primaryKeyIds, String parentId, Integer classify) {
-		return this.baseMapper.queryContractTree(contractId, parentId, classify);
+	public List<WbsTreeContractTreeVOS> queryContractTreeSupervision(List<String> contractIds, String parentId, Integer classify) {
+		return this.baseMapper.queryContractTreeSupervision(contractIds, parentId, classify);
 	}
 
 	@Override

+ 2 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/bean/TableInfo.java

@@ -3,6 +3,7 @@ package org.springblade.manager.bean;
 import lombok.Data;
 
 import java.util.LinkedHashMap;
+import java.util.List;
 
 /**
  * @author yangyj
@@ -33,7 +34,7 @@ public class TableInfo {
      */
     private String theLogId;
 
-    private String linkTabIds;
+    private List<Object> linkTabIds;
 
     private String recordTime;
 

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

@@ -14,7 +14,10 @@ import com.itextpdf.io.font.FontProgram;
 import com.itextpdf.io.font.FontProgramFactory;
 import com.itextpdf.layout.font.FontProvider;
 import com.spire.xls.*;
+import com.spire.xls.core.IStyle;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
+import com.spire.xls.core.spreadsheet.pivottables.PivotStyle;
+import com.spire.xls.core.spreadsheet.shapes.XlsTextBoxShape;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
@@ -24,6 +27,7 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
+import org.springblade.business.feign.ContractLogClient;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.MathUtil;
@@ -118,6 +122,8 @@ public class ExcelTabController extends BladeController {
     // 表单字典信息表
     private final ITextdictInfoService textdictInfoService;
 
+    private final ContractLogClient contractLogClient;
+
     /**
      * 详情
      */
@@ -1694,4 +1700,63 @@ public class ExcelTabController extends BladeController {
         return R.success("上传成功");
     }
 
+    /**
+     * 日志预览
+     */
+    @GetMapping("/get-the-log-pdfInfo")
+    @ApiOperationSupport(order = 25)
+    @ApiOperation(value = "日志预览")
+    @ApiImplicitParam(name = "theLogId", value = "日志ID", required = true)
+    public R<String> getTheLogPdInfo(String theLogId, String nodePrimaryKeyId, String recordTime) throws Exception{
+        //获取配置的路径
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+
+        //获取对应的日志
+        JSONObject theLogJson = this.contractLogClient.queryContractLogById(theLogId);
+        if(theLogJson != null){
+            //查询对应的html
+            WbsTreePrivate node = this.wbsTreePrivateService.getById(theLogJson.getString("wbsNodeId"));
+            //获取表格
+            WbsTreePrivate tableNode = this.wbsTreePrivateService.getById(node.getExcelId());
+
+            if(tableNode == null){
+                return R.fail("该数据下无此节点!");
+            }
+
+            if(StringUtils.isEmpty(tableNode.getHtmlUrl())){
+                return R.fail("请关联清表!");
+            }
+
+            String pdfPath = file_path + "/pdf//" + theLogId + ".pdf";
+            File tabpdf = ResourceUtil.getFile(pdfPath);
+            if (tabpdf.exists()) {
+                tabpdf.delete();
+            }
+
+            // 获取清表信息
+            ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
+
+            if (excelTab == null) {
+                return R.fail("失败");
+            }
+
+
+
+        }
+
+        return R.data(null);
+    }
+
+    @GetMapping("/get-the-log-business-data")
+    @ApiOperationSupport(order = 25)
+    @ApiOperation(value = "获取当前用户当前日期的填报记录")
+    @ApiImplicitParam(name = "theLogId", value = "日志ID", required = true)
+    public R getTheLogBusinessData(String nodePrimaryKeyId, String recordTime) {
+        Map<String, Object> resultMap = new HashMap<>();
+        //获取对应的记录
+
+
+        return R.data(null);
+    }
+
 }

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

@@ -180,7 +180,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
 				//huangjn 日志勾选的工序
 				if(dataInfo2.containsKey("linkTabIds")){
-					tableInfo.setLinkTabIds(dataInfo2.getString("linkTabIds"));
+					tableInfo.setLinkTabIds(dataInfo2.getJSONArray("linkTabIds"));
 				}
 				//huangjn 日志勾选的工序
 
@@ -289,7 +289,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 		if(StringUtils.isEmpty(businessId)){
 			businessId = SnowFlakeUtil.getId().toString();
 		}
-		String linkTabIds = tableInfoList.get(0).getLinkTabIds();
+		List<JSONObject> linkTabIds = JSONArray.parseArray(JSONObject.toJSONString(tableInfoList.get(0).getLinkTabIds()), JSONObject.class);
 		String recordTime = tableInfoList.get(0).getRecordTime();
 		if(StringUtils.isEmpty(recordTime)){
 			//为空,默认今天