Przeglądaj źródła

日志管理相关

huangjn 2 lat temu
rodzic
commit
15c89cace0
18 zmienionych plików z 576 dodań i 24 usunięć
  1. 34 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/ContractLogDTO.java
  2. 73 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ContractLog.java
  3. 35 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ContractLogVO.java
  4. 3 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java
  5. 78 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java
  6. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractTreeDrawingsController.java
  7. 5 11
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  8. 4 10
      blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java
  9. 30 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ClientTreePublicCodeClientImpl.java
  10. 43 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.java
  11. 87 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.xml
  12. 44 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IContractLogService.java
  13. 72 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java
  14. 46 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java
  15. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java
  16. 13 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml
  17. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  18. 4 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

+ 34 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/ContractLogDTO.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.ContractLog;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 日志通用表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-06-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ContractLogDTO extends ContractLog {
+	private static final long serialVersionUID = 1L;
+
+}

+ 73 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ContractLog.java

@@ -0,0 +1,73 @@
+/*
+ *      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.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 日志通用表实体类
+ *
+ * @author BladeX
+ * @since 2022-06-15
+ */
+@Data
+@TableName("u_contract_log")
+@EqualsAndHashCode(callSuper = true)
+public class ContractLog extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 项目ID
+     */
+    private Long projectId;
+    /**
+     * 合同段ID
+     */
+    private Long contractId;
+    /**
+     * 所填报的节点类型ID
+     */
+    private Long wbsNodeId;
+    /**
+     * 日志类型
+     */
+    private Integer wbsNodeType;
+    /**
+     * 填报时间、施工时间
+     */
+    private String recordTime;
+    /**
+     * 编号
+     */
+    private String recordNumber;
+    private String projectPileno;
+    private String projectPart;
+    /**
+     * 数据ID
+     */
+    private Long dataId;
+    private String createUserName;
+
+
+}

+ 35 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ContractLogVO.java

@@ -0,0 +1,35 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.springblade.business.entity.ContractLog;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 日志通用表视图实体类
+ *
+ * @author BladeX
+ * @since 2022-06-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ContractLogVO extends ContractLog {
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty("当前页数")
+	private Integer current;
+
+	@ApiModelProperty("当前页显示条数")
+	private Integer size;
+
+	@ApiModelProperty("时间查询")
+	private String queryTime;
+
+	private String startTime;
+
+	private String endTime;
+
+	@ApiModelProperty("关键字查询")
+	private String queryValue;
+
+}

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

@@ -47,4 +47,7 @@ public interface WbsTreeContractClient {
     @GetMapping(API_PREFIX + "/queryContractWbsTreeByContractIdAndType")
     List<WbsTreeContractTreeVOS> queryContractWbsTreeByContractIdAndType(@RequestParam String contractId, @RequestParam Integer wbsType, @RequestParam String parentId);
 
+    @GetMapping(API_PREFIX + "/queryCurrentContractLogList")
+    List<WbsTreeContractTreeVOS> queryCurrentContractLogList(@RequestParam String contractId);
+
 }

+ 78 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java

@@ -0,0 +1,78 @@
+/*
+ *      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.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.business.entity.ContractLog;
+import org.springblade.business.vo.ContractLogVO;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.manager.feign.WbsTreeContractClient;
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
+import org.springframework.web.bind.annotation.*;
+import org.springblade.business.service.IContractLogService;
+import org.springblade.core.boot.ctrl.BladeController;
+import java.util.List;
+
+/**
+ * 日志通用表 控制器
+ *
+ * @author BladeX
+ * @since 2022-06-15
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/contractLog")
+@Api(value = "日志通用表", tags = "日志通用表接口")
+public class ContractLogController extends BladeController {
+
+	private final IContractLogService contractLogService;
+
+	private final WbsTreeContractClient wbsTreeContractClient;
+
+	/**
+	 * 施工日志分页
+	 * @param logVo 查询条件
+	 * @return 结果
+	 */
+	@GetMapping("/constructionLogPage")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "施工日志分页")
+	public R<IPage<ContractLogVO>> constructionLogPage(@RequestBody ContractLogVO logVo){
+		return R.data(this.contractLogService.constructionLogPage(logVo));
+	}
+
+	/**
+	 * 获取当前合同段下的日志类型
+	 * @param contractId 合同段ID
+	 * @return 结果
+	 */
+	@GetMapping("/queryCurrentContractLogList")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "获取当前合同段下的日志类型")
+	@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
+	public R<List<WbsTreeContractTreeVOS>> queryCurrentContractLogList(@RequestParam String contractId){
+		return R.data(this.wbsTreeContractClient.queryCurrentContractLogList(contractId));
+	}
+	
+}

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

