Compare commits
No commits in common. "main" and "hz_1122" have entirely different histories.
|
@ -1,26 +0,0 @@
|
|||
# ---> Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
# This is spring boot config server
|
||||
# Version 2.1
|
||||
|
||||
FROM openjdk:8u212-jdk-alpine
|
||||
|
||||
MAINTAINER xiusong.xie@northking.net
|
||||
|
||||
EXPOSE 8250
|
||||
|
||||
ENV APP_NAME=atu-data-mgr
|
||||
ENV APP_VERSION=1.0.1-RELEASE
|
||||
|
||||
ENV CCTP_HOME /home/cctp
|
||||
|
||||
ARG SPACE
|
||||
ARG URL
|
||||
ARG SIZE
|
||||
ARG PROFILE
|
||||
ENV NACOS_SPACE=$SPACE
|
||||
ENV NACOS_URL=$URL
|
||||
ENV XMX=$SIZE
|
||||
ENV APP_PROFILE=$PROFILE
|
||||
|
||||
ENV JAR_FILE=${CCTP_HOME}/${APP_NAME}-${APP_VERSION}.ms.jar
|
||||
ENV TRACE_JAVAAGENT_OPTS='-javaagent:/home/cctp/trace-otel/hzb-otel-javaagent.jar -Dotel.javaagent.configuration-file=/home/cctp/trace-otel/trace-otel.properties'
|
||||
#ENV JACOCO_AGENT_OPTS='-javaagent:/home/cctp/jacoco-0.8.7/lib/jacocoagent.jar=includes=*,output=tcpserver,port=8040,address=0.0.0.0,append=true'
|
||||
|
||||
VOLUME ${CCTP_HOME}
|
||||
|
||||
ADD dist ${CCTP_HOME}/
|
||||
RUN chmod a+x ${CCTP_HOME}/nk-ms.sh
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
WORKDIR ${CCTP_HOME}
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "java -jar -Xms${XMX} -Xmx${XMX} ${TRACE_JAVAAGENT_OPTS} -Dfile.encoding=UTF-8 -DAPP_PROFILE=${APP_PROFILE} -DNACOS_NAMESPACE=${NACOS_SPACE} -DNACOS_SERVER_URL=${NACOS_URL} -Dloader.path=.,lib ${JAR_FILE}"]
|
||||
|
||||
#CMD [""]
|
|
@ -0,0 +1,40 @@
|
|||
# This is spring boot config server
|
||||
# Version 2.1
|
||||
|
||||
FROM openjdk:8u212-jdk-alpine
|
||||
|
||||
MAINTAINER xiusong.xie@northking.net
|
||||
|
||||
EXPOSE 8250
|
||||
|
||||
ENV APP_NAME=atu-data-mgr
|
||||
ENV APP_VERSION=1.0.1-RELEASE
|
||||
|
||||
ENV CCTP_HOME /home/cctp
|
||||
|
||||
ARG SPACE
|
||||
ARG URL
|
||||
ARG SIZE
|
||||
ARG PROFILE
|
||||
ENV NACOS_SPACE=$SPACE
|
||||
ENV NACOS_URL=$URL
|
||||
ENV XMX=$SIZE
|
||||
ENV APP_PROFILE=$PROFILE
|
||||
|
||||
ENV JAR_FILE=${CCTP_HOME}/${APP_NAME}-${APP_VERSION}.ms.jar
|
||||
ENV TRACE_JAVAAGENT_OPTS='-javaagent:/home/cctp/trace-otel/hzb-otel-javaagent.jar -Dotel.javaagent.configuration-file=/home/cctp/trace-otel/trace-otel.properties'
|
||||
#ENV JACOCO_AGENT_OPTS='-javaagent:/home/cctp/jacoco-0.8.7/lib/jacocoagent.jar=includes=*,output=tcpserver,port=8040,address=0.0.0.0,append=true'
|
||||
|
||||
VOLUME ${CCTP_HOME}
|
||||
|
||||
ADD dist ${CCTP_HOME}/
|
||||
RUN chmod a+x ${CCTP_HOME}/nk-ms.sh
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
WORKDIR ${CCTP_HOME}
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "java -jar -Xms${XMX} -Xmx${XMX} ${TRACE_JAVAAGENT_OPTS} -Dfile.encoding=UTF-8 -DAPP_PROFILE=${APP_PROFILE} -DNACOS_NAMESPACE=${NACOS_SPACE} -DNACOS_SERVER_URL=${NACOS_URL} -Dloader.path=.,lib ${JAR_FILE}"]
|
||||
|
||||
#CMD [""]
|
|
@ -0,0 +1,40 @@
|
|||
# This is spring boot config server
|
||||
# Version 2.1
|
||||
|
||||
FROM openjdk:8u212-jdk-alpine
|
||||
|
||||
MAINTAINER xiusong.xie@northking.net
|
||||
|
||||
EXPOSE 8250
|
||||
|
||||
ENV APP_NAME=atu-data-mgr
|
||||
ENV APP_VERSION=1.0.1-RELEASE
|
||||
|
||||
ENV CCTP_HOME /home/cctp
|
||||
|
||||
ARG SPACE
|
||||
ARG URL
|
||||
ARG SIZE
|
||||
ARG PROFILE
|
||||
ENV NACOS_SPACE=$SPACE
|
||||
ENV NACOS_URL=$URL
|
||||
ENV XMX=$SIZE
|
||||
ENV APP_PROFILE=$PROFILE
|
||||
|
||||
ENV JAR_FILE=${CCTP_HOME}/${APP_NAME}-${APP_VERSION}.ms.jar
|
||||
ENV TRACE_JAVAAGENT_OPTS='-javaagent:/home/cctp/trace-otel/hzb-otel-javaagent.jar -Dotel.javaagent.configuration-file=/home/cctp/trace-otel/trace-otel.properties'
|
||||
#ENV JACOCO_AGENT_OPTS='-javaagent:/home/cctp/jacoco-0.8.7/lib/jacocoagent.jar=includes=*,output=tcpserver,port=8040,address=0.0.0.0,append=true'
|
||||
|
||||
VOLUME ${CCTP_HOME}
|
||||
|
||||
ADD dist ${CCTP_HOME}/
|
||||
RUN chmod a+x ${CCTP_HOME}/nk-ms.sh
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
WORKDIR ${CCTP_HOME}
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "java -jar -Xms${XMX} -Xmx${XMX} ${TRACE_JAVAAGENT_OPTS} -Dfile.encoding=UTF-8 -DAPP_PROFILE=${APP_PROFILE} -DNACOS_NAMESPACE=${NACOS_SPACE} -DNACOS_SERVER_URL=${NACOS_URL} -Dloader.path=.,lib ${JAR_FILE}"]
|
||||
|
||||
#CMD [""]
|
|
@ -0,0 +1,40 @@
|
|||
# This is spring boot config server
|
||||
# Version 2.1
|
||||
|
||||
FROM openjdk:8u212-jdk-alpine
|
||||
|
||||
MAINTAINER xiusong.xie@northking.net
|
||||
|
||||
EXPOSE 8250
|
||||
|
||||
ENV APP_NAME=atu-data-mgr
|
||||
ENV APP_VERSION=1.0.1-RELEASE
|
||||
|
||||
ENV CCTP_HOME /home/cctp
|
||||
|
||||
ARG SPACE
|
||||
ARG URL
|
||||
ARG SIZE
|
||||
ARG PROFILE
|
||||
ENV NACOS_SPACE=$SPACE
|
||||
ENV NACOS_URL=$URL
|
||||
ENV XMX=$SIZE
|
||||
ENV APP_PROFILE=$PROFILE
|
||||
|
||||
ENV JAR_FILE=${CCTP_HOME}/${APP_NAME}-${APP_VERSION}.ms.jar
|
||||
ENV TRACE_JAVAAGENT_OPTS='-javaagent:/home/cctp/trace-otel/hzb-otel-javaagent.jar -Dotel.javaagent.configuration-file=/home/cctp/trace-otel/trace-otel.properties'
|
||||
ENV JACOCO_AGENT_OPTS='-javaagent:/home/cctp/jacoco-0.8.7/lib/jacocoagent.jar=includes=*,output=tcpserver,port=8040,address=0.0.0.0,append=true'
|
||||
|
||||
VOLUME ${CCTP_HOME}
|
||||
|
||||
ADD dist ${CCTP_HOME}/
|
||||
RUN chmod a+x ${CCTP_HOME}/nk-ms.sh
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
WORKDIR ${CCTP_HOME}
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "java -jar -Xms${XMX} -Xmx${XMX} ${TRACE_JAVAAGENT_OPTS} ${JACOCO_AGENT_OPTS} -Dfile.encoding=UTF-8 -DAPP_PROFILE=${APP_PROFILE} -DNACOS_NAMESPACE=${NACOS_SPACE} -DNACOS_SERVER_URL=${NACOS_URL} -Dloader.path=.,lib ${JAR_FILE}"]
|
||||
|
||||
#CMD [""]
|
|
@ -0,0 +1,179 @@
|
|||
#!/bin/sh
|
||||
|
||||
source /etc/profile
|
||||
|
||||
## 应用名称
|
||||
APP_NAME=atu-data-mgr
|
||||
|
||||
## 镜像版本
|
||||
VERSION=3.0-SNAPSHOT
|
||||
|
||||
## 公司名称
|
||||
corporation=gzrdc
|
||||
|
||||
NACOS_SPACE=UI-DEV
|
||||
NACOS_URL=158.1.12.237:8848
|
||||
JVM=256M
|
||||
PROFILE=dev
|
||||
|
||||
## 镜像仓库配置
|
||||
DOCKER_REGISTRY=harbor.hzbtest:8443
|
||||
|
||||
##dockerfile 文件名配置
|
||||
FILE_NAME=Dockerfile
|
||||
while getopts "a:v:d:f:n:u:s:p:" arg
|
||||
do
|
||||
case $arg in
|
||||
a)
|
||||
echo "set APP_NAME=$OPTARG"
|
||||
APP_NAME=$OPTARG
|
||||
;;
|
||||
v)
|
||||
echo "VERSION=$OPTARG"
|
||||
VERSION=$OPTARG
|
||||
;;
|
||||
d)
|
||||
echo "set DOCKER_REGISTRY=$OPTARG"
|
||||
DOCKER_REGISTRY=$OPTARG
|
||||
;;
|
||||
f)
|
||||
echo "set FILE_NAME=$OPTARG"
|
||||
FILE_NAME=$OPTARG
|
||||
;;
|
||||
n)
|
||||
echo "set NACOS_SPACE=$OPTARG"
|
||||
NACOS_SPACE=$OPTARG
|
||||
;;
|
||||
u)
|
||||
echo "set NACOS_URL=$OPTARG"
|
||||
NACOS_URL=$OPTARG
|
||||
;;
|
||||
s)
|
||||
echo "set JVM=$OPTARG"
|
||||
JVM=$OPTARG
|
||||
;;
|
||||
p)
|
||||
echo "set PROFILE=$OPTARG"
|
||||
PROFILE=$OPTARG
|
||||
;;
|
||||
?)
|
||||
echo "unkown argument: $? $OPTARG "
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
TAG_NAME=${DOCKER_REGISTRY}/${corporation}/${APP_NAME}
|
||||
## deployment yaml
|
||||
DEPLOYMENT_YAML=${APP_NAME}.deployment.yaml
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
clean_Container() {
|
||||
## 获取运行 容器ID
|
||||
RUN_ID=$(docker ps |grep ${APP_NAME}|awk '{print $1}')
|
||||
|
||||
## 先停止容器
|
||||
if [ "${RUN_ID}" = "" ]; then
|
||||
echo "Container ${APP_NAME} is not starting "
|
||||
else
|
||||
## 停止 docker容器
|
||||
docker stop ${RUN_ID}
|
||||
echo "Container ${APP_NAME} , ID: ${RUN_ID} is stopped "
|
||||
fi
|
||||
|
||||
## 获取已停止 容器ID
|
||||
STOP_ID=$(docker ps -a |grep ${APP_NAME}|awk '{print $1}')
|
||||
## 删除容器
|
||||
if [ "${STOP_ID}" = "" ]; then
|
||||
echo "Container ${APP_NAME} is not exist"
|
||||
else
|
||||
## 移除 docker容器
|
||||
docker rm -v ${STOP_ID}
|
||||
echo "Remove container ${APP_NAME} , ID: ${STOP_ID} "
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
clean_Image() {
|
||||
## 获取 镜像ID
|
||||
IMG_ID=$(docker images |grep ${APP_NAME}|awk '{print $3}')
|
||||
|
||||
if [ "${IMG_ID}" = "" ]; then
|
||||
echo "Image ${TAG_NAME} is not exist "
|
||||
else
|
||||
## 移除 docker镜像
|
||||
docker rmi ${TAG_NAME}
|
||||
echo "Remove image ${TAG_NAME} , ID: ${IMG_ID} "
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
get_agent(){
|
||||
## 获取agent 文件
|
||||
mkdir -p target/dist/trace-otel/
|
||||
wget -P target/dist/trace-otel/ http://devops.hzbtest:38081/repository/raw-distribution/rdc/uts/core/hzb-otel-javaagent.jar
|
||||
wget -P target/dist/trace-otel/ http://158.1.0.78:8081/repository/raw-distribution/rdc/uts/core/trace-otel.properties
|
||||
sed -i "s?SUBSYS_ZZZ?SUBSYS_ATU_DATAM?g" target/dist/trace-otel/trace-otel.properties
|
||||
## 添加jacoco的agent
|
||||
cp -r /home/northking/agent/jacoco-0.8.7 target/dist/
|
||||
}
|
||||
|
||||
|
||||
for command in $*
|
||||
do
|
||||
echo "execute : ${command}"
|
||||
|
||||
case "${command}" in
|
||||
clean)
|
||||
clean_Container
|
||||
clean_Image
|
||||
;;
|
||||
build)
|
||||
$0 clean
|
||||
mvn --update-snapshots clean package
|
||||
get_agent
|
||||
## 创建镜像
|
||||
docker build --build-arg SIZE=${JVM} --build-arg PROFILE=${PROFILE} --build-arg SPACE=${NACOS_SPACE} --build-arg URL=${NACOS_URL} -f ${FILE_NAME} -t ${TAG_NAME} target/
|
||||
;;
|
||||
debug)
|
||||
clean_Container
|
||||
|
||||
docker run -itd --net=host --privileged=true --name ${APP_NAME} ${TAG_NAME}
|
||||
sleep 2
|
||||
## 输出容器日志
|
||||
RUN_ID=$(docker ps -a |grep ${APP_NAME}|awk '{print $1}')
|
||||
docker logs -f -t ${RUN_ID}
|
||||
;;
|
||||
push)
|
||||
docker push ${TAG_NAME}
|
||||
docker tag ${TAG_NAME} ${TAG_NAME}:${VERSION}
|
||||
docker push ${TAG_NAME}:${VERSION}
|
||||
docker rmi -f ${TAG_NAME}
|
||||
docker rmi -f ${TAG_NAME}:${VERSION}
|
||||
;;
|
||||
pull)
|
||||
$0 clean
|
||||
docker pull ${TAG_NAME}
|
||||
;;
|
||||
deploy)
|
||||
kubectl delete -f ${DEPLOYMENT_YAML}
|
||||
sleep 2
|
||||
kubectl apply -f ${DEPLOYMENT_YAML}
|
||||
sleep 2
|
||||
;;
|
||||
logs)
|
||||
for pod in $(kubectl -n cctp get pod |grep ${APP_NAME}|awk '{print $1}')
|
||||
do
|
||||
echo "get logs by pod=${pod}"
|
||||
kubectl -n cctp logs -f --tail=200 --follow=false ${pod}
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {clean|build|debug|push|deploy|logs}"
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="log_path" value="logs"/>
|
||||
<!-- 参数 -->
|
||||
<springProperty name="app_name" source="spring.application.name"/>
|
||||
<springProperty name="app_instance_id" source="eureka.instance.instance-id"/>
|
||||
|
||||
<springProperty name="rabbitmq_host" source="spring.rabbitmq.host"/>
|
||||
<springProperty name="rabbitmq_vhost" source="spring.rabbitmq.virtual-host"/>
|
||||
<springProperty name="rabbitmq_username" source="spring.rabbitmq.username"/>
|
||||
<springProperty name="rabbitmq_password" source="spring.rabbitmq.password"/>
|
||||
|
||||
|
||||
|
||||
<!-- 控制台日志 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level | %X{trace_id} | %X{span_id} | [%thread] %-5level %logger{36} : %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 本地日志文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log_path}/${app_name}.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log_path}/${app_name}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<maxHistory>10</maxHistory>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level | %X{trace_id} | %X{span_id} | [%thread] %-5level %logger{36} : %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 日志发送到消息队列RabbitMQ ,接入ELK-->
|
||||
<appender name="RabbitMQ" class="org.springframework.amqp.rabbit.logback.AmqpAppender">
|
||||
<!--Layout(纯文本)而不是格式化的JSON -->
|
||||
<layout>
|
||||
<pattern>
|
||||
{
|
||||
"appName":"${app_name}",
|
||||
"appInstance":"${app_instance_id}",
|
||||
"date":"%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"thread":"[%thread]",
|
||||
"level":"%-5level",
|
||||
"logger":"%logger{36}",
|
||||
"msg":"%msg"
|
||||
}
|
||||
</pattern>
|
||||
</layout>
|
||||
<host>${rabbitmq_host}</host>
|
||||
<port>5672</port>
|
||||
<username>${rabbitmq_username}</username>
|
||||
<password>${rabbitmq_password}</password>
|
||||
<virtualHost>${rabbitmq_vhost}</virtualHost>
|
||||
<!-- 消息队列配置 -->
|
||||
<declareExchange>false</declareExchange>
|
||||
<exchangeType>direct</exchangeType>
|
||||
<exchangeName>logs.direct</exchangeName>
|
||||
<routingKeyPattern>logback</routingKeyPattern>
|
||||
<generateId>true</generateId>
|
||||
<durable>false</durable>
|
||||
<charset>UTF-8</charset>
|
||||
<deliveryMode>NON_PERSISTENT</deliveryMode>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>info</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<logger name="org.hibernate.engine.spi.QueryParameters" level="DEBUG"/>
|
||||
<logger name="org.hibernate.engine.query.spi.HQLQueryPlan" level="DEBUG"/>
|
||||
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE"/>
|
||||
<!-- <logger name="com.zaxxer.hikari.pool.HikariPool" level="DEBUG"/>-->
|
||||
<logger name="net.northking" level="DEBUG"/>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<!-- <appender-ref ref="RabbitMQ"/>-->
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>net.northking.cctp</groupId>
|
||||
<artifactId>cctp-parent</artifactId>
|
||||
<version>1.0.1-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>atu-data-mgr</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<!-- The main class to start by executing java -jar -->
|
||||
<start-class>net.northking.cctp.dataPool.DataPoolApplication</start-class>
|
||||
<quartz.version>2.3.2</quartz.version>
|
||||
<json.version>1.2.62</json.version>
|
||||
<es.version>7.4.0</es.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<!-- maven plugin: code generator -->
|
||||
<plugin>
|
||||
<groupId>net.northking.cctp</groupId>
|
||||
<artifactId>cctp-maven-plugin</artifactId>
|
||||
<version>0.0.141-RELEASE</version>
|
||||
<configuration>
|
||||
<jdbcDriver>com.mysql.cj.jdbc.Driver</jdbcDriver>
|
||||
<jdbcUrl>jdbc:mysql://192.168.77.26:3306/atu_data_mgr?useUnicode=true&characterEncoding=utf-8&useSSL=false</jdbcUrl>
|
||||
<jdbcUsername>northking</jdbcUsername>
|
||||
<jdbcPassword>northking@002987</jdbcPassword>
|
||||
<database>atu_data_mgr</database>
|
||||
<schema>atu_data_mgr</schema>
|
||||
<tableNames>data_sets,data_set_tree,data_rule,data_resource_package</tableNames>
|
||||
<basePackage>net.northking.cctp.dataPool</basePackage>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.mifmif</groupId>
|
||||
<artifactId>generex</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.northking.cctp</groupId>
|
||||
<artifactId>cctp-commons</artifactId>
|
||||
<version>${cctp-commons.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-config-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>1.9.5</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>io.minio</groupId>-->
|
||||
<!-- <artifactId>minio</artifactId>-->
|
||||
<!-- <version>8.1.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.plist</groupId>
|
||||
<artifactId>dd-plist</artifactId>
|
||||
<version>1.23</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache-extras.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
<version>2.0b6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,116 @@
|
|||
#!/bin/sh
|
||||
|
||||
SERVER_IP=192.168.77.22
|
||||
SERVER_PORT=9090
|
||||
|
||||
NK_HOME_DEFAULT=/home/northking
|
||||
PRODUCTION_NAME=cctp
|
||||
APP_NAME=atu-data-mgr
|
||||
APP_VERSION=3.0-SNAPSHOT
|
||||
JAR_FILE=${APP_NAME}-${APP_VERSION}.ms.jar
|
||||
APP_PORT=8911
|
||||
|
||||
JAVA_OPTIONS="-Xmx256M -Dfile.encoding=UTF-8 -Dloader.path=.,lib"
|
||||
PORT_OPTIONS="--server.port=${APP_PORT}"
|
||||
|
||||
if [ 0"$NK_HOME" = "0" ]; then
|
||||
echo "NK_HOME unset, use default value : $NK_HOME_DEFAULT"
|
||||
NK_HOME=${NK_HOME_DEFAULT}
|
||||
fi
|
||||
|
||||
|
||||
PID=$(ps aux | grep ${JAR_FILE} | grep -v grep | awk '{print $2}' )
|
||||
|
||||
check_if_process_is_running() {
|
||||
if [ "$PID" = "" ]; then
|
||||
return 1
|
||||
fi
|
||||
ps -p $PID | grep "java"
|
||||
return $?
|
||||
}
|
||||
|
||||
install_upgrade() {
|
||||
upgrade_url="http://${SERVER_IP}:${SERVER_PORT}/${PRODUCTION_NAME}/${APP_VERSION}/${APP_NAME}"
|
||||
rm -rf ${JAR_FILE}
|
||||
wget ${upgrade_url}/${JAR_FILE}
|
||||
|
||||
rm -rf install.list
|
||||
wget ${upgrade_url}/install.list
|
||||
|
||||
mkdir -p config
|
||||
mkdir -p lib
|
||||
|
||||
|
||||
cd config
|
||||
rm -rf application.yml
|
||||
wget ${upgrade_url}/config/application.yml
|
||||
|
||||
cd ../lib
|
||||
rm -rf *
|
||||
for filename in `cat ../install.list`
|
||||
do
|
||||
echo ${filename}
|
||||
wget http://${SERVER_IP}:${SERVER_PORT}/lib/${filename}
|
||||
done
|
||||
|
||||
cd ..
|
||||
}
|
||||
|
||||
|
||||
|
||||
case "$1" in
|
||||
upgrade)
|
||||
$0 stop
|
||||
install_upgrade
|
||||
;;
|
||||
status)
|
||||
if check_if_process_is_running
|
||||
then
|
||||
echo -e "\033[32m $APP_NAME is running \033[0m"
|
||||
else
|
||||
echo -e "\033[32m $APP_NAME not running \033[0m"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if ! check_if_process_is_running
|
||||
then
|
||||
echo -e "\033[32m $APP_NAME already stopped \033[0m"
|
||||
exit 0
|
||||
fi
|
||||
kill -9 $PID
|
||||
echo -e "\033[32m $APP_NAME already stopped \033[0m"
|
||||
;;
|
||||
start)
|
||||
if [ "$PID" != "" ] && check_if_process_is_running
|
||||
then
|
||||
echo -e "\033[32m $APP_NAME already running \033[0m"
|
||||
exit 1
|
||||
fi
|
||||
nohup java -jar ${JAVA_OPTIONS} ${JAR_FILE} ${PORT_OPTIONS} > /dev/null 2>&1 &
|
||||
echo -ne "\033[32m Starting \033[0m"
|
||||
|
||||
if check_if_process_is_running
|
||||
then
|
||||
echo -e "\033[32m $APP_NAME fail \033[0m"
|
||||
else
|
||||
echo -e "\033[32m $APP_NAME started \033[0m"
|
||||
fi
|
||||
;;
|
||||
debug)
|
||||
java -jar ${JAVA_OPTIONS} ${JAR_FILE} ${PORT_OPTIONS}
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
if [ $? = 1 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status|upgrade|debug}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,36 @@
|
|||
package net.northking.cctp.dataPool;
|
||||
|
||||
import cn.gjing.tools.auth.config.EnableAuthorization;
|
||||
import net.northking.cctp.common.config.EnableNKCloud;
|
||||
import net.northking.cctp.common.config.EnableNKWebMvc;
|
||||
import net.northking.cctp.common.s3.EnableS3;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@MapperScan({"net.northking.cctp.dataPool.db.mapper", "net.northking.cctp.dataPool.db.dao"})
|
||||
@EnableNKCloud
|
||||
@EnableNKWebMvc
|
||||
@EnableS3
|
||||
@EnableAuthorization
|
||||
@EnableTransactionManagement // 开启事务
|
||||
@EnableFeignClients(basePackages = {"net.northking.cctp.dataPool.feign", "net.northking.cctp.common.feign", "com.hzbank.testteam.autotest"})
|
||||
@ComponentScan(basePackages = {"net.northking.cctp.dataPool","com.hzbank.testteam.autotest"})
|
||||
public class DataPoolApplication {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataPoolApplication.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
logger.info("微服务启动----开始 .................");
|
||||
SpringApplication.run(DataPoolApplication.class, args);
|
||||
logger.info("微服务启动----完成 .................");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataRule;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.dataPool.api.dataRule.service.DataResourcePackageApiService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageQueryDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageUpdateDto;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 资源包 => Restful 类型 HTTP/HTTPS 接口
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
@Api(tags = "资源包")
|
||||
@RequestMapping("/v1")
|
||||
@RestController
|
||||
public class DataResourcePackageRestfulCtrl
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataResourcePackageRestfulCtrl.class);
|
||||
|
||||
@Autowired
|
||||
private DataResourcePackageApiService apiService;
|
||||
|
||||
@ApiOperation("上传资源包")
|
||||
@PostMapping("/dataResourcePackage/uploadResource")
|
||||
public ResultWrapper<DataResourcePackage> uploadResource(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("proId") String proId,@RequestParam(name = "memo",required = false) String memo) {
|
||||
ResultWrapper<DataResourcePackage> wrapper = new ResultWrapper<>();
|
||||
DataResourcePackage result = apiService.uploadResource(file,proId,memo);
|
||||
return wrapper.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询列表:公共资源表")
|
||||
@PostMapping(value = "/paging/query/dataResourcePackages",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Pagination<DataResourcePackageDetailDto>> pagingQuery(
|
||||
@RequestBody @Validated QueryByPage<DataResourcePackageQueryDto> queryByPage)
|
||||
{
|
||||
ResultWrapper<Pagination<DataResourcePackageDetailDto>> wrapper = new ResultWrapper<>();
|
||||
Pagination<DataResourcePackageDetailDto> page = apiService.pagingQuery(queryByPage);
|
||||
return wrapper.success(page);
|
||||
}
|
||||
|
||||
@ApiOperation("修改资源包说明")
|
||||
@PostMapping("/dataResourcePackage/updateResource")
|
||||
public ResultWrapper<Integer> updateResource(@RequestBody @Validated DataResourcePackageUpdateDto update) throws IllegalAccessException {
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer result = apiService.updateByPK(update);
|
||||
return wrapper.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("删除资源包")
|
||||
@DeleteMapping("/dataResourcePackage/deleteResource")
|
||||
public ResultWrapper<Integer> deleteResource(@RequestParam("resourceId") String resourceId){
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer result = apiService.deleteByPK(resourceId);
|
||||
return wrapper.success(result);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package net.northking.cctp.dataPool.api.dataRule;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.dataPool.api.dataRule.service.DataRuleApiService;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/pub")
|
||||
@Api(tags = "数据集管理无token请求")
|
||||
public class DataRulePubCtrl {
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataRulePubCtrl.class);
|
||||
|
||||
@Autowired
|
||||
private DataRuleApiService apiService;
|
||||
|
||||
@ApiOperation(value = "执行计划根据规则名称取值")
|
||||
@GetMapping(value = "/dataRule/getRuleDataByName")
|
||||
public ResultWrapper<String> getRuleDataByName(@RequestParam String ruleName,@RequestParam String proId) throws Exception
|
||||
{
|
||||
if (StringUtils.isBlank(ruleName) || StringUtils.isBlank(proId)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.PARAM_IS_MISSING);
|
||||
}
|
||||
ResultWrapper<String> wrapper = new ResultWrapper<>();
|
||||
String decodeRuleName = URLDecoder.decode(ruleName, StandardCharsets.UTF_8.name());
|
||||
String result = apiService.getRuleDataByName(decodeRuleName,proId);
|
||||
return wrapper.success(result);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataRule;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import cn.gjing.tools.auth.annotation.RequiredPermissions;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.*;
|
||||
import net.northking.cctp.dataPool.api.dataRule.service.DataRuleApiService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuDataSetFeignDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据规则表 => Restful 类型 HTTP/HTTPS 接口
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
@Api(tags = "数据规则表")
|
||||
@RequestMapping("/v1/DataRules")
|
||||
@RestController
|
||||
public class DataRuleRestfulCtrl
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataRuleRestfulCtrl.class);
|
||||
|
||||
@Autowired
|
||||
private DataRuleApiService apiService;
|
||||
|
||||
/**
|
||||
* Restful接口-post: 新增数据规则表
|
||||
*
|
||||
* @param inputDto 接口数据传输对象
|
||||
* @return 主键
|
||||
*/
|
||||
@ApiOperation(value = "新增:数据规则表")
|
||||
@RequiredPermissions("ui-saveDataRules")
|
||||
@PostMapping(
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<String> add(
|
||||
@RequestBody @Validated DataRuleAddDto inputDto)
|
||||
{
|
||||
ResultWrapper<String> wrapper = new ResultWrapper<>();
|
||||
String uuid = apiService.add(inputDto);
|
||||
return wrapper.success(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-put: 更新数据规则表
|
||||
*
|
||||
* @param inputDto 接口数据传输对象
|
||||
* @return 修改的记录数量
|
||||
*/
|
||||
@ApiOperation(value = "更新:数据规则表")
|
||||
@RequiredPermissions("ui-updateDataRules")
|
||||
@PutMapping(
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> update(
|
||||
@RequestBody @Validated DataRuleUpdateDto inputDto) throws IllegalAccessException
|
||||
{
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer count = apiService.updateByPK(inputDto);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-get: 获取数据规则表
|
||||
*
|
||||
* @param uuid 主键
|
||||
* @return 接口数据传输对象
|
||||
*/
|
||||
@ApiOperation(value = "获取:数据规则表")
|
||||
@GetMapping(
|
||||
value = "/{uuid}",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<DataRuleDetailDto> findByPK(
|
||||
@PathVariable("uuid") String uuid)
|
||||
{
|
||||
ResultWrapper<DataRuleDetailDto> wrapper = new ResultWrapper<>();
|
||||
DataRuleDetailDto dto = apiService.findByPK(uuid);
|
||||
return wrapper.success(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-delete: 删除数据规则表
|
||||
*
|
||||
* @param uuid 主键
|
||||
* @return 删除的记录数量
|
||||
*/
|
||||
@ApiOperation(value = "删除:数据规则表")
|
||||
@RequiredPermissions("ui-deleteDataRules")
|
||||
@DeleteMapping(
|
||||
value = "/{uuid}",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> deleteByPK(
|
||||
@PathVariable("uuid") String uuid)
|
||||
{
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer count = apiService.deleteByPK(uuid);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询 数据规则表 列表
|
||||
*
|
||||
* @param queryByPage 查询条件
|
||||
* @return 数据列表
|
||||
*/
|
||||
@ApiOperation(value = "分页查询列表:数据规则表")
|
||||
@RequiredPermissions("testData")
|
||||
@PostMapping(value = "/paging/query/DataRules",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Pagination<DataRuleDetailDto>> pagingQuery(
|
||||
@RequestBody @Validated QueryByPage<DataRuleQueryDto> queryByPage)
|
||||
{
|
||||
ResultWrapper<Pagination<DataRuleDetailDto>> wrapper = new ResultWrapper<>();
|
||||
Pagination<DataRuleDetailDto> page = apiService.pagingQuery(queryByPage);
|
||||
return wrapper.success(page);
|
||||
}
|
||||
|
||||
@ApiOperation("测试规则")
|
||||
@PostMapping("/executeRule")
|
||||
public ResultWrapper<List<String>> executeRule(@RequestBody DataRuleExecuteDto dto){
|
||||
ResultWrapper<List<String>> wrapper = new ResultWrapper<>();
|
||||
List<String> result = apiService.executeRule(dto);
|
||||
return wrapper.success(result);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询模糊数据集名称集合")
|
||||
@PostMapping(value = "/query/queryFuzzyDataNameMap",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public Map<String, String> queryFuzzyDataNameMap(@RequestBody AtuDataSetFeignDto setFeignDto){
|
||||
return apiService.queryFuzzyDataNameMap(setFeignDto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询模糊数据引用信息")
|
||||
@PostMapping(value = "/query/queryFuzzyDataQuoteInfo")
|
||||
public ResultWrapper<AtuScriptInputSetQuoteFieldDto> queryFuzzyDataQuoteInfo(@RequestBody AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto){
|
||||
logger.debug(" start queryFuzzyDataQuoteInfo parmas => {}", JSON.toJSONString(atuScriptInputSetQuoteFieldDto));
|
||||
|
||||
ResultWrapper<AtuScriptInputSetQuoteFieldDto> wrapper = new ResultWrapper<>();
|
||||
AtuScriptInputSetQuoteFieldDto result = apiService.queryFuzzyDataQuoteInfo(atuScriptInputSetQuoteFieldDto);
|
||||
|
||||
logger.debug(" end queryFuzzyDataQuoteInfo result => {}", JSON.toJSONString(result));
|
||||
|
||||
return wrapper.success(result);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataRule.service;
|
||||
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.db.excel.ExcelService;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageQueryDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageUpdateDto;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 资源包Restful逻辑接口
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface DataResourcePackageApiService extends ExcelService
|
||||
{
|
||||
/**
|
||||
* 查询资源包列表
|
||||
*
|
||||
* @param queryByPage 查询条件
|
||||
* @return 查询结果列表
|
||||
*/
|
||||
Pagination<DataResourcePackageDetailDto> pagingQuery(QueryByPage<DataResourcePackageQueryDto> queryByPage);
|
||||
|
||||
/**
|
||||
* 更新资源包
|
||||
*
|
||||
* @param dto 接口数据传输对象
|
||||
* @return 修改的记录数量
|
||||
*/
|
||||
Integer updateByPK(DataResourcePackageUpdateDto dto) throws IllegalAccessException;
|
||||
|
||||
/**
|
||||
* 删除资源包
|
||||
* @param uuid 主键
|
||||
* @return 删除的记录数量
|
||||
*/
|
||||
Integer deleteByPK(String uuid);
|
||||
|
||||
/**
|
||||
* 上传资源包
|
||||
* @return
|
||||
*/
|
||||
DataResourcePackage uploadResource(MultipartFile file,String proId,String memo);
|
||||
}
|
|
@ -0,0 +1,283 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataRule.service;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import net.northking.cctp.common.cache.EntityNameCache;
|
||||
import net.northking.cctp.common.cache.EntityNameCatalog;
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.common.db.DefaultPagination;
|
||||
import net.northking.cctp.common.db.OrderBy;
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.db.annotation.DatabaseReadOnly;
|
||||
import net.northking.cctp.common.db.excel.AbstractExcelService;
|
||||
import net.northking.cctp.common.db.excel.ExcelHeader;
|
||||
import net.northking.cctp.common.enums.FileBusinessTypeEnum;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.common.s3.NKFile;
|
||||
import net.northking.cctp.common.s3.SimpleStorageService;
|
||||
import net.northking.cctp.common.security.authentication.NKSecurityContext;
|
||||
import net.northking.cctp.common.util.UUIDUtil;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
import net.northking.cctp.dataPool.db.service.DataResourcePackageService;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageQueryDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageUpdateDto;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import net.northking.cctp.dataPool.utils.MinioPathUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源包服务实现类
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataResourcePackageApiServiceImpl")
|
||||
public class DataResourcePackageApiServiceImpl extends AbstractExcelService<DataResourcePackage> implements DataResourcePackageApiService
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataResourcePackageApiServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private DataResourcePackageService dataResourcePackageService;
|
||||
@Autowired
|
||||
private MinioPathUtils pathUtils;
|
||||
@Autowired
|
||||
private SimpleStorageService simpleStorageService;
|
||||
@Autowired
|
||||
private EntityNameCache entityNameCache;
|
||||
|
||||
@Override
|
||||
public BasicService<DataResourcePackage> getService()
|
||||
{
|
||||
return this.dataResourcePackageService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExcelHeader[] excelHeaders()
|
||||
{
|
||||
ExcelHeader id = new ExcelHeader("id", "id", String.class);
|
||||
ExcelHeader name = new ExcelHeader("资源包名称", "name", String.class);
|
||||
ExcelHeader memo = new ExcelHeader("资源包描述", "memo", String.class);
|
||||
ExcelHeader packageAddr = new ExcelHeader("资源包存放地址", "packageAddr", String.class);
|
||||
ExcelHeader proId = new ExcelHeader("系统id", "proId", String.class);
|
||||
ExcelHeader tenantId = new ExcelHeader("租户id", "tenantId", String.class);
|
||||
ExcelHeader createdBy = new ExcelHeader("创建人", "createdBy", String.class);
|
||||
ExcelHeader updatedBy = new ExcelHeader("更新人", "updatedBy", String.class);
|
||||
ExcelHeader createdTime = new ExcelHeader("创建时间", "createdTime", Date.class);
|
||||
ExcelHeader updatedTime = new ExcelHeader("更新时间", "updatedTime", Date.class);
|
||||
return new ExcelHeader[]{};
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel导入,入库之前的处理
|
||||
* @param records 从Excel读取到的记录
|
||||
* @return 待入库的记录
|
||||
*/
|
||||
@Override
|
||||
protected List<DataResourcePackage> beforeInsertBatch(List<DataResourcePackage> records)
|
||||
{
|
||||
for (DataResourcePackage record : records)
|
||||
{
|
||||
record.setId(UUIDUtil.create32UUID());
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入Excel之前的处理<br>
|
||||
* 数据的特殊处理在此处加工处理
|
||||
*
|
||||
* @param record 来自数据库记录
|
||||
* @return 待写入Excel的记录
|
||||
*/
|
||||
@Override
|
||||
protected DataResourcePackage beforeWriteExcel(DataResourcePackage record)
|
||||
{
|
||||
return record;
|
||||
}
|
||||
|
||||
//= Excel 导入导出相关代码 end =======================//
|
||||
|
||||
//= 增删改查 相关代码 start ==================//
|
||||
@Override
|
||||
@DatabaseReadOnly
|
||||
public Pagination<DataResourcePackageDetailDto> pagingQuery(QueryByPage<DataResourcePackageQueryDto> queryByPage)
|
||||
{
|
||||
DefaultPagination<DataResourcePackageDetailDto> pagination = new DefaultPagination<>();
|
||||
handlePageParam(queryByPage); //处理分页、排序参数
|
||||
//租户隔离
|
||||
queryByPage.getQuery().setTenantId(NKSecurityContext.getTenantId());
|
||||
pagination.setPageSize(queryByPage.getPageSize());
|
||||
pagination.setPageNo(queryByPage.getPageNo());
|
||||
|
||||
Page<DataResourcePackageDetailDto> page = PageMethod.startPage(queryByPage.getPageNo(), queryByPage.getPageSize());
|
||||
List<DataResourcePackageDetailDto> result = dataResourcePackageService.getDataResourcePackages(queryByPage);
|
||||
if (!CollectionUtils.isEmpty(result)) {
|
||||
for (DataResourcePackageDetailDto data : result) {
|
||||
data.setCreator(entityNameCache.translateById(EntityNameCatalog.MONSTER_USER,data.getCreatedBy()));
|
||||
}
|
||||
}
|
||||
pagination.setRecords(result);
|
||||
pagination.setRecordCount(page.getTotal());
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
|
||||
public Integer updateByPK(DataResourcePackageUpdateDto dto) throws IllegalAccessException
|
||||
{
|
||||
DataResourcePackage oldData = dataResourcePackageService.findByPrimaryKey(dto.getId());
|
||||
if (oldData == null) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RESOURCE_PACKAGE_IS_NULL);
|
||||
}
|
||||
DataResourcePackage entity = new DataResourcePackage();
|
||||
BeanUtils.copyProperties(oldData, entity);
|
||||
entity.setUpdatedTime(new Date());
|
||||
entity.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
entity.setMemo(dto.getMemo());
|
||||
return this.dataResourcePackageService.updateByPrimaryKey(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
|
||||
public Integer deleteByPK(String uuid)
|
||||
{
|
||||
DataResourcePackage oldData = dataResourcePackageService.findByPrimaryKey(uuid);
|
||||
if (oldData == null) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RESOURCE_PACKAGE_IS_NULL);
|
||||
}
|
||||
String oldPath = oldData.getPackageAddr();
|
||||
//删除数据
|
||||
DataResourcePackage entity = new DataResourcePackage();
|
||||
BeanUtils.copyProperties(oldData, entity);
|
||||
int res = this.dataResourcePackageService.deleteByPrimaryKey(entity);
|
||||
//删除文件
|
||||
deleteFile(oldPath);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
|
||||
public DataResourcePackage uploadResource(MultipartFile file,String proId,String memo) {
|
||||
logger.info("上传资源包,资源包名称:{},资源包大小:{}B", file.getOriginalFilename(), file.getSize());
|
||||
//1.获取前端传过来的文件 判断是否为空
|
||||
if (file.isEmpty()) {
|
||||
//判断文件的大小是否为空 如果为空 给出提示信息提示
|
||||
throw new PlatformRuntimeException(DataPoolError.IMPORT_FILE_IS_NULL);
|
||||
}
|
||||
//读取文件名
|
||||
String fileName = file.getOriginalFilename();
|
||||
//获取文件名的后缀 并判断
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
if (!suffix.endsWith(".jar")) {
|
||||
throw new PlatformRuntimeException(DataPoolError.IMPORT_FILE_FORMART_IS_ERROR);
|
||||
}
|
||||
try {
|
||||
DataResourcePackage query = new DataResourcePackage();
|
||||
query.setName(fileName);
|
||||
List<DataResourcePackage> list = this.dataResourcePackageService.query(query);
|
||||
boolean add = true;
|
||||
DataResourcePackage dataResourcePackage = null;
|
||||
String oldPath = "";
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
//存在同名资源包则做覆盖
|
||||
dataResourcePackage = list.get(0);
|
||||
oldPath = dataResourcePackage.getPackageAddr();
|
||||
add = false;
|
||||
} else {
|
||||
DataResourcePackage resource = new DataResourcePackage();
|
||||
resource.setId(UUIDUtil.create32UUID());
|
||||
resource.setName(fileName);
|
||||
dataResourcePackage = resource;
|
||||
}
|
||||
try {
|
||||
NKFile nkFile = simpleStorageService.upload(NKSecurityContext.getTenantId(), file, dataResourcePackage.getId(), FileBusinessTypeEnum.DATA_RUL_RESOURCE_PACKAGE);
|
||||
String filePath = nkFile.getId();
|
||||
String fileId = MinioPathUtils.pathToId(NKSecurityContext.getTenantId(),filePath);
|
||||
dataResourcePackage.setPackageAddr(fileId);
|
||||
} catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_UPLOAD_ERROR);
|
||||
}
|
||||
|
||||
dataResourcePackage.setProId(proId);
|
||||
dataResourcePackage.setMemo(memo);
|
||||
dataResourcePackage.setCreatedBy(NKSecurityContext.getUserId());
|
||||
dataResourcePackage.setTenantId(NKSecurityContext.getTenantId());
|
||||
dataResourcePackage.setUpdatedBy(dataResourcePackage.getCreatedBy());
|
||||
dataResourcePackage.setCreatedTime(new Date());
|
||||
dataResourcePackage.setUpdatedTime(dataResourcePackage.getCreatedTime());
|
||||
if (add) {
|
||||
this.dataResourcePackageService.insert(dataResourcePackage);
|
||||
} else {
|
||||
this.dataResourcePackageService.updateByPrimaryKey(dataResourcePackage);
|
||||
//删除原文件
|
||||
if (StringUtils.hasText(oldPath)) {
|
||||
deleteFile(oldPath);
|
||||
}
|
||||
}
|
||||
logger.info("资源包上传完成,路径:{}",dataResourcePackage.getPackageAddr());
|
||||
return dataResourcePackage;
|
||||
} catch (Exception e) {
|
||||
logger.error("上传资源包失败:",e);
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RESOURCE_PACKAGE_UPLOAD_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理分页查询参数
|
||||
*
|
||||
* @param query
|
||||
*/
|
||||
private void handlePageParam(QueryByPage<DataResourcePackageQueryDto> query) {
|
||||
if (query.getPageNo() <= 0) {
|
||||
query.setPageNo(1);
|
||||
}
|
||||
if (query.getPageSize() <= 0 || query.getPageSize() > 500) {
|
||||
query.setPageSize(500);
|
||||
}
|
||||
OrderBy sort = query.toSqlOrderBy();
|
||||
if (sort != null && sort.isNotEmpty() && StringUtils.hasText(sort.toString())) {
|
||||
PageMethod.orderBy(sort.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据url删除服务器端文件
|
||||
* @param url
|
||||
*/
|
||||
private void deleteFile(String url) {
|
||||
String[] pathData = pathUtils.idToPath(url);
|
||||
try {
|
||||
simpleStorageService.delete(pathData[0], "/" + pathData[1]);
|
||||
} catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_DEL_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataRule.service;
|
||||
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.db.excel.ExcelService;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.*;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuDataSetFeignDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据规则表Restful逻辑接口
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface DataRuleApiService extends ExcelService
|
||||
{
|
||||
/**
|
||||
* 查询数据规则表列表
|
||||
*
|
||||
* @param queryByPage 查询条件
|
||||
* @return 查询结果列表
|
||||
*/
|
||||
Pagination<DataRuleDetailDto> pagingQuery(QueryByPage<DataRuleQueryDto> queryByPage);
|
||||
|
||||
/**
|
||||
* 新增数据规则表
|
||||
*
|
||||
* @param dto 接口数据传输对象
|
||||
* @return 主键
|
||||
*/
|
||||
String add(DataRuleAddDto dto);
|
||||
|
||||
/**
|
||||
* 更新数据规则表
|
||||
*
|
||||
* @param dto 接口数据传输对象
|
||||
* @return 修改的记录数量
|
||||
*/
|
||||
Integer updateByPK(DataRuleUpdateDto dto) throws IllegalAccessException;
|
||||
|
||||
/**
|
||||
* 获取数据规则表
|
||||
* @param uuid 主键
|
||||
* @return 接口数据传输对象
|
||||
*/
|
||||
DataRuleDetailDto findByPK(String uuid);
|
||||
|
||||
/**
|
||||
* 删除数据规则表
|
||||
* @param uuid 主键
|
||||
* @return 删除的记录数量
|
||||
*/
|
||||
Integer deleteByPK(String uuid);
|
||||
|
||||
/**
|
||||
* 测试规则
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<String> executeRule(DataRuleExecuteDto dto);
|
||||
|
||||
/**
|
||||
* 执行计划根据规则名称取值
|
||||
* @param ruleName
|
||||
* @param proId
|
||||
* @return
|
||||
*/
|
||||
String getRuleDataByName(String ruleName, String proId);
|
||||
|
||||
Map<String, String> queryFuzzyDataNameMap(AtuDataSetFeignDto setFeignDto);
|
||||
|
||||
AtuScriptInputSetQuoteFieldDto queryFuzzyDataQuoteInfo(AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto);
|
||||
}
|
|
@ -0,0 +1,595 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataRule.service;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.mifmif.common.regex.Generex;
|
||||
import net.northking.cctp.common.cache.EntityNameCache;
|
||||
import net.northking.cctp.common.cache.EntityNameCatalog;
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.common.db.DefaultPagination;
|
||||
import net.northking.cctp.common.db.OrderBy;
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.db.annotation.DatabaseReadOnly;
|
||||
import net.northking.cctp.common.db.excel.AbstractExcelService;
|
||||
import net.northking.cctp.common.db.excel.ExcelHeader;
|
||||
import net.northking.cctp.common.dto.CpLogAddDto;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.feign.MonsterLogServer;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.common.s3.SimpleStorageService;
|
||||
import net.northking.cctp.common.security.authentication.NKSecurityContext;
|
||||
import net.northking.cctp.common.util.UUIDUtil;
|
||||
import net.northking.cctp.dataPool.bus.LogRabbitMQPublisher;
|
||||
import net.northking.cctp.dataPool.constants.DataPoolConstant;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataRule;
|
||||
import net.northking.cctp.dataPool.db.service.DataResourcePackageService;
|
||||
import net.northking.cctp.dataPool.db.service.DataRuleService;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.*;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuDataSetFeignDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import net.northking.cctp.dataPool.feign.ScriptFeignClient;
|
||||
import net.northking.cctp.dataPool.feign.dto.AtuInputDataSetResultDto;
|
||||
import net.northking.cctp.dataPool.utils.MinioPathUtils;
|
||||
import net.northking.cctp.dataPool.utils.MyUrlClassLoader;
|
||||
import net.northking.cctp.dataPool.utils.ScriptUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 数据规则表服务实现类
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataRuleApiServiceImpl")
|
||||
public class DataRuleApiServiceImpl extends AbstractExcelService<DataRule> implements DataRuleApiService
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataRuleApiServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private DataRuleService dataRuleService;
|
||||
@Autowired
|
||||
private DataResourcePackageService dataResourcePackageService;
|
||||
@Autowired
|
||||
private MinioPathUtils pathUtils;
|
||||
@Autowired
|
||||
private EntityNameCache entityNameCache;
|
||||
@Autowired
|
||||
private SimpleStorageService simpleStorageService;
|
||||
@Autowired
|
||||
private LogRabbitMQPublisher logPublisher;
|
||||
@Autowired
|
||||
private ScriptFeignClient scriptFeignClient;
|
||||
|
||||
@Override
|
||||
public BasicService<DataRule> getService()
|
||||
{
|
||||
return this.dataRuleService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExcelHeader[] excelHeaders()
|
||||
{
|
||||
ExcelHeader ruleId = new ExcelHeader("规则id", "ruleId", String.class);
|
||||
ExcelHeader name = new ExcelHeader("规则名称", "name", String.class);
|
||||
ExcelHeader type = new ExcelHeader("规则类型", "type", String.class);
|
||||
ExcelHeader contentExpression = new ExcelHeader("正则表达式、脚本编码", "contentExpression", String.class);
|
||||
ExcelHeader jarIds = new ExcelHeader("资源包集合", "jarIds", String.class);
|
||||
ExcelHeader proId = new ExcelHeader("系统id", "proId", String.class);
|
||||
ExcelHeader tenantId = new ExcelHeader("租户id", "tenantId", String.class);
|
||||
ExcelHeader createdBy = new ExcelHeader("创建人", "createdBy", String.class);
|
||||
ExcelHeader createdTime = new ExcelHeader("创建时间", "createdTime", Date.class);
|
||||
ExcelHeader updatedBy = new ExcelHeader("更新人", "updatedBy", String.class);
|
||||
ExcelHeader updatedTime = new ExcelHeader("更新时间", "updatedTime", Date.class);
|
||||
return new ExcelHeader[]{};
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel导入,入库之前的处理
|
||||
* @param records 从Excel读取到的记录
|
||||
* @return 待入库的记录
|
||||
*/
|
||||
@Override
|
||||
protected List<DataRule> beforeInsertBatch(List<DataRule> records)
|
||||
{
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入Excel之前的处理<br>
|
||||
* 数据的特殊处理在此处加工处理
|
||||
*
|
||||
* @param record 来自数据库记录
|
||||
* @return 待写入Excel的记录
|
||||
*/
|
||||
@Override
|
||||
protected DataRule beforeWriteExcel(DataRule record)
|
||||
{
|
||||
return record;
|
||||
}
|
||||
|
||||
//= Excel 导入导出相关代码 end =======================//
|
||||
|
||||
//= 增删改查 相关代码 start ==================//
|
||||
@Override
|
||||
@DatabaseReadOnly
|
||||
public Pagination<DataRuleDetailDto> pagingQuery(QueryByPage<DataRuleQueryDto> queryByPage)
|
||||
{
|
||||
DefaultPagination<DataRuleDetailDto> pagination = new DefaultPagination<>();
|
||||
DataRuleQueryDto queryDto = queryByPage.getQuery();
|
||||
//处理查询参数
|
||||
if (null != queryDto) {
|
||||
DataRuleQueryDto dataRuleQueryDto = handleQueryParam(queryDto);
|
||||
//无符合条件创建人
|
||||
if (null == dataRuleQueryDto) {
|
||||
return pagination;
|
||||
}
|
||||
queryByPage.setQuery(dataRuleQueryDto);
|
||||
}
|
||||
//数据租户隔离
|
||||
queryByPage.getQuery().setTenantId(NKSecurityContext.getTenantId());
|
||||
handlePageParam(queryByPage); //处理分页、排序参数
|
||||
pagination.setPageSize(queryByPage.getPageSize());
|
||||
pagination.setPageNo(queryByPage.getPageNo());
|
||||
|
||||
Page<DataRuleDetailDto> page = PageMethod.startPage(queryByPage.getPageNo(), queryByPage.getPageSize());
|
||||
List<DataRuleDetailDto> result = dataRuleService.getDataRules(queryByPage);
|
||||
if (!CollectionUtils.isEmpty(result)) {
|
||||
for (DataRuleDetailDto data : result) {
|
||||
data.setProjectName(entityNameCache.translateById(EntityNameCatalog.MONSTER_SYSTEM.name(),data.getProId()));
|
||||
data.setCreator(entityNameCache.translateById(EntityNameCatalog.MONSTER_USER,data.getCreatedBy()));
|
||||
data.setModifier(entityNameCache.translateById(EntityNameCatalog.MONSTER_USER,data.getUpdatedBy()));
|
||||
}
|
||||
}
|
||||
pagination.setRecords(result);
|
||||
pagination.setRecordCount(page.getTotal());
|
||||
return pagination;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String add(DataRuleAddDto dto)
|
||||
{
|
||||
logger.debug("规则重名校验");
|
||||
long startTime = System.currentTimeMillis();
|
||||
DataRule dataRule = new DataRule();
|
||||
dataRule.setName(dto.getName());
|
||||
dataRule.setProId(dto.getProId());
|
||||
List<DataRule> dataRuleList = dataRuleService.query(dataRule);
|
||||
if (!CollectionUtils.isEmpty(dataRuleList)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_NAME_IS_EXSIT);
|
||||
}
|
||||
logger.debug("规则类型校验");
|
||||
String type = dto.getType();
|
||||
String contentExpression = dto.getContentExpression();
|
||||
if (!StringUtils.hasText(contentExpression)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_EXP_IS_NULL);
|
||||
}
|
||||
//校验是否为正确表达式
|
||||
if ("1".equals(type)) {
|
||||
try {
|
||||
Pattern.compile(contentExpression);
|
||||
//特殊符号前反斜杠校验 @#
|
||||
char[] chars = contentExpression.toCharArray();
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] == '@' || chars[i] == '#') {
|
||||
if (i == 0 || chars[i-1] != '\\') {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_REXP_IS_VALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成随机字符串
|
||||
Generex generex = new Generex(contentExpression);
|
||||
String genValue = generex.random();
|
||||
logger.debug("Rexp:{}, res: {}",contentExpression,genValue);
|
||||
}catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_REXP_IS_VALID);
|
||||
}
|
||||
}
|
||||
logger.debug("保存数据库数据");
|
||||
String uuid = UUIDUtil.create32UUID();
|
||||
DataRule entity = new DataRule();
|
||||
BeanUtils.copyProperties(dto, entity);
|
||||
entity.setRuleId(uuid);
|
||||
entity.setCreatedBy(NKSecurityContext.getUserId());
|
||||
entity.setCreatedTime(new Date());
|
||||
entity.setUpdatedBy(entity.getCreatedBy());
|
||||
entity.setUpdatedTime(entity.getCreatedTime());
|
||||
entity.setTenantId(NKSecurityContext.getTenantId());
|
||||
this.dataRuleService.insert(entity);
|
||||
logger.debug("新增模糊数据完成,耗时: {}", System.currentTimeMillis() - startTime);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
|
||||
public Integer updateByPK(DataRuleUpdateDto dto) throws IllegalAccessException
|
||||
{
|
||||
//规则存在校验
|
||||
DataRule oldRule = dataRuleService.findByPrimaryKey(dto.getRuleId());
|
||||
if (null == oldRule) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_IS_NULL);
|
||||
}
|
||||
//规则同名校验
|
||||
if (!StringUtils.hasText(dto.getProId())) {
|
||||
dto.setProId(oldRule.getProId());
|
||||
}
|
||||
Integer count = dataRuleService.queryRuleByName(dto);
|
||||
if (count > 0) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_NAME_IS_EXSIT);
|
||||
}
|
||||
//规则类型校验
|
||||
String type = dto.getType();
|
||||
String contentExpression = dto.getContentExpression();
|
||||
if (!StringUtils.hasText(contentExpression)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_EXP_IS_NULL);
|
||||
}
|
||||
//校验是否为正确表达式
|
||||
if ("1".equals(type)) {
|
||||
try {
|
||||
Pattern.compile(contentExpression);
|
||||
//特殊符号前反斜杠校验 @#
|
||||
char[] chars = contentExpression.toCharArray();
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] == '@' || chars[i] == '#') {
|
||||
if (i == 0 || chars[i-1] != '\\') {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_REXP_IS_VALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成随机字符串
|
||||
Generex generex = new Generex(contentExpression);
|
||||
String genValue = generex.random();
|
||||
logger.debug("Rexp:{}, res: {}",contentExpression,genValue);
|
||||
}catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_REXP_IS_VALID);
|
||||
}
|
||||
}
|
||||
//修改数据规则
|
||||
DataRule entity = new DataRule();
|
||||
BeanUtils.copyProperties(oldRule, entity);
|
||||
entity.setName(dto.getName());
|
||||
entity.setContentExpression(dto.getContentExpression());
|
||||
entity.setJarIds(dto.getJarIds());
|
||||
entity.setType(dto.getType());
|
||||
entity.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
entity.setUpdatedTime(new Date());
|
||||
int res = this.dataRuleService.updateByPrimaryKey(entity);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DatabaseReadOnly
|
||||
public DataRuleDetailDto findByPK(String uuid)
|
||||
{
|
||||
DataRule rule = dataRuleService.findByPrimaryKey(uuid);
|
||||
if (null == rule) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_IS_NULL);
|
||||
}
|
||||
DataRuleDetailDto dto = new DataRuleDetailDto();
|
||||
BeanUtils.copyProperties(rule, dto);
|
||||
//封装资源包信息列表
|
||||
String jarIds = rule.getJarIds();
|
||||
if (StringUtils.hasText(jarIds)) {
|
||||
String[] jarIdList = jarIds.split(",");
|
||||
List<String> idList = Arrays.asList(jarIdList);
|
||||
List<DataResourcePackage> jarInfos = dataResourcePackageService.queryByIds(idList);
|
||||
List<DataResourcePackageInfoDto> jars = new ArrayList<>();
|
||||
for (DataResourcePackage jarInfo : jarInfos) {
|
||||
DataResourcePackageInfoDto infoDto = new DataResourcePackageInfoDto();
|
||||
infoDto.setJarId(jarInfo.getId());
|
||||
infoDto.setName(jarInfo.getName());
|
||||
jars.add(infoDto);
|
||||
}
|
||||
dto.setJarInfoList(jars);
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
|
||||
public Integer deleteByPK(String uuid)
|
||||
{
|
||||
DataRule rule = dataRuleService.findByPrimaryKey(uuid);
|
||||
if (null == rule) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_IS_NULL);
|
||||
}
|
||||
// 校验是否被引用
|
||||
//校验数据是否存在关联
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(uuid);
|
||||
List<AtuInputDataSetResultDto> dtos = scriptFeignClient.selectLinkBySetId(list);
|
||||
for (AtuInputDataSetResultDto dto : dtos) {
|
||||
if (dto.getCountNum() > 0){
|
||||
throw new PlatformRuntimeException(DataPoolError.FUZZY_DATA_SET_HAS_LINK);
|
||||
}
|
||||
}
|
||||
//删除数据规则
|
||||
int num = dataRuleService.deleteByPrimaryKey(uuid);
|
||||
//记录平台日志
|
||||
CpLogAddDto cpLogAddDto = new CpLogAddDto();
|
||||
String projectName = entityNameCache.translateById(EntityNameCatalog.MONSTER_SYSTEM.name(), rule.getProId());
|
||||
cpLogAddDto.setContent("【" + DataPoolConstant.CPLOGADDDTO_CONTENT_DELETE+"模糊测试数据】系统:" + projectName + ",规则名称:" + rule.getName());
|
||||
cpLogAddDto.setModule(DataPoolConstant.CPLOGADDDTO_DATA_POOL_MANAGEMENT);
|
||||
cpLogAddDto.setType(DataPoolConstant.CPLOGADDDTO_LOG_TYPE_DELETE);
|
||||
MonsterLogServer.sendLogToMonster(cpLogAddDto);
|
||||
logPublisher.deployLogContent(cpLogAddDto);
|
||||
return num;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> executeRule(DataRuleExecuteDto dto) {
|
||||
List<String> res = new ArrayList<>();
|
||||
//规则类型校验
|
||||
String type = dto.getType();
|
||||
String contentExpression = dto.getContentExpression();
|
||||
MyUrlClassLoader loader = null;
|
||||
if (!StringUtils.hasText(contentExpression)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_EXP_IS_NULL);
|
||||
}
|
||||
//正则表达式类型
|
||||
if ("1".equals(type)) {
|
||||
//校验是否为正确表达式
|
||||
try {
|
||||
Pattern.compile(contentExpression);
|
||||
//特殊符号前反斜杠校验 @#
|
||||
char[] chars = contentExpression.toCharArray();
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] == '@' || chars[i] == '#') {
|
||||
if (i == 0 || chars[i-1] != '\\') {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_REXP_IS_VALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
//表达式含Unicode需解码
|
||||
String exp = decodeExpression(chars);
|
||||
Pattern.compile(exp);
|
||||
//生成随机字符串
|
||||
Generex generex = new Generex(exp);
|
||||
String genValue = generex.random();
|
||||
logger.debug("Rexp:{}, exp:{}, res: {}",contentExpression,exp,genValue);
|
||||
res.add(genValue);
|
||||
}catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_REXP_IS_VALID);
|
||||
}
|
||||
}else if ("0".equals(type)) {
|
||||
//beanshell脚本类型
|
||||
String jarIds = dto.getJarIds();
|
||||
loader = new MyUrlClassLoader();
|
||||
if (StringUtils.hasText(jarIds)) {
|
||||
//有jar包依赖
|
||||
String[] jars = jarIds.split(",");
|
||||
//查询jar包路径
|
||||
for (String jar : jars) {
|
||||
//跳过空串
|
||||
if (!StringUtils.hasText(jar)) {
|
||||
continue;
|
||||
}
|
||||
//根据jar包id获取路径(同一jar包被删除后重新上传jar包id会改变)
|
||||
DataResourcePackage resourcePackage = dataResourcePackageService.findByPrimaryKey(jar);
|
||||
//下载jar包,并进行加载
|
||||
try {
|
||||
if (Objects.nonNull(resourcePackage)) {//资源包记录存在
|
||||
if (StringUtils.hasText(resourcePackage.getPackageAddr())) {
|
||||
//路径存在
|
||||
String path = resourcePackage.getPackageAddr();
|
||||
String[] result = pathUtils.idToPath(path);
|
||||
File file = simpleStorageService.downloadAsFile(result[0], "/" + result[1]);
|
||||
loader.addURLFile(file);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("资源包加载异常", e);
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RESOURCE_PACKAGE_LOAD_FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
//执行脚本1次
|
||||
res = ScriptUtil.executesBeanShell(contentExpression,1);
|
||||
if (res.contains(null)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_EXECUTE_RESULT_IS_NULL);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("脚本执行异常", e);
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_EXECUTE_RESULT_IS_EXCEPTION);
|
||||
}finally {
|
||||
if (loader != null){
|
||||
//删除文件夹下文件
|
||||
loader.unloadJarFiles();
|
||||
try {
|
||||
loader.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_NOT_SUPPORT_TYPE);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Unicode字符串解码成普通字符
|
||||
* @param chars
|
||||
* @return
|
||||
*/
|
||||
private String decodeExpression(char[] chars) {
|
||||
//存储解码后的字符串
|
||||
StringBuilder tempSb = new StringBuilder();
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
//查找unicode前缀
|
||||
if (chars[i] == '\\' && i != chars.length-1 && chars[i+1] == 'u') {
|
||||
StringBuilder hexSb = new StringBuilder(); //unicode中十六进制部分
|
||||
StringBuilder zeroSb = new StringBuilder(); //unicode中左位补零部分
|
||||
StringBuilder otherSb = new StringBuilder(); //不满足unicode十六进制部分
|
||||
//从第二位开始,跳过前缀直接处理十六进制(后四位)
|
||||
for (int j = 2; j <= 5; j++) {
|
||||
char tmpChar = chars[i + j];
|
||||
//判断当前符号是否满足十六进制条件 0-9a-f
|
||||
if (checkHex(tmpChar)) {
|
||||
hexSb.append(tmpChar);
|
||||
}else {
|
||||
//后四位中不满足条件,则左位补零凑齐四位,同时记录后续不满足字符
|
||||
zeroSb.append("0");
|
||||
otherSb.append(tmpChar);
|
||||
}
|
||||
}
|
||||
//补零位加上十六进制位凑齐四位完整unicode码
|
||||
zeroSb.append(hexSb);
|
||||
//十六进制转换成字符
|
||||
char ch = (char) Integer.parseInt(zeroSb.toString(),16);
|
||||
tempSb.append(ch);
|
||||
tempSb.append(otherSb);
|
||||
//直接从转换后的字符开始处理
|
||||
i = i+5;
|
||||
continue;
|
||||
}
|
||||
//非unicode编码部分则直接记录
|
||||
tempSb.append(chars[i]);
|
||||
}
|
||||
return tempSb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前符号是否满足十六进制条件 0-9a-fA-F
|
||||
* @param c
|
||||
* @return
|
||||
*/
|
||||
private boolean checkHex(char c) {
|
||||
boolean res = false;
|
||||
if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || (c >= '0' && c <= '9')) {
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRuleDataByName(String ruleName, String proId) {
|
||||
DataRule dataRule = new DataRule();
|
||||
dataRule.setName(ruleName);
|
||||
dataRule.setProId(proId);
|
||||
List<DataRule> dataRules = dataRuleService.query(dataRule);
|
||||
if (!CollectionUtils.isEmpty(dataRules)) {
|
||||
DataRule tempRule = dataRules.get(0);
|
||||
if (null != tempRule) {
|
||||
DataRuleExecuteDto execRule = new DataRuleExecuteDto();
|
||||
BeanUtils.copyProperties(tempRule,execRule);
|
||||
try {
|
||||
List<String> resultList = executeRule(execRule);
|
||||
if (!CollectionUtils.isEmpty(resultList)) {
|
||||
return resultList.get(0);
|
||||
}else {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_EXECUTE_RESULT_IS_NULL);
|
||||
}
|
||||
}catch (PlatformRuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_RULE_IS_NULL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> queryFuzzyDataNameMap(AtuDataSetFeignDto setFeignDto) {
|
||||
Map<String, String> dataRuleNameMap = new HashMap<>();
|
||||
Set<String> dataSetList = setFeignDto.getDataSetList();
|
||||
if (dataSetList == null || dataSetList.size() <= 0){
|
||||
logger.debug("查询的id集合为空");
|
||||
return dataRuleNameMap;
|
||||
}
|
||||
List<DataRule> dataRuleList = dataRuleService.queryByIdSet(dataSetList);
|
||||
if (dataRuleList == null || dataRuleList.size() <= 0){
|
||||
logger.debug("查询的数据规则为空");
|
||||
return dataRuleNameMap;
|
||||
}
|
||||
for (DataRule dataRule : dataRuleList) {
|
||||
dataRuleNameMap.put(dataRule.getRuleId(), dataRule.getName());
|
||||
}
|
||||
return dataRuleNameMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AtuScriptInputSetQuoteFieldDto queryFuzzyDataQuoteInfo(AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto) {
|
||||
AtuScriptInputSetQuoteFieldDto quoteFieldDto = new AtuScriptInputSetQuoteFieldDto();
|
||||
if (atuScriptInputSetQuoteFieldDto.getSetId() == null){
|
||||
throw new PlatformRuntimeException(DataPoolError.PARAM_IS_MISSING);
|
||||
}
|
||||
DataRule dataRule = dataRuleService.findByPrimaryKey(atuScriptInputSetQuoteFieldDto.getSetId());
|
||||
if (dataRule == null){
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_NO_EXISTS);
|
||||
}
|
||||
quoteFieldDto.setFullName(dataRule.getName());
|
||||
quoteFieldDto.setName(dataRule.getName());
|
||||
quoteFieldDto.setPath(dataRule.getName());
|
||||
quoteFieldDto.setType(DataPoolConstant.INPUT_SET_QUOTE_TYPE_FUZZY);
|
||||
quoteFieldDto.setValue(DataPoolConstant.FUZZY_DATA_QUOTE_PREFIX + dataRule.getName() + DataPoolConstant.FUZZY_DATA_QUOTE_SUFFIX);
|
||||
return quoteFieldDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理分页查询参数
|
||||
*
|
||||
* @param query
|
||||
*/
|
||||
private void handlePageParam(QueryByPage<DataRuleQueryDto> query) {
|
||||
if (query.getPageNo() <= 0) {
|
||||
query.setPageNo(1);
|
||||
}
|
||||
if (query.getPageSize() <= 0 || query.getPageSize() > 500) {
|
||||
query.setPageSize(500);
|
||||
}
|
||||
OrderBy sort = query.toSqlOrderBy();
|
||||
if (sort != null && sort.isNotEmpty() && StringUtils.hasText(sort.toString())) {
|
||||
PageMethod.orderBy(sort.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理查询参数
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
private DataRuleQueryDto handleQueryParam(DataRuleQueryDto query) {
|
||||
DataRuleQueryDto res = new DataRuleQueryDto();
|
||||
BeanUtils.copyProperties(query, res);
|
||||
//创建人查询参数修改
|
||||
String creatorName = query.getCreator();
|
||||
if (StringUtils.hasText(creatorName)) {
|
||||
List<String> creatorIds = new ArrayList<>();
|
||||
creatorIds.add(creatorName);
|
||||
res.setCreatorIds(creatorIds);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets;
|
||||
|
||||
import cn.gjing.tools.auth.annotation.RequiredPermissions;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.dataPool.api.dataSets.service.DataSetEnvRelApiService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "数据集环境关联表")
|
||||
@RequestMapping("/v1")
|
||||
@RestController
|
||||
public class DataSetEnvRelCtrl
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataSetEnvRelCtrl.class);
|
||||
|
||||
@Autowired
|
||||
private DataSetEnvRelApiService apiService;
|
||||
|
||||
/**
|
||||
* 导出单环境下的数据集数据
|
||||
* @param dataSetEnvRelQueryDto
|
||||
* @param response
|
||||
*/
|
||||
@ApiOperation(value = "导出Excel:数据集环境关联表")
|
||||
@RequiredPermissions("ui-exportDataSetEnvRels")
|
||||
@PostMapping(value = "/excel/export/DataSetEnvRels",
|
||||
produces = MediaType.APPLICATION_OCTET_STREAM_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public void exportExcel(
|
||||
@RequestBody @Validated DataSetEnvRelQueryDto dataSetEnvRelQueryDto,
|
||||
HttpServletResponse response)
|
||||
{
|
||||
apiService.exportExcel(response, dataSetEnvRelQueryDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单环境数据导入
|
||||
* @param file
|
||||
* @param dataSetId
|
||||
* @param envId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "导入Excel:单环境数据导入")
|
||||
@PostMapping(value = "/excel/import/DataSetEnvRels",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ResultWrapper<DataSetsSaveDto> importExcel(
|
||||
@RequestParam("file") MultipartFile file,@RequestParam("dataSetId") String dataSetId,@RequestParam("envId") String envId,@RequestParam("tableHeaders") String tableHeaders)
|
||||
{
|
||||
long startTime = System.currentTimeMillis();
|
||||
ResultWrapper<DataSetsSaveDto> resultWrapper = new ResultWrapper<>();
|
||||
DataSetsSaveDto result = apiService.importExcel(file, dataSetId, envId, tableHeaders);
|
||||
long endTime = System.currentTimeMillis();
|
||||
logger.info("单环境数据导入静态数据集耗时:"+(endTime - startTime));
|
||||
return resultWrapper.success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取数据集环境关联表数据列表查询
|
||||
*
|
||||
* @param queryDto 查询条件对象
|
||||
* @return DataSetsDetailDto
|
||||
*/
|
||||
@ApiOperation(value = "获取:数据集环境关联表")
|
||||
@PostMapping(
|
||||
value = "/query/list",
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<List<DataSetsSaveDto>> queryList(
|
||||
@RequestBody DataSetEnvRelQueryDto queryDto)
|
||||
{
|
||||
ResultWrapper<List<DataSetsSaveDto>> wrapper = new ResultWrapper<>();
|
||||
List<DataSetsSaveDto> dto = apiService.queryList(queryDto);
|
||||
return wrapper.success(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据集内多环境数据同时保存
|
||||
*
|
||||
* @param addDto 新增数据对象信息
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "保持:数据集内多环境数据同时保存")
|
||||
@RequiredPermissions("ui-saveDataSetBatch")
|
||||
@PostMapping(
|
||||
value = "/save/batch",
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<List<String>> saveBatch(
|
||||
@RequestBody DataSetEnvRelAddDto addDto)
|
||||
{
|
||||
return apiService.saveBatch(addDto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询Interface")
|
||||
@PostMapping(value = "/query/selectDataUrlAndTreeNameInterface",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<AtuScriptInputSetQuoteFieldDto> selectDataUrlAndTreeNameInterface(@RequestBody AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto){
|
||||
ResultWrapper<AtuScriptInputSetQuoteFieldDto> wrapper = new ResultWrapper<>();
|
||||
return wrapper.success(apiService.selectDataUrlAndTreeName(atuScriptInputSetQuoteFieldDto));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询静态数据集对应的文件")
|
||||
@PostMapping(value = "/query/getDataSetFile",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public Map<String,AtuScriptInputSetQuoteFeignDto> queryDataSetFile(@RequestBody AtuDataSetFeignDto dto){
|
||||
return apiService.getDataSetFile(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets;
|
||||
|
||||
import cn.gjing.tools.auth.annotation.RequiredPermissions;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.dataPool.api.dataSets.service.DataSetTreeApiService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据集树目录表 => Restful 类型 HTTP/HTTPS 接口
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
@Api(tags = "数据集树目录管理")
|
||||
@RequestMapping("/v1/dataSetTree")
|
||||
@RestController
|
||||
public class DataSetTreeRestfulCtrl
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataSetTreeRestfulCtrl.class);
|
||||
|
||||
@Autowired
|
||||
private DataSetTreeApiService apiService;
|
||||
|
||||
/**
|
||||
* Restful接口-post: 新增数据集树目录表
|
||||
*
|
||||
* @param inputDto 接口数据传输对象
|
||||
* @return 主键
|
||||
*/
|
||||
@ApiOperation(value = "新增:数据集树目录表")
|
||||
@RequiredPermissions("ui-saveDataSetTree")
|
||||
@PostMapping(
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<String> add(
|
||||
@RequestBody @Validated DataSetTreeAddDto inputDto)
|
||||
{
|
||||
ResultWrapper<String> wrapper = new ResultWrapper<>();
|
||||
String uuid = apiService.add(inputDto);
|
||||
return wrapper.success(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-put: 更新数据集树目录表
|
||||
*
|
||||
* @param inputDto 接口数据传输对象
|
||||
* @return 修改的记录数量
|
||||
*/
|
||||
@ApiOperation(value = "更新:数据集树目录表")
|
||||
@RequiredPermissions("ui-updateDataSetTree")
|
||||
@PutMapping(
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> update(
|
||||
@RequestBody @Validated DataSetTreeUpdateDto inputDto) throws IllegalAccessException
|
||||
{
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer count = apiService.updateByPK(inputDto);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-delete: 删除数据集树目录表
|
||||
*
|
||||
* @param uuid 主键
|
||||
* @return 删除的记录数量
|
||||
*/
|
||||
@ApiOperation(value = "删除:数据集树目录表")
|
||||
@RequiredPermissions("ui-deleteDataSetTree")
|
||||
@DeleteMapping(
|
||||
value = "/{uuid}",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> delete(
|
||||
@PathVariable("uuid") String uuid)
|
||||
{
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer count = apiService.deleteByPK(uuid);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据层级查询数据集目录节点")
|
||||
@PostMapping(
|
||||
value = "/queryDataSetTreeByParentId",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<List<DataSetTreeDetailDto>> queryDataSetTreeByParentId(
|
||||
@RequestBody @Validated DataSetTreeQueryDto dto)
|
||||
{
|
||||
logger.debug("start queryDataSetTreeByParentId, param:{}", JSONObject.toJSONString(dto));
|
||||
ResultWrapper<List<DataSetTreeDetailDto>> wrapper = new ResultWrapper<>();
|
||||
List<DataSetTreeDetailDto> res = apiService.queryDataSetTreeByParentId(dto);
|
||||
logger.debug("end queryDataSetTreeByParentId");
|
||||
return wrapper.success(res);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据名字模糊查询数据集目录节点")
|
||||
@PostMapping(
|
||||
value = "/queryDataSetTreeByName",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<List<DataSetTreeDetailDto>> queryDataSetTreeByName(
|
||||
@RequestBody @Validated DataSetTreeQueryDto dto)
|
||||
{
|
||||
logger.debug("start queryDataSetTreeByName, param:{}", JSONObject.toJSONString(dto));
|
||||
ResultWrapper<List<DataSetTreeDetailDto>> wrapper = new ResultWrapper<>();
|
||||
List<DataSetTreeDetailDto> res = apiService.queryDataSetTreeByName(dto);
|
||||
logger.debug("end queryDataSetTreeByName");
|
||||
return wrapper.success(res);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "拖拽树目录")
|
||||
@PostMapping(
|
||||
value = "/moveDataSetTree",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> moveDataSetTree(
|
||||
@RequestBody @Validated DataSetTreeMoveDto dto)
|
||||
{
|
||||
logger.debug("start moveDataSetTree, param:{}", JSONObject.toJSONString(dto));
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer num = apiService.moveDataSetTree(dto);
|
||||
logger.debug("end moveDataSetTree");
|
||||
return wrapper.success(num);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package net.northking.cctp.dataPool.api.dataSets;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.dataPool.api.dataSets.service.DataSetEnvRelApiService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/pub")
|
||||
@Api(tags = "数据集管理无token请求")
|
||||
public class DataSetsPubCtrl {
|
||||
|
||||
@Autowired
|
||||
private DataSetEnvRelApiService setEnvRelApiService;
|
||||
|
||||
@ApiOperation(value = "查询单元格的引用(pub)")
|
||||
@PostMapping(value = "/query/selectDataUrlAndTreeName",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public AtuScriptInputSetQuoteFieldDto selectDataUrlAndTreeName(@RequestBody AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto){
|
||||
return setEnvRelApiService.selectDataUrlAndTreeName(atuScriptInputSetQuoteFieldDto);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets;
|
||||
|
||||
import cn.gjing.tools.auth.annotation.RequiredPermissions;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.dataPool.api.dataSets.service.DataSetsApiService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 数据集 => Restful 类型 HTTP/HTTPS 接口
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
@Api(tags = "数据集管理")
|
||||
@RequestMapping("/v1/dataSets")
|
||||
@RestController
|
||||
public class DataSetsRestfulCtrl
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataSetsRestfulCtrl.class);
|
||||
|
||||
@Autowired
|
||||
private DataSetsApiService apiService;
|
||||
|
||||
@ApiOperation(value = "数据库配置保存数据集")
|
||||
@PostMapping(value = "/createDataSet",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<String> createDataSet(
|
||||
@RequestBody @Validated DataSetsAddDto inputDto)
|
||||
{
|
||||
ResultWrapper<String> wrapper = new ResultWrapper<>();
|
||||
String uuid = apiService.createDataSet(inputDto);
|
||||
return wrapper.success(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-post: 新增数据集
|
||||
*
|
||||
* @param inputDto 接口数据传输对象
|
||||
* @return 主键
|
||||
*/
|
||||
@ApiOperation(value = "新增:数据集")
|
||||
@RequiredPermissions("ui-saveDataSets")
|
||||
@PostMapping(
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<String> add(
|
||||
@RequestBody @Validated DataSetsAddDto inputDto)
|
||||
{
|
||||
ResultWrapper<String> wrapper = new ResultWrapper<>();
|
||||
String uuid = apiService.add(inputDto);
|
||||
return wrapper.success(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-put: 更新数据集
|
||||
*
|
||||
* @param inputDto 接口数据传输对象
|
||||
* @return 修改的记录数量
|
||||
*/
|
||||
@ApiOperation(value = "更新:数据集")
|
||||
@RequiredPermissions("ui-updateDataSets")
|
||||
@PutMapping(
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> update(
|
||||
@RequestBody @Validated DataSetsUpdateDto inputDto) throws IllegalAccessException
|
||||
{
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer count = apiService.updateByPK(inputDto);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-get: 获取数据集
|
||||
*
|
||||
* @param uuid 主键
|
||||
* @return 接口数据传输对象
|
||||
*/
|
||||
@ApiOperation(value = "获取:数据集详情")
|
||||
@GetMapping(
|
||||
value = "getDataSetDetail/{uuid}",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<DataSetsDetailDto> getDataSetDetail(
|
||||
@PathVariable("uuid") String uuid)
|
||||
{
|
||||
ResultWrapper<DataSetsDetailDto> wrapper = new ResultWrapper<>();
|
||||
DataSetsDetailDto dto = apiService.findByPK(uuid);
|
||||
return wrapper.success(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-delete: 删除数据集
|
||||
*
|
||||
* @param uuid 主键
|
||||
* @return 删除的记录数量
|
||||
*/
|
||||
@ApiOperation(value = "删除:数据集")
|
||||
@RequiredPermissions("ui-deleteDataSet")
|
||||
@DeleteMapping(
|
||||
value = "/{uuid}",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> delete(
|
||||
@PathVariable("uuid") String uuid)
|
||||
{
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer count = apiService.deleteByPK(uuid);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restful接口-post: 批量删除数据集
|
||||
*
|
||||
* @param dto
|
||||
* @return 成功的数量
|
||||
*/
|
||||
@ApiOperation(value = "批量删除:数据集")
|
||||
@RequiredPermissions("ui-deleteDataSetList")
|
||||
@PostMapping(
|
||||
value = "/deleteDataSets",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Integer> deleteBatch(
|
||||
@RequestBody @Validated DataSetsDeleteDto dto)
|
||||
{
|
||||
ResultWrapper<Integer> wrapper = new ResultWrapper<>();
|
||||
Integer count = this.apiService.deleteBatch(dto);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询 数据集 列表
|
||||
*
|
||||
* @param queryByPage 查询条件
|
||||
* @return 数据列表
|
||||
*/
|
||||
@ApiOperation(value = "分页查询列表:数据集")
|
||||
@RequiredPermissions("staticData")
|
||||
@PostMapping(value = "/paging/query/DataSets",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Pagination<DataSetsDetailDto>> pagingQuery(
|
||||
@RequestBody @Validated QueryByPage<DataSetsQueryDto> queryByPage)
|
||||
{
|
||||
ResultWrapper<Pagination<DataSetsDetailDto>> wrapper = new ResultWrapper<>();
|
||||
Pagination<DataSetsDetailDto> page = apiService.pagingQuery(queryByPage);
|
||||
return wrapper.success(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存数据集数据")
|
||||
@PostMapping(value = "/save",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Boolean> save(@RequestBody @Validated DataSetsSaveDto dto)
|
||||
{
|
||||
ResultWrapper<Boolean> wrapper = new ResultWrapper<>();
|
||||
Boolean count = this.apiService.save(dto);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增列校验数据集表头")
|
||||
@PostMapping(value = "/checkTableHeader",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<Boolean> checkTableHeader(@RequestBody @Validated ColumnCheckDto dto)
|
||||
{
|
||||
ResultWrapper<Boolean> wrapper = new ResultWrapper<>();
|
||||
Boolean count = this.apiService.checkTableHeader(dto);
|
||||
return wrapper.success(count);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出Excel:数据集")
|
||||
@GetMapping(value = "/export/{dataSetId}",
|
||||
produces = MediaType.APPLICATION_OCTET_STREAM_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public void export(@PathVariable("dataSetId") String dataSetId, HttpServletResponse response)
|
||||
{
|
||||
// 定义导出的Excel在客户端浏览器上提示下载的文件名,不写后缀
|
||||
logger.debug("start exportDataSet");
|
||||
String fileName = "数据集";
|
||||
apiService.exportDataSet(response, dataSetId, fileName);
|
||||
logger.debug("end exportDataSet");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "下载Excel模板:数据集")
|
||||
@PostMapping(value = "/downloadTemplate",
|
||||
produces = MediaType.APPLICATION_OCTET_STREAM_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public void downloadTemplate(@RequestBody DataSetsSaveDto dto,
|
||||
HttpServletResponse response)
|
||||
{
|
||||
logger.debug("start downloadTemplate");
|
||||
String fileName = "数据集模版";
|
||||
apiService.downloadTemplate(response, fileName, dto);
|
||||
logger.debug("end downloadTemplate");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据集环境关联表Restful逻辑接口
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface DataSetEnvRelApiService
|
||||
{
|
||||
|
||||
List<DataSetsSaveDto> queryList(DataSetEnvRelQueryDto queryDto);
|
||||
|
||||
ResultWrapper<List<String>> saveBatch(DataSetEnvRelAddDto addDto);
|
||||
|
||||
DataSetsSaveDto importExcel(MultipartFile file, String dataSetId, String envId,String tableHeaders);
|
||||
|
||||
void exportExcel(HttpServletResponse response, DataSetEnvRelQueryDto dataSetEnvRelQueryDto);
|
||||
|
||||
AtuScriptInputSetQuoteFieldDto selectDataUrlAndTreeName(AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto);
|
||||
|
||||
Map<String,AtuScriptInputSetQuoteFeignDto> getDataSetFile(AtuDataSetFeignDto dto);
|
||||
}
|
|
@ -0,0 +1,739 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.entity.Environment;
|
||||
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.exception.InvalidException;
|
||||
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.vo.ResponseVO;
|
||||
import net.northking.cctp.common.db.SqlOrderBy;
|
||||
import net.northking.cctp.common.enums.FileBusinessTypeEnum;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.feign.ApiAtsEnviromentFeign;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import net.northking.cctp.common.s3.FileDownloadException;
|
||||
import net.northking.cctp.common.s3.FileUploadException;
|
||||
import net.northking.cctp.common.s3.NKFile;
|
||||
import net.northking.cctp.common.s3.SimpleStorageService;
|
||||
import net.northking.cctp.common.security.authentication.NKSecurityContext;
|
||||
import net.northking.cctp.common.util.UUIDUtil;
|
||||
import net.northking.cctp.dataPool.constants.DataPoolConstant;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetEnvRel;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetEnvRelService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import net.northking.cctp.dataPool.feign.AttachmentFeignClient;
|
||||
import net.northking.cctp.dataPool.feign.ProjectFeignClient;
|
||||
import net.northking.cctp.dataPool.utils.EnvNameUtils;
|
||||
import net.northking.cctp.dataPool.utils.MinioPathUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据集环境关联表服务实现类
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataSetEnvRelApiServiceImpl")
|
||||
public class DataSetEnvRelApiServiceImpl implements DataSetEnvRelApiService
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataSetEnvRelApiServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private DataSetEnvRelService dataSetEnvRelService;
|
||||
@Autowired
|
||||
private ProjectFeignClient projectFeignClient;
|
||||
@Autowired
|
||||
private MinioPathUtils pathUtils;
|
||||
@Autowired
|
||||
private SimpleStorageService simpleStorageService;
|
||||
@Autowired
|
||||
private EnvNameUtils envNameUtils;
|
||||
|
||||
@Autowired
|
||||
private ApiAtsEnviromentFeign apiAtsEnviromentFeign;
|
||||
@Autowired
|
||||
private AttachmentFeignClient attachmentFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<DataSetsSaveDto> queryList(DataSetEnvRelQueryDto queryDto) {
|
||||
//返回结果集
|
||||
List<DataSetsSaveDto> dataSetsSaveDtos=new ArrayList<>();
|
||||
//根据数据集id查关联表 1
|
||||
DataSetEnvRel dataSetEnvRel=new DataSetEnvRel();
|
||||
dataSetEnvRel.setDataSetId(queryDto.getDataSetId());
|
||||
SqlOrderBy sqlOrderBy=new SqlOrderBy();
|
||||
sqlOrderBy.asc("env_id");
|
||||
List<DataSetEnvRel> query = dataSetEnvRelService.query(dataSetEnvRel,sqlOrderBy);
|
||||
//跟据系统id查关联环境 调project的feign 2
|
||||
//去project服务写feign
|
||||
Long projectId = null;
|
||||
try {
|
||||
projectId = Long.valueOf(queryDto.getProId());
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("系统Id类型转换异常");
|
||||
throw new InvalidException("系统Id类型转换异常");
|
||||
}
|
||||
ResponseVO<List<Environment>> listResponseVO = apiAtsEnviromentFeign.listByProject(projectId);
|
||||
List<Environment> environmentList = listResponseVO.getData();
|
||||
Map<String, Environment> environmentMap = environmentList.stream().collect(Collectors.toMap(e -> e.getId().toString(), e -> e));
|
||||
List<String> envIds = environmentList.stream().map(e -> e.getId().toString()).collect(Collectors.toList());
|
||||
if (environmentList.size()==0){
|
||||
//删除当前数据集全部环境关联记录
|
||||
if (query.size()!=0){
|
||||
List<Object> ids = query.stream().map(DataSetEnvRel::getId).collect(Collectors.toList());
|
||||
dataSetEnvRelService.deleteByPrimaryKeys(ids);
|
||||
//是否删除文件服务器上的数据
|
||||
}
|
||||
return dataSetsSaveDtos;
|
||||
}
|
||||
if (query.size()!=0) {
|
||||
List<Object> delDsIds = new ArrayList<>();
|
||||
List<DataSetEnvRel> noDelDs = new ArrayList<>();
|
||||
//比较1和2
|
||||
for (DataSetEnvRel d : query) {
|
||||
if (!envIds.contains(d.getEnvId())) {
|
||||
delDsIds.add(d.getId());
|
||||
} else {
|
||||
noDelDs.add(d);
|
||||
}
|
||||
}
|
||||
// 如果1中存在2不存的环境的话删除1中相关信息
|
||||
if (delDsIds.size() != 0) {
|
||||
dataSetEnvRelService.deleteByPrimaryKeys(delDsIds);
|
||||
//是否删除对应的文件服务器中的json文件
|
||||
}
|
||||
// 筛选出2中存在1中不存在
|
||||
List<String> addEnvIds = new ArrayList<>();
|
||||
if (noDelDs.size() != 0) {
|
||||
List<String> noDelEnvIds = noDelDs.stream().map(DataSetEnvRel::getEnvId).collect(Collectors.toList());
|
||||
for (String envId : envIds) {
|
||||
if (!noDelEnvIds.contains(envId)) {
|
||||
addEnvIds.add(envId);
|
||||
}
|
||||
}
|
||||
if (addEnvIds.size() != 0) {//如果2中存在1中不存在的环境给1的file_addr加上赋值为与其他记录相同的头信息
|
||||
DataSetEnvRel dataSetEnvRelAdd = null;
|
||||
Integer seq = noDelDs.get(noDelDs.size() - 1).getSeq();
|
||||
String fileAddr = noDelDs.get(0).getFileAddr();
|
||||
String fileAddrAdd = "";
|
||||
//获取文件数据
|
||||
JSONObject data = downloadFile(fileAddr);
|
||||
DataSetsSaveDto dataSetsSaveDto = new DataSetsSaveDto();
|
||||
if (!ObjectUtils.isEmpty(data)) {
|
||||
dataSetsSaveDto = data.toJavaObject(DataSetsSaveDto.class);
|
||||
dataSetsSaveDto.setTableContent(null);
|
||||
}
|
||||
for (int i = 0; i < addEnvIds.size(); i++) {
|
||||
|
||||
dataSetsSaveDto.setEnvId(addEnvIds.get(i));
|
||||
if(environmentMap.containsKey(addEnvIds.get(i))){
|
||||
dataSetsSaveDto.setEnvName(environmentMap.get(addEnvIds.get(i)).getName());
|
||||
}
|
||||
dataSetsSaveDtos.add(dataSetsSaveDto);
|
||||
|
||||
dataSetEnvRelAdd = new DataSetEnvRel();
|
||||
dataSetEnvRelAdd.setDataSetId(queryDto.getDataSetId());
|
||||
dataSetEnvRelAdd.setEnvId(addEnvIds.get(i));
|
||||
dataSetEnvRelAdd.setId(UUIDUtil.create32UUID());
|
||||
dataSetEnvRelAdd.setCreatedBy(NKSecurityContext.getUserId());
|
||||
dataSetEnvRelAdd.setCreatedTime(new Date());
|
||||
dataSetEnvRelAdd.setTenantId(NKSecurityContext.getTenantId());
|
||||
dataSetEnvRelAdd.setSeq(seq + i + 1);
|
||||
//存储文件数据
|
||||
fileAddrAdd = uploadFile(dataSetsSaveDto, dataSetEnvRelAdd.getId(), FileBusinessTypeEnum.STATIC_DATA_SET_ENV);
|
||||
dataSetEnvRelAdd.setFileAddr(fileAddrAdd);
|
||||
dataSetEnvRelService.insert(dataSetEnvRelAdd);
|
||||
}
|
||||
}
|
||||
//封装反显数据
|
||||
DataSetsSaveDto dataSetsSaveVo = null;
|
||||
for (int i = 0; i < noDelDs.size(); i++) {
|
||||
if (StringUtils.hasText(noDelDs.get(i).getFileAddr())) {
|
||||
JSONObject data1 = downloadFile(noDelDs.get(i).getFileAddr());
|
||||
if (!ObjectUtils.isEmpty(data1)) {
|
||||
dataSetsSaveVo = data1.toJavaObject(DataSetsSaveDto.class);
|
||||
dataSetsSaveVo.setEnvId(noDelDs.get(i).getEnvId());
|
||||
if(environmentMap.containsKey(noDelDs.get(i).getEnvId())){
|
||||
dataSetsSaveVo.setEnvName(environmentMap.get(noDelDs.get(i).getEnvId()).getName());
|
||||
}
|
||||
dataSetsSaveDtos.add(dataSetsSaveVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
//反显系统关联的环境名以及环境id
|
||||
DataSetsSaveDto dataSetsSaveDto = null;
|
||||
for (String envId:envIds){
|
||||
dataSetsSaveDto = new DataSetsSaveDto();
|
||||
dataSetsSaveDto.setEnvId(envId);
|
||||
if(environmentMap.containsKey(envId)){
|
||||
dataSetsSaveDto.setEnvName(environmentMap.get(envId).getName());
|
||||
}
|
||||
dataSetsSaveDtos.add(dataSetsSaveDto);
|
||||
}
|
||||
}
|
||||
return dataSetListSeq(envIds,dataSetsSaveDtos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultWrapper<List<String>> saveBatch(DataSetEnvRelAddDto addDto) {
|
||||
ResultWrapper<List<String>> resultWrapper=new ResultWrapper<>();
|
||||
//用projectId调project服务的feign查系统关联的环境集合 1
|
||||
List<String> envIds = projectFeignClient.selectEnvIds(addDto.getProId());
|
||||
List<String> resultId = saveDataEnv(envIds, addDto);
|
||||
return resultWrapper.success(resultId);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
private List<String> saveDataEnv(List<String> envIds,DataSetEnvRelAddDto addDto){
|
||||
List<String> resultId=new ArrayList<>();
|
||||
//用dataSetId查数据集环境关联表获取相关关联记录 2
|
||||
DataSetEnvRel dataSetEnvRel=new DataSetEnvRel();
|
||||
dataSetEnvRel.setDataSetId(addDto.getDataSetId());
|
||||
SqlOrderBy sqlOrderBy=new SqlOrderBy();
|
||||
sqlOrderBy.asc("seq");
|
||||
List<DataSetEnvRel> query = dataSetEnvRelService.query(dataSetEnvRel,sqlOrderBy);
|
||||
//系统未关联环境,删除当前数据集关联环境的所有记录
|
||||
if (envIds.size()==0){
|
||||
if (query.size()!=0) {
|
||||
List<Object> ids = query.stream().map(DataSetEnvRel::getId).collect(Collectors.toList());
|
||||
dataSetEnvRelService.deleteByPrimaryKeys(ids);
|
||||
}
|
||||
throw new PlatformRuntimeException(DataPoolError.PROJECT_NO_REFER_ENV);
|
||||
}
|
||||
if (query.size()!=0) {
|
||||
//比较1和2
|
||||
List<DataSetEnvRel> delIds=new ArrayList<>();//系统已删除关联的环境id集合
|
||||
List<DataSetEnvRel> noDelQuery=new ArrayList<>();//1和2中均存在的
|
||||
for (int i = 0; i <query.size() ; i++) {
|
||||
if (!envIds.contains(query.get(i).getEnvId())){
|
||||
delIds.add(query.get(i));
|
||||
}else {
|
||||
noDelQuery.add(query.get(i));
|
||||
}
|
||||
}
|
||||
//2中存在1不存在的 删
|
||||
if (delIds.size()!=0){
|
||||
delIds.forEach(item -> {
|
||||
if (StringUtils.hasText(dataSetEnvRel.getFileAddr())) {
|
||||
deleteFile(dataSetEnvRel.getFileAddr());
|
||||
}
|
||||
});
|
||||
List<Object> collect = delIds.stream().map(DataSetEnvRel::getId).collect(Collectors.toList());
|
||||
dataSetEnvRelService.deleteByPrimaryKeys(collect);
|
||||
//是否需要补充删除文件服务器上的json文件
|
||||
}
|
||||
//2和1中都存在的 改
|
||||
if (noDelQuery.size()!=0){
|
||||
Map<String, DataSetEnvRel> noDelMap = noDelQuery.stream().collect(Collectors.toMap(DataSetEnvRel::getEnvId, e -> e));
|
||||
Set<String> noDelEnvIds = noDelMap.keySet();
|
||||
Map<String, List<DataSetEnvRel>> map = noDelQuery.stream().collect(Collectors.groupingBy(DataSetEnvRel::getEnvId));
|
||||
DataSetEnvRel update=null;
|
||||
DataSetsSaveDto updateSaveDto=null;
|
||||
for (DataSetEnvRelAddTmpDto d:addDto.getDataSetEnvRelAddTmpDto()) {
|
||||
if (noDelEnvIds.contains(d.getEnvId())){
|
||||
update=new DataSetEnvRel();
|
||||
update.setId(map.get(d.getEnvId()).get(0).getId());
|
||||
update.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
update.setUpdatedTime(new Date());
|
||||
updateSaveDto=new DataSetsSaveDto();
|
||||
updateSaveDto.setDataSetId(addDto.getDataSetId());
|
||||
updateSaveDto.setTableContent(d.getTableContent());
|
||||
updateSaveDto.setTableHeader(d.getTableHeader());
|
||||
//更新到文件服务器
|
||||
DataSetEnvRel envRel = noDelMap.get(d.getEnvId());
|
||||
if (StringUtils.hasText(envRel.getFileAddr())) {
|
||||
deleteFile(envRel.getFileAddr());
|
||||
}
|
||||
String path = uploadFile(updateSaveDto, update.getId(), FileBusinessTypeEnum.STATIC_DATA_SET_ENV);
|
||||
update.setFileAddr(path);
|
||||
//更新到表
|
||||
resultId.add(map.get(d.getEnvId()).get(0).getId());
|
||||
dataSetEnvRelService.updateByPrimaryKey(update);
|
||||
}
|
||||
}
|
||||
}
|
||||
//筛选出1中存在2不存在的
|
||||
List<String> addEnvIds=new ArrayList<>();
|
||||
List<String> foundIds = query.stream().map(DataSetEnvRel::getEnvId).collect(Collectors.toList());
|
||||
for (String envId:envIds) {
|
||||
if (!foundIds.contains(envId)){
|
||||
addEnvIds.add(envId);
|
||||
}
|
||||
}
|
||||
//1中存在2不存在的 加
|
||||
if (addEnvIds.size()!=0){
|
||||
Integer seq=0;
|
||||
if (noDelQuery.size()!=0) {
|
||||
seq = noDelQuery.get(query.size() - 1).getSeq();
|
||||
}
|
||||
DataSetEnvRel dataSetEnvRelAdd=null;
|
||||
DataSetsSaveDto dataSetsSaveDto=null;
|
||||
for (DataSetEnvRelAddTmpDto d:addDto.getDataSetEnvRelAddTmpDto()) {
|
||||
if (addEnvIds.contains(d.getEnvId())) {
|
||||
dataSetEnvRelAdd = new DataSetEnvRel();
|
||||
dataSetEnvRelAdd.setEnvId(d.getEnvId());
|
||||
dataSetEnvRelAdd.setDataSetId(addDto.getDataSetId());
|
||||
dataSetEnvRelAdd.setTenantId(NKSecurityContext.getTenantId());
|
||||
dataSetEnvRelAdd.setCreatedTime(new Date());
|
||||
dataSetEnvRelAdd.setCreatedBy(NKSecurityContext.getUserId());
|
||||
String uuid = UUIDUtil.create32UUID();
|
||||
dataSetEnvRelAdd.setId(uuid);
|
||||
dataSetEnvRelAdd.setSeq(++seq);
|
||||
//上传数据到文件服务器
|
||||
dataSetsSaveDto = new DataSetsSaveDto();
|
||||
dataSetsSaveDto.setTableHeader(d.getTableHeader());
|
||||
dataSetsSaveDto.setTableContent(d.getTableContent());
|
||||
dataSetsSaveDto.setDataSetId(addDto.getDataSetId());
|
||||
String path = uploadFile(dataSetsSaveDto, dataSetEnvRelAdd.getId(), FileBusinessTypeEnum.STATIC_DATA_SET_ENV);
|
||||
dataSetEnvRelAdd.setFileAddr(path);
|
||||
//存记录到数据库
|
||||
resultId.add(uuid);
|
||||
dataSetEnvRelService.insert(dataSetEnvRelAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//直接新增
|
||||
DataSetsSaveDto dataSetsSaveDto=null;
|
||||
DataSetEnvRel dataSetEnvRelAdd=null;
|
||||
Integer count=1;
|
||||
for (DataSetEnvRelAddTmpDto d:addDto.getDataSetEnvRelAddTmpDto()) {
|
||||
if (envIds.contains(d.getEnvId())) {
|
||||
dataSetEnvRelAdd = new DataSetEnvRel();
|
||||
dataSetEnvRelAdd.setEnvId(d.getEnvId());
|
||||
dataSetEnvRelAdd.setDataSetId(addDto.getDataSetId());
|
||||
dataSetEnvRelAdd.setTenantId(NKSecurityContext.getTenantId());
|
||||
dataSetEnvRelAdd.setCreatedTime(new Date());
|
||||
dataSetEnvRelAdd.setCreatedBy(NKSecurityContext.getUserId());
|
||||
String uuid = UUIDUtil.create32UUID();
|
||||
dataSetEnvRelAdd.setId(uuid);
|
||||
dataSetEnvRelAdd.setSeq(count++);
|
||||
//上传数据到文件服务器
|
||||
dataSetsSaveDto = new DataSetsSaveDto();
|
||||
dataSetsSaveDto.setTableHeader(d.getTableHeader());
|
||||
dataSetsSaveDto.setTableContent(d.getTableContent());
|
||||
dataSetsSaveDto.setDataSetId(addDto.getDataSetId());
|
||||
|
||||
String path = uploadFile(dataSetsSaveDto, dataSetEnvRelAdd.getId(), FileBusinessTypeEnum.STATIC_DATA_SET_ENV);
|
||||
dataSetEnvRelAdd.setFileAddr(path);
|
||||
//存记录到数据库
|
||||
resultId.add(uuid);
|
||||
dataSetEnvRelService.insert(dataSetEnvRelAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultId;
|
||||
}
|
||||
|
||||
private void deleteFile(String fileAddr) {
|
||||
String[] pathData = MinioPathUtils.idToPath(fileAddr);
|
||||
try {
|
||||
simpleStorageService.delete(pathData[0], "/" + pathData[1]);
|
||||
} catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_DEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exportExcel(HttpServletResponse response, DataSetEnvRelQueryDto dataSetEnvRelQueryDto) {
|
||||
try {
|
||||
XSSFWorkbook hssfWorkbook = getXSSFWorkbook(dataSetEnvRelQueryDto);
|
||||
setResponseHeader(response);
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
hssfWorkbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
}catch (IOException e){
|
||||
logger.error(e.getMessage());
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_DOWNLOAD_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AtuScriptInputSetQuoteFieldDto selectDataUrlAndTreeName(AtuScriptInputSetQuoteFieldDto fieldDto) {
|
||||
AtuScriptInputSetQuoteFieldDto dto = dataSetEnvRelService.selectDataUrlAndTreeName(fieldDto);
|
||||
if (null!=dto){
|
||||
//拼接path
|
||||
int row = fieldDto.getRow() + 1;
|
||||
String path = dto.getFullName() + ":" + dto.getName() + "." + fieldDto.getColumn() + ".[" + row + "]";
|
||||
//获取最新value
|
||||
if (StringUtils.hasText(dto.getPath())){
|
||||
JSONObject jsonObject = downloadFile(dto.getPath());
|
||||
try{
|
||||
logger.info("脚本文件内容:jsonobject:{}",jsonObject.toJSONString());
|
||||
DataSetsSaveDto dataSetsSaveDto = jsonObject.toJavaObject(DataSetsSaveDto.class);
|
||||
Map<String, List<DataContentDto>> tableContent = dataSetsSaveDto.getTableContent();
|
||||
dto.setValue(tableContent.get(fieldDto.getColumn()).get(fieldDto.getRow()).getValue());
|
||||
}catch (Exception e){
|
||||
dto.setValue(null);
|
||||
logger.error("文件下载转换异常,e,{}",e);
|
||||
}
|
||||
}
|
||||
dto.setPath(path);
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, AtuScriptInputSetQuoteFeignDto> getDataSetFile(AtuDataSetFeignDto dto) {
|
||||
Map<String, AtuScriptInputSetQuoteFeignDto> resultMap = new HashMap<>();
|
||||
List<String> list = new ArrayList<>(dto.getDataSetList());
|
||||
List<AtuScriptInputSetQuoteFeignDto> dataSetList = dataSetEnvRelService.getDataSetFile(list, dto.getEnvId());
|
||||
if (dataSetList != null && dataSetList.size()>0) {
|
||||
for (AtuScriptInputSetQuoteFeignDto fieldDto : dataSetList) {
|
||||
resultMap.put(fieldDto.getSetId(),fieldDto);
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private XSSFWorkbook getXSSFWorkbook(DataSetEnvRelQueryDto dataSetEnvRelQueryDto) {
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
XSSFSheet sheet = workbook.createSheet("sheet1");
|
||||
XSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
XSSFCell cell = null;
|
||||
|
||||
List<String> tableHeaders = dataSetEnvRelQueryDto.getTableHeaders();
|
||||
List<Map<String, Object>> tableContent = dataSetEnvRelQueryDto.getTableContent();
|
||||
|
||||
if (null != tableHeaders && tableHeaders.size() > 0) {
|
||||
//表头填充
|
||||
XSSFRow row = sheet.createRow(0);
|
||||
for (int i = 0; i < tableHeaders.size(); i++) {
|
||||
cell = row.createCell(i);
|
||||
cell.setCellValue(tableHeaders.get(i));
|
||||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
if (null != tableContent && tableContent.size() > 0) {
|
||||
//表体填充
|
||||
for (int i = 1; i <= tableContent.size(); i++) {
|
||||
XSSFRow xssfRow = sheet.createRow(i);
|
||||
for (int j = 0; j < tableHeaders.size(); j++) {
|
||||
cell = xssfRow.createCell(j);
|
||||
Object obj = tableContent.get(i - 1).get(tableHeaders.get(j));
|
||||
if (obj != null) {
|
||||
cell.setCellValue(obj.toString());
|
||||
} else {
|
||||
cell.setCellValue("");
|
||||
}
|
||||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return workbook;
|
||||
}
|
||||
|
||||
private void setResponseHeader(HttpServletResponse response) {
|
||||
try {
|
||||
String fileName="导出数据集名称";
|
||||
fileName= URLEncoder.encode(fileName,"utf8");
|
||||
response.reset();
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||
response.setHeader("Content-Disposition","attachment;filename="+fileName+".xlsx");
|
||||
}catch (Exception e){
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据url下载文件
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
private JSONObject downloadFile(String url) {
|
||||
String[] resultPath = pathUtils.idToPath(url);
|
||||
InputStream inputStream = null;
|
||||
JSONObject scriptData = null;
|
||||
try {
|
||||
inputStream = simpleStorageService.downloadAsStream(resultPath[0], "/" + resultPath[1]);
|
||||
scriptData = pathUtils.getFileContent(inputStream, JSONObject.class);
|
||||
return scriptData;
|
||||
} catch (FileDownloadException e) {
|
||||
logger.error("读取原文件失败,失败原因:", e);
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_DOWNLOAD_ERROR);
|
||||
} finally {
|
||||
if (null != inputStream) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 上传文件
|
||||
* @param scriptJsonStr
|
||||
* @return
|
||||
*/
|
||||
private String uploadFile(Object scriptJsonStr, String objId, FileBusinessTypeEnum businessCode) {
|
||||
File file = pathUtils.objectToJsonFile(scriptJsonStr);
|
||||
try {
|
||||
NKFile nkFile = simpleStorageService.upload(NKSecurityContext.getTenantId(), file, objId, businessCode);
|
||||
String path = pathUtils.pathToId(NKSecurityContext.getTenantId(), nkFile.getId());
|
||||
return path;
|
||||
} catch (FileUploadException e) {
|
||||
logger.error("上传文件出错", e);
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_UPLOAD_ERROR);
|
||||
} finally {
|
||||
boolean delete = file.delete();
|
||||
if (!delete) {
|
||||
logger.error("删除文件失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<DataSetsSaveDto> dataSetListSeq(List<String> envList,List<DataSetsSaveDto> dtoList){
|
||||
List<DataSetsSaveDto> resultList = new ArrayList<>();
|
||||
for (String envId : envList) {
|
||||
for (DataSetsSaveDto dataSetsSaveDto : dtoList) {
|
||||
if (dataSetsSaveDto.getEnvId().equals(envId)){
|
||||
resultList.add(dataSetsSaveDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSetsSaveDto importExcel(MultipartFile file, String dataSetId, String envId, String tableHeader) {
|
||||
DataSetsSaveDto dataSetsSaveDto = new DataSetsSaveDto();
|
||||
if (file.isEmpty()) {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_IS_NULL);
|
||||
}
|
||||
String name = file.getOriginalFilename();
|
||||
String[] tableHeaders = new String[0];
|
||||
int length = 0;
|
||||
if (tableHeader != null && !tableHeader.equals("")) {
|
||||
tableHeaders = tableHeader.split(",");
|
||||
length = tableHeaders.length;
|
||||
}
|
||||
if (name != null && !name.equals("")) {
|
||||
//表头信息列表
|
||||
String subStr = name.substring(name.lastIndexOf("."));
|
||||
if (subStr.equals(DataPoolConstant.FILE_XLS)) {
|
||||
dataSetsSaveDto = analysisExcelByXLS(file, length);
|
||||
} else if (subStr.equals(DataPoolConstant.FILE_XLSX)) {
|
||||
dataSetsSaveDto = analysisExcelByXLSX(file, length);
|
||||
} else {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_IS_NOT_EXCEL);
|
||||
}
|
||||
} else {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_NAME_IS_NULL);
|
||||
}
|
||||
|
||||
int excelSize = dataSetsSaveDto.getTableHeader().size();
|
||||
|
||||
if (length > excelSize) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TABLE_HEADER_SIZE_UNEQULE);
|
||||
}
|
||||
for (int i = 0; i < length; i++) {
|
||||
//校验是否一致
|
||||
String dto = tableHeaders[i];
|
||||
DataHeaderDto headerDto = dataSetsSaveDto.getTableHeader().get(i);
|
||||
if (!headerDto.getName().equals(dto)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TABLE_HEADER_NAME_ERROR, i + 1, headerDto.getName(), dto);
|
||||
}
|
||||
}
|
||||
dataSetsSaveDto.setEnvId(envId);
|
||||
String envName = envNameUtils.getEnvName(envId);
|
||||
dataSetsSaveDto.setEnvName(envName);
|
||||
dataSetsSaveDto.setDataSetId(dataSetId);
|
||||
return dataSetsSaveDto;
|
||||
}
|
||||
|
||||
|
||||
private DataSetsSaveDto analysisExcelByXLSX(MultipartFile file,Integer headerSize) {
|
||||
DataSetsSaveDto resultDto = new DataSetsSaveDto();
|
||||
List<DataHeaderDto> excelHeaders = new ArrayList<>();
|
||||
Map<String, List<DataContentDto>> excelMap = new HashMap<>();
|
||||
XSSFWorkbook sheets = null;
|
||||
try {
|
||||
sheets = new XSSFWorkbook(file.getInputStream());
|
||||
} catch (IOException e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.EXCEL_FILE_READ_ERROR);
|
||||
}
|
||||
//获取表头信息
|
||||
XSSFSheet sheet = sheets.getSheetAt(0);
|
||||
if (sheet == null) {
|
||||
throw new PlatformRuntimeException(DataPoolError.EXCEL_FISRT_SHEET_NULL);
|
||||
}
|
||||
XSSFRow rowHeader = sheet.getRow(0);
|
||||
Boolean checkTableHeader = false;
|
||||
if (rowHeader != null) {
|
||||
if (headerSize.equals(0)) {
|
||||
checkTableHeader = true;
|
||||
headerSize = Integer.parseInt(String.valueOf(rowHeader.getLastCellNum()));
|
||||
}
|
||||
for (int i = 0; i < headerSize; i++) {
|
||||
XSSFCell cell = rowHeader.getCell(i);
|
||||
if (cell != null && cell.getCellType() != CellType.BLANK) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
DataHeaderDto headerDto = new DataHeaderDto();
|
||||
headerDto.setName(cell.getStringCellValue());
|
||||
excelHeaders.add(headerDto);
|
||||
} else {
|
||||
throw new PlatformRuntimeException(DataPoolError.EXCEL_HEADER_IS_NULL);
|
||||
}
|
||||
}
|
||||
if (checkTableHeader) {
|
||||
if (excelHeaders.size() > 1) {
|
||||
checkTableHeader(excelHeaders);
|
||||
}
|
||||
}
|
||||
//组装表体数据
|
||||
int rowNum = sheet.getLastRowNum() + 1;
|
||||
for (int i = 1; i < rowNum; i++) {
|
||||
XSSFRow row = sheet.getRow(i);
|
||||
for (int j = 0; j < headerSize; j++) {
|
||||
String headerName = excelHeaders.get(j).getName();
|
||||
List<DataContentDto> dtoList = excelMap.get(headerName);
|
||||
if (dtoList == null || dtoList.size() == 0) {
|
||||
dtoList = new ArrayList<>();
|
||||
}
|
||||
XSSFCell cell = row.getCell(j);
|
||||
DataContentDto contentDto = new DataContentDto();
|
||||
if (cell == null) {
|
||||
contentDto.setValue(null);
|
||||
} else if (cell.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell)) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
contentDto.setValue(sdf.format(cell.getDateCellValue()));
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
contentDto.setValue(cell.getStringCellValue());
|
||||
}
|
||||
dtoList.add(contentDto);
|
||||
excelMap.put(headerName, dtoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultDto.setTableHeader(excelHeaders);
|
||||
resultDto.setTableContent(excelMap);
|
||||
return resultDto;
|
||||
}
|
||||
|
||||
private DataSetsSaveDto analysisExcelByXLS(MultipartFile file,Integer headerSize) {
|
||||
DataSetsSaveDto resultDto = new DataSetsSaveDto();
|
||||
List<DataHeaderDto> excelHeaders = new ArrayList<>();
|
||||
Map<String, List<DataContentDto>> excelMap = new HashMap<>();
|
||||
HSSFWorkbook sheets = null;
|
||||
try {
|
||||
sheets = new HSSFWorkbook(file.getInputStream());
|
||||
} catch (IOException e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.EXCEL_FILE_READ_ERROR);
|
||||
}
|
||||
//获取表头信息
|
||||
HSSFSheet sheet = sheets.getSheetAt(0);
|
||||
if (sheet == null) {
|
||||
throw new PlatformRuntimeException(DataPoolError.EXCEL_FISRT_SHEET_NULL);
|
||||
}
|
||||
HSSFRow rowHeader = sheet.getRow(0);
|
||||
Boolean checkTableHeader = false;
|
||||
if (rowHeader != null) {
|
||||
if (headerSize.equals(0)) {
|
||||
//校验表头是否存在重复数据
|
||||
checkTableHeader = true;
|
||||
headerSize = Integer.parseInt(String.valueOf(rowHeader.getLastCellNum()));
|
||||
}
|
||||
for (int i = 0; i < headerSize; i++) {
|
||||
HSSFCell cell = rowHeader.getCell(i);
|
||||
if (cell != null && cell.getStringCellValue() != null) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
DataHeaderDto headerDto = new DataHeaderDto();
|
||||
headerDto.setName(cell.getStringCellValue());
|
||||
excelHeaders.add(headerDto);
|
||||
} else {
|
||||
throw new PlatformRuntimeException(DataPoolError.EXCEL_HEADER_IS_NULL);
|
||||
}
|
||||
}
|
||||
if (checkTableHeader) {
|
||||
if (excelHeaders.size() > 1) {
|
||||
checkTableHeader(excelHeaders);
|
||||
}
|
||||
}
|
||||
//组装表体数据
|
||||
int rowNum = sheet.getLastRowNum() + 1;
|
||||
for (int i = 1; i < rowNum; i++) {
|
||||
HSSFRow row = sheet.getRow(i);
|
||||
for (int j = 0; j < headerSize; j++) {
|
||||
String headerName = excelHeaders.get(j).getName();
|
||||
List<DataContentDto> dtoList = excelMap.get(headerName);
|
||||
if (dtoList == null || dtoList.size() == 0) {
|
||||
dtoList = new ArrayList<>();
|
||||
}
|
||||
HSSFCell cell = row.getCell(j);
|
||||
DataContentDto contentDto = new DataContentDto();
|
||||
if (cell == null) {
|
||||
contentDto.setValue(null);
|
||||
} else if (cell.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell)) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
contentDto.setValue(sdf.format(cell.getDateCellValue()));
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
contentDto.setValue(cell.getStringCellValue());
|
||||
}
|
||||
dtoList.add(contentDto);
|
||||
excelMap.put(headerName, dtoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultDto.setTableHeader(excelHeaders);
|
||||
resultDto.setTableContent(excelMap);
|
||||
return resultDto;
|
||||
}
|
||||
|
||||
private void checkTableHeader(List<DataHeaderDto> excelHeaders){
|
||||
List<String> nameList = new ArrayList<>();
|
||||
for (DataHeaderDto excelHeader : excelHeaders) {
|
||||
String headerName = excelHeader.getName();
|
||||
if (nameList.contains(headerName)){
|
||||
throw new PlatformRuntimeException(DataPoolError.EXCEL_HEADER_HAS_SAME);
|
||||
}
|
||||
nameList.add(headerName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import net.northking.cctp.common.db.excel.ExcelService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据集树目录表Restful逻辑接口
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface DataSetTreeApiService extends ExcelService
|
||||
{
|
||||
|
||||
/**
|
||||
* 新增数据集树目录表
|
||||
*
|
||||
* @param dto 接口数据传输对象
|
||||
* @return 主键
|
||||
*/
|
||||
String add(DataSetTreeAddDto dto);
|
||||
|
||||
/**
|
||||
* 更新数据集树目录表
|
||||
*
|
||||
* @param dto 接口数据传输对象
|
||||
* @return 修改的记录数量
|
||||
*/
|
||||
Integer updateByPK(DataSetTreeUpdateDto dto) throws IllegalAccessException;
|
||||
|
||||
/**
|
||||
* 删除数据集树目录表
|
||||
* @param uuid 主键
|
||||
* @return 删除的记录数量
|
||||
*/
|
||||
Integer deleteByPK(String uuid);
|
||||
|
||||
/**
|
||||
* 根据层级查询数据集目录节点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<DataSetTreeDetailDto> queryDataSetTreeByParentId(DataSetTreeQueryDto dto);
|
||||
|
||||
/**
|
||||
* 根据名字模糊查询数据集目录节点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<DataSetTreeDetailDto> queryDataSetTreeByName(DataSetTreeQueryDto dto);
|
||||
|
||||
/**
|
||||
* 拖拽数据集树目录
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Integer moveDataSetTree(DataSetTreeMoveDto dto);
|
||||
}
|
|
@ -0,0 +1,542 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import net.northking.cctp.common.cache.EntityNameCache;
|
||||
import net.northking.cctp.common.cache.EntityNameCatalog;
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.common.db.annotation.DatabaseReadOnly;
|
||||
import net.northking.cctp.common.db.excel.AbstractExcelService;
|
||||
import net.northking.cctp.common.db.excel.ExcelHeader;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.security.authentication.NKSecurityContext;
|
||||
import net.northking.cctp.common.util.UUIDUtil;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetTree;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSets;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetTreeService;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetsService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据集树目录表服务实现类
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataSetTreeApiServiceImpl")
|
||||
public class DataSetTreeApiServiceImpl extends AbstractExcelService<DataSetTree> implements DataSetTreeApiService
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataSetTreeApiServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private DataSetTreeService dataSetTreeService;
|
||||
@Autowired
|
||||
private DataSetsService dataSetService;
|
||||
@Autowired
|
||||
private TreeIndexNoApiService treeIndexNoApiService;
|
||||
@Autowired
|
||||
private EntityNameCache entityNameCache;
|
||||
|
||||
//= Excel 导入导出相关代码 start ==================//
|
||||
@Override
|
||||
public BasicService<DataSetTree> getService()
|
||||
{
|
||||
return this.dataSetTreeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExcelHeader[] excelHeaders()
|
||||
{
|
||||
ExcelHeader id = new ExcelHeader("id", "id", String.class);
|
||||
ExcelHeader name = new ExcelHeader("节点名称", "name", String.class);
|
||||
ExcelHeader parentId = new ExcelHeader("父节点id", "parentId", String.class);
|
||||
ExcelHeader levelNo = new ExcelHeader("层级", "levelNo", Integer.class);
|
||||
ExcelHeader indexNo = new ExcelHeader("序号", "indexNo", Integer.class);
|
||||
ExcelHeader isLeaf = new ExcelHeader("是否叶子节点", "isLeaf", String.class);
|
||||
ExcelHeader path = new ExcelHeader("路径", "path", String.class);
|
||||
ExcelHeader fullName = new ExcelHeader("完整路径", "fullName", String.class);
|
||||
ExcelHeader proId = new ExcelHeader("系统id", "proId", String.class);
|
||||
ExcelHeader tenantId = new ExcelHeader("租户id", "tenantId", String.class);
|
||||
ExcelHeader createdBy = new ExcelHeader("创建人", "createdBy", String.class);
|
||||
ExcelHeader createdTime = new ExcelHeader("创建时间", "createdTime", Date.class);
|
||||
ExcelHeader updatedBy = new ExcelHeader("更新人", "updatedBy", String.class);
|
||||
ExcelHeader updatedTime = new ExcelHeader("更新时间", "updatedTime", Date.class);
|
||||
return new ExcelHeader[]{};
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel导入,入库之前的处理
|
||||
* @param records 从Excel读取到的记录
|
||||
* @return 待入库的记录
|
||||
*/
|
||||
@Override
|
||||
protected List<DataSetTree> beforeInsertBatch(List<DataSetTree> records)
|
||||
{
|
||||
for (DataSetTree record : records)
|
||||
{
|
||||
record.setId(UUIDUtil.create32UUID());
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入Excel之前的处理<br>
|
||||
* 数据的特殊处理在此处加工处理
|
||||
*
|
||||
* @param record 来自数据库记录
|
||||
* @return 待写入Excel的记录
|
||||
*/
|
||||
@Override
|
||||
protected DataSetTree beforeWriteExcel(DataSetTree record)
|
||||
{
|
||||
return record;
|
||||
}
|
||||
|
||||
//= Excel 导入导出相关代码 end =======================//
|
||||
|
||||
//= 增删改查 相关代码 start ==================//
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public String add(DataSetTreeAddDto dto)
|
||||
{
|
||||
//判断名字是否包括/或者\
|
||||
if (dto.getName().contains("/") || dto.getName().contains("\\")) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_NAME_VALID);
|
||||
}
|
||||
//设置根节点目录
|
||||
if (dto.isAddRootNode() || !StringUtils.hasText(dto.getParentId())) {
|
||||
dto.setParentId("0");
|
||||
}
|
||||
//获取父id,如果是根目录则父id为0
|
||||
String pid = dto.getParentId();
|
||||
//查询父节点信息
|
||||
DataSetTree dataSetTree = new DataSetTree();
|
||||
dataSetTree.setId(pid);
|
||||
DataSetTree byPKParent = dataSetTreeService.findByPrimaryKey(dataSetTree);
|
||||
//设置根节点的父节点
|
||||
if (byPKParent == null) {
|
||||
byPKParent = new DataSetTree();
|
||||
byPKParent.setId("0");
|
||||
byPKParent.setName("");
|
||||
byPKParent.setLevelNo(0);
|
||||
byPKParent.setPath("0");
|
||||
byPKParent.setFullName("");
|
||||
byPKParent.setParentId("-1");
|
||||
byPKParent.setIsLeaf("0");
|
||||
}
|
||||
//非根目录创建
|
||||
//1.判断父节点是否存在数据集
|
||||
if (!"0".equals(pid)) {
|
||||
DataSets tempSet = new DataSets();
|
||||
tempSet.setTreeId(byPKParent.getId());
|
||||
List<DataSets> existSets = dataSetService.query(tempSet);
|
||||
if (!CollectionUtils.isEmpty(existSets)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_ADD_DATA_EXISTS);
|
||||
}
|
||||
}
|
||||
//2.限制最多十级目录
|
||||
if (byPKParent.getLevelNo() - 10 >= 0) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_LEVEL_LIMIT);
|
||||
}
|
||||
//3.判断同级是否存在重名目录
|
||||
DataSetTree setTree = new DataSetTree();
|
||||
setTree.setParentId(pid);
|
||||
setTree.setName(dto.getName());
|
||||
setTree.setProId(dto.getProId());
|
||||
List<DataSetTree> setTrees = dataSetTreeService.query(setTree);
|
||||
if (!CollectionUtils.isEmpty(setTrees)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_NAME_EXISTS);
|
||||
}
|
||||
//5.插入节点至数据库
|
||||
String uuid = UUIDUtil.create32UUID();
|
||||
DataSetTree newTree = new DataSetTree();
|
||||
BeanUtils.copyProperties(dto,newTree);
|
||||
newTree.setId(uuid);
|
||||
newTree.setIsLeaf("1");
|
||||
newTree.setCreatedBy(NKSecurityContext.getUserId());
|
||||
newTree.setCreatedTime(new Date());
|
||||
newTree.setUpdatedBy(newTree.getCreatedBy());
|
||||
newTree.setUpdatedTime(newTree.getCreatedTime());
|
||||
//新增根节点目录
|
||||
if ("0".equals(dto.getParentId())) {
|
||||
newTree.setPath(uuid);
|
||||
newTree.setFullName(dto.getName());
|
||||
newTree.setLevelNo(1);
|
||||
} else { //新增非根节点目录
|
||||
newTree.setLevelNo(byPKParent.getLevelNo()+1);
|
||||
newTree.setPath(byPKParent.getPath() + "/" + uuid);
|
||||
newTree.setFullName(byPKParent.getFullName() + "/" + dto.getName());
|
||||
//6.如果父节点是叶子节点更新父节点
|
||||
if ("1".equals(byPKParent.getIsLeaf())) {
|
||||
DataSetTree newParent = new DataSetTree();
|
||||
newParent.setId(dto.getParentId());
|
||||
newParent.setIsLeaf("0");
|
||||
newParent.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
newParent.setUpdatedTime(newTree.getCreatedTime());
|
||||
newParent.setTenantId(byPKParent.getTenantId());
|
||||
dataSetTreeService.updateByPrimaryKey(newParent);
|
||||
}
|
||||
}
|
||||
//获取排序值
|
||||
Integer seq = treeIndexNoApiService.genIndexNo(dto.getProId(), "ATU_DATA_MGR", 1L).get(0);
|
||||
newTree.setIndexNo(seq);
|
||||
newTree.setTenantId(NKSecurityContext.getTenantId());
|
||||
dataSetTreeService.insert(newTree);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Integer updateByPK(DataSetTreeUpdateDto dto) throws IllegalAccessException
|
||||
{
|
||||
String newName = dto.getName();
|
||||
//判断目录名是否包括/或者\
|
||||
if (newName.contains("/") || newName.contains("\\")) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_NAME_VALID);
|
||||
}
|
||||
//获取待改目录节点信息
|
||||
DataSetTree byPrimaryKey = dataSetTreeService.findByPrimaryKey(dto.getId());
|
||||
if (null == byPrimaryKey) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_NO_EXISTS);
|
||||
}
|
||||
//获取同级目录节点信息
|
||||
DataSetTree tree = new DataSetTree();
|
||||
tree.setParentId(byPrimaryKey.getParentId());
|
||||
tree.setName(dto.getName());
|
||||
tree.setProId(byPrimaryKey.getProId());
|
||||
List<DataSetTree> broNodes = dataSetTreeService.query(tree);
|
||||
if (!CollectionUtils.isEmpty(broNodes) && !broNodes.get(0).getId().equals(dto.getId())) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_NAME_EXISTS);
|
||||
}
|
||||
//更新数据库数据
|
||||
DataSetTree tempTree = new DataSetTree();
|
||||
BeanUtils.copyProperties(dto,tempTree);
|
||||
tempTree.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
tempTree.setUpdatedTime(new Date());
|
||||
//更新namePath
|
||||
String namePath = byPrimaryKey.getFullName();
|
||||
String namePathNew = "";
|
||||
DataSetTree childSetTrees = new DataSetTree();
|
||||
childSetTrees.setProId(byPrimaryKey.getProId());
|
||||
childSetTrees.setFullName(namePath);
|
||||
//更新根节点名称路径
|
||||
if ("0".equals(byPrimaryKey.getParentId())) {
|
||||
namePathNew = dto.getName();
|
||||
}else {
|
||||
//更新非根节点名称路径
|
||||
String[] nameArr = namePath.split("/");
|
||||
namePathNew = nameArr[0];
|
||||
for (int i = 1; i < nameArr.length - 1; i++) {
|
||||
namePathNew = namePathNew + "/" + nameArr[i];
|
||||
}
|
||||
namePathNew = namePathNew + "/" + dto.getName();
|
||||
}
|
||||
tempTree.setFullName(namePathNew);
|
||||
tempTree.setTenantId(byPrimaryKey.getTenantId());
|
||||
int total = dataSetTreeService.updateByPrimaryKey(tempTree);
|
||||
//同步修改所有子级节点
|
||||
total+= dataSetTreeService.updateChildNamePath(childSetTrees,namePathNew);
|
||||
return total;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Integer deleteByPK(String uuid)
|
||||
{
|
||||
DataSetTree byPrimaryKey = dataSetTreeService.findByPrimaryKey(uuid);
|
||||
if (null == byPrimaryKey) {
|
||||
return 0;
|
||||
}
|
||||
//判断节点是否为叶子结点
|
||||
if ("0".equals(byPrimaryKey.getIsLeaf())) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_DEL_DIR_EXISTS);
|
||||
}
|
||||
//判断所选目录是否有脚本
|
||||
DataSets tempSet = new DataSets();
|
||||
tempSet.setTreeId(uuid);
|
||||
List<DataSets> sets = dataSetService.query(tempSet);
|
||||
if (!CollectionUtils.isEmpty(sets)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_DEL_DATA_EXISTS);
|
||||
}
|
||||
//删除数据库数据
|
||||
int res = dataSetTreeService.deleteByPrimaryKey(uuid);
|
||||
//查询父目录是否含有其他子目录
|
||||
DataSetTree setTree = new DataSetTree();
|
||||
setTree.setParentId(byPrimaryKey.getParentId());
|
||||
List<DataSetTree> childrenNodes = dataSetTreeService.query(setTree);
|
||||
//无子目录时需改为叶子结点
|
||||
if (CollectionUtils.isEmpty(childrenNodes)) {
|
||||
DataSetTree newParent = new DataSetTree();
|
||||
newParent.setId(byPrimaryKey.getParentId());
|
||||
newParent.setIsLeaf("1");
|
||||
newParent.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
newParent.setUpdatedTime(new Date());
|
||||
dataSetTreeService.updateByPrimaryKey(newParent);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DatabaseReadOnly
|
||||
public List<DataSetTreeDetailDto> queryDataSetTreeByParentId(DataSetTreeQueryDto dto) {
|
||||
List<DataSetTreeDetailDto> result = new ArrayList<>();
|
||||
//根据父节点查询所有子级节点
|
||||
if(!StringUtils.isEmpty(dto.getParentId())){
|
||||
DataSetTreeQueryDto setTreeQueryDto = new DataSetTreeQueryDto();
|
||||
setTreeQueryDto.setProIds(dto.getProIds());
|
||||
setTreeQueryDto.setParentId(dto.getParentId());
|
||||
//租户隔离
|
||||
setTreeQueryDto.setTenantId(NKSecurityContext.getTenantId());
|
||||
result = dataSetTreeService.selectDataSetTree(setTreeQueryDto);
|
||||
for (DataSetTreeDetailDto dataSetTreeDetailDto : result) {
|
||||
dataSetTreeDetailDto.setIdx(dataSetTreeDetailDto.getIndexNo());
|
||||
}
|
||||
}else{
|
||||
//最外层为系统信息数组
|
||||
for (String projectId : dto.getProIds()) {
|
||||
DataSetTreeDetailDto detailDto = new DataSetTreeDetailDto();
|
||||
detailDto.setId(projectId);
|
||||
detailDto.setParentId("");
|
||||
detailDto.setProId(projectId);
|
||||
detailDto.setName(entityNameCache.translateById(EntityNameCatalog.MONSTER_SYSTEM.name(),projectId));
|
||||
detailDto.setIsLeaf("0");
|
||||
detailDto.setLevelNo(0);
|
||||
result.add(detailDto);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Integer moveDataSetTree(DataSetTreeMoveDto dto) {
|
||||
DataSetTree oldNode = dataSetTreeService.findByPrimaryKey(dto.getId());
|
||||
DataSetTree tempTree = new DataSetTree();
|
||||
if("0".equals(dto.getTargetId())) {
|
||||
tempTree.setId("0");
|
||||
tempTree.setLevelNo(0);
|
||||
tempTree.setIsLeaf("0");
|
||||
tempTree.setFullName("");
|
||||
}else {
|
||||
tempTree = dataSetTreeService.findByPrimaryKey(dto.getTargetId());
|
||||
}
|
||||
//判断拖拽后是否层数超过10级
|
||||
Integer targetLevel = tempTree.getLevelNo();
|
||||
DataSetTree queryLevel = new DataSetTree();
|
||||
queryLevel.setId(oldNode.getId());
|
||||
queryLevel.setProId(oldNode.getProId());
|
||||
int maxLevel = dataSetTreeService.countMaxLevelNo(queryLevel);
|
||||
int myMaxLevel = maxLevel - oldNode.getLevelNo() + 1;
|
||||
if ((targetLevel + myMaxLevel) > 10) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_LEVEL_LIMIT);
|
||||
}
|
||||
int levelNo = tempTree.getLevelNo()-oldNode.getLevelNo()+1;
|
||||
if(dto.getOrderSeq()==null) {
|
||||
dto.setOrderSeq(0);
|
||||
}
|
||||
//校验是否同名
|
||||
DataSetTree check = new DataSetTree();
|
||||
check.setName(oldNode.getName());
|
||||
check.setParentId(tempTree.getId());
|
||||
check.setProId(dto.getProId());
|
||||
List<DataSetTree> sameSets = dataSetTreeService.query(check);
|
||||
if(!CollectionUtils.isEmpty(sameSets) && !oldNode.getParentId().equals(tempTree.getId())){
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_NAME_EXISTS);
|
||||
}
|
||||
//校验是否目标节点为非叶子节点并存在用例
|
||||
DataSets exitElement = new DataSets();
|
||||
exitElement.setProId(dto.getProId());
|
||||
exitElement.setTreeId(tempTree.getId());
|
||||
if ("1".equals(tempTree.getIsLeaf()) && !CollectionUtils.isEmpty(dataSetService.query(exitElement))) {
|
||||
throw new PlatformRuntimeException(DataPoolError.TREE_MOVE_DATA_EXISTS);
|
||||
}
|
||||
//更新节点以及子节点
|
||||
DataSetTree treeUp = new DataSetTree();
|
||||
treeUp.setId(oldNode.getId());
|
||||
treeUp.setParentId(tempTree.getId());
|
||||
treeUp.setTenantId(oldNode.getTenantId());
|
||||
dataSetTreeService.updateByPrimaryKey(treeUp);
|
||||
String targetIdPath = StringUtils.hasText(tempTree.getPath()) ? (tempTree.getPath()+"/") : "";
|
||||
String targetNamePath = StringUtils.hasText(tempTree.getFullName()) ? (tempTree.getFullName()+"/") : "";
|
||||
treeUp.setPath(targetIdPath+oldNode.getId());
|
||||
treeUp.setFullName(targetNamePath+oldNode.getFullName());
|
||||
//更改顺序号
|
||||
DataSetTreeMoveDto childUp = new DataSetTreeMoveDto();
|
||||
childUp.setOrderSeq(dto.getOrderSeq());
|
||||
childUp.setProId(dto.getProId());
|
||||
treeIndexNoApiService.genIndexNo(dto.getProId(), "ATU_DATA_MGR", 1L);
|
||||
dataSetTreeService.updateSeqByMove(childUp);
|
||||
//替换移动节点的排序号
|
||||
DataSetTree treeUpOrder = new DataSetTree();
|
||||
treeUpOrder.setId(oldNode.getId());
|
||||
treeUpOrder.setIndexNo(dto.getOrderSeq()+1);
|
||||
treeUpOrder.setTenantId(oldNode.getTenantId());
|
||||
dataSetTreeService.updateByPrimaryKey(treeUpOrder);
|
||||
//子节点更改路径
|
||||
DataSetTree child = new DataSetTree();
|
||||
BeanUtils.copyProperties(childUp,child);
|
||||
child.setProId(oldNode.getProId());
|
||||
child.setFullName(oldNode.getFullName());
|
||||
child.setPath(oldNode.getPath());
|
||||
child.setLevelNo(levelNo);
|
||||
|
||||
//不再维护namePath,长度不够
|
||||
dataSetTreeService.updateChildIdPath(child,treeUp.getPath());
|
||||
//修改原父节点以及现父节点的叶子节点标识
|
||||
if("1".equals(tempTree.getIsLeaf())){
|
||||
DataSetTree itemTreeUp = new DataSetTree();
|
||||
itemTreeUp.setId(tempTree.getId());
|
||||
itemTreeUp.setIsLeaf("0");
|
||||
itemTreeUp.setTenantId(tempTree.getTenantId());
|
||||
dataSetTreeService.updateByPrimaryKey(itemTreeUp);
|
||||
}
|
||||
DataSetTree oldFaCount = new DataSetTree();
|
||||
oldFaCount.setParentId(oldNode.getParentId());
|
||||
if(CollectionUtils.isEmpty(dataSetTreeService.query(oldFaCount))){
|
||||
DataSetTree oldTreeUp = new DataSetTree();
|
||||
oldTreeUp.setId(oldNode.getParentId());
|
||||
oldTreeUp.setIsLeaf("1");
|
||||
dataSetTreeService.updateByPrimaryKey(oldTreeUp);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataSetTreeDetailDto> queryDataSetTreeByName(DataSetTreeQueryDto dto) {
|
||||
DataSetTreeQueryDto queryDto = new DataSetTreeQueryDto();
|
||||
queryDto.setName(dto.getName());
|
||||
queryDto.setProIds(dto.getProIds());
|
||||
List<DataSetTreeDetailDto> setTreeList = dataSetTreeService.selectDataSetTree(queryDto);
|
||||
if (setTreeList.size()<1) {
|
||||
//无数据时多系统也需再包装一层系统级信息
|
||||
if(dto.isMoreProject()) {
|
||||
return setProjectTop(setTreeList, dto.getProIds(), dto.getName());
|
||||
}else {
|
||||
return setTreeList;
|
||||
}
|
||||
}
|
||||
Map<String, DataSetTreeDetailDto> treeMap = getTreeMap(setTreeList);
|
||||
List<DataSetTreeDetailDto> detailDtos = new ArrayList<>();
|
||||
for (String treeId : treeMap.keySet()) {
|
||||
detailDtos.add(treeMap.get(treeId));
|
||||
}
|
||||
List<DataSetTreeDetailDto> treeList = getTreeList(detailDtos);
|
||||
List<DataSetTreeDetailDto> resList = treeList.stream().sorted(Comparator.comparing(DataSetTreeDetailDto::getIndexNo)).collect(Collectors.toList());
|
||||
//多系统包装最外层系统信息
|
||||
if(dto.isMoreProject()){
|
||||
return setProjectTop(resList,dto.getProIds(),dto.getName());
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
private Map<String, DataSetTreeDetailDto> getTreeMap(List<DataSetTreeDetailDto> allList) {
|
||||
Map<String, DataSetTreeDetailDto> treeMap = new HashMap<>();
|
||||
List<String> list = new ArrayList<>();
|
||||
//查询包含的树节点id
|
||||
for (int i = 0; i < allList.size(); i++) {
|
||||
DataSetTreeDetailDto detailDto = allList.get(i);
|
||||
String[] paths = detailDto.getPath().split("/");
|
||||
List<String> ids = new ArrayList<>(Arrays.asList(paths));
|
||||
list.addAll(ids);
|
||||
}
|
||||
list = list.stream().distinct().collect(Collectors.toList());
|
||||
List<DataSetTree> treeList = dataSetTreeService.queryByIds(list);
|
||||
for (DataSetTree dataSetTree : treeList) {
|
||||
DataSetTreeDetailDto detailDto = new DataSetTreeDetailDto();
|
||||
BeanUtils.copyProperties(dataSetTree,detailDto);
|
||||
detailDto.setIdx(dataSetTree.getIndexNo());
|
||||
if (!treeMap.containsKey(dataSetTree.getId())) {
|
||||
treeMap.put(dataSetTree.getId(),detailDto);
|
||||
}
|
||||
}
|
||||
return treeMap;
|
||||
}
|
||||
|
||||
private List<DataSetTreeDetailDto> getTreeList(List<DataSetTreeDetailDto> dtoList) {
|
||||
List<DataSetTreeDetailDto> treeList = new ArrayList<>();
|
||||
for (int i = 0; i < dtoList.size(); i++) {
|
||||
DataSetTreeDetailDto tree = dtoList.get(i);
|
||||
//根节点生成对应树列表
|
||||
if("0".equals(tree.getParentId())){
|
||||
getSonTree(tree,dtoList);
|
||||
treeList.add(tree);
|
||||
}
|
||||
}
|
||||
return treeList;
|
||||
}
|
||||
|
||||
private void getSonTree(DataSetTreeDetailDto tree, List<DataSetTreeDetailDto> dtoList) {
|
||||
List<DataSetTreeDetailDto> sonList = new ArrayList<>();
|
||||
for (DataSetTreeDetailDto dto : dtoList) {
|
||||
if(tree.getId().equals(dto.getParentId())){
|
||||
getSonTree(dto,dtoList);
|
||||
sonList.add(dto);
|
||||
}
|
||||
}
|
||||
List<DataSetTreeDetailDto> reSonList = sonList.stream().sorted(Comparator.comparing(DataSetTreeDetailDto::getIndexNo)).collect(Collectors.toList());
|
||||
tree.setChildren(reSonList);
|
||||
}
|
||||
|
||||
private List<DataSetTreeDetailDto> setProjectTop(List<DataSetTreeDetailDto> reList,List<String> projectIds,String name){
|
||||
List<DataSetTreeDetailDto> result = new ArrayList<>();
|
||||
Map<String,List<DataSetTreeDetailDto>> tool = new HashMap<>();
|
||||
for (DataSetTreeDetailDto oneTree : reList) {
|
||||
if (tool.containsKey(oneTree.getProId())){
|
||||
tool.get(oneTree.getProId()).add(oneTree);
|
||||
}else{
|
||||
List<DataSetTreeDetailDto> list = new ArrayList<>();
|
||||
list.add(oneTree);
|
||||
tool.put(oneTree.getProId(),list);
|
||||
}
|
||||
}
|
||||
//无系统查全部
|
||||
if (CollectionUtils.isEmpty(projectIds)) {
|
||||
projectIds = new ArrayList<>();
|
||||
projectIds.addAll(tool.keySet());
|
||||
}
|
||||
for (String projectId : projectIds) {
|
||||
String projectName = entityNameCache.translateById(EntityNameCatalog.MONSTER_SYSTEM.name(), projectId);
|
||||
//系统展示条件:1.有符合条件目录 2.无关键字筛选则都需展示 3. 有关键字筛选名称含关键字系统
|
||||
if(tool.containsKey(projectId) ||!StringUtils.hasText (name) || (StringUtils.hasText(name) && projectName.contains(name))){
|
||||
DataSetTreeDetailDto one = new DataSetTreeDetailDto();
|
||||
one.setId(projectId);
|
||||
one.setIsLeaf("0");
|
||||
one.setName(projectName);
|
||||
one.setLevelNo(0);
|
||||
one.setParentId("");
|
||||
one.setProId(projectId);
|
||||
one.setChildren(tool.get(projectId));
|
||||
//无子树则为叶子结点
|
||||
if (CollectionUtils.isEmpty(one.getChildren())) {
|
||||
one.setIsLeaf("1");
|
||||
}
|
||||
result.add(one);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.db.excel.ExcelService;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 数据集Restful逻辑接口
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface DataSetsApiService extends ExcelService
|
||||
{
|
||||
/**
|
||||
* 查询数据集列表
|
||||
*
|
||||
* @param queryByPage 查询条件
|
||||
* @return 查询结果列表
|
||||
*/
|
||||
Pagination<DataSetsDetailDto> pagingQuery(QueryByPage<DataSetsQueryDto> queryByPage);
|
||||
|
||||
/**
|
||||
* 新增数据集
|
||||
*
|
||||
* @param dto 接口数据传输对象
|
||||
* @return 主键
|
||||
*/
|
||||
String add(DataSetsAddDto dto);
|
||||
|
||||
/**
|
||||
* 更新数据集
|
||||
*
|
||||
* @param dto 接口数据传输对象
|
||||
* @return 修改的记录数量
|
||||
*/
|
||||
Integer updateByPK(DataSetsUpdateDto dto) throws IllegalAccessException;
|
||||
|
||||
/**
|
||||
* 获取数据集
|
||||
* @param uuid 主键
|
||||
* @return 接口数据传输对象
|
||||
*/
|
||||
DataSetsDetailDto findByPK(String uuid);
|
||||
|
||||
/**
|
||||
* 删除数据集
|
||||
* @param uuid 主键
|
||||
* @return 删除的记录数量
|
||||
*/
|
||||
Integer deleteByPK(String uuid);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param dto
|
||||
* @return 成功的数量
|
||||
*/
|
||||
Integer deleteBatch(DataSetsDeleteDto dto);
|
||||
|
||||
/**
|
||||
* 保存数据集数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Boolean save(DataSetsSaveDto dto);
|
||||
|
||||
/**
|
||||
* 新增列校验列实体
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Boolean checkTableHeader(ColumnCheckDto dto);
|
||||
|
||||
/**
|
||||
* 导出数据集
|
||||
* @param response
|
||||
* @param dataSetId
|
||||
* @param fileName
|
||||
*/
|
||||
void exportDataSet(HttpServletResponse response, String dataSetId, String fileName);
|
||||
|
||||
|
||||
/**
|
||||
* 下载数据模板
|
||||
* @param response
|
||||
* @param fileName
|
||||
* @param saveDto
|
||||
*/
|
||||
void downloadTemplate(HttpServletResponse response, String fileName, DataSetsSaveDto saveDto);
|
||||
|
||||
/**
|
||||
* 数据库配置保存数据集
|
||||
* @param inputDto
|
||||
* @return
|
||||
*/
|
||||
String createDataSet(DataSetsAddDto inputDto);
|
||||
}
|
|
@ -0,0 +1,765 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import net.northking.cctp.common.cache.EntityNameCache;
|
||||
import net.northking.cctp.common.cache.EntityNameCatalog;
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.common.db.DefaultPagination;
|
||||
import net.northking.cctp.common.db.OrderBy;
|
||||
import net.northking.cctp.common.db.Pagination;
|
||||
import net.northking.cctp.common.db.annotation.DatabaseReadOnly;
|
||||
import net.northking.cctp.common.db.excel.AbstractExcelService;
|
||||
import net.northking.cctp.common.db.excel.ExcelHeader;
|
||||
import net.northking.cctp.common.dto.CpLogAddDto;
|
||||
import net.northking.cctp.common.enums.FileBusinessTypeEnum;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.feign.MonsterLogServer;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.common.s3.FileDownloadException;
|
||||
import net.northking.cctp.common.s3.FileUploadException;
|
||||
import net.northking.cctp.common.s3.NKFile;
|
||||
import net.northking.cctp.common.s3.SimpleStorageService;
|
||||
import net.northking.cctp.common.security.authentication.NKSecurityContext;
|
||||
import net.northking.cctp.common.util.UUIDUtil;
|
||||
import net.northking.cctp.dataPool.bus.LogRabbitMQPublisher;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetEnvRel;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetTree;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSets;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetEnvRelService;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetTreeService;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetsService;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.*;
|
||||
import net.northking.cctp.dataPool.enums.DataHeaderType;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import net.northking.cctp.dataPool.feign.AttachmentFeignClient;
|
||||
import net.northking.cctp.dataPool.feign.ProjectFeignClient;
|
||||
import net.northking.cctp.dataPool.feign.ScriptFeignClient;
|
||||
import net.northking.cctp.dataPool.feign.dto.AtuInputDataSetResultDto;
|
||||
import net.northking.cctp.dataPool.utils.ExcelUtils;
|
||||
import net.northking.cctp.dataPool.utils.MinioPathUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据集服务实现类
|
||||
*
|
||||
* @author maven-cctp-plugin
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataSetsApiServiceImpl")
|
||||
public class DataSetsApiServiceImpl extends AbstractExcelService<DataSets> implements DataSetsApiService
|
||||
{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(DataSetsApiServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private DataSetsService dataSetsService;
|
||||
@Autowired
|
||||
private DataSetTreeService dataSetTreeService;
|
||||
@Autowired
|
||||
private DataSetEnvRelService dataSetEnvRelService;
|
||||
@Autowired
|
||||
private MinioPathUtils pathUtils;
|
||||
@Autowired
|
||||
private SimpleStorageService simpleStorageService;
|
||||
@Autowired
|
||||
private EntityNameCache entityNameCache;
|
||||
@Autowired
|
||||
private LogRabbitMQPublisher logPublisher;
|
||||
@Autowired
|
||||
private ProjectFeignClient projectFeignClient;
|
||||
@Autowired
|
||||
private ScriptFeignClient scriptFeignClient;
|
||||
@Autowired
|
||||
private AttachmentFeignClient attachmentFeignClient;
|
||||
//= Excel 导入导出相关代码 start ==================//
|
||||
@Override
|
||||
public BasicService<DataSets> getService()
|
||||
{
|
||||
return this.dataSetsService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExcelHeader[] excelHeaders()
|
||||
{
|
||||
ExcelHeader dataSetId = new ExcelHeader("数据集id", "dataSetId", String.class);
|
||||
ExcelHeader name = new ExcelHeader("数据集名称", "name", String.class);
|
||||
ExcelHeader description = new ExcelHeader("描述", "description", String.class);
|
||||
ExcelHeader proId = new ExcelHeader("系统id", "proId", String.class);
|
||||
ExcelHeader tenantId = new ExcelHeader("租户id", "tenantId", String.class);
|
||||
ExcelHeader fileAddr = new ExcelHeader("文件地址", "fileAddr", String.class);
|
||||
ExcelHeader treeId = new ExcelHeader("目录id", "treeId", String.class);
|
||||
ExcelHeader createdBy = new ExcelHeader("创建人", "createdBy", String.class);
|
||||
ExcelHeader createdTime = new ExcelHeader("创建时间", "createdTime", Date.class);
|
||||
ExcelHeader updatedBy = new ExcelHeader("更新人", "updatedBy", String.class);
|
||||
ExcelHeader updatedTime = new ExcelHeader("更新时间", "updatedTime", Date.class);
|
||||
return new ExcelHeader[]{};
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel导入,入库之前的处理
|
||||
* @param records 从Excel读取到的记录
|
||||
* @return 待入库的记录
|
||||
*/
|
||||
@Override
|
||||
protected List<DataSets> beforeInsertBatch(List<DataSets> records)
|
||||
{
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入Excel之前的处理<br>
|
||||
* 数据的特殊处理在此处加工处理
|
||||
*
|
||||
* @param record 来自数据库记录
|
||||
* @return 待写入Excel的记录
|
||||
*/
|
||||
@Override
|
||||
protected DataSets beforeWriteExcel(DataSets record)
|
||||
{
|
||||
return record;
|
||||
}
|
||||
|
||||
//= Excel 导入导出相关代码 end =======================//
|
||||
|
||||
//= 增删改查 相关代码 start ==================//
|
||||
@Override
|
||||
@DatabaseReadOnly
|
||||
public Pagination<DataSetsDetailDto> pagingQuery(QueryByPage<DataSetsQueryDto> query)
|
||||
{
|
||||
DefaultPagination<DataSetsDetailDto> pagination = new DefaultPagination();
|
||||
//目录查询参数修改
|
||||
String treeId = query.getQuery().getTreeId();
|
||||
if (StringUtils.hasText(treeId)) {
|
||||
List<DataSetTreeDetailDto> list = dataSetTreeService.queryChildrenTreeList(treeId);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<String> groupIds = list.stream().map(item->item.getId()).collect(Collectors.toList());
|
||||
query.getQuery().setTreeId(null);
|
||||
query.getQuery().setTreeIds(groupIds);
|
||||
}
|
||||
}
|
||||
//数据集查询租户隔离
|
||||
query.getQuery().setTenantId(NKSecurityContext.getTenantId());
|
||||
//处理分页参数
|
||||
handlePageParam(query);
|
||||
pagination.setPageSize(query.getPageSize());
|
||||
pagination.setPageNo(query.getPageNo());
|
||||
Page<DataSetsDetailDto> page = PageMethod.startPage(query.getPageNo(), query.getPageSize()); //开始分页
|
||||
List<DataSetsDetailDto> result = dataSetsService.queryDataSets(query);
|
||||
//处理返回数据
|
||||
for (DataSetsDetailDto detailDto : result) {
|
||||
//创建修改人名称
|
||||
detailDto.setCreator(entityNameCache.translateById(EntityNameCatalog.MONSTER_USER, detailDto.getCreatedBy()));
|
||||
detailDto.setModifier(entityNameCache.translateById(EntityNameCatalog.MONSTER_USER, detailDto.getUpdatedBy()));
|
||||
}
|
||||
pagination.setRecords(result);
|
||||
pagination.setRecordCount(page.getTotal());
|
||||
return pagination;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public String add(DataSetsAddDto dto)
|
||||
{
|
||||
//名称校验
|
||||
Pattern p = Pattern.compile("[\\\\/:*?\"<>|]");
|
||||
if (p.matcher(dto.getName()).find()) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SET_NAME_IS_VALID);
|
||||
}
|
||||
//所选目录校验
|
||||
DataSetTree byPrimaryKey = dataSetTreeService.findByPrimaryKey(dto.getTreeId());
|
||||
if (null == byPrimaryKey || "0".equals(byPrimaryKey.getIsLeaf())) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_DIR_VALID);
|
||||
}
|
||||
|
||||
// 校验目录下名称唯一
|
||||
boolean nameUnique = checkNameUnique(dto.getName(), dto.getTreeId(), null);
|
||||
if (!nameUnique){
|
||||
throw new PlatformRuntimeException(DataPoolError.SET_NAME_NO_UNIQUE, dto.getName());
|
||||
}
|
||||
|
||||
//创建实体
|
||||
String uuid = UUIDUtil.create32UUID();
|
||||
DataSets entity = new DataSets();
|
||||
BeanUtils.copyProperties(dto, entity);
|
||||
entity.setDataSetId(uuid);
|
||||
entity.setCreatedBy(NKSecurityContext.getUserId());
|
||||
entity.setCreatedTime(new Date());
|
||||
entity.setUpdatedBy(entity.getCreatedBy());
|
||||
entity.setUpdatedTime(entity.getCreatedTime());
|
||||
entity.setTenantId(NKSecurityContext.getTenantId());
|
||||
this.dataSetsService.insert(entity);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
private boolean checkNameUnique(String name, String treeId, String id){
|
||||
DataSets dataSets = new DataSets();
|
||||
dataSets.setName(name);
|
||||
dataSets.setTreeId(treeId);
|
||||
List<DataSets> setsList = this.dataSetsService.query(dataSets);
|
||||
if (setsList != null && setsList.size() > 0){
|
||||
DataSets sets = setsList.get(0);
|
||||
if (!sets.getDataSetId().equals(id)){
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Integer updateByPK(DataSetsUpdateDto dto) throws IllegalAccessException
|
||||
{
|
||||
//数据集存在性校验
|
||||
DataSets byPrimaryKey = dataSetsService.findByPrimaryKey(dto.getDataSetId());
|
||||
if (null == byPrimaryKey) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_NO_EXISTS);
|
||||
}
|
||||
//名称校验
|
||||
Pattern p = Pattern.compile("[\\\\/:*?\"<>|]");
|
||||
if (p.matcher(dto.getName()).find()) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SET_NAME_IS_VALID);
|
||||
}
|
||||
|
||||
// 校验目录下名称唯一
|
||||
boolean nameUnique = checkNameUnique(dto.getName(), dto.getTreeId(), dto.getDataSetId());
|
||||
if (!nameUnique){
|
||||
throw new PlatformRuntimeException(DataPoolError.SET_NAME_NO_UNIQUE, dto.getName());
|
||||
}
|
||||
|
||||
DataSets entity = new DataSets();
|
||||
BeanUtils.copyProperties(byPrimaryKey, entity);
|
||||
entity.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
entity.setDescription(dto.getDescription());
|
||||
entity.setUpdatedTime(new Date());
|
||||
entity.setName(dto.getName());
|
||||
return this.dataSetsService.updateByPrimaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DatabaseReadOnly
|
||||
public DataSetsDetailDto findByPK(String uuid)
|
||||
{
|
||||
//获取数据集
|
||||
DataSets byPrimaryKey = dataSetsService.findByPrimaryKey(uuid);
|
||||
if (null == byPrimaryKey) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_NO_EXISTS);
|
||||
}
|
||||
DataSetsDetailDto dto = new DataSetsDetailDto();
|
||||
BeanUtils.copyProperties(byPrimaryKey, dto);
|
||||
//获取文件数据
|
||||
if (StringUtils.hasText(dto.getFileAddr())) {
|
||||
JSONObject data = downloadFile(dto.getFileAddr());
|
||||
DataSetsSaveDto dataSetsSaveDto = null;
|
||||
if (!ObjectUtils.isEmpty(data)) {
|
||||
dataSetsSaveDto = data.toJavaObject(DataSetsSaveDto.class);
|
||||
}
|
||||
if (null != dataSetsSaveDto) {
|
||||
dto.setTableContent(dataSetsSaveDto.getTableContent());
|
||||
dto.setTableHeader(dataSetsSaveDto.getTableHeader());
|
||||
}
|
||||
}
|
||||
//封装数据集信息
|
||||
dto.setCreator(entityNameCache.translateById(EntityNameCatalog.MONSTER_USER, dto.getCreatedBy()));
|
||||
dto.setModifier(entityNameCache.translateById(EntityNameCatalog.MONSTER_USER, dto.getUpdatedBy()));
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Integer deleteByPK(String uuid)
|
||||
{
|
||||
//数据集存在性校验
|
||||
DataSets byPrimaryKey = dataSetsService.findByPrimaryKey(uuid);
|
||||
if (null == byPrimaryKey) {
|
||||
return 0;
|
||||
}
|
||||
//校验数据是否存在关联
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(uuid);
|
||||
List<AtuInputDataSetResultDto> dtos = scriptFeignClient.selectLinkBySetId(list);
|
||||
for (AtuInputDataSetResultDto dto : dtos) {
|
||||
if (dto.getCountNum() > 0){
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_SET_HAS_LINK);
|
||||
}
|
||||
}
|
||||
|
||||
//删除对应文件
|
||||
String fileAddr = byPrimaryKey.getFileAddr();
|
||||
if (StringUtils.hasText(fileAddr)) {
|
||||
deleteFile(fileAddr);
|
||||
}
|
||||
deleteDataSetEnv(byPrimaryKey);
|
||||
//删除库数据
|
||||
int result = this.dataSetsService.deleteByPrimaryKey(byPrimaryKey);
|
||||
//删除数据集增加平台日志
|
||||
CpLogAddDto cpLogAddDto = new CpLogAddDto();
|
||||
String projectName = entityNameCache.translateById(EntityNameCatalog.MONSTER_SYSTEM.name(), byPrimaryKey.getProId());
|
||||
cpLogAddDto.setContent("【删除静态数据】系统:" + projectName + "数据集名称:" + byPrimaryKey.getName());
|
||||
cpLogAddDto.setModule("静态数据管理");
|
||||
cpLogAddDto.setType("3");
|
||||
// 发送日志到 monster
|
||||
MonsterLogServer.sendLogToMonster(cpLogAddDto);
|
||||
logPublisher.deployLogContent(cpLogAddDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void deleteDataSetEnv(DataSets byPrimaryKey) {
|
||||
DataSetEnvRel record = new DataSetEnvRel();
|
||||
record.setDataSetId(byPrimaryKey.getDataSetId());
|
||||
List<DataSetEnvRel> dataSetEnvRels = dataSetEnvRelService.query(record);
|
||||
dataSetEnvRels.forEach(dataSetEnvRel -> {
|
||||
if (StringUtils.hasText(dataSetEnvRel.getFileAddr())) {
|
||||
deleteFile(dataSetEnvRel.getFileAddr());
|
||||
}
|
||||
});
|
||||
//删除环境数据
|
||||
List<Object> deleteIds = dataSetEnvRels.stream().map(DataSetEnvRel::getId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(deleteIds)) {
|
||||
dataSetEnvRelService.deleteByPrimaryKeys(deleteIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Integer deleteBatch(DataSetsDeleteDto dto)
|
||||
{
|
||||
List<String> setIds = dto.getSetIds();
|
||||
if (CollectionUtils.isEmpty(setIds)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
List<AtuInputDataSetResultDto> dtos = scriptFeignClient.selectLinkBySetId(dto.getSetIds());
|
||||
for (AtuInputDataSetResultDto resultDto : dtos) {
|
||||
if (resultDto.getCountNum() > 0){
|
||||
throw new PlatformRuntimeException(DataPoolError.DATA_SET_HAS_LINK);
|
||||
}
|
||||
}
|
||||
//删除文件 记录删除的系统和数据集
|
||||
List<DataSets> dataSets = dataSetsService.queryByIds(setIds);
|
||||
List<String> proIds = new ArrayList<>();
|
||||
List<String> setNames = new ArrayList<>();
|
||||
for (DataSets dataSet : dataSets) {
|
||||
if (null != dataSet) {
|
||||
if (StringUtils.hasText(dataSet.getProId())) {
|
||||
proIds.add(dataSet.getProId());
|
||||
}
|
||||
if (StringUtils.hasText(dataSet.getName())) {
|
||||
setNames.add(dataSet.getName());
|
||||
}
|
||||
if (StringUtils.hasText(dataSet.getFileAddr())) {
|
||||
deleteFile(dataSet.getFileAddr());
|
||||
}
|
||||
}
|
||||
}
|
||||
//未获取到系统或数据集名称
|
||||
if (CollectionUtils.isEmpty(proIds) || CollectionUtils.isEmpty(setNames)) {
|
||||
return 0;
|
||||
}
|
||||
for (DataSets dataSet : dataSets) {
|
||||
deleteDataSetEnv(dataSet);
|
||||
}
|
||||
//删除数据
|
||||
Integer result = dataSetsService.deleteByIds(setIds);
|
||||
//批量删除数据集增加平台日志(均为同系统
|
||||
String projectName = entityNameCache.translateById(EntityNameCatalog.MONSTER_SYSTEM.name(), proIds.get(0));
|
||||
CpLogAddDto cpLogAddDto = new CpLogAddDto();
|
||||
cpLogAddDto.setContent("【批量删除静态数据集】:系统" + projectName + ",共" + result + "条");
|
||||
cpLogAddDto.setModule("静态数据管理");
|
||||
cpLogAddDto.setType("3");
|
||||
cpLogAddDto.setContentDetails(setNames);
|
||||
MonsterLogServer.sendLogToMonster(cpLogAddDto);
|
||||
logPublisher.deployLogContent(cpLogAddDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Boolean save(DataSetsSaveDto dto) {
|
||||
//获取数据集数据
|
||||
String dataSetId = dto.getDataSetId();
|
||||
DataSets byPrimaryKey = dataSetsService.findByPrimaryKey(dataSetId);
|
||||
if (null == byPrimaryKey) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_NO_EXISTS);
|
||||
}
|
||||
//校验表头是否正确
|
||||
List<DataHeaderDto> tableHeader = dto.getTableHeader();
|
||||
List<String> colNameList = checkColumnList(tableHeader);
|
||||
//校验数据是否正确
|
||||
Map<String, List<DataContentDto>> tableContent = dto.getTableContent();
|
||||
if (!colNameList.containsAll(tableContent.keySet())) {
|
||||
throw new PlatformRuntimeException(DataPoolError.HEADER_CONTENT_NO_MATCH);
|
||||
}
|
||||
//存储文件
|
||||
String path = null;
|
||||
try {
|
||||
String filePath = uploadFile(dto, byPrimaryKey.getDataSetId(), FileBusinessTypeEnum.STATIC_DATA_SET);
|
||||
if (StringUtils.hasText(filePath)) {
|
||||
path = filePath;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_UPLOAD_ERROR);
|
||||
}
|
||||
//更新数据集数据
|
||||
DataSets dataSets = new DataSets();
|
||||
BeanUtils.copyProperties(byPrimaryKey,dataSets);
|
||||
dataSets.setFileAddr(path);
|
||||
dataSets.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
dataSets.setUpdatedTime(new Date());
|
||||
dataSetsService.updateByPrimaryKey(dataSets);
|
||||
//删除原文件
|
||||
String oldPath = byPrimaryKey.getFileAddr();
|
||||
if (StringUtils.hasText(oldPath)) {
|
||||
deleteFile(oldPath);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkTableHeader(ColumnCheckDto dto) {
|
||||
String dataSetId = dto.getDataSetId();
|
||||
DataSets byPrimaryKey = dataSetsService.findByPrimaryKey(dataSetId);
|
||||
if (null == byPrimaryKey) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_NO_EXISTS);
|
||||
}
|
||||
if (null == dto.getColumnInfo()) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_IS_NULL);
|
||||
}
|
||||
String fileAddr = byPrimaryKey.getFileAddr();
|
||||
//新增列
|
||||
if (StringUtils.hasText(fileAddr)) {
|
||||
JSONObject dataInfo = downloadFile(fileAddr);
|
||||
if (!ObjectUtils.isEmpty(dataInfo)) {
|
||||
DataSetsSaveDto data = dataInfo.toJavaObject(DataSetsSaveDto.class);
|
||||
List<DataHeaderDto> tableHeader = data.getTableHeader();
|
||||
List<String> columnList = tableHeader.stream().map(item->item.getName()).collect(Collectors.toList());
|
||||
if (columnList.contains(dto.getColumnInfo().getName())) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_IS_EXSITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportDataSet(HttpServletResponse response, String dataSetId, String fileName) {
|
||||
DataSets dataSet = dataSetsService.findByPrimaryKey(dataSetId);
|
||||
if (null == dataSet) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_NO_EXISTS);
|
||||
}
|
||||
dataSetDownloadExecl(response, dataSet.getName());
|
||||
ServletOutputStream outputStream = null;
|
||||
try {
|
||||
Workbook workbook = exportDataTable(dataSet);
|
||||
outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
} catch (IOException e) {
|
||||
logger.error("导出" + dataSet.getName() + "数据集文件失败:", e);
|
||||
} finally {
|
||||
if (null != outputStream) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadTemplate(HttpServletResponse response, String fileName, DataSetsSaveDto saveDto) {
|
||||
DataSets dataSet = dataSetsService.findByPrimaryKey(saveDto.getDataSetId());
|
||||
if (null == dataSet) {
|
||||
throw new PlatformRuntimeException(DataPoolError.SETS_NO_EXISTS);
|
||||
}
|
||||
dataSetDownloadExecl(response, dataSet.getName() + "模板");
|
||||
ServletOutputStream outputStream = null;
|
||||
saveDto.setTableContent(null);
|
||||
try {
|
||||
Workbook workbook = ExcelUtils.exportToExcel(saveDto, dataSet.getName(), true);
|
||||
outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
} catch (IOException e) {
|
||||
logger.error("导出" + dataSet.getName() + "模板文件失败:", e);
|
||||
} finally {
|
||||
if (null != outputStream) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class)
|
||||
public String createDataSet(DataSetsAddDto inputDto) {
|
||||
String setId = add(inputDto);
|
||||
List<String> headers = inputDto.getHeaders();
|
||||
List<Map<String, Object>> tableData = inputDto.getTableData();
|
||||
//保存表数据
|
||||
if (!CollectionUtils.isEmpty(headers)) {
|
||||
DataSetsSaveDto saveDto = new DataSetsSaveDto();
|
||||
List<DataHeaderDto> headerList = new ArrayList<>();
|
||||
//记录表头信息
|
||||
for (String colName : headers) {
|
||||
if(!StringUtils.hasText(colName)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_IS_NULL);
|
||||
}
|
||||
DataHeaderDto dataHeaderDto = new DataHeaderDto();
|
||||
dataHeaderDto.setName(colName);
|
||||
dataHeaderDto.setType("string");
|
||||
dataHeaderDto.setIsRepeat("1");
|
||||
headerList.add(dataHeaderDto);
|
||||
}
|
||||
saveDto.setTableHeader(headerList);
|
||||
|
||||
// 同步至其他环境只需要表头即可
|
||||
DataSetsSaveDto syncSaveDto = new DataSetsSaveDto();
|
||||
syncSaveDto.setTableHeader(headerList);
|
||||
|
||||
//记录表数据
|
||||
Map<String,List<DataContentDto>> contentList = new HashMap<>();
|
||||
for(int col = 0; col < headers.size(); col++) {
|
||||
String name = headers.get(col);
|
||||
List<DataContentDto> colDatas = new ArrayList<>();
|
||||
//逐行获取该列值
|
||||
for (int row = 0; row < tableData.size(); row++) {
|
||||
DataContentDto contentDto = new DataContentDto();
|
||||
Map<String, Object> rowData = tableData.get(row);
|
||||
String val = "";
|
||||
//有值替换 无值存空串
|
||||
if (rowData.containsKey(name)) {
|
||||
Object value = rowData.get(name);
|
||||
if (value != null && StringUtils.hasText(value.toString()) && !"null".equals(value.toString())) {
|
||||
val = value.toString();
|
||||
}
|
||||
}
|
||||
contentDto.setValue(val);
|
||||
contentDto.setTime("0");
|
||||
colDatas.add(contentDto);
|
||||
}
|
||||
contentList.put(name,colDatas);
|
||||
}
|
||||
saveDto.setTableContent(contentList);
|
||||
//将数据上传文件服务器
|
||||
String path = uploadFile(saveDto, setId, FileBusinessTypeEnum.STATIC_DATA_SET);
|
||||
if (StringUtils.hasText(path)) {
|
||||
DataSets dataSets = new DataSets();
|
||||
dataSets.setDataSetId(setId);
|
||||
dataSets.setFileAddr(path);
|
||||
dataSetsService.updateByPrimaryKey(dataSets);
|
||||
//更新到每个环境下
|
||||
List<String> envIds = projectFeignClient.selectEnvIds(inputDto.getProId());
|
||||
int seq = 1;
|
||||
for (String envId : envIds) {
|
||||
DataSetEnvRel dataSetEnvRel = new DataSetEnvRel();
|
||||
dataSetEnvRel.setId(UUIDUtil.create32UUID());//主键
|
||||
dataSetEnvRel.setDataSetId(setId);//数据集id
|
||||
dataSetEnvRel.setEnvId(envId);//环境id
|
||||
// 环境相同保存标题和数据,其他环境只保存表头
|
||||
if (Objects.equals(inputDto.getEnvId(), envId)){
|
||||
String envPath = uploadFile(saveDto, dataSetEnvRel.getId(), FileBusinessTypeEnum.STATIC_DATA_SET_ENV);
|
||||
dataSetEnvRel.setFileAddr(envPath);//文件路径
|
||||
}else {
|
||||
String syncFilePath = uploadFile(syncSaveDto, dataSetEnvRel.getId(), FileBusinessTypeEnum.STATIC_DATA_SET_ENV);
|
||||
dataSetEnvRel.setFileAddr(syncFilePath);//文件路径
|
||||
}
|
||||
dataSetEnvRel.setSeq(seq);//排序
|
||||
dataSetEnvRel.setCreatedBy(NKSecurityContext.getUserId());
|
||||
dataSetEnvRel.setUpdatedBy(NKSecurityContext.getUserId());
|
||||
dataSetEnvRel.setCreatedTime(new Date());
|
||||
dataSetEnvRel.setUpdatedTime(new Date());
|
||||
dataSetEnvRel.setTenantId(NKSecurityContext.getTenantId());
|
||||
dataSetEnvRelService.insert(dataSetEnvRel);
|
||||
}
|
||||
}else {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_ID_ERROR);
|
||||
}
|
||||
}
|
||||
return setId;
|
||||
}
|
||||
|
||||
private void dataSetDownloadExecl(HttpServletResponse response, String fileName) {
|
||||
response.reset();
|
||||
response.setStatus(HttpStatus.OK.value());
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName,"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error("文件名转换编码异常", e);
|
||||
}
|
||||
response.setHeader("Content-Type", "application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
}
|
||||
|
||||
private Workbook exportDataTable(DataSets dataSet) {
|
||||
String fileAddr = dataSet.getFileAddr();
|
||||
if (StringUtils.hasText(fileAddr)) {
|
||||
JSONObject jsonObject = downloadFile(fileAddr);
|
||||
if (!ObjectUtils.isEmpty(jsonObject)) {
|
||||
DataSetsSaveDto dataInfo = jsonObject.toJavaObject(DataSetsSaveDto.class);
|
||||
return ExcelUtils.exportToExcel(dataInfo, dataSet.getName(), true);
|
||||
}else {
|
||||
return ExcelUtils.exportToExcel(null, dataSet.getName(), true);
|
||||
}
|
||||
}else {
|
||||
return ExcelUtils.exportToExcel(null, dataSet.getName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验表头是否正确
|
||||
* @param columnList
|
||||
* @return
|
||||
*/
|
||||
private List<String> checkColumnList(List<DataHeaderDto> columnList) {
|
||||
List<String> names = new ArrayList<>();
|
||||
//校验是否存在同名列
|
||||
if (!CollectionUtils.isEmpty(columnList)) {
|
||||
names = new ArrayList<>();
|
||||
for (DataHeaderDto dataHeaderDto : columnList) {
|
||||
if (null == dataHeaderDto) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_IS_NULL);
|
||||
}
|
||||
//列名称校验
|
||||
String headName = dataHeaderDto.getName();
|
||||
if (!StringUtils.hasText(headName)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_NAME_IS_NULL);
|
||||
}
|
||||
if (headName.length() > 30) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_NAME_IS_TOO_LONG);
|
||||
}
|
||||
if (names.contains(headName)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_IS_EXSITS);
|
||||
}
|
||||
//列类型校验
|
||||
String headType = dataHeaderDto.getType();
|
||||
if (!StringUtils.hasText(headType)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_TYPE_IS_NULL);
|
||||
}
|
||||
String code = DataHeaderType.getCode(headType);
|
||||
if (!StringUtils.hasText(code)) {
|
||||
throw new PlatformRuntimeException(DataPoolError.COLUMN_TYPE_IS_WRONG);
|
||||
}
|
||||
names.add(headName);
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理分页查询参数
|
||||
*
|
||||
* @param query
|
||||
*/
|
||||
private void handlePageParam(QueryByPage<DataSetsQueryDto> query) {
|
||||
if (query.getPageNo() <= 0) {
|
||||
query.setPageNo(1);
|
||||
}
|
||||
if (query.getPageSize() <= 0 || query.getPageSize() > 500) {
|
||||
query.setPageSize(500);
|
||||
}
|
||||
OrderBy sort = query.toSqlOrderBy();
|
||||
if (sort != null && sort.isNotEmpty() && StringUtils.hasText(sort.toString())) {
|
||||
PageMethod.orderBy(sort.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据url下载文件
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
private JSONObject downloadFile(String url) {
|
||||
String[] resultPath = MinioPathUtils.idToPath(url);
|
||||
InputStream inputStream = null;
|
||||
JSONObject scriptData = null;
|
||||
try {
|
||||
inputStream = simpleStorageService.downloadAsStream(resultPath[0], "/" + resultPath[1]);
|
||||
scriptData = MinioPathUtils.getFileContent(inputStream, JSONObject.class);
|
||||
return scriptData;
|
||||
} catch (FileDownloadException e) {
|
||||
logger.error("读取原文件失败,失败原因:", e);
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_DOWNLOAD_ERROR);
|
||||
} finally {
|
||||
if (null != inputStream) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据url删除服务器端文件
|
||||
* @param url
|
||||
*/
|
||||
private void deleteFile(String url) {
|
||||
String[] pathData = MinioPathUtils.idToPath(url);
|
||||
try {
|
||||
simpleStorageService.delete(pathData[0], "/" + pathData[1]);
|
||||
} catch (Exception e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_DEL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param scriptJsonStr
|
||||
* @return
|
||||
*/
|
||||
private String uploadFile(Object scriptJsonStr, String objId, FileBusinessTypeEnum businessCode) {
|
||||
File file = MinioPathUtils.objectToJsonFile(scriptJsonStr);
|
||||
try {
|
||||
NKFile nkFile = simpleStorageService.upload(NKSecurityContext.getTenantId(), file, objId, businessCode);
|
||||
return MinioPathUtils.pathToId(NKSecurityContext.getTenantId(), nkFile.getId());
|
||||
} catch (FileUploadException e) {
|
||||
logger.error("上传文件出错", e);
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_UPLOAD_ERROR);
|
||||
} finally {
|
||||
boolean delete = file.delete();
|
||||
if (!delete) {
|
||||
logger.error("删除文件失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TreeIndexNoApiService {
|
||||
List<Integer> genIndexNo(String project, String noType, long count);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package net.northking.cctp.dataPool.api.dataSets.service;
|
||||
|
||||
import net.northking.cctp.common.security.authentication.NKSecurityContext;
|
||||
import net.northking.cctp.common.sequence.SequenceService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "TreeIndexNoApiServiceImpl")
|
||||
public class TreeIndexNoApiServiceImpl implements TreeIndexNoApiService{
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(TreeIndexNoApiServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private SequenceService sequenceService;
|
||||
|
||||
@Override
|
||||
public List<Integer> genIndexNo(String project, String noType, long count) {
|
||||
List<Integer> result = new ArrayList<>();
|
||||
String suffix = "data-pool-no";
|
||||
String after = "dataPool";
|
||||
String projectId = StringUtils.isEmpty(project) ? "tenant" : project;
|
||||
String key = after + ":" + NKSecurityContext.getTenantId() + ":" + suffix + ":" + projectId + ":" + noType;
|
||||
long value = sequenceService.skipValue(key, (int) count);
|
||||
for (long i = value; i > value - count; i--) {
|
||||
result.add(0, Integer.valueOf(i+""));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package net.northking.cctp.dataPool.bus;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import net.northking.cctp.common.dto.CpLogAddDto;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.security.authentication.NKSecurityContext;
|
||||
import net.northking.cctp.dataPool.constants.DataPoolConstant;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import org.springframework.amqp.core.MessageBuilder;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Component
|
||||
public class LogRabbitMQPublisher {
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
public void deployLogContent(CpLogAddDto cpLogAddDto) {
|
||||
byte[] json;
|
||||
try {
|
||||
cpLogAddDto.setRemoteAddr(request.getRemoteAddr());
|
||||
json = objectMapper.writeValueAsBytes(cpLogAddDto);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new PlatformRuntimeException(DataPoolError.INSERT_LOG_FAIL);
|
||||
}
|
||||
MessageBuilder mb = MessageBuilder.withBody(json);
|
||||
mb.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||
mb.setHeader(DataPoolConstant.CCTP_USER_ID, NKSecurityContext.getUserId());
|
||||
mb.setHeader(DataPoolConstant.SAAS_TENANT_ID, NKSecurityContext.getTenantId());
|
||||
rabbitTemplate.send(DataPoolConstant.PLATFORM_LOG_INSERT_REQ, mb.build());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package net.northking.cctp.dataPool.constants;
|
||||
|
||||
public class DataPoolConstant {
|
||||
|
||||
public static final String FILE_XLSX = ".xlsx";
|
||||
|
||||
public static final String FILE_XLS = ".xls";
|
||||
|
||||
public static final String CCTP_USER_ID= "CCTP_User_ID";
|
||||
|
||||
public static final String SAAS_TENANT_ID= "SaaS_Tenant_ID";
|
||||
|
||||
public static final String PLATFORM_LOG_INSERT_REQ= "Platform.Log.Insert.REQ";
|
||||
|
||||
public static final String ADD_URL= "addURL";
|
||||
|
||||
public static final String CPLOGADDDTO_LOG_TYPE_DELETE = "3";
|
||||
public static final String CPLOGADDDTO_DATA_POOL_MANAGEMENT = "系统数据池管理";
|
||||
public static final String CPLOGADDDTO_CONTENT_DELETE = "删除";
|
||||
|
||||
public static final String FUZZY_DATA_QUOTE_PREFIX = "%{";
|
||||
|
||||
public static final String FUZZY_DATA_QUOTE_SUFFIX = "}";
|
||||
|
||||
/**
|
||||
* 输入项数据集引用类型-静态数据
|
||||
*/
|
||||
public static final String INPUT_SET_QUOTE_TYPE_STATIC = "1";
|
||||
/**
|
||||
* 输入项数据集引用类型-模糊数据
|
||||
*/
|
||||
public static final String INPUT_SET_QUOTE_TYPE_FUZZY = "2";
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.dao;
|
||||
|
||||
import feign.Param;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
import net.northking.cctp.dataPool.db.mapper.DataResourcePackageMapper;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageQueryDto;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(业务层):资源包
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Repository
|
||||
public interface DataResourcePackageDao extends DataResourcePackageMapper
|
||||
{
|
||||
/**
|
||||
* 条件查询资源包列表
|
||||
* @param queryByPage
|
||||
* @return
|
||||
*/
|
||||
List<DataResourcePackageDetailDto> getDataResourcePackages(@Param("query") QueryByPage<DataResourcePackageQueryDto> queryByPage);
|
||||
|
||||
/**
|
||||
* 根据id列表查询资源包
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
List<DataResourcePackage> queryByIds(@Param("list") List<String> idList);
|
||||
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.dao;
|
||||
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataRule;
|
||||
import net.northking.cctp.dataPool.db.mapper.DataRuleMapper;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleQueryDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleUpdateDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(业务层):数据规则表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Repository
|
||||
public interface DataRuleDao extends DataRuleMapper
|
||||
{
|
||||
/**
|
||||
* 查询同名的其他规则
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Integer queryRuleByName(DataRuleUpdateDto dto);
|
||||
|
||||
/**
|
||||
* 条件查询数据规则
|
||||
* @param queryByPage
|
||||
* @return
|
||||
*/
|
||||
List<DataRuleDetailDto> getDataRules(QueryByPage<DataRuleQueryDto> queryByPage);
|
||||
|
||||
/**
|
||||
* 根据id集合查询数据规则
|
||||
* @param idSet id集合
|
||||
* @return 结果集
|
||||
*/
|
||||
List<DataRule> queryByIdSet(@Param("idSet") Set<String> idSet);
|
||||
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.dao;
|
||||
|
||||
import net.northking.cctp.dataPool.db.mapper.DataSetEnvRelMapper;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFeignDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(业务层):数据集环境关联表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2023-08-23 17:53:02 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Repository
|
||||
public interface DataSetEnvRelDao extends DataSetEnvRelMapper
|
||||
{
|
||||
AtuScriptInputSetQuoteFieldDto selectDataUrlAndTreeName(AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto);
|
||||
|
||||
List<AtuScriptInputSetQuoteFeignDto> getDataSetFile(@Param("list")List<String> list, @Param("envId")String envId);
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.dao;
|
||||
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetTree;
|
||||
import net.northking.cctp.dataPool.db.mapper.DataSetTreeMapper;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeMoveDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeQueryDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(业务层):数据集树目录表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Repository
|
||||
public interface DataSetTreeDao extends DataSetTreeMapper
|
||||
{
|
||||
/**
|
||||
* 修改子节点名称路径
|
||||
* @param childSetTree
|
||||
* @param namePathNew
|
||||
* @return
|
||||
*/
|
||||
int updateChildNamePath(@Param("tree") DataSetTree childSetTree, @Param("newPath") String namePathNew);
|
||||
|
||||
/**
|
||||
* 条件查询数据集目录节点
|
||||
* @param setTreeQueryDto
|
||||
* @return
|
||||
*/
|
||||
List<DataSetTreeDetailDto> selectDataSetTree(DataSetTreeQueryDto setTreeQueryDto);
|
||||
|
||||
/**
|
||||
* 根据目录id查询子目录列表
|
||||
* @param treeId
|
||||
* @return
|
||||
*/
|
||||
List<DataSetTreeDetailDto> queryChildrenTreeList(String treeId);
|
||||
|
||||
List<DataSetTree> queryByIds(List<String> list);
|
||||
|
||||
int countMaxLevelNo(DataSetTree queryLevel);
|
||||
|
||||
void updateSeqByMove(DataSetTreeMoveDto childUp);
|
||||
|
||||
int updateChildIdPath(@Param("tree") DataSetTree child, @Param("newPath") String path);
|
||||
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.dao;
|
||||
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSets;
|
||||
import net.northking.cctp.dataPool.db.mapper.DataSetsMapper;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetsDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetsQueryDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(业务层):数据集
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:39 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Repository
|
||||
public interface DataSetsDao extends DataSetsMapper
|
||||
{
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
/**
|
||||
* 条件查询数据集列表
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<DataSetsDetailDto> queryDataSets(QueryByPage<DataSetsQueryDto> query);
|
||||
|
||||
/**
|
||||
* 根据id列表查询数据集
|
||||
* @param setIds
|
||||
* @return
|
||||
*/
|
||||
List<DataSets> queryByIds(@Param("setIds") List<String> setIds);
|
||||
|
||||
/**
|
||||
* 根据id列表批量删除
|
||||
* @param setIds
|
||||
* @return
|
||||
*/
|
||||
Integer deleteByIds(@Param("setIds") List<String> setIds);
|
||||
}
|
|
@ -0,0 +1,286 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.common.db.entity.Entity;
|
||||
import net.northking.cctp.common.saas.db.TenantPartition;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 资源包
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@ApiModel(description = "资源包")
|
||||
public class DataResourcePackage extends TenantPartition implements Entity
|
||||
{
|
||||
public static final String KEY_id = "id";
|
||||
public static final String KEY_name = "name";
|
||||
public static final String KEY_memo = "memo";
|
||||
public static final String KEY_packageAddr = "packageAddr";
|
||||
public static final String KEY_proId = "proId";
|
||||
public static final String KEY_tenantId = "tenantId";
|
||||
public static final String KEY_createdBy = "createdBy";
|
||||
public static final String KEY_updatedBy = "updatedBy";
|
||||
public static final String KEY_createdTime = "createdTime";
|
||||
public static final String KEY_updatedTime = "updatedTime";
|
||||
|
||||
/**
|
||||
* id<br>
|
||||
*/
|
||||
@ApiModelProperty("id")
|
||||
@Size(max = 32, message="id-id: 数据长度不能 > 32" )
|
||||
private String id;
|
||||
/**
|
||||
* 资源包名称<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包名称")
|
||||
@Size(max = 32, message="资源包名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 资源包描述<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包描述")
|
||||
@Size(max = 128, message="资源包描述-memo: 数据长度不能 > 128" )
|
||||
private String memo;
|
||||
/**
|
||||
* 资源包存放地址<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包存放地址")
|
||||
@Size(max = 128, message="资源包存放地址-packageAddr: 数据长度不能 > 128" )
|
||||
private String packageAddr;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
@ApiModelProperty("创建人")
|
||||
@Size(max = 32, message="创建人-createdBy: 数据长度不能 > 32" )
|
||||
private String createdBy;
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
@ApiModelProperty("更新人")
|
||||
@Size(max = 32, message="更新人-updatedBy: 数据长度不能 > 32" )
|
||||
private String updatedBy;
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* id<br>
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* id<br>
|
||||
*
|
||||
* @param id id
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 资源包名称<br>
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源包名称<br>
|
||||
*
|
||||
* @param name 资源包名称
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* 资源包描述<br>
|
||||
*/
|
||||
public String getMemo()
|
||||
{
|
||||
return memo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源包描述<br>
|
||||
*
|
||||
* @param memo 资源包描述
|
||||
*/
|
||||
public void setMemo(String memo)
|
||||
{
|
||||
this.memo = memo;
|
||||
}
|
||||
/**
|
||||
* 资源包存放地址<br>
|
||||
*/
|
||||
public String getPackageAddr()
|
||||
{
|
||||
return packageAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源包存放地址<br>
|
||||
*
|
||||
* @param packageAddr 资源包存放地址
|
||||
*/
|
||||
public void setPackageAddr(String packageAddr)
|
||||
{
|
||||
this.packageAddr = packageAddr;
|
||||
}
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
public String getProId()
|
||||
{
|
||||
return proId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统id<br>
|
||||
*
|
||||
* @param proId 系统id
|
||||
*/
|
||||
public void setProId(String proId)
|
||||
{
|
||||
this.proId = proId;
|
||||
}
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
public String getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户id<br>
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
*/
|
||||
public void setTenantId(String tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人<br>
|
||||
*
|
||||
* @param createdBy 创建人
|
||||
*/
|
||||
public void setCreatedBy(String createdBy)
|
||||
{
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
public String getUpdatedBy()
|
||||
{
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新人<br>
|
||||
*
|
||||
* @param updatedBy 更新人
|
||||
*/
|
||||
public void setUpdatedBy(String updatedBy)
|
||||
{
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
public Date getCreatedTime()
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
return (Date)createdTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*
|
||||
* @param createdTime 创建时间
|
||||
*/
|
||||
public void setCreatedTime(Date createdTime)
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
this.createdTime = (Date)createdTime.clone();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
public Date getUpdatedTime()
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
return (Date)updatedTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*
|
||||
* @param updatedTime 更新时间
|
||||
*/
|
||||
public void setUpdatedTime(Date updatedTime)
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
this.updatedTime = (Date)updatedTime.clone();
|
||||
}
|
||||
}
|
||||
|
||||
public DataResourcePackage()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,312 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.common.db.entity.Entity;
|
||||
import net.northking.cctp.common.saas.db.TenantPartition;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 数据规则表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@ApiModel(description = "数据规则表")
|
||||
public class DataRule extends TenantPartition implements Entity
|
||||
{
|
||||
public static final String KEY_ruleId = "ruleId";
|
||||
public static final String KEY_name = "name";
|
||||
public static final String KEY_type = "type";
|
||||
public static final String KEY_contentExpression = "contentExpression";
|
||||
public static final String KEY_jarIds = "jarIds";
|
||||
public static final String KEY_proId = "proId";
|
||||
public static final String KEY_tenantId = "tenantId";
|
||||
public static final String KEY_createdBy = "createdBy";
|
||||
public static final String KEY_createdTime = "createdTime";
|
||||
public static final String KEY_updatedBy = "updatedBy";
|
||||
public static final String KEY_updatedTime = "updatedTime";
|
||||
|
||||
/**
|
||||
* 规则id<br>
|
||||
*/
|
||||
@ApiModelProperty("规则id")
|
||||
@Size(max = 32, message="规则id-ruleId: 数据长度不能 > 32" )
|
||||
private String ruleId;
|
||||
/**
|
||||
* 规则名称<br>
|
||||
*/
|
||||
@ApiModelProperty("规则名称")
|
||||
@Size(max = 32, message="规则名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 规则类型<br>
|
||||
*/
|
||||
@ApiModelProperty("规则类型")
|
||||
@Size(max = 1, message="规则类型-type: 数据长度不能 > 1" )
|
||||
private String type;
|
||||
/**
|
||||
* 正则表达式、脚本编码<br>
|
||||
*/
|
||||
@ApiModelProperty("正则表达式、脚本编码")
|
||||
@Size(max = 65535, message="正则表达式、脚本编码-contentExpression: 数据长度不能 > 65535" )
|
||||
private String contentExpression;
|
||||
/**
|
||||
* 资源包集合<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包集合")
|
||||
@Size(max = 1024, message="资源包集合-jarIds: 数据长度不能 > 1024" )
|
||||
private String jarIds;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
@ApiModelProperty("创建人")
|
||||
@Size(max = 32, message="创建人-createdBy: 数据长度不能 > 32" )
|
||||
private String createdBy;
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
@ApiModelProperty("更新人")
|
||||
@Size(max = 32, message="更新人-updatedBy: 数据长度不能 > 32" )
|
||||
private String updatedBy;
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 规则id<br>
|
||||
*/
|
||||
public String getRuleId()
|
||||
{
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则id<br>
|
||||
*
|
||||
* @param ruleId 规则id
|
||||
*/
|
||||
public void setRuleId(String ruleId)
|
||||
{
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
/**
|
||||
* 规则名称<br>
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则名称<br>
|
||||
*
|
||||
* @param name 规则名称
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* 规则类型<br>
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则类型<br>
|
||||
*
|
||||
* @param type 规则类型
|
||||
*/
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* 正则表达式、脚本编码<br>
|
||||
*/
|
||||
public String getContentExpression()
|
||||
{
|
||||
return contentExpression;
|
||||
}
|
||||
|
||||
/**
|
||||
* 正则表达式、脚本编码<br>
|
||||
*
|
||||
* @param contentExpression 正则表达式、脚本编码
|
||||
*/
|
||||
public void setContentExpression(String contentExpression)
|
||||
{
|
||||
this.contentExpression = contentExpression;
|
||||
}
|
||||
/**
|
||||
* 资源包集合<br>
|
||||
*/
|
||||
public String getJarIds()
|
||||
{
|
||||
return jarIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源包集合<br>
|
||||
*
|
||||
* @param jarIds 资源包集合
|
||||
*/
|
||||
public void setJarIds(String jarIds)
|
||||
{
|
||||
this.jarIds = jarIds;
|
||||
}
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
public String getProId()
|
||||
{
|
||||
return proId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统id<br>
|
||||
*
|
||||
* @param proId 系统id
|
||||
*/
|
||||
public void setProId(String proId)
|
||||
{
|
||||
this.proId = proId;
|
||||
}
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
public String getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户id<br>
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
*/
|
||||
public void setTenantId(String tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人<br>
|
||||
*
|
||||
* @param createdBy 创建人
|
||||
*/
|
||||
public void setCreatedBy(String createdBy)
|
||||
{
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
public Date getCreatedTime()
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
return (Date)createdTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*
|
||||
* @param createdTime 创建时间
|
||||
*/
|
||||
public void setCreatedTime(Date createdTime)
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
this.createdTime = (Date)createdTime.clone();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
public String getUpdatedBy()
|
||||
{
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新人<br>
|
||||
*
|
||||
* @param updatedBy 更新人
|
||||
*/
|
||||
public void setUpdatedBy(String updatedBy)
|
||||
{
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
public Date getUpdatedTime()
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
return (Date)updatedTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*
|
||||
* @param updatedTime 更新时间
|
||||
*/
|
||||
public void setUpdatedTime(Date updatedTime)
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
this.updatedTime = (Date)updatedTime.clone();
|
||||
}
|
||||
}
|
||||
|
||||
public DataRule()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.common.db.Partition;
|
||||
import net.northking.cctp.common.db.entity.Entity;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 数据集环境关联表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2023-08-23 17:53:02 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@ApiModel(description = "数据集环境关联表")
|
||||
public class DataSetEnvRel extends Partition implements Entity
|
||||
{
|
||||
public static final String KEY_id = "id";
|
||||
public static final String KEY_dataSetId = "dataSetId";
|
||||
public static final String KEY_envId = "envId";
|
||||
public static final String KEY_tenantId = "tenantId";
|
||||
public static final String KEY_seq = "seq";
|
||||
public static final String KEY_createdTime = "createdTime";
|
||||
public static final String KEY_createdBy = "createdBy";
|
||||
public static final String KEY_updatedTime = "updatedTime";
|
||||
public static final String KEY_updatedBy = "updatedBy";
|
||||
public static final String KEY_fileAddr = "fileAddr";
|
||||
|
||||
/**
|
||||
* 主键<br>
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@Size(max = 32, message="主键-id: 数据长度不能 > 32" )
|
||||
private String id;
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集id")
|
||||
@Size(max = 32, message="数据集id-dataSetId: 数据长度不能 > 32" )
|
||||
private String dataSetId;
|
||||
/**
|
||||
* 环境id<br>
|
||||
*/
|
||||
@ApiModelProperty("环境id")
|
||||
@Size(max = 32, message="环境id-envId: 数据长度不能 > 32" )
|
||||
private String envId;
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
/**
|
||||
* 排序<br>
|
||||
*/
|
||||
@ApiModelProperty("排序")
|
||||
private Integer seq;
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
@ApiModelProperty("创建人")
|
||||
@Size(max = 32, message="创建人-createdBy: 数据长度不能 > 32" )
|
||||
private String createdBy;
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedTime;
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
@ApiModelProperty("更新人")
|
||||
@Size(max = 32, message="更新人-updatedBy: 数据长度不能 > 32" )
|
||||
private String updatedBy;
|
||||
/**
|
||||
* 文件地址<br>
|
||||
*/
|
||||
@ApiModelProperty("文件地址")
|
||||
@Size(max = 1024, message="文件地址-fileAddr: 数据长度不能 > 1024" )
|
||||
private String fileAddr;
|
||||
|
||||
/**
|
||||
* 主键<br>
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键<br>
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*/
|
||||
public String getDataSetId()
|
||||
{
|
||||
return dataSetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*
|
||||
* @param dataSetId 数据集id
|
||||
*/
|
||||
public void setDataSetId(String dataSetId)
|
||||
{
|
||||
this.dataSetId = dataSetId;
|
||||
}
|
||||
/**
|
||||
* 环境id<br>
|
||||
*/
|
||||
public String getEnvId()
|
||||
{
|
||||
return envId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 环境id<br>
|
||||
*
|
||||
* @param envId 环境id
|
||||
*/
|
||||
public void setEnvId(String envId)
|
||||
{
|
||||
this.envId = envId;
|
||||
}
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
public String getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户id<br>
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
*/
|
||||
public void setTenantId(String tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
/**
|
||||
* 排序<br>
|
||||
*/
|
||||
public Integer getSeq()
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序<br>
|
||||
*
|
||||
* @param seq 排序
|
||||
*/
|
||||
public void setSeq(Integer seq)
|
||||
{
|
||||
this.seq = seq;
|
||||
}
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
public Date getCreatedTime()
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
return (Date)createdTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*
|
||||
* @param createdTime 创建时间
|
||||
*/
|
||||
public void setCreatedTime(Date createdTime)
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
this.createdTime = (Date)createdTime.clone();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人<br>
|
||||
*
|
||||
* @param createdBy 创建人
|
||||
*/
|
||||
public void setCreatedBy(String createdBy)
|
||||
{
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
public Date getUpdatedTime()
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
return (Date)updatedTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*
|
||||
* @param updatedTime 更新时间
|
||||
*/
|
||||
public void setUpdatedTime(Date updatedTime)
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
this.updatedTime = (Date)updatedTime.clone();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
public String getUpdatedBy()
|
||||
{
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新人<br>
|
||||
*
|
||||
* @param updatedBy 更新人
|
||||
*/
|
||||
public void setUpdatedBy(String updatedBy)
|
||||
{
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
/**
|
||||
* 文件地址<br>
|
||||
*/
|
||||
public String getFileAddr()
|
||||
{
|
||||
return fileAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件地址<br>
|
||||
*
|
||||
* @param fileAddr 文件地址
|
||||
*/
|
||||
public void setFileAddr(String fileAddr)
|
||||
{
|
||||
this.fileAddr = fileAddr;
|
||||
}
|
||||
|
||||
public DataSetEnvRel()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,395 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.common.db.entity.Entity;
|
||||
import net.northking.cctp.common.saas.db.TenantPartition;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 数据集树目录表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@ApiModel(description = "数据集树目录表")
|
||||
public class DataSetTree extends TenantPartition implements Entity
|
||||
{
|
||||
public static final String KEY_id = "id";
|
||||
public static final String KEY_name = "name";
|
||||
public static final String KEY_parentId = "parentId";
|
||||
public static final String KEY_levelNo = "levelNo";
|
||||
public static final String KEY_indexNo = "indexNo";
|
||||
public static final String KEY_isLeaf = "isLeaf";
|
||||
public static final String KEY_path = "path";
|
||||
public static final String KEY_fullName = "fullName";
|
||||
public static final String KEY_proId = "proId";
|
||||
public static final String KEY_tenantId = "tenantId";
|
||||
public static final String KEY_createdBy = "createdBy";
|
||||
public static final String KEY_createdTime = "createdTime";
|
||||
public static final String KEY_updatedBy = "updatedBy";
|
||||
public static final String KEY_updatedTime = "updatedTime";
|
||||
public static final String KEY_description = "description";
|
||||
|
||||
/**
|
||||
* id<br>
|
||||
*/
|
||||
@ApiModelProperty("id")
|
||||
@Size(max = 32, message="id-id: 数据长度不能 > 32" )
|
||||
private String id;
|
||||
/**
|
||||
* 节点名称<br>
|
||||
*/
|
||||
@ApiModelProperty("节点名称")
|
||||
@Size(max = 32, message="节点名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 父节点id<br>
|
||||
*/
|
||||
@ApiModelProperty("父节点id")
|
||||
@Size(max = 32, message="父节点id-parentId: 数据长度不能 > 32" )
|
||||
private String parentId;
|
||||
/**
|
||||
* 层级<br>
|
||||
*/
|
||||
@ApiModelProperty("层级")
|
||||
private Integer levelNo;
|
||||
/**
|
||||
* 序号<br>
|
||||
*/
|
||||
@ApiModelProperty("序号")
|
||||
private Integer indexNo;
|
||||
/**
|
||||
* 是否叶子节点<br>
|
||||
*/
|
||||
@ApiModelProperty("是否叶子节点")
|
||||
@Size(max = 1, message="是否叶子节点-isLeaf: 数据长度不能 > 1" )
|
||||
private String isLeaf;
|
||||
/**
|
||||
* 路径<br>
|
||||
*/
|
||||
@ApiModelProperty("路径")
|
||||
@Size(max = 1024, message="路径-path: 数据长度不能 > 1024" )
|
||||
private String path;
|
||||
/**
|
||||
* 完整路径<br>
|
||||
*/
|
||||
@ApiModelProperty("完整路径")
|
||||
@Size(max = 1024, message="完整路径-fullName: 数据长度不能 > 1024" )
|
||||
private String fullName;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
@ApiModelProperty("创建人")
|
||||
@Size(max = 32, message="创建人-createdBy: 数据长度不能 > 32" )
|
||||
private String createdBy;
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
@ApiModelProperty("更新人")
|
||||
@Size(max = 32, message="更新人-updatedBy: 数据长度不能 > 32" )
|
||||
private String updatedBy;
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedTime;
|
||||
/**
|
||||
* 描述<br>
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
@Size(max = 255, message="描述-description: 数据长度不能 > 255" )
|
||||
private String description;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* id<br>
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* id<br>
|
||||
*
|
||||
* @param id id
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 节点名称<br>
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 节点名称<br>
|
||||
*
|
||||
* @param name 节点名称
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* 父节点id<br>
|
||||
*/
|
||||
public String getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 父节点id<br>
|
||||
*
|
||||
* @param parentId 父节点id
|
||||
*/
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
/**
|
||||
* 层级<br>
|
||||
*/
|
||||
public Integer getLevelNo()
|
||||
{
|
||||
return levelNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 层级<br>
|
||||
*
|
||||
* @param levelNo 层级
|
||||
*/
|
||||
public void setLevelNo(Integer levelNo)
|
||||
{
|
||||
this.levelNo = levelNo;
|
||||
}
|
||||
/**
|
||||
* 序号<br>
|
||||
*/
|
||||
public Integer getIndexNo()
|
||||
{
|
||||
return indexNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 序号<br>
|
||||
*
|
||||
* @param indexNo 序号
|
||||
*/
|
||||
public void setIndexNo(Integer indexNo)
|
||||
{
|
||||
this.indexNo = indexNo;
|
||||
}
|
||||
/**
|
||||
* 是否叶子节点<br>
|
||||
*/
|
||||
public String getIsLeaf()
|
||||
{
|
||||
return isLeaf;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否叶子节点<br>
|
||||
*
|
||||
* @param isLeaf 是否叶子节点
|
||||
*/
|
||||
public void setIsLeaf(String isLeaf)
|
||||
{
|
||||
this.isLeaf = isLeaf;
|
||||
}
|
||||
/**
|
||||
* 路径<br>
|
||||
*/
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 路径<br>
|
||||
*
|
||||
* @param path 路径
|
||||
*/
|
||||
public void setPath(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
/**
|
||||
* 完整路径<br>
|
||||
*/
|
||||
public String getFullName()
|
||||
{
|
||||
return fullName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整路径<br>
|
||||
*
|
||||
* @param fullName 完整路径
|
||||
*/
|
||||
public void setFullName(String fullName)
|
||||
{
|
||||
this.fullName = fullName;
|
||||
}
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
public String getProId()
|
||||
{
|
||||
return proId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统id<br>
|
||||
*
|
||||
* @param proId 系统id
|
||||
*/
|
||||
public void setProId(String proId)
|
||||
{
|
||||
this.proId = proId;
|
||||
}
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
public String getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户id<br>
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
*/
|
||||
public void setTenantId(String tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人<br>
|
||||
*
|
||||
* @param createdBy 创建人
|
||||
*/
|
||||
public void setCreatedBy(String createdBy)
|
||||
{
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
public Date getCreatedTime()
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
return (Date)createdTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*
|
||||
* @param createdTime 创建时间
|
||||
*/
|
||||
public void setCreatedTime(Date createdTime)
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
this.createdTime = (Date)createdTime.clone();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
public String getUpdatedBy()
|
||||
{
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新人<br>
|
||||
*
|
||||
* @param updatedBy 更新人
|
||||
*/
|
||||
public void setUpdatedBy(String updatedBy)
|
||||
{
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
public Date getUpdatedTime()
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
return (Date)updatedTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*
|
||||
* @param updatedTime 更新时间
|
||||
*/
|
||||
public void setUpdatedTime(Date updatedTime)
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
this.updatedTime = (Date)updatedTime.clone();
|
||||
}
|
||||
}
|
||||
|
||||
public DataSetTree()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,312 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.common.db.entity.Entity;
|
||||
import net.northking.cctp.common.saas.db.TenantPartition;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 数据集
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@ApiModel(description = "数据集")
|
||||
public class DataSets extends TenantPartition implements Entity
|
||||
{
|
||||
public static final String KEY_dataSetId = "dataSetId";
|
||||
public static final String KEY_name = "name";
|
||||
public static final String KEY_description = "description";
|
||||
public static final String KEY_proId = "proId";
|
||||
public static final String KEY_tenantId = "tenantId";
|
||||
public static final String KEY_fileAddr = "fileAddr";
|
||||
public static final String KEY_treeId = "treeId";
|
||||
public static final String KEY_createdBy = "createdBy";
|
||||
public static final String KEY_createdTime = "createdTime";
|
||||
public static final String KEY_updatedBy = "updatedBy";
|
||||
public static final String KEY_updatedTime = "updatedTime";
|
||||
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集id")
|
||||
@Size(max = 32, message="数据集id-dataSetId: 数据长度不能 > 32" )
|
||||
private String dataSetId;
|
||||
/**
|
||||
* 数据集名称<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集名称")
|
||||
@Size(max = 32, message="数据集名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 描述<br>
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
@Size(max = 255, message="描述-description: 数据长度不能 > 255" )
|
||||
private String description;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
/**
|
||||
* 文件地址<br>
|
||||
*/
|
||||
@ApiModelProperty("文件地址")
|
||||
@Size(max = 1024, message="文件地址-fileAddr: 数据长度不能 > 1024" )
|
||||
private String fileAddr;
|
||||
/**
|
||||
* 目录id<br>
|
||||
*/
|
||||
@ApiModelProperty("目录id")
|
||||
@Size(max = 32, message="目录id-treeId: 数据长度不能 > 32" )
|
||||
private String treeId;
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
@ApiModelProperty("创建人")
|
||||
@Size(max = 32, message="创建人-createdBy: 数据长度不能 > 32" )
|
||||
private String createdBy;
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
@ApiModelProperty("更新人")
|
||||
@Size(max = 32, message="更新人-updatedBy: 数据长度不能 > 32" )
|
||||
private String updatedBy;
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*/
|
||||
public String getDataSetId()
|
||||
{
|
||||
return dataSetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*
|
||||
* @param dataSetId 数据集id
|
||||
*/
|
||||
public void setDataSetId(String dataSetId)
|
||||
{
|
||||
this.dataSetId = dataSetId;
|
||||
}
|
||||
/**
|
||||
* 数据集名称<br>
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据集名称<br>
|
||||
*
|
||||
* @param name 数据集名称
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* 描述<br>
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述<br>
|
||||
*
|
||||
* @param description 描述
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
public String getProId()
|
||||
{
|
||||
return proId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统id<br>
|
||||
*
|
||||
* @param proId 系统id
|
||||
*/
|
||||
public void setProId(String proId)
|
||||
{
|
||||
this.proId = proId;
|
||||
}
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
public String getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户id<br>
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
*/
|
||||
public void setTenantId(String tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
/**
|
||||
* 文件地址<br>
|
||||
*/
|
||||
public String getFileAddr()
|
||||
{
|
||||
return fileAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件地址<br>
|
||||
*
|
||||
* @param fileAddr 文件地址
|
||||
*/
|
||||
public void setFileAddr(String fileAddr)
|
||||
{
|
||||
this.fileAddr = fileAddr;
|
||||
}
|
||||
/**
|
||||
* 目录id<br>
|
||||
*/
|
||||
public String getTreeId()
|
||||
{
|
||||
return treeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 目录id<br>
|
||||
*
|
||||
* @param treeId 目录id
|
||||
*/
|
||||
public void setTreeId(String treeId)
|
||||
{
|
||||
this.treeId = treeId;
|
||||
}
|
||||
/**
|
||||
* 创建人<br>
|
||||
*/
|
||||
public String getCreatedBy()
|
||||
{
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人<br>
|
||||
*
|
||||
* @param createdBy 创建人
|
||||
*/
|
||||
public void setCreatedBy(String createdBy)
|
||||
{
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*/
|
||||
public Date getCreatedTime()
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
return (Date)createdTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间<br>
|
||||
*
|
||||
* @param createdTime 创建时间
|
||||
*/
|
||||
public void setCreatedTime(Date createdTime)
|
||||
{
|
||||
if(createdTime != null)
|
||||
{
|
||||
this.createdTime = (Date)createdTime.clone();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新人<br>
|
||||
*/
|
||||
public String getUpdatedBy()
|
||||
{
|
||||
return updatedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新人<br>
|
||||
*
|
||||
* @param updatedBy 更新人
|
||||
*/
|
||||
public void setUpdatedBy(String updatedBy)
|
||||
{
|
||||
this.updatedBy = updatedBy;
|
||||
}
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*/
|
||||
public Date getUpdatedTime()
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
return (Date)updatedTime.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间<br>
|
||||
*
|
||||
* @param updatedTime 更新时间
|
||||
*/
|
||||
public void setUpdatedTime(Date updatedTime)
|
||||
{
|
||||
if(updatedTime != null)
|
||||
{
|
||||
this.updatedTime = (Date)updatedTime.clone();
|
||||
}
|
||||
}
|
||||
|
||||
public DataSets()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.impl;
|
||||
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.dao.DataResourcePackageDao;
|
||||
import net.northking.cctp.dataPool.db.service.DataResourcePackageService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.common.saas.db.TenantEntityService;
|
||||
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageQueryDto;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 资源包
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataResourcePackageServiceImpl")
|
||||
public class DataResourcePackageServiceImpl extends TenantEntityService<DataResourcePackage> implements DataResourcePackageService
|
||||
{
|
||||
|
||||
private final DataResourcePackageDao dataResourcePackageDao;
|
||||
|
||||
public DataResourcePackageServiceImpl(DataResourcePackageDao dataResourcePackageDao) {this.dataResourcePackageDao = dataResourcePackageDao;}
|
||||
|
||||
public BasicDao<DataResourcePackage> getDao() {return dataResourcePackageDao;}
|
||||
|
||||
public DataResourcePackage createEntity() { return new DataResourcePackage();}
|
||||
|
||||
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
|
||||
@Override
|
||||
public List<DataResourcePackageDetailDto> getDataResourcePackages(QueryByPage<DataResourcePackageQueryDto> queryByPage) {
|
||||
return dataResourcePackageDao.getDataResourcePackages(queryByPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataResourcePackage> queryByIds(List<String> idList) {
|
||||
return dataResourcePackageDao.queryByIds(idList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.impl;
|
||||
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.dao.DataRuleDao;
|
||||
import net.northking.cctp.dataPool.db.service.DataRuleService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataRule;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.common.saas.db.TenantEntityService;
|
||||
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleQueryDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleUpdateDto;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* 数据规则表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataRuleServiceImpl")
|
||||
public class DataRuleServiceImpl extends TenantEntityService<DataRule> implements DataRuleService
|
||||
{
|
||||
|
||||
private final DataRuleDao dataRuleDao;
|
||||
|
||||
public DataRuleServiceImpl(DataRuleDao dataRuleDao) {this.dataRuleDao = dataRuleDao;}
|
||||
|
||||
public BasicDao<DataRule> getDao() {return dataRuleDao;}
|
||||
|
||||
public DataRule createEntity() { return new DataRule();}
|
||||
|
||||
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
|
||||
@Override
|
||||
public Integer queryRuleByName(DataRuleUpdateDto dto) {
|
||||
return dataRuleDao.queryRuleByName(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataRuleDetailDto> getDataRules(QueryByPage<DataRuleQueryDto> queryByPage) {
|
||||
return dataRuleDao.getDataRules(queryByPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataRule> queryByIdSet(Set<String> idSet) {
|
||||
return dataRuleDao.queryByIdSet(idSet);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.impl;
|
||||
|
||||
import net.northking.cctp.dataPool.db.dao.DataSetEnvRelDao;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetEnvRelService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetEnvRel;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.common.db.PaginationService;
|
||||
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFeignDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 数据集环境关联表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2023-08-23 17:53:02 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataSetEnvRelServiceImpl")
|
||||
public class DataSetEnvRelServiceImpl extends PaginationService<DataSetEnvRel> implements DataSetEnvRelService
|
||||
{
|
||||
|
||||
private final DataSetEnvRelDao dataSetEnvRelDao;
|
||||
|
||||
public DataSetEnvRelServiceImpl(DataSetEnvRelDao dataSetEnvRelDao) {this.dataSetEnvRelDao = dataSetEnvRelDao;}
|
||||
|
||||
public BasicDao<DataSetEnvRel> getDao() {return dataSetEnvRelDao;}
|
||||
|
||||
public DataSetEnvRel createEntity() { return new DataSetEnvRel();}
|
||||
|
||||
@Override
|
||||
protected void beforeInsert(DataSetEnvRel record) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeUpdate(DataSetEnvRel record) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AtuScriptInputSetQuoteFieldDto selectDataUrlAndTreeName(AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto) {
|
||||
return dataSetEnvRelDao.selectDataUrlAndTreeName(atuScriptInputSetQuoteFieldDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AtuScriptInputSetQuoteFeignDto> getDataSetFile(List<String> list, String envId) {
|
||||
return dataSetEnvRelDao.getDataSetFile(list, envId);
|
||||
}
|
||||
|
||||
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.impl;
|
||||
|
||||
import net.northking.cctp.dataPool.db.dao.DataSetTreeDao;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetTreeService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetTree;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.common.saas.db.TenantEntityService;
|
||||
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeMoveDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeQueryDto;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 数据集树目录表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataSetTreeServiceImpl")
|
||||
public class DataSetTreeServiceImpl extends TenantEntityService<DataSetTree> implements DataSetTreeService
|
||||
{
|
||||
private final DataSetTreeDao dataSetTreeDao;
|
||||
|
||||
public DataSetTreeServiceImpl(DataSetTreeDao dataSetTreeDao) {this.dataSetTreeDao = dataSetTreeDao;}
|
||||
|
||||
public BasicDao<DataSetTree> getDao() {return dataSetTreeDao;}
|
||||
|
||||
public DataSetTree createEntity() { return new DataSetTree();}
|
||||
|
||||
@Override
|
||||
public int updateChildNamePath(DataSetTree childSetTrees, String namePathNew) {
|
||||
return dataSetTreeDao.updateChildNamePath(childSetTrees, namePathNew);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataSetTreeDetailDto> selectDataSetTree(DataSetTreeQueryDto setTreeQueryDto) {
|
||||
return dataSetTreeDao.selectDataSetTree(setTreeQueryDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataSetTreeDetailDto> queryChildrenTreeList(String treeId) {
|
||||
return dataSetTreeDao.queryChildrenTreeList(treeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataSetTree> queryByIds(List<String> list) {
|
||||
return dataSetTreeDao.queryByIds(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countMaxLevelNo(DataSetTree queryLevel) {
|
||||
return dataSetTreeDao.countMaxLevelNo(queryLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSeqByMove(DataSetTreeMoveDto childUp) {
|
||||
dataSetTreeDao.updateSeqByMove(childUp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateChildIdPath(DataSetTree child, String path) {
|
||||
return dataSetTreeDao.updateChildIdPath(child, path);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.impl;
|
||||
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.dao.DataSetsDao;
|
||||
import net.northking.cctp.dataPool.db.service.DataSetsService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSets;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.common.saas.db.TenantEntityService;
|
||||
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetsDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetsQueryDto;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 数据集
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:39 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@Service
|
||||
@ConditionalOnMissingBean(name = "DataSetsServiceImpl")
|
||||
public class DataSetsServiceImpl extends TenantEntityService<DataSets> implements DataSetsService
|
||||
{
|
||||
|
||||
private final DataSetsDao dataSetsDao;
|
||||
|
||||
public DataSetsServiceImpl(DataSetsDao dataSetsDao) {this.dataSetsDao = dataSetsDao;}
|
||||
|
||||
public BasicDao<DataSets> getDao() {return dataSetsDao;}
|
||||
|
||||
public DataSets createEntity() { return new DataSets();}
|
||||
|
||||
|
||||
// ---- The End by Generator ----//
|
||||
|
||||
|
||||
@Override
|
||||
public List<DataSetsDetailDto> queryDataSets(QueryByPage<DataSetsQueryDto> query) {
|
||||
return dataSetsDao.queryDataSets(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataSets> queryByIds(List<String> setIds) {
|
||||
return dataSetsDao.queryByIds(setIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByIds(List<String> setIds) {
|
||||
return dataSetsDao.deleteByIds(setIds);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.mapper;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(底层):资源包
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改!
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataResourcePackageMapper extends BasicDao<DataResourcePackage>
|
||||
{
|
||||
String EntityName = "DataResourcePackage";
|
||||
|
||||
String COLUMN_id = "id";
|
||||
String COLUMN_name = "name";
|
||||
String COLUMN_memo = "memo";
|
||||
String COLUMN_packageAddr = "package_addr";
|
||||
String COLUMN_proId = "pro_id";
|
||||
String COLUMN_tenantId = "tenant_id";
|
||||
String COLUMN_createdBy = "created_by";
|
||||
String COLUMN_updatedBy = "updated_by";
|
||||
String COLUMN_createdTime = "created_time";
|
||||
String COLUMN_updatedTime = "updated_time";
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.mapper;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.dataPool.db.entity.DataRule;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(底层):数据规则表
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改!
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataRuleMapper extends BasicDao<DataRule>
|
||||
{
|
||||
String EntityName = "DataRule";
|
||||
|
||||
String COLUMN_ruleId = "rule_id";
|
||||
String COLUMN_name = "name";
|
||||
String COLUMN_type = "type";
|
||||
String COLUMN_contentExpression = "content_expression";
|
||||
String COLUMN_jarIds = "jar_ids";
|
||||
String COLUMN_proId = "pro_id";
|
||||
String COLUMN_tenantId = "tenant_id";
|
||||
String COLUMN_createdBy = "created_by";
|
||||
String COLUMN_createdTime = "created_time";
|
||||
String COLUMN_updatedBy = "updated_by";
|
||||
String COLUMN_updatedTime = "updated_time";
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.mapper;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetEnvRel;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(底层):数据集环境关联表
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改!
|
||||
* createdate: 2023-08-23 17:53:02 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataSetEnvRelMapper extends BasicDao<DataSetEnvRel>
|
||||
{
|
||||
String EntityName = "DataSetEnvRel";
|
||||
|
||||
String COLUMN_id = "id";
|
||||
String COLUMN_dataSetId = "data_set_id";
|
||||
String COLUMN_envId = "env_id";
|
||||
String COLUMN_tenantId = "tenant_id";
|
||||
String COLUMN_seq = "seq";
|
||||
String COLUMN_createdTime = "created_time";
|
||||
String COLUMN_createdBy = "created_by";
|
||||
String COLUMN_updatedTime = "updated_time";
|
||||
String COLUMN_updatedBy = "updated_by";
|
||||
String COLUMN_fileAddr = "file_addr";
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.mapper;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetTree;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(底层):数据集树目录表
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改!
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataSetTreeMapper extends BasicDao<DataSetTree>
|
||||
{
|
||||
String EntityName = "DataSetTree";
|
||||
|
||||
String COLUMN_id = "id";
|
||||
String COLUMN_name = "name";
|
||||
String COLUMN_parentId = "parent_id";
|
||||
String COLUMN_levelNo = "level_no";
|
||||
String COLUMN_indexNo = "index_no";
|
||||
String COLUMN_isLeaf = "is_leaf";
|
||||
String COLUMN_path = "path";
|
||||
String COLUMN_fullName = "full_name";
|
||||
String COLUMN_proId = "pro_id";
|
||||
String COLUMN_tenantId = "tenant_id";
|
||||
String COLUMN_createdBy = "created_by";
|
||||
String COLUMN_createdTime = "created_time";
|
||||
String COLUMN_updatedBy = "updated_by";
|
||||
String COLUMN_updatedTime = "updated_time";
|
||||
String COLUMN_description = "description";
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.mapper;
|
||||
|
||||
import net.northking.cctp.common.db.BasicDao;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSets;
|
||||
|
||||
/**
|
||||
* Mybatis数据库持久层(底层):数据集
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改!
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataSetsMapper extends BasicDao<DataSets>
|
||||
{
|
||||
String EntityName = "DataSets";
|
||||
|
||||
String COLUMN_dataSetId = "data_set_id";
|
||||
String COLUMN_name = "name";
|
||||
String COLUMN_desc = "description";
|
||||
String COLUMN_proId = "pro_id";
|
||||
String COLUMN_tenantId = "tenant_id";
|
||||
String COLUMN_fileAddr = "file_addr";
|
||||
String COLUMN_treeId = "tree_id";
|
||||
String COLUMN_createdBy = "created_by";
|
||||
String COLUMN_createdTime = "created_time";
|
||||
String COLUMN_updatedBy = "updated_by";
|
||||
String COLUMN_updatedTime = "updated_time";
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.service;
|
||||
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataResourcePackageQueryDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源包
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataResourcePackageService extends BasicService<DataResourcePackage>
|
||||
{
|
||||
/**
|
||||
* 条件查询资源包列表
|
||||
* @param queryByPage
|
||||
* @return
|
||||
*/
|
||||
List<DataResourcePackageDetailDto> getDataResourcePackages(QueryByPage<DataResourcePackageQueryDto> queryByPage);
|
||||
|
||||
/**
|
||||
* 根据id列表查询资源包
|
||||
* @param idList
|
||||
* @return
|
||||
*/
|
||||
List<DataResourcePackage> queryByIds(List<String> idList);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.service;
|
||||
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataRule;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleQueryDto;
|
||||
import net.northking.cctp.dataPool.dto.dataRule.DataRuleUpdateDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 数据规则表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataRuleService extends BasicService<DataRule>
|
||||
{
|
||||
/**
|
||||
* 查询同名的其他规则
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Integer queryRuleByName(DataRuleUpdateDto dto);
|
||||
|
||||
/**
|
||||
* 条件查询数据规则
|
||||
* @param queryByPage
|
||||
* @return
|
||||
*/
|
||||
List<DataRuleDetailDto> getDataRules(QueryByPage<DataRuleQueryDto> queryByPage);
|
||||
|
||||
/**
|
||||
* 根据id集合查询数据规则
|
||||
* @param idSet id集合
|
||||
* @return 结果集
|
||||
*/
|
||||
List<DataRule> queryByIdSet(Set<String> idSet);
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.service;
|
||||
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetEnvRel;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFeignDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据集环境关联表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2023-08-23 17:53:02 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataSetEnvRelService extends BasicService<DataSetEnvRel>
|
||||
{
|
||||
AtuScriptInputSetQuoteFieldDto selectDataUrlAndTreeName(AtuScriptInputSetQuoteFieldDto atuScriptInputSetQuoteFieldDto);
|
||||
|
||||
List<AtuScriptInputSetQuoteFeignDto> getDataSetFile(List<String> list, String envId);
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.service;
|
||||
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetTree;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeMoveDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetTreeQueryDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据集树目录表
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:38 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataSetTreeService extends BasicService<DataSetTree>
|
||||
{
|
||||
int updateChildNamePath(DataSetTree childSetTrees, String namePathNew);
|
||||
|
||||
List<DataSetTreeDetailDto> selectDataSetTree(DataSetTreeQueryDto setTreeQueryDto);
|
||||
|
||||
List<DataSetTreeDetailDto> queryChildrenTreeList(String treeId);
|
||||
|
||||
List<DataSetTree> queryByIds(List<String> list);
|
||||
|
||||
int countMaxLevelNo(DataSetTree queryLevel);
|
||||
|
||||
void updateSeqByMove(DataSetTreeMoveDto childUp);
|
||||
|
||||
int updateChildIdPath(DataSetTree child, String path);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.db.service;
|
||||
|
||||
import net.northking.cctp.common.db.BasicService;
|
||||
import net.northking.cctp.common.http.QueryByPage;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSets;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetsDetailDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetsQueryDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据集
|
||||
*
|
||||
* <p>文件内容由代码生成器产生,请不要手动修改! <br>
|
||||
* createdate: 2022-10-24 16:58:39 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
public interface DataSetsService extends BasicService<DataSets>
|
||||
{
|
||||
/**
|
||||
* 条件查询数据集列表
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<DataSetsDetailDto> queryDataSets(QueryByPage<DataSetsQueryDto> query);
|
||||
|
||||
/**
|
||||
* 根据id列表查询数据集
|
||||
* @param setIds
|
||||
* @return
|
||||
*/
|
||||
List<DataSets> queryByIds(List<String> setIds);
|
||||
|
||||
Integer deleteByIds(List<String> setIds);
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.dataPool.db.entity.DataResourcePackage;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--资源详情--数据传输对象:资源包
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "资源包")
|
||||
public class DataResourcePackageDetailDto extends DataResourcePackage implements Serializable
|
||||
{
|
||||
@ApiModelProperty("上传人")
|
||||
private String creator;
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "资源包信息实体")
|
||||
public class DataResourcePackageInfoDto implements Serializable {
|
||||
@ApiModelProperty("资源包id")
|
||||
private String jarId;
|
||||
|
||||
@ApiModelProperty("资源包名称")
|
||||
private String name;
|
||||
|
||||
public String getJarId() {
|
||||
return jarId;
|
||||
}
|
||||
|
||||
public void setJarId(String jarId) {
|
||||
this.jarId = jarId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 查询接口--数据传输对象:资源包
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "资源包")
|
||||
public class DataResourcePackageQueryDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 资源包名称<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包名称")
|
||||
@Size(max = 32, message="资源包名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--更新资源--数据传输对象:资源包
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "资源包")
|
||||
public class DataResourcePackageUpdateDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* id<br>
|
||||
*/
|
||||
@ApiModelProperty("id")
|
||||
@Size(max = 32, message="id-id: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "资源包id不能为空")
|
||||
private String id;
|
||||
/**
|
||||
* 资源包描述<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包描述")
|
||||
@Size(max = 128, message="资源包描述-memo: 数据长度不能 > 128" )
|
||||
private String memo;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--新增资源--数据传输对象:数据规则表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据规则表")
|
||||
public class DataRuleAddDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 规则名称<br>
|
||||
*/
|
||||
@ApiModelProperty("规则名称")
|
||||
@Size(max = 32, message="规则名称-name: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "规则名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 规则类型 0-脚本语言 1-正则表达式<br>
|
||||
*/
|
||||
@ApiModelProperty("规则类型 0-脚本语言 1-正则表达式")
|
||||
@Size(max = 1, message="规则类型-type: 数据长度不能 > 1" )
|
||||
@NotBlank(message = "规则类型不能为空")
|
||||
private String type;
|
||||
/**
|
||||
* 正则表达式、脚本编码<br>
|
||||
*/
|
||||
@ApiModelProperty("正则表达式、脚本编码")
|
||||
@Size(max = 65535, message="正则表达式、脚本编码-contentExpression: 数据长度不能 > 65535" )
|
||||
private String contentExpression;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 资源包集合<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包集合")
|
||||
@Size(max = 1024, message="资源包集合-jarIds: 数据长度不能 > 1024" )
|
||||
private String jarIds;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContentExpression() {
|
||||
return contentExpression;
|
||||
}
|
||||
|
||||
public void setContentExpression(String contentExpression) {
|
||||
this.contentExpression = contentExpression;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public String getJarIds() {
|
||||
return jarIds;
|
||||
}
|
||||
|
||||
public void setJarIds(String jarIds) {
|
||||
this.jarIds = jarIds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.dataPool.db.entity.DataRule;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Restful接口--资源详情--数据传输对象:数据规则表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据规则表")
|
||||
public class DataRuleDetailDto extends DataRule implements Serializable
|
||||
{
|
||||
@ApiModelProperty("创建人名称")
|
||||
private String creator;
|
||||
@ApiModelProperty("修改人名称")
|
||||
private String modifier;
|
||||
@ApiModelProperty("系统名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty("引用的资源包名称列表")
|
||||
private List<DataResourcePackageInfoDto> jarInfoList;
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public List<DataResourcePackageInfoDto> getJarInfoList() {
|
||||
return jarInfoList;
|
||||
}
|
||||
|
||||
public void setJarInfoList(List<DataResourcePackageInfoDto> jarInfoList) {
|
||||
this.jarInfoList = jarInfoList;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据规则测试实体")
|
||||
public class DataRuleExecuteDto implements Serializable {
|
||||
/**
|
||||
* 规则名称<br>
|
||||
*/
|
||||
@ApiModelProperty("规则名称")
|
||||
@Size(max = 32, message="规则名称-name: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "规则名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 规则类型 0-脚本语言 1-正则表达式<br>
|
||||
*/
|
||||
@ApiModelProperty("规则类型 0-脚本语言 1-正则表达式")
|
||||
@Size(max = 1, message="规则类型-type: 数据长度不能 > 1" )
|
||||
@NotBlank(message = "规则类型不能为空")
|
||||
private String type;
|
||||
/**
|
||||
* 正则表达式、脚本编码<br>
|
||||
*/
|
||||
@ApiModelProperty("正则表达式、脚本编码")
|
||||
@Size(max = 65535, message="正则表达式、脚本编码-contentExpression: 数据长度不能 > 65535" )
|
||||
private String contentExpression;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 资源包集合<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包集合")
|
||||
@Size(max = 1024, message="资源包集合-jarIds: 数据长度不能 > 1024" )
|
||||
private String jarIds;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContentExpression() {
|
||||
return contentExpression;
|
||||
}
|
||||
|
||||
public void setContentExpression(String contentExpression) {
|
||||
this.contentExpression = contentExpression;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public String getJarIds() {
|
||||
return jarIds;
|
||||
}
|
||||
|
||||
public void setJarIds(String jarIds) {
|
||||
this.jarIds = jarIds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询接口--数据传输对象:数据规则表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据规则表")
|
||||
public class DataRuleQueryDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 规则名称<br>
|
||||
*/
|
||||
@ApiModelProperty("规则名称")
|
||||
@Size(max = 32, message="规则名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 规则类型<br>
|
||||
*/
|
||||
@ApiModelProperty("规则类型")
|
||||
@Size(max = 1, message="规则类型-type: 数据长度不能 > 1" )
|
||||
private String type;
|
||||
/**
|
||||
* 租户id<br>
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
|
||||
@ApiModelProperty("系统id列表")
|
||||
private List<String> proIds;
|
||||
|
||||
@ApiModelProperty("创建人名称")
|
||||
private String creator;
|
||||
|
||||
private List<String> creatorIds;
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public List<String> getCreatorIds() {
|
||||
return creatorIds;
|
||||
}
|
||||
|
||||
public void setCreatorIds(List<String> creatorIds) {
|
||||
this.creatorIds = creatorIds;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<String> getProIds() {
|
||||
return proIds;
|
||||
}
|
||||
|
||||
public void setProIds(List<String> proIds) {
|
||||
this.proIds = proIds;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--更新资源--数据传输对象:数据规则表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据规则表")
|
||||
public class DataRuleUpdateDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 规则id<br>
|
||||
*/
|
||||
@ApiModelProperty("规则id")
|
||||
@Size(max = 32, message="规则id-ruleId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "规则id不能为空")
|
||||
private String ruleId;
|
||||
/**
|
||||
* 规则名称<br>
|
||||
*/
|
||||
@ApiModelProperty("规则名称")
|
||||
@Size(max = 32, message="规则名称-name: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "规则名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 规则类型<br>
|
||||
*/
|
||||
@ApiModelProperty("规则类型")
|
||||
@Size(max = 1, message="规则类型-type: 数据长度不能 > 1" )
|
||||
@NotBlank(message = "规则类型不能为空")
|
||||
private String type;
|
||||
/**
|
||||
* 正则表达式、脚本编码<br>
|
||||
*/
|
||||
@ApiModelProperty("正则表达式、脚本编码")
|
||||
@Size(max = 65535, message="正则表达式、脚本编码-contentExpression: 数据长度不能 > 65535" )
|
||||
private String contentExpression;
|
||||
/**
|
||||
* 资源包集合<br>
|
||||
*/
|
||||
@ApiModelProperty("资源包集合")
|
||||
@Size(max = 1024, message="资源包集合-jarIds: 数据长度不能 > 1024" )
|
||||
private String jarIds;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
|
||||
public String getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(String ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContentExpression() {
|
||||
return contentExpression;
|
||||
}
|
||||
|
||||
public void setContentExpression(String contentExpression) {
|
||||
this.contentExpression = contentExpression;
|
||||
}
|
||||
|
||||
public String getJarIds() {
|
||||
return jarIds;
|
||||
}
|
||||
|
||||
public void setJarIds(String jarIds) {
|
||||
this.jarIds = jarIds;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package net.northking.cctp.dataPool.dto.dataRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.common.saas.db.TenantPartition;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel("用户查询实体")
|
||||
public class UserQueryDto extends TenantPartition implements Serializable {
|
||||
@Override
|
||||
public String getTenantId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTenantId(String s) {
|
||||
|
||||
}
|
||||
/**
|
||||
* 用户中文名称<br>
|
||||
*/
|
||||
@ApiModelProperty("用户中文名称")
|
||||
private String userChnName;
|
||||
|
||||
public String getUserChnName() {
|
||||
return userChnName;
|
||||
}
|
||||
|
||||
public void setUserChnName(String userChnName) {
|
||||
this.userChnName = userChnName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class AtuDataSetFeignDto {
|
||||
//静态数据集id集合
|
||||
private Set<String> dataSetList;
|
||||
//环境id
|
||||
private String envId;
|
||||
|
||||
public Set<String> getDataSetList() {
|
||||
return dataSetList;
|
||||
}
|
||||
|
||||
public void setDataSetList(Set<String> dataSetList) {
|
||||
this.dataSetList = dataSetList;
|
||||
}
|
||||
|
||||
public String getEnvId() {
|
||||
return envId;
|
||||
}
|
||||
|
||||
public void setEnvId(String envId) {
|
||||
this.envId = envId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
public class AtuScriptInputSetQuoteFeignDto extends AtuScriptInputSetQuoteFieldDto {
|
||||
|
||||
private String filePath;
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import net.northking.cctp.dataPool.constants.DataPoolConstant;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--更新资源--数据传输对象:脚本输入项数据集关联草稿表
|
||||
*
|
||||
* createdate: 2023-08-29 10:41:06 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "脚本输入项数据集关联草稿表")
|
||||
public class AtuScriptInputSetQuoteFieldDto implements Serializable
|
||||
{
|
||||
private String setId;//数据集id
|
||||
private String value;//指定某行列的单元格的值
|
||||
private String column;//列名
|
||||
private Integer row;//行号
|
||||
private String path;//静态数据集所在目录:静态数据集名称
|
||||
/**
|
||||
* 类型,默认为1,1-静态数据,2-模糊数据
|
||||
*/
|
||||
private String type = DataPoolConstant.INPUT_SET_QUOTE_TYPE_STATIC;
|
||||
|
||||
private String envId;
|
||||
|
||||
private String name;
|
||||
private String fullName;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
public void setFullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
}
|
||||
|
||||
public String getEnvId() {
|
||||
return envId;
|
||||
}
|
||||
|
||||
public void setEnvId(String envId) {
|
||||
this.envId = envId;
|
||||
}
|
||||
|
||||
public String getSetId() {
|
||||
return setId;
|
||||
}
|
||||
|
||||
public void setSetId(String setId) {
|
||||
this.setId = setId;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getColumn() {
|
||||
return column;
|
||||
}
|
||||
|
||||
public void setColumn(String column) {
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
public Integer getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public void setRow(Integer row) {
|
||||
this.row = row;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "列校验实体")
|
||||
public class ColumnCheckDto implements Serializable {
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集id")
|
||||
@Size(max = 32, message="数据集id-dataSetId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "数据集id不能为空")
|
||||
private String dataSetId;
|
||||
|
||||
@ApiModelProperty("新增列实体")
|
||||
private DataHeaderDto columnInfo;
|
||||
|
||||
public String getDataSetId() {
|
||||
return dataSetId;
|
||||
}
|
||||
|
||||
public void setDataSetId(String dataSetId) {
|
||||
this.dataSetId = dataSetId;
|
||||
}
|
||||
|
||||
public DataHeaderDto getColumnInfo() {
|
||||
return columnInfo;
|
||||
}
|
||||
|
||||
public void setColumnInfo(DataHeaderDto columnInfo) {
|
||||
this.columnInfo = columnInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据内容对象")
|
||||
public class DataContentDto implements Serializable {
|
||||
@ApiModelProperty("数值")
|
||||
private String value;
|
||||
@ApiModelProperty("被使用次数")
|
||||
private String time;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集表头对象")
|
||||
public class DataHeaderDto implements Serializable {
|
||||
@ApiModelProperty("列名称")
|
||||
private String name;
|
||||
@ApiModelProperty("数据类型")
|
||||
private String type;
|
||||
@ApiModelProperty("数据是否支撑重复使用")
|
||||
private String isRepeat;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getIsRepeat() {
|
||||
return isRepeat;
|
||||
}
|
||||
|
||||
public void setIsRepeat(String isRepeat) {
|
||||
this.isRepeat = isRepeat;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Restful接口--新增资源--数据传输对象:数据集环境关联表
|
||||
*
|
||||
* createdate: 2023-08-23 17:55:51 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集环境关联表")
|
||||
public class DataSetEnvRelAddDto implements Serializable
|
||||
{
|
||||
@ApiModelProperty("系统id")
|
||||
private String proId;
|
||||
@ApiModelProperty("数据集id")
|
||||
private String dataSetId;
|
||||
@ApiModelProperty("")
|
||||
private List<DataSetEnvRelAddTmpDto> dataSetEnvRelAddTmpDto;
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public String getDataSetId() {
|
||||
return dataSetId;
|
||||
}
|
||||
|
||||
public void setDataSetId(String dataSetId) {
|
||||
this.dataSetId = dataSetId;
|
||||
}
|
||||
|
||||
public List<DataSetEnvRelAddTmpDto> getDataSetEnvRelAddTmpDto() {
|
||||
return dataSetEnvRelAddTmpDto;
|
||||
}
|
||||
|
||||
public void setDataSetEnvRelAddTmpDto(List<DataSetEnvRelAddTmpDto> dataSetEnvRelAddTmpDto) {
|
||||
this.dataSetEnvRelAddTmpDto = dataSetEnvRelAddTmpDto;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Restful接口--新增资源--数据传输对象:数据集环境关联表
|
||||
*
|
||||
* createdate: 2023-08-23 17:55:51 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集环境关联表")
|
||||
public class DataSetEnvRelAddTmpDto implements Serializable
|
||||
{
|
||||
@ApiModelProperty("数据表头")
|
||||
private String envId;
|
||||
|
||||
@ApiModelProperty("数据表头")
|
||||
private List<DataHeaderDto> tableHeader;
|
||||
|
||||
@ApiModelProperty("数据内容 key-列名 value-该列数据信息列表")
|
||||
private Map<String,List<DataContentDto>> tableContent;
|
||||
|
||||
public String getEnvId() {
|
||||
return envId;
|
||||
}
|
||||
|
||||
public void setEnvId(String envId) {
|
||||
this.envId = envId;
|
||||
}
|
||||
|
||||
public List<DataHeaderDto> getTableHeader() {
|
||||
return tableHeader;
|
||||
}
|
||||
|
||||
public void setTableHeader(List<DataHeaderDto> tableHeader) {
|
||||
this.tableHeader = tableHeader;
|
||||
}
|
||||
|
||||
public Map<String, List<DataContentDto>> getTableContent() {
|
||||
return tableContent;
|
||||
}
|
||||
|
||||
public void setTableContent(Map<String, List<DataContentDto>> tableContent) {
|
||||
this.tableContent = tableContent;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 查询接口--数据传输对象:数据集环境关联表
|
||||
*
|
||||
* createdate: 2023-08-23 17:55:51 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集环境关联表")
|
||||
public class DataSetEnvRelQueryDto implements Serializable
|
||||
{
|
||||
@ApiModelProperty("数据集id")
|
||||
private String dataSetId;
|
||||
@ApiModelProperty("系统id")
|
||||
private String proId;
|
||||
@ApiModelProperty("环境id")
|
||||
private String envId;
|
||||
|
||||
@ApiModelProperty("表头集合")
|
||||
private List<String> tableHeaders;
|
||||
|
||||
@ApiModelProperty("数据信息 按行存储")
|
||||
private List<Map<String,Object>> tableContent;
|
||||
|
||||
public List<String> getTableHeaders() {
|
||||
return tableHeaders;
|
||||
}
|
||||
|
||||
public void setTableHeaders(List<String> tableHeaders) {
|
||||
this.tableHeaders = tableHeaders;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getTableContent() {
|
||||
return tableContent;
|
||||
}
|
||||
|
||||
public void setTableContent(List<Map<String, Object>> tableContent) {
|
||||
this.tableContent = tableContent;
|
||||
}
|
||||
|
||||
public String getEnvId() {
|
||||
return envId;
|
||||
}
|
||||
|
||||
public void setEnvId(String envId) {
|
||||
this.envId = envId;
|
||||
}
|
||||
|
||||
public String getDataSetId() {
|
||||
return dataSetId;
|
||||
}
|
||||
|
||||
public void setDataSetId(String dataSetId) {
|
||||
this.dataSetId = dataSetId;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--新增资源--数据传输对象:数据集树目录表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集树目录表")
|
||||
public class DataSetTreeAddDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 节点名称<br>
|
||||
*/
|
||||
@ApiModelProperty("节点名称")
|
||||
@Size(max = 32, message="节点名称长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 父节点id<br>
|
||||
*/
|
||||
@ApiModelProperty("父节点id")
|
||||
@Size(max = 32, message="父节点名称长度不能 > 32" )
|
||||
private String parentId;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id长度不能 > 32" )
|
||||
private String proId;
|
||||
|
||||
@ApiModelProperty("是否新增到根节点 false-否 true-是")
|
||||
private boolean addRootNode;
|
||||
|
||||
@ApiModelProperty("节点描述")
|
||||
private String description;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public boolean isAddRootNode() {
|
||||
return addRootNode;
|
||||
}
|
||||
|
||||
public void setAddRootNode(boolean addRootNode) {
|
||||
this.addRootNode = addRootNode;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSetTree;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Restful接口--资源详情--数据传输对象:数据集树目录表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集树目录表")
|
||||
public class DataSetTreeDetailDto extends DataSetTree implements Serializable
|
||||
{
|
||||
/**
|
||||
* 子节点列表<br>
|
||||
*/
|
||||
@ApiModelProperty("子节点列表")
|
||||
private List<DataSetTreeDetailDto> children;
|
||||
|
||||
@ApiModelProperty("节点次序")
|
||||
private Integer idx;
|
||||
|
||||
public Integer getIdx() {
|
||||
return idx;
|
||||
}
|
||||
|
||||
public void setIdx(Integer idx) {
|
||||
this.idx = idx;
|
||||
}
|
||||
|
||||
public List<DataSetTreeDetailDto> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<DataSetTreeDetailDto> children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集树目录表")
|
||||
public class DataSetTreeMoveDto implements Serializable {
|
||||
/**
|
||||
* 目录ID<br>
|
||||
*/
|
||||
@ApiModelProperty("目录ID")
|
||||
@Size(max = 32, message="目录ID-id: 数据长度不能 > 32" )
|
||||
private String id;
|
||||
/**
|
||||
* 目标位置父节点id<br>
|
||||
*/
|
||||
@ApiModelProperty("目标位置父节点id")
|
||||
@Size(max = 32, message="目标位置父节点id-targetId: 数据长度不能 > 32" )
|
||||
private String targetId;
|
||||
/**
|
||||
* 系统ID<br>
|
||||
*/
|
||||
@ApiModelProperty("系统ID")
|
||||
@Size(max = 32, message="系统ID-projectId: 数据长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 目标位置前一位的顺序号
|
||||
*/
|
||||
@ApiModelProperty("目标位置前一位的顺序号")
|
||||
private Integer orderSeq;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTargetId() {
|
||||
return targetId;
|
||||
}
|
||||
|
||||
public void setTargetId(String targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public Integer getOrderSeq() {
|
||||
return orderSeq;
|
||||
}
|
||||
|
||||
public void setOrderSeq(Integer orderSeq) {
|
||||
this.orderSeq = orderSeq;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询接口--数据传输对象:数据集树目录表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集树目录表")
|
||||
public class DataSetTreeQueryDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 节点名称<br>
|
||||
*/
|
||||
@ApiModelProperty("节点名称")
|
||||
@Size(max = 32, message="节点名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 父节点id<br>
|
||||
*/
|
||||
@ApiModelProperty("父节点id")
|
||||
@Size(max = 32, message="父节点id-parentId: 数据长度不能 > 32" )
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty("系统id列表")
|
||||
private List<String> proIds;
|
||||
|
||||
@ApiModelProperty("是否为多系统 false-单系统 true-多系统")
|
||||
private boolean moreProject;
|
||||
|
||||
/**
|
||||
* 路径<br>
|
||||
*/
|
||||
@ApiModelProperty("路径")
|
||||
@Size(max = 1024, message="路径-path: 数据长度不能 > 1024" )
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public boolean isMoreProject() {
|
||||
return moreProject;
|
||||
}
|
||||
|
||||
public void setMoreProject(boolean moreProject) {
|
||||
this.moreProject = moreProject;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public List<String> getProIds() {
|
||||
return proIds;
|
||||
}
|
||||
|
||||
public void setProIds(List<String> proIds) {
|
||||
this.proIds = proIds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--更新资源--数据传输对象:数据集树目录表
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:18 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集树目录表")
|
||||
public class DataSetTreeUpdateDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* id<br>
|
||||
*/
|
||||
@ApiModelProperty("id")
|
||||
@Size(max = 32, message="id长度不能 > 32" )
|
||||
private String id;
|
||||
/**
|
||||
* 节点名称<br>
|
||||
*/
|
||||
@ApiModelProperty("节点名称")
|
||||
@Size(max = 32, message="节点名称长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id长度不能 > 32" )
|
||||
private String proId;
|
||||
/**
|
||||
* 目录描述<br>
|
||||
*/
|
||||
@ApiModelProperty("目录描述")
|
||||
@Size(max = 255, message="目录描述长度不能 > 255" )
|
||||
private String description;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Restful接口--新增资源--数据传输对象:数据集
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:19 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集")
|
||||
public class DataSetsAddDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 数据集名称<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集名称")
|
||||
@Size(max = 30, message="数据集名称-name: 数据长度不能 > 30" )
|
||||
@NotBlank(message = "数据集名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 描述<br>
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
@Size(max = 255, message="描述-description: 数据长度不能 > 255" )
|
||||
private String description;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "系统id不能为空")
|
||||
private String proId;
|
||||
/**
|
||||
* 目录id<br>
|
||||
*/
|
||||
@ApiModelProperty("目录id")
|
||||
@Size(max = 32, message="目录id-treeId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "目录id不能为空")
|
||||
private String treeId;
|
||||
|
||||
@ApiModelProperty("表头列表")
|
||||
private List<String> headers;
|
||||
@ApiModelProperty("表数据")
|
||||
private List<Map<String, Object>> tableData;
|
||||
|
||||
@ApiModelProperty("环境id")
|
||||
private String envId;
|
||||
|
||||
public String getEnvId() {
|
||||
return envId;
|
||||
}
|
||||
|
||||
public void setEnvId(String envId) {
|
||||
this.envId = envId;
|
||||
}
|
||||
|
||||
public List<String> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public void setHeaders(List<String> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getTableData() {
|
||||
return tableData;
|
||||
}
|
||||
|
||||
public void setTableData(List<Map<String, Object>> tableData) {
|
||||
this.tableData = tableData;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public String getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(String treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集删除实体")
|
||||
public class DataSetsDeleteDto implements Serializable {
|
||||
@ApiModelProperty("数据集id列表")
|
||||
private List<String> setIds;
|
||||
|
||||
public List<String> getSetIds() {
|
||||
return setIds;
|
||||
}
|
||||
|
||||
public void setSetIds(List<String> setIds) {
|
||||
this.setIds = setIds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import net.northking.cctp.dataPool.db.entity.DataSets;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Restful接口--资源详情--数据传输对象:数据集
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:19 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集")
|
||||
public class DataSetsDetailDto extends DataSets implements Serializable
|
||||
{
|
||||
@ApiModelProperty("创建人名称")
|
||||
private String creator;
|
||||
|
||||
@ApiModelProperty("修改人名称")
|
||||
private String modifier;
|
||||
|
||||
@ApiModelProperty("数据表头")
|
||||
private List<DataHeaderDto> tableHeader;
|
||||
|
||||
@ApiModelProperty("数据内容 key-列名 value-该列数据信息列表")
|
||||
private Map<String,List<DataContentDto>> tableContent;
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public List<DataHeaderDto> getTableHeader() {
|
||||
return tableHeader;
|
||||
}
|
||||
|
||||
public void setTableHeader(List<DataHeaderDto> tableHeader) {
|
||||
this.tableHeader = tableHeader;
|
||||
}
|
||||
|
||||
public Map<String, List<DataContentDto>> getTableContent() {
|
||||
return tableContent;
|
||||
}
|
||||
|
||||
public void setTableContent(Map<String, List<DataContentDto>> tableContent) {
|
||||
this.tableContent = tableContent;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询接口--数据传输对象:数据集
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:19 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集查询实体")
|
||||
public class DataSetsQueryDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 数据集名称<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集名称")
|
||||
@Size(max = 32, message="数据集名称-name: 数据长度不能 > 32" )
|
||||
private String name;
|
||||
/**
|
||||
* 目录id<br>
|
||||
*/
|
||||
@ApiModelProperty("目录id")
|
||||
@Size(max = 32, message="目录id-treeId: 数据长度不能 > 32" )
|
||||
private String treeId;
|
||||
|
||||
@ApiModelProperty("目录id列表")
|
||||
private List<String> treeIds;
|
||||
|
||||
@ApiModelProperty("系统id列表")
|
||||
private List<String> proIds;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
@Size(max = 32, message="租户id-tenantId: 数据长度不能 > 32" )
|
||||
private String tenantId;
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public List<String> getTreeIds() {
|
||||
return treeIds;
|
||||
}
|
||||
|
||||
public void setTreeIds(List<String> treeIds) {
|
||||
this.treeIds = treeIds;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(String treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public List<String> getProIds() {
|
||||
return proIds;
|
||||
}
|
||||
|
||||
public void setProIds(List<String> proIds) {
|
||||
this.proIds = proIds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集内容实体")
|
||||
public class DataSetsSaveDto implements Serializable {
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集id")
|
||||
@Size(max = 32, message="数据集id-dataSetId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "数据集id不能为空")
|
||||
private String dataSetId;
|
||||
|
||||
@ApiModelProperty("环境id")
|
||||
private String envId;
|
||||
|
||||
@ApiModelProperty("环境名称")
|
||||
private String envName;
|
||||
|
||||
@ApiModelProperty("数据表头")
|
||||
private List<DataHeaderDto> tableHeader;
|
||||
|
||||
@ApiModelProperty("数据内容 key-列名 value-该列数据信息列表")
|
||||
private Map<String,List<DataContentDto>> tableContent;
|
||||
|
||||
public String getEnvId() {
|
||||
return envId;
|
||||
}
|
||||
|
||||
public void setEnvId(String envId) {
|
||||
this.envId = envId;
|
||||
}
|
||||
|
||||
public String getEnvName() {
|
||||
return envName;
|
||||
}
|
||||
|
||||
public void setEnvName(String envName) {
|
||||
this.envName = envName;
|
||||
}
|
||||
|
||||
public String getDataSetId() {
|
||||
return dataSetId;
|
||||
}
|
||||
|
||||
public void setDataSetId(String dataSetId) {
|
||||
this.dataSetId = dataSetId;
|
||||
}
|
||||
|
||||
public List<DataHeaderDto> getTableHeader() {
|
||||
return tableHeader;
|
||||
}
|
||||
|
||||
public void setTableHeader(List<DataHeaderDto> tableHeader) {
|
||||
this.tableHeader = tableHeader;
|
||||
}
|
||||
|
||||
public Map<String, List<DataContentDto>> getTableContent() {
|
||||
return tableContent;
|
||||
}
|
||||
|
||||
public void setTableContent(Map<String, List<DataContentDto>> tableContent) {
|
||||
this.tableContent = tableContent;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
|
||||
*
|
||||
*/
|
||||
package net.northking.cctp.dataPool.dto.dataSets;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Restful接口--更新资源--数据传输对象:数据集
|
||||
*
|
||||
* createdate: 2022-10-24 17:01:19 <br>
|
||||
* @author: maven-cctp-plugin <br>
|
||||
* @since: 1.0 <br>
|
||||
*/
|
||||
@JsonSerialize
|
||||
@ApiModel(description = "数据集")
|
||||
public class DataSetsUpdateDto implements Serializable
|
||||
{
|
||||
/**
|
||||
* 数据集名称<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集名称")
|
||||
@Size(max = 32, message="数据集名称-name: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "数据集名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 描述<br>
|
||||
*/
|
||||
@ApiModelProperty("描述")
|
||||
@Size(max = 255, message="描述-description: 数据长度不能 > 255" )
|
||||
private String description;
|
||||
/**
|
||||
* 系统id<br>
|
||||
*/
|
||||
@ApiModelProperty("系统id")
|
||||
@Size(max = 32, message="系统id-proId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "系统id不能为空")
|
||||
private String proId;
|
||||
/**
|
||||
* 目录id<br>
|
||||
*/
|
||||
@ApiModelProperty("目录id")
|
||||
@Size(max = 32, message="目录id-treeId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "目录id不能为空")
|
||||
private String treeId;
|
||||
/**
|
||||
* 数据集id<br>
|
||||
*/
|
||||
@ApiModelProperty("数据集id")
|
||||
@Size(max = 32, message="数据集id-dataSetId: 数据长度不能 > 32" )
|
||||
@NotBlank(message = "数据集id不能为空")
|
||||
private String dataSetId;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(String proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public String getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(String treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public String getDataSetId() {
|
||||
return dataSetId;
|
||||
}
|
||||
|
||||
public void setDataSetId(String dataSetId) {
|
||||
this.dataSetId = dataSetId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package net.northking.cctp.dataPool.enums;
|
||||
|
||||
public enum DataHeaderType {
|
||||
STRING("0","string"),
|
||||
MAP("1","keyValue"),
|
||||
BOOLEAN("2","boolean"),
|
||||
ARRAY("3","array"),
|
||||
JSON("4","json"),
|
||||
XML("5","xml"),
|
||||
HTML("6","html");
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
DataHeaderType(String code, String name){
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
public static String getName(String code){
|
||||
for (DataHeaderType value : DataHeaderType.values()) {
|
||||
if (code.equals(value.code)) {
|
||||
return value.name;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getCode(String name){
|
||||
for (DataHeaderType value : DataHeaderType.values()) {
|
||||
if (name.equals(value.name)) {
|
||||
return value.code;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package net.northking.cctp.dataPool.enums;
|
||||
|
||||
import net.northking.cctp.common.exception.PlatformError;
|
||||
|
||||
/**
|
||||
* 自定义异常信息
|
||||
*/
|
||||
public enum DataPoolError implements PlatformError {
|
||||
//目录树管理
|
||||
TREE_NAME_VALID("目录名称不可包含【/】或者【\\】"),
|
||||
TREE_NO_EXISTS("当前目录不存在,请刷新列表"),
|
||||
TREE_NAME_EXISTS("当前目录名称已存在"),
|
||||
TREE_ADD_DATA_EXISTS("所选父目录存在数据,不可新建目录"),
|
||||
TREE_DEL_DIR_EXISTS("该目录下有子目录,不允许删除!"),
|
||||
TREE_DEL_DATA_EXISTS("该目录下存在数据,不允许删除!"),
|
||||
TREE_LEVEL_LIMIT("超过树节点层级上限10级"),
|
||||
TREE_MOVE_DATA_EXISTS("目标目录存在数据,不可拖拽"),
|
||||
//数据集管理
|
||||
SET_NAME_NO_UNIQUE("数据集名称[{0}]在该目录下已存在"),
|
||||
SET_NAME_IS_VALID("数据集名称不可包含特殊符号"),
|
||||
SETS_DIR_VALID("所选目录不合法,请选择存在的叶子节点"),
|
||||
SETS_NO_EXISTS("当前数据集不存在,请刷新列表"),
|
||||
SETS_DATA_IS_NULL("数据集文件内容为空"),
|
||||
COLUMN_IS_NULL("列信息为空"),
|
||||
COLUMN_NAME_IS_NULL("列名不能为空"),
|
||||
COLUMN_NAME_IS_TOO_LONG("列名长度不可超过30"),
|
||||
COLUMN_TYPE_IS_NULL("列类型不能为空"),
|
||||
COLUMN_TYPE_IS_WRONG("列类型错误!"),
|
||||
COLUMN_IS_EXSITS("同名列已存在"),
|
||||
HEADER_CONTENT_NO_MATCH("表头与数据不匹配"),
|
||||
IMPORT_FILE_IS_NULL("导入文件为空"),
|
||||
IMPORT_EXCEL_FILE_IS_TOO_LARGE("导入文件大小不可超过2M"),
|
||||
IMPORT_FILE_FORMART_IS_ERROR("导入文件格式不正确"),
|
||||
IMPORT_EXCEL_CELL_IS_NULL("导入文件表头列数据不能为空"),
|
||||
IMPORT_COLUMN_IS_EXSITS("导入文件表头列名不能重复"),
|
||||
IMPORT_COLUMN_IS_TOO_LONG("导入文件表头列名长度不能超过30"),
|
||||
IMPORT_COLUMN_IS_INVALID("导入失败:当前excel为无效文件!!!"),
|
||||
PROJECT_NO_REFER_ENV("新增数据失败:当前系统未关联环境!!!"),
|
||||
//模糊数据管理
|
||||
DATA_RESOURCE_PACKAGE_UPLOAD_FAIL("资源包上传失败"),
|
||||
DATA_RESOURCE_PACKAGE_IS_NULL("当前资源包不存在,请刷新列表"),
|
||||
DATA_RULE_IS_NULL("所选规则不存在,请刷新列表"),
|
||||
DATA_RULE_NAME_IS_EXSIT("同名数据规则已存在"),
|
||||
DATA_RULE_EXP_IS_NULL("数据规则内容不能为空"),
|
||||
DATA_RULE_REXP_IS_VALID("正则表达式语法错误,请重新检查"),
|
||||
DATA_RULE_NOT_SUPPORT_TYPE("数据规则脚本暂不支持所选类型"),
|
||||
DATA_RESOURCE_PACKAGE_LOAD_FAIL("数据规则资源包加载失败"),
|
||||
DATA_RULE_EXECUTE_RESULT_IS_NULL("规则测试结果为null,请检查语法"),
|
||||
DATA_RULE_EXECUTE_RESULT_IS_EXCEPTION("规则测试执行异常,请检查语法"),
|
||||
PARAM_IS_MISSING("缺少请求参数"),
|
||||
DATA_SET_HAS_LINK("当前静态数据集存在关联,删除失败!"),
|
||||
FUZZY_DATA_SET_HAS_LINK("当前模糊数据存在关联,删除失败!"),
|
||||
|
||||
//文件IO管理
|
||||
FILE_IS_NULL("文件不能为空!"),
|
||||
FILE_UPLOAD_ERROR("文件上传失败"),
|
||||
FILE_DOWNLOAD_ERROR("文件下载失败"),
|
||||
FILE_READ_ERROR("读取文件内容失败"),
|
||||
FILE_DEL_ERROR("文件删除失败"),
|
||||
FILE_ID_ERROR("文件id有误"),
|
||||
FILE_IS_NOT_EXCEL("导入异常,当前文件非正常格式的Excel文件!"),
|
||||
FILE_NAME_IS_NULL("导入异常,文件名称不能为空!"),
|
||||
|
||||
//excel
|
||||
EXCEL_HEADER_IS_NULL("导入文件的第1列数据存在空值,请修改文件再导入!"),
|
||||
EXCEL_FILE_READ_ERROR("导入失败:当前Excel为无效文件!"),
|
||||
EXCEL_FISRT_SHEET_NULL("Excel文件中首个工作表为空!"),
|
||||
EXCEL_NAME_IS_NULL("Excel文件名称为空,导入失败!"),
|
||||
TABLE_HEADER_NAME_ERROR("导入文件中的表头字段第{0}列名称【{1}】跟前端界面字段【{2}】不一致!"),
|
||||
TABLE_HEADER_SIZE_UNEQULE("导入文件中的表头字段数跟前端界面显示的不一致!"),
|
||||
EXCEL_HEADER_HAS_SAME("表头存在重复数据,请修改Excel文件!"),
|
||||
|
||||
//日志管理
|
||||
INSERT_LOG_FAIL("日志创建失败");
|
||||
private final Integer code;
|
||||
private final String msg;
|
||||
|
||||
private static final int START_CODE = 220000;
|
||||
|
||||
DataPoolError(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
DataPoolError(String msg) {
|
||||
this.code = ordinal() + START_CODE;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package net.northking.cctp.dataPool.feign;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import net.northking.cctp.common.dto.AssociatedFilesDto;
|
||||
import net.northking.cctp.common.feign.FeignCctpConfig;
|
||||
import net.northking.cctp.common.http.ResultWrapper;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = "cctp-files", path = "/cctp-files", configuration = {FeignCctpConfig.class})
|
||||
public interface AttachmentFeignClient {
|
||||
|
||||
@PostMapping(value = "/v1/update",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
public ResultWrapper<String> update(Map<String,String> file);
|
||||
|
||||
@PostMapping(value = "/pub/associatedFiles")
|
||||
ResultWrapper<String> associatedFiles(@ApiParam(value = "关联文件请求对象") @RequestBody AssociatedFilesDto associatedFilesDto);
|
||||
|
||||
@GetMapping(value = "/pub/deleteFileByObjIdAndBusinessCode")
|
||||
void deleteFileByObjId(@RequestParam("objectId") String objectId, @RequestParam("businessCode") String businessCode);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package net.northking.cctp.dataPool.feign;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.feign.FeignCctpConfig;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "cctp-projects", configuration = {FeignCctpConfig.class}, path = "/cctp-projects")
|
||||
public interface ProjectFeignClient {
|
||||
|
||||
@ApiOperation(value = "根据系统id查关联的环境id集合")
|
||||
@PostMapping(value = "/v1/query/selectEnvIds",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
List<String> selectEnvIds(@RequestParam("proId") String proId);
|
||||
|
||||
@ApiOperation(value = "查询系统关联的环境排序")
|
||||
@PostMapping(value = "/v1/query/envListSeq",
|
||||
produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||
List<String> queryEnvListSeq(@RequestParam("proId") String proId);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package net.northking.cctp.dataPool.feign;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.northking.cctp.common.feign.FeignCctpConfig;
|
||||
import net.northking.cctp.dataPool.feign.dto.AtuInputDataSetResultDto;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "atu-script-case", configuration = {FeignCctpConfig.class}, path = "/atu-script-case")
|
||||
public interface ScriptFeignClient {
|
||||
|
||||
@ApiOperation(value = "查询静态数据集存在关联")
|
||||
@PostMapping(value = "/v1/selectLinkBySetId")
|
||||
List<AtuInputDataSetResultDto> selectLinkBySetId(@RequestBody List<String> setId);
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.northking.cctp.dataPool.feign.dto;
|
||||
|
||||
|
||||
public class AtuInputDataSetResultDto {
|
||||
|
||||
private String setId;
|
||||
|
||||
private Integer countNum;
|
||||
|
||||
public String getSetId() {
|
||||
return setId;
|
||||
}
|
||||
|
||||
public void setSetId(String setId) {
|
||||
this.setId = setId;
|
||||
}
|
||||
|
||||
public Integer getCountNum() {
|
||||
return countNum;
|
||||
}
|
||||
|
||||
public void setCountNum(Integer countNum) {
|
||||
this.countNum = countNum;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package net.northking.cctp.dataPool.utils;
|
||||
|
||||
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.constants.BaseDefineDependencyConstants;
|
||||
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.entity.Environment;
|
||||
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.exception.InvalidException;
|
||||
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.vo.ResponseVO;
|
||||
import net.northking.cctp.common.feign.ApiAtsEnviromentFeign;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class EnvNameUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EnvNameUtils.class);
|
||||
|
||||
@Autowired
|
||||
private ApiAtsEnviromentFeign apiAtsEnviromentFeign;
|
||||
|
||||
public String getEnvName(String envId) {
|
||||
if (StringUtils.isNotBlank(envId)) {
|
||||
Long id = null;
|
||||
try {
|
||||
id = Long.valueOf(envId);
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("环境Id类型转化异常");
|
||||
throw new InvalidException("环境Id类型转化异常");
|
||||
}
|
||||
List<Long> envIds = new ArrayList<>();
|
||||
envIds.add(id);
|
||||
ResponseVO<List<Environment>> responseVo = apiAtsEnviromentFeign.getEnvInfoById(envIds);
|
||||
if (responseVo == null || !responseVo.getCode().equals(BaseDefineDependencyConstants.SYSTEM_RESPONSE_CODE_SUCCESS)) {
|
||||
throw new InvalidException("服务间调用获取环境信息失败");
|
||||
}
|
||||
|
||||
if (responseVo.getData() != null) {
|
||||
return responseVo.getData().get(0).getName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,207 @@
|
|||
package net.northking.cctp.dataPool.utils;
|
||||
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataContentDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataHeaderDto;
|
||||
import net.northking.cctp.dataPool.dto.dataSets.DataSetsSaveDto;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ExcelUtils {
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(ExcelUtils.class);
|
||||
|
||||
public static Workbook exportToExcel(DataSetsSaveDto saveDto, String sheetName, Boolean isXssf){
|
||||
Workbook workbook = null;
|
||||
if (isXssf) {
|
||||
workbook = new XSSFWorkbook();
|
||||
} else {
|
||||
workbook = new HSSFWorkbook();
|
||||
}
|
||||
//工作表
|
||||
Sheet sheet = workbook.createSheet(sheetName);
|
||||
if (null == saveDto) {
|
||||
return workbook;
|
||||
}
|
||||
List<DataHeaderDto> headers = saveDto.getTableHeader();
|
||||
Map<String, List<DataContentDto>> data = saveDto.getTableContent();
|
||||
//无表头则直接返回空表
|
||||
if (CollectionUtils.isEmpty(headers)) {
|
||||
return workbook;
|
||||
}
|
||||
//表头
|
||||
Row headerRow = sheet.createRow(0);
|
||||
Map<Integer, Integer> columnWidth = new HashMap<>();
|
||||
//设置表头样式
|
||||
CellStyle headerStyle = getHeaderStyle(workbook);
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
DataHeaderDto headerDto = headers.get(i);
|
||||
if (null == headerDto) continue;
|
||||
Cell cell = getHeaderCell(headerDto,headerRow,i,sheet);
|
||||
String name = headerDto.getName();
|
||||
int width = name.getBytes().length * 256 + 512;
|
||||
if (width > 15000) {
|
||||
width = 15000;
|
||||
}
|
||||
columnWidth.put(i, width);
|
||||
cell.setCellValue(name);
|
||||
cell.setCellStyle(headerStyle);
|
||||
}
|
||||
//数据样式
|
||||
if (!CollectionUtils.isEmpty(data)) {
|
||||
CellStyle bodyStyle = getBodyStyle(workbook);
|
||||
List<Map<String, Object>> rowMapList = getRowMapList(saveDto);
|
||||
for (int rowNum = 0; rowNum < rowMapList.size(); rowNum++) {
|
||||
Map<String, Object> rowMap = rowMapList.get(rowNum);
|
||||
Row row = sheet.createRow(rowNum + 1);
|
||||
for (int colNum = 0; colNum < headers.size(); colNum++) {
|
||||
DataHeaderDto header = headers.get(colNum);
|
||||
Cell cell = getBodyCell(header, rowMap,row,rowNum,colNum,columnWidth);
|
||||
if (null == cell) break;
|
||||
cell.setCellStyle(bodyStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
//设置列宽
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
sheet.setColumnWidth(i,columnWidth.get(i));
|
||||
}
|
||||
return workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行结构数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
private static List<Map<String,Object>> getRowMapList(DataSetsSaveDto dto) {
|
||||
List<Map<String,Object>> res = new ArrayList<>();
|
||||
List<DataHeaderDto> tableHeader = dto.getTableHeader();
|
||||
Map<String, List<DataContentDto>> tableContent = dto.getTableContent();
|
||||
if (CollectionUtils.isEmpty(tableHeader) || CollectionUtils.isEmpty(tableContent)) {
|
||||
return res;
|
||||
}
|
||||
List<String> nameList = new ArrayList<>();
|
||||
int rowNum = 0;
|
||||
//统计各列数据最大行数
|
||||
for (int i = 0; i < tableHeader.size(); i++) {
|
||||
DataHeaderDto headerDto = tableHeader.get(i);
|
||||
if (null == headerDto) continue;
|
||||
nameList.add(headerDto.getName());
|
||||
List<DataContentDto> contentDtos = tableContent.get(headerDto.getName());
|
||||
//最大行数与当前列数据量比较
|
||||
rowNum = (contentDtos.size() > rowNum) ? contentDtos.size() : rowNum;
|
||||
}
|
||||
//整理每行数据
|
||||
for(int i = 0; i < rowNum; i++) {
|
||||
Map<String,Object> row = new HashMap<>();
|
||||
for(int j = 0; j < nameList.size(); j++) {
|
||||
String name = nameList.get(j);
|
||||
List<DataContentDto> columnData = tableContent.get(name);
|
||||
//如果该格无数据则存空串
|
||||
if (CollectionUtils.isEmpty(columnData) || columnData.size() <= i) {
|
||||
row.put(name,"");
|
||||
} else {
|
||||
row.put(name, columnData.get(i).getValue());
|
||||
}
|
||||
}
|
||||
res.add(row);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private static Cell getBodyCell(DataHeaderDto header, Map<String, Object> rowMap, Row row, int rowNum, int columnNum, Map<Integer, Integer> columnWidth) {
|
||||
Cell cell = null;
|
||||
String type = header.getType();
|
||||
String name = header.getName();
|
||||
if (null != rowMap.get(name)) {
|
||||
Object o = rowMap.get(name);
|
||||
if ("boolean".equals(type)) {
|
||||
cell = row.createCell(columnNum, CellType.BOOLEAN);
|
||||
cell.setCellValue(Boolean.parseBoolean(o.toString()));
|
||||
} else {
|
||||
cell = row.createCell(columnNum, CellType.STRING);
|
||||
String value = o.toString();
|
||||
Integer width = columnWidth.get(columnNum);
|
||||
int newWidth = value.getBytes().length * 256 + 200;
|
||||
if (newWidth > width && newWidth <= 15000) {
|
||||
columnWidth.put(columnNum, newWidth);
|
||||
} else if (newWidth > 15000) {
|
||||
columnWidth.put(columnNum, 15000);
|
||||
}
|
||||
cell.setCellValue(value);
|
||||
}
|
||||
}else {
|
||||
//未传值则存空字符串
|
||||
cell = row.createCell(columnNum, CellType.STRING);
|
||||
Integer width = columnWidth.get(columnNum);
|
||||
columnWidth.put(columnNum, width>200 ? width : 200);
|
||||
cell.setCellValue("");
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
private static Cell getHeaderCell(DataHeaderDto dataMap, Row row, int index,Sheet sheet) {
|
||||
Cell cell = null;
|
||||
String type = dataMap.getType();
|
||||
if ("date".equals(type)) {
|
||||
cell = row.createCell(index, CellType.NUMERIC);
|
||||
} else if ("int".equals(type)) {
|
||||
cell = row.createCell(index, CellType.NUMERIC);
|
||||
} else if ("boolean".equals(type)) {
|
||||
cell = row.createCell(index, CellType.BOOLEAN);
|
||||
} else {
|
||||
cell = row.createCell(index, CellType.STRING);
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
private static CellStyle getHeaderStyle(Workbook workbook) {
|
||||
CellStyle headerStyle = workbook.createCellStyle();
|
||||
headerStyle.setAlignment(HorizontalAlignment.CENTER); //水平居中
|
||||
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直居中
|
||||
headerStyle.setWrapText(true); //自动换行
|
||||
headerStyle.setBorderTop(BorderStyle.THIN); //边框
|
||||
headerStyle.setBorderBottom(BorderStyle.THIN);
|
||||
headerStyle.setBorderLeft(BorderStyle.THIN);
|
||||
headerStyle.setBorderRight(BorderStyle.THIN);
|
||||
//字体
|
||||
Font headerFont = workbook.createFont();
|
||||
headerFont.setFontName("黑体");
|
||||
headerFont.setFontHeightInPoints((short) 14);
|
||||
headerStyle.setFont(headerFont);
|
||||
//背景
|
||||
headerStyle.setFillForegroundColor(IndexedColors.SKY_BLUE.getIndex());
|
||||
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
return headerStyle;
|
||||
}
|
||||
|
||||
private static CellStyle getBodyStyle(Workbook workbook) {
|
||||
CellStyle headerStyle = workbook.createCellStyle();
|
||||
headerStyle.setAlignment(HorizontalAlignment.CENTER); //水平居中
|
||||
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直居中
|
||||
headerStyle.setWrapText(true); //自动换行
|
||||
headerStyle.setBorderTop(BorderStyle.THIN); //边框
|
||||
headerStyle.setBorderBottom(BorderStyle.THIN);
|
||||
headerStyle.setBorderLeft(BorderStyle.THIN);
|
||||
headerStyle.setBorderRight(BorderStyle.THIN);
|
||||
//字体
|
||||
Font headerFont = workbook.createFont();
|
||||
headerFont.setFontName("宋体");
|
||||
headerFont.setFontHeightInPoints((short) 12);
|
||||
headerStyle.setFont(headerFont);
|
||||
return headerStyle;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package net.northking.cctp.dataPool.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import net.northking.cctp.common.exception.PlatformRuntimeException;
|
||||
import net.northking.cctp.common.s3.SimpleStorageService;
|
||||
import net.northking.cctp.common.util.UUIDUtil;
|
||||
import net.northking.cctp.dataPool.enums.DataPoolError;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@Component
|
||||
public class MinioPathUtils {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MinioPathUtils.class);
|
||||
|
||||
private static final String TEMP_FILE_PATH = MinioPathUtils.class.getProtectionDomain().getCodeSource().getLocation().getPath();
|
||||
|
||||
@Autowired
|
||||
private static SimpleStorageService simpleStorageService;
|
||||
|
||||
public static String pathToId(String tenantId,String path){
|
||||
if (!path.startsWith("/")) {
|
||||
path = "/" + path;
|
||||
}
|
||||
if (path.endsWith("/")) {
|
||||
path = path.substring(0, path.length() - 1);
|
||||
}
|
||||
String str = path.replaceAll("/", "_");
|
||||
return tenantId + str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 第一个是租户id,第二个是文件id,第三个是文件名
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
public static String[] idToPath(String fileId) {
|
||||
String[] result = new String[3];
|
||||
if (fileId.startsWith("/") || fileId.startsWith("_")) {
|
||||
fileId = fileId.substring(1);
|
||||
}
|
||||
if (fileId.endsWith("/") || fileId.endsWith("_")) {
|
||||
fileId = fileId.substring(0, fileId.length() - 1);
|
||||
}
|
||||
int index = fileId.indexOf("_");
|
||||
result[0] = fileId.substring(0, index); //租户id
|
||||
result[1] = fileId.substring(index + 1); //文件id
|
||||
result[2] = result[1]; //文件名
|
||||
return result;
|
||||
}
|
||||
|
||||
public static<T> File objectToJsonFile(T t) {
|
||||
String objectStr = JSON.toJSONString(t);
|
||||
byte[] bytes = new byte[0];
|
||||
try {
|
||||
bytes = objectStr.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error("",e);
|
||||
logger.info("数据转换二进制失败");
|
||||
}
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); //获取脚本输入流
|
||||
File tempFilePath = new File(TEMP_FILE_PATH);
|
||||
if (!tempFilePath.exists()) {
|
||||
tempFilePath.mkdirs();
|
||||
}
|
||||
File file = new File(TEMP_FILE_PATH + "/tempFile" + UUIDUtil.create32UUID() + ".json");
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
fileOutputStream = new FileOutputStream(file);
|
||||
byte[] readBytes = new byte[1024 * 1024];
|
||||
int length = 0;
|
||||
while ((length = inputStream.read(readBytes, 0, readBytes.length)) > 0) {
|
||||
fileOutputStream.write(readBytes,0,length);
|
||||
}
|
||||
fileOutputStream.flush();
|
||||
} catch (Exception e) {
|
||||
logger.error("object写入文件出错");
|
||||
}finally {
|
||||
if (null != inputStream) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
if (null != fileOutputStream) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
public static<T> T getFileContent(InputStream inputStream, Class<T> clazz) {
|
||||
InputStreamReader streamReader = null;
|
||||
BufferedReader reader = null;
|
||||
T t = null;
|
||||
try {
|
||||
streamReader = new InputStreamReader(inputStream,"UTF-8");
|
||||
reader = new BufferedReader(streamReader);
|
||||
StringBuilder builder = new StringBuilder();
|
||||
String temp = "";
|
||||
while (null != (temp = reader.readLine())) {
|
||||
builder.append(temp);
|
||||
}
|
||||
String jsonStr = builder.toString();
|
||||
if (StringUtils.hasText(jsonStr)) {
|
||||
t = JSON.parseObject(JSON.parse(jsonStr).toString(), clazz);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("读取文件内容失败");
|
||||
throw new PlatformRuntimeException(DataPoolError.FILE_READ_ERROR);
|
||||
}finally {
|
||||
if (null != streamReader) {
|
||||
try {
|
||||
streamReader.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
if (null != reader) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package net.northking.cctp.dataPool.utils;
|
||||
|
||||
import net.northking.cctp.dataPool.constants.DataPoolConstant;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhengbang.jiang
|
||||
* @date 2021/1/12
|
||||
* @since 1.0
|
||||
*/
|
||||
public class MyUrlClassLoader extends URLClassLoader {
|
||||
|
||||
private List<JarURLConnection> cachedJarFiles = new ArrayList<>();
|
||||
|
||||
private List<File> jarFiles = new ArrayList<>();
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MyUrlClassLoader.class);
|
||||
|
||||
public MyUrlClassLoader() {
|
||||
super(new URL[]{}, findParentClassLoader());
|
||||
}
|
||||
|
||||
private static ClassLoader findParentClassLoader() {
|
||||
ClassLoader parent = net.northking.cctp.dataPool.utils.MyUrlClassLoader.class.getClassLoader();
|
||||
if (parent == null) {
|
||||
parent = net.northking.cctp.dataPool.utils.MyUrlClassLoader.getSystemClassLoader();
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void addURLFile(File f) throws MalformedURLException {
|
||||
jarFiles.add(f);
|
||||
String jarStr = "jar:" + f.toURI().toURL().toExternalForm() + "!/";
|
||||
URL file = new URL(jarStr);
|
||||
try {
|
||||
URLConnection uc = file.openConnection();
|
||||
if (uc instanceof JarURLConnection) {
|
||||
uc.setUseCaches(true);
|
||||
((JarURLConnection) uc).getManifest();
|
||||
cachedJarFiles.add((JarURLConnection) uc);
|
||||
Method method = URLClassLoader.class.getDeclaredMethod(DataPoolConstant.ADD_URL, URL.class);
|
||||
URLClassLoader classLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
boolean accessible = method.isAccessible();
|
||||
try {
|
||||
if (!accessible) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
URL url1 = file.toURI().toURL();
|
||||
method.invoke(classLoader, url1);
|
||||
} catch (IllegalAccessException e) {
|
||||
logger.error("",e);
|
||||
} catch (MalformedURLException e) {
|
||||
logger.error("",e);
|
||||
} catch (InvocationTargetException e) {
|
||||
logger.error("",e);
|
||||
} finally {
|
||||
method.setAccessible(accessible);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
|
||||
public void unloadJarFiles() {
|
||||
List<JarURLConnection> list = new ArrayList<>();
|
||||
for (JarURLConnection url : cachedJarFiles) {
|
||||
try {
|
||||
list.add(url);
|
||||
url.getJarFile().close();
|
||||
url = null;
|
||||
} catch (Exception e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
}
|
||||
cachedJarFiles.removeAll(list);
|
||||
list = null;
|
||||
for (File jarFile : jarFiles) {
|
||||
boolean delete = jarFile.delete();
|
||||
if (!delete) {
|
||||
logger.error("删除文件失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package net.northking.cctp.dataPool.utils;
|
||||
|
||||
import bsh.EvalError;
|
||||
import bsh.Interpreter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ScriptUtil {
|
||||
|
||||
|
||||
//传进脚本内容,返回执行结果
|
||||
public static Object executeBeanShell(String scriptContent) throws EvalError {
|
||||
Interpreter interpreter = new Interpreter();
|
||||
Object o = interpreter.eval(scriptContent);
|
||||
return o;
|
||||
}
|
||||
|
||||
public static List executesBeanShell(String scriptContent,Integer execNum) throws EvalError {
|
||||
List values = new ArrayList();
|
||||
for (Integer i = 0; i < execNum; i++) {
|
||||
values.add(executeBeanShell(scriptContent));
|
||||
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue