init commit

This commit is contained in:
shenyifei 2025-11-09 13:22:29 +08:00
commit b164e5e26a
1077 changed files with 45294 additions and 0 deletions

11
.coding/settings.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<mirrors>
<mirror>
<id>aliyun maven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>*,!jitpack.io</mirrorOf>
</mirror>
</mirrors>
</settings>

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
target

21
.editorconfig Normal file
View File

@ -0,0 +1,21 @@
# Code Style Guide
root = true
[*]
indent_style = tab
indent_size = 4
max_line_length = 80
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{yaml,yml,bat,md}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[Jenkinsfile]
indent_size = 2

151
.gitattributes vendored Normal file
View File

@ -0,0 +1,151 @@
# This file is inspired by https://github.com/alexkaratarakis/gitattributes
#
# Auto detect text files and perform LF normalization
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
* text=auto
# The above will handle all files NOT found below
# These files are text and should be normalized (Convert crlf => lf)
*.bat text eol=crlf
*.coffee text
*.css text
*.cql text
*.df text
*.ejs text
*.html text
*.java text
*.js text
*.json text
*.less text
*.properties text
*.sass text
*.scss text
*.sh text
*.sql text
*.txt text
*.ts text
*.xml text
*.yaml text
*.yml text
# Documents
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.markdown text
*.md text
*.adoc text
*.textile text
*.mustache text
*.csv text
*.tab text
*.tsv text
*.txt text
AUTHORS text
CHANGELOG text
CHANGES text
CONTRIBUTING text
COPYING text
copyright text
*COPYRIGHT* text
INSTALL text
license text
LICENSE text
NEWS text
readme text
*README* text
TODO text
# Graphics
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as an asset (binary) by default. If you want to treat it as text,
# comment-out the following line and uncomment the line after.
*.svg binary
#*.svg text
*.eps binary
# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.jar binary
*.war binary
## LINTERS
.csslintrc text
.eslintrc text
.jscsrc text
.jshintrc text
.jshintignore text
.stylelintrc text
## CONFIGS
*.bowerrc text
*.conf text
*.config text
.editorconfig text
.gitattributes text
.gitconfig text
.gitignore text
.htaccess text
*.npmignore text
## HEROKU
Procfile text
.slugignore text
## AUDIO
*.kar binary
*.m4a binary
*.mid binary
*.midi binary
*.mp3 binary
*.ogg binary
*.ra binary
## VIDEO
*.3gpp binary
*.3gp binary
*.as binary
*.asf binary
*.asx binary
*.fla binary
*.flv binary
*.m4v binary
*.mng binary
*.mov binary
*.mp4 binary
*.mpeg binary
*.mpg binary
*.swc binary
*.swf binary
*.webm binary
## ARCHIVES
*.7z binary
*.gz binary
*.rar binary
*.tar binary
*.zip binary
## FONTS
*.ttf binary
*.eot binary
*.otf binary
*.woff binary
*.woff2 binary
docker/entrypoint.sh text eol=lf

73
.gitignore vendored Normal file
View File

