无关风月
2025-01-07 7804e7a907c6bb407b359fa144fd09fb081be09f
manage/src/main/java/com/jilongda/manage/service/impl/TWarehousingServiceImpl.java
@@ -91,12 +91,17 @@
    public PageInfo<TWarehousingVO> inventoryReceiptList(TWarehousingDetailQuery query) {
        PageInfo<TWarehousingVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TWarehousingVO> list = this.baseMapper.inventoryReceiptList(query,pageInfo);
        List<TStore> stores = storeMapper.selectList(Wrappers.lambdaQuery(TStore.class)
                .in(TStore::getId, list.stream().map(TWarehousingVO::getStoreId).collect(Collectors.toList())));
        for (TWarehousingVO tWarehousingVO : list) {
            List<TFrameWarehousingDetail> tFrameWarehousingDetails = frameWarehousingDetailMapper.selectList(Wrappers.lambdaQuery(TFrameWarehousingDetail.class)
                    .eq(TFrameWarehousingDetail::getWarehousingId, tWarehousingVO.getId()));
            if(CollectionUtils.isNotEmpty(tFrameWarehousingDetails)){
                tWarehousingVO.setTotalNum(tFrameWarehousingDetails.stream().mapToInt(TFrameWarehousingDetail::getTotal).sum());
            }
            stores.stream().filter(tStore -> tStore.getId().equals(tWarehousingVO.getStoreId())).findFirst().ifPresent(tStore -> {
                tWarehousingVO.setStoreName(tStore.getName());
            });
        }
        pageInfo.setRecords(list);
        return pageInfo;