Huanyi 6 часов назад
Родитель
Сommit
aa84216a2e

+ 1 - 1
pom.xml

@@ -67,7 +67,7 @@
         <profile>
             <id>Huanyi</id>
             <properties>
-                <profiles.active>prod</profiles.active>
+                <profiles.active>dev</profiles.active>
                 <nacos.server>127.0.0.1:8848</nacos.server>
                 <nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
                 <nacos.config.group>DEFAULT_GROUP</nacos.config.group>

+ 8 - 0
ruoyi-api/yingpaipay-api-service/src/main/java/org/dromara/service/api/RemoteStoreServiceService.java

@@ -15,4 +15,12 @@ public interface RemoteStoreServiceService {
      * @Author: Antigravity
      */
     List<Long> getStoreIdsByServiceId(Long serviceId);
+
+    /**
+     * 根据门店ID列表获取所有关联的服务ID集合(去重)
+     * @param storeIds 门店ID列表
+     * @return 服务ID列表(去重)
+     * @Author: Antigravity
+     */
+    List<Long> getServiceIdsByStoreIds(List<Long> storeIds);
 }

+ 30 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysStoreController.java

@@ -1,11 +1,11 @@
 package org.dromara.system.controller.system;
 
 import java.util.List;
+import java.util.Collections;
 
 import lombok.RequiredArgsConstructor;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.constraints.*;
-import cn.dev33.satoken.annotation.SaCheckPermission;
 import org.dromara.system.domain.bo.*;
 import org.dromara.system.domain.vo.*;
 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.system.service.ISysStoreService;
 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 {
 
     private final ISysStoreService sysStoreService;
+    private final RemoteStoreServiceService remoteStoreServiceService;
 
     /**
      * 查询门店管理列表
@@ -157,4 +160,30 @@ public class SysStoreController extends BaseController {
         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);
+    }
+
 }

+ 10 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysTenantServiceImpl.java

@@ -175,6 +175,16 @@ public class SysTenantServiceImpl implements ISysTenantService {
         roleDept.setDeptId(deptId);
         roleDeptMapper.insert(roleDept);
 
+        // 校验用户名是否已存在
+        boolean userExist = TenantHelper.ignore(() ->
+            userMapper.exists(new LambdaQueryWrapper<SysUser>()
+                .eq(SysUser::getUserName, bo.getUsername())
+                .eq(SysUser::getPlatformId, Platform.MERCHANT.getId()))
+        );
+        if (userExist) {
+            throw new ServiceException("账号已存在,请重新输入");
+        }
+
         // 创建系统用户(品牌商户的管理员)
         SysUser user = new SysUser();
         user.setUserId(userId);

+ 1 - 0
ruoyi-modules/yingpaipay-fulfiller/src/main/java/org/dromara/fulfiller/domain/bo/FlfComplaintLogBo.java

@@ -51,6 +51,7 @@ public class FlfComplaintLogBo extends BaseEntity {
     /**
      * 是否好评(true:好评, false:差评/投诉)
      */
+    @NotNull(message = "必须选择赞或者不赞", groups = { AddGroup.class, EditGroup.class })
     private Boolean praiseFlag;
 
 

+ 18 - 0
ruoyi-modules/yingpaipay-service/src/main/java/org/dromara/service/dubbo/RemoteStoreServiceServiceImpl.java

@@ -71,4 +71,22 @@ public class RemoteStoreServiceServiceImpl implements RemoteStoreServiceService
             .eq(SysStoreService::getServiceId, serviceId));
         return list.stream().map(SysStoreService::getStoreId).distinct().toList();
     }
+
+    /**
+     * 根据门店ID列表获取所有关联的服务ID集合(去重)
+     * @param storeIds 门店ID列表
+     * @return 服务ID列表(去重)
+     * @Author: Antigravity
+     */
+    @Override
+    public List<Long> getServiceIdsByStoreIds(List<Long> storeIds) {
+        if (storeIds == null || storeIds.isEmpty()) {
+            return Collections.emptyList();
+        }
+        List<SysStoreService> list = baseMapper.selectList(
+            Wrappers.lambdaQuery(SysStoreService.class).in(SysStoreService::getStoreId, storeIds)
+                .select(SysStoreService::getServiceId)
+        );
+        return list.stream().map(SysStoreService::getServiceId).distinct().toList();
+    }
 }

+ 1 - 1
ruoyi-modules/yingpaipay-service/src/main/java/org/dromara/service/service/impl/SysServiceClassificationServiceImpl.java

@@ -138,7 +138,7 @@ public class SysServiceClassificationServiceImpl implements ISysServiceClassific
         return baseMapper.deleteByIds(ids) > 0;
     }
 
-    @Cacheable(cacheNames = CacheNames.SYS_SERVICE_CLASSIFICATION)
+    @Cacheable(cacheNames = CacheNames.SYS_SERVICE_CLASSIFICATION, key = "'all'")
     @Override
     public List<SysServiceClassificationVo> listAll() {
         return baseMapper.selectVoList();

+ 6 - 6
ruoyi-visual/ruoyi-nacos/src/main/resources/application.properties

@@ -43,14 +43,14 @@ db.num=1
 ## Development
 
 # Local
-db.url.0=jdbc:mysql://127.0.0.1:3306/pet_system_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
-db.user.0=root
-db.password.0=1234
+#db.url.0=jdbc:mysql://127.0.0.1:3306/pet_system_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
+#db.user.0=root
+#db.password.0=1234
 
 # Test
-#db.url.0=jdbc:mysql://116.62.136.107:4563/pet_system_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
-#db.user.0=pet_system_config
-#db.password.0=tfry6h6yrztNTw3e
+db.url.0=jdbc:mysql://111.228.46.254:3306/pet_system_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
+db.user.0=root
+db.password.0=Yr888888
 
 ## Production
 #db.url.0=jdbc:mysql://127.0.0.1:3306/pet_system_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true

+ 13 - 10
script/sql/business/v2/create.sql

@@ -29,21 +29,24 @@ CREATE TABLE pet_system.sys_sub_order_appeal
     create_dept            bigint(20) COMMENT '创建部门',
     create_by              bigint(20) COMMENT '创建者',
     create_time            datetime COMMENT '创建时间',
+    update_by              bigint(20) COMMENT '更新者',
     update_time            datetime COMMENT '更新时间'
 ) ENGINE = innoDB COMMENT = '服务分类信息表';
 
 -- 地区信息表
-CREATE TABLE `sys_region` (
+CREATE TABLE `sys_region`
+(
     `id`          bigint(20)   NOT NULL COMMENT '主键',
-    `parent_id`   bigint(20)   DEFAULT 0 COMMENT '父级id',
+    `parent_id`   bigint(20)  DEFAULT 0 COMMENT '父级id',
     `code`        varchar(64)  NOT NULL COMMENT '地区代码',
     `name`        varchar(128) NOT NULL COMMENT '地区名称',
-    `del_flag`    char(1)      DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
-    `create_dept` bigint(20)   DEFAULT NULL COMMENT '创建部门',
-    `create_by`   bigint(20)   DEFAULT NULL COMMENT '创建者',
-    `create_time` datetime     DEFAULT NULL COMMENT '创建时间',
-    `update_by`   bigint(20)   DEFAULT NULL COMMENT '更新者',
-    `update_time` datetime     DEFAULT NULL COMMENT '更新时间',
-    `tenant_id`   varchar(20)  DEFAULT NULL COMMENT '租户编号',
+    `del_flag`    char(1)     DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
+    `create_dept` bigint(20)  DEFAULT NULL COMMENT '创建部门',
+    `create_by`   bigint(20)  DEFAULT NULL COMMENT '创建者',
+    `create_time` datetime    DEFAULT NULL COMMENT '创建时间',
+    `update_by`   bigint(20)  DEFAULT NULL COMMENT '更新者',
+    `update_time` datetime    DEFAULT NULL COMMENT '更新时间',
+    `tenant_id`   varchar(20) DEFAULT NULL COMMENT '租户编号',
     PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='地区信息表';
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4 COMMENT ='地区信息表';