| | |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.join.GoodsorderJoinMapper; |
| | | import com.doumee.dao.business.join.MemberJoinMapper; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.join.ProductLabelJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.model.Labels; |
| | |
| | | |
| | | @Autowired |
| | | private ShopMapper shopMapper; |
| | | @Autowired |
| | | private GoodsMapper goodsMapper; |
| | | @Autowired |
| | | private GoodsSkuMapper goodsSkuMapper; |
| | | @Autowired |
| | | private ShopGoodsRelationMapper shopGoodsRelationMapper; |
| | | |
| | | @Autowired |
| | | private ShopCommentService shopCommentService; |
| | |
| | | |
| | | @Override |
| | | public List<Shop> findList(Shop shop) { |
| | | shop.setIsdeleted(Constants.ZERO); |
| | | QueryWrapper<Shop> wrapper = new QueryWrapper<>(shop); |
| | | return shopMapper.selectList(wrapper); |
| | | } |
| | |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | |
| | | queryWrapper.selectAll(Shop.class); |
| | | if(pageWrap.getModel().getGoodsId()!=null){ |
| | | //查询某商品的供货价 |
| | | queryWrapper.select("(select s.price from shop_goods_relation s where s.ISDELETED=0 and s.shop_id = t.id and s.GOODS_ID="+pageWrap.getModel().getGoodsId()+") as goodsPrice "); |
| | | } |
| | | queryWrapper.selectAs(Labels::getName,Shop::getBigAreaName); |
| | | queryWrapper.selectAs(Member::getNickname,Shop::getNickName); |
| | | queryWrapper.selectAs(Member::getImgurl,Shop::getMemberImgurl); |
| | |
| | | queryWrapper.eq(pageWrap.getModel().getSaleType()!=null, Shop::getSaleType, pageWrap.getModel().getSaleType()); |
| | | queryWrapper.eq(pageWrap.getModel().getStatus()!=null, Shop::getStatus, pageWrap.getModel().getStatus()); |
| | | queryWrapper.eq(pageWrap.getModel().getIsrec()!=null, Shop::getIsrec, pageWrap.getModel().getIsrec()); |
| | | queryWrapper.orderByDesc(Shop::getCreateDate); |
| | | if(pageWrap.getModel().getGoodsId()!=null){ |
| | | queryWrapper.orderByAsc("goodsPrice"); |
| | | } |
| | | queryWrapper.orderByDesc(Shop::getId); |
| | | IPage<Shop> result = shopJoinMapper.selectJoinPage(page, Shop.class, queryWrapper); |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.SHOP_FILE).getCode(); |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public String setGoodsPrice(Shop dto){ |
| | | // 查询用户 |
| | | Shop shop = shopMapper.selectById(dto.getId()); |
| | | if (shop == null) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,供销商信息查询无效!"); |
| | | } |
| | | GoodsSku queryGoodsSku=new GoodsSku(); |
| | | queryGoodsSku.setGoodsId(dto.getGoodsId()); |
| | | queryGoodsSku.setIsdeleted(Constants.ZERO); |
| | | List<GoodsSku> goodsSkuList=goodsSkuMapper.selectList(new QueryWrapper<>(queryGoodsSku)); |
| | | if(goodsSkuList==null || goodsSkuList.size() ==0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,请确认商品信息有效且【销售价】已设置!"); |
| | | } |
| | | //默认sku信息 |
| | | GoodsSku goodsSku = goodsSkuList.get(0); |
| | | if(Constants.formatBigdecimal(goodsSku.getPrice()).compareTo(Constants.formatBigdecimal(dto.getGoodsPrice())) >=0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,供货价不允许大于商品销售价!"); |
| | | } |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | //先删除原来的数据 |
| | | shopGoodsRelationMapper.delete(new QueryWrapper<ShopGoodsRelation>().lambda() |
| | | .eq(ShopGoodsRelation::getGoodsId,dto.getGoodsId()) |
| | | .eq(ShopGoodsRelation::getShopId,shop.getId()) |
| | | ); |
| | | ShopGoodsRelation add =new ShopGoodsRelation(); |
| | | add.setCreator(user.getId()); |
| | | add.setCreateDate(new Date()); |
| | | add.setIsdeleted(Constants.ZERO); |
| | | add.setEditor(add.getCreator()); |
| | | add.setEditDate(add.getCreateDate()); |
| | | add.setShopId(dto.getId()); |
| | | add.setGoodsId(dto.getGoodsId()); |
| | | add.setGoodsSkuId(goodsSku.getId()); |
| | | add.setPrice(dto.getGoodsPrice()); |
| | | add.setStatus(Constants.ZERO); |
| | | shopGoodsRelationMapper.insert(add); |
| | | return "操作成功"; |
| | | } |
| | | } |