huangjn 3 lat temu
rodzic
commit
8e1f0dd98a
15 zmienionych plików z 870 dodań i 1 usunięć
  1. 34 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/InformationQueryDTO.java
  2. 109 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java
  3. 32 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/InformationQueryClient.java
  4. 19 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/FileUserVO.java
  5. 51 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/InformationQueryVO.java
  6. 9 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java
  7. 201 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationQueryController.java
  8. 0 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java
  9. 19 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/InformationQueryClientImpl.java
  10. 68 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java
  11. 95 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  12. 68 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java
  13. 146 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  14. 10 0
      blade-service/blade-business/src/main/java/sql/informationquery.menu.sql
  15. 9 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

+ 34 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/InformationQueryDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.dto;
+
+import org.springblade.business.entity.InformationQuery;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-06-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class InformationQueryDTO extends InformationQuery {
+	private static final long serialVersionUID = 1L;
+
+}

+ 109 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java

@@ -0,0 +1,109 @@
+package org.springblade.business.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-06-08
+ */
+@Data
+@TableName("u_information_query")
+@EqualsAndHashCode(callSuper = true)
+public class InformationQuery extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 文件名称
+     */
+	@ApiModelProperty("文件名称")
+    private String name;
+    /**
+     * 文件编号
+     */
+	@ApiModelProperty("文件编号")
+    private String number;
+    /**
+     * 与m_wbs_tree_contract的dept_category一致
+     */
+	@ApiModelProperty("类型")
+    private Integer category;
+    /**
+     * 上级节点ID
+     */
+	@ApiModelProperty("上级节点ID")
+    private Long parentId;
+    /**
+     * 项目ID
+     */
+	@ApiModelProperty("项目ID")
+    private Long projectId;
+    /**
+     * 合同段ID
+     */
+	@ApiModelProperty("合同段ID")
+    private Long contractId;
+    /**
+     * 1施工2质检
+     */
+	@ApiModelProperty("1施工2质检")
+    private Integer classify;
+    /**
+     * 节点ID
+     */
+    @ApiModelProperty("节点ID")
+    private Long wbsId;
+    /**
+     * 是否是试验资料,1是试验
+     */
+	@ApiModelProperty("是否是试验资料,1是试验")
+    private Integer isExperiment;
+    /**
+     * 数据ID
+     */
+	@ApiModelProperty("数据ID")
+    private Long dataId;
+    /**
+     * 施工资料的流程ID
+     */
+	@ApiModelProperty("资料的流程ID")
+    private Long taskId;
+    /**
+     * 1未上报,2待审批,3已审批
+     */
+	@ApiModelProperty("资料流程状态,1未上报,2待审批,3已审批")
+    private Integer taskStatus;
+    /**
+     * 填报人ID及姓名,多人则逗号拼接,ID与姓名间用 - 隔开
+     */
+	@ApiModelProperty("填报人ID及姓名,多人则逗号拼接,ID与姓名间用 - 隔开")
+    private String fileUserIdAndName;
+    /**
+     * 审批人ID及姓名,多人则逗号拼接,ID与姓名间用 - 隔开
+     */
+	@ApiModelProperty("审批人ID及姓名,多人则逗号拼接,ID与姓名间用 - 隔开")
+    private String auditUserIdAndName;
+    /**
+     * 上报批次,施工质检共用
+     */
+	@ApiModelProperty("上报批次,施工质检共用")
+    private Integer reportNumber;
+    /**
+     * 00施工质检未完成,10施工已完成质检未完成,01施工未完成质检已完成,11施工质检已完成
+     */
+	@ApiModelProperty("00施工质检未完成,10施工已完成质检未完成,01施工未完成质检已完成,11施工质检已完成")
+    private String completionStatus;
+    /**
+     * 数据源类型,1原生,2数字化
+     */
+    @ApiModelProperty("数据源类型,1原生,2数字化")
+    private Integer sourceType;
+
+}

+ 32 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/InformationQueryClient.java

