Bladeren bron

Merge remote-tracking branch 'origin/master'

wucl 1 jaar geleden
bovenliggende
commit
b57c282ef5

+ 51 - 1
dao/src/main/resources/mapper/AssetsMapper.xml

@@ -48,7 +48,9 @@
 
     <!--条件查询资产任务列表-->
     <select id="selectPage" resultType="com.dayou.vo.AssetsVO">
-        SELECT (@i :=  @i + 1) AS id,
+        SELECT DISTINCT
+#             (@i :=  @i + 1) AS id,
+        nodeInfo.recordId AS id,
         assets.id AS assetsId,
         assets.name,
         order_id,
@@ -103,6 +105,36 @@
         AND record.instance_id = nodeInstance.id
         AND nodeInstance.business_type = 'ASSET_BUSINESS'
         ) AS nodeInfo ON nodeInfo.businessId = assets.id
+        <if test="assetsSelectDTO != null and assetsSelectDTO.selectByDepartment">
+            INNER JOIN (
+            SELECT DISTINCT
+            department.id,
+            department.parent_id,
+            user.id AS userId
+            FROM
+            USER,
+            post,
+            department,
+            user_post ,
+            work_task_record AS record
+            WHERE
+            USER.id = user_post.user_id
+            AND user_post.post_id = post.id
+            AND post.department_id = department.id
+            AND user_post.deleted = 0
+            ) AS department ON (department.id IN
+            <foreach collection="assetsSelectDTO.departmentIdList" index="index" item="item" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+            OR department.parent_id IN
+            <foreach collection="assetsSelectDTO.departmentIdList" index="index" item="item" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+            )
+            AND department.userId = nodeInfo.handlerId
+        </if>
         WHERE assets.deleted = 0
         AND nodeInfo.state = 'PENDING'
         #评估业务类别(业务类型)查询
@@ -134,6 +166,9 @@
         <if test="assetsSelectDTO != null and assetsSelectDTO.handlerId != null ">
             AND nodeInfo.handlerId = #{assetsSelectDTO.handlerId}
         </if>
+        <if test="assetsSelectDTO != null and assetsSelectDTO.departmentId">
+            AND assets.department_id = #{assetsSelectDTO.departmentId}
+        </if>
         ORDER BY assets.created DESC
     </select>
 
@@ -230,6 +265,9 @@
             customer.name LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%')
             )
         </if>
+        <if test="assetsSelectDTO != null and assetsSelectDTO.departmentId != null ">
+            AND assets.department_id = #{assetsSelectDTO.departmentId}
+        </if>
         ORDER BY assets.created DESC
     </select>
 
@@ -331,6 +369,9 @@
         <if test="assetsSelectDTO != null and assetsSelectDTO.handlerId != null ">
             AND nodeInfo.handlerId = #{assetsSelectDTO.handlerId}
         </if>
+        <if test="assetsSelectDTO != null and assetsSelectDTO.departmentId != null ">
+            AND assets.department_id = #{assetsSelectDTO.departmentId}
+        </if>
         ORDER BY assets.created DESC
     </select>
 
@@ -408,6 +449,9 @@
             customer.name LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%')
             )
         </if>
+        <if test="assetsSelectDTO != null and assetsSelectDTO.departmentId != null ">
+            AND assets.department_id = #{assetsSelectDTO.departmentId}
+        </if>
         ORDER BY assets.created DESC
     </select>
 
@@ -484,6 +528,9 @@
             production.production_no LIKE CONCAT('%',#{assetsSelectDTO.keyWord},'%')
             )
         </if>
+        <if test="assetsSelectDTO != null and assetsSelectDTO.departmentId != null ">
+            AND assets.department_id = #{assetsSelectDTO.departmentId}
+        </if>
         <if test="assetsSelectDTO != null and assetsSelectDTO.startTime != null and assetsSelectDTO.endTime != null ">
             HAVING startTime &gt;= #{assetsSelectDTO.startTime}
             AND endTime &lt;= #{assetsSelectDTO.endTime}
