浏览代码

多店铺

ct 2 周之前
父节点
当前提交
5404c3d7b4

+ 134 - 0
fs-admin/src/main/java/com/fs/hisStore/FsStoreScrmController.java

@@ -0,0 +1,134 @@
+package com.fs.hisStore;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.ParseUtils;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.his.domain.FsStore;
+import com.fs.his.param.FsStoreAuditParam;
+import com.fs.his.service.IFsStoreService;
+import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.service.IFsStoreScrmService;
+import com.fs.hisStore.vo.FsStoreScrmVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 店铺管理Controller
+ *
+ * @author fs
+ * @date 2023-06-15
+ */
+@RestController
+@RequestMapping("/store/store")
+public class FsStoreScrmController extends BaseController
+{
+    @Autowired
+    private IFsStoreScrmService fsStoreService;
+
+    /**
+     * 查询店铺管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('store:store:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsStoreScrm fsStore)
+    {
+        startPage();
+        List<FsStoreScrm> list = fsStoreService.selectFsStoreList(fsStore);
+        for (FsStoreScrm store : list) {
+            store.setPhone(ParseUtils.parsePhone(store.getPhone()));
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出店铺管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('store:store:export')")
+    @Log(title = "店铺管理", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsStoreScrm fsStore)
+    {
+        List<FsStoreScrm> list = fsStoreService.selectFsStoreList(fsStore);
+        for (FsStoreScrm store : list) {
+            store.setPhone(ParseUtils.parsePhone(store.getPhone()));
+        }
+        ExcelUtil<FsStoreScrm> util = new ExcelUtil<FsStoreScrm>(FsStoreScrm.class);
+        return util.exportExcel(list, "店铺管理数据");
+    }
+
+    /**
+     * 获取店铺管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('store:store:query')")
+    @GetMapping(value = "/{storeId}")
+    public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
+    {
+        FsStoreScrm fsStore = fsStoreService.selectFsStoreByStoreId(storeId);
+        fsStore.setPhone(ParseUtils.parsePhone(fsStore.getPhone()));
+        return AjaxResult.success(fsStore);
+    }
+
+    /**
+     * 新增店铺管理
+     */
+    @PreAuthorize("@ss.hasPermi('store:store:add')")
+    @Log(title = "店铺管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsStoreScrm fsStore)
+    {
+        return toAjax(fsStoreService.insertFsStore(fsStore));
+    }
+
+    /**
+     * 修改店铺管理
+     */
+    @PreAuthorize("@ss.hasPermi('store:store:edit')")
+    @Log(title = "店铺管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsStoreScrm fsStore)
+    {
+
+        if (fsStore.getPhone()!=null&&fsStore.getPhone().contains("*")){
+            fsStore.setPhone(null);
+        }
+        return toAjax(fsStoreService.updateFsStore(fsStore));
+    }
+
+    /**
+     * 删除店铺管理
+     */
+    @PreAuthorize("@ss.hasPermi('store:store:remove')")
+    @Log(title = "店铺管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{storeIds}")
+    public AjaxResult remove(@PathVariable Long[] storeIds)
+    {
+        return toAjax(fsStoreService.deleteFsStoreByStoreIds(storeIds));
+    }
+
+    /**
+     * 店铺审核
+     */
+    @PreAuthorize("@ss.hasPermi('store:store:audit')")
+    @Log(title = "店铺管理", businessType = BusinessType.UPDATE)
+    @PutMapping("/audit")
+    public AjaxResult audit(@RequestBody FsStoreAuditParam fsStore)
+    {
+        return toAjax(fsStoreService.updateFsStoreAudit(fsStore));
+    }
+
+    @GetMapping("/storeList")
+    public R storeList(){
+        List<FsStoreScrmVO> list = fsStoreService.selectAllStore();
+        return R.ok().put("data",list);
+    }
+
+
+}

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

@@ -153,6 +153,14 @@ public interface FsStoreProductScrmMapper
             "</if>" +
             "</script>"})
     List<FsStoreProductListQueryVO> selectFsStoreProductListQuery(@Param("maps")FsStoreProductQueryParam param);
+//    @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);
     @Select({"<script> " +
             "select p.* from fs_store_product_scrm p  " +
             "where is_del=0 and is_show=1 and product_id=#{productId} " +
@@ -160,7 +168,7 @@ public interface FsStoreProductScrmMapper
             "and find_in_set(p.store_id,#{storeId} " +
             "</if>" +
             "</script>"})
-    FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId);
+    FsStoreProductQueryVO selectFsStoreProductByIdQuery(@Param("productId")Long productId,@Param("storeId")String storeId);
     @Update("update fs_store_product_scrm set stock=stock-#{num}, sales=sales+#{num}" +
             " where product_id=#{productId} and stock >= #{num}")
     int decProductAttrStock(@Param("productId")Long productId, @Param("num")Integer cartNum);

+ 4 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreScrmMapper.java

@@ -79,4 +79,8 @@ public interface FsStoreScrmMapper
             + "</foreach>"
             + "</script>")
     List<FsStoreScrmVO> selectFsStoreListByIds(@Param("storeIds") List<Integer> storeIds);
+
+//    @Select("select store_id ,store_name,bus_no,bus_name  from fs_store ")
+    @Select("select store_id ,store_name  from fs_store_scrm ")
+    List<FsStoreScrmVO> selectFsAllStoreList();
 }

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

@@ -80,7 +80,7 @@ public interface IFsStoreProductScrmService
 
     List<FsStoreProductListQueryVO> selectFsStoreProductListQuery(FsStoreProductQueryParam param);
 
-    FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId);
+    FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId,String storeId);
 
     void decProductStock(Long productId, Long productAttrValueId, Integer cartNum);
 

+ 2 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreScrmService.java

@@ -73,4 +73,6 @@ public interface IFsStoreScrmService
     List<FsStoreScrm> selectFsStoreListByDoctorId(Long doctorId);
 
     List<FsStoreScrmVO> selectFsStoreListByIds(List<Integer> storeIds);
+
+    List<FsStoreScrmVO> selectAllStore();
 }

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

@@ -601,8 +601,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     }
 
     @Override
-    public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId) {
-        return fsStoreProductMapper.selectFsStoreProductByIdQuery(productId);
+    public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId,String storeId) {
+        return fsStoreProductMapper.selectFsStoreProductByIdQuery(productId,storeId);
     }
 
     @Override

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

@@ -11,6 +11,7 @@ import com.fs.hisStore.vo.FsStoreScrmVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 
@@ -138,5 +139,10 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
         return fsStoreMapper.selectFsStoreListByIds(storeIds);
     }
 
+    @Override
+    public List<FsStoreScrmVO> selectAllStore() {
+        return fsStoreMapper.selectFsAllStoreList();
+    }
+
 
 }

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

@@ -96,7 +96,7 @@ public class ProductScrmController extends AppBaseController {
     @ApiOperation("获取商品详情")
     @GetMapping("/getProductDetails")
     public R getProductDetails(@RequestParam(value="productId") Long productId,@RequestParam(value="storeId",required = false) String storeId){
-        FsStoreProductQueryVO product=productService.selectFsStoreProductByIdQuery(productId);
+        FsStoreProductQueryVO product=productService.selectFsStoreProductByIdQuery(productId,storeId);
         if(product==null){
             return R.error("商品不存在或已下架");
         }