|
|
@@ -9,6 +9,13 @@ import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.his.service.IFsStoreProductService;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductAttrScrm;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductAttrValueScrm;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductRelationScrm;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
|
+import com.fs.hisStore.service.IFsStoreProductAttrScrmService;
|
|
|
+import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
|
|
|
+import com.fs.hisStore.service.IFsStoreProductRelationScrmService;
|
|
|
import com.fs.hisStore.service.IFsStoreProductScrmService;
|
|
|
import com.fs.live.domain.LiveGoods;
|
|
|
import com.fs.live.service.ILiveGoodsService;
|
|
|
@@ -17,6 +24,7 @@ import com.github.pagehelper.PageInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -37,6 +45,13 @@ public class LiveGoodsController extends AppBaseController
|
|
|
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductAttrScrmService attrService;
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductRelationScrmService productRelationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductAttrValueScrmService attrValueService;
|
|
|
|
|
|
/**
|
|
|
* 查询直播商品列表
|
|
|
@@ -119,7 +134,39 @@ public class LiveGoodsController extends AppBaseController
|
|
|
@GetMapping("/liveGoodsDetail/{productId}")
|
|
|
public R liveGoodsDetail(@PathVariable Long productId)
|
|
|
{
|
|
|
- return R.ok().put("data",fsStoreProductService.selectFsStoreProductById(productId));
|
|
|
+ FsStoreProductScrm product = fsStoreProductService.selectFsStoreProductById(productId);
|
|
|
+ if(product==null){
|
|
|
+ return R.error("商品不存在或已下架");
|
|
|
+ }
|
|
|
+ List<FsStoreProductAttrScrm> productAttr=attrService.selectFsStoreProductAttrByProductId(productId);
|
|
|
+ List<FsStoreProductAttrValueScrm> productValues=attrValueService.selectFsStoreProductAttrValueByProductId(productId);
|
|
|
+//获取用户的TOKEN写入足迹
|
|
|
+ String userId=getUserId();
|
|
|
+ if(userId!=null){
|
|
|
+ FsStoreProductRelationScrm productRelation=new FsStoreProductRelationScrm();
|
|
|
+ productRelation.setIsDel(0);
|
|
|
+ productRelation.setUserId(Long.parseLong(userId));
|
|
|
+ productRelation.setProductId(product.getProductId());
|
|
|
+ productRelation.setType("foot");
|
|
|
+ List<FsStoreProductRelationScrm> productRelations=productRelationService.selectFsStoreProductRelationList(productRelation);
|
|
|
+ if(productRelations!=null&&productRelations.size()>0){
|
|
|
+ FsStoreProductRelationScrm relation=productRelations.get(0);
|
|
|
+ relation.setUpdateTime(new Date());
|
|
|
+ productRelationService.updateFsStoreProductRelation(relation);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ FsStoreProductRelationScrm relation=new FsStoreProductRelationScrm();
|
|
|
+ relation.setUserId(Long.parseLong(userId));
|
|
|
+ relation.setIsDel(0);
|
|
|
+ relation.setProductId(product.getProductId());
|
|
|
+ relation.setUpdateTime(new Date());
|
|
|
+ relation.setType("foot");
|
|
|
+ relation.setCreateTime(new Date());
|
|
|
+ relation.setUpdateTime(new Date());
|
|
|
+ productRelationService.insertFsStoreProductRelation(relation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok().put("product",product).put("productAttr",productAttr).put("productValues",productValues);
|
|
|
}
|
|
|
|
|
|
/**
|