@@ -556,6 +603,9 @@
         WHERE production.deleted = 0
         AND (production.repertory_state = 0 OR production.repertory_state = 1)
         AND production.production_type != 'STATEMENT'
+        <if test="assetsSelectDTO != null and assetsSelectDTO.departmentId != null ">
+            AND assets.department_id = #{assetsSelectDTO.departmentId}
+        </if>
         <if test="assetsSelectDTO != null and assetsSelectDTO.startTime != null and assetsSelectDTO.endTime != null ">
             HAVING startTime &gt;= #{assetsSelectDTO.startTime}
             AND endTime &lt;= #{assetsSelectDTO.endTime}

+ 46 - 7
dao/src/main/resources/mapper/WorkTaskRecordMapper.xml

@@ -502,7 +502,9 @@
 
     <!--获取资产业务已办列表-->
     <select id="getAssetsTaskDoneList" resultType="com.dayou.vo.AssetsTaskDoneVO">
-        SELECT (@i := @i + 1) AS id,
+        SELECT DISTINCT
+        # (@i := @i + 1) AS id,
+        instance.recordId AS id,
         log.id AS logId,
         user.name AS handlerName,
         log.handler_id,
@@ -521,22 +523,56 @@
         node.code AS nodeCode,
         log.created AS finishTime,
         instance.business_sub_id AS statementNo,
-        (SELECT assets_name FROM assets_production WHERE assets_production.production_no = instance.business_sub_id) AS statementName,
-        (SELECT assets_name FROM assets_production WHERE assets_production.production_no = instance.business_min_id) AS reportName,
-        instance.business_min_id    AS reportNo,
+        (SELECT assets_name FROM assets_production WHERE assets_production.production_no = instance.business_sub_id) AS
+        statementName,
+        (SELECT assets_name FROM assets_production WHERE assets_production.production_no = instance.business_min_id) AS
+        reportName,
+        instance.business_min_id AS reportNo,
         instance.state AS instanceState,
         instance.id AS instanceId,
         instance.created AS startDate
-        FROM (SELECT @i := 0) AS sort, work_flow_log AS log
+        FROM
+#             (SELECT @i := 0) AS sort,
+        work_flow_log AS log
         LEFT JOIN (SELECT work_flow_node_instance.id, node_id, business_id, state, business_sub_id,
-        business_min_id,work_task_record.created
+        business_min_id,work_task_record.created,work_task_record.id AS recordId
         FROM work_flow_node_instance,work_task_record
         WHERE state = 'FINISHED'
         AND work_flow_node_instance.id = work_task_record.instance_id
         AND work_flow_node_instance.deleted = 0) AS instance ON log.instance_id = instance.id
         LEFT JOIN (SELECT id, name, code FROM work_node WHERE deleted = 0) AS node ON node.id = instance.node_id
-        LEFT JOIN (SELECT id, order_id, NAME FROM assets WHERE deleted = 0) AS assets ON assets.id = log.business_id
+        LEFT JOIN (SELECT id, order_id, name, department_id FROM assets WHERE deleted = 0) AS assets ON assets.id = log.business_id
         LEFT JOIN user ON user.id = log.handler_id
+        <if test="assetsSelectDTO != null and assetsSelectDTO.selectByDepartment">
+            INNER JOIN (
+            SELECT DISTINCT
+            department.id,
+            department.parent_id,
+            user.id AS userId
+            FROM
+            USER,
+            post,
+            department,
+            user_post ,
+            work_task_record AS record
+            WHERE
+            USER.id = user_post.user_id
+            AND user_post.post_id = post.id
+            AND post.department_id = department.id
+            AND user_post.deleted = 0
+            ) AS department ON (department.id IN
+            <foreach collection="assetsSelectDTO.departmentIdList" index="index" item="item" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+                OR department.parent_id IN
+            <foreach collection="assetsSelectDTO.departmentIdList" index="index" item="item" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+            )
+            AND department.userId = log.handler_id
+        </if>
         WHERE instance.id IS NOT NULL
         AND log.business_type = 'ASSET_BUSINESS'
         <if test="assetsSelectDTO != null and assetsSelectDTO.handlerId != null">
