|
|
@ -22,12 +22,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.Constant; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.HttpContextUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.TreeUtils; |
|
|
|
import com.epmet.dao.GovMenuDao; |
|
|
|
import com.epmet.dao.GovRoleDao; |
|
|
@ -36,6 +38,7 @@ import com.epmet.dao.GovRoleUserDao; |
|
|
|
import com.epmet.dto.GovMenuDTO; |
|
|
|
import com.epmet.entity.GovMenuEntity; |
|
|
|
import com.epmet.enums.MenuTypeEnum; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.redis.GovCustomerMenuRedis; |
|
|
|
import com.epmet.redis.GovMenuRedis; |
|
|
|
import com.epmet.service.*; |
|
|
@ -77,6 +80,8 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
private GovRoleMenuDao govRoleMenuDao; |
|
|
|
@Autowired |
|
|
|
private GovRoleUserDao govRoleUserDao; |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<GovMenuDTO> page(Map<String, Object> params) { |
|
|
@ -235,6 +240,14 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
public List<GovMenuDTO> navDigitalCommunity(TokenDto tokenDto, String tableName) { |
|
|
|
tableName = getTableName(tableName); |
|
|
|
List<GovMenuEntity> menuList = baseDao.getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value(), HttpContextUtils.getLanguage(),tableName); |
|
|
|
Result<Boolean> isRootManager = epmetUserOpenFeignClient.getIsRootManager(tokenDto.getUserId()); |
|
|
|
if (!isRootManager.success()){ |
|
|
|
throw new EpmetException("getIsRootManager method is failure"); |
|
|
|
} |
|
|
|
if (isRootManager.getData()){ |
|
|
|
List<GovMenuDTO> govMenuDTOS = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class); |
|
|
|
return TreeUtils.buildTree(govMenuDTOS); |
|
|
|
} |
|
|
|
disposeGovMenu(menuList,tokenDto.getUserId()); |
|
|
|
Map<Boolean, List<GovMenuEntity>> groupByStatus = menuList.stream().collect(Collectors.groupingBy(GovMenuEntity::getRoleStatus)); |
|
|
|
List<GovMenuDTO> dtoList = ConvertUtils.sourceToTarget(CollectionUtils.isEmpty(groupByStatus.get(true)) ? new ArrayList<>() : groupByStatus.get(true), GovMenuDTO.class); |
|
|
|