@ -0,0 +1,73 @@
# Java
*.class
*.db
*.ear
*.jar
*.war
# Intellij
.idea/
classes/
*.ids
*.iml
*.ipr
*.iws
*.orig
# Eclipse
.settings/
.classpath
.factorypath
.loadpath
.metadata
.project
*.bak
*.launch
*.pydevproject
*.swp
*.tmp
*~.nib
local.properties
# Visual Studio Code
.vscode/
# JRebel
rebel.xml
# Maven
!.mvn/wrapper/maven-wrapper.jar
!maven/wrapper/maven-wrapper.jar
maven/
target/
.flattened-pom.xml
release.properties
# Gradle
!gradle/wrapper/maven-wrapper.jar
.gradle/
build/
# SVN
.svn/
# Mac OSX
.DS_Store
# Windows
._*
*.*~
*~
.merge_file*
Desktop.ini
Thumbs.db
# Others
logs/
log/
.log
.buildpath
.cproject
.externalToolBuilders/**
.Spotlight-V100
.Trashes

5
.lingma/rules/design.md Normal file
View File

@ -0,0 +1,5 @@
---
trigger: manual
---
不用管 erp-turbo-svc 这个目录的代码

118
.mvn/wrapper/MavenWrapperDownloader.java vendored Normal file
View File

@ -0,0 +1,118 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://mirrors.cloud.tencent.com/nexus/repository/maven-public/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

BIN
.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

17
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1,17 @@
#
# Copyright 2012-2019 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
distributionUrl=https://mirrors.cloud.tencent.com/nexus/repository/maven-public/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://mirrors.cloud.tencent.com/nexus/repository/maven-public/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

20
build.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# 检查是否提供了版本号
if [ -z "$1" ]; then
echo "Usage: $0 <version> [xjar_password]"
echo "Example: $0 1.0.0 mysecretpassword"
exit 1
fi
VERSION=$1
XJAR_PASSWORD=${2:-io.xjar} # 使用第二个参数,如果未提供则默认为 "io.xjar"
# 使用 Maven 编译和打包项目
./mvnw -T 4C -U compile package -Pprod -DskipTests -s ./.coding/settings.xml -Dxjar.password=$XJAR_PASSWORD
# 构建 Docker 镜像
docker build -t registry.cn-hangzhou.aliyuncs.com/m809745357/erp-turbo:$VERSION -f docker/Dockerfile --build-arg ACTIVE=dev --build-arg MODULE=erp-turbo-svc .
# 推送 Docker 镜像到仓库
docker push registry.cn-hangzhou.aliyuncs.com/m809745357/erp-turbo:$VERSION

56
docker/Dockerfile Normal file
View File

@ -0,0 +1,56 @@
# 使用基础镜像
FROM openjdk:21-jdk as builder
# 设置工作目录并指定构建模块
WORKDIR /app
ARG MODULE
# 复制必要文件
COPY $MODULE/target/$MODULE.jar application.jar
COPY docker/entrypoint.sh entrypoint.sh
# 使用 Spring Boot 的分层模式提取 JAR 文件的依赖项
RUN java -Djarmode=layertools -jar application.jar extract
# 创建容器镜像
FROM openjdk:21-jdk
ARG ACTIVE
# 定义镜像元数据和环境变量
LABEL maintainer="shenyifei <809745357@qq.com>"
LABEL version="1.0.0"
ENV HOME "/app"
ENV TZ "Asia/Shanghai"
ENV LANG "C.UTF-8"
ENV XMS "500m"
ENV XMX "2g"
ENV XSS "256k"
ENV GC_MODE "G1"
ENV USE_GC_LOG "Y"
ENV USE_HEAP_DUMP "Y"
ENV USE_LARGE_PAGES "N"
ENV SPRING_PROFILES_ACTIVE ${ACTIVE}
ENV SERVER_PORT "8080"
ENV MANAGEMENT_SERVER_PORT "9080"
ENV NACOS_SERVER_ADDR "nacos-headless:8848"
WORKDIR $HOME
# 从基础镜像复制应用程序依赖项和模块
COPY --from=builder /app/dependencies/ ./
COPY --from=builder /app/spring-boot-loader ./
COPY --from=builder /app/modules-dependencies ./
COPY --from=builder /app/snapshot-dependencies/ ./
COPY --from=builder /app/application/ ./
COPY --from=builder /app/entrypoint.sh ./
RUN chmod +x entrypoint.sh
RUN mkdir $HOME/logs \
&& touch $HOME/logs/entrypoint.out \
&& ln -sf /dev/stdout $HOME/logs/entrypoint.out \
&& ln -sf /dev/stderr $HOME/logs/entrypoint.out
# 设置启动入口和端口
EXPOSE $SERVER_PORT $MANAGEMENT_SERVER_PORT
ENTRYPOINT ["./entrypoint.sh"]

59
docker/entrypoint.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
JAVA_OPTS="${JAVA_OPTS} -server"
JAVA_OPTS="${JAVA_OPTS} -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions"
JAVA_OPTS="${JAVA_OPTS} -XX:+AlwaysPreTouch -XX:+PrintFlagsFinal -XX:-DisplayVMOutput -XX:-OmitStackTraceInFastThrow"
JAVA_OPTS="${JAVA_OPTS} -Xms${XMS:-1G} -Xmx${XMX:-1G} -Xss${XSS:-256K}"
JAVA_OPTS="${JAVA_OPTS} -XX:MetaspaceSize=${METASPACE_SIZE:-128M} -XX:MaxMetaspaceSize=${MAX_METASPACE_SIZE:-256M}"
JAVA_OPTS="${JAVA_OPTS} -XX:MaxGCPauseMillis=${MAX_GC_PAUSE_MILLIS:-200}"
if [[ "${GC_MODE}" == "ShenandoahGC" ]]; then
echo "GC mode is ShenandoahGC"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseShenandoahGC"
elif [[ "${GC_MODE}" == "ZGC" ]]; then
echo "GC mode is ZGC"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseZGC"
elif [[ "${GC_MODE}" == "G1" ]]; then
echo "GC mode is G1"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseG1GC"
JAVA_OPTS="${JAVA_OPTS} -XX:InitiatingHeapOccupancyPercent=${INITIATING_HEAP_OCCUPANCY_PERCENT:-45}"
JAVA_OPTS="${JAVA_OPTS} -XX:G1ReservePercent=${G1_RESERVE_PERCENT:-10} -XX:G1HeapWastePercent=${G1_HEAP_WASTE_PERCENT:-5} "
JAVA_OPTS="${JAVA_OPTS} -XX:G1NewSizePercent=${G1_NEW_SIZE_PERCENT:-50} -XX:G1MaxNewSizePercent=${G1_MAX_NEW_SIZE_PERCENT:-60}"
JAVA_OPTS="${JAVA_OPTS} -XX:G1MixedGCCountTarget=${G1_MIXED_GCCOUNT_TARGET:-8}"
JAVA_OPTS="${JAVA_OPTS} -XX:G1MixedGCLiveThresholdPercent=${G1_MIXED_GCLIVE_THRESHOLD_PERCENT:-65}"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled"
elif [[ "${GC_MODE}" == "CMS" ]]; then
echo "GC mode is CMS"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseConcMarkSweepGC -Xmn${XMN:-512m}"
JAVA_OPTS="${JAVA_OPTS} -XX:ParallelGCThreads=${PARALLEL_GC_THREADS:-2} -XX:ConcGCThreads=${CONC_GC_THREADS:-1}"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=${CMS_INITIATING_HEAP_OCCUPANCY_PERCENT:-92}"
JAVA_OPTS="${JAVA_OPTS} -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark"
fi
if [[ "${USE_GC_LOG}" == "Y" ]]; then
echo "GC log path is '${HOME}/logs/jvm_gc.log'."
JAVA_OPTS="${JAVA_OPTS} -XX:+PrintVMOptions"
JAVA_OPTS="${JAVA_OPTS} -Xlog:gc:file=${HOME}/logs/jvm_gc-%p-%t.log:tags,uptime,time,level:filecount=${GC_LOG_FILE_COUNT:-10},filesize=${GC_LOG_FILE_SIZE:-100M}"
fi
if [ ! -d "${HOME}/logs" ]; then
mkdir ${HOME}/logs
fi
if [[ "${USE_HEAP_DUMP}" == "Y" ]]; then
echo "Heap dump path is '${HOME}/logs/jvm_heap_dump.hprof'."
JAVA_OPTS="${JAVA_OPTS} -XX:HeapDumpPath=${HOME}/logs/jvm_heap_dump.hprof -XX:+HeapDumpOnOutOfMemoryError"
fi
if [[ "${USE_LARGE_PAGES}" == "Y" ]]; then
echo "Use large pages."
JAVA_OPTS="${JAVA_OPTS} -XX:+UseLargePages"
fi
if [[ "${JDWP_DEBUG:-N}" == "Y" ]]; then
echo "Attach to remote JVM using port ${JDWP_PORT:-5005}."
JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=${JDWP_PORT:-5005},server=y,suspend=n"
fi
JAVA_OPTS="${JAVA_OPTS} -Dserver.port=${SERVER_PORT} -Dmanagement.server.port=${MANAGEMENT_SERVER_PORT} -Dspring.profiles.active=prod"
exec java $JAVA_OPTS -noverify -Djava.security.egd=file:/dev/./urandom "org.springframework.boot.loader.launch.JarLauncher" "$@"

49
docker/xjar/Dockerfile Normal file
View File

@ -0,0 +1,49 @@
# 使用基础镜像
FROM golang:1.21.3 as builder
# 设置工作目录并指定构建模块
WORKDIR /app
ARG MODULE
# 复制必要文件
COPY $MODULE/target/xJarDir .
RUN go mod init . && \
go mod tidy && \
go build -o . xjar.go
#
## 创建容器镜像
#FROM openjdk:21-jdk
#
#ARG ACTIVE
#
## 定义镜像元数据和环境变量
#LABEL maintainer="shenyifei <809745357@qq.com>"
#LABEL version="1.0.0"
#ENV HOME "/app"
#ENV TZ "Asia/Shanghai"
#ENV LANG "C.UTF-8"
#ENV XMS "500m"
#ENV XMX "2g"
#ENV XSS "256k"
#ENV GC_MODE "G1"
#ENV USE_GC_LOG "Y"
#ENV USE_HEAP_DUMP "Y"
#ENV USE_LARGE_PAGES "N"
#ENV SPRING_PROFILES_ACTIVE ${ACTIVE}
#ENV SERVER_PORT "8080"
#ENV MANAGEMENT_SERVER_PORT "9080"
#ENV NACOS_SERVER_ADDR "nacos-headless:8848"
#
#WORKDIR $HOME
#
#RUN chmod +x entrypoint.sh
#
#RUN mkdir $HOME/logs \
# && touch $HOME/logs/entrypoint.out \
# && ln -sf /dev/stdout $HOME/logs/entrypoint.out \
# && ln -sf /dev/stderr $HOME/logs/entrypoint.out
#
## 设置启动入口和端口
#EXPOSE $SERVER_PORT $MANAGEMENT_SERVER_PORT
#ENTRYPOINT ["./entrypoint.sh"]

59
docker/xjar/entrypoint.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
JAVA_OPTS="${JAVA_OPTS} -server"
JAVA_OPTS="${JAVA_OPTS} -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions"
JAVA_OPTS="${JAVA_OPTS} -XX:+AlwaysPreTouch -XX:+PrintFlagsFinal -XX:-DisplayVMOutput -XX:-OmitStackTraceInFastThrow"
JAVA_OPTS="${JAVA_OPTS} -Xms${XMS:-1G} -Xmx${XMX:-1G} -Xss${XSS:-256K}"
JAVA_OPTS="${JAVA_OPTS} -XX:MetaspaceSize=${METASPACE_SIZE:-128M} -XX:MaxMetaspaceSize=${MAX_METASPACE_SIZE:-256M}"
JAVA_OPTS="${JAVA_OPTS} -XX:MaxGCPauseMillis=${MAX_GC_PAUSE_MILLIS:-200}"
if [[ "${GC_MODE}" == "ShenandoahGC" ]]; then
echo "GC mode is ShenandoahGC"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseShenandoahGC"
elif [[ "${GC_MODE}" == "ZGC" ]]; then
echo "GC mode is ZGC"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseZGC"
elif [[ "${GC_MODE}" == "G1" ]]; then
echo "GC mode is G1"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseG1GC"
JAVA_OPTS="${JAVA_OPTS} -XX:InitiatingHeapOccupancyPercent=${INITIATING_HEAP_OCCUPANCY_PERCENT:-45}"
JAVA_OPTS="${JAVA_OPTS} -XX:G1ReservePercent=${G1_RESERVE_PERCENT:-10} -XX:G1HeapWastePercent=${G1_HEAP_WASTE_PERCENT:-5} "
JAVA_OPTS="${JAVA_OPTS} -XX:G1NewSizePercent=${G1_NEW_SIZE_PERCENT:-50} -XX:G1MaxNewSizePercent=${G1_MAX_NEW_SIZE_PERCENT:-60}"
JAVA_OPTS="${JAVA_OPTS} -XX:G1MixedGCCountTarget=${G1_MIXED_GCCOUNT_TARGET:-8}"
JAVA_OPTS="${JAVA_OPTS} -XX:G1MixedGCLiveThresholdPercent=${G1_MIXED_GCLIVE_THRESHOLD_PERCENT:-65}"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled"
elif [[ "${GC_MODE}" == "CMS" ]]; then
echo "GC mode is CMS"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseConcMarkSweepGC -Xmn${XMN:-512m}"
JAVA_OPTS="${JAVA_OPTS} -XX:ParallelGCThreads=${PARALLEL_GC_THREADS:-2} -XX:ConcGCThreads=${CONC_GC_THREADS:-1}"
JAVA_OPTS="${JAVA_OPTS} -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=${CMS_INITIATING_HEAP_OCCUPANCY_PERCENT:-92}"
JAVA_OPTS="${JAVA_OPTS} -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark"
fi
if [[ "${USE_GC_LOG}" == "Y" ]]; then
echo "GC log path is '${HOME}/logs/jvm_gc.log'."
JAVA_OPTS="${JAVA_OPTS} -XX:+PrintVMOptions"
JAVA_OPTS="${JAVA_OPTS} -Xlog:gc:file=${HOME}/logs/jvm_gc-%p-%t.log:tags,uptime,time,level:filecount=${GC_LOG_FILE_COUNT:-10},filesize=${GC_LOG_FILE_SIZE:-100M}"
fi
if [ ! -d "${HOME}/logs" ]; then
mkdir ${HOME}/logs
fi
if [[ "${USE_HEAP_DUMP}" == "Y" ]]; then
echo "Heap dump path is '${HOME}/logs/jvm_heap_dump.hprof'."
JAVA_OPTS="${JAVA_OPTS} -XX:HeapDumpPath=${HOME}/logs/jvm_heap_dump.hprof -XX:+HeapDumpOnOutOfMemoryError"
fi
if [[ "${USE_LARGE_PAGES}" == "Y" ]]; then
echo "Use large pages."
JAVA_OPTS="${JAVA_OPTS} -XX:+UseLargePages"
fi
if [[ "${JDWP_DEBUG:-N}" == "Y" ]]; then
echo "Attach to remote JVM using port ${JDWP_PORT:-5005}."
JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=${JDWP_PORT:-5005},server=y,suspend=n"
fi
JAVA_OPTS="${JAVA_OPTS} -Dserver.port=${SERVER_PORT} -Dmanagement.server.port=${MANAGEMENT_SERVER_PORT} -Dspring.profiles.active=prod"
exec xjar java $JAVA_OPTS -noverify -Djava.security.egd=file:/dev/./urandom zsplat.jar

144
erp-turbo-admin/pom.xml Normal file
View File

@ -0,0 +1,144 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xunhong</groupId>
<artifactId>ERPTurbo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>erp-turbo-admin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<application.name>erp-turbo-admin</application.name>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-base</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-config</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-file</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-api</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-rpc</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-web</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-sa-token</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-apm</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-logback</artifactId>
</dependency>
<!-- TEST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- h2内存数据库-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-mate-annotation</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>8.0.3</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>5.0.3</version>
</dependency>
</dependencies>
<build>
<finalName>${application.name}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<mainClass>
com.xunhong.erp.turbo.admin.ErpTurboAdminApplication
</mainClass>
<layers>
<enabled>true</enabled>
<configuration>
../layers/layers.xml
</configuration>
</layers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.admin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Spring Boot Starter
*
* @author shenyifei
*/
@SpringBootApplication(scanBasePackages = {"com.xunhong.erp.turbo", "com.alibaba.cola"})
public class ErpTurboAdminApplication {
public static void main(String[] args) {
SpringApplication.run(ErpTurboAdminApplication.class, args);
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.AgreementServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.AgreementListQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.AgreementPageQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.AgreementShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.AgreementVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Agreement", description = "协议管理")
@RestController("operationAgreementController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class AgreementController {
@DubboReference(version = "1.0.0")
private final AgreementServiceI agreementService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_AGREEMENT_VIEW})
@GetMapping("listAgreement")
@Operation(summary = "协议列表", method = "GET")
public MultiResponse<AgreementVO> listAgreement(@ModelAttribute @Validated AgreementListQry agreementListQry) {
return MultiResponse.of(agreementService.list(agreementListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_AGREEMENT_CREATE})
@PostMapping("createAgreement")
@Operation(summary = "创建协议", method = "POST")
public SingleResponse<AgreementVO> createAgreement(@RequestBody @Validated AgreementCreateCmd agreementCreateCmd) {
return SingleResponse.of(agreementService.create(agreementCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_AGREEMENT_VIEW})
@GetMapping("showAgreement")
@Operation(summary = "协议详情", method = "GET")
public SingleResponse<AgreementVO> showAgreement(@ModelAttribute @Validated AgreementShowQry agreementShowQry) {
return SingleResponse.of(agreementService.show(agreementShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_AGREEMENT_VIEW})
@GetMapping("pageAgreement")
@Operation(summary = "协议列表", method = "GET")
public PageResponse<AgreementVO> pageAgreement(@ModelAttribute @Validated AgreementPageQry agreementPageQry) {
PageDTO<AgreementVO> page = agreementService.page(agreementPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_AGREEMENT_UPDATE})
@RequestMapping(value = "updateAgreement", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "协议更新", method = "PATCH")
public SingleResponse<AgreementVO> updateAgreement(@RequestBody @Validated AgreementUpdateCmd agreementUpdateCmd) {
return SingleResponse.of(agreementService.update(agreementUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_AGREEMENT_DELETE})
@DeleteMapping("destroyAgreement")
@Operation(summary = "协议删除", method = "DELETE")
public Response destroyAgreement(@RequestBody @Validated AgreementDestroyCmd agreementDestroyCmd) {
agreementService.destroy(agreementDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.BoxBrandServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.BoxBrandListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.BoxBrandPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.BoxBrandShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxBrandVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "BoxBrand", description = "纸箱品牌管理")
@RestController("operationBoxBrandController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class BoxBrandController {
@DubboReference(version = "1.0.0")
private final BoxBrandServiceI boxBrandService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_BRAND_VIEW})
@GetMapping("listBoxBrand")
@Operation(summary = "纸箱品牌列表", method = "GET")
public MultiResponse<BoxBrandVO> listBoxBrand(@ModelAttribute @Validated BoxBrandListQry boxBrandListQry) {
return MultiResponse.of(boxBrandService.list(boxBrandListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_BRAND_CREATE})
@PostMapping("createBoxBrand")
@Operation(summary = "创建纸箱品牌", method = "POST")
public SingleResponse<BoxBrandVO> createBoxBrand(@RequestBody @Validated BoxBrandCreateCmd boxBrandCreateCmd) {
return SingleResponse.of(boxBrandService.create(boxBrandCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_BRAND_VIEW})
@GetMapping("showBoxBrand")
@Operation(summary = "纸箱品牌详情", method = "GET")
public SingleResponse<BoxBrandVO> showBoxBrand(@ModelAttribute @Validated BoxBrandShowQry boxBrandShowQry) {
return SingleResponse.of(boxBrandService.show(boxBrandShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_BRAND_VIEW})
@GetMapping("pageBoxBrand")
@Operation(summary = "纸箱品牌列表", method = "GET")
public PageResponse<BoxBrandVO> pageBoxBrand(@ModelAttribute @Validated BoxBrandPageQry boxBrandPageQry) {
PageDTO<BoxBrandVO> page = boxBrandService.page(boxBrandPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_BRAND_UPDATE})
@RequestMapping(value = "updateBoxBrand", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "纸箱品牌更新", method = "PATCH")
public SingleResponse<BoxBrandVO> updateBoxBrand(@RequestBody @Validated BoxBrandUpdateCmd boxBrandUpdateCmd) {
return SingleResponse.of(boxBrandService.update(boxBrandUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_BRAND_DELETE})
@DeleteMapping("destroyBoxBrand")
@Operation(summary = "纸箱品牌删除", method = "DELETE")
public Response destroyBoxBrand(@RequestBody @Validated BoxBrandDestroyCmd boxBrandDestroyCmd) {
boxBrandService.destroy(boxBrandDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.BoxProductServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxProductCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxProductDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxProductUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.BoxProductListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.BoxProductPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.BoxProductShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxProductVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "BoxProduct", description = "纸箱产品管理")
@RestController("operationBoxProductController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class BoxProductController {
@DubboReference(version = "1.0.0")
private final BoxProductServiceI boxProductService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_PRODUCT_VIEW})
@GetMapping("listBoxProduct")
@Operation(summary = "纸箱产品列表", method = "GET")
public MultiResponse<BoxProductVO> listBoxProduct(@ModelAttribute @Validated BoxProductListQry boxProductListQry) {
return MultiResponse.of(boxProductService.list(boxProductListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_PRODUCT_CREATE})
@PostMapping("createBoxProduct")
@Operation(summary = "创建纸箱产品", method = "POST")
public SingleResponse<BoxProductVO> createBoxProduct(@RequestBody @Validated BoxProductCreateCmd boxProductCreateCmd) {
return SingleResponse.of(boxProductService.create(boxProductCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_PRODUCT_VIEW})
@GetMapping("showBoxProduct")
@Operation(summary = "纸箱产品详情", method = "GET")
public SingleResponse<BoxProductVO> showBoxProduct(@ModelAttribute @Validated BoxProductShowQry boxProductShowQry) {
return SingleResponse.of(boxProductService.show(boxProductShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_PRODUCT_VIEW})
@GetMapping("pageBoxProduct")
@Operation(summary = "纸箱产品列表", method = "GET")
public PageResponse<BoxProductVO> pageBoxProduct(@ModelAttribute @Validated BoxProductPageQry boxProductPageQry) {
PageDTO<BoxProductVO> page = boxProductService.page(boxProductPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_PRODUCT_UPDATE})
@RequestMapping(value = "updateBoxProduct", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "纸箱产品更新", method = "PATCH")
public SingleResponse<BoxProductVO> updateBoxProduct(@RequestBody @Validated BoxProductUpdateCmd boxProductUpdateCmd) {
return SingleResponse.of(boxProductService.update(boxProductUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_BOX_PRODUCT_DELETE})
@DeleteMapping("destroyBoxProduct")
@Operation(summary = "纸箱产品删除", method = "DELETE")
public Response destroyBoxProduct(@RequestBody @Validated BoxProductDestroyCmd boxProductDestroyCmd) {
boxProductService.destroy(boxProductDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,74 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.ChannelServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.ChannelCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.ChannelDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.ChannelUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.ChannelPageQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.ChannelShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.ChannelVO;
import com.xunhong.erp.turbo.api.rbac.dto.constants.PermissionConstant;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Tag(name = "Channel", description = "渠道管理")
@RestController("operationChannelController")
@RequestMapping("/operation")
@RequiredArgsConstructor
public class ChannelController {
@DubboReference(version = "1.0.0")
private final ChannelServiceI channelService;
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_CHANNEL_VIEW})
@GetMapping("/pageChannel")
@Operation(summary = "渠道分页", method = "GET")
public PageResponse<ChannelVO> pageChannel(@ModelAttribute @Validated ChannelPageQry channelPageQry) {
PageDTO<ChannelVO> page = channelService.page(channelPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_CHANNEL_CREATE})
@PostMapping("/createChannel")
@Operation(summary = "创建渠道", method = "POST")
public SingleResponse<ChannelVO> createChannel(@RequestBody @Validated ChannelCreateCmd channelCreateCmd) {
return SingleResponse.of(channelService.create(channelCreateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_CHANNEL_VIEW})
@GetMapping("/showChannel")
@Operation(summary = "渠道详情", method = "GET")
public SingleResponse<ChannelVO> showChannel(@ModelAttribute @Validated ChannelShowQry channelShowQry) {
return SingleResponse.of(channelService.show(channelShowQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_CHANNEL_UPDATE})
@RequestMapping(value = "/updateChannel", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "渠道更新", method = "PATCH")
public SingleResponse<ChannelVO> updateChannel(@RequestBody @Validated ChannelUpdateCmd channelUpdateCmd) {
return SingleResponse.of(channelService.update(channelUpdateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_CHANNEL_DELETE})
@DeleteMapping(value = "/destroyChannel")
@Operation(summary = "渠道删除", method = "DELETE")
public Response destroyChannel(@RequestBody @Validated ChannelDestroyCmd channelDestroyCmd) {
channelService.destroy(channelDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.CompanyServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Company", description = "公司管理管理")
@RestController("operationCompanyController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class CompanyController {
@DubboReference(version = "1.0.0")
private final CompanyServiceI companyService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_VIEW})
@GetMapping("listCompany")
@Operation(summary = "公司管理列表", method = "GET")
public MultiResponse<CompanyVO> listCompany(@ModelAttribute @Validated CompanyListQry companyListQry) {
return MultiResponse.of(companyService.list(companyListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_CREATE})
@PostMapping("createCompany")
@Operation(summary = "创建公司管理", method = "POST")
public SingleResponse<CompanyVO> createCompany(@RequestBody @Validated CompanyCreateCmd companyCreateCmd) {
return SingleResponse.of(companyService.create(companyCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_VIEW})
@GetMapping("showCompany")
@Operation(summary = "公司管理详情", method = "GET")
public SingleResponse<CompanyVO> showCompany(@ModelAttribute @Validated CompanyShowQry companyShowQry) {
return SingleResponse.of(companyService.show(companyShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_VIEW})
@GetMapping("pageCompany")
@Operation(summary = "公司管理列表", method = "GET")
public PageResponse<CompanyVO> pageCompany(@ModelAttribute @Validated CompanyPageQry companyPageQry) {
PageDTO<CompanyVO> page = companyService.page(companyPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_UPDATE})
@RequestMapping(value = "updateCompany", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "公司管理更新", method = "PATCH")
public SingleResponse<CompanyVO> updateCompany(@RequestBody @Validated CompanyUpdateCmd companyUpdateCmd) {
return SingleResponse.of(companyService.update(companyUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_DELETE})
@DeleteMapping("destroyCompany")
@Operation(summary = "公司管理删除", method = "DELETE")
public Response destroyCompany(@RequestBody @Validated CompanyDestroyCmd companyDestroyCmd) {
companyService.destroy(companyDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.CompanyPaymentAccountServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyPaymentAccountCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyPaymentAccountDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyPaymentAccountUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyPaymentAccountListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyPaymentAccountPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyPaymentAccountShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyPaymentAccountVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "CompanyPaymentAccount", description = "公司付款账户管理")
@RestController("operationCompanyPaymentAccountController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class CompanyPaymentAccountController {
@DubboReference(version = "1.0.0")
private final CompanyPaymentAccountServiceI companyPaymentAccountService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_PAYMENT_ACCOUNT_VIEW})
@GetMapping("listCompanyPaymentAccount")
@Operation(summary = "公司付款账户列表", method = "GET")
public MultiResponse<CompanyPaymentAccountVO> listCompanyPaymentAccount(@ModelAttribute @Validated CompanyPaymentAccountListQry companyPaymentAccountListQry) {
return MultiResponse.of(companyPaymentAccountService.list(companyPaymentAccountListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_PAYMENT_ACCOUNT_CREATE})
@PostMapping("createCompanyPaymentAccount")
@Operation(summary = "创建公司付款账户", method = "POST")
public SingleResponse<CompanyPaymentAccountVO> createCompanyPaymentAccount(@RequestBody @Validated CompanyPaymentAccountCreateCmd companyPaymentAccountCreateCmd) {
return SingleResponse.of(companyPaymentAccountService.create(companyPaymentAccountCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_PAYMENT_ACCOUNT_VIEW})
@GetMapping("showCompanyPaymentAccount")
@Operation(summary = "公司付款账户详情", method = "GET")
public SingleResponse<CompanyPaymentAccountVO> showCompanyPaymentAccount(@ModelAttribute @Validated CompanyPaymentAccountShowQry companyPaymentAccountShowQry) {
return SingleResponse.of(companyPaymentAccountService.show(companyPaymentAccountShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_PAYMENT_ACCOUNT_VIEW})
@GetMapping("pageCompanyPaymentAccount")
@Operation(summary = "公司付款账户列表", method = "GET")
public PageResponse<CompanyPaymentAccountVO> pageCompanyPaymentAccount(@ModelAttribute @Validated CompanyPaymentAccountPageQry companyPaymentAccountPageQry) {
PageDTO<CompanyPaymentAccountVO> page = companyPaymentAccountService.page(companyPaymentAccountPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_PAYMENT_ACCOUNT_UPDATE})
@RequestMapping(value = "updateCompanyPaymentAccount", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "公司付款账户更新", method = "PATCH")
public SingleResponse<CompanyPaymentAccountVO> updateCompanyPaymentAccount(@RequestBody @Validated CompanyPaymentAccountUpdateCmd companyPaymentAccountUpdateCmd) {
return SingleResponse.of(companyPaymentAccountService.update(companyPaymentAccountUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COMPANY_PAYMENT_ACCOUNT_DELETE})
@DeleteMapping("destroyCompanyPaymentAccount")
@Operation(summary = "公司付款账户删除", method = "DELETE")
public Response destroyCompanyPaymentAccount(@RequestBody @Validated CompanyPaymentAccountDestroyCmd companyPaymentAccountDestroyCmd) {
companyPaymentAccountService.destroy(companyPaymentAccountDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.CostItemServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.CostItemListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CostItemPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CostItemShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.CostItemVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "CostItem", description = "费用项目管理")
@RestController("operationCostItemController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class CostItemController {
@DubboReference(version = "1.0.0")
private final CostItemServiceI costItemService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COST_ITEM_VIEW})
@GetMapping("listCostItem")
@Operation(summary = "费用项目列表", method = "GET")
public MultiResponse<CostItemVO> listCostItem(@ModelAttribute @Validated CostItemListQry costItemListQry) {
return MultiResponse.of(costItemService.list(costItemListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COST_ITEM_CREATE})
@PostMapping("createCostItem")
@Operation(summary = "创建费用项目", method = "POST")
public SingleResponse<CostItemVO> createCostItem(@RequestBody @Validated CostItemCreateCmd costItemCreateCmd) {
return SingleResponse.of(costItemService.create(costItemCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COST_ITEM_VIEW})
@GetMapping("showCostItem")
@Operation(summary = "费用项目详情", method = "GET")
public SingleResponse<CostItemVO> showCostItem(@ModelAttribute @Validated CostItemShowQry costItemShowQry) {
return SingleResponse.of(costItemService.show(costItemShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COST_ITEM_VIEW})
@GetMapping("pageCostItem")
@Operation(summary = "费用项目列表", method = "GET")
public PageResponse<CostItemVO> pageCostItem(@ModelAttribute @Validated CostItemPageQry costItemPageQry) {
PageDTO<CostItemVO> page = costItemService.page(costItemPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COST_ITEM_UPDATE})
@RequestMapping(value = "updateCostItem", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "费用项目更新", method = "PATCH")
public SingleResponse<CostItemVO> updateCostItem(@RequestBody @Validated CostItemUpdateCmd costItemUpdateCmd) {
return SingleResponse.of(costItemService.update(costItemUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_COST_ITEM_DELETE})
@DeleteMapping("destroyCostItem")
@Operation(summary = "费用项目删除", method = "DELETE")
public Response destroyCostItem(@RequestBody @Validated CostItemDestroyCmd costItemDestroyCmd) {
costItemService.destroy(costItemDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.DealerServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Dealer", description = "经销商表管理")
@RestController("operationDealerController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class DealerController {
@DubboReference(version = "1.0.0")
private final DealerServiceI dealerService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_VIEW})
@GetMapping("listDealer")
@Operation(summary = "经销商表列表", method = "GET")
public MultiResponse<DealerVO> listDealer(@ModelAttribute @Validated DealerListQry dealerListQry) {
return MultiResponse.of(dealerService.list(dealerListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_CREATE})
@PostMapping("createDealer")
@Operation(summary = "创建经销商表", method = "POST")
public SingleResponse<DealerVO> createDealer(@RequestBody @Validated DealerCreateCmd dealerCreateCmd) {
return SingleResponse.of(dealerService.create(dealerCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_VIEW})
@GetMapping("showDealer")
@Operation(summary = "经销商表详情", method = "GET")
public SingleResponse<DealerVO> showDealer(@ModelAttribute @Validated DealerShowQry dealerShowQry) {
return SingleResponse.of(dealerService.show(dealerShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_VIEW})
@GetMapping("pageDealer")
@Operation(summary = "经销商表列表", method = "GET")
public PageResponse<DealerVO> pageDealer(@ModelAttribute @Validated DealerPageQry dealerPageQry) {
PageDTO<DealerVO> page = dealerService.page(dealerPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_UPDATE})
@RequestMapping(value = "updateDealer", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "经销商表更新", method = "PATCH")
public SingleResponse<DealerVO> updateDealer(@RequestBody @Validated DealerUpdateCmd dealerUpdateCmd) {
return SingleResponse.of(dealerService.update(dealerUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_DELETE})
@DeleteMapping("destroyDealer")
@Operation(summary = "经销商表删除", method = "DELETE")
public Response destroyDealer(@RequestBody @Validated DealerDestroyCmd dealerDestroyCmd) {
dealerService.destroy(dealerDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.DealerPaymentAccountServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerPaymentAccountCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerPaymentAccountDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerPaymentAccountUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerPaymentAccountListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerPaymentAccountPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerPaymentAccountShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerPaymentAccountVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "DealerPaymentAccount", description = "经销商付款账户管理")
@RestController("operationDealerPaymentAccountController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class DealerPaymentAccountController {
@DubboReference(version = "1.0.0")
private final DealerPaymentAccountServiceI dealerPaymentAccountService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_PAYMENT_ACCOUNT_VIEW})
@GetMapping("listDealerPaymentAccount")
@Operation(summary = "经销商付款账户列表", method = "GET")
public MultiResponse<DealerPaymentAccountVO> listDealerPaymentAccount(@ModelAttribute @Validated DealerPaymentAccountListQry dealerPaymentAccountListQry) {
return MultiResponse.of(dealerPaymentAccountService.list(dealerPaymentAccountListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_PAYMENT_ACCOUNT_CREATE})
@PostMapping("createDealerPaymentAccount")
@Operation(summary = "创建经销商付款账户", method = "POST")
public SingleResponse<DealerPaymentAccountVO> createDealerPaymentAccount(@RequestBody @Validated DealerPaymentAccountCreateCmd dealerPaymentAccountCreateCmd) {
return SingleResponse.of(dealerPaymentAccountService.create(dealerPaymentAccountCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_PAYMENT_ACCOUNT_VIEW})
@GetMapping("showDealerPaymentAccount")
@Operation(summary = "经销商付款账户详情", method = "GET")
public SingleResponse<DealerPaymentAccountVO> showDealerPaymentAccount(@ModelAttribute @Validated DealerPaymentAccountShowQry dealerPaymentAccountShowQry) {
return SingleResponse.of(dealerPaymentAccountService.show(dealerPaymentAccountShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_PAYMENT_ACCOUNT_VIEW})
@GetMapping("pageDealerPaymentAccount")
@Operation(summary = "经销商付款账户列表", method = "GET")
public PageResponse<DealerPaymentAccountVO> pageDealerPaymentAccount(@ModelAttribute @Validated DealerPaymentAccountPageQry dealerPaymentAccountPageQry) {
PageDTO<DealerPaymentAccountVO> page = dealerPaymentAccountService.page(dealerPaymentAccountPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_PAYMENT_ACCOUNT_UPDATE})
@RequestMapping(value = "updateDealerPaymentAccount", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "经销商付款账户更新", method = "PATCH")
public SingleResponse<DealerPaymentAccountVO> updateDealerPaymentAccount(@RequestBody @Validated DealerPaymentAccountUpdateCmd dealerPaymentAccountUpdateCmd) {
return SingleResponse.of(dealerPaymentAccountService.update(dealerPaymentAccountUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_PAYMENT_ACCOUNT_DELETE})
@DeleteMapping("destroyDealerPaymentAccount")
@Operation(summary = "经销商付款账户删除", method = "DELETE")
public Response destroyDealerPaymentAccount(@RequestBody @Validated DealerPaymentAccountDestroyCmd dealerPaymentAccountDestroyCmd) {
dealerPaymentAccountService.destroy(dealerPaymentAccountDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.DealerRebateCustomerServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerRebateCustomerCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerRebateCustomerDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerRebateCustomerUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerRebateCustomerListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerRebateCustomerPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerRebateCustomerShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerRebateCustomerVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "DealerRebateCustomer", description = "经销商返点客户管理")
@RestController("operationDealerRebateCustomerController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class DealerRebateCustomerController {
@DubboReference(version = "1.0.0")
private final DealerRebateCustomerServiceI dealerRebateCustomerService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_REBATE_CUSTOMER_VIEW})
@GetMapping("listDealerRebateCustomer")
@Operation(summary = "经销商返点客户列表", method = "GET")
public MultiResponse<DealerRebateCustomerVO> listDealerRebateCustomer(@ModelAttribute @Validated DealerRebateCustomerListQry dealerRebateCustomerListQry) {
return MultiResponse.of(dealerRebateCustomerService.list(dealerRebateCustomerListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_REBATE_CUSTOMER_CREATE})
@PostMapping("createDealerRebateCustomer")
@Operation(summary = "创建经销商返点客户", method = "POST")
public SingleResponse<DealerRebateCustomerVO> createDealerRebateCustomer(@RequestBody @Validated DealerRebateCustomerCreateCmd dealerRebateCustomerCreateCmd) {
return SingleResponse.of(dealerRebateCustomerService.create(dealerRebateCustomerCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_REBATE_CUSTOMER_VIEW})
@GetMapping("showDealerRebateCustomer")
@Operation(summary = "经销商返点客户详情", method = "GET")
public SingleResponse<DealerRebateCustomerVO> showDealerRebateCustomer(@ModelAttribute @Validated DealerRebateCustomerShowQry dealerRebateCustomerShowQry) {
return SingleResponse.of(dealerRebateCustomerService.show(dealerRebateCustomerShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_REBATE_CUSTOMER_VIEW})
@GetMapping("pageDealerRebateCustomer")
@Operation(summary = "经销商返点客户列表", method = "GET")
public PageResponse<DealerRebateCustomerVO> pageDealerRebateCustomer(@ModelAttribute @Validated DealerRebateCustomerPageQry dealerRebateCustomerPageQry) {
PageDTO<DealerRebateCustomerVO> page = dealerRebateCustomerService.page(dealerRebateCustomerPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_REBATE_CUSTOMER_UPDATE})
@RequestMapping(value = "updateDealerRebateCustomer", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "经销商返点客户更新", method = "PATCH")
public SingleResponse<DealerRebateCustomerVO> updateDealerRebateCustomer(@RequestBody @Validated DealerRebateCustomerUpdateCmd dealerRebateCustomerUpdateCmd) {
return SingleResponse.of(dealerRebateCustomerService.update(dealerRebateCustomerUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_REBATE_CUSTOMER_DELETE})
@DeleteMapping("destroyDealerRebateCustomer")
@Operation(summary = "经销商返点客户删除", method = "DELETE")
public Response destroyDealerRebateCustomer(@RequestBody @Validated DealerRebateCustomerDestroyCmd dealerRebateCustomerDestroyCmd) {
dealerRebateCustomerService.destroy(dealerRebateCustomerDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.DealerWarehouseServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerWarehouseCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerWarehouseDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerWarehouseUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerWarehouseListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerWarehousePageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.DealerWarehouseShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerWarehouseVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "DealerWarehouse", description = "经销商仓库管理")
@RestController("operationDealerWarehouseController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class DealerWarehouseController {
@DubboReference(version = "1.0.0")
private final DealerWarehouseServiceI dealerWarehouseService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_WAREHOUSE_VIEW})
@GetMapping("listDealerWarehouse")
@Operation(summary = "经销商仓库列表", method = "GET")
public MultiResponse<DealerWarehouseVO> listDealerWarehouse(@ModelAttribute @Validated DealerWarehouseListQry dealerWarehouseListQry) {
return MultiResponse.of(dealerWarehouseService.list(dealerWarehouseListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_WAREHOUSE_CREATE})
@PostMapping("createDealerWarehouse")
@Operation(summary = "创建经销商仓库", method = "POST")
public SingleResponse<DealerWarehouseVO> createDealerWarehouse(@RequestBody @Validated DealerWarehouseCreateCmd dealerWarehouseCreateCmd) {
return SingleResponse.of(dealerWarehouseService.create(dealerWarehouseCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_WAREHOUSE_VIEW})
@GetMapping("showDealerWarehouse")
@Operation(summary = "经销商仓库详情", method = "GET")
public SingleResponse<DealerWarehouseVO> showDealerWarehouse(@ModelAttribute @Validated DealerWarehouseShowQry dealerWarehouseShowQry) {
return SingleResponse.of(dealerWarehouseService.show(dealerWarehouseShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_WAREHOUSE_VIEW})
@GetMapping("pageDealerWarehouse")
@Operation(summary = "经销商仓库列表", method = "GET")
public PageResponse<DealerWarehouseVO> pageDealerWarehouse(@ModelAttribute @Validated DealerWarehousePageQry dealerWarehousePageQry) {
PageDTO<DealerWarehouseVO> page = dealerWarehouseService.page(dealerWarehousePageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_WAREHOUSE_UPDATE})
@RequestMapping(value = "updateDealerWarehouse", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "经销商仓库更新", method = "PATCH")
public SingleResponse<DealerWarehouseVO> updateDealerWarehouse(@RequestBody @Validated DealerWarehouseUpdateCmd dealerWarehouseUpdateCmd) {
return SingleResponse.of(dealerWarehouseService.update(dealerWarehouseUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DEALER_WAREHOUSE_DELETE})
@DeleteMapping("destroyDealerWarehouse")
@Operation(summary = "经销商仓库删除", method = "DELETE")
public Response destroyDealerWarehouse(@RequestBody @Validated DealerWarehouseDestroyCmd dealerWarehouseDestroyCmd) {
dealerWarehouseService.destroy(dealerWarehouseDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.DictionaryServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.DictionaryCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.DictionaryDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.DictionaryUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.DictionaryListQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.DictionaryPageQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.DictionaryShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.DictionaryVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Dictionary", description = "字典管理")
@RestController("DictionaryController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class DictionaryController {
@DubboReference(version = "1.0.0")
private final DictionaryServiceI dictionaryService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DICTIONARY_VIEW})
@GetMapping("listDictionary")
@Operation(summary = "字典列表", method = "GET")
public MultiResponse<DictionaryVO> listDictionary(@ModelAttribute @Validated DictionaryListQry dictionaryListQry) {
return MultiResponse.of(dictionaryService.list(dictionaryListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DICTIONARY_CREATE})
@PostMapping("createDictionary")
@Operation(summary = "创建字典", method = "POST")
public SingleResponse<DictionaryVO> createDictionary(@RequestBody @Validated DictionaryCreateCmd dictionaryCreateCmd) {
return SingleResponse.of(dictionaryService.create(dictionaryCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DICTIONARY_VIEW})
@GetMapping("showDictionary")
@Operation(summary = "字典详情", method = "GET")
public SingleResponse<DictionaryVO> showDictionary(@ModelAttribute @Validated DictionaryShowQry dictionaryShowQry) {
return SingleResponse.of(dictionaryService.show(dictionaryShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DICTIONARY_VIEW})
@GetMapping("pageDictionary")
@Operation(summary = "字典列表", method = "GET")
public PageResponse<DictionaryVO> pageDictionary(@ModelAttribute @Validated DictionaryPageQry dictionaryPageQry) {
PageDTO<DictionaryVO> page = dictionaryService.page(dictionaryPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DICTIONARY_UPDATE})
@RequestMapping(value = "updateDictionary", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "字典更新", method = "PATCH")
public SingleResponse<DictionaryVO> updateDictionary(@RequestBody @Validated DictionaryUpdateCmd dictionaryUpdateCmd) {
return SingleResponse.of(dictionaryService.update(dictionaryUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_DICTIONARY_DELETE})
@DeleteMapping("destroyDictionary")
@Operation(summary = "字典删除", method = "DELETE")
public Response destroyDictionary(@RequestBody @Validated DictionaryDestroyCmd dictionaryDestroyCmd) {
dictionaryService.destroy(dictionaryDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,194 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckSafe;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.monitor4all.logRecord.annotation.OperationLog;
import cn.monitor4all.logRecord.context.LogRecordContext;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.rbac.api.UserRoleServiceI;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.UserRoleCreateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.UserRoleUpdateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.qry.UserRoleListQry;
import com.xunhong.erp.turbo.api.rbac.dto.vo.UserRoleVO;
import com.xunhong.erp.turbo.api.user.api.EmployeeServiceI;
import com.xunhong.erp.turbo.api.user.dto.cmd.*;
import com.xunhong.erp.turbo.api.user.dto.qry.EmployeeListQry;
import com.xunhong.erp.turbo.api.user.dto.qry.EmployeePageQry;
import com.xunhong.erp.turbo.api.user.dto.qry.EmployeeShowQry;
import com.xunhong.erp.turbo.api.user.dto.vo.EmployeeVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* @author shenyifei
*/
@Tag(name = "Employee", description = "员工信息管理")
@RestController("operationEmployeeController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class EmployeeController {
@DubboReference(version = "1.0.0")
private final EmployeeServiceI employeeService;
@DubboReference(version = "1.0.0")
private final UserRoleServiceI userRoleService;
@SaCheckLogin
@SaCheckSafe
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_REST_PASSWORD})
@PostMapping("restEmployeePassword")
@Operation(summary = "重置员工密码", method = "POST")
public Response restEmployeePassword(@RequestBody @Validated EmployeeRestPasswordCmd employeeRestPasswordCmd) {
employeeService.restPassword(employeeRestPasswordCmd);
// 强制注销
StpUtil.logout(employeeRestPasswordCmd.getUserId());
return Response.buildSuccess();
}
@SaCheckLogin
@SaCheckSafe
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_DISABLE})
@PostMapping("disableEmployee")
@Operation(summary = "封禁员工", method = "POST")
@OperationLog(bizId = "#employeeVO.employeeId", bizType = "'disableEmployee'", msg = "'封禁员工:' + #employeeVO.name + '(工号:' + #employeeVO.number + ')'", operatorId = "T(cn.dev33.satoken.stp.StpUtil).getLoginIdAsLong()")
public Response disableEmployee(@RequestBody @Validated EmployeeDisableCmd employeeDisableCmd) {
EmployeeVO employeeVO = employeeService.disable(employeeDisableCmd);
// 踢他下线
StpUtil.kickout(employeeVO.getUserId());
// 永久封禁
StpUtil.disable(employeeVO.getUserId(), -1);
return Response.buildSuccess();
}
@SaCheckLogin
@SaCheckSafe
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_ROLE_UPDATE})
@PostMapping("updateEmployeeRole")
@Operation(summary = "修改员工角色", method = "POST")
@OperationLog(bizId = "#employeeVO.employeeId", bizType = "'updateEmployeeRole'", msg = "'修改员工角色:' + #employeeVO.name + '(工号:' + #employeeVO.number + ')'", extra = "#_DIFF(#oldEmployeeVO, #employeeVO)", operatorId = "T(cn.dev33.satoken.stp.StpUtil).getLoginIdAsLong()")
public Response updateEmployeeRole(@RequestBody @Validated UserRoleUpdateCmd userRoleUpdateCmd) {
userRoleService.update(userRoleUpdateCmd);
// 强制注销
StpUtil.logout(userRoleUpdateCmd.getUserId());
return Response.buildSuccess();
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_VIEW})
@GetMapping("listEmployee")
@Operation(summary = "员工信息列表", method = "GET")
public MultiResponse<EmployeeVO> listEmployee(@ModelAttribute @Validated EmployeeListQry employeeListQry) {
return MultiResponse.of(employeeService.list(employeeListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_CREATE})
@PostMapping("createEmployee")
@Operation(summary = "创建员工信息", method = "POST")
@OperationLog(bizId = "#employeeVO.employeeId", bizType = "'createEmployee'", msg = "'创建员工:' + #employeeVO.name + '(工号:' + #employeeVO.number + ')'", operatorId = "T(cn.dev33.satoken.stp.StpUtil).getLoginIdAsLong()")
public SingleResponse<EmployeeVO> createEmployee(@RequestBody @Validated EmployeeCreateCmd employeeCreateCmd) {
// 创建员工注册用户注册管理员
EmployeeVO employeeVO = employeeService.create(employeeCreateCmd);
// 赋予用户权限
UserRoleCreateCmd userRoleCreateCmd = new UserRoleCreateCmd();
userRoleCreateCmd.setRoleId(employeeCreateCmd.getRoleId());
userRoleCreateCmd.setUserId(employeeVO.getUserId());
List<UserRoleVO> userRoleVOList = userRoleService.create(userRoleCreateCmd);
employeeVO.setRoleIdList(userRoleVOList.stream().map(UserRoleVO::getRoleId).toList());
LogRecordContext.putVariable("employeeVO", employeeVO);
return SingleResponse.of(employeeVO);
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_VIEW})
@GetMapping("showEmployee")
@Operation(summary = "员工信息详情", method = "GET")
@OperationLog(bizId = "#employeeShowQry.employeeId", bizType = "'showEmployee'", msg = "'查看员工:' + #employeeVO.name + '(工号:' + #employeeVO.number + ')'", operatorId = "T(cn.dev33.satoken.stp.StpUtil).getLoginIdAsLong()")
public SingleResponse<EmployeeVO> showEmployee(@ModelAttribute @Validated EmployeeShowQry employeeShowQry) {
EmployeeVO employeeVO = employeeService.show(employeeShowQry);
// 获取角色
UserRoleListQry userRoleListQry = new UserRoleListQry();
userRoleListQry.setUserId(employeeVO.getUserId());
List<UserRoleVO> userRoleVOList = userRoleService.list(userRoleListQry);
employeeVO.setRoleIdList(userRoleVOList.stream().map(UserRoleVO::getRoleId).toList());
LogRecordContext.putVariable("employeeVO", employeeVO);
return SingleResponse.of(employeeVO);
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_VIEW})
@GetMapping("pageEmployee")
@Operation(summary = "员工信息列表", method = "GET")
public PageResponse<EmployeeVO> pageEmployee(@ModelAttribute @Validated EmployeePageQry employeePageQry) {
PageDTO<EmployeeVO> page = employeeService.page(employeePageQry);
List<Long> userIdList = page.getRecords().stream().map(EmployeeVO::getUserId).toList();
if (CollUtil.isNotEmpty(userIdList)) {
UserRoleListQry userRoleListQry = new UserRoleListQry();
userRoleListQry.setUserIdList(userIdList);
List<UserRoleVO> userRoleVOList = userRoleService.list(userRoleListQry);
page.getRecords().forEach(employeeVO -> employeeVO.setRoleIdList(userRoleVOList.stream().filter(userRoleVO -> userRoleVO.getUserId().equals(employeeVO.getUserId())).map(UserRoleVO::getRoleId).toList()));
}
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_UPDATE})
@RequestMapping(value = "updateEmployee", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "员工信息更新", method = "PATCH")
@OperationLog(bizId = "#employeeVO.employeeId", bizType = "'updateEmployee'", msg = "'更新员工:' + #employeeVO.name + '(工号:' + #employeeVO.number + ')'", extra = "#_DIFF(#oldEmployeeVO, #employeeVO)", operatorId = "T(cn.dev33.satoken.stp.StpUtil).getLoginIdAsLong()")
public SingleResponse<EmployeeVO> updateEmployee(@RequestBody @Validated EmployeeUpdateCmd employeeUpdateCmd) {
EmployeeShowQry employeeShowQry = new EmployeeShowQry();
employeeShowQry.setEmployeeId(employeeUpdateCmd.getEmployeeId());
LogRecordContext.putVariable("oldEmployeeVO", employeeService.show(employeeShowQry));
EmployeeVO employeeVO = employeeService.update(employeeUpdateCmd);
LogRecordContext.putVariable("employeeVO", employeeVO);
return SingleResponse.of(employeeVO);
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_EMPLOYEE_DELETE})
@DeleteMapping("destroyEmployee")
@Operation(summary = "员工信息删除", method = "DELETE")
@OperationLog(bizId = "#employeeVO.employeeId", bizType = "'destroyEmployee'", msg = "'删除员工:' + #employeeVO.name + '(工号:' + #employeeVO.number + ')'", operatorId = "T(cn.dev33.satoken.stp.StpUtil).getLoginIdAsLong()")
public Response destroyEmployee(@RequestBody @Validated EmployeeDestroyCmd employeeDestroyCmd) {
EmployeeShowQry employeeShowQry = new EmployeeShowQry();
employeeShowQry.setEmployeeId(employeeDestroyCmd.getEmployeeId());
EmployeeVO employeeVO = employeeService.show(employeeShowQry);
if (Objects.isNull(employeeVO)) {
return Response.buildFailure("400", "员工不存在");
}
LogRecordContext.putVariable("employeeVO", employeeVO);
employeeService.destroy(employeeDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,38 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.facade.api.DeepSeekServiceI;
import com.xunhong.erp.turbo.api.facade.dto.cmd.VehicleExtractionCmd;
import com.xunhong.erp.turbo.api.facade.dto.vo.VehicleExtractionVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 聊天
*/
@Slf4j
@Tag(name = "Extraction", description = "信息抽取")
@RestController("operationExtractionController")
@RequestMapping("/operation")
@RequiredArgsConstructor
public class ExtractionController {
@DubboReference(version = "1.0.0")
private final DeepSeekServiceI deepSeekService;
@SaCheckLogin
@PostMapping("/extraction/vehicle")
@Operation(summary = "智能提取物流信息", method = "POST")
public SingleResponse<VehicleExtractionVO> vehicleExtraction(@RequestBody @Validated VehicleExtractionCmd vehicleExtractionCmd) {
return SingleResponse.of(deepSeekService.vehicleExtraction(vehicleExtractionCmd));
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.GiftBoxServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.GiftBoxCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.GiftBoxDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.GiftBoxUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.GiftBoxListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.GiftBoxPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.GiftBoxShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.GiftBoxVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "GiftBox", description = "礼盒管理")
@RestController("operationGiftBoxController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class GiftBoxController {
@DubboReference(version = "1.0.0")
private final GiftBoxServiceI giftBoxService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_GIFT_BOX_VIEW})
@GetMapping("listGiftBox")
@Operation(summary = "礼盒列表", method = "GET")
public MultiResponse<GiftBoxVO> listGiftBox(@ModelAttribute @Validated GiftBoxListQry giftBoxListQry) {
return MultiResponse.of(giftBoxService.list(giftBoxListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_GIFT_BOX_CREATE})
@PostMapping("createGiftBox")
@Operation(summary = "创建礼盒", method = "POST")
public SingleResponse<GiftBoxVO> createGiftBox(@RequestBody @Validated GiftBoxCreateCmd giftBoxCreateCmd) {
return SingleResponse.of(giftBoxService.create(giftBoxCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_GIFT_BOX_VIEW})
@GetMapping("showGiftBox")
@Operation(summary = "礼盒详情", method = "GET")
public SingleResponse<GiftBoxVO> showGiftBox(@ModelAttribute @Validated GiftBoxShowQry giftBoxShowQry) {
return SingleResponse.of(giftBoxService.show(giftBoxShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_GIFT_BOX_VIEW})
@GetMapping("pageGiftBox")
@Operation(summary = "礼盒列表", method = "GET")
public PageResponse<GiftBoxVO> pageGiftBox(@ModelAttribute @Validated GiftBoxPageQry giftBoxPageQry) {
PageDTO<GiftBoxVO> page = giftBoxService.page(giftBoxPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_GIFT_BOX_UPDATE})
@RequestMapping(value = "updateGiftBox", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "礼盒更新", method = "PATCH")
public SingleResponse<GiftBoxVO> updateGiftBox(@RequestBody @Validated GiftBoxUpdateCmd giftBoxUpdateCmd) {
return SingleResponse.of(giftBoxService.update(giftBoxUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_GIFT_BOX_DELETE})
@DeleteMapping("destroyGiftBox")
@Operation(summary = "礼盒删除", method = "DELETE")
public Response destroyGiftBox(@RequestBody @Validated GiftBoxDestroyCmd giftBoxDestroyCmd) {
giftBoxService.destroy(giftBoxDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,99 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.CategoryServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.CategoryCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.CategoryDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.CategoryUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.enums.CategoryTypeEnum;
import com.xunhong.erp.turbo.api.infra.dto.qry.CategoryShowQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.CategoryTreeQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.CategoryVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@Tag(name = "MaterialCategory", description = "素材分类")
@RestController("operationMaterialCategoryController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class MaterialCategoryController {
@DubboReference(version = "1.0.0")
private final CategoryServiceI categoryService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_CATEGORY_VIEW}, mode = SaMode.OR)
@GetMapping("/treeMaterialCategory")
@Operation(summary = "素材分类树", method = "GET")
public MultiResponse<Tree<Long>> treeMaterialCategory(@ModelAttribute @Validated CategoryTreeQry categoryTreeQry) {
List<CategoryTypeEnum> typeList = new ArrayList<>();
typeList.add(CategoryTypeEnum.FILE_IMAGE);
typeList.add(CategoryTypeEnum.FILE_VIDEO);
categoryTreeQry.setTypeList(typeList);
List<CategoryVO> categoryVOList = categoryService.list(categoryTreeQry);
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
treeNodeConfig.setWeightKey("sort");
treeNodeConfig.setIdKey("categoryId");
treeNodeConfig.setParentIdKey("pid");
treeNodeConfig.setNameKey("name");
treeNodeConfig.setChildrenKey("children");
treeNodeConfig.setDeep(5);
List<Tree<Long>> trees = TreeUtil.build(categoryVOList, null, treeNodeConfig, (category, tree) -> {
tree.setId(category.getCategoryId());
tree.setParentId(category.getPid());
tree.setWeight(category.getSort());
tree.setName(category.getName());
tree.putExtra("type", category.getType());
});
return MultiResponse.of(trees);
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_CATEGORY_CREATE}, mode = SaMode.OR)
@PostMapping("createMaterialCategory")
@Operation(summary = "创建素材分类", method = "POST")
public SingleResponse<CategoryVO> createMaterialCategory(@RequestBody @Validated CategoryCreateCmd categoryCreateCmd) {
return SingleResponse.of(categoryService.create(categoryCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_CATEGORY_UPDATE}, mode = SaMode.OR)
@RequestMapping(value = "updateMaterialCategory", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "更新素材分类", method = "PATCH")
public SingleResponse<CategoryVO> updateMaterialCategory(@RequestBody @Validated CategoryUpdateCmd categoryUpdateCmd) {
return SingleResponse.of(categoryService.update(categoryUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_CATEGORY_VIEW}, mode = SaMode.OR)
@GetMapping("/showMaterialCategory")
@Operation(summary = "素材分类", method = "GET")
public SingleResponse<CategoryVO> showMaterialCategory(@ModelAttribute @Validated CategoryShowQry categoryShowQry) {
return SingleResponse.of(categoryService.show(categoryShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_CATEGORY_DELETE}, mode = SaMode.OR)
@DeleteMapping("/destroyMaterialCategory")
@Operation(summary = "删除素材分类", method = "DELETE")
public Response destroyMaterialCategory(@RequestBody @Validated CategoryDestroyCmd categoryDestroyCmd) {
categoryService.destroy(categoryDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,93 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.MaterialServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.MaterialBatchAddCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.MaterialCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.MaterialDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.MaterialUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.MaterialPageQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.MaterialShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.MaterialVO;
import com.xunhong.erp.turbo.api.user.dto.vo.OssTokenVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 素材库
*/
@Tag(name = "Material", description = "素材管理")
@RestController("operationMaterialController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class MaterialController {
@DubboReference(version = "1.0.0")
private final MaterialServiceI materialService;
@SaCheckLogin
@GetMapping(value = "/ossToken")
@Operation(summary = "获取OSS上传凭证", method = "GET")
public SingleResponse<OssTokenVO> ossToken() {
return SingleResponse.of(materialService.ossToken());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_VIEW}, mode = SaMode.OR)
@GetMapping("/pageMaterial")
@Operation(summary = "素材内容列表", method = "GET")
public PageResponse<MaterialVO> pageMaterial(@ModelAttribute @Validated MaterialPageQry materialPageQry) {
PageDTO<MaterialVO> page = materialService.page(materialPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_VIEW}, mode = SaMode.OR)
@PostMapping("/createMaterial")
@Operation(summary = "创建素材内容", method = "POST")
public SingleResponse<MaterialVO> createMaterial(@RequestBody @Validated MaterialCreateCmd materialCreateCmd) {
return SingleResponse.of(materialService.create(materialCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_CREATE}, mode = SaMode.OR)
@PostMapping("/batchCreateMaterial")
@Operation(summary = "创建素材内容", method = "POST")
public MultiResponse<MaterialVO> batchCreateMaterial(@RequestBody @Validated MaterialBatchAddCmd materialAddCmdList) {
return MultiResponse.of(materialService.batchCreate(materialAddCmdList));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_VIEW}, mode = SaMode.OR)
@GetMapping("showMaterial")
@Operation(summary = "素材内容详情", method = "GET")
public SingleResponse<MaterialVO> showMaterial(@ModelAttribute @Validated MaterialShowQry materialShowQry) {
return SingleResponse.of(materialService.show(materialShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_UPDATE}, mode = SaMode.OR)
@RequestMapping(value = "updateMaterial", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "素材内容更新", method = "PATCH")
public SingleResponse<MaterialVO> updateMaterial(@RequestBody @Validated MaterialUpdateCmd materialUpdateCmd) {
return SingleResponse.of(materialService.update(materialUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.OPERATION_MATERIAL_DELETE}, mode = SaMode.OR)
@DeleteMapping("destroyMaterial")
@Operation(summary = "删除素材内容", method = "DELETE")
public Response destroyMaterial(@RequestBody @Validated MaterialDestroyCmd materialDestroyCmd) {
materialService.destroy(materialDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,93 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.tree.Tree;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.rbac.api.MenuServiceI;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.MenuCreateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.MenuDestroyCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.MenuDragCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.MenuUpdateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.constants.PermissionConstant;
import com.xunhong.erp.turbo.api.rbac.dto.qry.MenuListQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.MenuShowQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.MenuTreeQry;
import com.xunhong.erp.turbo.api.rbac.dto.vo.MenuVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Menu", description = "应用菜单")
@RestController("operationMenuController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class MenuController {
@DubboReference(version = "1.0.0")
private final MenuServiceI menuService;
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_MENU_VIEW})
@GetMapping("/treeMenu")
@Operation(summary = "菜单列表", method = "GET")
public MultiResponse<Tree<Long>> treeMenu(@ModelAttribute @Validated MenuTreeQry menuTreeQry) {
return MultiResponse.of(menuService.tree(menuTreeQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_MENU_VIEW})
@GetMapping("/listMenu")
@Operation(summary = "菜单列表", method = "GET")
public MultiResponse<MenuVO> listMenu(@ModelAttribute @Validated MenuListQry menuListQry) {
return MultiResponse.of(menuService.list(menuListQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_MENU_CREATE})
@PostMapping("/createMenu")
@Operation(summary = "创建菜单", method = "POST")
public SingleResponse<MenuVO> createMenu(@RequestBody @Validated MenuCreateCmd menuCreateCmd) {
return SingleResponse.of(menuService.create(menuCreateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_MENU_VIEW})
@GetMapping("/showMenu")
@Operation(summary = "菜单详情", method = "GET")
public SingleResponse<MenuVO> showMenu(@ModelAttribute @Validated MenuShowQry menuShowQry) {
return SingleResponse.of(menuService.show(menuShowQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_MENU_UPDATE})
@RequestMapping(value = "/updateMenu", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "菜单更新", method = "PATCH")
public SingleResponse<MenuVO> updateMenu(@RequestBody @Validated MenuUpdateCmd menuUpdateCmd) {
return SingleResponse.of(menuService.update(menuUpdateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_MENU_DELETE})
@DeleteMapping("/destroyMenu")
@Operation(summary = "菜单更新", method = "DELETE")
public Response destroyMenu(@RequestBody @Validated MenuDestroyCmd menuDestroyCmd) {
menuService.destroy(menuDestroyCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@PostMapping("dragMenu")
@Operation(summary = "菜单拖拽", method = "POST")
public Response dragMenu(@RequestBody @Validated MenuDragCmd menuDragCmd) {
menuService.drag(menuDragCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,61 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.facade.api.WxMaServiceI;
import com.xunhong.erp.turbo.api.facade.dto.vo.WxMaOcrBankCardVO;
import com.xunhong.erp.turbo.api.facade.dto.vo.WxMaOcrIdCardVO;
import com.xunhong.erp.turbo.file.FileService;
import com.xunhong.erp.turbo.file.config.OssProperties;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* @author shenyifei
*/
@Tag(name = "Ocr", description = "OCR识别")
@RestController("operationOcrController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class OcrController {
private final OssProperties properties;
@DubboReference(version = "1.0.0")
private final WxMaServiceI wxMaService;
private final FileService fileService;
@SaCheckLogin
@PostMapping(value = "ocrIdCard", consumes = "multipart/form-data")
@Operation(summary = "OCR识别身份证", method = "POST", hidden = true)
public SingleResponse<WxMaOcrIdCardVO> ocrIdCard(@RequestParam @Schema(title = "图片文件", requiredMode = Schema.RequiredMode.REQUIRED, type = "file") MultipartFile file) throws IOException {
String objectName = "uploads/" + LocalDateTimeUtil.format(LocalDateTimeUtil.now(), "yyMM/dd") + "/" + file.getOriginalFilename();
fileService.upload(objectName, file.getInputStream());
String ocrUrl = properties.getDomain() + objectName;
return SingleResponse.of(wxMaService.ocrIdCard(ocrUrl));
}
@SaCheckLogin
@PostMapping(value = "ocrBankCard", consumes = "multipart/form-data")
@Operation(summary = "OCR识别银行卡", method = "POST", hidden = true)
public SingleResponse<WxMaOcrBankCardVO> ocrBankCard(@RequestParam @Schema(title = "图片文件", requiredMode = Schema.RequiredMode.REQUIRED, type = "file") MultipartFile file) throws IOException {
String objectName = "uploads/" + LocalDateTimeUtil.format(LocalDateTimeUtil.now(), "yyMM/dd") + "/" + file.getOriginalFilename();
fileService.upload(objectName, file.getInputStream());
String ocrUrl = properties.getDomain() + objectName;
return SingleResponse.of(wxMaService.ocrBankCard(ocrUrl));
}
}

View File

@ -0,0 +1,84 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.rbac.api.PermissionServiceI;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.PermissionCreateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.PermissionDestroyCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.PermissionUpdateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.constants.PermissionConstant;
import com.xunhong.erp.turbo.api.rbac.dto.qry.PermissionListQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.PermissionPageQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.PermissionShowQry;
import com.xunhong.erp.turbo.api.rbac.dto.vo.PermissionVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Tag(name = "Permission", description = "权限管理")
@RestController("operationPermissionController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class PermissionController {
@DubboReference(version = "1.0.0")
private final PermissionServiceI permissionService;
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PERMISSION_VIEW})
@GetMapping("/listPermission")
@Operation(summary = "权限列表", method = "GET")
public MultiResponse<PermissionVO> listPermission(@ModelAttribute @Validated PermissionListQry permissionListQry) {
return MultiResponse.of(permissionService.list(permissionListQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PERMISSION_VIEW})
@GetMapping("/pagePermission")
@Operation(summary = "权限分页", method = "GET")
public PageResponse<PermissionVO> pagePermission(@ModelAttribute @Validated PermissionPageQry permissionPageQry) {
PageDTO<PermissionVO> page = permissionService.page(permissionPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PERMISSION_CREATE})
@PostMapping("/createPermission")
@Operation(summary = "创建权限", method = "POST")
public SingleResponse<PermissionVO> createPermission(@RequestBody @Validated PermissionCreateCmd permissionCreateCmd) {
return SingleResponse.of(permissionService.create(permissionCreateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PERMISSION_VIEW})
@GetMapping("/showPermission")
@Operation(summary = "查看权限", method = "GET")
public SingleResponse<PermissionVO> showPermission(@ModelAttribute @Validated PermissionShowQry permissionShowQry) {
return SingleResponse.of(permissionService.show(permissionShowQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PERMISSION_UPDATE})
@PostMapping("updatePermission")
@Operation(summary = "更新权限", method = "POST")
public SingleResponse<PermissionVO> updatePermission(@RequestBody @Validated PermissionUpdateCmd permissionUpdateCmd) {
return SingleResponse.of(permissionService.update(permissionUpdateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PERMISSION_DELETE})
@PostMapping("destroyPermission")
@Operation(summary = "删除权限", method = "POST")
public Response destroyPermission(@RequestBody @Validated PermissionDestroyCmd permissionDestroyCmd) {
permissionService.destroy(permissionDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,86 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.PlatformServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.PlatformCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.PlatformDestroyCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.PlatformUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformListQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformPageQry;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.PlatformVO;
import com.xunhong.erp.turbo.api.rbac.dto.constants.PermissionConstant;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Platform", description = "平台管理")
@RestController("operationPlatformController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class PlatformController {
@DubboReference(version = "1.0.0")
private final PlatformServiceI platformService;
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PLATFORM_VIEW})
@GetMapping("/listPlatform")
@Operation(summary = "平台列表", method = "GET")
public MultiResponse<PlatformVO> listPlatform(@ModelAttribute @Validated PlatformListQry platformListQry) {
return MultiResponse.of(platformService.list(platformListQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PLATFORM_CREATE})
@PostMapping("/createPlatform")
@Operation(summary = "创建平台", method = "POST")
public SingleResponse<PlatformVO> createPlatform(@RequestBody @Validated PlatformCreateCmd platformCreateCmd) {
return SingleResponse.of(platformService.create(platformCreateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PLATFORM_VIEW})
@GetMapping("/showPlatform")
@Operation(summary = "平台详情", method = "GET")
public SingleResponse<PlatformVO> showPlatform(@ModelAttribute @Validated PlatformShowQry platformShowQry) {
return SingleResponse.of(platformService.show(platformShowQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PLATFORM_VIEW})
@GetMapping("/pagePlatform")
@Operation(summary = "平台列表", method = "GET")
public PageResponse<PlatformVO> pagePlatform(@ModelAttribute @Validated PlatformPageQry platformPageQry) {
PageDTO<PlatformVO> page = platformService.page(platformPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PLATFORM_UPDATE})
@RequestMapping(value = "/updatePlatform", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "平台更新", method = "PATCH")
public SingleResponse<PlatformVO> updatePlatform(@RequestBody @Validated PlatformUpdateCmd platformUpdateCmd) {
return SingleResponse.of(platformService.update(platformUpdateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_PLATFORM_DELETE})
@DeleteMapping("/destroyPlatform")
@Operation(summary = "平台删除", method = "DELETE")
public Response destroyPlatform(@RequestBody @Validated PlatformDestroyCmd platformDestroyCmd) {
platformService.destroy(platformDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,163 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.PurchaseOrderServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.*;
import com.xunhong.erp.turbo.api.biz.dto.qry.PurchaseOrderCountQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.PurchaseOrderListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.PurchaseOrderPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.PurchaseOrderShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.PurchaseOrderVO;
import com.xunhong.erp.turbo.api.rbac.dto.constants.RoleConstant;
import com.xunhong.erp.turbo.api.user.api.AdminServiceI;
import com.xunhong.erp.turbo.api.user.dto.qry.AdminShowQry;
import com.xunhong.erp.turbo.api.user.dto.vo.AdminVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.base.dto.UserSession;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "PurchaseOrder", description = "采购订单管理")
@RestController("operationPurchaseOrderController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class PurchaseOrderController {
@DubboReference(version = "1.0.0")
private final PurchaseOrderServiceI purchaseOrderService;
@DubboReference(version = "1.0.0")
private final AdminServiceI adminService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_PURCHASE_ORDER_VIEW})
@GetMapping("listPurchaseOrder")
@Operation(summary = "采购订单列表", method = "GET")
public MultiResponse<PurchaseOrderVO> listPurchaseOrder(@ModelAttribute @Validated PurchaseOrderListQry purchaseOrderListQry) {
return MultiResponse.of(purchaseOrderService.list(purchaseOrderListQry));
}
// 获取某个状态的数量
@SaCheckLogin
@GetMapping("countPurchaseOrderByState")
@Operation(summary = "获取某个状态的数量", method = "GET")
public SingleResponse<Long> countPurchaseOrderByState(@ModelAttribute @Validated PurchaseOrderCountQry purchaseOrderCountQry) {
return SingleResponse.of(purchaseOrderService.countPurchaseOrderByState(purchaseOrderCountQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_PURCHASE_ORDER_CREATE})
@PostMapping("createPurchaseOrder")
@Operation(summary = "创建采购订单(暂存)", method = "POST")
public SingleResponse<PurchaseOrderVO> createPurchaseOrder(@RequestBody @Validated PurchaseOrderCreateCmd purchaseOrderCreateCmd) {
return SingleResponse.of(purchaseOrderService.create(purchaseOrderCreateCmd));
}
@SaCheckLogin
@PostMapping("submitReviewPurchaseOrder")
@Operation(summary = "采购订单提审(录入员提审)", method = "POST")
public Response submitReviewPurchaseOrder(@RequestBody @Validated PurchaseOrderSubmitReviewCmd purchaseOrderSubmitReviewCmd) {
purchaseOrderService.submitReview(purchaseOrderSubmitReviewCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@PostMapping("withdrawReviewPurchaseOrder")
@Operation(summary = "采购订单撤回提审(录入员撤回提审)", method = "POST")
public Response withdrawReviewPurchaseOrder(@RequestBody @Validated PurchaseOrderWithdrawReviewCmd purchaseOrderWithdrawReviewCmd) {
purchaseOrderService.withdrawReview(purchaseOrderWithdrawReviewCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@PostMapping("approvePurchaseOrder")
@Operation(summary = "采购订单审核(审核员审核)", method = "POST")
public Response approvePurchaseOrder(@RequestBody @Validated PurchaseOrderApproveCmd purchaseOrderApproveCmd) {
purchaseOrderService.approve(purchaseOrderApproveCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@PostMapping("rejectApprovePurchaseOrder")
@Operation(summary = "采购订单驳回审核(审核员驳回审核)", method = "POST")
public Response rejectApprovePurchaseOrder(@RequestBody @Validated PurchaseOrderRejectApproveCmd purchaseOrderRejectApproveCmd) {
purchaseOrderService.rejectApprove(purchaseOrderRejectApproveCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@PostMapping("finalApprovePurchaseOrder")
@Operation(summary = "采购订单审批(老板审批)", method = "POST")
public Response finalApprovePurchaseOrder(@RequestBody @Validated PurchaseOrderFinalApproveCmd purchaseOrderFinalApproveCmd) {
purchaseOrderService.finalApprove(purchaseOrderFinalApproveCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@PostMapping("rejectFinalPurchaseOrder")
@Operation(summary = "采购订单驳回审批(老板驳回审批)", method = "POST")
public Response rejectFinalPurchaseOrder(@RequestBody @Validated PurchaseOrderRejectFinalCmd purchaseOrderRejectFinalCmd) {
purchaseOrderService.rejectFinal(purchaseOrderRejectFinalCmd);
return Response.buildSuccess();
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_PURCHASE_ORDER_VIEW})
@GetMapping("showPurchaseOrder")
@Operation(summary = "采购订单详情", method = "GET")
public SingleResponse<PurchaseOrderVO> showPurchaseOrder(@ModelAttribute @Validated PurchaseOrderShowQry purchaseOrderShowQry) {
return SingleResponse.of(purchaseOrderService.show(purchaseOrderShowQry));
}
@SaCheckLogin
@SaCheckRole(value = {RoleConstant.ORIGIN_ENTRY, RoleConstant.MARKET_BUYER, RoleConstant.BOSS, RoleConstant.REVIEWER, RoleConstant.SUPERADMIN}, mode = SaMode.OR)
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_PURCHASE_ORDER_VIEW})
@GetMapping("pagePurchaseOrder")
@Operation(summary = "采购订单列表", method = "GET")
public PageResponse<PurchaseOrderVO> pagePurchaseOrder(@ModelAttribute @Validated PurchaseOrderPageQry purchaseOrderPageQry) {
String roleSlug = UserSession.USER_THREAD_LOCAL.get().getRoleSlug();
if (roleSlug.equals(RoleConstant.ORIGIN_ENTRY) || roleSlug.equals(RoleConstant.MARKET_BUYER)) {
Long userId = UserSession.USER_THREAD_LOCAL.get().getUserId();
AdminShowQry adminShowQry = new AdminShowQry();
adminShowQry.setUserId(userId);
AdminVO adminVO = adminService.show(adminShowQry);
purchaseOrderPageQry.setCreatedBy(adminVO.getAdminId());
}
PageDTO<PurchaseOrderVO> page = purchaseOrderService.page(purchaseOrderPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_PURCHASE_ORDER_UPDATE})
@RequestMapping(value = "updatePurchaseOrder", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "采购订单更新", method = "PATCH")
public SingleResponse<PurchaseOrderVO> updatePurchaseOrder(@RequestBody @Validated PurchaseOrderUpdateCmd purchaseOrderUpdateCmd) {
return SingleResponse.of(purchaseOrderService.update(purchaseOrderUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_PURCHASE_ORDER_DELETE})
@DeleteMapping("destroyPurchaseOrder")
@Operation(summary = "采购订单删除", method = "DELETE")
public Response destroyPurchaseOrder(@RequestBody @Validated PurchaseOrderDestroyCmd purchaseOrderDestroyCmd) {
purchaseOrderService.destroy(purchaseOrderDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,86 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.rbac.api.RoleServiceI;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.RoleCreateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.RoleDestroyCmd;
import com.xunhong.erp.turbo.api.rbac.dto.cmd.RoleUpdateCmd;
import com.xunhong.erp.turbo.api.rbac.dto.constants.PermissionConstant;
import com.xunhong.erp.turbo.api.rbac.dto.qry.RoleListQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.RolePageQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.RoleShowQry;
import com.xunhong.erp.turbo.api.rbac.dto.vo.RoleVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Tag(name = "Role", description = "应用角色管理")
@RestController("operationRoleController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class RoleController {
@DubboReference(version = "1.0.0")
private final RoleServiceI roleService;
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_ROLE_VIEW})
@GetMapping("/listRole")
@Operation(summary = "应用角色列表", method = "GET")
public MultiResponse<RoleVO> listRole(@ModelAttribute @Validated RoleListQry roleListQry) {
return MultiResponse.of(roleService.listRole(roleListQry));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_ROLE_VIEW})
@GetMapping("/pageRole")
@Operation(summary = "应用角色分页", method = "GET")
public PageResponse<RoleVO> pageRole(@ModelAttribute @Validated RolePageQry rolePageQry) {
PageDTO<RoleVO> page = roleService.pageRole(rolePageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_ROLE_CREATE})
@PostMapping("/createRole")
@Operation(summary = "创建应用角色", method = "POST")
public SingleResponse<RoleVO> createRole(@RequestBody @Validated RoleCreateCmd roleCreateCmd) {
return SingleResponse.of(roleService.createRole(roleCreateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_ROLE_VIEW})
@GetMapping("showRole")
@Operation(summary = "查看应用角色", method = "GET")
public SingleResponse<RoleVO> showRole(@ModelAttribute @Validated RoleShowQry roleShowQry) {
RoleVO roleVO = roleService.showRole(roleShowQry);
return SingleResponse.of(roleVO);
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_ROLE_UPDATE})
@PostMapping("updateRole")
@Operation(summary = "更新应用应用角色", method = "POST")
public SingleResponse<RoleVO> updateRole(@RequestBody @Validated RoleUpdateCmd roleUpdateCmd) {
return SingleResponse.of(roleService.updateRole(roleUpdateCmd));
}
@SaCheckLogin
@SaCheckPermission(value = {PermissionConstant.OPERATION_ROLE_DELETE})
@PostMapping("destroyRole")
@Operation(summary = "删除应用角色", method = "POST")
public Response destroyRole(@RequestBody @Validated RoleDestroyCmd roleDestroyCmd) {
roleService.destroyRole(roleDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,43 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.SettingServiceI;
import com.xunhong.erp.turbo.api.infra.dto.cmd.SettingUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.qry.SettingShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.SettingVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Setting", description = "系统设置管理")
@RestController("operationSettingController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class SettingController {
@DubboReference(version = "1.0.0")
private final SettingServiceI settingService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_STORE_SETTING_VIEW})
@GetMapping("showSetting")
@Operation(summary = "系统设置详情", method = "GET")
public SingleResponse<SettingVO> showSetting(@ModelAttribute @Validated SettingShowQry settingShowQry) {
return SingleResponse.of(settingService.show(settingShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_STORE_SETTING_UPDATE})
@RequestMapping(value = "updateSetting", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "系统设置更新", method = "PATCH")
public SingleResponse<SettingVO> updateSetting(@RequestBody @Validated SettingUpdateCmd settingUpdateCmd) {
return SingleResponse.of(settingService.update(settingUpdateCmd));
}
}

View File

@ -0,0 +1,95 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.ShipOrderServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderGenerateDocumentCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.ShipOrderUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.ShipOrderListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.ShipOrderPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.ShipOrderShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.ShipOrderVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "ShipOrder", description = "发货单管理")
@RestController("operationShipOrderController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class ShipOrderController {
@DubboReference(version = "1.0.0")
private final ShipOrderServiceI shipOrderService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SHIP_ORDER_VIEW})
@GetMapping("listShipOrder")
@Operation(summary = "发货单列表", method = "GET")
public MultiResponse<ShipOrderVO> listShipOrder(@ModelAttribute @Validated ShipOrderListQry shipOrderListQry) {
return MultiResponse.of(shipOrderService.list(shipOrderListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SHIP_ORDER_CREATE})
@PostMapping("createShipOrder")
@Operation(summary = "创建发货单", method = "POST")
public SingleResponse<ShipOrderVO> createShipOrder(@RequestBody @Validated ShipOrderCreateCmd shipOrderCreateCmd) {
return SingleResponse.of(shipOrderService.create(shipOrderCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SHIP_ORDER_VIEW})
@GetMapping("showShipOrder")
@Operation(summary = "发货单详情", method = "GET")
public SingleResponse<ShipOrderVO> showShipOrder(@ModelAttribute @Validated ShipOrderShowQry shipOrderShowQry) {
return SingleResponse.of(shipOrderService.show(shipOrderShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SHIP_ORDER_VIEW})
@GetMapping("pageShipOrder")
@Operation(summary = "发货单列表", method = "GET")
public PageResponse<ShipOrderVO> pageShipOrder(@ModelAttribute @Validated ShipOrderPageQry shipOrderPageQry) {
PageDTO<ShipOrderVO> page = shipOrderService.page(shipOrderPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SHIP_ORDER_UPDATE})
@RequestMapping(value = "updateShipOrder", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "发货单更新", method = "PATCH")
public SingleResponse<ShipOrderVO> updateShipOrder(@RequestBody @Validated ShipOrderUpdateCmd shipOrderUpdateCmd) {
return SingleResponse.of(shipOrderService.update(shipOrderUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SHIP_ORDER_UPDATE})
@RequestMapping(value = "generateDocumentShipOrder", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "发货单生成单据", method = "PATCH")
public Response generateDocumentShipOrder(@RequestBody @Validated ShipOrderGenerateDocumentCmd shipOrderGenerateDocumentCmd) {
shipOrderService.generateDocument(shipOrderGenerateDocumentCmd);
return Response.buildSuccess();
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SHIP_ORDER_DELETE})
@DeleteMapping("destroyShipOrder")
@Operation(summary = "发货单删除", method = "DELETE")
public Response destroyShipOrder(@RequestBody @Validated ShipOrderDestroyCmd shipOrderDestroyCmd) {
shipOrderService.destroy(shipOrderDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,85 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.biz.api.SupplierServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.SupplierCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.SupplierDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.SupplierUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.SupplierListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.SupplierPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.SupplierShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.SupplierVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "Supplier", description = "供应商管理")
@RestController("operationSupplierController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class SupplierController {
@DubboReference(version = "1.0.0")
private final SupplierServiceI supplierService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SUPPLIER_VIEW})
@GetMapping("listSupplier")
@Operation(summary = "供应商列表", method = "GET")
public MultiResponse<SupplierVO> listSupplier(@ModelAttribute @Validated SupplierListQry supplierListQry) {
return MultiResponse.of(supplierService.list(supplierListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SUPPLIER_CREATE})
@PostMapping("createSupplier")
@Operation(summary = "创建供应商", method = "POST")
public SingleResponse<SupplierVO> createSupplier(@RequestBody @Validated SupplierCreateCmd supplierCreateCmd) {
return SingleResponse.of(supplierService.create(supplierCreateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SUPPLIER_VIEW})
@GetMapping("showSupplier")
@Operation(summary = "供应商详情", method = "GET")
public SingleResponse<SupplierVO> showSupplier(@ModelAttribute @Validated SupplierShowQry supplierShowQry) {
return SingleResponse.of(supplierService.show(supplierShowQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SUPPLIER_VIEW})
@GetMapping("pageSupplier")
@Operation(summary = "供应商列表", method = "GET")
public PageResponse<SupplierVO> pageSupplier(@ModelAttribute @Validated SupplierPageQry supplierPageQry) {
PageDTO<SupplierVO> page = supplierService.page(supplierPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SUPPLIER_UPDATE})
@RequestMapping(value = "updateSupplier", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "供应商更新", method = "PATCH")
public SingleResponse<SupplierVO> updateSupplier(@RequestBody @Validated SupplierUpdateCmd supplierUpdateCmd) {
return SingleResponse.of(supplierService.update(supplierUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.MDB_BUSINESS_SUPPLIER_DELETE})
@DeleteMapping("destroySupplier")
@Operation(summary = "供应商删除", method = "DELETE")
public Response destroySupplier(@RequestBody @Validated SupplierDestroyCmd supplierDestroyCmd) {
supplierService.destroy(supplierDestroyCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,108 @@
package com.xunhong.erp.turbo.admin.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckSafe;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.user.api.UserServiceI;
import com.xunhong.erp.turbo.api.user.dto.cmd.*;
import com.xunhong.erp.turbo.api.user.dto.qry.UserListQry;
import com.xunhong.erp.turbo.api.user.dto.qry.UserPageQry;
import com.xunhong.erp.turbo.api.user.dto.qry.UserShowQry;
import com.xunhong.erp.turbo.api.user.dto.vo.UserVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author shenyifei
*/
@Tag(name = "User", description = "用户管理")
@RestController("operationUserController")
@RequestMapping(value = "/operation")
@RequiredArgsConstructor
public class UserController {
@DubboReference(version = "1.0.0")
private final UserServiceI userService;
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_VIEW})
@GetMapping("pageUser")
@Operation(summary = "用户列表", method = "GET")
public PageResponse<UserVO> pageUser(@ModelAttribute @Validated UserPageQry userPageQry) {
userPageQry.setIsAdmin(Boolean.FALSE);
PageDTO<UserVO> page = userService.page(userPageQry);
return PageResponse.of(page.getRecords(), (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_VIEW})
@GetMapping("listUser")
@Operation(summary = "用户列表", method = "GET")
public MultiResponse<UserVO> listUser(@ModelAttribute @Validated UserListQry userListQry) {
return MultiResponse.of(userService.list(userListQry));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_VIEW})
@GetMapping("/showUser")
@Operation(summary = "获取用户", method = "GET")
public SingleResponse<UserVO> showUser(@ModelAttribute @Validated UserShowQry userShowQry) {
UserVO userVO = userService.show(userShowQry);
return SingleResponse.of(userVO);
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_UPDATE})
@RequestMapping(value = "/updateUser", method = {RequestMethod.PATCH, RequestMethod.PUT})
@Operation(summary = "更新用户", method = "PATCH")
public SingleResponse<UserVO> updateUser(@Validated @RequestBody UserUpdateCmd userUpdateCmd) {
return SingleResponse.of(userService.update(userUpdateCmd));
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_CREATE})
@PostMapping("/createUser")
@Operation(summary = "创建会员", method = "POST")
public SingleResponse<UserVO> createUser(@Validated @RequestBody UserCreateCmd userCreateCmd) {
return SingleResponse.of(userService.create(userCreateCmd));
}
@SaCheckLogin
@SaCheckSafe
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_DELETE})
@DeleteMapping("/destroyUser")
@Operation(summary = "删除用户", method = "DELETE")
public Response destroyUser(@Validated @RequestBody UserDestroyCmd userDestroyCmd) {
userService.destroy(userDestroyCmd);
return Response.buildSuccess();
}
/**
* 禁用
*/
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_DISABLE})
@PostMapping("/disableUser")
@Operation(summary = "禁用用户", method = "POST")
public Response disableUser(@RequestBody @Validated UserDisableCmd userDisableCmd) {
userService.disable(userDisableCmd);
return Response.buildSuccess();
}
@SaCheckLogin
// @SaCheckPermission(value = {PermissionConstant.KHB_BUSINESS_MEMBER_ENABLE})
@PostMapping("/enableUser")
@Operation(summary = "启用用户", method = "POST")
public Response enableUser(@RequestBody @Validated UserEnableCmd userEnableCmd) {
userService.enable(userEnableCmd);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,17 @@
spring:
application:
name: @application.name@
profiles:
active: dev
config:
import: classpath:cache.yml,classpath:rpc.yml,classpath:sa-token.yml
oss:
endpoint: https://oss-cn-beijing.aliyuncs.com
access-secret: nQjR51pOeVggk1AgSyroj2svegAH2q
access-key: LTAI5tRk9oGxq7KYb5VtJbUm
bucket: qilincloud168
enabled: true
server:
port: 8083

View File

@ -0,0 +1,7 @@
spring:
application:
name: @application.name@
profiles:
active: dev
config:
import: classpath:base.yml,classpath:logging.yml,classpath:config.yml

View File

@ -0,0 +1,22 @@
msg.200=Success
msg.500=Internal Server Error.
msg.1001=No data
msg.1002=Data saving failed
msg.100000=platform and client do not match.
msg.100001=the current account has been registered in the platform client, please do not register again.
msg.100002=
msg.50001=Obtaining the verification code succeeded
msg.50002=The verification code has expired
msg.50003=The account corresponding to the verification code does not match
msg.50004=Verification code error
validation.account=account number
validation.wechatCode=wechat code
validation.smsCode=message authentication code
validation.mobile=mobile
validation.platform=platform
validation.password=password
validation.min=length must be greater than {min} bits
validation.max=length must be less than {max} bits
validation.size=length must be between {min} ~ {max} bits
validation.regexp=format error
validation.notBlank=must not be empty

View File

@ -0,0 +1,22 @@
msg.200=Success
msg.500=Internal Server Error.
msg.1001=No data
msg.1002=Data saving failed
msg.100000=platform and client do not match.
msg.100001=the current account has been registered in the platform client, please do not register again.
msg.100002=
msg.50001=Obtaining the verification code succeeded
msg.50002=The verification code has expired
msg.50003=The account corresponding to the verification code does not match
msg.50004=Verification code error
validation.account=account number
validation.wechatCode=wechat code
validation.smsCode=message authentication code
validation.mobile=mobile
validation.platform=platform
validation.password=password
validation.min=length must be greater than {min} bits
validation.max=length must be less than {max} bits
validation.size=length must be between {min} ~ {max} bits
validation.regexp=format error
validation.notBlank=must not be empty

View File

@ -0,0 +1,21 @@
msg.200=\u64CD\u4F5C\u6210\u529F
msg.500=\u7CFB\u7EDF\u5F02\u5E38
msg.1001=\u6570\u636E\u4E3A\u7A7A
msg.1002=\u6570\u636E\u4FDD\u5B58\u5931\u8D25
msg.100000=\u5e73\u53f0\u548c\u5ba2\u6237\u7aef\u4e0d\u5339\u914d。
msg.100001=\u5f53\u524d\u8d26\u53f7\u5df2\u7ecf\u5728\u5e73\u53f0\u5ba2\u6237\u7aef\u6ce8\u518c\u8bf7\u52ff\u91cd\u590d\u6ce8\u518c。
msg.50001={0}\u83b7\u53d6\u6210\u529f
msg.50002={0}\u5df2\u8fc7\u671f
msg.50003={0}\u5bf9\u5e94\u7684\u8d26\u53f7\u4e0d\u5339\u914d
msg.50004={0}\u9519\u8bef
validation.account=\u8d26\u53f7
validation.wechatCode=\u5fae\u4fe1 code
validation.smsCode=\u77ed\u4fe1\u9a8c\u8bc1\u7801
validation.mobile=\u624b\u673a\u53f7\u7801
validation.platform=\u5e73\u53f0
validation.password=\u5bc6\u7801
validation.min=\u957f\u5ea6\u5fc5\u987b\u5927\u4e8e {min} \u4f4d
validation.max=\u957f\u5ea6\u5fc5\u987b\u5c0f\u4e8e {max} \u4f4d
validation.size=\u957f\u5ea6\u5fc5\u987b\u4ecb\u4e8e {min} ~ {max} \u4f4d
validation.regexp=\u683c\u5f0f\u9519\u8bef
validation.notBlank=\u5fc5\u987b\u4e0d\u80fd\u4e3a\u7a7a

143
erp-turbo-auth/pom.xml Normal file
View File

@ -0,0 +1,143 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xunhong</groupId>
<artifactId>ERPTurbo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>erp-turbo-auth</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<application.name>erp-turbo-auth</application.name>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-base</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-config</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-file</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-api</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-rpc</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-web</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-sa-token</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-apm</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-logback</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-limiter</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-captcha</artifactId>
</dependency>
<!-- TEST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- h2内存数据库-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-mate-annotation</artifactId>
<version>1.3.4</version>
</dependency>
</dependencies>
<build>
<finalName>${application.name}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<mainClass>
com.xunhong.erp.turbo.auth.ErpTurboAuthApplication
</mainClass>
<layers>
<enabled>true</enabled>
<configuration>
../layers/layers.xml
</configuration>
</layers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.auth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Spring Boot Starter
*
* @author shenyifei
*/
@SpringBootApplication(scanBasePackages = {"com.xunhong.erp.turbo", "com.alibaba.cola"})
public class ErpTurboAuthApplication {
public static void main(String[] args) {
SpringApplication.run(ErpTurboAuthApplication.class, args);
}
}

View File

@ -0,0 +1,57 @@
package com.xunhong.erp.turbo.auth.controller;
import com.anji.captcha.model.common.ResponseModel;
import com.anji.captcha.model.vo.CaptchaVO;
import com.anji.captcha.service.CaptchaService;
import com.anji.captcha.util.StringUtils;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "Captcha", description = "验证码管理")
@RestController("authCaptchaController")
@RequestMapping("/auth")
@RequiredArgsConstructor
public class CaptchaController {
private final CaptchaService captchaService;
public static String getRemoteId(HttpServletRequest request) {
String xfwd = request.getHeader("X-Forwarded-For");
String ip = getRemoteIpFromXfwd(xfwd);
String ua = request.getHeader("user-agent");
if (StringUtils.isNotBlank(ip)) {
return ip + ua;
}
return request.getRemoteAddr() + ua;
}
private static String getRemoteIpFromXfwd(String xfwd) {
if (StringUtils.isNotBlank(xfwd)) {
String[] ipList = xfwd.split(",");
return StringUtils.trim(ipList[0]);
}
return null;
}
@PostMapping("/captcha/get")
public ResponseModel get(@RequestBody CaptchaVO data, HttpServletRequest request) {
assert request.getRemoteHost() != null;
data.setBrowserInfo(getRemoteId(request));
return captchaService.get(data);
}
@PostMapping("/captcha/check")
public ResponseModel check(@RequestBody CaptchaVO data, HttpServletRequest request) {
data.setBrowserInfo(getRemoteId(request));
return captchaService.check(data);
}
@PostMapping("/captcha/verify")
public ResponseModel verify(@RequestBody CaptchaVO data, HttpServletRequest request) {
return captchaService.verification(data);
}
}

View File

@ -0,0 +1,32 @@
package com.xunhong.erp.turbo.auth.controller;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.infra.api.ChannelServiceI;
import com.xunhong.erp.turbo.api.infra.dto.qry.ChannelShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.ChannelVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "Channel", description = "渠道管理")
@RestController("authChannelController")
@RequestMapping("/auth")
@RequiredArgsConstructor
public class ChannelController {
@DubboReference(version = "1.0.0")
private final ChannelServiceI channelService;
@GetMapping("/selectChannelByDomain")
@Operation(summary = "根据域名获取渠道", method = "GET")
public SingleResponse<ChannelVO> selectChannelByDomain(@RequestParam(value = "domain") String domain) {
ChannelShowQry channelShowQry = new ChannelShowQry();
channelShowQry.setDomain(domain);
return SingleResponse.of(channelService.show(channelShowQry));
}
}

View File

@ -0,0 +1,301 @@
package com.xunhong.erp.turbo.auth.controller;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.config.SaCookieConfig;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaCookie;
import cn.dev33.satoken.sso.processor.SaSsoServerProcessor;
import cn.dev33.satoken.sso.template.SaSsoUtil;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaFoxUtil;
import cn.dev33.satoken.util.SaResult;
import cn.hutool.core.util.StrUtil;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.anji.captcha.model.common.ResponseModel;
import com.anji.captcha.model.vo.CaptchaVO;
import com.anji.captcha.service.CaptchaService;
import com.xunhong.erp.turbo.api.facade.api.WxMaServiceI;
import com.xunhong.erp.turbo.api.facade.dto.qry.WxMaOpenidQry;
import com.xunhong.erp.turbo.api.facade.dto.vo.WxMaOpenidVO;
import com.xunhong.erp.turbo.api.infra.api.PlatformServiceI;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformListQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.PlatformVO;
import com.xunhong.erp.turbo.api.rbac.api.UserPermissionServiceI;
import com.xunhong.erp.turbo.api.rbac.api.UserRoleServiceI;
import com.xunhong.erp.turbo.api.rbac.dto.qry.UserPermissionQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.UserRoleListQry;
import com.xunhong.erp.turbo.api.rbac.dto.vo.PermissionVO;
import com.xunhong.erp.turbo.api.rbac.dto.vo.UserRoleVO;
import com.xunhong.erp.turbo.api.user.api.AdminServiceI;
import com.xunhong.erp.turbo.api.user.api.UserAuthServiceI;
import com.xunhong.erp.turbo.api.user.dto.cmd.OpenSafeCmd;
import com.xunhong.erp.turbo.api.user.dto.cmd.UpdatePasswordCmd;
import com.xunhong.erp.turbo.api.user.dto.qry.AdminShowQry;
import com.xunhong.erp.turbo.api.user.dto.qry.PasswordLoginQry;
import com.xunhong.erp.turbo.api.user.dto.vo.AdminVO;
import com.xunhong.erp.turbo.api.user.dto.vo.UserAuthVO;
import com.xunhong.erp.turbo.auth.exception.UserAuthErrorCode;
import com.xunhong.erp.turbo.base.exception.BizException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author shenyifei
*/
@Tag(name = "UserAuth", description = "认证管理")
@RestController("authUserAuthController")
@RequestMapping("/auth")
@RequiredArgsConstructor
public class UserAuthController {
@DubboReference(version = "1.0.0")
private final UserAuthServiceI userAuthService;
@DubboReference(version = "1.0.0")
private final PlatformServiceI platformService;
@DubboReference(version = "1.0.0")
private final UserPermissionServiceI userPermissionService;
@DubboReference(version = "1.0.0")
private final UserRoleServiceI userRoleService;
@DubboReference(version = "1.0.0")
private final WxMaServiceI wxMaService;
private final CaptchaService captchaService;
@DubboReference(version = "1.0.0")
private final AdminServiceI adminService;
private static PlatformVO getPlatformVO(String redirect, List<PlatformVO> platformVOList) {
if (StrUtil.isBlankIfStr(redirect)) {
return platformVOList.getFirst();
}
// 已登录情况下构建 redirectUrl
redirect = SaFoxUtil.decoderUrl(redirect);
PlatformVO platformVO;
// 编译正则表达式以匹配URL中的域名部分
Pattern pattern = Pattern.compile("(https?://[^/]+)");
Matcher matcher = pattern.matcher(redirect);
// 如果找到了匹配的域名部分
if (matcher.find()) {
String domain = matcher.group(1);
platformVO = platformVOList.stream()
.filter(merchantAppVO1 -> merchantAppVO1.getHomePage().contains(domain))
.findFirst()
.orElse(platformVOList.getFirst());
} else {
platformVO = platformVOList.getFirst();
}
return platformVO;
}
private static void addCookie(String name, String value, int timeout) {
// 获取cookie配置信息
SaCookieConfig cfg = SaManager.getConfig().getCookie();
// 创建SaCookie对象并设置相关属性
SaCookie cookie = new SaCookie()
.setName(name) // 设置cookie名称为"merchantId"
.setValue(value) // 将商户ID转换为字符串并设置为cookie的值
.setMaxAge(timeout) // 设置cookie的存活时间单位为秒
.setDomain(cfg.getDomain()) // 设置cookie的域名
.setPath(cfg.getPath()) // 设置cookie的路径
.setSecure(cfg.getSecure()) // 设置是否仅通过HTTPS传输cookie
.setHttpOnly(cfg.getHttpOnly()) // 设置是否禁止JavaScript访问cookie
.setSameSite(cfg.getSameSite()); // 设置SameSite属性控制cookie的发送范围
// 将创建的cookie添加到HTTP响应中
SaHolder.getResponse().addCookie(cookie);
}
/**
* 密码登录
*
* @param passwordLoginQry 用户密码登录请求
* @return 返回
*/
@PostMapping("/passwordLogin")
@Operation(summary = "账号密码登录接口", method = "POST")
public SingleResponse<UserAuthVO> passwordLogin(@RequestBody @Validated PasswordLoginQry passwordLoginQry) {
checkCaptchaVerification(passwordLoginQry.getToken());
UserAuthVO userAuthVO = userAuthService.passwordLogin(passwordLoginQry);
extracted(userAuthVO);
return SingleResponse.of(userAuthVO);
}
/**
* 修改密码
*/
@SaCheckLogin
@PostMapping("/updatePassword")
@Operation(summary = "修改密码", method = "POST")
public Response updatePassword(@RequestBody @Validated UpdatePasswordCmd updatePasswordCmd) {
checkCaptchaVerification(updatePasswordCmd.getToken());
userAuthService.updatePassword(updatePasswordCmd);
return Response.buildSuccess();
}
/**
* 微信登录
*
* @return 返回
*/
@PostMapping("/wxMaCodeLogin")
@Operation(summary = "微信登录", method = "POST")
public SingleResponse<UserAuthVO> wxMaCodeLogin(@RequestBody @Validated WxMaOpenidQry wxMaOpenidQry) {
WxMaOpenidVO wxMaOpenidVO = wxMaService.getOpenId(wxMaOpenidQry);
wxMaOpenidQry.setMaOpenid(wxMaOpenidVO.getOpenid());
wxMaOpenidQry.setUnionid(wxMaOpenidVO.getUnionid());
UserAuthVO userAuthVO = userAuthService.wxMaCodeLogin(wxMaOpenidQry);
extracted(userAuthVO);
return SingleResponse.of(userAuthVO);
}
/**
* 当前是否登录
*/
@PostMapping("/sso/isLogin")
@Operation(summary = "当前是否登录", method = "POST")
public Object isLogin() {
return SaResult.data(StpUtil.isLogin());
}
/**
* 登出
*
* @return 返回
*/
@SaCheckLogin
@PostMapping("/sso/logout")
@Operation(summary = "登出", method = "POST")
public Response logout() {
SaSsoServerProcessor.instance.ssoSignout();
addCookie("satoken", "", 0);
return Response.buildSuccess();
}
/**
* 返回SSO认证中心登录地址
*/
@PostMapping("/sso/getSsoAuthUrl")
@Operation(summary = "返回SSO认证中心登录地址", method = "POST")
public SingleResponse<String> getSsoAuthUrl(String clientLoginUrl) {
String serverAuthUrl = SaSsoUtil.buildServerAuthUrl(clientLoginUrl, "");
return SingleResponse.of(serverAuthUrl);
}
/**
* 获取 redirectUrl
*/
@PostMapping("/sso/getRedirectUrl")
@Operation(summary = "获取 redirectUrl", method = "POST")
public SingleResponse<String> getRedirectUrl(String redirect) {
// 未登录情况下返回 code=401
if (!StpUtil.isLogin()) {
throw new BizException(UserAuthErrorCode.USER_AUTH_NOT_LOGIN);
}
List<PlatformVO> platformVOList = platformService.list(new PlatformListQry());
PlatformVO platformVO = getPlatformVO(redirect, platformVOList);
UserAuthVO userAuthVO = (UserAuthVO) StpUtil.getSession().get("userAuth");
List<UserRoleVO> userRoleVOList = userAuthVO.getUserRoleVOList();
// 查询用户关联的权限
Long platformId = platformVO.getPlatformId();
UserPermissionQry userPermissionQry = new UserPermissionQry();
userPermissionQry.setPlatformId(platformId);
userPermissionQry.setRoleIdList(userRoleVOList.stream().map(UserRoleVO::getRoleId).toList());
List<PermissionVO> permissionVOList = userPermissionService.list(userPermissionQry);
StpUtil.getSession().set("platformId:" + platformId, permissionVOList);
return SingleResponse.of(platformVO.getHomePage());
}
/**
* 登录后处理
*
* @param userAuthVO 用户信息
*/
private void extracted(UserAuthVO userAuthVO) {
// 查询用户关联的角色
UserRoleListQry userRoleListQry = new UserRoleListQry();
userRoleListQry.setUserId(userAuthVO.getUserId());
List<UserRoleVO> userRoleVOList = userRoleService.list(userRoleListQry);
userAuthVO.setUserRoleVOList(userRoleVOList);
// 登录, 同端互斥
StpUtil.login(userAuthVO.getUserId());
StpUtil.getSession().set("userAuth", userAuthVO);
AdminShowQry adminShowQry = new AdminShowQry();
adminShowQry.setUserId(userAuthVO.getUserId());
AdminVO adminVO = adminService.show(adminShowQry);
StpUtil.getSession().set("createdBy", adminVO.getAdminId());
StpUtil.getSession().set("createdByName", adminVO.getName());
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
UserAuthVO.Meta meta = new UserAuthVO.Meta();
meta.setAccessToken(tokenInfo.getTokenValue());
meta.setExpiresIn(tokenInfo.getTokenTimeout());
meta.setTokenType("Bearer");
userAuthVO.setMeta(meta);
}
/**
* 检查验证码验证
* 本方法用于验证用户提交的验证码是否有效通过验证码服务的验证
*
* @param token 验证码令牌用于验证用户提交的验证码
* @throws BizException 如果验证码验证失败抛出业务异常
*/
private void checkCaptchaVerification(String token) {
// 初始化验证码校验对象
CaptchaVO captchaVO = new CaptchaVO();
// 设置验证码验证令牌
captchaVO.setCaptchaVerification(token);
// 调用验证码服务进行验证
ResponseModel verification = captchaService.verification(captchaVO);
// 如果验证失败抛出业务异常
if (!verification.isSuccess()) {
throw new BizException(verification.getRepMsg(), UserAuthErrorCode.CAPTCHA_ERROR);
}
}
@PostMapping("/openSafe")
@Operation(summary = "二次认证", method = "POST")
public Response openSafe(@RequestBody @Validated OpenSafeCmd openSafeCmd) {
openSafeCmd.setUserId(StpUtil.getLoginIdAsLong());
userAuthService.openSafe(openSafeCmd);
StpUtil.openSafe(600);
return Response.buildSuccess();
}
}

View File

@ -0,0 +1,211 @@
package com.xunhong.erp.turbo.auth.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.lang.tree.Tree;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xunhong.erp.turbo.api.facade.api.WxMaServiceI;
import com.xunhong.erp.turbo.api.facade.dto.cmd.WxMaPhoneBindCmd;
import com.xunhong.erp.turbo.api.facade.dto.qry.WxMaPhoneQry;
import com.xunhong.erp.turbo.api.rbac.api.UserMenuServiceI;
import com.xunhong.erp.turbo.api.rbac.api.UserRoleServiceI;
import com.xunhong.erp.turbo.api.rbac.dto.qry.RoleMenuTreeQry;
import com.xunhong.erp.turbo.api.rbac.dto.qry.UserRoleListQry;
import com.xunhong.erp.turbo.api.rbac.dto.vo.UserRoleVO;
import com.xunhong.erp.turbo.api.user.api.AdminServiceI;
import com.xunhong.erp.turbo.api.user.api.EmployeeServiceI;
import com.xunhong.erp.turbo.api.user.api.UserAuthServiceI;
import com.xunhong.erp.turbo.api.user.api.UserServiceI;
import com.xunhong.erp.turbo.api.user.dto.cmd.EmployeeUpdateAvatarCmd;
import com.xunhong.erp.turbo.api.user.dto.cmd.UserUpdateCmd;
import com.xunhong.erp.turbo.api.user.dto.qry.AdminShowQry;
import com.xunhong.erp.turbo.api.user.dto.qry.EmployeeShowQry;
import com.xunhong.erp.turbo.api.user.dto.qry.UserAuthShowQry;
import com.xunhong.erp.turbo.api.user.dto.qry.UserShowQry;
import com.xunhong.erp.turbo.api.user.dto.vo.AdminVO;
import com.xunhong.erp.turbo.api.user.dto.vo.EmployeeVO;
import com.xunhong.erp.turbo.api.user.dto.vo.UserAuthVO;
import com.xunhong.erp.turbo.api.user.dto.vo.UserVO;
import com.xunhong.erp.turbo.base.dto.UserSession;
import com.xunhong.erp.turbo.file.FileService;
import com.xunhong.erp.turbo.file.config.OssProperties;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
/**
* @author shenyifei
*/
@Tag(name = "User", description = "用户管理")
@RestController("authUserController")
@RequestMapping(value = "/auth")
@RequiredArgsConstructor
public class UserController {
private final OssProperties properties;
@DubboReference(version = "1.0.0")
private final AdminServiceI adminService;
@DubboReference(version = "1.0.0")
private final UserServiceI userService;
@DubboReference(version = "1.0.0")
private final UserMenuServiceI userMenuService;
@DubboReference(version = "1.0.0")
private final WxMaServiceI wxMaService;
private final FileService fileService;
@DubboReference(version = "1.0.0")
private final UserAuthServiceI userAuthService;
@DubboReference(version = "1.0.0")
private final EmployeeServiceI employeeService;
@DubboReference(version = "1.0.0")
private final UserRoleServiceI userRoleService;
@SaCheckLogin
@GetMapping(value = "/userAdmin")
@Operation(summary = "管理员详情", method = "GET")
public SingleResponse<AdminVO> userAdmin(@ModelAttribute @Validated AdminShowQry adminShowQry) {
Long userId = UserSession.USER_THREAD_LOCAL.get().getUserId();
adminShowQry.setUserId(userId);
return SingleResponse.of(adminService.show(adminShowQry));
}
@SaCheckLogin
@GetMapping(value = "/userEmployee")
@Operation(summary = "员工详情", method = "GET")
public SingleResponse<EmployeeVO> userEmployee(@ModelAttribute @Validated EmployeeShowQry employeeShowQry) {
Long userId = UserSession.USER_THREAD_LOCAL.get().getUserId();
employeeShowQry.setUserId(userId);
EmployeeVO employeeVO = employeeService.show(employeeShowQry);
// 获取角色
UserRoleListQry userRoleListQry = new UserRoleListQry();
userRoleListQry.setUserId(employeeVO.getUserId());
List<UserRoleVO> userRoleVOList = userRoleService.list(userRoleListQry);
employeeVO.setUserRoleList(userRoleVOList);
employeeVO.setRoleIdList(userRoleVOList.stream().map(UserRoleVO::getRoleId).toList());
return SingleResponse.of(employeeVO);
}
// 更新员工头像
@SaCheckLogin
@PostMapping("/userEmployeeUpdateAvatar")
@Operation(summary = "更新员工头像", method = "POST")
public Response userEmployeeUpdateAvatar(@RequestBody @Validated EmployeeUpdateAvatarCmd employeeUpdateAvatarCmd) {
employeeService.updateAvatar(employeeUpdateAvatarCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@GetMapping("/userInfo")
@Operation(summary = "用户信息", method = "GET")
public SingleResponse<UserAuthVO> userInfo() {
UserAuthShowQry userAuthShowQry = new UserAuthShowQry();
userAuthShowQry.setUserId(UserSession.USER_THREAD_LOCAL.get().getUserId());
UserAuthVO userAuthVO = userAuthService.show(userAuthShowQry);
return SingleResponse.of(userAuthVO);
}
@SaCheckLogin
@PostMapping("/userUpdate")
@Operation(summary = "修改用户信息", method = "POST")
public Response userUpdate(@RequestBody @Validated UserUpdateCmd userUpdateCmd) {
userUpdateCmd.setUserId(UserSession.USER_THREAD_LOCAL.get().getUserId());
userService.update(userUpdateCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@GetMapping("/userMenu")
@Operation(summary = "菜单列表", method = "GET")
public MultiResponse<Tree<Long>> userMenu(
@ModelAttribute @Validated RoleMenuTreeQry roleMenuTreeQry
) {
return MultiResponse.of(userMenuService.list(roleMenuTreeQry));
}
/**
* 获取手机号码
*/
@SaCheckLogin
@PostMapping("/wxMaPhone")
@Operation(summary = "绑定微信手机号码", method = "GET")
public SingleResponse<String> wxMaPhone(@ModelAttribute @Validated WxMaPhoneQry wxMaPhoneQry) {
String phone = wxMaService.getPhone(wxMaPhoneQry);
return SingleResponse.of(phone);
}
/**
* 绑定微信手机号码
*/
@SaCheckLogin
@PostMapping("/wxMaPhoneBind")
@Operation(summary = "绑定微信手机号码", method = "POST")
public Response wxMaPhoneBind(@RequestBody @Validated WxMaPhoneBindCmd wxMaPhoneBindCmd) {
String phone = wxMaService.getPhone(wxMaPhoneBindCmd);
UserAuthVO userAuthVO = (UserAuthVO) StpUtil.getSession().get("userAuth");
UserUpdateCmd userUpdateCmd = new UserUpdateCmd();
userUpdateCmd.setUserId(userAuthVO.getUserId());
userUpdateCmd.setPhone(phone);
UserVO userVO = userAuthVO.getUserVO();
userVO.setPhone(phone);
userAuthVO.setUserVO(userVO);
StpUtil.getSession().set("userAuth", userAuthVO);
userService.update(userUpdateCmd);
return Response.buildSuccess();
}
@SaCheckLogin
@PostMapping(value = "upload", consumes = "multipart/form-data")
@Operation(summary = "上传图片", method = "POST", hidden = true)
public SingleResponse<String> upload(@RequestParam @Schema(title = "图片文件", requiredMode = Schema.RequiredMode.REQUIRED, type = "file") MultipartFile file) throws IOException {
String objectName = "uploads/" + LocalDateTimeUtil.format(LocalDateTimeUtil.now(), "yyMM/dd") + "/" + file.getOriginalFilename();
fileService.upload(objectName, file.getInputStream());
return SingleResponse.of(properties.getDomain() + objectName);
}
/**
* 判断是否关注公众号
*/
@SaCheckLogin
@PostMapping("/isSubscribe")
@Operation(summary = "判断是否关注公众号", method = "POST")
public SingleResponse<Boolean> isSubscribe() {
UserShowQry userShowQry = new UserShowQry();
userShowQry.setUserId(UserSession.USER_THREAD_LOCAL.get().getUserId());
UserVO userVO = userService.show(userShowQry);
return SingleResponse.of(Objects.nonNull(userVO.getMpOpenid()));
}
}

View File

@ -0,0 +1,42 @@
package com.xunhong.erp.turbo.auth.exception;
import com.xunhong.erp.turbo.base.exception.ErrorCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public enum UserAuthErrorCode implements ErrorCode {
// 未登录
USER_AUTH_NOT_LOGIN("USER_AUTH_NOT_LOGIN", "未登录"),
// 无应用权限
USER_AUTH_NO_APP_PERMISSION("USER_AUTH_NO_APP_PERMISSION", "无应用权限"),
// 无权限
USER_AUTH_NO_PERMISSION("USER_AUTH_NO_PERMISSION", "无权限"),
// 无权限
USER_AUTH_NO_ROLE("USER_AUTH_NO_ROLE", "无角色"),
// 无权限
USER_AUTH_NO_USER("USER_AUTH_NO_USER", "无用户"),
// 验证码错误
CAPTCHA_ERROR("CAPTCHA_ERROR", "验证码错误");
private final String code;
private final String message;
@Override
public String getCode() {
return this.code;
}
@Override
public String getMessage() {
return this.message;
}
}

View File

@ -0,0 +1,17 @@
spring:
application:
name: @application.name@
profiles:
active: dev
config:
import: classpath:cache.yml,classpath:rpc.yml,classpath:limiter.yml,classpath:sa-token.yml
oss:
endpoint: https://oss-cn-beijing.aliyuncs.com
access-secret: nQjR51pOeVggk1AgSyroj2svegAH2q
access-key: LTAI5tRk9oGxq7KYb5VtJbUm
bucket: qilincloud168
enabled: true
server:
port: 8082

View File

@ -0,0 +1,7 @@
spring:
application:
name: @application.name@
profiles:
active: dev
config:
import: classpath:base.yml,classpath:logging.yml,classpath:config.yml

View File

@ -0,0 +1,22 @@
msg.200=Success
msg.500=Internal Server Error.
msg.1001=No data
msg.1002=Data saving failed
msg.100000=platform and client do not match.
msg.100001=the current account has been registered in the platform client, please do not register again.
msg.100002=
msg.50001=Obtaining the verification code succeeded
msg.50002=The verification code has expired
msg.50003=The account corresponding to the verification code does not match
msg.50004=Verification code error
validation.account=account number
validation.wechatCode=wechat code
validation.smsCode=message authentication code
validation.mobile=mobile
validation.platform=platform
validation.password=password
validation.min=length must be greater than {min} bits
validation.max=length must be less than {max} bits
validation.size=length must be between {min} ~ {max} bits
validation.regexp=format error
validation.notBlank=must not be empty

View File

@ -0,0 +1,22 @@
msg.200=Success
msg.500=Internal Server Error.
msg.1001=No data
msg.1002=Data saving failed
msg.100000=platform and client do not match.
msg.100001=the current account has been registered in the platform client, please do not register again.
msg.100002=
msg.50001=Obtaining the verification code succeeded
msg.50002=The verification code has expired
msg.50003=The account corresponding to the verification code does not match
msg.50004=Verification code error
validation.account=account number
validation.wechatCode=wechat code
validation.smsCode=message authentication code
validation.mobile=mobile
validation.platform=platform
validation.password=password
validation.min=length must be greater than {min} bits
validation.max=length must be less than {max} bits
validation.size=length must be between {min} ~ {max} bits
validation.regexp=format error
validation.notBlank=must not be empty

View File

@ -0,0 +1,21 @@
msg.200=\u64CD\u4F5C\u6210\u529F
msg.500=\u7CFB\u7EDF\u5F02\u5E38
msg.1001=\u6570\u636E\u4E3A\u7A7A
msg.1002=\u6570\u636E\u4FDD\u5B58\u5931\u8D25
msg.100000=\u5e73\u53f0\u548c\u5ba2\u6237\u7aef\u4e0d\u5339\u914d。
msg.100001=\u5f53\u524d\u8d26\u53f7\u5df2\u7ecf\u5728\u5e73\u53f0\u5ba2\u6237\u7aef\u6ce8\u518c\u8bf7\u52ff\u91cd\u590d\u6ce8\u518c。
msg.50001={0}\u83b7\u53d6\u6210\u529f
msg.50002={0}\u5df2\u8fc7\u671f
msg.50003={0}\u5bf9\u5e94\u7684\u8d26\u53f7\u4e0d\u5339\u914d
msg.50004={0}\u9519\u8bef
validation.account=\u8d26\u53f7
validation.wechatCode=\u5fae\u4fe1 code
validation.smsCode=\u77ed\u4fe1\u9a8c\u8bc1\u7801
validation.mobile=\u624b\u673a\u53f7\u7801
validation.platform=\u5e73\u53f0
validation.password=\u5bc6\u7801
validation.min=\u957f\u5ea6\u5fc5\u987b\u5927\u4e8e {min} \u4f4d
validation.max=\u957f\u5ea6\u5fc5\u987b\u5c0f\u4e8e {max} \u4f4d
validation.size=\u957f\u5ea6\u5fc5\u987b\u4ecb\u4e8e {min} ~ {max} \u4f4d
validation.regexp=\u683c\u5f0f\u9519\u8bef
validation.notBlank=\u5fc5\u987b\u4e0d\u80fd\u4e3a\u7a7a

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-business</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-biz</artifactId>
<properties>
<application.name>erp-turbo-biz</application.name>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- COLA components -->
<dependency>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-component-domain-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-component-exception</artifactId>
</dependency>
<!-- COLA components End-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-base</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-config</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-file</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-api</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-rpc</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-apm</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-logback</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-limiter</artifactId>
</dependency>
<dependency>
<groupId>com.xunhong</groupId>
<artifactId>erp-turbo-datasource</artifactId>
</dependency>
<!-- TEST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- h2内存数据库-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-mate-annotation</artifactId>
<version>1.3.4</version>
</dependency>
</dependencies>
<build>
<finalName>${application.name}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<mainClass>
com.xunhong.erp.turbo.biz.ErpTurboBizApplication
</mainClass>
<layers>
<enabled>true</enabled>
<configuration>
../layers/layers.xml
</configuration>
</layers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.biz;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Spring Boot Starter
*
* @author shenyifei
*/
@SpringBootApplication(scanBasePackages = {"com.xunhong.erp.turbo", "com.alibaba.cola"})
public class ErpTurboBizApplication {
public static void main(String[] args) {
SpringApplication.run(ErpTurboBizApplication.class, args);
}
}

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxBrandVO;
import com.xunhong.erp.turbo.biz.domain.entity.BoxBrand;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface BoxBrandAssembler {
@Mapping(target = "boxProductVOList", source = "boxProductList")
BoxBrandVO toBoxBrandVO(BoxBrand boxBrand);
}

View File

@ -0,0 +1,15 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxProductVO;
import com.xunhong.erp.turbo.biz.domain.entity.BoxProduct;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface BoxProductAssembler {
BoxProductVO toBoxProductVO(BoxProduct boxProduct);
}

View File

@ -0,0 +1,15 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyVO;
import com.xunhong.erp.turbo.biz.domain.entity.Company;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface CompanyAssembler {
CompanyVO toCompanyVO(Company company);
}

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyPaymentAccountVO;
import com.xunhong.erp.turbo.biz.domain.entity.CompanyPaymentAccount;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface CompanyPaymentAccountAssembler {
@Mapping(target = "companyVO", source = "company")
CompanyPaymentAccountVO toCompanyPaymentAccountVO(CompanyPaymentAccount companyPaymentAccount);
}

View File

@ -0,0 +1,15 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.CostItemVO;
import com.xunhong.erp.turbo.biz.domain.entity.CostItem;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface CostItemAssembler {
CostItemVO toCostItemVO(CostItem costItem);
}

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerVO;
import com.xunhong.erp.turbo.biz.domain.entity.Dealer;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface DealerAssembler {
@Mapping(target = "dealerPaymentAccountVOList", source = "dealerPaymentAccountList")
DealerVO toDealerVO(Dealer dealer);
}

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerPaymentAccountVO;
import com.xunhong.erp.turbo.biz.domain.entity.DealerPaymentAccount;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS, uses = {DealerAssembler.class})
public interface DealerPaymentAccountAssembler {
@Mapping(target = "dealerVO", source = "dealer")
DealerPaymentAccountVO toDealerPaymentAccountVO(DealerPaymentAccount dealerPaymentAccount);
}

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerRebateCustomerVO;
import com.xunhong.erp.turbo.biz.domain.entity.DealerRebateCustomer;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface DealerRebateCustomerAssembler {
@Mapping(target = "dealerVO", source = "dealer")
DealerRebateCustomerVO toDealerRebateCustomerVO(DealerRebateCustomer dealerRebateCustomer);
}

View File

@ -0,0 +1,18 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerWarehouseVO;
import com.xunhong.erp.turbo.biz.domain.entity.DealerWarehouse;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface DealerWarehouseAssembler {
@Mapping(target = "dealerPaymentAccountVO", source = "dealerPaymentAccount")
@Mapping(target = "dealerVO", source = "dealer")
DealerWarehouseVO toDealerWarehouseVO(DealerWarehouse dealerWarehouse);
}

View File

@ -0,0 +1,15 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.GiftBoxVO;
import com.xunhong.erp.turbo.biz.domain.entity.GiftBox;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface GiftBoxAssembler {
GiftBoxVO toGiftBoxVO(GiftBox giftBox);
}

View File

@ -0,0 +1,17 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.PurchaseOrderVO;
import com.xunhong.erp.turbo.biz.domain.entity.PurchaseOrder;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface PurchaseOrderAssembler {
@Mapping(target = "draft", ignore = true)
PurchaseOrderVO toPurchaseOrderVO(PurchaseOrder purchaseOrder);
}

View File

@ -0,0 +1,15 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.ShipOrderVO;
import com.xunhong.erp.turbo.biz.domain.entity.ShipOrder;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface ShipOrderAssembler {
ShipOrderVO toShipOrderVO(ShipOrder shipOrder);
}

View File

@ -0,0 +1,15 @@
package com.xunhong.erp.turbo.biz.app.assembler;
import com.xunhong.erp.turbo.api.biz.dto.vo.SupplierVO;
import com.xunhong.erp.turbo.biz.domain.entity.Supplier;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
/**
* @author shenyifei
*/
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface SupplierAssembler {
SupplierVO toSupplierVO(Supplier supplier);
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxBrandVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxBrandAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxBrand;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxBrandGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class BoxBrandCreateCmdExe {
private final BoxBrandAssembler boxBrandAssembler;
private final BoxBrandGateway boxBrandGateway;
public BoxBrandVO execute(BoxBrandCreateCmd boxBrandCreateCmd) {
BoxBrand boxBrand = boxBrandGateway.save(boxBrandCreateCmd);
return boxBrandAssembler.toBoxBrandVO(boxBrand);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxBrandGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class BoxBrandDestroyCmdExe {
private final BoxBrandGateway boxBrandGateway;
public void execute(BoxBrandDestroyCmd boxBrandDestroyCmd) {
boxBrandGateway.destroy(boxBrandDestroyCmd);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxBrandUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxBrandVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxBrandAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxBrand;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxBrandGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class BoxBrandUpdateCmdExe {
private final BoxBrandAssembler boxBrandAssembler;
private final BoxBrandGateway boxBrandGateway;
public BoxBrandVO execute(BoxBrandUpdateCmd boxBrandUpdateCmd) {
BoxBrand boxBrand = boxBrandGateway.update(boxBrandUpdateCmd);
return boxBrandAssembler.toBoxBrandVO(boxBrand);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxProductCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxProductVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxProductAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxProduct;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxProductGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class BoxProductCreateCmdExe {
private final BoxProductAssembler boxProductAssembler;
private final BoxProductGateway boxProductGateway;
public BoxProductVO execute(BoxProductCreateCmd boxProductCreateCmd) {
BoxProduct boxProduct = boxProductGateway.save(boxProductCreateCmd);
return boxProductAssembler.toBoxProductVO(boxProduct);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxProductDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxProductGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class BoxProductDestroyCmdExe {
private final BoxProductGateway boxProductGateway;
public void execute(BoxProductDestroyCmd boxProductDestroyCmd) {
boxProductGateway.destroy(boxProductDestroyCmd);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.BoxProductUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxProductVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxProductAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxProduct;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxProductGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class BoxProductUpdateCmdExe {
private final BoxProductAssembler boxProductAssembler;
private final BoxProductGateway boxProductGateway;
public BoxProductVO execute(BoxProductUpdateCmd boxProductUpdateCmd) {
BoxProduct boxProduct = boxProductGateway.update(boxProductUpdateCmd);
return boxProductAssembler.toBoxProductVO(boxProduct);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyVO;
import com.xunhong.erp.turbo.biz.app.assembler.CompanyAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Company;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CompanyCreateCmdExe {
private final CompanyAssembler companyAssembler;
private final CompanyGateway companyGateway;
public CompanyVO execute(CompanyCreateCmd companyCreateCmd) {
Company company = companyGateway.save(companyCreateCmd);
return companyAssembler.toCompanyVO(company);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CompanyDestroyCmdExe {
private final CompanyGateway companyGateway;
public void execute(CompanyDestroyCmd companyDestroyCmd) {
companyGateway.destroy(companyDestroyCmd);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyPaymentAccountCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyPaymentAccountVO;
import com.xunhong.erp.turbo.biz.app.assembler.CompanyPaymentAccountAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.CompanyPaymentAccount;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CompanyPaymentAccountCreateCmdExe {
private final CompanyPaymentAccountAssembler companyPaymentAccountAssembler;
private final CompanyPaymentAccountGateway companyPaymentAccountGateway;
public CompanyPaymentAccountVO execute(CompanyPaymentAccountCreateCmd companyPaymentAccountCreateCmd) {
CompanyPaymentAccount companyPaymentAccount = companyPaymentAccountGateway.save(companyPaymentAccountCreateCmd);
return companyPaymentAccountAssembler.toCompanyPaymentAccountVO(companyPaymentAccount);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyPaymentAccountDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CompanyPaymentAccountDestroyCmdExe {
private final CompanyPaymentAccountGateway companyPaymentAccountGateway;
public void execute(CompanyPaymentAccountDestroyCmd companyPaymentAccountDestroyCmd) {
companyPaymentAccountGateway.destroy(companyPaymentAccountDestroyCmd);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyPaymentAccountUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyPaymentAccountVO;
import com.xunhong.erp.turbo.biz.app.assembler.CompanyPaymentAccountAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.CompanyPaymentAccount;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CompanyPaymentAccountUpdateCmdExe {
private final CompanyPaymentAccountAssembler companyPaymentAccountAssembler;
private final CompanyPaymentAccountGateway companyPaymentAccountGateway;
public CompanyPaymentAccountVO execute(CompanyPaymentAccountUpdateCmd companyPaymentAccountUpdateCmd) {
CompanyPaymentAccount companyPaymentAccount = companyPaymentAccountGateway.update(companyPaymentAccountUpdateCmd);
return companyPaymentAccountAssembler.toCompanyPaymentAccountVO(companyPaymentAccount);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyVO;
import com.xunhong.erp.turbo.biz.app.assembler.CompanyAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Company;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CompanyUpdateCmdExe {
private final CompanyAssembler companyAssembler;
private final CompanyGateway companyGateway;
public CompanyVO execute(CompanyUpdateCmd companyUpdateCmd) {
Company company = companyGateway.update(companyUpdateCmd);
return companyAssembler.toCompanyVO(company);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.CostItemVO;
import com.xunhong.erp.turbo.biz.app.assembler.CostItemAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.CostItem;
import com.xunhong.erp.turbo.biz.domain.gateway.CostItemGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CostItemCreateCmdExe {
private final CostItemAssembler costItemAssembler;
private final CostItemGateway costItemGateway;
public CostItemVO execute(CostItemCreateCmd costItemCreateCmd) {
CostItem costItem = costItemGateway.save(costItemCreateCmd);
return costItemAssembler.toCostItemVO(costItem);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.CostItemGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CostItemDestroyCmdExe {
private final CostItemGateway costItemGateway;
public void execute(CostItemDestroyCmd costItemDestroyCmd) {
costItemGateway.destroy(costItemDestroyCmd);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CostItemUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.CostItemVO;
import com.xunhong.erp.turbo.biz.app.assembler.CostItemAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.CostItem;
import com.xunhong.erp.turbo.biz.domain.gateway.CostItemGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CostItemUpdateCmdExe {
private final CostItemAssembler costItemAssembler;
private final CostItemGateway costItemGateway;
public CostItemVO execute(CostItemUpdateCmd costItemUpdateCmd) {
CostItem costItem = costItemGateway.update(costItemUpdateCmd);
return costItemAssembler.toCostItemVO(costItem);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Dealer;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerCreateCmdExe {
private final DealerAssembler dealerAssembler;
private final DealerGateway dealerGateway;
public DealerVO execute(DealerCreateCmd dealerCreateCmd) {
Dealer dealer = dealerGateway.save(dealerCreateCmd);
return dealerAssembler.toDealerVO(dealer);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerDestroyCmdExe {
private final DealerGateway dealerGateway;
public void execute(DealerDestroyCmd dealerDestroyCmd) {
dealerGateway.destroy(dealerDestroyCmd);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerPaymentAccountCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerPaymentAccountVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerPaymentAccountAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerPaymentAccount;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerPaymentAccountCreateCmdExe {
private final DealerPaymentAccountAssembler dealerPaymentAccountAssembler;
private final DealerPaymentAccountGateway dealerPaymentAccountGateway;
public DealerPaymentAccountVO execute(DealerPaymentAccountCreateCmd dealerPaymentAccountCreateCmd) {
DealerPaymentAccount dealerPaymentAccount = dealerPaymentAccountGateway.save(dealerPaymentAccountCreateCmd);
return dealerPaymentAccountAssembler.toDealerPaymentAccountVO(dealerPaymentAccount);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerPaymentAccountDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerPaymentAccountDestroyCmdExe {
private final DealerPaymentAccountGateway dealerPaymentAccountGateway;
public void execute(DealerPaymentAccountDestroyCmd dealerPaymentAccountDestroyCmd) {
dealerPaymentAccountGateway.destroy(dealerPaymentAccountDestroyCmd);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerPaymentAccountUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerPaymentAccountVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerPaymentAccountAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerPaymentAccount;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerPaymentAccountUpdateCmdExe {
private final DealerPaymentAccountAssembler dealerPaymentAccountAssembler;
private final DealerPaymentAccountGateway dealerPaymentAccountGateway;
public DealerPaymentAccountVO execute(DealerPaymentAccountUpdateCmd dealerPaymentAccountUpdateCmd) {
DealerPaymentAccount dealerPaymentAccount = dealerPaymentAccountGateway.update(dealerPaymentAccountUpdateCmd);
return dealerPaymentAccountAssembler.toDealerPaymentAccountVO(dealerPaymentAccount);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerRebateCustomerCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerRebateCustomerVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerRebateCustomerAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerRebateCustomer;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerRebateCustomerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerRebateCustomerCreateCmdExe {
private final DealerRebateCustomerAssembler dealerRebateCustomerAssembler;
private final DealerRebateCustomerGateway dealerRebateCustomerGateway;
public DealerRebateCustomerVO execute(DealerRebateCustomerCreateCmd dealerRebateCustomerCreateCmd) {
DealerRebateCustomer dealerRebateCustomer = dealerRebateCustomerGateway.save(dealerRebateCustomerCreateCmd);
return dealerRebateCustomerAssembler.toDealerRebateCustomerVO(dealerRebateCustomer);
}
}

View File

@ -0,0 +1,22 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerRebateCustomerDestroyCmd;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerRebateCustomerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerRebateCustomerDestroyCmdExe {
private final DealerRebateCustomerGateway dealerRebateCustomerGateway;
public void execute(DealerRebateCustomerDestroyCmd dealerRebateCustomerDestroyCmd) {
dealerRebateCustomerGateway.destroy(dealerRebateCustomerDestroyCmd);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerRebateCustomerUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerRebateCustomerVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerRebateCustomerAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerRebateCustomer;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerRebateCustomerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerRebateCustomerUpdateCmdExe {
private final DealerRebateCustomerAssembler dealerRebateCustomerAssembler;
private final DealerRebateCustomerGateway dealerRebateCustomerGateway;
public DealerRebateCustomerVO execute(DealerRebateCustomerUpdateCmd dealerRebateCustomerUpdateCmd) {
DealerRebateCustomer dealerRebateCustomer = dealerRebateCustomerGateway.update(dealerRebateCustomerUpdateCmd);
return dealerRebateCustomerAssembler.toDealerRebateCustomerVO(dealerRebateCustomer);
}
}

View File

@ -0,0 +1,27 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Dealer;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerUpdateCmdExe {
private final DealerAssembler dealerAssembler;
private final DealerGateway dealerGateway;
public DealerVO execute(DealerUpdateCmd dealerUpdateCmd) {
Dealer dealer = dealerGateway.update(dealerUpdateCmd);
return dealerAssembler.toDealerVO(dealer);
}
}

View File

@ -0,0 +1,29 @@
package com.xunhong.erp.turbo.biz.app.executor.cmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.DealerWarehouseCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerWarehouseVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerWarehouseAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerWarehouse;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerWarehouseGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author shenyifei
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class DealerWarehouseCreateCmdExe {
private final DealerWarehouseAssembler dealerWarehouseAssembler;
private final DealerWarehouseGateway dealerWarehouseGateway;
public DealerWarehouseVO execute(DealerWarehouseCreateCmd dealerWarehouseCreateCmd) {
DealerWarehouse dealerWarehouse = dealerWarehouseGateway.save(dealerWarehouseCreateCmd);
return dealerWarehouseAssembler.toDealerWarehouseVO(dealerWarehouse);
}
}

Some files were not shown because too many files have changed in this diff Show More