@@ -553,6 +589,9 @@
         <if test="assetsSelectDTO != null and assetsSelectDTO.nodeCode != null">
             AND node.code = #{assetsSelectDTO.nodeCode}
         </if>
+        <if test="assetsSelectDTO != null and assetsSelectDTO.departmentId">
+            AND assets.department_id = #{assetsSelectDTO.departmentId}
+        </if>
         ORDER BY log.created DESC
     </select>
 </mapper>

+ 16 - 1
domain/src/main/java/com/dayou/dto/AssetsSelectDTO.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.util.Date;
+import java.util.List;
 
 @Data
 @NoArgsConstructor
@@ -104,5 +105,19 @@ public class AssetsSelectDTO {
      */
     private Date archivedTime;
 
-    private String a;
+    /**
+     * 部门id
+     */
+    private Long departmentId;
+
+    /**
+     * 是否根据部门id集合查询
+     */
+    private Boolean selectByDepartment;
+
+    /**
+     * 部门id
+     */
+    private List<Long> departmentIdList;
+//    private String a;
 }

+ 7 - 0
service/src/main/java/com/dayou/service/impl/AssetsServiceImpl.java

@@ -3,6 +3,7 @@ package com.dayou.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.dayou.bo.SimpleParentModel;
 import com.dayou.entity.*;
 import com.dayou.enums.GlobalConfigEnum;
 import com.dayou.enums.MainBusinessEnum;
@@ -92,6 +93,12 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
      */
     @Override
     public Page<AssetsVO> selectPage(Page page, AssetsSelectDTO assetsSelectDTO) {
+        // 判断是否要根据部门id集合查询(部门待办查询)
+        if (ObjectUtil.isNotNull(assetsSelectDTO.getSelectByDepartment()) && assetsSelectDTO.getSelectByDepartment()){
+            assetsSelectDTO.setDepartmentIdList(LoginContext.getLoginCacheUserBO().getDepartmentList().stream()
+                    .map(SimpleParentModel::getId)
+                    .collect(Collectors.toList()));
+        }
         return assetsMapper.selectPage(page, assetsSelectDTO);
     }
 

+ 11 - 1
service/src/main/java/com/dayou/service/workflow/WorkTaskRecordServiceImpl.java

@@ -1,6 +1,8 @@
 package com.dayou.service.workflow;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
+import com.dayou.bo.SimpleParentModel;
 import com.dayou.dto.AssetsSelectDTO;
 import com.dayou.dto.HandlerPermissionDTO;
 import com.dayou.entity.*;
@@ -18,6 +20,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
@@ -159,7 +162,14 @@ public class WorkTaskRecordServiceImpl extends ServiceImpl<WorkTaskRecordMapper,
      */
     @Override
     public Page<AssetsTaskDoneVO> getAssetsTaskDoneList(AssetsSelectDTO assetsSelectDTO, Page page) {
-        assetsSelectDTO.setHandlerId(LoginContext.getCurrentUserId());
+        // 判断是否要根据部门id集合查询(部门待办查询)
+        if (ObjectUtil.isNotNull(assetsSelectDTO.getSelectByDepartment()) && assetsSelectDTO.getSelectByDepartment()){
+            assetsSelectDTO.setDepartmentIdList(LoginContext.getLoginCacheUserBO().getDepartmentList().stream()
+                    .map(SimpleParentModel::getId)
+                    .collect(Collectors.toList()));
+        }else {
+            assetsSelectDTO.setHandlerId(LoginContext.getCurrentUserId());
+        }
         Page<AssetsTaskDoneVO> assetsTaskDoneVOPage = workTaskRecordMapper.getAssetsTaskDoneList(assetsSelectDTO, page);
         assetsTaskDoneVOPage.getRecords().forEach(x->{
             x.setHandingTime(DateUtils.getTimeLong(x.getHandingTimeLong()==null?0L:x.getHandingTimeLong()));