yanghui
2022-11-28 d03851da2ae1227f95f351a845b24fd1244656e9
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerGoodsServiceImpl.java
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static java.util.Objects.isNull;
@@ -195,13 +196,13 @@
        List<ComShopFlowerGoodsAttrVO> goodsAttrList = new ArrayList<>();
        List<ComShopFlowerGoodsAttrDO> goodsAttrDOS =
                shopFlowerGoodsAttrDAO.selectList(new QueryWrapper<ComShopFlowerGoodsAttrDO>().eq("goods_id", goodsId));
        List<String> images = new ArrayList<>();
//        List<String> images = new ArrayList<>();
        int stock = 0;
        for (ComShopFlowerGoodsAttrDO attrDO : goodsAttrDOS) {
            ComShopFlowerGoodsAttrVO goodsAttrVO = new ComShopFlowerGoodsAttrVO();
            BeanUtils.copyProperties(attrDO, goodsAttrVO);
            String attrPic = attrDO.getAttrPic();
            images.add(attrPic);
//            images.add(attrPic);
            goodsAttrList.add(goodsAttrVO);
            stock = stock +attrDO.getStock();
        }
@@ -215,7 +216,7 @@
        BeanUtils.copyProperties(goodsDO, shopGoods);
        shopGoods.setGoodsAttrList(goodsAttrList);
        shopGoods.setConvenientMerchantVO(convenientMerchantVO);
        shopGoods.setImages(StringUtils.join(images,","));
//        shopGoods.setImages(StringUtils.join(images,","));
        Integer orderNum = comShopFlowerOrderGoodsDAO.selectCount(new LambdaQueryWrapper<ComShopFlowerOrderGoodsDO>().eq(ComShopFlowerOrderGoodsDO::getGoodsId, goodsId));
        shopGoods.setOrderNum(orderNum);
        List<ComShopFlowerEvaluateVO> comShopFlowerEvaluateVOList = comShopFlowerEvaluateDAO.selectListLimit(goodsId);
@@ -341,4 +342,11 @@
        }
        return R.ok();
    }
    @Override
    public R countSaleByUserId(Long userId){
        List<ComShopOrderStoreIdCountVO> comShopOrderStoreIdCountVOS = this.baseMapper.countSaleByUserId(userId);
        Map<String, Integer> collect = comShopOrderStoreIdCountVOS.stream().collect(Collectors.toMap(ComShopOrderStoreIdCountVO::getCountName, ComShopOrderStoreIdCountVO::getCountNum));
        return R.ok(collect);
    }
}