| | |
| | | import com.vci.ubcs.system.feign.ISysClient; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | */ |
| | | @Override |
| | | public List<MdmCount> getMdmCounts(String userId) throws ServiceException{ |
| | | if(Func.isBlank(userId)){ |
| | | if(Func.isBlank(userId) && Func.isBlank(AuthUtil.getUserId().toString())){ |
| | | throw new ServiceException("必传参数用户id不能为空"); |
| | | } |
| | | /** 1、先查询出各分类顶层节点有哪些主数据,拿到业务类型名称,相当于拿到主数据表名 |
| | |
| | | .isNull(CodeClassify::getParentCodeClassifyOid).select(CodeClassify::getBtmTypeId) |
| | | .orderByAsc(CodeClassify::getBtmTypeId); |
| | | List<CodeClassify> codeClassifies = codeClassifyService.list(wrapper); |
| | | List<String> btyTypeIds = codeClassifies.stream().map(CodeClassify::getBtmTypeId).collect(Collectors.toList()); |
| | | List<String> btmTypeIds = codeClassifies.stream().map(CodeClassify::getBtmTypeId).collect(Collectors.toList()); |
| | | // 2、然后feign调用需要查询出菜单路由和图标 |
| | | R<List<Menu>> menuList = sysClient.getMenuByCodes(btyTypeIds); |
| | | if(!menuList.isSuccess() && menuList.getData().isEmpty()){ |
| | | throw new ServiceException("获取主数据统计时,主数据菜单查询为空,原因:"+menuList.getMsg()); |
| | | R<List<Menu>> menuList = sysClient.getMenuByCodes(btmTypeIds,Func.toLong(userId)); |
| | | if(!menuList.isSuccess()){ |
| | | throw new ServiceException("获取主数据统计时,主数据菜单查询失败,原因:"+menuList.getMsg()); |
| | | } |
| | | List<MdmCount> mdmCountList = new ArrayList<>(); |
| | | // 3、查询当前登录的用户配置了那些主数据统计项 |
| | | R<MdmCountConfig> mdmCountConfig = sysClient.getMdmCountConfig(userId); |
| | | R<MdmCountConfig> mdmCountConfig = sysClient.getMdmCountConfig(Func.isBlank(userId) ? AuthUtil.getUserId().toString():userId); |
| | | if(!mdmCountConfig.isSuccess()){ |
| | | throw new ServiceException("获取主数据统计项配置时出现错误,原因:"+mdmCountConfig.getMsg()); |
| | | } |