doum
14 小时以前 80fd41ea0dc602ac3ca33778f17fce5bc2e817b1
server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -89,6 +89,8 @@
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private ShopMapper shopMapper;
    @Autowired
    private GoodsSkuAttrJoinMapper goodsSkuAttrJoinMapper;
@@ -214,8 +216,9 @@
                    || goods.getDeductRata() == null
                    || goods.getPrice() == null
                    || goods.getSkuPrice() == null
                    || StringUtils.isBlank(goods.getImgurl())
                    || org.apache.commons.collections.CollectionUtils.isEmpty(goods.getFileList())) {
//                    || StringUtils.isBlank(goods.getImgurl())
//                    || org.apache.commons.collections.CollectionUtils.isEmpty(goods.getFileList())
            ) {
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), ResponseStatus.BAD_REQUEST.getMessage());
            }
@@ -710,6 +713,9 @@
    @Override
    public List<Goods> findList(Goods goods) {
        QueryWrapper<Goods> wrapper = new QueryWrapper<>(goods);
        wrapper.lambda()
            .in(goods.getIdList() != null && goods.getIdList().size()>0, Goods::getId, goods.getIdList())
            .eq( Goods::getIsdeleted, Constants.ZERO);
        return goodsMapper.selectList(wrapper);
    }
@@ -718,9 +724,7 @@
        IPage<Goods> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        MPJLambdaWrapper<Goods> queryWrapper = new MPJLambdaWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        queryWrapper.selectAll(Goods.class);
        queryWrapper.select("t1.name",Goods::getCategoryName);
        queryWrapper.select("t2.name" ,Goods::getBrandName);
        queryWrapper.select("t3.name" ,Goods::getParentName);
@@ -729,6 +733,7 @@
        queryWrapper.leftJoin(Labels.class,Labels::getId,Goods::getParentCategoryId);
        //库存量
        queryWrapper.select("(select sum(STOCK) from goods_sku where ISDELETED=0 and GOODS_ID=t.id) as stockNum ");
        queryWrapper.select("(select count(id) from shop_goods_relation s where s.ISDELETED=0 and s.GOODS_ID=t.id) as pricedShopNum ");
        //实际销量
        queryWrapper.select("(select sum(gd.GOODS_NUM) from  goodsorder_detail gd" +
                "        inner join  goods_sku gs on gs.id=gd.GOODS_SKU_ID" +
@@ -750,8 +755,8 @@
        queryWrapper.eq(pageWrap.getModel().getParentCategoryId() != null, Goods::getParentCategoryId, pageWrap.getModel().getParentCategoryId());
        queryWrapper.eq(pageWrap.getModel().getBrandId() != null, Goods::getBrandId, pageWrap.getModel().getBrandId());
        queryWrapper.eq(pageWrap.getModel().getStatus() != null, Goods::getStatus, pageWrap.getModel().getStatus());
        queryWrapper.orderByDesc(Goods::getCreateDate);
        queryWrapper.in(pageWrap.getModel().getIdList() != null && pageWrap.getModel().getIdList().size()>0, Goods::getId, pageWrap.getModel().getIdList());
        queryWrapper.orderByDesc(Goods::getId);
        IPage<Goods> result = goodsAdminJoinMapper.selectJoinPage(page, Goods.class, queryWrapper);
        initResult(result.getRecords());
        return PageData.from(result);
@@ -780,9 +785,12 @@
        if (list == null || list.size() == 0) {
            return;
        }
       long shopNum = shopMapper.selectCount(new QueryWrapper<Shop>().lambda()
                .eq(Shop::getIsdeleted,Constants.ZERO));
        String path = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode()
                + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_FILE).getCode();
        for (Goods goods : list) {
            goods.setShopNum(shopNum);
            goods.setResourcePath(path);
            //查询sku
            MPJLambdaWrapper<GoodsSku> queryWrapper = new MPJLambdaWrapper<GoodsSku>()