|  | @@ -1,22 +1,20 @@
 | 
											
												
													
														|  |  package com.xunmei.core.drill.service.impl;
 |  |  package com.xunmei.core.drill.service.impl;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -import java.util.Date;
 |  | 
 | 
											
												
													
														|  | -import java.util.List;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  import cn.hutool.core.util.ObjectUtil;
 |  |  import cn.hutool.core.util.ObjectUtil;
 | 
											
												
													
														|  |  import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 |  |  import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
											
												
													
														|  | 
 |  | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
											
												
													
														|  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
											
												
													
														|  | 
 |  | +import com.xunmei.common.core.constant.Constants;
 | 
											
												
													
														|  |  import com.xunmei.common.core.constant.DictConstants;
 |  |  import com.xunmei.common.core.constant.DictConstants;
 | 
											
												
													
														|  |  import com.xunmei.common.core.constant.ErrorMsgConstants;
 |  |  import com.xunmei.common.core.constant.ErrorMsgConstants;
 | 
											
												
													
														|  |  import com.xunmei.common.core.constant.SecurityConstants;
 |  |  import com.xunmei.common.core.constant.SecurityConstants;
 | 
											
												
													
														|  | -import com.xunmei.common.core.domain.IdName;
 |  | 
 | 
											
												
													
														|  |  import com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary;
 |  |  import com.xunmei.common.core.domain.drill.domain.CoreDrillDictionary;
 | 
											
												
													
														|  |  import com.xunmei.common.core.domain.drill.dto.CoreDrillDictionaryInsertDto;
 |  |  import com.xunmei.common.core.domain.drill.dto.CoreDrillDictionaryInsertDto;
 | 
											
												
													
														|  |  import com.xunmei.common.core.domain.drill.dto.CoreDrillDictionaryPageDto;
 |  |  import com.xunmei.common.core.domain.drill.dto.CoreDrillDictionaryPageDto;
 | 
											
												
													
														|  |  import com.xunmei.common.core.domain.drill.dto.CoreDrillDictionaryUpdateDto;
 |  |  import com.xunmei.common.core.domain.drill.dto.CoreDrillDictionaryUpdateDto;
 | 
											
												
													
														|  |  import com.xunmei.common.core.domain.drill.vo.CoreDrillDictionaryDetailVo;
 |  |  import com.xunmei.common.core.domain.drill.vo.CoreDrillDictionaryDetailVo;
 | 
											
												
													
														|  |  import com.xunmei.common.core.domain.drill.vo.CoreDrillDictionaryPageVo;
 |  |  import com.xunmei.common.core.domain.drill.vo.CoreDrillDictionaryPageVo;
 | 
											
												
													
														|  | -import com.xunmei.common.core.util.BeanHelper;
 |  | 
 | 
											
												
													
														|  | 
 |  | +import com.xunmei.common.core.web.page.TableDataInfo;
 | 
											
												
													
														|  |  import com.xunmei.common.security.utils.DictUtils;
 |  |  import com.xunmei.common.security.utils.DictUtils;
 | 
											
												
													
														|  |  import com.xunmei.common.security.utils.SecurityUtils;
 |  |  import com.xunmei.common.security.utils.SecurityUtils;
 | 
											
												
													
														|  |  import com.xunmei.core.drill.mapper.CoreDrillDictionaryMapper;
 |  |  import com.xunmei.core.drill.mapper.CoreDrillDictionaryMapper;
 | 
											
										
											
												
													
														|  | @@ -28,16 +26,13 @@ import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
 | 
											
												
													
														|  |  import org.springframework.beans.BeanUtils;
 |  |  import org.springframework.beans.BeanUtils;
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  | 
 |  | +import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import java.util.Arrays;
 |  |  import java.util.Arrays;
 | 
											
												
													
														|  | 
 |  | +import java.util.Date;
 | 
											
												
													
														|  | 
 |  | +import java.util.List;
 | 
											
												
													
														|  |  import java.util.stream.Collectors;
 |  |  import java.util.stream.Collectors;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 |  | 
 | 
											
												
													
														|  | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 |  | 
 | 
											
												
													
														|  | -import com.xunmei.common.core.web.page.TableDataInfo;
 |  | 
 | 
											
												
													
														|  | -import org.springframework.transaction.annotation.Transactional;
 |  | 
 | 
											
												
													
														|  | -import org.springframework.web.bind.annotation.RequestParam;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
												
													
														|  |   * 预案演练库Service业务层处理
 |  |   * 预案演练库Service业务层处理
 | 
											
										
											
												
													
														|  | @@ -54,20 +49,57 @@ public class CoreDrillDictionaryServiceImpl extends ServiceImpl<CoreDrillDiction
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public TableDataInfo<CoreDrillDictionaryPageVo> selectPage(CoreDrillDictionaryPageDto request) {
 |  |      public TableDataInfo<CoreDrillDictionaryPageVo> selectPage(CoreDrillDictionaryPageDto request) {
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        if (request.getCheckSub()) {
 |  | 
 | 
											
												
													
														|  | -            SysOrg org = getOrg(request.getOrgId());
 |  | 
 | 
											
												
													
														|  | -            request.setOrgPath(org.getPath());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        dealPageRequestParam(request);
 | 
											
												
													
														|  | 
 |  | +        Page<CoreDrillDictionaryPageVo> page = null;
 | 
											
												
													
														|  | 
 |  | +        if (ObjectUtil.equal(Constants.TOP_ORG_PARENT_ID, request.getOrgParentId())) {
 | 
											
												
													
														|  | 
 |  | +            if (!request.getCheckSub()) {
 | 
											
												
													
														|  | 
 |  | +                page = coreDrillDictionaryMapper.selectPageData1(request.getPageRequest(), request);
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  | 
 |  | +                page = coreDrillDictionaryMapper.selectPageData2(request.getPageRequest(), request);
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +            if (!request.getCheckSub()) {
 | 
											
												
													
														|  | 
 |  | +                page = coreDrillDictionaryMapper.selectPageData3(request.getPageRequest(), request);
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  | 
 |  | +                page = coreDrillDictionaryMapper.selectPageData4(request.getPageRequest(), request);
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        //获取数据
 |  | 
 | 
											
												
													
														|  | -        Page<CoreDrillDictionaryPageVo> page = coreDrillDictionaryMapper.selectPageData(request.getPageRequest(), request);
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          //抓换为TableDataInfo适配前端
 |  |          //抓换为TableDataInfo适配前端
 | 
											
												
													
														|  |          return TableDataInfo.build(page);
 |  |          return TableDataInfo.build(page);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    private void dealPageRequestParam(CoreDrillDictionaryPageDto request) {
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        SysOrg curOrg = getOrg(request.getOrgId());
 | 
											
												
													
														|  | 
 |  | +        request.setOrgParentId(curOrg.getParentId());
 | 
											
												
													
														|  | 
 |  | +        if (request.getCheckSub()) {
 | 
											
												
													
														|  | 
 |  | +            //顶级机构下穿 :查询所有
 | 
											
												
													
														|  | 
 |  | +            if (ObjectUtil.equal(Constants.TOP_ORG_PARENT_ID, curOrg.getParentId())) {
 | 
											
												
													
														|  | 
 |  | +                request.setOrgPath(curOrg.getPath());
 | 
											
												
													
														|  | 
 |  | +                return;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            //普通机构下穿,查询父机构数据和下面机构所有数据
 | 
											
												
													
														|  | 
 |  | +            List<Long> collect = Arrays.stream(curOrg.getPath().split("-")).map(Long::parseLong).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +            //这里如果不remove,那么根据orgIdList和path查询 实际上是重复了的
 | 
											
												
													
														|  | 
 |  | +            collect.remove(curOrg.getId());
 | 
											
												
													
														|  | 
 |  | +            request.setOrgIdList(collect);
 | 
											
												
													
														|  | 
 |  | +            request.setOrgPath(curOrg.getPath());
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +            //顶级机构不下穿 :查询自己的数据
 | 
											
												
													
														|  | 
 |  | +            if (ObjectUtil.equal(Constants.TOP_ORG_PARENT_ID, curOrg.getParentId())) {
 | 
											
												
													
														|  | 
 |  | +                return;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            //普通机构不下穿,查询父机构数据和自己的数据
 | 
											
												
													
														|  | 
 |  | +            List<Long> collect = Arrays.stream(curOrg.getPath().split("-")).map(Long::parseLong).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +            request.setOrgIdList(collect);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      private SysOrg getOrg(Long orgId) {
 |  |      private SysOrg getOrg(Long orgId) {
 | 
											
												
													
														|  |          return RemoteCallHandlerExecutor.executeRemoteCall(() ->
 |  |          return RemoteCallHandlerExecutor.executeRemoteCall(() ->
 | 
											
												
													
														|  |                  orgService.selectOrgById(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 |  |                  orgService.selectOrgById(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 | 
											
										
											
												
													
														|  | @@ -153,7 +185,7 @@ public class CoreDrillDictionaryServiceImpl extends ServiceImpl<CoreDrillDiction
 | 
											
												
													
														|  |          String path = org.getPath();
 |  |          String path = org.getPath();
 | 
											
												
													
														|  |          List<CoreDrillDictionary> selectList = coreDrillDictionaryMapper.selectList(new LambdaQueryWrapper<CoreDrillDictionary>()
 |  |          List<CoreDrillDictionary> selectList = coreDrillDictionaryMapper.selectList(new LambdaQueryWrapper<CoreDrillDictionary>()
 | 
											
												
													
														|  |                  .eq(CoreDrillDictionary::getDeleted, 0)
 |  |                  .eq(CoreDrillDictionary::getDeleted, 0)
 | 
											
												
													
														|  | -               // .likeRight(CoreDrillDictionary::getOrgPath, path)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                // .likeRight(CoreDrillDictionary::getOrgPath, path)
 | 
											
												
													
														|  |                  .eq(ObjectUtil.isNotNull(dictValue), CoreDrillDictionary::getDrillType, dictValue)
 |  |                  .eq(ObjectUtil.isNotNull(dictValue), CoreDrillDictionary::getDrillType, dictValue)
 | 
											
												
													
														|  |                  .select(CoreDrillDictionary::getId
 |  |                  .select(CoreDrillDictionary::getId
 | 
											
												
													
														|  |                          , CoreDrillDictionary::getDrillTypeName
 |  |                          , CoreDrillDictionary::getDrillTypeName
 |