|
|
@@ -4,6 +4,7 @@ package com.fs.app.controller.store;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.controller.AppBaseController;
|
|
|
+import com.fs.common.BeanCopyUtils;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.param.BaseQueryParam;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
@@ -19,6 +20,9 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -65,12 +69,13 @@ public class ProductScrmController extends AppBaseController {
|
|
|
* @return */
|
|
|
@ApiOperation("获取分类")
|
|
|
@GetMapping("/getProductCate")
|
|
|
- public R getProductCate(@RequestParam(name = "storeId",required = false) Long storeId){
|
|
|
+ public R getProductCate(@RequestParam(name = "storeId",required = false) Long storeId,@RequestParam(name = "isDrug",required = false) Integer isDrug){
|
|
|
try {
|
|
|
FsStoreProductCategoryScrm param=new FsStoreProductCategoryScrm();
|
|
|
param.setIsShow(1);
|
|
|
param.setIsDel(0);
|
|
|
param.setStoreId(storeId);
|
|
|
+ param.setIsDrug(isDrug);
|
|
|
List<FsStoreProductCategoryScrm> list=categoryService.selectFsStoreProductCategoryListQuery(param);
|
|
|
return R.ok().put("data",list);
|
|
|
} catch (Exception e){
|
|
|
@@ -79,12 +84,13 @@ public class ProductScrmController extends AppBaseController {
|
|
|
}
|
|
|
@ApiOperation("获取分类")
|
|
|
@GetMapping("/getProductCateByPid")
|
|
|
- public R getProductCateByPid(@RequestParam(value="pid") Long pid, @RequestParam(value="storeId",required = false) Long storeId,HttpServletRequest request){
|
|
|
+ public R getProductCateByPid(@RequestParam(value="pid") Long pid, @RequestParam(value="storeId",required = false) Long storeId, @Param("isDrug") Integer isDrug, HttpServletRequest request){
|
|
|
try {
|
|
|
FsStoreProductCategoryScrm param=new FsStoreProductCategoryScrm();
|
|
|
param.setIsShow(1);
|
|
|
param.setIsDel(0);
|
|
|
param.setPid(pid);
|
|
|
+ param.setIsDrug(isDrug);
|
|
|
param.setStoreId(storeId);
|
|
|
List<FsStoreProductCategoryScrm> list=categoryService.selectFsStoreProductCategoryListQuery(param);
|
|
|
return R.ok().put("data",list);
|
|
|
@@ -98,29 +104,44 @@ public class ProductScrmController extends AppBaseController {
|
|
|
public R getProducts(FsStoreProductQueryParam param, HttpServletRequest request){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
param.setIsDisplay(1);
|
|
|
- List<FsStoreProductListQueryVO> productList=productService.selectFsStoreProductListQuery(param);
|
|
|
+ List<FsStoreProductListQueryVO> productList = null;
|
|
|
+ if(param.getIsDrug() != null && param.getIsDrug() == 0){
|
|
|
+ productList = productService.selectFsStoreProductOrdinaryListQuery(param);
|
|
|
+ }else {
|
|
|
+ productList = productService.selectFsStoreProductListQuery(param);
|
|
|
+ }
|
|
|
PageInfo<FsStoreProductListQueryVO> listPageInfo=new PageInfo<>(productList);
|
|
|
return R.ok().put("data",listPageInfo);
|
|
|
}
|
|
|
@ApiOperation("获取商品详情")
|
|
|
@GetMapping("/getProductDetails")
|
|
|
- public R getProductDetails(@RequestParam(value="productId") Long productId,String storeId){
|
|
|
- FsStoreProductQueryVO product=productService.selectFsStoreProductByIdQuery(productId, storeId);
|
|
|
- if(product==null){
|
|
|
- return R.error("商品不存在或已下架");
|
|
|
- }
|
|
|
- //增加店铺信息
|
|
|
+ public R getProductDetails(@RequestParam(value="productId") Long productId,String storeId,Integer isDrug){
|
|
|
+ FsStoreProductQueryVO product = new FsStoreProductQueryVO();
|
|
|
FsStoreScrm fsStoreScrm = null;
|
|
|
- if(StringUtils.isNotEmpty(product.getStoreId())){
|
|
|
- fsStoreScrm = storeScrmService.selectFsStoreByStoreId(Long.parseLong(product.getStoreId()));
|
|
|
- //根据按判断校验条件
|
|
|
- SysConfig mallconfig = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
|
- MedicalMallConfig medicalMallConfig = JSON.parseObject(mallconfig.getConfigValue(), MedicalMallConfig.class);
|
|
|
+ if(isDrug != null && isDrug == 0){
|
|
|
+ FsStoreProductScrm productScrm = productService.selectFsStoreProductById(productId);
|
|
|
+ if(productScrm == null){
|
|
|
+ return R.error("操作失败,商品不存在!");
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(productScrm, product);
|
|
|
+ }else {
|
|
|
+ product = productService.selectFsStoreProductByIdQuery(productId, storeId);
|
|
|
+ if(product==null){
|
|
|
+ return R.error("商品不存在或已下架");
|
|
|
+ }
|
|
|
+ //增加店铺信息
|
|
|
+ if(StringUtils.isNotEmpty(product.getStoreId())){
|
|
|
+ fsStoreScrm = storeScrmService.selectFsStoreByStoreId(Long.parseLong(product.getStoreId()));
|
|
|
+ //根据按判断校验条件
|
|
|
+ SysConfig mallconfig = configService.selectConfigByConfigKey("medicalMall.func.switch");
|
|
|
+ MedicalMallConfig medicalMallConfig = JSON.parseObject(mallconfig.getConfigValue(), MedicalMallConfig.class);
|
|
|
|
|
|
- if(medicalMallConfig != null && medicalMallConfig.isThreePartyEntry() && fsStoreScrm.getStatus() != 1){
|
|
|
- return R.error("当前商品店铺"+fsStoreScrm.getStoreName()+"已停用!");
|
|
|
+ if(medicalMallConfig != null && medicalMallConfig.isThreePartyEntry() && fsStoreScrm.getStatus() != 1){
|
|
|
+ return R.error("当前商品店铺"+fsStoreScrm.getStoreName()+"已停用!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
List<FsStoreProductAttrScrm> productAttr=attrService.selectFsStoreProductAttrByProductId(product.getProductId());
|
|
|
List<FsStoreProductAttrValueScrm> productValues=attrValueService.selectFsStoreProductAttrValueByProductId(product.getProductId());
|
|
|
|
|
|
@@ -272,15 +293,28 @@ public class ProductScrmController extends AppBaseController {
|
|
|
@GetMapping("/getTuiProducts")
|
|
|
public R getTuiProducts(BaseQueryParam param, HttpServletRequest request){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
- List<FsStoreProductListQueryVO> list=productService.selectFsStoreProductTuiListQuery();
|
|
|
- PageInfo<FsStoreProductListQueryVO> listPageInfo=new PageInfo<>(list.size() < 4?list.subList(0,list.size()):list.subList(0,4));
|
|
|
+ List<FsStoreProductListQueryVO> list=productService.selectFsStoreProductTuiListQuery(param);
|
|
|
+ PageInfo<FsStoreProductListQueryVO> listPageInfo;
|
|
|
+
|
|
|
+ //普通商品
|
|
|
+ if(param.getIsDrug() != null && param.getIsDrug() == 0){
|
|
|
+ listPageInfo = new PageInfo<>(list);
|
|
|
+ }else {//药品
|
|
|
+ listPageInfo=new PageInfo<>(list.size() < 4?list.subList(0,list.size()):list.subList(0,4));
|
|
|
+ }
|
|
|
+
|
|
|
return R.ok().put("data",listPageInfo);
|
|
|
}
|
|
|
@ApiOperation("获取喜欢商品数据")
|
|
|
@GetMapping("/getGoodsProducts")
|
|
|
public R getGoodsProducts(BaseQueryParam param, HttpServletRequest request){
|
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
|
- List<FsStoreProductListQueryVO> list=productService.selectFsStoreProductGoodListQuery();
|
|
|
+ List<FsStoreProductListQueryVO> list;
|
|
|
+ if(param.getIsDrug() != null && param.getIsDrug() == 0){
|
|
|
+ list =productService.selectFsStoreProductGoodListList();
|
|
|
+ }else {
|
|
|
+ list = productService.selectFsStoreProductGoodListQuery();
|
|
|
+ }
|
|
|
PageInfo<FsStoreProductListQueryVO> listPageInfo=new PageInfo<>(list);
|
|
|
return R.ok().put("data",listPageInfo);
|
|
|
|