Jelajahi Sumber

feat(store): 申请入住

wxd 4 minggu lalu
induk
melakukan
4db2d89a36

+ 2 - 0
alien-store-platform/doc/LOGIN_USER_UTIL_README.md

@@ -126,3 +126,5 @@ public class StoreServiceImpl {
 **作者**: ssk
 
 
+
+

+ 5 - 4
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/StoreManageController.java

@@ -10,6 +10,7 @@ import shop.alien.entity.store.dto.StoreInfoDto;
 import shop.alien.entity.store.vo.StoreInfoVo;
 import shop.alien.entity.store.vo.StoreMainInfoVo;
 import shop.alien.storeplatform.service.StoreManageService;
+import shop.alien.storeplatform.util.LoginUserUtil;
 
 /**
  * web端商户店铺管理 前端控制器
@@ -105,9 +106,9 @@ public class StoreManageController {
             @ApiImplicitParam(name = "storeId", value = "店铺ID", dataType = "Integer", paramType = "query", required = true)
     })
     @GetMapping("/getTodayIncome")
-    public R<String> getTodayIncome(@RequestParam("storeId") Integer storeId) {
-        log.info("StoreManageController.getTodayIncome?storeId={}", storeId);
+    public R<String> getTodayIncome() {
         try {
+            Integer storeId = LoginUserUtil.getCurrentStoreId();
             String income = storeManageService.getTodayIncome(storeId);
             return R.data(income, "查询成功");
         } catch (Exception e) {
@@ -122,9 +123,9 @@ public class StoreManageController {
             @ApiImplicitParam(name = "storeId", value = "店铺ID", dataType = "Integer", paramType = "query", required = true)
     })
     @GetMapping("/getTodayOrderCount")
-    public R<Integer> getTodayOrderCount(@RequestParam("storeId") Integer storeId) {
-        log.info("StoreManageController.getTodayOrderCount?storeId={}", storeId);
+    public R<Integer> getTodayOrderCount() {
         try {
+            Integer storeId = LoginUserUtil.getCurrentStoreId();
             Integer count = storeManageService.getTodayOrderCount(storeId);
             return R.data(count, "查询成功");
         } catch (Exception e) {

+ 1 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/dto/MarkAllNoticesReadDTO.java

@@ -26,3 +26,4 @@ public class MarkAllNoticesReadDTO implements Serializable {
 }
 
 
+

+ 1 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/example/LoginUserUtilExample.java

@@ -254,3 +254,4 @@ public class LoginUserUtilExample {
 
 
 
+

+ 11 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StoreManageServiceImpl.java

@@ -21,6 +21,7 @@ import shop.alien.mapper.*;
 import shop.alien.storeplatform.feign.AlienStoreFeign;
 import shop.alien.storeplatform.service.StoreManageService;
 import shop.alien.storeplatform.util.GaoDeMapApiUtil;
+import shop.alien.storeplatform.util.LoginUserUtil;
 import shop.alien.storeplatform.util.NearMeUtil;
 import shop.alien.util.common.constant.OrderStatusEnum;
 import shop.alien.util.map.DistanceUtil;
@@ -85,6 +86,16 @@ public class StoreManageServiceImpl implements StoreManageService {
     public StoreInfoVo applyStore(StoreInfoDto storeInfoDto) throws Exception {
         log.info("StoreManageServiceImpl.applyStore?storeInfoDto={}", storeInfoDto);
 
+        // 0. 获取店铺用户登录信息
+        StoreUser storeUser = LoginUserUtil.getCurrentStoreUser();
+
+        storeInfoDto.setUserAccount(storeUser.getId().toString());
+
+        // 校验店铺信息 如果店铺id 不为空,证明店铺以关联,不可再次申请
+        if (storeUser.getStoreId() != null){
+            throw new IllegalArgumentException("该用户已关联店铺,请勿重复申请");
+        }
+
         // 1. 获取经营板块信息
         Integer businessSection = storeInfoDto.getBusinessSection();
         StoreDictionary businessSectionDict = storeDictionaryMapper.selectOne(

+ 1 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/util/LoginUserUtil.java

@@ -246,3 +246,4 @@ public class LoginUserUtil {
 
 
 
+