@@ -58,7 +58,7 @@ public class ContractTreeDrawingsController extends BladeController {
 	@ApiImplicitParams({
 			@ApiImplicitParam(name = "primaryKeyId", value = "节点primaryKeyId", required = true),
 			@ApiImplicitParam(name = "fileUrl", value = "文件url", required = true),
-			@ApiImplicitParam(name = "id", value = "文件url")
+			@ApiImplicitParam(name = "id", value = "节点的drawingsId")
 	})
 	public R<Boolean> saveOrUpdateContractTreeDrawings(@RequestParam String primaryKeyId, @RequestParam String fileUrl, @RequestParam String id){
 		//当前提交用户

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

@@ -25,6 +25,7 @@ import javax.validation.Valid;
 
 import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.ContractTreeDrawings;
+import org.springblade.business.feignClient.ClientTreePublicCodeClientImpl;
 import org.springblade.business.service.IContractTreeDrawingsService;
 import org.springblade.business.vo.FileUserVO;
 import org.springblade.business.vo.InformationQueryVO;
@@ -74,6 +75,8 @@ public class InformationWriteQueryController extends BladeController {
 
 	private final IContractTreeDrawingsService contractTreeDrawingsService;
 
+	private final ClientTreePublicCodeClientImpl clientTreePublicCodeClient;
+
 	/**
 	 * 修改节点信息
 	 * @param node 节点信息
@@ -134,7 +137,7 @@ public class InformationWriteQueryController extends BladeController {
 	public R<Boolean> saveContractTreeNode(@RequestParam String contractNodePrimaryKeyId, @RequestParam String projectNodePrimaryKeyId){
 		//先获取当前节点的信息
 		WbsTreeContract treeContract = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(contractNodePrimaryKeyId));
-		//判断新增
+		//检查当前节点下是否添加了子节点
 
 		return null;
 	}
@@ -266,16 +269,7 @@ public class InformationWriteQueryController extends BladeController {
 		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);
-					}
-				});
-			}
+			rootTreeNode = this.clientTreePublicCodeClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
 		} else {
 			//不为空,获取其下子节点
 			rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);

+ 4 - 10
blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiYeController.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.business.entity.ConstructionLedger;
+import org.springblade.business.feignClient.ClientTreePublicCodeClientImpl;
 import org.springblade.business.service.IConstructionLedgerService;
 import org.springblade.business.vo.NeiYeLedgerVO;
 import org.springblade.business.vo.NeiYeQueryVO;
@@ -33,6 +34,8 @@ public class NeiYeController {
 
     private final IConstructionLedgerService constructionLedgerService;
 
+    private final ClientTreePublicCodeClientImpl clientTreePublicCodeClient;
+
     /**
      * 获取内业台账列表
      * @return 内业台账列表
@@ -195,16 +198,7 @@ public class NeiYeController {
         if(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);
-                    }
-                });
-            }
+            rootTreeNode = this.clientTreePublicCodeClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
         } else {
             //不为空,获取其下子节点
             rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);

+ 30 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ClientTreePublicCodeClientImpl.java

@@ -0,0 +1,30 @@
+package org.springblade.business.feignClient;
+
+import lombok.AllArgsConstructor;
+import org.springblade.manager.feign.WbsTreeContractClient;
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@AllArgsConstructor
+public class ClientTreePublicCodeClientImpl {
+
+    private final WbsTreeContractClient wbsTreeContractClient;
+    
+    public List<WbsTreeContractTreeVOS> queryContractWbsTreeByContractIdAndType(String contractId, Integer wbsType, String parentId){
+        List<WbsTreeContractTreeVOS> rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, wbsType, parentId);
+        if(rootTreeNode != null && rootTreeNode.size() != 0){
+            rootTreeNode.forEach(vo -> {
+                //获取一级子节点
+                List<WbsTreeContractTreeVOS> treeNodes = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, wbsType, vo.getId());
+                if(treeNodes != null && treeNodes.size() != 0){
+                    vo.setChildren(treeNodes);
+                }
+            });
+        }
+        return rootTreeNode;
+    }
+    
+}

+ 43 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.java

@@ -0,0 +1,43 @@
+/*
+ *      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.apache.ibatis.annotations.Param;
+import org.springblade.business.entity.ContractLog;
+import org.springblade.business.vo.ContractLogVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 日志通用表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-06-15
+ */
+public interface ContractLogMapper extends BaseMapper<ContractLog> {
+
+	List<ContractLog> constructionLogPage(@Param("current") Integer current, @Param("size") Integer size, @Param("vo") ContractLogVO vo);
+
+	Integer selectPageCount(@Param("vo") ContractLogVO vo);
+
+	/**
+	 * 自定义分页
+	 */
+	List<ContractLogVO> selectContractLogPage(IPage page, ContractLogVO contractLog);
+
+}

+ 87 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.xml

@@ -0,0 +1,87 @@
+<?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.ContractLogMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="contractLogResultMap" type="org.springblade.business.entity.ContractLog">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <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="project_id" property="projectId"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="wbs_node_id" property="wbsNodeId"/>
+        <result column="wbs_node_type" property="wbsNodeType"/>
+        <result column="record_time" property="recordTime"/>
+        <result column="record_number" property="recordNumber"/>
+        <result column="project_pileno" property="projectPileno"/>
+        <result column="project_part" property="projectPart"/>
+        <result column="data_id" property="dataId"/>
+        <result column="create_user_name" property="createUserName"/>
+    </resultMap>
+
+    <select id="constructionLogPage" resultMap="contractLogResultMap">
+        select
+          id,
+          record_time,
+          record_number,
+          project_pileno,
+          project_part,
+          data_id,
+          create_user_name
+        from
+          u_contract_log
+        where
+        is_deleted = 0
+        and wbs_node_id = #{vo.wbsNodeId}
+        <if test="vo.queryValue != null and vo.queryValue != ''">
+            and
+            (
+            project_pileno like concat('%',#{vo.queryValue},'%')
+            or
+            project_part like concat('%',#{vo.queryValue},'%')
+            or
+            record_number like concat('%',#{vo.queryValue},'%')
+            )
+        </if>
+        <if test="vo.createUser != null and vo.createUser != ''">
+            and create_user = #{vo.createUser}
+        </if>
+        <if test="vo.startTime != null and vo.startTime != '' and vo.endTime != null and vo.endTime != ''">
+            and record_time between #{startTime} and #{endTime}
+        </if>
+        order by record_time DESC limit #{current}, #{size}
+    </select>
+
+    <select id="selectPageCount" resultType="java.lang.Integer">
+        select count(id) from u_contract_log
+        where
+          is_deleted = 0
+        and wbs_node_id = #{vo.wbsNodeId}
+        <if test="vo.queryValue != null and vo.queryValue != ''">
+          and
+            (
+                project_pileno like concat('%',#{vo.queryValue},'%')
+                  or
+                project_part like concat('%',#{vo.queryValue},'%')
+                  or
+                record_number like concat('%',#{vo.queryValue},'%')
+            )
+        </if>
+        <if test="vo.createUser != null and vo.createUser != ''">
+            and create_user = #{vo.createUser}
+        </if>
+        <if test="vo.startTime != null and vo.startTime != '' and vo.endTime != null and vo.endTime != ''">
+            and record_time between #{startTime} and #{endTime}
+        </if>
+    </select>
+
+    <select id="selectContractLogPage" resultMap="contractLogResultMap">
+        select * from u_contract_log where is_deleted = 0
+    </select>
+
+</mapper>

+ 44 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IContractLogService.java

@@ -0,0 +1,44 @@
+/*
+ *      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.ContractLog;
+import org.springblade.business.vo.ContractLogVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 日志通用表 服务类
+ *
+ * @author BladeX
+ * @since 2022-06-15
+ */
+public interface IContractLogService extends BaseService<ContractLog> {
+
+	/**
+	 * 施工日志分页
+	 * @param logVO 查询条件
+	 * @return 结果
+	 */
+	IPage<ContractLogVO> constructionLogPage(ContractLogVO logVO);
+
+	/**
+	 * 自定义分页
+	 */
+	IPage<ContractLogVO> selectContractLogPage(IPage<ContractLogVO> page, ContractLogVO contractLog);
+
+}

+ 72 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java

@@ -0,0 +1,72 @@
+/*
+ *      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.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.springblade.business.entity.ContractLog;
+import org.springblade.business.vo.ContractLogVO;
+import org.springblade.business.mapper.ContractLogMapper;
+import org.springblade.business.service.IContractLogService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+
+/**
+ * 日志通用表 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-06-15
+ */
+@Service
+public class ContractLogServiceImpl extends BaseServiceImpl<ContractLogMapper, ContractLog> implements IContractLogService {
+
+	@Override
+	public IPage<ContractLogVO> constructionLogPage(ContractLogVO logVO) {
+		Integer current = (logVO.getCurrent() - 1) * logVO.getSize();
+
+		Query query = new Query();
+		query.setCurrent(logVO.getCurrent());
+		query.setSize(logVO.getSize());
+
+		//总数
+		Integer count = this.baseMapper.selectPageCount(logVO);
+		//分页信息
+		List<ContractLog> result = this.baseMapper.constructionLogPage(current, logVO.getSize(), logVO);
+		//没有数据
+		if(result == null || result.size() == 0){
+			return Condition.getPage(query);
+		}
+		//有数据,转换成VO
+		List<ContractLogVO> voResult = JSONArray.parseArray(JSONObject.toJSONString(result), ContractLogVO.class);
+
+		IPage<ContractLogVO> iPage = Condition.getPage(query);
+		iPage.setTotal(count);
+		return iPage.setRecords(voResult);
+	}
+
+	@Override
+	public IPage<ContractLogVO> selectContractLogPage(IPage<ContractLogVO> page, ContractLogVO contractLog) {
+		return page.setRecords(this.baseMapper.selectContractLogPage(page, contractLog));
+	}
+
+}

+ 46 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -3,6 +3,7 @@ package org.springblade.manager.feign;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.mixsmart.utils.StringUtils;
 import lombok.AllArgsConstructor;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.entity.WbsTreeContract;
@@ -10,8 +11,11 @@ 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.springblade.system.entity.DictBiz;
+import org.springblade.system.feign.IDictBizClient;
 import org.springframework.web.bind.annotation.RestController;
-import java.util.List;
+
+import java.util.*;
 
 @RestController
 @AllArgsConstructor
@@ -21,6 +25,8 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
     private final IWbsTreeContractService wbsTreeContractService;
 
+    private final IDictBizClient dictBizClient;
+
     @Override
     public Boolean updateContractNodeParameter(WbsTreeContract node) {
         return this.wbsTreeContractService.update(Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getDeptName, node.getDeptName()).eq(WbsTreeContract::getPKeyId, node.getPKeyId()));
@@ -55,4 +61,43 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
         vos.forEach(voData -> voData.setLeaf(new Integer("6").equals(voData.getDeptCategory())));
         return vos;
     }
+
+    @Override
+    public List<WbsTreeContractTreeVOS> queryCurrentContractLogList(String contractId) {
+        List<WbsTreeContract> result = this.wbsTreeContractService.queryCurrentContractLogList(contractId);
+        if(result != null && result.size() != 0){
+            List<WbsTreeContractTreeVOS> vosResult = new ArrayList<>();
+            result.forEach(node -> {
+                //转换
+                WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
+                vos.setPrimaryKeyId(String.valueOf(node.getPKeyId()));
+                vos.setTitle(StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getDeptName());
+                //最终返回集合
+                vosResult.add(vos);
+            });
+
+            List<WbsTreeContractTreeVOS> finalResult = new ArrayList<>();
+            //排序顺序
+            List<DictBiz> dictBizList = this.dictBizClient.getList("contract_log_sort", "notRoot").getData();
+            if(dictBizList == null || dictBizList.size() == 0){
+                return vosResult;
+            }
+            //存在排序,则根据排序规则对数据进行排序
+            dictBizList.sort(Comparator.comparingInt(DictBiz::getSort));
+            dictBizList.forEach(dictBiz -> {
+                Iterator<WbsTreeContractTreeVOS> iterator = vosResult.iterator();
+                while (iterator.hasNext()){
+                    WbsTreeContractTreeVOS next = iterator.next();
+                    if(next.getTitle().contains(dictBiz.getDictValue())){
+                        finalResult.add(next);
+                        iterator.remove();
+                        break;
+                    }
+                }
+            });
+
+            return finalResult;
+        }
+        return null;
+    }
 }

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java

@@ -12,6 +12,8 @@ import java.util.List;
 
 public interface WbsTreeContractMapper extends BaseMapper<WbsTreeContract> {
 
+    List<WbsTreeContract> queryCurrentContractLogList(@Param("contractId") String contractId);
+
     List<WbsTreeContractVO> selectAll();
 
     Integer insertWbsTreeContract1(@Param("snowId") Long snowId,

+ 13 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -166,5 +166,18 @@
         AND id = #{parentId}
     </select>
 
+    <select id="queryCurrentContractLogList" resultMap="ResultMap">
+        select
+            p_key_id,
+            dept_name,
+            full_name
+        from
+          m_wbs_tree_contract
+        where
+          is_deleted = 0
+        and parent_id in(select id from m_wbs_tree_contract where is_deleted = 0 and contract_id = #{contractId} and parent_id = 0)
+        and major_data_type = 5
+        and contract_id = #{contractId}
+    </select>
 
 </mapper>

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java

@@ -13,4 +13,6 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
     boolean submitWbsTreeInContract(WbsTreeContractDTO wbsTreeContractDTO);
 
     List<WbsTreeContract> findWbsTreeContract(String ids);
+
+    List<WbsTreeContract> queryCurrentContractLogList(String contractId);
 }

+ 4 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -137,5 +137,8 @@ public class WbsTreeContractServiceImpl
         return list;
     }
 
-
+    @Override
+    public List<WbsTreeContract> queryCurrentContractLogList(String contractId) {
+        return this.baseMapper.queryCurrentContractLogList(contractId);
+    }
 }