@@ -0,0 +1,32 @@
+package org.springblade.business.feign;
+
+import org.springblade.common.constant.BusinessConstant;
+import org.springblade.core.secure.BladeUser;
+import org.springframework.cloud.openfeign.FeignClient;
+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
+)
+public interface InformationQueryClient {
+
+    /**
+     * 接口前缀
+     */
+    String API_PREFIX = "/api/business/informationQuery";
+
+    /**
+     * 保存填报时新增或修改填报资料记录表数据
+     * @param user 当前操作用户
+     * @param wbsId 当前填报节点
+     * @param fileName 文件题名
+     * @param classify 1施工2质检
+     * @param sourceType 1原生2数据化
+     * @param dataId 1原生2数据化
+     */
+    @PostMapping(API_PREFIX + "/saveOrUpdateInformationQueryData")
+    void saveOrUpdateInformationQueryData(@RequestBody BladeUser user, @RequestParam Long wbsId, @RequestParam String fileName, @RequestParam Integer classify, @RequestParam Integer sourceType, @RequestParam Long dataId);
+
+}

+ 19 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/FileUserVO.java

@@ -0,0 +1,19 @@
+package org.springblade.business.vo;
+
+import lombok.Data;
+
+@Data
+public class FileUserVO {
+
+    private String userId;
+
+    private String userName;
+
+    public FileUserVO(String userId, String userName){
+        this.userId = userId;
+        this.userName = userName;
+    }
+
+    public FileUserVO(){}
+
+}

+ 51 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/InformationQueryVO.java

@@ -0,0 +1,51 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.springblade.business.entity.InformationQuery;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-06-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class InformationQueryVO extends InformationQuery {
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty("每页条数")
+	private int size;
+
+	@ApiModelProperty("当前页")
+	private int current;
+
+	private List<String> wbsIds;
+
+	@ApiModelProperty("流程状态,中文")
+	private String taskStatusStr;
+
+	@ApiModelProperty("输入框内容查询")
+	private String queryValue;
+
+}

+ 9 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java

@@ -1,5 +1,6 @@
 package org.springblade.manager.feign;
 
