|
@@ -136,12 +136,12 @@ public class GoodsDetailsController extends BaseController {
|
|
|
|
|
|
//缓存不存在,查库并缓存
|
|
|
Goods goods = goodsModel.getGoodsByGoodsId(goodsId);
|
|
|
- AssertUtil.notNull(goods, "商品不存在,请重试!");
|
|
|
- if (!goods.getState().equals(GoodsConst.GOODS_STATE_UPPER)) {
|
|
|
- return SldResponse.fail("商品已下架,请重试!");
|
|
|
- }
|
|
|
+// AssertUtil.notNull(goods, "商品不存在,请重试!");
|
|
|
+// if (!goods.getState().equals(GoodsConst.GOODS_STATE_UPPER)) {
|
|
|
+// return SldResponse.fail("商品已下架,请重试!");
|
|
|
+// }
|
|
|
GoodsExtend goodsExtend = goodsExtendModel.getGoodsExtendByGoodsId(goodsId);
|
|
|
- AssertUtil.notNull(goodsExtend, "商品不存在,请重试!");
|
|
|
+// AssertUtil.notNull(goodsExtend, "商品不存在,请重试!");
|
|
|
|
|
|
SysSeoVO sysSeoVO = storeModel.getRecordByTargetIdAndTypeForGoodsDetail(goodsId, SeoTypeConstant.SEO_TYPE_GOODS);
|
|
|
|
|
@@ -164,15 +164,19 @@ public class GoodsDetailsController extends BaseController {
|
|
|
//是否关注店铺
|
|
|
Boolean isFollowStore = checkIsFollowStore(member.getMemberId(), product.getStoreId());
|
|
|
|
|
|
- //查询规格图片
|
|
|
- GoodsPictureExample goodsPictureExample = new GoodsPictureExample();
|
|
|
- goodsPictureExample.setOrderBy("is_main asc,picture_id asc");
|
|
|
- goodsPictureExample.setGoodsId(goodsId);
|
|
|
- //有主规格
|
|
|
- if (goodsExtend.getMainSpecId() != 0) {
|
|
|
- goodsPictureExample.setSpecValueIdIn(product.getSpecValueIds());
|
|
|
+ List<GoodsPicture> goodsPictureList = new ArrayList<>();
|
|
|
+ if (goodsExtend != null) {
|
|
|
+ //查询规格图片
|
|
|
+ GoodsPictureExample goodsPictureExample = new GoodsPictureExample();
|
|
|
+ goodsPictureExample.setOrderBy("is_main asc,picture_id asc");
|
|
|
+ goodsPictureExample.setGoodsId(goodsId);
|
|
|
+ //有主规格
|
|
|
+ if (goodsExtend.getMainSpecId() != 0) {
|
|
|
+ goodsPictureExample.setSpecValueIdIn(product.getSpecValueIds());
|
|
|
+ }
|
|
|
+ goodsPictureList = goodsPictureModel.getGoodsPictureList(goodsPictureExample, null);
|
|
|
}
|
|
|
- List<GoodsPicture> goodsPictureList = goodsPictureModel.getGoodsPictureList(goodsPictureExample, null);
|
|
|
+
|
|
|
String webSite = WebUtil.getWebSite(request);
|
|
|
Store store = storeModel.getStoreByStoreId(goods.getStoreId());
|
|
|
Integer isOwnStore = store.getIsOwnStore();
|
|
@@ -216,7 +220,9 @@ public class GoodsDetailsController extends BaseController {
|
|
|
//物流发货信息
|
|
|
GoodsFrontDetailVO.DeliverInfo deliverInfo = null;
|
|
|
if (goods.getIsVirtualGoods() == GoodsConst.IS_VIRTUAL_GOODS_1) {
|
|
|
- deliverInfo = getDeliverInfo(goodsExtend, product, member);
|
|
|
+ if (goodsExtend != null) {
|
|
|
+ deliverInfo = getDeliverInfo(goodsExtend, product, member);
|
|
|
+ }
|
|
|
}
|
|
|
//商品说明书
|
|
|
GoodsAnnexExample goodsAnnexExample = new GoodsAnnexExample();
|
|
@@ -268,12 +274,12 @@ public class GoodsDetailsController extends BaseController {
|
|
|
Long goodsId = product.getGoodsId();
|
|
|
|
|
|
Goods goods = goodsModel.getGoodsByGoodsId(goodsId);
|
|
|
- AssertUtil.notNull(goods, "商品不存在,请重试!");
|
|
|
- if (!goods.getState().equals(GoodsConst.GOODS_STATE_UPPER)) {
|
|
|
- return SldResponse.fail("商品已下架,请重试!");
|
|
|
- }
|
|
|
+// AssertUtil.notNull(goods, "商品不存在,请重试!");
|
|
|
+// if (!goods.getState().equals(GoodsConst.GOODS_STATE_UPPER)) {
|
|
|
+// return SldResponse.fail("商品已下架,请重试!");
|
|
|
+// }
|
|
|
GoodsExtend goodsExtend = goodsExtendModel.getGoodsExtendByGoodsId(goodsId);
|
|
|
- AssertUtil.notNull(goodsExtend, "商品不存在,请重试!");
|
|
|
+// AssertUtil.notNull(goodsExtend, "商品不存在,请重试!");
|
|
|
|
|
|
//seo
|
|
|
SysSeoVO sysSeoVO = storeModel.getRecordByTargetIdAndTypeForGoodsDetail(goodsId, SeoTypeConstant.SEO_TYPE_GOODS);
|
|
@@ -308,15 +314,19 @@ public class GoodsDetailsController extends BaseController {
|
|
|
//是否关注店铺
|
|
|
Boolean isFollowStore = checkIsFollowStore(member.getMemberId(), product.getStoreId());
|
|
|
|
|
|
- //查询规格图片
|
|
|
- GoodsPictureExample goodsPictureExample = new GoodsPictureExample();
|
|
|
- goodsPictureExample.setOrderBy("is_main asc,picture_id asc");
|
|
|
- goodsPictureExample.setGoodsId(goodsId);
|
|
|
- //有主规格
|
|
|
- if (goodsExtend.getMainSpecId() != 0) {
|
|
|
- goodsPictureExample.setSpecValueIdIn(product.getSpecValueIds());
|
|
|
+ List<GoodsPicture> goodsPictureList = new ArrayList<>();
|
|
|
+ if (goodsExtend != null) {
|
|
|
+ //查询规格图片
|
|
|
+ GoodsPictureExample goodsPictureExample = new GoodsPictureExample();
|
|
|
+ goodsPictureExample.setOrderBy("is_main asc,picture_id asc");
|
|
|
+ goodsPictureExample.setGoodsId(goodsId);
|
|
|
+ //有主规格
|
|
|
+ if (goodsExtend.getMainSpecId() != 0) {
|
|
|
+ goodsPictureExample.setSpecValueIdIn(product.getSpecValueIds());
|
|
|
+ }
|
|
|
+ goodsPictureList = goodsPictureModel.getGoodsPictureList(goodsPictureExample, null);
|
|
|
}
|
|
|
- List<GoodsPicture> goodsPictureList = goodsPictureModel.getGoodsPictureList(goodsPictureExample, null);
|
|
|
+
|
|
|
|
|
|
Store store = storeModel.getStoreByStoreId(goods.getStoreId());
|
|
|
String webSite = WebUtil.getWebSite(request);
|
|
@@ -361,7 +371,9 @@ public class GoodsDetailsController extends BaseController {
|
|
|
//物流发货信息
|
|
|
GoodsFrontDetailVO.DeliverInfo deliverInfo = null;
|
|
|
if (goods.getIsVirtualGoods() == GoodsConst.IS_VIRTUAL_GOODS_1) {
|
|
|
- deliverInfo = getDeliverInfo(goodsExtend, product, member);
|
|
|
+ if (goodsExtend != null) {
|
|
|
+ deliverInfo = getDeliverInfo(goodsExtend, product, member);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
GoodsFrontDetailVO goodsFrontDetailVO = new GoodsFrontDetailVO(goods, isFavorite, null, goodsExtend,
|