ソースを参照

1.资产列表查询时只返回本人及其所在部门的人员为项目负责人或项目经理的流程
2.资产其他查询优化

GouGengquan 10 ヶ月 前
コミット
39f939f0dc

+ 25 - 5
dao/src/main/resources/mapper/AssetsMapper.xml

@@ -127,14 +127,34 @@
                      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>
+        <if test="assetsSelectDTO != null and assetsSelectDTO.selectByAll">
+            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>
+            )
+            AND (department.userId = assets.principal_id OR department.userId = assets.client_manager_id)
+        </if>
         WHERE assets.deleted = 0
         AND nodeInfo.state = 'PENDING'
         #评估业务类别(业务类型)查询

+ 0 - 5
dao/src/main/resources/mapper/WorkTaskRecordMapper.xml

@@ -587,11 +587,6 @@
                      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>

+ 5 - 0
domain/src/main/java/com/dayou/dto/AssetsSelectDTO.java

@@ -116,6 +116,11 @@ public class AssetsSelectDTO {
     private Boolean selectByDepartment;
 
     /**
+     * 是否查询资产列表
+     */
+    private Boolean selectByAll;
+
+    /**
      * 部门id
      */
     private List<Long> departmentIdList;

+ 6 - 0
domain/src/main/java/com/dayou/vo/AssetsTaskDoneVO.java

@@ -11,6 +11,12 @@ public class AssetsTaskDoneVO {
      * id
      */
     private Long id;
+
+    /**
+     * 任务id
+     */
+    private Long recordId;
+
     /**
      * 资产业务id
      */

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

@@ -105,6 +105,10 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
         if (ObjectUtil.isNotNull(assetsSelectDTO.getSelectByDepartment()) && assetsSelectDTO.getSelectByDepartment()){
             assetsSelectDTO.setDepartmentIdList(departmentMapper.getDepIdList(LoginContext.getLoginCacheUserBO().getDepartmentList().get(0).getId()));
         }
+        // 判断是否要查询资产列表,资产列表只能查询包含本人及其所在部门的人员为项目负责人或项目经理的流程(资产列表查询)
+        if (ObjectUtil.isNotNull(assetsSelectDTO.getSelectByAll()) && assetsSelectDTO.getSelectByAll()){
+            assetsSelectDTO.setDepartmentIdList(departmentMapper.getDepIdList(LoginContext.getLoginCacheUserBO().getDepartmentList().get(0).getId()));
+        }
         // 此处判断handlerId是否为空只是为了确保前端查询条件有handlerId,并不直接信任
         if (ObjectUtil.isNotNull(assetsSelectDTO) && ObjectUtil.isNotNull(assetsSelectDTO.getHandlerId())){
             assetsSelectDTO.setHandlerId(LoginContext.getCurrentUserId());

+ 4 - 3
service/src/main/java/com/dayou/service/workflow/WorkTaskRecordServiceImpl.java

@@ -7,6 +7,7 @@ import com.dayou.dto.AssetsSelectDTO;
 import com.dayou.dto.HandlerPermissionDTO;
 import com.dayou.entity.*;
 import com.dayou.exception.ErrorCode;
+import com.dayou.mapper.DepartmentMapper;
 import com.dayou.mapper.WorkTaskRecordMapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.utils.DateUtils;
@@ -37,6 +38,8 @@ public class WorkTaskRecordServiceImpl extends ServiceImpl<WorkTaskRecordMapper,
     @Autowired
     private  WorkTaskRecordMapper workTaskRecordMapper;
 
+    @Autowired
+    private DepartmentMapper departmentMapper;
 
     @Override
     @SuppressWarnings("unchecked")
@@ -164,9 +167,7 @@ public class WorkTaskRecordServiceImpl extends ServiceImpl<WorkTaskRecordMapper,
     public Page<AssetsTaskDoneVO> getAssetsTaskDoneList(AssetsSelectDTO assetsSelectDTO, Page page) {
         // 判断是否要根据部门id集合查询(部门待办查询)
         if (ObjectUtil.isNotNull(assetsSelectDTO.getSelectByDepartment()) && assetsSelectDTO.getSelectByDepartment()){
-            assetsSelectDTO.setDepartmentIdList(LoginContext.getLoginCacheUserBO().getDepartmentList().stream()
-                    .map(SimpleParentModel::getId)
-                    .collect(Collectors.toList()));
+            assetsSelectDTO.setDepartmentIdList(departmentMapper.getDepIdList(LoginContext.getLoginCacheUserBO().getDepartmentList().get(0).getId()));
         }else {
             assetsSelectDTO.setHandlerId(LoginContext.getCurrentUserId());
         }