zjk
4 天以前 13f4d5bd41c0604da54764763f73724c1ad482c0
feat(product): 新增商品服务模块

为所有微服务统一配置Nacos命名空间,以避免因使用默认公共命名空间导致的Nacos长轮询空转刷屏问题。
6个文件已添加
10个文件已修改
294 ■■■■■ 已修改文件
hugray-server/bin/run-modules-product.bat 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/bin/start-all.bat 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-auth/src/main/resources/bootstrap.yml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-gateway/src/main/resources/bootstrap.yml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/pom.xml 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-product/pom.xml 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-product/src/main/java/com/ruoyi/product/RuoYiProductApplication.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-product/src/main/resources/banner.txt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-product/src/main/resources/bootstrap.yml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-product/src/main/resources/logback.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/bootstrap.yml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hugray-server/bin/run-modules-product.bat
New file
@@ -0,0 +1,14 @@
@echo off
echo.
echo [ÐÅÏ¢] Ê¹ÓÃJarÃüÁîÔËÐÐModules-Product½ø³Ì¡£
echo.
cd %~dp0
cd ../ruoyi-modules/ruoyi-product/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-product.jar
cd bin
pause
hugray-server/bin/start-all.bat
@@ -83,6 +83,7 @@
call :start_service "ruoyi-job"     "ruoyi-modules\ruoyi-job"    "ruoyi-modules-job.jar"     9203
call :start_service "ruoyi-file"    "ruoyi-modules\ruoyi-file"   "ruoyi-modules-file.jar"    9300
call :start_service "ruoyi-user"    "ruoyi-modules\ruoyi-user"  "ruoyi-modules-user.jar"    9210
call :start_service "ruoyi-product" "ruoyi-modules\ruoyi-product" "ruoyi-modules-product.jar" 9211
call :start_service "ruoyi-monitor" "ruoyi-visual\ruoyi-monitor" "ruoyi-visual-monitor.jar"  9100
call :start_service "ruoyi-gateway" "ruoyi-gateway"              "ruoyi-gateway.jar"         8085
hugray-server/ruoyi-auth/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml
hugray-server/ruoyi-gateway/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
    sentinel:
      # 取消控制台懒加载
      eager: true
@@ -29,6 +33,8 @@
        ds1:
          nacos:
            server-addr: 127.0.0.1:8848
            # 命名空间(hugray),需与 config/discovery 保持一致
            namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
            dataId: sentinel-ruoyi-gateway
            groupId: DEFAULT_GROUP
            data-type: json
hugray-server/ruoyi-modules/pom.xml
@@ -14,6 +14,7 @@
        <module>ruoyi-job</module>
        <module>ruoyi-file</module>
        <module>ruoyi-user</module>
        <module>ruoyi-product</module>
    </modules>
    <artifactId>ruoyi-modules</artifactId>
hugray-server/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml
hugray-server/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml
hugray-server/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml
hugray-server/ruoyi-modules/ruoyi-product/pom.xml
New file
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>com.ruoyi</groupId>
        <artifactId>ruoyi-modules</artifactId>
        <version>3.6.8</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>ruoyi-modules-product</artifactId>
    <description>
        ruoyi-modules-product商品服务(商品/套餐/等级价/首页内容)
    </description>
    <dependencies>
        <!-- SpringCloud Alibaba Nacos -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>
        <!-- SpringCloud Alibaba Nacos Config -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>
        <!-- SpringCloud Alibaba Sentinel -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        </dependency>
        <!-- SpringBoot Actuator -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <!-- Mysql Connector -->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
        </dependency>
        <!-- RuoYi Common DataSource -->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common-datasource</artifactId>
        </dependency>
        <!-- RuoYi Common DataScope -->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common-datascope</artifactId>
        </dependency>
        <!-- RuoYi Common Log -->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common-log</artifactId>
        </dependency>
        <!-- RuoYi Common Swagger -->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common-swagger</artifactId>
        </dependency>
    </dependencies>
    <!-- finalName 固定为 artifactId,jar 名必须与 bin/start-all.bat 里的写法一致 -->
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
hugray-server/ruoyi-modules/ruoyi-product/src/main/java/com/ruoyi/product/RuoYiProductApplication.java
New file
@@ -0,0 +1,35 @@
package com.ruoyi.product;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
/**
 * 商品服务
 *
 * 承载:商品/套餐资料、等级价与最低库存、首页内容与健康方案配置。
 * 平台后台维护数据,用户端按等级读取展示。
 *
 * @author ruoyi
 */
