From 2b6b906b3ce00a417f4f1901df8c09e49034b8b4 Mon Sep 17 00:00:00 2001 From: wangpengfei <1928057482@qq.com> Date: Wed, 10 Apr 2024 09:07:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 116 +++++++++++++++ README.md | 0 pom.xml | 133 ++++++++++++++++++ .../java/com/yxt/goods/GoodsApplication.java | 24 ++++ src/main/resources/application-devv.yml | 37 +++++ src/main/resources/application-pro.yml | 29 ++++ src/main/resources/application-test.yml | 34 +++++ src/main/resources/application.yml | 50 +++++++ src/main/resources/logback-spring.xml | 50 +++++++ .../com/yxt/goods/GoodsApplicationTest.java | 24 ++++ 10 files changed, 497 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 pom.xml create mode 100644 src/main/java/com/yxt/goods/GoodsApplication.java create mode 100644 src/main/resources/application-devv.yml create mode 100644 src/main/resources/application-pro.yml create mode 100644 src/main/resources/application-test.yml create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/logback-spring.xml create mode 100644 src/test/java/com/yxt/goods/GoodsApplicationTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a70b169 --- /dev/null +++ b/.gitignore @@ -0,0 +1,116 @@ +# ---> Java +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# ---> Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# ---> JetBrains +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +**/.idea/ +**/logs/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7a1dd34 --- /dev/null +++ b/pom.xml @@ -0,0 +1,133 @@ + + + + + com.yxt + yxt-parent + 0.0.1 + + + 4.0.0 + + ss-common-goods + ss-common-goods + 2.0.1 + + + + com.yxt + yxt-common-base + 0.0.1 + + + + org.springframework.boot + spring-boot-starter-web + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + + mysql + mysql-connector-java + runtime + + + + com.baomidou + mybatis-plus-boot-starter + + + com.baomidou + mybatis-plus-annotation + + + junit + junit + compile + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + cn.dev33 + sa-token-spring-boot-starter + 1.37.0 + + + cn.hutool + hutool-all + 5.8.23 + + + cn.hutool + hutool-core + 5.8.23 + + + com.google.zxing + core + 3.5.2 + + + com.alibaba + easyexcel + 3.3.2 + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.5.6 + + + + repackage + + + + + + + + src/main/java + + **/*Mapper.xml + + + + src/main/resources + + **/*.* + + false + + + + + diff --git a/src/main/java/com/yxt/goods/GoodsApplication.java b/src/main/java/com/yxt/goods/GoodsApplication.java new file mode 100644 index 0000000..4299157 --- /dev/null +++ b/src/main/java/com/yxt/goods/GoodsApplication.java @@ -0,0 +1,24 @@ +package com.yxt.goods; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.scheduling.annotation.EnableScheduling; + +/** + * @author dimengzhe + */ +@SpringBootApplication(scanBasePackages = { + "com.yxt.goods.config", + "com.yxt.common.base.config", + "com.yxt.goods" +}) +// 启用自带定时任务 +@EnableScheduling +@EnableFeignClients(basePackages = {}) +public class GoodsApplication { + public static void main(String[] args) { + SpringApplication.run(GoodsApplication.class, args); + } +} diff --git a/src/main/resources/application-devv.yml b/src/main/resources/application-devv.yml new file mode 100644 index 0000000..30fab1d --- /dev/null +++ b/src/main/resources/application-devv.yml @@ -0,0 +1,37 @@ +spring: + datasource: + hikari: + max-lifetime: 500000 + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://39.104.100.138:3306/yxt_base?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true +# url: jdbc:mysql://8.130.39.13:3306/yxt_lpk_yythmall?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true + username: root +# password: 1LAiGz$t1*Iw + password: yxt_mysql_138 + cloud: + nacos: + discovery: + namespace: common + server-addr: 39.104.100.138:8848 + register-enabled: false + redis: + database: 3 # Redis数据库索引(默认为0) + host: 39.104.100.138 + jedis: + pool: + max-active: -1 #连接池最大连接数(使用负值表示没有限制) + max-idle: 8 #连接池中的最大空闲连接 + max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) + min-idle: 0 # 连接池中的最小空闲连接 + password: + port: 6379 + timeout: 0 # 连接超时时间(毫秒) + +image: +# xlsxtmpl: E:/code/yxt-yyth/target/classes/static/upload/ + xlsxtmpl: D:/works/projects/yxt/yxtgit/lipinka/yxt-yyth-biz/target/classes/static/upload/ + upload: +# path: E:/code/yxt-yyth/target/classes/static/upload/ + path: D:/works/projects/yxt/yxtgit/lipinka/yxt-yythmall-biz/target/classes/static/upload/ + url: + prefix: https://supervise.yxtsoft.com/lpk/upload/ diff --git a/src/main/resources/application-pro.yml b/src/main/resources/application-pro.yml new file mode 100644 index 0000000..cb9c87d --- /dev/null +++ b/src/main/resources/application-pro.yml @@ -0,0 +1,29 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/yxt_base?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true + username: root + password: 1LAiGz$t1*Iw + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 + redis: + database: 3 # Redis数据库索引(默认为0) + host: 127.0.0.1 + jedis: + pool: + max-active: -1 #连接池最大连接数(使用负值表示没有限制) + max-idle: 8 #连接池中的最大空闲连接 + max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) + min-idle: 0 # 连接池中的最小空闲连接 + password: 123456 + port: 6379 + timeout: 0 # 连接超时时间(毫秒) +image: + upload: + path: D:/webapps/lipinka/yythmall-ui/upload/ + url: + prefix: https://supervise.yxtsoft.com/lpk/upload/ +import: + filePath: D:/yxt-supervise-gf/upload/ diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 0000000..fc2e84f --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,34 @@ +server: + port: 17211 + +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://172.18.0.4:3306/yxt_base?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true + username: root + password: yxt_mysql_138 + cloud: + nacos: + discovery: + namespace: lipinka + server-addr: 172.18.0.5:8848 + ip: 39.104.100.138 + redis: + database: 3 # Redis数据库索引(默认为0) + host: 172.18.0.7 + jedis: + pool: + max-active: -1 #连接池最大连接数(使用负值表示没有限制) + max-idle: 8 #连接池中的最大空闲连接 + max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) + min-idle: 0 # 连接池中的最小空闲连接 + password: + port: 6379 + timeout: 0 # 连接超时时间(毫秒) + + +image: + upload: + path: /home/lzh/docker_data/nginx/html/lipinka/yythmall-ui/upload/ + url: + prefix: https://lpk.yyundong.com/upload/ diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..7004abe --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,50 @@ +spring: + application: + name: ss-common-goods + profiles: + active: devv +# active: test +# active: pro + messages: + # 国际化资源文件路径 + basename: i18n/messages + servlet: + #上传文件 + multipart: + max-file-size: 50MB + max-request-size: 100MB + devtools: + restart: + # 热部署开关 + enabled: true + +server: + port: 6211 + max-http-header-size: 102400 + undertow: + max-http-post-size: -1 + +#mybatis +mybatis-plus: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapper-locations: classpath*:**Mapper.xml + global-config: + refresh: true + db-config: + #定义生成ID的类型 + id-type: Auto + db-type: mysql + configuration: + map-underscore-to-camel-case: false + cache-enabled: true + call-setters-on-nulls: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +#rocketmq: +# producer: +# group: yxt-supervise-gf +# name-server: 127.0.0.1:9876 + + + + diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..ea76604 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,50 @@ + + + + + + + + + + %yellow(%date{yyyy-MM-dd HH:mm:ss}) |%highlight(%-5level) |%green(%logger:%line) |%blue(%msg%n) + + + + + + + + + + + + + + + ${log.base}.log + + ${log.base}.%d{yyyyMMdd}.%i.log.zip + + + + 1MB + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} + -%msg%n + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/com/yxt/goods/GoodsApplicationTest.java b/src/test/java/com/yxt/goods/GoodsApplicationTest.java new file mode 100644 index 0000000..a1d4ff0 --- /dev/null +++ b/src/test/java/com/yxt/goods/GoodsApplicationTest.java @@ -0,0 +1,24 @@ +package com.yxt.goods; + +import cn.hutool.core.util.IdUtil; +import org.junit.Test; + +import java.util.UUID; + +public class GoodsApplicationTest { + + @Test + public void test() { + System.out.println(IdUtil.nanoId()); + System.out.println(IdUtil.getSnowflakeNextId()); + + UUID uuid = UUID.randomUUID(); + String uniqueID = uuid.toString().replaceAll("-", "").substring(0, 16).replaceAll("\\D", ""); + System.out.println(uniqueID); + } +} + +//do3KW8XIUSyu4vg_zTXdm +// 1727231267909320704 +//uw0AotdmQTlIxKlA2V8_O +// 1727231437887668224