|
@@ -1,11 +1,11 @@
|
|
|
package org.dromara.system.controller.system;
|
|
package org.dromara.system.controller.system;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Collections;
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import jakarta.validation.constraints.*;
|
|
import jakarta.validation.constraints.*;
|
|
|
-import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
|
import org.dromara.system.domain.bo.*;
|
|
import org.dromara.system.domain.bo.*;
|
|
|
import org.dromara.system.domain.vo.*;
|
|
import org.dromara.system.domain.vo.*;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -21,6 +21,8 @@ import org.dromara.common.log.enums.BusinessType;
|
|
|
import org.dromara.common.excel.utils.ExcelUtil;
|
|
import org.dromara.common.excel.utils.ExcelUtil;
|
|
|
import org.dromara.system.service.ISysStoreService;
|
|
import org.dromara.system.service.ISysStoreService;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
+import org.dromara.service.api.RemoteStoreServiceService;
|
|
|
|
|
+import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 门店管理
|
|
* 门店管理
|
|
@@ -36,6 +38,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
public class SysStoreController extends BaseController {
|
|
public class SysStoreController extends BaseController {
|
|
|
|
|
|
|
|
private final ISysStoreService sysStoreService;
|
|
private final ISysStoreService sysStoreService;
|
|
|
|
|
+ private final RemoteStoreServiceService remoteStoreServiceService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询门店管理列表
|
|
* 查询门店管理列表
|
|
@@ -157,4 +160,30 @@ public class SysStoreController extends BaseController {
|
|
|
return R.ok(sysStoreService.listOnDispatch(site));
|
|
return R.ok(sysStoreService.listOnDispatch(site));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取当前登录用户可下单的服务ID列表
|
|
|
|
|
+ * 根据用户绑定的门店,查询门店关联的所有服务类型ID
|
|
|
|
|
+ * 如果storeId=0则表示全部门店权限,返回所有服务ID
|
|
|
|
|
+ * @return 服务ID列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/listMyServices")
|
|
|
|
|
+ public R<List<Long>> listMyServices() {
|
|
|
|
|
+ Long userId = LoginHelper.getUserId();
|
|
|
|
|
+ List<Long> storeIds = sysStoreService.selectStoreIds(userId);
|
|
|
|
|
+
|
|
|
|
|
+ // storeId 为 0 表示全部门店权限
|
|
|
|
|
+ boolean hasAllPermission = storeIds.stream().anyMatch(id -> id != null && id == 0L);
|
|
|
|
|
+ if (hasAllPermission) {
|
|
|
|
|
+ // 查询所有正常状态的门店
|
|
|
|
|
+ List<Long> allStoreIds = sysStoreService.listAll().stream()
|
|
|
|
|
+ .map(SysStoreListOnMerchantAccountInfoVo::getId).toList();
|
|
|
|
|
+ storeIds = allStoreIds;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (storeIds.isEmpty()) {
|
|
|
|
|
+ return R.ok(Collections.emptyList());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> serviceIds = remoteStoreServiceService.getServiceIdsByStoreIds(storeIds);
|
|
|
|
|
+ return R.ok(serviceIds);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|