init
This commit is contained in:
commit
0e50fc4783
|
|
@ -0,0 +1,45 @@
|
|||
# e-code 本地二开项目
|
||||
## 项目搭建
|
||||
本项目为本地开发模版,可在 IDEA 中直接打开。
|
||||
|
||||
## 调试
|
||||
|
||||
本地调试:[参考文档](https://www.e-cology.com.cn/ecode/playground/doc/share/view/916733818655342593#3.4.1%20%E6%9C%AC%E5%9C%B0%E4%BB%A3%E7%A0%81%E8%B0%83%E8%AF%95)
|
||||
|
||||
项目使用 gradle 进行构建,在项目根目录下直接运行 gradle build 即可
|
||||
|
||||
## 打包部署
|
||||
|
||||
### 多模块项目创建说明
|
||||
> 子项目会集成根目录下的关联依赖,可在build.gradle中进行修改
|
||||
|
||||
#### 创建子模块
|
||||
|
||||
|
||||
> 在根目录下直接创建目录,并在目录下创建对应的gradle文件
|
||||
|
||||
例如:创建模块secondev-workflow-demo
|
||||
|
||||
1.创建目录 secondev-md-demo
|
||||
|
||||
2.创建gradle文件 secondev-md-demo/secondev-md-demo.gradle
|
||||
|
||||
```
|
||||
root
|
||||
|-secondev-custom-demo
|
||||
| |-src
|
||||
| | |--...
|
||||
| |-secondev-custom-demo.gradle
|
||||
| |
|
||||
|
||||
```
|
||||
secondev-custom-demo.gradle 内容如下
|
||||
```
|
||||
description = "子模块demo项目"
|
||||
|
||||
dependencies {
|
||||
// 子项目私有依赖添加
|
||||
}
|
||||
```
|
||||
#### 接触子模块关联
|
||||
> 在需要接触关联的子模块目录下 添加名为.disabled的文件即可,内容为空即可 需要重新reload
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'com.weaver.ecode.gradle.plugin.BuildArchPlugin'
|
||||
}
|
||||
|
||||
group 'com.weaver.seconddev'
|
||||
version '1.0.0'
|
||||
description ''
|
||||
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
// maven { url 'https://maven.aliyun.com/repository/public/' } // 可以连互联网 可放开此行注释
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
def ignoredProjectNames = []
|
||||
|
||||
|
||||
configure(allprojects) { project ->
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'com.weaver.ecode.gradle.plugin.BuildArchPlugin'
|
||||
|
||||
compileJava {
|
||||
options.encoding = 'UTF-8'
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.main.allJava
|
||||
manifest {
|
||||
attributes 'weaver-ecode-seconddev-id': rootProject.group + '-' + rootProject.name,
|
||||
'Implementation-Version': rootProject.version,
|
||||
'Implementation-Vendor-Id': rootProject.group,
|
||||
'Implementation-Title': rootProject.name
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignoredProjectNames.contains(project.name)) {
|
||||
dependencies {
|
||||
// implementation group: 'junit', name: 'junit', version: '4.12'
|
||||
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.20'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.20'
|
||||
// implementation group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
|
||||
|
||||
// 添加二开服务拉取的清单依赖
|
||||
def includeType = ['**/*.jar', '**/*.class']
|
||||
//服务器class文件依赖
|
||||
implementation files(rootProject.projectDir.getPath() + '/secDevClasses')
|
||||
//服务器jar包依赖
|
||||
implementation fileTree(dir: rootProject.projectDir.getPath() + '/secDevLib', includes: includeType)
|
||||
// 项目二开自定义依赖
|
||||
implementation fileTree(dir: rootProject.projectDir.getPath() + "/devLib", includes: includeType)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
org.gradle.jvmargs=-Xmx8192m -XX:MaxPermSize=8192m
|
||||
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
# 如果是内网环境请预先下载文件文件,让后调整以下url 指向本地文件
|
||||
# 例如windows 系统: distributionUrl=file\:///D:/gradle/gradle-6.9.2-all.zip
|
||||
# 例如 mac / linux 系统:distributionUrl=file:/Users/gradle/gradle-6.9.2-all.zip
|
||||
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-6.9.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
plugins{
|
||||
id 'java'
|
||||
}
|
||||
description = ""
|
||||
|
||||
dependencies {
|
||||
// 子项目私有依赖添加
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.weaver.seconddev.chapanda.action;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hr.util.Util;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service("checkBcskjeAction")
|
||||
public class CheckBcskjeAction implements EsbServerlessRpcRemoteInterface {
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
String bcskje = Util.null2String(params.get("bcskje"));
|
||||
String htje = Util.null2String(params.get("htje"));
|
||||
|
||||
if (!NumberUtil.isNumber(bcskje) || !NumberUtil.isNumber(htje)) {
|
||||
return WeaResult.fail("金额填写有误", true);
|
||||
}
|
||||
|
||||
if (NumberUtil.compare(Double.parseDouble(bcskje), Double.parseDouble(htje)) > 0) {
|
||||
return WeaResult.fail("本次收款金额大于合同总金额", true);
|
||||
}
|
||||
|
||||
return WeaResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 表单
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Form {
|
||||
|
||||
int labelId() default -1;
|
||||
|
||||
String label() default "";
|
||||
|
||||
int labelSpan() default 6;
|
||||
|
||||
boolean hide() default false;
|
||||
|
||||
String layout() default "";
|
||||
|
||||
String group() default "";
|
||||
|
||||
String tip() default "";
|
||||
|
||||
int tipLabel() default -1;
|
||||
|
||||
FormItem[] items();
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import com.weaver.common.component.form.item.WeaFormItemType;
|
||||
import com.weaver.seconddev.chapanda.enums.BaseEnum;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 表单项
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
public @interface FormItem {
|
||||
|
||||
WeaFormItemType itemType();
|
||||
|
||||
String name() default "";
|
||||
|
||||
String options() default "";
|
||||
|
||||
Class<? extends BaseEnum>[] optionsEnum() default {};
|
||||
|
||||
String optionsEnumMethod() default "name";
|
||||
|
||||
String browserType() default "";
|
||||
|
||||
String browserModule() default "";
|
||||
|
||||
String maxLength() default "";
|
||||
|
||||
boolean readOnly() default false;
|
||||
|
||||
boolean required() default false;
|
||||
|
||||
boolean browserMultiple() default false;
|
||||
|
||||
boolean langLine() default false;
|
||||
|
||||
long max() default Integer.MAX_VALUE;
|
||||
|
||||
long min() default Integer.MIN_VALUE;
|
||||
|
||||
int precision() default 5;
|
||||
|
||||
boolean needNumberSetting() default false;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import com.weaver.common.component.form.item.WeaFormItemType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 多语言配置
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MultiLanguage {
|
||||
|
||||
String tablefield() default "";
|
||||
|
||||
WeaFormItemType itemType() default WeaFormItemType.LOCALE;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 高级搜索
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SearchCondition {
|
||||
|
||||
int labelId() default -1;
|
||||
|
||||
String label() default "";
|
||||
|
||||
int labelSpan() default 6;
|
||||
|
||||
String module() default "";
|
||||
|
||||
String quickSearchKey() default "";
|
||||
|
||||
boolean needQuickSearch() default false;
|
||||
|
||||
// 根据需要可动态忽略
|
||||
boolean ignore() default false;
|
||||
|
||||
SearchConditionItem[] items();
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import com.weaver.common.component.search.item.WeaSearchConditionItemType;
|
||||
import com.weaver.seconddev.chapanda.enums.BaseEnum;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 高级搜索搜索项
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
public @interface SearchConditionItem {
|
||||
|
||||
WeaSearchConditionItemType itemType();
|
||||
|
||||
String name() default "";
|
||||
|
||||
String groupId() default "commonGroup";
|
||||
|
||||
String browserModule() default "";
|
||||
|
||||
String browserType() default "";
|
||||
|
||||
boolean browserMultiple() default false;
|
||||
|
||||
String options() default "";
|
||||
|
||||
Class<? extends BaseEnum>[] optionsEnum() default {};
|
||||
|
||||
boolean isRange() default false;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import com.weaver.common.component.table.type.WeaTableTypeEnum;
|
||||
import com.weaver.seconddev.chapanda.constant.Constant;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 表格组件
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Table {
|
||||
|
||||
TableOperate[] value() default {};
|
||||
|
||||
WeaTableTypeEnum tableType() default WeaTableTypeEnum.NONE;
|
||||
|
||||
String module() default Constant.MODULE;
|
||||
|
||||
String pageUid() default "";
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 表格表头
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TableColumn {
|
||||
|
||||
String width() default "";
|
||||
|
||||
boolean hide() default false;
|
||||
|
||||
String label() default "";
|
||||
|
||||
long labelId() default -1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.weaver.seconddev.chapanda.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 表格操作按钮
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TableOperate {
|
||||
|
||||
String text();
|
||||
|
||||
long labelId() default -1L;
|
||||
|
||||
String menuCode() default "";
|
||||
|
||||
String permissionSetCode() default "";
|
||||
|
||||
int index() default -1;
|
||||
|
||||
boolean outer() default true;
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package com.weaver.seconddev.chapanda.browser;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.weaver.common.component.browser.annotation.WeaBrowserTypeLink;
|
||||
import com.weaver.common.component.browser.constant.WeaBrowserConstant;
|
||||
import com.weaver.common.component.browser.constant.WeaBrowserDataType;
|
||||
import com.weaver.common.component.browser.entity.BrowserEntity;
|
||||
import com.weaver.common.component.browser.entity.WeaBrowserBaseBean;
|
||||
import com.weaver.common.component.browser.service.AbstractWeaBrowserBaseService;
|
||||
import com.weaver.common.component.table.page.Page;
|
||||
import com.weaver.seconddev.chapanda.constant.Constant;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.OrderTypeListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.param.OrderTypeQueryParam;
|
||||
import com.weaver.seconddev.chapanda.service.PageDemoService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工单类型浏览按钮
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Component
|
||||
@WeaBrowserTypeLink(module = Constant.MODULE, type = "orderTypeBrowser")
|
||||
public class OrderTypeBrowser extends AbstractWeaBrowserBaseService {
|
||||
|
||||
@Autowired
|
||||
private PageDemoService pageDemoService;
|
||||
|
||||
/**
|
||||
* @param params
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public WeaBrowserBaseBean init(Map<String, Object> params) {
|
||||
WeaBrowserBaseBean baseBean = new WeaBrowserBaseBean();
|
||||
HashMap<String, Object> dialogPropsMap = Maps.newHashMap();
|
||||
dialogPropsMap.put("title", "请选择工单类型");
|
||||
baseBean.setBrowserDialogProps(dialogPropsMap);
|
||||
baseBean.setHasAdvanceSearch(false);
|
||||
baseBean.setQuickSearchName("keywords");
|
||||
return baseBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBrowserData(Map<String, Object> params) {
|
||||
Map<String, Object> resultMap = Maps.newHashMap();
|
||||
if (MapUtils.isEmpty(params)) {
|
||||
return resultMap;
|
||||
}
|
||||
Map<String, Object> quickSearchDataMap = (Map<String, Object>) params.get("quickSearchDatas");
|
||||
Object name = Objects.isNull(quickSearchDataMap) ? null : quickSearchDataMap.get("keywords");
|
||||
OrderTypeQueryParam queryParam = new OrderTypeQueryParam();
|
||||
queryParam.setName(Objects.isNull(name) ? "" : name.toString());
|
||||
queryParam.setCurrent(Long.parseLong(params.getOrDefault("current", "1").toString()));
|
||||
queryParam.setPageSize(Long.parseLong(params.getOrDefault("pageSize", "10").toString()));
|
||||
Page<OrderTypeListDTO>page = pageDemoService.orderTypePage(queryParam);
|
||||
|
||||
resultMap.put(WeaBrowserConstant.BROWSER_RESULT_DATA, convert2BrowserData(page.getRecords()));
|
||||
resultMap.put(WeaBrowserConstant.BROWSER_RESULT_TOTAL, page.getTotal());
|
||||
resultMap.put(WeaBrowserConstant.BROWSER_RESULT_DATA_TYPE, WeaBrowserDataType.LIST_DATA.getType());
|
||||
resultMap.put(WeaBrowserConstant.BROWSER_RESULT_PAGE_SIZE, page.getSize());
|
||||
resultMap.put(WeaBrowserConstant.BROWSER_RESULT_CURRENT_PAGE, page.getCurrent());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> browserAutoComplete(Map<String, Object> params){
|
||||
Object name = params.get("searchValue");
|
||||
OrderTypeQueryParam queryParam = new OrderTypeQueryParam();
|
||||
queryParam.setName(Objects.isNull(name) ? "" : name.toString());
|
||||
queryParam.setCurrent(Long.parseLong(params.getOrDefault("current", "1").toString()));
|
||||
queryParam.setPageSize(Long.parseLong(params.getOrDefault("pageSize", "10").toString()));
|
||||
Page<OrderTypeListDTO> page = pageDemoService.orderTypePage(queryParam);
|
||||
|
||||
Map<String, Object> resultMap = Maps.newHashMap();
|
||||
resultMap.put(WeaBrowserConstant.BROWSER_RESULT_TOTAL, page.getTotal());
|
||||
resultMap.put(WeaBrowserConstant.BROWSER_RESULT_DATA, convert2BrowserData(page.getRecords()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> convert2BrowserData(Collection<OrderTypeListDTO> salarySobs) {
|
||||
if (CollectionUtils.isEmpty(salarySobs)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return salarySobs.stream()
|
||||
.map(e -> {
|
||||
Map<String, Object> tempMap = Maps.newHashMap();
|
||||
tempMap.put("id", e.getId().toString());
|
||||
tempMap.put("name", e.getMc());
|
||||
return tempMap;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BrowserEntity> getBrowserEntities(Map<String, Object> params) {
|
||||
List<BrowserEntity> browserEntityList = Lists.newArrayList();
|
||||
Map<String, Object> browserData = getBrowserData(params);
|
||||
if (MapUtils.isNotEmpty(browserData)) {
|
||||
List<Object> list = (List<Object>) browserData.get(WeaBrowserConstant.BROWSER_RESULT_DATA);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BrowserEntity browserEntity = new BrowserEntity();
|
||||
Map<String, Object> userMap = (Map<String, Object>) list.get(i);
|
||||
String idStr = (String) userMap.get("id");
|
||||
String name = (String) userMap.get("name");
|
||||
browserEntity.setDataId(idStr);
|
||||
browserEntity.setContent(name);
|
||||
browserEntityList.add(browserEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return browserEntityList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.weaver.seconddev.chapanda.browser;
|
||||
|
||||
import com.weaver.common.component.browser.entity.BrowserEntity;
|
||||
import com.weaver.common.component.browser.entity.BrowserParam;
|
||||
import com.weaver.common.component.browser.rest.RemoteBrowserService;
|
||||
import com.weaver.common.component.browser.service.Browser;
|
||||
import com.weaver.common.component.browser.util.BrowserUtil;
|
||||
import com.weaver.framework.util.JsonUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 标准浏览按钮
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Service("pageDemo_OrderTypeRemoteBrowserService")
|
||||
public class OrderTypeRemoteBrowserService implements RemoteBrowserService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderTypeRemoteBrowserService.class);
|
||||
|
||||
@Override
|
||||
public Map<String, List<BrowserEntity>> queryBrowserByParam(List<BrowserParam> param) {
|
||||
log.info("SalaryRemoteBrowserService.queryBrowserByParam.param : {}", JsonUtil.toJsonString(param));
|
||||
if (param == null || param.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
log.info("SalaryRemoteBrowserService.queryBrowserByParam.param : {}", JsonUtil.toJsonString(param));
|
||||
|
||||
Map<String, List<BrowserEntity>> map = new HashMap<>();
|
||||
for (BrowserParam browserParam : param) {
|
||||
if (!map.containsKey(browserParam.getBrowserType())) {
|
||||
map.put(browserParam.getBrowserType(), new ArrayList<>());
|
||||
}
|
||||
map.get(browserParam.getBrowserType()).addAll(assembleBrowser(browserParam));
|
||||
}
|
||||
log.info("SalaryRemoteBrowserService.queryBrowserByParam.result: {}", JsonUtil.toJsonString(map));
|
||||
return map;
|
||||
}
|
||||
|
||||
private List<BrowserEntity> assembleBrowser(BrowserParam param) {
|
||||
try {
|
||||
// 获取对应的浏览按钮
|
||||
Browser browser = BrowserUtil.getBrowser(param.getBrowserType());
|
||||
if (browser != null) {
|
||||
Map<String,Object> object = new HashMap<>();
|
||||
object.put("ids", param.getDataIds());
|
||||
object.put("user", param.getUser());
|
||||
return browser.getBrowserEntities(object);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取浏览按钮[{}]数据失败:{},{},{}", param.getBrowserType(), e.getMessage(),e.toString(), e.getLocalizedMessage());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.weaver.seconddev.chapanda.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* id、name的基本数据格式
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseDTO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.weaver.seconddev.chapanda.common;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 人员选项
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel("人员选项")
|
||||
public class OptionDTO {
|
||||
|
||||
@ApiModelProperty("人员ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("人员姓名")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("人员姓名")
|
||||
private String name;
|
||||
|
||||
public OptionDTO(String id, String content) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.weaver.seconddev.chapanda.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* sql返回对象
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SqlResponse<T> {
|
||||
private String sqlType;
|
||||
private Integer code;
|
||||
private List<T> records;
|
||||
private Integer count;
|
||||
private String message;
|
||||
private String status;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.weaver.seconddev.chapanda.constant;
|
||||
|
||||
/**
|
||||
* 常量
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class Constant {
|
||||
|
||||
/**
|
||||
* 模块标识
|
||||
*/
|
||||
public static final String MODULE = "secondev";
|
||||
|
||||
/**
|
||||
*租户
|
||||
*/
|
||||
public static final String TENANT_KEY = "tma3ktp1q7";
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.weaver.seconddev.chapanda.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
import com.weaver.seconddev.chapanda.service.MybatisDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/qt/demo")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class DemoController {
|
||||
|
||||
@Autowired
|
||||
private MybatisDemoService mybatisDemoService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public WeaResult<List<DemoPO>> getSearchCondition() {
|
||||
return WeaResult.success(mybatisDemoService.list());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.weaver.seconddev.chapanda.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.component.search.WeaSearchCondition;
|
||||
import com.weaver.common.component.table.WeaTable;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.param.DemoQueryParam;
|
||||
import com.weaver.seconddev.chapanda.service.PageDemoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/page/demo")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class PageDemoController {
|
||||
|
||||
@Autowired
|
||||
private PageDemoService pageDemoService;
|
||||
|
||||
|
||||
@GetMapping("/getSearchCondition")
|
||||
@ApiOperation("列表的高级搜索")
|
||||
public WeaResult<WeaSearchCondition> getSearchCondition() {
|
||||
return WeaResult.success(pageDemoService.getSearchCondition());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("列表")
|
||||
public WeaResult<WeaTable<DemoListDTO>> list(@RequestBody DemoQueryParam queryParam) {
|
||||
return WeaResult.success(pageDemoService.list(queryParam));
|
||||
}
|
||||
|
||||
@GetMapping("/getForm")
|
||||
@ApiOperation("获取表单")
|
||||
public WeaResult<?> getFrom(@RequestParam(value = "id", required = false) Long id) {
|
||||
return WeaResult.success(pageDemoService.getForm(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.weaver.seconddev.chapanda.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.weaver.common.component.form.item.WeaFormItemType;
|
||||
import com.weaver.seconddev.chapanda.annotation.Form;
|
||||
import com.weaver.seconddev.chapanda.annotation.FormItem;
|
||||
import com.weaver.seconddev.chapanda.annotation.TableColumn;
|
||||
import com.weaver.seconddev.chapanda.common.BaseDTO;
|
||||
import com.weaver.seconddev.chapanda.constant.Constant;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 表单
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DemoFormDTO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@Form(
|
||||
label = "标题",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.INPUT, required = true)
|
||||
}
|
||||
)
|
||||
private String bt;
|
||||
|
||||
@Form(
|
||||
label = "发起人",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.BROWSER, browserType = "resource", required = true)
|
||||
}
|
||||
)
|
||||
private BaseDTO fqr;
|
||||
|
||||
@Form(
|
||||
label = "部门",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.BROWSER, browserType = "department", required = true)
|
||||
}
|
||||
)
|
||||
private BaseDTO bm;
|
||||
|
||||
@Form(
|
||||
label = "工单类型",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.BROWSER, browserModule = Constant.MODULE, browserType = "orderTypeBrowser", required = true)
|
||||
}
|
||||
)
|
||||
private BaseDTO gdlx;
|
||||
|
||||
|
||||
@Form(
|
||||
label = "创建日期",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.DATEPICKER, required = true)
|
||||
},
|
||||
group = "baseInfo"
|
||||
)
|
||||
@TableColumn(label = "创建日期", labelId = 100377, width = "150")
|
||||
private String cjrq;
|
||||
|
||||
@Form(
|
||||
label = "文档",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.UPLOAD)
|
||||
}
|
||||
)
|
||||
private String wd;
|
||||
|
||||
@Form(
|
||||
label = "流程",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.BROWSER, browserModule = "workflow/pathdef", browserType = "workflowPathBrowser", required = true)
|
||||
}
|
||||
)
|
||||
private String lc;
|
||||
|
||||
|
||||
@Form(
|
||||
label = "问题描述",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@FormItem(itemType = WeaFormItemType.TEXTAREA, required = true)
|
||||
}
|
||||
)
|
||||
private String wtms;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.weaver.seconddev.chapanda.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.weaver.common.component.table.type.WeaTableTypeEnum;
|
||||
import com.weaver.seconddev.chapanda.annotation.Table;
|
||||
import com.weaver.seconddev.chapanda.annotation.TableColumn;
|
||||
import com.weaver.seconddev.chapanda.annotation.TableOperate;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(pageUid = "demoList",
|
||||
tableType = WeaTableTypeEnum.CHECKBOX,
|
||||
value = {
|
||||
@TableOperate(index = 0, text = "查看明细", labelId = 0)
|
||||
})
|
||||
public class DemoListDTO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableColumn(label = "标题", labelId = 0, width = "150")
|
||||
private String bt;
|
||||
|
||||
@TableColumn(label = "工单类型", labelId = 0, width = "150")
|
||||
private String gdlxname;
|
||||
private String gdlx;
|
||||
|
||||
@TableColumn(label = "创建日期", labelId = 0, width = "150")
|
||||
private String cjrq;
|
||||
|
||||
@TableColumn(label = "发起人", labelId = 0, width = "150")
|
||||
private String username;
|
||||
private String fqr;
|
||||
|
||||
@TableColumn(label = "部门", labelId = 0, width = "150")
|
||||
private String bmName;
|
||||
private String bm;
|
||||
|
||||
@TableColumn(label = "问题描述", labelId = 0, width = "150")
|
||||
private String wtms;
|
||||
|
||||
@TableColumn(label = "文档", labelId = 0, width = "150")
|
||||
private String wd;
|
||||
|
||||
@TableColumn(label = "流程", labelId = 0, width = "150")
|
||||
private String lc;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.weaver.seconddev.chapanda.entity.dto;
|
||||
|
||||
import com.weaver.common.component.search.item.WeaSearchConditionItemType;
|
||||
import com.weaver.seconddev.chapanda.annotation.SearchCondition;
|
||||
import com.weaver.seconddev.chapanda.annotation.SearchConditionItem;
|
||||
import com.weaver.seconddev.chapanda.constant.Constant;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DemoSearchConditionDTO {
|
||||
|
||||
@SearchCondition(
|
||||
label = "创建人",
|
||||
labelId = 0,
|
||||
needQuickSearch = true,
|
||||
quickSearchKey = "username",
|
||||
items = {
|
||||
@SearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "username"),
|
||||
}
|
||||
)
|
||||
private String username;
|
||||
|
||||
@SearchCondition(
|
||||
label = "部门",
|
||||
labelId = 0,
|
||||
needQuickSearch = true,
|
||||
items = {
|
||||
@SearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER,
|
||||
browserType = "department", browserMultiple = true, name = "department"),
|
||||
}
|
||||
)
|
||||
private String department;
|
||||
|
||||
@SearchCondition(
|
||||
label = "工单类型",
|
||||
labelId = 0,
|
||||
items = @SearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER,
|
||||
browserType = "orderTypeBrowser", name = "orderType", browserModule = Constant.MODULE)
|
||||
)
|
||||
private String orderType;
|
||||
|
||||
|
||||
@SearchCondition(
|
||||
label = "创建日期",
|
||||
labelId = 0,
|
||||
items = {
|
||||
@SearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "createTime"),
|
||||
}
|
||||
)
|
||||
private String createTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.weaver.seconddev.chapanda.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderTypeListDTO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String mc;
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.weaver.seconddev.chapanda.entity.param;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DemoQueryParam {
|
||||
@ApiModelProperty("当前页码")
|
||||
private Long current ;
|
||||
|
||||
@ApiModelProperty("每页数据条数")
|
||||
private Long pageSize ;
|
||||
|
||||
@ApiModelProperty("总条数")
|
||||
private Integer total ;
|
||||
|
||||
@ApiModelProperty("主键id")
|
||||
private Collection<Long> ids;
|
||||
|
||||
@ApiModelProperty("关键字(姓名、部门、工号)")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("申报年月")
|
||||
private List<YearMonth> declareMonth;
|
||||
|
||||
/**
|
||||
* 申报年月
|
||||
*/
|
||||
@JsonIgnore
|
||||
private List<LocalDate> declareMonthDate;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("员工id")
|
||||
private Long employeeId;
|
||||
|
||||
@ApiModelProperty("个税扣缴义务人的主键id")
|
||||
private Long taxAgentId;
|
||||
|
||||
@ApiModelProperty("部门id")
|
||||
private List<Long> departmentIds;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String jobNum;
|
||||
|
||||
@ApiModelProperty("身份证号码")
|
||||
private String idNo;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.weaver.seconddev.chapanda.entity.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderTypeQueryParam {
|
||||
@ApiModelProperty("当前页码")
|
||||
private Long current ;
|
||||
|
||||
@ApiModelProperty("每页数据条数")
|
||||
private Long pageSize ;
|
||||
|
||||
@ApiModelProperty("总条数")
|
||||
private Integer total ;
|
||||
|
||||
@ApiModelProperty("名字")
|
||||
private String name ;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.weaver.seconddev.chapanda.entity.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* demo PO
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("uf_gdjcxx")
|
||||
public class DemoPO {
|
||||
|
||||
private Long id;
|
||||
private Long formDataId;
|
||||
private Double dataIndex;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private String tenantKey;
|
||||
private Byte isDelete;
|
||||
private Long creator;
|
||||
private Long updater;
|
||||
private Byte deleteType;
|
||||
private Byte ftStatus;
|
||||
private String name;
|
||||
private Byte isFlow;
|
||||
private Long flowId;
|
||||
private Byte dataStatus;
|
||||
private String currentStep;
|
||||
private String flowStatus;
|
||||
private Long isTop;
|
||||
private Long classification;
|
||||
private String classificationExpire;
|
||||
private Byte dnFirst;
|
||||
private Long multiPathId;
|
||||
private Long multiTaskId;
|
||||
private String flowSystemNumber;
|
||||
private Long ebWorkflowId;
|
||||
private Long addBatchId;
|
||||
private Long updateBatchId;
|
||||
|
||||
private String bm;
|
||||
private String cbr;
|
||||
private String wtms;
|
||||
private String fqr;
|
||||
private String wd;
|
||||
private String cjrq;
|
||||
private String bt;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.weaver.seconddev.chapanda.enums;
|
||||
|
||||
/**
|
||||
* 基础枚举
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public interface BaseEnum<T> {
|
||||
|
||||
String name();
|
||||
|
||||
T getValue();
|
||||
|
||||
Integer getLabelId();
|
||||
|
||||
String getDefaultLabel();
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.weaver.seconddev.chapanda.enums;
|
||||
|
||||
public enum SQLStatusEnum implements BaseEnum<String> {
|
||||
OK("OK", "成功", 0),
|
||||
FAIL("FAIL", "失败", 0);
|
||||
|
||||
private String value;
|
||||
|
||||
private String defaultLabel;
|
||||
|
||||
private int labelId;
|
||||
|
||||
|
||||
SQLStatusEnum(String value, String defaultLabel, int labelId) {
|
||||
this.value = value;
|
||||
this.defaultLabel = defaultLabel;
|
||||
this.labelId = labelId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getLabelId() {
|
||||
return labelId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultLabel() {
|
||||
return defaultLabel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.weaver.seconddev.chapanda.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class BusinessRunTimeException extends RuntimeException {
|
||||
|
||||
public BusinessRunTimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.weaver.seconddev.chapanda.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* sql执行异常
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class SqlRunTimeException extends RuntimeException {
|
||||
public SqlRunTimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.weaver.seconddev.chapanda.handler;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.exception.BusinessRunTimeException;
|
||||
import com.weaver.seconddev.chapanda.exception.SqlRunTimeException;
|
||||
import com.weaver.seconddev.chapanda.util.I18nUtil;
|
||||
import com.weaver.teams.security.context.TenantContext;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 全局异常处理
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
@ControllerAdvice(value = "com.weaver.seconddev.chapanda.controller")
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
/**
|
||||
* 处理参数校验异常
|
||||
*
|
||||
* @param e 参数校验异常
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = MethodArgumentNotValidException.class)
|
||||
public WeaResult<String> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||
String tenantKey = TenantContext.getCurrentTenantKey();
|
||||
Long employeeId = UserContext.getCurrentEmployeeId();
|
||||
|
||||
Pattern numberPattern = Pattern.compile("^LABEL:([0-9]+)$");
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
for (ObjectError error : e.getBindingResult().getAllErrors()) {
|
||||
Matcher matcher = numberPattern.matcher(Optional.ofNullable(error.getDefaultMessage()).orElse(StringUtils.EMPTY));
|
||||
if (matcher.find()) {
|
||||
errMsg.append(" ");
|
||||
errMsg.append(I18nUtil.getI18nLabel(tenantKey, employeeId, Integer.parseInt(matcher.group(1)), error.getDefaultMessage()));
|
||||
} else {
|
||||
errMsg.append(error.getDefaultMessage());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(errMsg.toString())) {
|
||||
return WeaResult.fail(I18nUtil.getI18nLabel(tenantKey, employeeId, 0, "系统错误,请联系管理员"), e);
|
||||
}
|
||||
return WeaResult.fail(errMsg.toString(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理业务异常
|
||||
*
|
||||
* @param e 业务异常
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = BusinessRunTimeException.class)
|
||||
public WeaResult<String> handleBusinessRunTimeException(BusinessRunTimeException e) {
|
||||
return WeaResult.fail(e.getMessage(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理业务异常
|
||||
*
|
||||
* @param e 业务异常
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = SqlRunTimeException.class)
|
||||
public WeaResult<String> handleSqlRuntimeException(SqlRunTimeException e) {
|
||||
return WeaResult.fail(e.getMessage(), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理未知异常
|
||||
*
|
||||
* @param e 异常信息
|
||||
* @param request 请求
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
public WeaResult<String> handleException(Exception e, HttpServletRequest request) {
|
||||
String tenantKey = TenantContext.getCurrentTenantKey();
|
||||
Long employeeId = UserContext.getCurrentEmployeeId();
|
||||
// 打印异常信息
|
||||
log.warn("tenantKey: {}, employeeId: {}, uri: {}", tenantKey, employeeId, request.getRequestURI(), e);
|
||||
// 返回给前端默认异常信息
|
||||
return WeaResult.fail(I18nUtil.getI18nLabel(tenantKey, employeeId, 0, "系统错误,请联系管理员"), e);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.weaver.seconddev.chapanda.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoFormDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface DemoMapper extends BaseMapper<DemoPO> {
|
||||
DemoFormDTO getDemoListDTO(@Param("id") Long id, @Param("tenantKey") String tenantKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.chapanda.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
|
||||
/**
|
||||
* db最佳实践demo
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public interface MybatisDemoService extends IService<DemoPO> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.weaver.seconddev.chapanda.service;
|
||||
|
||||
import com.weaver.common.component.form.WeaForm;
|
||||
import com.weaver.common.component.search.WeaSearchCondition;
|
||||
import com.weaver.common.component.table.WeaTable;
|
||||
import com.weaver.common.component.table.page.Page;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.OrderTypeListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.param.DemoQueryParam;
|
||||
import com.weaver.seconddev.chapanda.entity.param.OrderTypeQueryParam;
|
||||
|
||||
public interface PageDemoService {
|
||||
|
||||
WeaSearchCondition getSearchCondition();
|
||||
|
||||
WeaTable<DemoListDTO> list(DemoQueryParam queryParam);
|
||||
|
||||
Page<OrderTypeListDTO> orderTypePage(OrderTypeQueryParam queryParam);
|
||||
|
||||
WeaForm getForm(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.weaver.seconddev.chapanda.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.weaver.framework.spring.annotation.AopClass;
|
||||
import com.weaver.seconddev.chapanda.entity.po.DemoPO;
|
||||
import com.weaver.seconddev.chapanda.mapper.DemoMapper;
|
||||
import com.weaver.seconddev.chapanda.service.MybatisDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* db最佳实践
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Service
|
||||
@AopClass
|
||||
public class MybatisDemoServiceImpl extends ServiceImpl<DemoMapper, DemoPO> implements MybatisDemoService {
|
||||
@Autowired
|
||||
private DemoMapper demoMapper;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.weaver.seconddev.chapanda.service.impl;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.weaver.common.component.form.WeaForm;
|
||||
import com.weaver.common.component.search.WeaSearchCondition;
|
||||
import com.weaver.common.component.table.WeaTable;
|
||||
import com.weaver.common.component.table.page.Page;
|
||||
import com.weaver.ebuilder.datasource.api.entity.ExecuteSqlEntity;
|
||||
import com.weaver.ebuilder.datasource.api.enums.SourceType;
|
||||
import com.weaver.ebuilder.datasource.api.service.DataSetService;
|
||||
import com.weaver.framework.spring.annotation.AopClass;
|
||||
import com.weaver.seconddev.chapanda.common.SqlResponse;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoFormDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.DemoSearchConditionDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.dto.OrderTypeListDTO;
|
||||
import com.weaver.seconddev.chapanda.entity.param.DemoQueryParam;
|
||||
import com.weaver.seconddev.chapanda.entity.param.OrderTypeQueryParam;
|
||||
import com.weaver.seconddev.chapanda.enums.SQLStatusEnum;
|
||||
import com.weaver.seconddev.chapanda.exception.BusinessRunTimeException;
|
||||
import com.weaver.seconddev.chapanda.exception.SqlRunTimeException;
|
||||
import com.weaver.seconddev.chapanda.mapper.DemoMapper;
|
||||
import com.weaver.seconddev.chapanda.service.PageDemoService;
|
||||
import com.weaver.seconddev.chapanda.util.EntityUtil;
|
||||
import com.weaver.seconddev.chapanda.util.FormatUtil;
|
||||
import com.weaver.seconddev.chapanda.util.PageUtil;
|
||||
import com.weaver.teams.security.context.TenantContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@AopClass
|
||||
@Slf4j
|
||||
public class PageDemoServiceImpl implements PageDemoService {
|
||||
|
||||
@Autowired
|
||||
private DataSetService dataSetService;
|
||||
|
||||
@Autowired
|
||||
private DemoMapper demoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public WeaSearchCondition getSearchCondition() {
|
||||
WeaSearchCondition weaSearchCondition = FormatUtil.<DemoSearchConditionDTO>getInstance()
|
||||
.buildCondition(DemoSearchConditionDTO.class, new DemoSearchConditionDTO(), "demoPage_SearchCondition");
|
||||
return weaSearchCondition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaTable<DemoListDTO> list(DemoQueryParam queryParam) {
|
||||
|
||||
String sql = "select t.id,t.bt,cjrq,fqr,bm,wtms,wd,ebllk,e.username,d.name as bmName,x.mc as gdlxname from uf_gdjcxx t " +
|
||||
"LEFT JOIN eteams.EMPLOYEE e ON e.id = t.fqr " +
|
||||
"LEFT JOIN eteams.DEPARTMENT d ON d.id = e.department " +
|
||||
"LEFT JOIN uf_gdlx x ON t.gdlx = x.id " +
|
||||
"where t.TENANT_KEY = 'tma3ktp1q7' ";
|
||||
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(Base64.encode(sql));
|
||||
executeSqlEntity.setGroupId("weaver-ebuilder-app-service");
|
||||
executeSqlEntity.setSourceType(SourceType.LOGIC);
|
||||
|
||||
Map<String, Object> map = dataSetService.executeSql(executeSqlEntity);
|
||||
SqlResponse<DemoListDTO> sqlResponse = EntityUtil.map2Entity(map, DemoListDTO.class);
|
||||
if (SQLStatusEnum.FAIL.getValue().equals(sqlResponse.getStatus())) {
|
||||
throw new SqlRunTimeException(sqlResponse.getMessage());
|
||||
}
|
||||
List<DemoListDTO> list = sqlResponse.getRecords();
|
||||
|
||||
Page<DemoListDTO> page = PageUtil.buildPage(list, queryParam.getCurrent(), queryParam.getPageSize());
|
||||
WeaTable<DemoListDTO> table = FormatUtil.<DemoListDTO>getInstance().buildTable(DemoListDTO.class, page);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<OrderTypeListDTO> orderTypePage(OrderTypeQueryParam queryParam) {
|
||||
|
||||
String sql = "select t.id,t.mc from uf_gdlx t where t.TENANT_KEY = 'tma3ktp1q7' ";
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(Base64.encode(sql));
|
||||
executeSqlEntity.setGroupId("weaver-ebuilder-app-service");
|
||||
executeSqlEntity.setSourceType(SourceType.LOGIC);
|
||||
|
||||
Map<String, Object> map = dataSetService.executeSql(executeSqlEntity);
|
||||
SqlResponse<OrderTypeListDTO> sqlResponse = EntityUtil.map2Entity(map, OrderTypeListDTO.class);
|
||||
if (SQLStatusEnum.FAIL.getValue().equals(sqlResponse.getStatus())) {
|
||||
throw new SqlRunTimeException(sqlResponse.getMessage());
|
||||
}
|
||||
List<OrderTypeListDTO> list = sqlResponse.getRecords();
|
||||
|
||||
Page<OrderTypeListDTO> page = PageUtil.buildPage(list, queryParam.getCurrent(), queryParam.getPageSize());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeaForm getForm(Long id) {
|
||||
DemoFormDTO dataFormDTO = new DemoFormDTO();
|
||||
if (id != null) {
|
||||
dataFormDTO = demoMapper.getDemoListDTO(id, TenantContext.getCurrentTenantKey());
|
||||
|
||||
if (dataFormDTO == null) {
|
||||
throw new BusinessRunTimeException("数据不存在!");
|
||||
}
|
||||
}
|
||||
|
||||
WeaForm weaForm = FormatUtil.<DemoFormDTO>getInstance().buildForm(DemoFormDTO.class, dataFormDTO);
|
||||
|
||||
return weaForm;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.weaver.seconddev.chapanda.util;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.weaver.seconddev.chapanda.common.SqlResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class EntityUtil {
|
||||
public static <T> SqlResponse<T> map2Entity(Map<String, Object> map, Class<T> clazz) {
|
||||
String s = JSON.toJSONString(map);
|
||||
SqlResponse<T> sqlResponse = JSON.parseObject(s, SqlResponse.class);
|
||||
List<T> list = JSON.parseArray(JSON.toJSONString(map.get("records")), clazz);
|
||||
sqlResponse.setRecords(list);
|
||||
return sqlResponse;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,482 @@
|
|||
package com.weaver.seconddev.chapanda.util;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.weaver.common.authority.annotation.WeaPermissionMetadata;
|
||||
import com.weaver.common.authority.context.PermissionContext;
|
||||
import com.weaver.common.authority.format.WeaSearchConditionWapper;
|
||||
import com.weaver.common.authority.service.AuthorityService;
|
||||
import com.weaver.common.authority.service.MenuPermissionSetDTO;
|
||||
import com.weaver.common.component.browser.combination.TypesBrowserOption;
|
||||
import com.weaver.common.component.browser.entity.WeaBrowserBean;
|
||||
import com.weaver.common.component.browser.entity.WeaTypesBrowserBean;
|
||||
import com.weaver.common.component.form.WeaForm;
|
||||
import com.weaver.common.component.form.group.WeaFormGroup;
|
||||
import com.weaver.common.component.form.item.WeaFormItem;
|
||||
import com.weaver.common.component.form.item.WeaFormItemType;
|
||||
import com.weaver.common.component.form.item.WeaFormOption;
|
||||
import com.weaver.common.component.form.layout.WeaFormLayout;
|
||||
import com.weaver.common.component.search.WeaSearchCondition;
|
||||
import com.weaver.common.component.search.item.WeaSearchConditionItem;
|
||||
import com.weaver.common.component.search.item.WeaSearchConditionItemType;
|
||||
import com.weaver.common.component.search.item.WeaSearchConditionOption;
|
||||
import com.weaver.common.component.search.layout.WeaSearchConditionLayout;
|
||||
import com.weaver.common.component.table.WeaTable;
|
||||
import com.weaver.common.component.table.column.WeaTableColumn;
|
||||
import com.weaver.common.component.table.operate.WeaTableOperate;
|
||||
import com.weaver.common.component.table.page.Page;
|
||||
import com.weaver.common.component.table.permission.Permission;
|
||||
import com.weaver.common.component.table.type.WeaTableTypeEnum;
|
||||
import com.weaver.common.i18n.tool.util.I18nContextUtil;
|
||||
import com.weaver.framework.rpc.context.impl.TenantRpcContext;
|
||||
import com.weaver.framework.util.JsonUtil;
|
||||
import com.weaver.seconddev.chapanda.annotation.*;
|
||||
import com.weaver.seconddev.chapanda.constant.Constant;
|
||||
import com.weaver.seconddev.chapanda.enums.BaseEnum;
|
||||
import com.weaver.teams.security.context.TenantContext;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 前后端组件数据格式化
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@SuppressWarnings("all")
|
||||
public class FormatUtil<T> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(FormatUtil.class);
|
||||
|
||||
private FormatUtil() {
|
||||
}
|
||||
|
||||
public static <T> FormatUtil<T> getInstance() {
|
||||
return new FormatUtil<T>();
|
||||
}
|
||||
|
||||
public WeaTable<T> buildTable(Class<T> clazz, Page page) {
|
||||
Long employeeId = TenantRpcContext.getEmployeeIdLong();
|
||||
String tenantKey = TenantRpcContext.getCurrentTenantKey();
|
||||
if (employeeId == null) {
|
||||
employeeId = TenantRpcContext.getEmployeeIdLong();
|
||||
}
|
||||
if (tenantKey == null) {
|
||||
tenantKey = TenantRpcContext.getCurrentTenantKey();
|
||||
}
|
||||
|
||||
// 加载权限项
|
||||
AuthorityService authorityService = I18nContextUtil.getBean(AuthorityService.class);
|
||||
List<MenuPermissionSetDTO> menuPermissionSets = new ArrayList<>();
|
||||
WeaPermissionMetadata currentPermissionMetadata = PermissionContext.getCurrentPermissionMetadata();
|
||||
if (currentPermissionMetadata != null) {
|
||||
menuPermissionSets = currentPermissionMetadata.getMenuPermissionSetDTOList();
|
||||
}
|
||||
|
||||
WeaTable<T> weaTable = new WeaTable<>();
|
||||
weaTable.setCheckBoxPermission(Collections.emptyList());
|
||||
weaTable.setPageUid(UUID.randomUUID().toString());
|
||||
weaTable.setModule(Constant.MODULE);
|
||||
if (clazz.isAnnotationPresent(Table.class)) {
|
||||
Table tableAnnotation = clazz.getAnnotation(Table.class);
|
||||
weaTable.setModule(tableAnnotation.module());
|
||||
if (StringUtils.isNotEmpty(tableAnnotation.pageUid())) {
|
||||
weaTable.setPageUid(tableAnnotation.pageUid());
|
||||
}
|
||||
weaTable.setTableType(tableAnnotation.tableType());
|
||||
// 构筑operate
|
||||
TableOperate[] tableOperates = tableAnnotation.value();
|
||||
for (TableOperate tableOperate : tableOperates) {
|
||||
WeaTableOperate weaTableOperate = new WeaTableOperate(I18nUtil.getI18nLabel(tenantKey, employeeId, (int) tableOperate.labelId(), tableOperate.text()), tableOperate.index());
|
||||
String permissionSetCode = tableOperate.permissionSetCode();
|
||||
weaTableOperate.setOuter(tableOperate.outer());
|
||||
if (StringUtils.isEmpty(permissionSetCode)) {
|
||||
weaTableOperate.setVisible(true);
|
||||
} else {
|
||||
if (CollectionUtils.isNotEmpty(menuPermissionSets)) {
|
||||
boolean visible = menuPermissionSets.stream().anyMatch(e -> StringUtils.equals(e.getCode(), permissionSetCode));
|
||||
weaTableOperate.setVisible(visible);
|
||||
} else {
|
||||
weaTableOperate.setVisible(authorityService.checkPermissionSet(tableOperate.menuCode(), permissionSetCode));
|
||||
}
|
||||
}
|
||||
weaTable.getOperates().add(weaTableOperate);
|
||||
}
|
||||
}
|
||||
List<List<Permission>> operatePermissionList = new ArrayList<>();
|
||||
List<Permission> checkBoxPermission = new ArrayList<>();
|
||||
for (Object record : page.getRecords()) {
|
||||
List<Permission> permissionList = new ArrayList<>();
|
||||
for (WeaTableOperate operate : weaTable.getOperates()) {
|
||||
Permission permission = new Permission(operate.isVisible(), false);
|
||||
permissionList.add(permission);
|
||||
}
|
||||
operatePermissionList.add(permissionList);
|
||||
checkBoxPermission.add(new Permission(true, false));
|
||||
}
|
||||
weaTable.setOperatesPermission(operatePermissionList);
|
||||
// 构筑checkbox permission
|
||||
if (weaTable.getTableType() == WeaTableTypeEnum.CHECKBOX) {
|
||||
weaTable.setCheckBoxPermission(checkBoxPermission);
|
||||
}
|
||||
List<WeaTableColumn> weaTableColumns = new ArrayList<>();
|
||||
this.buildTableColumns(clazz, employeeId, tenantKey, weaTableColumns);
|
||||
weaTable.getColumns().addAll(weaTableColumns);
|
||||
weaTable.setData(page.getRecords());
|
||||
weaTable.setDisplayData(page.getRecords());
|
||||
weaTable.setCurrent(page.getCurrent());
|
||||
weaTable.setTotal(page.getTotal());
|
||||
weaTable.setPageSize(page.getSize());
|
||||
return weaTable;
|
||||
}
|
||||
|
||||
private void buildTableColumns(Class<? super T> clazz, Long employeeId, String tenantKey, List<WeaTableColumn> weaTableColumns) {
|
||||
if (clazz.equals(Object.class)) {
|
||||
return;
|
||||
}
|
||||
buildTableColumns(clazz.getSuperclass(), employeeId, tenantKey, weaTableColumns);
|
||||
Field[] declaredFields = clazz.getDeclaredFields();
|
||||
for (Field declaredField : declaredFields) {
|
||||
if (!declaredField.isAnnotationPresent(TableColumn.class)) {
|
||||
continue;
|
||||
}
|
||||
TableColumn annotation = declaredField.getAnnotation(TableColumn.class);
|
||||
WeaTableColumn weaTableColumn = new WeaTableColumn(I18nUtil.getI18nLabel(tenantKey, employeeId, (int) annotation.labelId(), annotation.label()), declaredField.getName());
|
||||
weaTableColumn.setHide(annotation.hide());
|
||||
weaTableColumn.setWidth(annotation.width());
|
||||
weaTableColumns.add(weaTableColumn);
|
||||
}
|
||||
}
|
||||
|
||||
// @SneakyThrows
|
||||
// public EditableTable<T> buildEditTable(Class<T> clazz, Page page) {
|
||||
// WeaTable<T> weaTable = buildTable(clazz, page);
|
||||
// EditableTable<T> editableTable = new EditableTable<>(weaTable);
|
||||
// List<SalaryWeaTableColumn> columns = new ArrayList<>();
|
||||
// for (WeaTableColumn column : weaTable.getColumns()) {
|
||||
// SalaryWeaTableColumn salaryWeaTableColumn = new SalaryWeaTableColumn();
|
||||
// BeanUtils.copyProperties(column, salaryWeaTableColumn);
|
||||
// salaryWeaTableColumn.setComKey(column.getDataIndex());
|
||||
// columns.add(salaryWeaTableColumn);
|
||||
// }
|
||||
// editableTable.setColumns(columns);
|
||||
//
|
||||
// Map<String, EditableTableItem> comProps = new HashMap<>();
|
||||
//
|
||||
// Field[] declaredFields = clazz.getDeclaredFields();
|
||||
// for (Field declaredField : declaredFields) {
|
||||
// if (!declaredField.isAnnotationPresent(SalaryEditTableItem.class)) {
|
||||
// continue;
|
||||
// }
|
||||
// SalaryEditTableItem annotation = declaredField.getAnnotation(SalaryEditTableItem.class);
|
||||
//
|
||||
// EditableTableItem editableTableItem = new EditableTableItem(annotation.itemType(),
|
||||
// annotation.defaultValue(), annotation.readOnly(), annotation.required());
|
||||
// comProps.put(declaredField.getName(), editableTableItem);
|
||||
//
|
||||
// Class<? extends BaseEnum> optionsEnum = Arrays.stream(annotation.optionsEnum()).findFirst().orElse(null);
|
||||
// if (optionsEnum != null) {
|
||||
// Method method = null;
|
||||
// if (StringUtils.isNotEmpty(annotation.optionsEnumMethod())){
|
||||
// method = optionsEnum.getMethod(annotation.optionsEnumMethod());
|
||||
// } else {
|
||||
// method = optionsEnum.getMethod("name");
|
||||
// }
|
||||
// BaseEnum[] enumConstants = optionsEnum.getEnumConstants();
|
||||
// List<WeaFormOption> options = Lists.newArrayListWithExpectedSize(enumConstants.length);
|
||||
// for (BaseEnum enumConstant : enumConstants) {
|
||||
// Object value = method.invoke(enumConstant);
|
||||
// options.add(new WeaFormOption(value.toString(),
|
||||
// I18nUtil.getI18nLabel(enumConstant.getLabelId(), enumConstant.getDefaultLabel())));
|
||||
// }
|
||||
// editableTableItem.setData(options);
|
||||
// }
|
||||
// }
|
||||
// editableTable.setComProps(comProps);
|
||||
// return editableTable;
|
||||
// }
|
||||
|
||||
public WeaForm buildForm(Class<T> clazz, Object source) {
|
||||
try {
|
||||
if (source == null) {
|
||||
source = clazz.newInstance();
|
||||
}
|
||||
T t = source.getClass().equals(clazz) ? (T) source : null;
|
||||
if (t == null) {
|
||||
t = clazz.newInstance();
|
||||
BeanUtils.copyProperties(source, t);
|
||||
}
|
||||
Long employeeId = UserContext.getCurrentEmployeeId();
|
||||
String tenantKey = TenantContext.getCurrentTenantKey();
|
||||
|
||||
WeaForm weaForm = new WeaForm();
|
||||
Map<String, Object> dataMap = JsonUtil.parseMap(source, Object.class);
|
||||
Map<String, Object> stringDataMap = Maps.newHashMapWithExpectedSize(dataMap.size());
|
||||
dataMap.forEach((k, v) -> {
|
||||
if (v instanceof Long) {
|
||||
stringDataMap.put(k, Objects.isNull(v) ? "" : ((Long) v).toString());
|
||||
} else {
|
||||
stringDataMap.put(k, v);
|
||||
}
|
||||
});
|
||||
weaForm.setData(stringDataMap);
|
||||
|
||||
String id = stringDataMap.getOrDefault("id", "0").toString();
|
||||
|
||||
List<WeaFormLayout> layouts = Lists.newArrayList();
|
||||
List<WeaFormGroup> groups = Lists.newArrayList();
|
||||
Map<String, List<WeaFormLayout>> layoutMap = Maps.newLinkedHashMap();
|
||||
Field[] declaredFields = clazz.getDeclaredFields();
|
||||
for (Field f : declaredFields) {
|
||||
if (!f.isAnnotationPresent(Form.class)) {
|
||||
continue;
|
||||
}
|
||||
Form formAnnotation = f.getAnnotation(Form.class);
|
||||
for (FormItem itemAnnotation : formAnnotation.items()) {
|
||||
WeaFormItem weaFormItem = new WeaFormItem(itemAnnotation.itemType());
|
||||
weaFormItem.setReadOnly(itemAnnotation.readOnly());
|
||||
weaFormItem.setRequired(itemAnnotation.required());
|
||||
weaFormItem.setMaxLength(itemAnnotation.maxLength());
|
||||
switch (itemAnnotation.itemType()) {
|
||||
case BROWSER:
|
||||
WeaBrowserBean weaBrowserBean = new WeaBrowserBean(itemAnnotation.browserModule(), itemAnnotation.browserType());
|
||||
weaBrowserBean.setMultiple(itemAnnotation.browserMultiple());
|
||||
if (Lists.newArrayList("app", "ebuilderForm", "ebuilderField").contains(weaBrowserBean.getType())) {
|
||||
weaBrowserBean.setCommonParams(ImmutableMap.of("publishStatus", "ALL"));
|
||||
weaBrowserBean.setCompleteParams(ImmutableMap.of("publishStatus", "ALL"));
|
||||
weaBrowserBean.setRequestHeaderParams(ImmutableMap.of("ebBusinessid", "10000000000000000"));
|
||||
}
|
||||
weaFormItem.setBrowserBean(weaBrowserBean);
|
||||
break;
|
||||
case TYPESBROWSER:
|
||||
WeaTypesBrowserBean weaTypesBrowserBean = new WeaTypesBrowserBean(itemAnnotation.browserModule(), itemAnnotation.browserType());
|
||||
weaTypesBrowserBean.setMultiple(itemAnnotation.browserMultiple());
|
||||
weaFormItem.setTypesBrowserBean(weaTypesBrowserBean);
|
||||
break;
|
||||
case SHAREBROWSER:
|
||||
WeaBrowserBean shareBrowserBean = new WeaBrowserBean(itemAnnotation.browserModule(), itemAnnotation.browserType());
|
||||
shareBrowserBean.setMultiple(itemAnnotation.browserMultiple());
|
||||
weaFormItem.setShareBrowserBean(shareBrowserBean);
|
||||
weaFormItem.setOtherParams(ImmutableMap.of("showShareDetail", "true"));
|
||||
break;
|
||||
case LOCALE:
|
||||
String tablefield = "";
|
||||
MultiLanguage languageAnnotation = f.getAnnotation(MultiLanguage.class);
|
||||
if (languageAnnotation != null) {
|
||||
tablefield = languageAnnotation.tablefield();
|
||||
}
|
||||
Map<String, Object> otherParamsMap = Maps.newHashMap();
|
||||
// todo 多语言
|
||||
// otherParamsMap.put("getUrl", itemAnnotation.langLine() ? SalaryMultiLangConstant.GET_URL_LINE : SalaryMultiLangConstant.GET_URL);
|
||||
// otherParamsMap.put("getUrlData", ImmutableMap.of("module", SalaryConstant.MODULE,"tablefield", tablefield, "targetId", Util.null2String(id)));
|
||||
// otherParamsMap.put("saveUrl", itemAnnotation.langLine() ? SalaryMultiLangConstant.SAVE_URL_LINE : SalaryMultiLangConstant.SAVE_URL);
|
||||
// otherParamsMap.put("saveUrlData", ImmutableMap.of("module",SalaryConstant.MODULE,"tablefield", tablefield, "targetId", Util.null2String(id)));
|
||||
otherParamsMap.put("useDefaultLangConfig", true);
|
||||
if (languageAnnotation.itemType() != WeaFormItemType.LOCALE) {
|
||||
otherParamsMap.put("filedType", languageAnnotation.itemType().name());
|
||||
}
|
||||
weaFormItem.setOtherParams(otherParamsMap);
|
||||
break;
|
||||
case INPUTNUMBER:
|
||||
if (itemAnnotation.needNumberSetting()) {
|
||||
Map<String, Object> numberOtherParamsMap = Maps.newHashMap();
|
||||
numberOtherParamsMap.put("max", itemAnnotation.max());
|
||||
numberOtherParamsMap.put("min", itemAnnotation.min());
|
||||
numberOtherParamsMap.put("precision", itemAnnotation.precision());
|
||||
weaFormItem.setOtherParams(numberOtherParamsMap);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Class<? extends BaseEnum> optionsEnum = Arrays.stream(itemAnnotation.optionsEnum()).findFirst().orElse(null);
|
||||
if (StringUtils.isNotEmpty(itemAnnotation.options())) {
|
||||
Method declaredMethod = clazz.getDeclaredMethod(itemAnnotation.options().replaceAll("\\(", "").replaceAll("\\)", ""));
|
||||
declaredMethod.setAccessible(true);
|
||||
Object options = declaredMethod.invoke(t);
|
||||
if (options instanceof List) {
|
||||
List optionsTemp = ((List) options);
|
||||
if (CollectionUtils.isNotEmpty(optionsTemp)) {
|
||||
// 获取泛型list真实类型
|
||||
Object temp = optionsTemp.get(0);
|
||||
if (temp instanceof WeaFormOption) {
|
||||
weaFormItem.setOptions((List<WeaFormOption>) options);
|
||||
} else if (temp instanceof TypesBrowserOption) {
|
||||
weaFormItem.getTypesBrowserBean().setOptions((List<TypesBrowserOption>) options);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (optionsEnum != null) {
|
||||
Method method = null;
|
||||
if (StringUtils.isNotEmpty(itemAnnotation.optionsEnumMethod())) {
|
||||
method = optionsEnum.getMethod(itemAnnotation.optionsEnumMethod());
|
||||
} else {
|
||||
method = optionsEnum.getMethod("name");
|
||||
}
|
||||
BaseEnum[] enumConstants = optionsEnum.getEnumConstants();
|
||||
List<WeaFormOption> options = Lists.newArrayListWithExpectedSize(enumConstants.length);
|
||||
for (BaseEnum enumConstant : enumConstants) {
|
||||
Object value = method.invoke(enumConstant);
|
||||
options.add(new WeaFormOption(value.toString(),
|
||||
I18nUtil.getI18nLabel(tenantKey, employeeId, enumConstant.getLabelId(), enumConstant.getDefaultLabel())));
|
||||
}
|
||||
weaFormItem.setOptions(options);
|
||||
}
|
||||
weaForm.getItems().put(StringUtils.isEmpty(itemAnnotation.name()) ? f.getName() : itemAnnotation.name(), weaFormItem);
|
||||
}
|
||||
List<String> items = Arrays.stream(formAnnotation.items()).map(FormItem::name).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(items)) {
|
||||
items = Lists.newArrayList(f.getName());
|
||||
}
|
||||
WeaFormLayout weaFormLayout = new WeaFormLayout(f.getName(), I18nUtil.getI18nLabel(tenantKey, employeeId, formAnnotation.labelId(), formAnnotation.label()), items.toArray(new String[items.size()]));
|
||||
weaFormLayout.setHide(formAnnotation.hide());
|
||||
weaFormLayout.setLabelSpan(formAnnotation.labelSpan());
|
||||
weaFormLayout.setGroupId(formAnnotation.group());
|
||||
Map<String, Object> otherParamsMap = Maps.newHashMap();
|
||||
otherParamsMap.put("helpfulTip", I18nUtil.getI18nLabel(formAnnotation.tipLabel(), formAnnotation.tip()));
|
||||
weaFormLayout.setOtherParams(otherParamsMap);
|
||||
List<WeaFormLayout> weaFormLayouts = layoutMap.computeIfAbsent(StringUtils.isEmpty(formAnnotation.layout()) ? f.getName() : formAnnotation.layout(), e -> Lists.newArrayList());
|
||||
weaFormLayouts.add(weaFormLayout);
|
||||
}
|
||||
weaForm.getLayout().addAll(layoutMap.values());
|
||||
weaForm.getGroups().addAll(groups);
|
||||
return weaForm;
|
||||
} catch (Exception e) {
|
||||
logger.error("转换成表单数据格式化失败:{}", e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public WeaSearchCondition buildCondition(Class<T> clazz, Object source) {
|
||||
return this.buildCondition(clazz, source, null);
|
||||
}
|
||||
|
||||
public WeaSearchCondition buildCondition(Class<T> clazz, Object source, String conditionId) {
|
||||
try {
|
||||
T t = source.getClass().equals(clazz) ? (T) source : null;
|
||||
if (t == null) {
|
||||
t = clazz.newInstance();
|
||||
BeanUtils.copyProperties(source, t);
|
||||
}
|
||||
|
||||
Long employeeId = UserContext.getCurrentEmployeeId();
|
||||
String tenantKey = TenantContext.getCurrentTenantKey();
|
||||
WeaSearchConditionWapper weaSearchCondition = new WeaSearchConditionWapper(StringUtils.isEmpty(conditionId) ? UUID.randomUUID().toString() : conditionId);
|
||||
List<WeaSearchConditionLayout> otherLayouts = Lists.newArrayListWithExpectedSize(2);
|
||||
List<WeaSearchConditionLayout> commonLayouts = Lists.newArrayListWithExpectedSize(2);
|
||||
List<String> quickSearchKeys = Lists.newArrayList();
|
||||
String module = Constant.MODULE;
|
||||
Field[] declaredFields = clazz.getDeclaredFields();
|
||||
for (Field f : declaredFields) {
|
||||
if (!f.isAnnotationPresent(SearchCondition.class)) {
|
||||
continue;
|
||||
}
|
||||
SearchCondition conditionAnnotation = f.getAnnotation(SearchCondition.class);
|
||||
// 忽略
|
||||
if (conditionAnnotation.ignore()) {
|
||||
continue;
|
||||
}
|
||||
SearchConditionItem[] items = conditionAnnotation.items();
|
||||
for (SearchConditionItem itemAnnotation : items) {
|
||||
WeaSearchConditionItem weaSearchConditionItem = new WeaSearchConditionItem(itemAnnotation.itemType());
|
||||
switch (itemAnnotation.itemType()) {
|
||||
case BROWSER:
|
||||
WeaBrowserBean weaBrowserBean = new WeaBrowserBean(itemAnnotation.browserModule(), itemAnnotation.browserType());
|
||||
weaBrowserBean.setMultiple(itemAnnotation.browserMultiple());
|
||||
weaSearchConditionItem.setBrowserBean(weaBrowserBean);
|
||||
break;
|
||||
case TYPESBROWSER:
|
||||
WeaTypesBrowserBean weaTypesBrowserBean = new WeaTypesBrowserBean(itemAnnotation.browserModule(), itemAnnotation.browserType());
|
||||
weaTypesBrowserBean.setMultiple(itemAnnotation.browserMultiple());
|
||||
weaSearchConditionItem.setTypesBrowserBean(weaTypesBrowserBean);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (itemAnnotation.itemType() == WeaSearchConditionItemType.DATEPICKER && itemAnnotation.isRange()) {
|
||||
Map<String, Object> otherParams = new HashMap<>();
|
||||
otherParams.put("isRange", true);
|
||||
weaSearchConditionItem.setOtherParams(otherParams);
|
||||
}
|
||||
Class<? extends BaseEnum> optionsEnum = Arrays.stream(itemAnnotation.optionsEnum()).findFirst().orElse(null);
|
||||
if (StringUtils.isNotEmpty(itemAnnotation.options())) {
|
||||
Method declaredMethod = clazz.getDeclaredMethod(itemAnnotation.options().replaceAll("\\(", "").replaceAll("\\)", ""));
|
||||
declaredMethod.setAccessible(true);
|
||||
Object options = declaredMethod.invoke(t);
|
||||
if (options instanceof List) {
|
||||
List optionsTemp = ((List) options);
|
||||
if (CollectionUtils.isNotEmpty(optionsTemp)) {
|
||||
// 获取泛型list真实类型
|
||||
Object temp = optionsTemp.get(0);
|
||||
if (temp instanceof WeaSearchConditionOption) {
|
||||
weaSearchConditionItem.setOptions((List<WeaSearchConditionOption>) options);
|
||||
} else if (temp instanceof TypesBrowserOption) {
|
||||
weaSearchConditionItem.getTypesBrowserBean().setOptions((List<TypesBrowserOption>) options);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (optionsEnum != null) {
|
||||
BaseEnum[] enumConstants = optionsEnum.getEnumConstants();
|
||||
List<WeaSearchConditionOption> options = Lists.newArrayListWithExpectedSize(enumConstants.length);
|
||||
for (BaseEnum enumConstant : enumConstants) {
|
||||
options.add(new WeaSearchConditionOption(enumConstant.name(),
|
||||
I18nUtil.getI18nLabel(tenantKey, employeeId, enumConstant.getLabelId(), enumConstant.getDefaultLabel())));
|
||||
}
|
||||
weaSearchConditionItem.setOptions(options);
|
||||
}
|
||||
weaSearchCondition.getItems().put(itemAnnotation.name(), weaSearchConditionItem);
|
||||
}
|
||||
Map<String, List<SearchConditionItem>> itemMapByGroupId = Lists.newArrayList(items).stream()
|
||||
.collect(Collectors.groupingBy(SearchConditionItem::groupId));
|
||||
itemMapByGroupId.forEach((k, v) -> {
|
||||
WeaSearchConditionLayout weaSearchConditionLayout = new WeaSearchConditionLayout(f.getName(),
|
||||
I18nUtil.getI18nLabel(tenantKey, employeeId, conditionAnnotation.labelId(), conditionAnnotation.label()), k,
|
||||
v.stream().map(SearchConditionItem::name).collect(Collectors.toList()).toArray(new String[v.size()]));
|
||||
weaSearchConditionLayout.setLabelSpan(conditionAnnotation.labelSpan());
|
||||
weaSearchConditionLayout.setNeedQuickSearch(conditionAnnotation.needQuickSearch());
|
||||
if (StringUtils.equals(k, "commonGroup")) {
|
||||
commonLayouts.add(weaSearchConditionLayout);
|
||||
if (commonLayouts.size() == 2) {
|
||||
weaSearchCondition.getLayout().add(new ArrayList<>(commonLayouts));
|
||||
commonLayouts.clear();
|
||||
}
|
||||
}
|
||||
if (StringUtils.equals(k, "otherGroup")) {
|
||||
otherLayouts.add(weaSearchConditionLayout);
|
||||
if (otherLayouts.size() == 2) {
|
||||
weaSearchCondition.getLayout().add(new ArrayList<>(otherLayouts));
|
||||
otherLayouts.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (StringUtils.isNotEmpty(conditionAnnotation.quickSearchKey())) {
|
||||
quickSearchKeys.add(conditionAnnotation.quickSearchKey());
|
||||
}
|
||||
}
|
||||
weaSearchCondition.setModule(module);
|
||||
weaSearchCondition.setQuickSearchKey(StringUtils.join(quickSearchKeys.toArray(), ","));
|
||||
if (CollectionUtils.isNotEmpty(commonLayouts)) {
|
||||
weaSearchCondition.getLayout().add(new ArrayList<>(commonLayouts));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(otherLayouts)) {
|
||||
weaSearchCondition.getLayout().add(new ArrayList<>(otherLayouts));
|
||||
}
|
||||
return weaSearchCondition;
|
||||
} catch (Exception e) {
|
||||
logger.error("前后端组件数据格式化失败:{}", e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.weaver.seconddev.chapanda.util;
|
||||
|
||||
import com.weaver.common.i18n.label.SystemEnv;
|
||||
import com.weaver.common.i18n.tool.util.I18nLanguageUtil;
|
||||
|
||||
/**
|
||||
* 多语言工具类
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class I18nUtil {
|
||||
|
||||
/**
|
||||
* 获取多语言信息
|
||||
*
|
||||
* @param labelId 多语言对应的labelId
|
||||
* @param defaultLabel 默认中文
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getI18nLabel(int labelId, String defaultLabel) {
|
||||
return SystemEnv.getHtmlLabelName(labelId, defaultLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多语言信息
|
||||
*
|
||||
* @param tenantKey 租户key
|
||||
* @param employeeId 人员id
|
||||
* @param labelId 多语言对应的labelId
|
||||
* @param defaultLabel 默认中文
|
||||
* @return
|
||||
*/
|
||||
public static String getI18nLabel(String tenantKey, Long employeeId, int labelId, String defaultLabel) {
|
||||
int languageId = I18nLanguageUtil.getLangId(employeeId);
|
||||
return SystemEnv.getHtmlLabelName(labelId, languageId, tenantKey, defaultLabel);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.weaver.seconddev.chapanda.util;
|
||||
|
||||
import com.weaver.common.component.table.page.Page;
|
||||
import com.weaver.common.component.util.CommonPageUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页相关的工具类
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class PageUtil {
|
||||
|
||||
private PageUtil() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static <T> Page<T> buildPage(Long pageNo, Long pageSize) {
|
||||
pageNo = pageNo == null || pageNo <= 0 ? 1L : pageNo;
|
||||
pageSize = pageSize == null || pageSize <= 0 ? 10L : pageSize;
|
||||
return new Page<>(pageNo, pageSize, true);
|
||||
}
|
||||
|
||||
public static <T> Page<T> buildPage(List<T> list, Long pageNo, Long pageSize) {
|
||||
Page<T> dtoPage = buildPage(pageNo, pageSize);
|
||||
// 填充总数和当页数据
|
||||
dtoPage.setTotal(list.size());
|
||||
dtoPage.setRecords(subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list));
|
||||
return dtoPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param pageNo 页码(从1开始)
|
||||
* @param pageSize 每页条数
|
||||
* @param source 待分页的数据
|
||||
* @param <T> 范型制定类
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> subList(int pageNo, int pageSize, List<T> source) {
|
||||
if (CollectionUtils.isEmpty(source)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
int endIndex = pageNo * pageSize;
|
||||
int startIndex = (pageNo - 1) * pageSize;
|
||||
startIndex = Math.max(startIndex, 0);
|
||||
return source.subList(Math.min(startIndex, source.size()),
|
||||
Math.min(endIndex, source.size()));
|
||||
}
|
||||
|
||||
public static Long getPageSize(String pageUid) {
|
||||
return getPageSize(pageUid, 10L);
|
||||
}
|
||||
|
||||
public static Long getPageSize(String pageUid, long defaultPageSize) {
|
||||
long pageSize = CommonPageUtil.getPageSize(pageUid);
|
||||
return pageSize > 0 ? pageSize : defaultPageSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
// 根项目名
|
||||
rootProject.name = 'secondev-chapanda'
|
||||
|
||||
|
||||
def projectNames = []
|
||||
def discoverProjects
|
||||
discoverProjects = { File directory, String prefix ->
|
||||
directory.eachDir { subDir ->
|
||||
def buildFilePath = new File(subDir.getCanonicalPath(), subDir.name + ".gradle");
|
||||
if (buildFilePath.exists()) {
|
||||
def projectPath = buildFilePath.getParentFile().getCanonicalPath();
|
||||
// 判断是否要添加关联引用 根据模块下是否有.disabled文件
|
||||
if (new File(projectPath + File.separator + ".disabled").exists()) {
|
||||
return;
|
||||
}
|
||||
projectNames.add(projectPath)
|
||||
} else if (subDir.isDirectory()) {
|
||||
discoverProjects(new File(subDir.getPath()), prefix + subDir.name + ":")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
discoverProjects(rootProject.projectDir, "")
|
||||
println('root dir: ' + rootDir)
|
||||
projectNames.forEach { projectName ->
|
||||
def proj = new File((String) projectName)
|
||||
// 计算相对路径
|
||||
def rel_path = proj.getCanonicalPath().replace(rootDir.toString() + File.separator, "")
|
||||
def include_path = rel_path.replace(File.separator, ":");
|
||||
println("include: ${rel_path}, ref: ${include_path}")
|
||||
|
||||
include include_path
|
||||
project(":${include_path}").buildFileName = proj.getName() + ".gradle"
|
||||
}
|
||||
Loading…
Reference in New Issue