+import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -18,6 +19,14 @@ public interface WbsTreeContractClient {
      */
     String API_PREFIX = "/api/manager/WbsTreeContract";
 
+    /**
+     * 根据primaryKeyId获取合同段划分树的节点信息
+     * @param primaryKeyId 节点唯一主键
+     * @return 信息
+     */
+    @PostMapping(API_PREFIX + "/getContractWbsTreeByPrimaryKeyId")
+    WbsTreeContract getContractWbsTreeByPrimaryKeyId(@RequestParam Long primaryKeyId);
+
     @PostMapping(API_PREFIX + "/queryContractWbsTreeAll")
     List<WbsTreeContractTreeVOS> queryContractWbsTreeAll(@RequestParam String contractId, @RequestParam Integer wbsType, @RequestParam String parentId);
 

+ 201 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationQueryController.java

@@ -0,0 +1,201 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import io.swagger.annotations.*;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.apache.commons.lang.StringUtils;
+import org.springblade.business.vo.FileUserVO;
+import org.springblade.business.vo.InformationQueryVO;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.feign.ContractClient;
+import org.springblade.manager.feign.WbsTreeContractClient;
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
+import org.springblade.system.entity.DictBiz;
+import org.springblade.system.feign.IDictBizClient;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.service.IInformationQueryService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.List;
+
+/**
+ *  资料查询控制器
+ *
+ * @author BladeX
+ * @since 2022-06-08
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/informationQuery")
+@Api(tags = "资料查询接口")
+public class InformationQueryController extends BladeController {
+
+	private final ContractClient contractClient;
+
+	private final WbsTreeContractClient wbsTreeContractClient;
+
+	private final IInformationQueryService informationQueryService;
+
+	private final IDictBizClient dictBizClient;
+
+	/**
+	 * 获取流程状态分类和文件类型分类
+	 */
+	@GetMapping("/getDictBizClassifyByCode")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "获取流程状态分类和文件类型分类")
+	@ApiImplicitParam(name = "code", value = "获取流程状态分类:flowTaskStatus;获取文件类型分类:fileType")
+	public R<List<DictBiz>> getDictBizClassifyByCode(@RequestParam String code){
+		return this.dictBizClient.getList(code, "notRoot");
+	}
+
+	/**
+	 * 获取当前合同段下所有的上报批次
+	 * @param contractId 合同段ID
+	 * @return 结果
+	 */
+	@GetMapping("/getReportNumberByContractId")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "获取当前合同段下所有的上报批次")
+	@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+	public R<List<Integer>> getReportNumberByContractId(@RequestParam String contractId){
+		//获取合同段信息
+		ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
+		return R.data(this.informationQueryService.getReportNumberByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), contractId));
+	}
+
+	/**
+	 * 根据合同段ID获取所有填报人
+	 * @param contractId 合同段ID
+	 * @return 填报人集合
+	 */
+	@GetMapping("/getFileUserByContractId")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "根据合同段ID获取所有填报人")
+	@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+	public R<List<FileUserVO>> getFileUserByContractId(@RequestParam String contractId){
+		//获取合同段信息
+		ContractInfo contract = this.contractClient.getContractById(Long.valueOf(contractId));
+		return R.data(this.informationQueryService.queryFileUserByContractId(contract.getContractType() == null ? 1 : contract.getContractType(), contractId));
+	}
+
+	/**
+	 * 分页
+	 * @param vo 查询条件
+	 * @return 结果
+	 */
+	@PostMapping("/page")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "分页")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "size", value = "当前页条数", required = true),
+			@ApiImplicitParam(name = "current", value = "当前页", required = true),
+			@ApiImplicitParam(name = "wbsId", value = "节点ID", required = true),
+			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+	})
+	public R<IPage<InformationQueryVO>> page(@RequestBody InformationQueryVO vo){
+		if("null".equals(String.valueOf(vo.getContractId())) || StringUtils.isEmpty(String.valueOf(vo.getContractId()))){
+			return R.data(-1, null, "数据查询失败");
+		}
+		//封装分页信息
+		Query query = new Query();
+		query.setSize(vo.getSize());
+		query.setCurrent(vo.getCurrent());
+		//获取合同段信息
+		ContractInfo contract = this.contractClient.getContractById(vo.getContractId());
+		vo.setClassify(contract.getContractType() == null ? 1 : contract.getContractType());
+
+		return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo));
+	}
+
+	/**
+	 * 获取当前合同段的划分树
+	 * @return 结果
+	 */
+	@GetMapping("/queryContractWbsTreeByContractIdAndType")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "获取当前合同段的划分树")
+	@ApiImplicitParams(value = {
+			@ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
+			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+	})
+	public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String parentId, @RequestParam String contractId){
+		List<WbsTreeContractTreeVOS> rootTreeNode;
+
+		if(com.alibaba.nacos.common.utils.StringUtils.isEmpty(parentId)){
+			//为空,说明初始化
+			//获取根节点
+			rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
+			if(rootTreeNode != null && rootTreeNode.size() != 0){
+				rootTreeNode.forEach(vo -> {
+					//获取一级子节点
+					List<WbsTreeContractTreeVOS> treeNodes = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, vo.getId());
+					if(treeNodes != null && treeNodes.size() != 0){
+						vo.setChildren(treeNodes);
+					}
+				});
+			}
+		} else {
+			//不为空,获取其下子节点
+			rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
+		}
+
+		return R.data(rootTreeNode);
+	}
+
+	/**
+	 * 修改 
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "修改(只能修改编号和文件名)")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "name", value = "文件名称, 必须有值", required = true),
+			@ApiImplicitParam(name = "number", value = "文件编号,可以为空")
+	})
+	public R<Boolean> update(@Valid @RequestBody InformationQuery informationQuery) {
+		if("null".equals(String.valueOf(informationQuery.getId())) || StringUtils.isEmpty(String.valueOf(informationQuery.getId()))){
+			return R.data(-1, false, "数据操作失败");
+		}
+		return R.status(informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getName, informationQuery.getName()).set(InformationQuery::getNumber, informationQuery.getNumber()).eq(InformationQuery::getId, informationQuery.getId())));
+	}
+
+	
+	/**
+	 * 删除 
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(informationQueryService.deleteLogic(Func.toLongList(ids)));
+	}
+
+	
+}

+ 0 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java

@@ -206,7 +206,6 @@ public class NeiYeController {
                 });
             }
         } else {
-            // todo 先写死项目ID
             //不为空,获取其下子节点
             rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
         }

+ 19 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/InformationQueryClientImpl.java

@@ -0,0 +1,19 @@
+package org.springblade.business.feignClient;
+
+import lombok.AllArgsConstructor;
+import org.springblade.business.feign.InformationQueryClient;
+import org.springblade.business.service.IInformationQueryService;
+import org.springblade.core.secure.BladeUser;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@AllArgsConstructor
+public class InformationQueryClientImpl implements InformationQueryClient {
+
+    private final IInformationQueryService iInformationQueryService;
+
+    @Override
+    public void saveOrUpdateInformationQueryData(BladeUser user, Long wbsId, String fileName, Integer classify, Integer sourceType, Long dataId) {
+        this.iInformationQueryService.saveOrUpdateInformationQueryData(user, wbsId, fileName, classify, sourceType, dataId);
+    }
+}

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

@@ -0,0 +1,68 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.mapper;
+
+import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.vo.InformationQueryVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-06-08
+ */
+public interface InformationQueryMapper extends BaseMapper<InformationQuery> {
+
+	/**
+	 * 根据节点ID及其填报的类型获取填报记录
+	 * @param wbsId 节点ID
+	 * @param classify 1施工2质检
+	 * @return 结果对象
+	 */
+	InformationQuery getInformationQueryByWbsId(@Param("wbsId") Long wbsId, @Param("classify") Integer classify);
+
+	/**
+	 * 获取当前合同段下所有的上报批次
+	 * @param classify 合同段类型
+	 * @param contractId 合同段ID
+	 * @return 填报人集合
+	 */
+	List<Integer> getReportNumberByContractId(@Param("classify") Integer classify, @Param("contractId") String contractId);
+
+	/**
+	 * 查询填报人集合
+	 * @param classify 合同段类型
+	 * @param contractId 合同段ID
+	 * @return 填报人集合
+	 */
+	List<InformationQuery> queryFileUserByContractId(@Param("classify") Integer classify, @Param("contractId") String contractId);
+
+	/**
+	 * 统计
+	 */
+	Integer countInformationQuery(@Param("query") InformationQueryVO informationQuery);
+
+	/**
+	 * 自定义分页
+	 */
+	List<InformationQuery> selectInformationQueryPage(@Param("current") Long current, @Param("size") Long size, @Param("query") InformationQueryVO informationQuery);
+
+}

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

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.business.mapper.InformationQueryMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="informationQueryResultMap" type="org.springblade.business.entity.InformationQuery">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_time" property="createTime"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="name" property="name"/>
+        <result column="number" property="number"/>
+        <result column="category" property="category"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="project_id" property="projectId"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="classify" property="classify"/>
+        <result column="wbs_id" property="wbsId"/>
+        <result column="is_experiment" property="isExperiment"/>
+        <result column="data_id" property="dataId"/>
+        <result column="task_id" property="taskId"/>
+        <result column="task_status" property="taskStatus"/>
+        <result column="file_user_id_and_name" property="fileUserIdAndName"/>
+        <result column="audit_user_id_and_name" property="auditUserIdAndName"/>
+        <result column="report_number" property="reportNumber"/>
+        <result column="completion_status" property="completionStatus"/>
+        <result column="source_type" property="sourceType"/>
+    </resultMap>
+
+    <resultMap id="intResultMap" type="java.lang.Integer"/>
+
+    <select id="getInformationQueryByWbsId" resultMap="informationQueryResultMap">
+        select * from u_information_query where is_deleted = 0 and wbs_id = #{wbsId} and classify = #{classify}
+    </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>
+
+    <select id="queryFileUserByContractId" resultMap="informationQueryResultMap">
+        select file_user_id_and_name from u_information_query where is_deleted = 0 and contract_id = #{contractId} and classify = #{classify}
+    </select>
+
+    <select id="countInformationQuery" resultType="java.lang.Integer">
+        select count(id) from u_information_query
+        where
+            is_deleted = 0
+        and classify = #{query.classify}
+        and contract_id = #{query.contractId}
+        <if test="query.taskStatus != null and query.taskStatus != ''"> and task_status = #{query.taskStatus} </if>
+        <if test="query.sourceType != null and query.sourceType != ''"> and source_type = #{query.sourceType} </if>
+        <if test="query.reportNumber != null and query.reportNumber != ''"> and report_number = #{query.reportNumber} </if>
+        <if test="query.fileUserIdAndName != null and query.fileUserIdAndName != ''"> and file_user_id_and_name like concat('%',#{query.fileUserIdAndName},'%') </if>
+        <if test="query.queryValue != null and query.queryValue != ''"> and (name like concat('%',#{query.queryValue},'%') OR number like concat('%',#{query.queryValue},'%')) </if>
+        <if test="query.wbsIds != null">
+            and wbs_id in
+            <foreach collection="query.wbsIds" item="wbsId" open="(" separator="," close=")">
+                #{wbsId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="selectInformationQueryPage" resultMap="informationQueryResultMap">
+        select
+            id,
+            name,
+            number,
+            create_time,
+            task_status,
+            report_number,
+            file_user_name
+        from u_information_query
+        where
+            is_deleted = 0
+        and classify = #{query.classify}
+        and contract_id = #{query.contractId}
+        <if test="query.taskStatus != null and query.taskStatus != ''"> and task_status = #{query.taskStatus} </if>
+        <if test="query.sourceType != null and query.sourceType != ''"> and source_type = #{query.sourceType} </if>
+        <if test="query.reportNumber != null and query.reportNumber != ''"> and report_number = #{query.reportNumber} </if>
+        <if test="query.fileUserIdAndName != null and query.fileUserIdAndName != ''"> and file_user_id_and_name like concat('%',#{query.fileUserIdAndName},'%') </if>
+        <if test="query.queryValue != null and query.queryValue != ''"> and (name like concat('%',#{query.queryValue},'%') OR number like concat('%',#{query.queryValue},'%')) </if>
+        <if test="query.wbsIds != null">
+            and wbs_id in
+            <foreach collection="query.wbsIds" item="wbsId" open="(" separator="," close=")">
+                #{wbsId}
+            </foreach>
+        </if>
+        limit #{current}, #{size}
+    </select>
+
+</mapper>

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

@@ -0,0 +1,68 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.service;
+
+import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.vo.FileUserVO;
+import org.springblade.business.vo.InformationQueryVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.secure.BladeUser;
+
+import java.util.List;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2022-06-08
+ */
+public interface IInformationQueryService extends BaseService<InformationQuery> {
+
+	/**
+	 * 保存填报时新增或修改填报资料记录表数据
+	 * @param user 当前操作用户
+	 * @param wbsId 当前填报节点
+	 * @param fileName 文件题名
+	 * @param classify 1施工2质检
+	 * @param sourceType 1原生2数据化
+	 * @param dataId 1原生2数据化
+	 */
+	void saveOrUpdateInformationQueryData(BladeUser user, Long wbsId, String fileName, Integer classify, Integer sourceType, Long dataId);
+
+	/**
+	 * 获取当前合同段下所有的上报批次
+	 * @param classify 合同段类型
+	 * @param contractId 合同段ID
+	 * @return 结果
+	 */
+	List<Integer> getReportNumberByContractId(Integer classify, String contractId);
+
+	/**
+	 * 根据合同段ID获取所有填报人
+	 * @param classify 合同段类型
+	 * @param contractId 合同段ID
+	 * @return 填报人集合
+	 */
+	List<FileUserVO> queryFileUserByContractId(Integer classify, String contractId);
+
+	/**
+	 * 自定义分页
+	 */
+	IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo);
+
+}

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

@@ -0,0 +1,146 @@
+package org.springblade.business.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang.StringUtils;
+import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.vo.FileUserVO;
+import org.springblade.business.vo.InformationQueryVO;
+import org.springblade.business.mapper.InformationQueryMapper;
+import org.springblade.business.service.IInformationQueryService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.manager.entity.WbsTreeContract;
+import org.springblade.manager.feign.WbsTreeContractClient;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.*;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2022-06-08
+ */
+@Service
+@AllArgsConstructor
+public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQueryMapper, InformationQuery> implements IInformationQueryService {
+
+	private final WbsTreeContractClient wbsTreeContractClient;
+
+	@Override
+	public void saveOrUpdateInformationQueryData(BladeUser user, Long primaryKeyId, String fileName, Integer classify, Integer sourceType, Long dataId) {
+		//判断当前填报节点下是否已经存在相应数据
+		InformationQuery oldData = this.baseMapper.getInformationQueryByWbsId(primaryKeyId, classify);
+
+		if(oldData != null){
+			//存在记录,修改
+			if(StringUtils.isNotEmpty(fileName)){
+				oldData.setName(fileName);
+			}
+
+			//拼接填报人信息
+			String fileUser = user.getUserId() + "-" + user.getUserName();
+			if(StringUtils.isNotEmpty(oldData.getFileUserIdAndName())){
+				if(!oldData.getFileUserIdAndName().contains(fileUser)){
+					//不包含,拼接
+					oldData.setFileUserIdAndName(oldData.getFileUserIdAndName() + "," + fileUser);
+				}
+			} else {
+				oldData.setFileUserIdAndName(fileUser);
+			}
+
+			oldData.setUpdateTime(new Date());
+			oldData.setUpdateUser(user.getUserId());
+			//修改数据
+			this.baseMapper.updateById(oldData);
+		} else {
+			//首先根据wbsId获取合同段ID和项目ID
+			WbsTreeContract contractTree = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(primaryKeyId);
+			//新增基础数据
+			InformationQuery newData = new InformationQuery();
+			//设置文件题名
+			newData.setName(fileName);
+			//设置文件类型
+			newData.setCategory(contractTree.getDeptCategory());
+			//项目ID
+			newData.setProjectId(Long.parseLong(contractTree.getProjectId()));
+			//合同段ID
+			newData.setContractId(Long.parseLong(contractTree.getContractId()));
+			//施工资料还是质检资料
+			newData.setClassify(classify);
+			//节点ID
+			newData.setWbsId(primaryKeyId);
+			//是否是试验节点
+			newData.setIsExperiment(contractTree.getIsExpernode());
+			//数据ID
+			newData.setDataId(dataId);
+			//流程状态,默认未上报
+			newData.setTaskStatus(0);
+			//填报人ID及姓名
+			newData.setFileUserIdAndName(user.getUserId() + "-" + user.getUserName());
+			//数据源类型
+			newData.setSourceType(sourceType);
+			newData.setCreateUser(user.getUserId());
+			newData.setCreateDept(user.getDeptId().contains(",") ? Long.parseLong(user.getDeptId().split(",")[0]) : Long.parseLong(user.getDeptId()));
+			newData.setCreateTime(new Date());
+			//保存数据
+			this.baseMapper.insert(newData);
+		}
+
+	}
+
+	@Override
+	public List<Integer> getReportNumberByContractId(Integer classify, String contractId) {
+		return this.baseMapper.getReportNumberByContractId(classify, contractId);
+	}
+
+	@Override
+	public List<FileUserVO> queryFileUserByContractId(Integer classify, String contractId) {
+		//获取当前合同段下有填报记录的填报人
+		List<InformationQuery> fileUserResult = this.baseMapper.queryFileUserByContractId(classify, contractId);
+
+		//获取填报人数据
+		List<String> userList = new ArrayList<>();
+		fileUserResult.forEach(user -> userList.add(user.getFileUserIdAndName()));
+		//去重
+		HashSet<String> hashSet = new HashSet<>(userList);
+		//将原本拼接的字符串拆分为userId和userName
+		List<FileUserVO> result = new ArrayList<>();
+		hashSet.forEach(user -> {
+			String[] array = user.split("-");
+			result.add(new FileUserVO(array[0], array[1]));
+		});
+
+		return result;
+	}
+
+	@Override
+	public IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo) {
+		long current = (page.getCurrent() - 1L) * page.getSize();
+		//获取总量
+		Integer count = this.baseMapper.countInformationQuery(vo);
+		//多节点查询
+		if(vo.getWbsId() != null){
+			vo.setWbsIds(JSONArray.parseArray(JSONObject.toJSONString(String.valueOf(vo.getWbsId()).split(",")), String.class));
+		}
+		//获取数据
+		List<InformationQuery> result = this.baseMapper.selectInformationQueryPage(current, page.getSize(), vo);
+		//转换VO
+		if(result != null && result.size() != 0){
+			List<InformationQueryVO> voResult = JSONArray.parseArray(JSONObject.toJSONString(result), InformationQueryVO.class);
+			//处理流程状态
+			voResult.forEach(vor -> vor.setTaskStatusStr(new Integer("1").equals(vor.getTaskStatus()) ? "未上报" : new Integer("2").equals(vor.getTaskStatus()) ? "待审批" : "已审批"));
+
+			page.setRecords(voResult);
+			page.setTotal(count);
+
+			return page;
+		}
+
+		return page.setRecords(null);
+	}
+
+}

+ 10 - 0
blade-service/blade-business/src/main/java/sql/informationquery.menu.sql

@@ -0,0 +1,10 @@
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1534441094564773889', 1123598815738675201, 'informationquery', '资料查询', 'menu', '/business/informationquery', NULL, 1, 1, 0, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1534441094564773890', '1534441094564773889', 'informationquery_add', '新增', 'add', '/business/informationquery/add', 'plus', 1, 2, 1, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1534441094564773891', '1534441094564773889', 'informationquery_edit', '修改', 'edit', '/business/informationquery/edit', 'form', 2, 2, 2, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1534441094564773892', '1534441094564773889', 'informationquery_delete', '删除', 'delete', '/api/blade-business/informationquery/remove', 'delete', 3, 2, 3, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
+VALUES ('1534441094564773893', '1534441094564773889', 'informationquery_view', '查看', 'view', '/business/informationquery/view', 'file-text', 4, 2, 2, 1, NULL, 0);

+ 9 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -3,7 +3,9 @@ package org.springblade.manager.feign;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.AllArgsConstructor;
+import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.service.IContractInfoService;
+import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.vo.WbsTreeContractTreeVO;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 import org.springframework.web.bind.annotation.RestController;
@@ -15,6 +17,13 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
     private final IContractInfoService contractInfoService;
 
+    private final IWbsTreeContractService wbsTreeContractService;
+
+    @Override
+    public WbsTreeContract getContractWbsTreeByPrimaryKeyId(Long primaryKeyId) {
+        return this.wbsTreeContractService.getById(primaryKeyId);
+    }
+
     @Override
     public List<WbsTreeContractTreeVOS> queryContractWbsTreeAll(String contractId, Integer wbsType, String parentId) {
         return JSONArray.parseArray(JSONObject.toJSONString(this.contractInfoService.queryContractWbsTreeAll(contractId, wbsType, parentId)), WbsTreeContractTreeVOS.class);