Pārlūkot izejas kodu

1.资产部门待办查询逻辑修改,现在可查询所在部门及其下属部门
2.资产流程固定节点修改

GouGengquan 10 mēneši atpakaļ
vecāks
revīzija
13e2f79b60

+ 7 - 0
dao/src/main/java/com/dayou/mapper/DepartmentMapper.java

@@ -35,4 +35,11 @@ public interface DepartmentMapper extends CustomBaseMapper<Department> {
      * @return Long 下单部门id
      */
     Long getDepartmentByUserId(@Param("userId") Long userId);
+
+    /**
+     * 根据部门id获取部门及其下属部门的id集合
+     * @param depId 部门id
+     * @return List<Long>
+     */
+    List<Long> getDepIdList(@Param("depId") Long depId);
 }

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

@@ -127,11 +127,11 @@
                      close=")">
                 #{item}
             </foreach>
-            OR department.parent_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>

+ 19 - 0
dao/src/main/resources/mapper/DepartmentMapper.xml

@@ -64,4 +64,23 @@
           AND user.id = #{userId}
         LIMIT 1
     </select>
+
+    <!--根据部门id获取部门及其下属部门的id集合-->
+    <select id="getDepIdList" resultType="java.lang.Long">
+        SELECT DISTINCT
+            department.id
+        FROM
+                ( SELECT department.id FROM department ) AS department
+                    INNER JOIN (
+                SELECT
+                    id
+                FROM
+                    ( SELECT id, parent_id FROM department WHERE deleted = 0 ORDER BY parent_id, id ) org_query,
+                    (
+                        SELECT
+                            @id := ( SELECT id FROM department WHERE id = #{depId} AND deleted = 0 )) initialisation
+                WHERE
+                    ( FIND_IN_SET( parent_id, @id ) > 0 OR FIND_IN_SET( id, @id ) > 0 )
+                        AND @id := CONCAT( @id, ',', id )) AS depId ON depId.id = department.id
+    </select>
 </mapper>

+ 1 - 1
domain/src/main/java/com/dayou/common/FixedWorkNode.java

@@ -30,7 +30,7 @@ public class FixedWorkNode {
     public static final List<WorkflowNodeEnum> ASSET_FIXED_NODES = Arrays.asList(new WorkflowNodeEnum[]
             {DEPARTMENT_ALLOCATION,SPOT_RECONNAISSANCE_DETERMINE_PRICE,QUOTATION_FEEDBACK,PRODUCT_CHOICE,ASSET_REPORT_TAKE_NO,
                     WRITE_REPORT,CHECK_REPORT,RECHECK_REPORT,REPORT_BOOKBINDING_STAMP,
-                    REPORT_IN,REPORT_OUT,CHECK_ARCHIVING, RECHECK_ARCHIVING, BUSINESS_ARCHIVING});
+                    REPORT_IN,REPORT_OUT,COMMIT_ARCHIVING,CHECK_ARCHIVING, BUSINESS_ARCHIVING});
 
     public static  List<WorkflowNodeEnum> getFixedNodesByBusinessType(String businessType){
         if (MainBusinessEnum.MAJOR_BUSINESS.name().equals(businessType)){

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

@@ -89,6 +89,9 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
     @Autowired
     private IFinanceInvoiceService financeInvoiceService;
 
+    @Autowired
+    private DepartmentMapper departmentMapper;
+
     /**
      * 条件查询资产任务列表
      *
@@ -100,9 +103,7 @@ public class AssetsServiceImpl extends ServiceImpl<AssetsMapper, Assets> impleme
     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()));
+            assetsSelectDTO.setDepartmentIdList(departmentMapper.getDepIdList(LoginContext.getLoginCacheUserBO().getDepartmentList().get(0).getId()));
         }
         // 此处判断handlerId是否为空只是为了确保前端查询条件有handlerId,并不直接信任
         if (ObjectUtil.isNotNull(assetsSelectDTO) && ObjectUtil.isNotNull(assetsSelectDTO.getHandlerId())){