@EnableCustomConfig
@EnableRyFeignClients
@SpringBootApplication
public class RuoYiProductApplication
{
    public static void main(String[] args)
    {
        SpringApplication.run(RuoYiProductApplication.class, args);
        System.out.println("(♥◠‿◠)ノ゙  商品服务启动成功   ლ(´ڡ`ლ)゙  \n" +
                " .-------.       ____     __        \n" +
                " |  _ _   \\      \\   \\   /  /    \n" +
                " | ( ' )  |       \\  _. /  '       \n" +
                " |(_ o _) /        _( )_ .'         \n" +
                " | (_,_).' __  ___(_ o _)'          \n" +
                " |  |\\ \\  |  ||   |(_,_)'         \n" +
                " |  | \\ `'   /|   `-'  /           \n" +
                " |  |  \\    /  \\      /           \n" +
                " ''-'   `'-'    `-..-'              ");
    }
}
hugray-server/ruoyi-modules/ruoyi-product/src/main/resources/banner.txt
New file
@@ -0,0 +1,10 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
                      _            _
                     | |          | |
 _ __  _ __ ___   __| |_   _  ___| |_
| '_ \| '__/ _ \ / _` | | | |/ __| __|
| |_) | | | (_) | (_| | |_| | (__| |_
| .__/|_|  \___/ \__,_|\__,_|\___|\__|
| |
|_|
hugray-server/ruoyi-modules/ruoyi-product/src/main/resources/bootstrap.yml
New file
@@ -0,0 +1,31 @@
# Tomcat
server:
  port: 9211
# Spring
spring:
  application:
    # 应用名称
    name: ruoyi-product
  profiles:
    # 环境配置
    active: dev
  cloud:
    nacos:
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml
    # 数据源、mybatis、springdoc 全在 Nacos,此处只声明要加载哪两份配置
    import:
      - nacos:application-${spring.profiles.active}.${spring.config.file-extension}
      - nacos:${spring.application.name}-${spring.profiles.active}.${spring.config.file-extension}
hugray-server/ruoyi-modules/ruoyi-product/src/main/resources/logback.xml
New file
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
    <!-- 日志存放路径 -->
    <property name="log.path" value="logs/ruoyi-product" />
   <!-- 日志输出格式 -->
    <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
    <!-- 控制台输出 -->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>
    <!-- 系统日志输出 -->
    <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/info.log</file>
        <!-- 循环政策:基于时间创建日志文件 -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件名格式 -->
            <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- 日志最大的历史 60天 -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!-- 过滤的级别 -->
            <level>INFO</level>
            <!-- 匹配时的操作:接收(记录) -->
            <onMatch>ACCEPT</onMatch>
            <!-- 不匹配时的操作:拒绝(不记录) -->
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>
    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/error.log</file>
        <!-- 循环政策:基于时间创建日志文件 -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件名格式 -->
            <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- 日志最大的历史 60天 -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!-- 过滤的级别 -->
            <level>ERROR</level>
            <!-- 匹配时的操作:接收(记录) -->
            <onMatch>ACCEPT</onMatch>
            <!-- 不匹配时的操作:拒绝(不记录) -->
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>
    <!-- 系统模块日志级别控制  -->
    <logger name="com.ruoyi" level="info" />
    <!-- Spring日志级别控制  -->
    <logger name="org.springframework" level="warn" />
    <root level="info">
        <appender-ref ref="console" />
    </root>
    <!--系统操作日志-->
    <root level="info">
        <appender-ref ref="file_info" />
        <appender-ref ref="file_error" />
    </root>
</configuration>
hugray-server/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml
hugray-server/ruoyi-modules/ruoyi-user/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml
hugray-server/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml
@@ -15,9 +15,13 @@
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray),切勿填字面量 public,否则会触发长轮询空转刷屏
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 命名空间(hugray)
        namespace: c75c831e-0570-4a9f-b8de-aba9087a5f37
  config:
    # 配置文件格式
    file-extension: yml