huangjn 2 年之前
父节点
当前提交
3b08feaa53

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

@@ -1605,10 +1605,10 @@ public class InformationWriteQueryController extends BladeController {
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "获取当前合同段下所有的上报批次")
 	@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
-	public R<List<Integer>> getReportNumberByContractId(@RequestParam String contractId){
+	public R<List<Integer>> getReportNumberByContractId(@RequestParam String contractId, String contractIdRelation){
 		//获取合同段信息
 		ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
-		return R.data(this.informationQueryService.getReportNumberByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), contractId));
+		return R.data(this.informationQueryService.getReportNumberByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), StringUtils.isNotEmpty(contractIdRelation) ? contractIdRelation : contractId));
 	}
 
 	/**
@@ -1720,7 +1720,7 @@ public class InformationWriteQueryController extends BladeController {
 			parentId = primaryKeyId;
 		}
 		List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
-		rootTreeNode = rootTreeNode.stream().filter(vo -> vo.getDeptCategory() != 111).collect(Collectors.toList());
+		rootTreeNode = rootTreeNode.stream().filter(vo -> vo.getDeptCategory() != null && vo.getDeptCategory() != 111).collect(Collectors.toList());
 
 		return R.data(rootTreeNode);
 	}
@@ -1866,14 +1866,8 @@ public class InformationWriteQueryController extends BladeController {
 			//监理合同段,需要获取关联的施工方合同段根节点数据
 			rootTreeNode = this.wbsTreeContractClient.lazyTree(StringUtils.isNotEmpty(parentId) ? Long.parseLong(parentId) : 0, contractId, contractIdRelation, contractInfo.getContractType());
 		} else {
-			if(com.alibaba.nacos.common.utils.StringUtils.isEmpty(parentId)){
-				//为空,说明初始化
-				//获取根节点
-				rootTreeNode = this.clientTreePublicCodeClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
-			} else {
-				//不为空,获取其下子节点
-				rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
-			}
+			//施工合同段
+			rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
 		}
 
 		//其他参数
@@ -1887,32 +1881,16 @@ public class InformationWriteQueryController extends BladeController {
 			}
 
 			rootTreeNode.forEach(vo -> {
-//				String primaryKeyId = new Integer("2").equals(contractInfo.getContractType()) ? vo.getId().toString() : vo.getPrimaryKeyId();
-				String primaryKeyId = vo.getPrimaryKeyId();
-
 				if(new Integer("1").equals(contractInfo.getContractType())){
 					if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
 						vo.setTitle(contractInfo.getContractName());
 					}
 				}
 
-				//获取上传的图纸
-				ContractTreeDrawings drawings = this.contractTreeDrawingsService.queryCurrentNodeDrawings(primaryKeyId);
-				if(drawings != null){
-					//主键
-					vo.setDrawingsId(drawings.getId());
-					//文件路径
-					vo.setFileUrl(drawings.getFileUrl());
-				}
-
 				//处理颜色
 				if(queryDataResult != null && queryDataResult.size() > 0){
 					this.setNodeColor(vo, queryDataResult, true);
 				}
-
-				//判断当前节点是否被标记为首件
-				TreeContractFirst first = this.treeContractFirstService.getOne(Wrappers.<TreeContractFirst>lambdaQuery().eq(TreeContractFirst::getIsDeleted, 0).eq(TreeContractFirst::getWbsNodeId, primaryKeyId));
-				vo.setIsFirst(first != null);
 			});
 		}
 

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

@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.business.vo.QueryProcessDataVO;
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 
 /**
  *  Mapper 接口
@@ -32,6 +33,8 @@ import org.springblade.business.vo.QueryProcessDataVO;
  */
 public interface InformationQueryMapper extends BaseMapper<InformationQuery> {
 
+	List<WbsTreeContractTreeVOS> queryContractTree(@Param("contractId") String contractId, @Param("parentId") String parentId, @Param("classify") Integer classify);
+
 	List<QueryProcessDataVO> queryProcessDataByPrimaryKeyIdAndClassify(@Param("primaryKeyId") String primaryKeyId, @Param("classify") Integer classify);
 
 	/**

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

@@ -46,8 +46,88 @@
         <result column="evaluate" property="evaluate"/>
     </resultMap>
 
+    <resultMap id="queryContractTreeMap" type="org.springblade.manager.vo.WbsTreeContractTreeVOS">
+        <result column="primaryKeyId" property="primaryKeyId"/>
+        <result column="id" property="id"/>
+        <result column="title" property="title"/>
+        <result column="parentId" property="parentId"/>
+        <result column="contractId" property="contractId"/>
+        <result column="oldId" property="oldId"/>
+        <result column="majorDataType" property="majorDataType"/>
+        <result column="leaf" property="leaf"/>
+        <result column="notExsitChild" property="notExsitChild"/>
+        <result column="fileUrl" property="fileUrl"/>
+        <result column="drawingsId" property="drawingsId"/>
+        <result column="isFirst" property="isFirst"/>
+        <result column="deptCategory" property="deptCategory"/>
+        <result column="colorStatus" property="colorStatus"/>
+    </resultMap>
+
     <resultMap id="intResultMap" type="java.lang.Integer"/>
 
+    <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.dept_name),wtc.dept_name) AS title,
+            wtc.parent_id AS parentId,
+            wtc.contract_id AS contractId,
+            wtc.old_id AS oldId,
+            wtc.major_data_type AS majorDataType,
+            wtc.dept_category AS deptCategory,
+            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 = #{contractId} and tc.type = 1 and tc.is_deleted = 0)
+            WHEN 0 THEN 'true'
+            ELSE 'false' END AS notExsitChild,
+            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
+                #{parentId} AS parentId,
+                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
+                    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 tc
+                LEFT JOIN u_information_query AS iq ON tc.p_key_id = iq.wbs_id
+                WHERE
+                    tc.major_data_type in(1,2,3,4)
+                AND tc.ancestors LIKE concat('%', #{parentId}, '%')
+                AND tc.contract_id = #{contractId}
+            ) AS querys
+        ) AS querys ON wtc.parent_id = querys.parentId
+        WHERE
+            wtc.contract_id = #{contractId}
+        AND wtc.type = #{classify}
+        AND wtc.parent_id = #{parentId}
+        AND wtc.is_deleted= '0'
+        ORDER BY wtc.sort ASC
+    </select>
+
     <select id="queryProcessDataByPrimaryKeyIdAndClassify" resultMap="queryProcessDataMap">
         SELECT
             wtc.id AS treeId,
@@ -124,7 +204,7 @@
     </select>
 
     <select id="getReportNumberByContractId" resultMap="intResultMap">
-        select report_number from u_information_query where is_deleted = 0 and contract_id = #{contractId} and classify = #{classify} group by report_number order by report_number ASC
+        select report_number from u_information_query where is_deleted = 0 and contract_id = #{contractId} and classify = #{classify} and report_number is not null group by report_number order by report_number ASC
     </select>
 
     <select id="queryFileUserByContractId" resultMap="informationQueryResultMap">

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

@@ -22,6 +22,7 @@ import org.springblade.business.vo.InformationQueryVO;
 import org.springblade.business.vo.QueryProcessDataVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 
 import java.util.List;
 
@@ -33,6 +34,11 @@ import java.util.List;
  */
 public interface IInformationQueryService extends BaseService<InformationQuery> {
 
+	/**
+	 * 获取合同段树
+	 */
+	List<WbsTreeContractTreeVOS> queryContractTree(String contractId, String parentId, Integer classify);
+
 	/**
 	 * 查询工序节点的填报记录
 	 */

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

@@ -21,6 +21,7 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.feign.WbsTreeContractClient;
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
@@ -47,6 +48,11 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 
 	private final ITaskParallelService taskParallelService;
 
+	@Override
+	public List<WbsTreeContractTreeVOS> queryContractTree(String contractId, String parentId, Integer classify) {
+		return this.baseMapper.queryContractTree(contractId, parentId, classify);
+	}
+
 	@Override
 	public List<QueryProcessDataVO> queryProcessDataByPrimaryKeyIdAndClassify(String primaryKeyId, Integer classify) {
 		return this.baseMapper.queryProcessDataByPrimaryKeyIdAndClassify(primaryKeyId, classify);
@@ -195,6 +201,10 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 			vo.setFileUserIdAndName(vo.getFileUserIdAndName().split("-")[0]);
 		}
 
+		if(vo.getStatus() != null){
+			vo.setTaskStatus(vo.getStatus().toString());
+		}
+
 		//获取总量
 		Integer count = this.baseMapper.countInformationQuery(vo);