| | |
| | | import com.ruoyi.system.mapper.AssetTypeMapper; |
| | | import com.ruoyi.system.model.AssetMain; |
| | | import com.ruoyi.system.model.AssetType; |
| | | import com.ruoyi.system.query.AssetStatisticsListDetailQuery; |
| | | import com.ruoyi.system.query.AssetStatisticsListQuery; |
| | | import com.ruoyi.system.service.AssetMainService; |
| | | import com.ruoyi.system.service.AssetTypeService; |
| | | import com.ruoyi.system.vo.AssetStatisticsDetailVO; |
| | | import com.ruoyi.system.vo.AssetStatisticsVO; |
| | | import com.ruoyi.system.vo.asset.AssetTypeTreeVO; |
| | | import com.ruoyi.system.vo.system.NotificationVO; |
| | |
| | | public class AssetTypeServiceImpl extends ServiceImpl<AssetTypeMapper, AssetType> implements AssetTypeService { |
| | | |
| | | private final AssetMainService assetMainService; |
| | | private final AssetTypeService assetTypeService; |
| | | |
| | | @Override |
| | | public List<AssetTypeTreeVO> getAssetTypeTree() { |
| | |
| | | if (assetTypeIds.isEmpty()){ |
| | | return new PageInfo<>(); |
| | | } |
| | | Map<Integer, List<AssetMain>> assetMainMap = assetMainService.lambdaQuery().in(AssetMain::getAssetTypeId, assetTypeIds).list() |
| | | Map<Integer, List<AssetMain>> assetMainMap = assetMainService.lambdaQuery() |
| | | .eq(AssetMain::getOwnershipDeptId, query.getDeptId()) |
| | | .in(AssetMain::getAssetTypeId, assetTypeIds).list() |
| | | .stream() |
| | | .collect(Collectors.groupingBy(AssetMain::getAssetTypeId)); |
| | | for (AssetStatisticsVO asset : list) { |
| | |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<AssetStatisticsDetailVO> pageListDetail(AssetStatisticsListDetailQuery query) { |
| | | String assetTypeName = null; |
| | | AssetType assetType = assetTypeService.getById(query.getAssetTypeIdSecond()); |
| | | if (assetType!=null){ |
| | | AssetType assetTypeParent = assetTypeService.getById(assetType.getParentId()); |
| | | if (assetTypeParent!=null){ |
| | | assetTypeName = assetTypeParent.getTypeName()+">"+assetType.getTypeName(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.hasLength(query.getNameOrCode())){ |
| | | // 查询出资产名称或者资产编号符合条件的code |
| | | List<Integer> assetTypeIds = assetMainService.lambdaQuery().like(AssetMain::getAssetName, query.getNameOrCode()) |
| | | .or() |
| | | .like(AssetMain::getAssetCode, query.getNameOrCode()) |
| | | .list() |
| | | .stream() |
| | | .map(AssetMain::getAssetTypeId) |
| | | .collect(Collectors.toList()); |
| | | query.setAssetMainIds(assetTypeIds); |
| | | if (assetTypeIds.isEmpty()){ |
| | | return new PageInfo<>(); |
| | | } |
| | | } |
| | | PageInfo<AssetStatisticsDetailVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<AssetStatisticsDetailVO> list = this.baseMapper.pageListDetail(query,pageInfo); |
| | | for (AssetStatisticsDetailVO assetStatisticsDetailVO : list) { |
| | | assetStatisticsDetailVO.setAssetTypeName(assetTypeName); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | } |