فهرست منبع

根据店铺id查询商品

ct 2 هفته پیش
والد
کامیت
5687523ed6

+ 9 - 2
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductAttrValueScrmMapper.java

@@ -70,8 +70,15 @@ public interface FsStoreProductAttrValueScrmMapper
     public int deleteFsStoreProductAttrValueByIds(Long[] ids);
     @Delete("delete from fs_store_product_attr_value_scrm where product_id=#{productId}")
     int deleteFsStoreProductAttrValueByProductId(Long productId);
-    @Select("select * from fs_store_product_attr_value_scrm where  product_id=#{productId}")
-    List<FsStoreProductAttrValueScrm> selectFsStoreProductAttrValueByProductId(Long productId);
+//    @Select("select * from fs_store_product_attr_value_scrm where  product_id=#{productId}")
+//    List<FsStoreProductAttrValueScrm> selectFsStoreProductAttrValueByProductId(Long productId);
+    @Select({"<script> " +
+            "select * from fs_store_product_attr_value_scrm where  product_id=#{productId} " +
+            "<if test = 'storeId != null and  storeId !=\"\"   '> " +
+            "and find_in_set(#{storeId},store_id) " +
+            "</if>" +
+            "</script>"})
+    List<FsStoreProductAttrValueScrm> selectFsStoreProductAttrValueByProductId( @Param("productId")Long productId, @Param("storeId")String storeId);
     @Select("select ifnull(stock,0) from fs_store_product_attr_value_scrm where  id=#{productAttrValueId}")
     int selectFsStoreProductStockById(Long productAttrValueId);
 

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -156,6 +156,9 @@ public interface FsStoreProductScrmMapper
     @Select({"<script> " +
             "select p.* from fs_store_product_scrm p  " +
             "where is_del=0 and is_show=1 and product_id=#{productId} " +
+            "<if test = 'storeId != null and storeId !=\"\"'> " +
+            "and find_in_set(p.store_id,#{storeId} " +
+            "</if>" +
             "</script>"})
     FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId);
     @Update("update fs_store_product_scrm set stock=stock-#{num}, sales=sales+#{num}" +

+ 9 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreScrmMapper.java

@@ -1,7 +1,7 @@
 package com.fs.hisStore.mapper;
 
-import com.fs.his.domain.FsStore;
 import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.vo.FsStoreScrmVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
@@ -71,4 +71,12 @@ public interface FsStoreScrmMapper
 
     @Select("SELECT * from fs_store_scrm WHERE   FIND_IN_SET(store_id, (SELECT store_ids FROM fs_doctor where doctor_id=#{doctorId}))")
     List<FsStoreScrm> selectFsStoreListByDoctorId(Long doctorId);
+
+    @Select("<script>"
+            + "SELECT * FROM fs_store_scrm WHERE store_id IN "
+            + "<foreach collection='storeIds' item='storeId' open='(' separator=',' close=')'>"
+            + "#{storeId}"
+            + "</foreach>"
+            + "</script>")
+    List<FsStoreScrmVO> selectFsStoreListByIds(@Param("storeIds") List<Integer> storeIds);
 }

+ 8 - 8
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreProductAttrValueScrmService.java

@@ -11,7 +11,7 @@ import com.fs.hisStore.vo.FsStoreTuiProductAttrValueVO;
 
 /**
  * 商品属性值Service接口
- * 
+ *
  * @author fs
  * @date 2022-03-15
  */
@@ -19,7 +19,7 @@ public interface IFsStoreProductAttrValueScrmService
 {
     /**
      * 查询商品属性值
-     * 
+     *
      * @param id 商品属性值ID
      * @return 商品属性值
      */
@@ -27,7 +27,7 @@ public interface IFsStoreProductAttrValueScrmService
 
     /**
      * 查询商品属性值列表
-     * 
+     *
      * @param fsStoreProductAttrValue 商品属性值
      * @return 商品属性值集合
      */
@@ -35,7 +35,7 @@ public interface IFsStoreProductAttrValueScrmService
 
     /**
      * 新增商品属性值
-     * 
+     *
      * @param fsStoreProductAttrValue 商品属性值
      * @return 结果
      */
@@ -43,7 +43,7 @@ public interface IFsStoreProductAttrValueScrmService
 
     /**
      * 修改商品属性值
-     * 
+     *
      * @param fsStoreProductAttrValue 商品属性值
      * @return 结果
      */
@@ -51,7 +51,7 @@ public interface IFsStoreProductAttrValueScrmService
 
     /**
      * 批量删除商品属性值
-     * 
+     *
      * @param ids 需要删除的商品属性值ID
      * @return 结果
      */
@@ -59,13 +59,13 @@ public interface IFsStoreProductAttrValueScrmService
 
     /**
      * 删除商品属性值信息
-     * 
+     *
      * @param id 商品属性值ID
      * @return 结果
      */
     public int deleteFsStoreProductAttrValueById(Long id);
 
-    List<FsStoreProductAttrValueScrm> selectFsStoreProductAttrValueByProductId(Long productId);
+    List<FsStoreProductAttrValueScrm> selectFsStoreProductAttrValueByProductId(Long productId,String storeId);
 
     int incProductAttrStock(Long num, Long productId, Long productAttrValueId);
 

+ 3 - 1
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreScrmService.java

@@ -1,8 +1,8 @@
 package com.fs.hisStore.service;
 
-import com.fs.his.domain.FsStore;
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.vo.FsStoreScrmVO;
 
 import java.util.List;
 
@@ -71,4 +71,6 @@ public interface IFsStoreScrmService
 
 
     List<FsStoreScrm> selectFsStoreListByDoctorId(Long doctorId);
+
+    List<FsStoreScrmVO> selectFsStoreListByIds(List<Integer> storeIds);
 }

+ 10 - 10
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductAttrValueScrmServiceImpl.java

@@ -16,19 +16,19 @@ import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
 
 /**
  * 商品属性值Service业务层处理
- * 
+ *
  * @author fs
  * @date 2022-03-15
  */
 @Service
-public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAttrValueScrmService 
+public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAttrValueScrmService
 {
     @Autowired
     private FsStoreProductAttrValueScrmMapper fsStoreProductAttrValueMapper;
 
     /**
      * 查询商品属性值
-     * 
+     *
      * @param id 商品属性值ID
      * @return 商品属性值
      */
@@ -40,7 +40,7 @@ public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAt
 
     /**
      * 查询商品属性值列表
-     * 
+     *
      * @param fsStoreProductAttrValue 商品属性值
      * @return 商品属性值
      */
@@ -52,7 +52,7 @@ public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAt
 
     /**
      * 新增商品属性值
-     * 
+     *
      * @param fsStoreProductAttrValue 商品属性值
      * @return 结果
      */
@@ -64,7 +64,7 @@ public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAt
 
     /**
      * 修改商品属性值
-     * 
+     *
      * @param fsStoreProductAttrValue 商品属性值
      * @return 结果
      */
@@ -76,7 +76,7 @@ public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAt
 
     /**
      * 批量删除商品属性值
-     * 
+     *
      * @param ids 需要删除的商品属性值ID
      * @return 结果
      */
@@ -88,7 +88,7 @@ public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAt
 
     /**
      * 删除商品属性值信息
-     * 
+     *
      * @param id 商品属性值ID
      * @return 结果
      */
@@ -99,8 +99,8 @@ public class FsStoreProductAttrValueScrmServiceImpl implements IFsStoreProductAt
     }
 
     @Override
-    public List<FsStoreProductAttrValueScrm> selectFsStoreProductAttrValueByProductId(Long productId) {
-        return fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
+    public List<FsStoreProductAttrValueScrm> selectFsStoreProductAttrValueByProductId(Long productId,String storeId) {
+        return fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId,storeId);
     }
 
     @Override

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -332,7 +332,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         fsStoreProductAttrMapper.clear(productId);
         //清空values
         //查出商品属性所有ID;
-        List<FsStoreProductAttrValueScrm> attrValues=fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
+        List<FsStoreProductAttrValueScrm> attrValues=fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId,null);
         fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(productId);
         //写入attr
         for(ProductArrtDTO vo:items){

+ 6 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreScrmServiceImpl.java

@@ -2,12 +2,12 @@ package com.fs.hisStore.service.impl;
 
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
-import com.fs.his.domain.FsStore;
 import com.fs.his.param.FsStoreAuditParam;
 import com.fs.his.utils.StoreMD5PasswordEncoder;
 import com.fs.hisStore.domain.FsStoreScrm;
 import com.fs.hisStore.mapper.FsStoreScrmMapper;
 import com.fs.hisStore.service.IFsStoreScrmService;
+import com.fs.hisStore.vo.FsStoreScrmVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -133,5 +133,10 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
         return fsStoreMapper.selectFsStoreListByDoctorId(doctorId);
     }
 
+    @Override
+    public List<FsStoreScrmVO> selectFsStoreListByIds(List<Integer> storeIds) {
+        return fsStoreMapper.selectFsStoreListByIds(storeIds);
+    }
+
 
 }

+ 17 - 0
fs-service/src/main/java/com/fs/hisStore/vo/ErpSkuVO.java

@@ -0,0 +1,17 @@
+package com.fs.hisStore.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ErpSkuVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Integer pageSize;
+    private Integer pageNum;
+    private String erpCode;
+    private String erpSkuName;
+    private String busno;
+
+
+}

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsStoreProductQueryVO.java

@@ -119,4 +119,7 @@ public class FsStoreProductQueryVO implements Serializable
     /** 所属企业 */
     private String companyIds;
 
+    /** 门店Ids */
+    private String storeId;
+
 }

+ 13 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsStoreScrmVO.java

@@ -0,0 +1,13 @@
+package com.fs.hisStore.vo;
+
+import lombok.Data;
+
+@Data
+public class FsStoreScrmVO {
+    Long storeId;
+    String storeName;
+    String busNo;
+    String busName;
+    String logoUrl;
+    Integer salesCount;
+}

+ 30 - 11
fs-user-app/src/main/java/com/fs/app/controller/store/ProductScrmController.java

@@ -5,17 +5,12 @@ import com.fs.app.annotation.Login;
 import com.fs.app.controller.AppBaseController;
 import com.fs.common.core.domain.R;
 import com.fs.common.param.BaseQueryParam;
+import com.fs.common.utils.StringUtils;
 import com.fs.erp.service.IErpGoodsService;
-import com.fs.hisStore.domain.FsStoreProductAttrScrm;
-import com.fs.hisStore.domain.FsStoreProductAttrValueScrm;
-import com.fs.hisStore.domain.FsStoreProductCategoryScrm;
-import com.fs.hisStore.domain.FsStoreProductRelationScrm;
+import com.fs.hisStore.domain.*;
 import com.fs.hisStore.param.*;
 import com.fs.hisStore.service.*;
-import com.fs.hisStore.vo.FsStoreCartVO;
-import com.fs.hisStore.vo.FsStoreProductAttrValueQueryVO;
-import com.fs.hisStore.vo.FsStoreProductListQueryVO;
-import com.fs.hisStore.vo.FsStoreProductQueryVO;
+import com.fs.hisStore.vo.*;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -25,6 +20,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -53,6 +49,9 @@ public class ProductScrmController extends AppBaseController {
     private IFsStoreProductRelationScrmService productRelationService;
     @Autowired
     IErpGoodsService goodsService;
+
+    @Autowired
+    private IFsStoreScrmService storeService;
     /**
      * 获取用户信息
      * @param request
@@ -96,13 +95,33 @@ public class ProductScrmController extends AppBaseController {
     }
     @ApiOperation("获取商品详情")
     @GetMapping("/getProductDetails")
-    public R getProductDetails(@RequestParam(value="productId") Long productId){
+    public R getProductDetails(@RequestParam(value="productId") Long productId,@RequestParam(value="storeId",required = false) String storeId){
         FsStoreProductQueryVO product=productService.selectFsStoreProductByIdQuery(productId);
         if(product==null){
             return R.error("商品不存在或已下架");
         }
         List<FsStoreProductAttrScrm> productAttr=attrService.selectFsStoreProductAttrByProductId(product.getProductId());
-        List<FsStoreProductAttrValueScrm> productValues=attrValueService.selectFsStoreProductAttrValueByProductId(product.getProductId());
+        List<FsStoreProductAttrValueScrm> productValues=attrValueService.selectFsStoreProductAttrValueByProductId(product.getProductId(),storeId);
+
+        List<Integer> storeIds=new ArrayList<>();
+        String[] arrList={};
+        if(StringUtils.isNotEmpty(product.getStoreId())){
+            arrList=product.getStoreId().split(",");
+        }
+        Integer tStoreId=0;
+        List<FsStoreScrmVO> storeList=new ArrayList<>();
+        ErpSkuVO skuMap=new ErpSkuVO();
+        skuMap.setPageNum(1);
+        skuMap.setPageSize(10);
+        if(arrList.length>0){
+            tStoreId=Integer.parseInt(arrList[0]);
+            FsStoreScrm store=storeService.selectFsStoreByStoreId(Long.valueOf(tStoreId));
+//            skuMap.setBusno(store.getBusNo()); //erp店铺编号
+            for (int i = 0; i <arrList.length ; i++) {
+                storeIds.add(Integer.parseInt(arrList[i]));
+            }
+            storeList = storeService.selectFsStoreListByIds(storeIds);
+        }
 
 //        for(FsStoreProductAttrValue value:productValues){
 //            if(StringUtils.isEmpty(value.getGroupBarCode())){
@@ -197,7 +216,7 @@ public class ProductScrmController extends AppBaseController {
                 productRelationService.insertFsStoreProductRelation(relation);
             }
         }
-        return R.ok().put("product",product).put("productAttr",productAttr).put("productValues",productValues);
+        return R.ok().put("product",product).put("productAttr",productAttr).put("productValues",productValues).put("stores",storeList);
     }
 
     @Login