commit
764413a6cd
@ -0,0 +1,37 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
logs/
|
||||
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
*.iml
|
||||
web/web.iml
|
Binary file not shown.
@ -0,0 +1,18 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
|
@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
<webroots />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.14.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.32" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.5.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.5.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.5.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.4.7" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:2.4.7" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.19.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.9.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.8.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.spring4all:swagger-spring-boot-starter:1.9.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.54" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.54" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.83" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.54" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:easyexcel:2.1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
|
||||
<orderEntry type="library" name="Maven: cglib:cglib:3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ow2.asm:asm:4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.32" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ehcache:ehcache:3.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.7.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.1.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.27" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.2.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.1.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:4.9.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.5.31" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.aliyun:aliyun-java-sdk-core:4.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.agent:runtime:0.8.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,36 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.imitate</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>common</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>common</name>
|
||||
<description>common</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- 配置文件联想提示 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,65 @@
|
||||
package com.imitate.common.advisor;
|
||||
|
||||
import com.imitate.common.enums.ErrorCodeEnum;
|
||||
import com.imitate.common.exception.BusinessException;
|
||||
import com.imitate.common.util.R;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* @author yanchao
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class DefaultControllerAdvisor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultControllerAdvisor.class);
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public R processException(Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error(ErrorCodeEnum.EXCEPTION.getValue(), ErrorCodeEnum.EXCEPTION.getDescription());
|
||||
}
|
||||
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public R processException(BusinessException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error(e.getErrCode(), e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
public R processMissingServletRequestParameterException(MissingServletRequestParameterException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error(ErrorCodeEnum.MVC_BIND_EXCEPTION.getValue(), ErrorCodeEnum.MVC_BIND_EXCEPTION.getDescription());
|
||||
}
|
||||
|
||||
@ExceptionHandler(ConstraintViolationException.class)
|
||||
public R processConstraintViolationException(ConstraintViolationException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error(ErrorCodeEnum.INVALID_ARG_EXCEPTION.getValue(),
|
||||
ErrorCodeEnum.INVALID_ARG_EXCEPTION.getDescription());
|
||||
}
|
||||
|
||||
@ExceptionHandler(BindException.class)
|
||||
public R processBindException(BindException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error(ErrorCodeEnum.BIND_EXCEPTION.getValue(), ErrorCodeEnum.BIND_EXCEPTION.getDescription());
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
@ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
public R processHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error(ErrorCodeEnum.METHOD_NOT_ALLOWED_EXCEPTION.getValue(),
|
||||
ErrorCodeEnum.METHOD_NOT_ALLOWED_EXCEPTION.getDescription());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.imitate.common.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 日志开启注解
|
||||
*
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Inherited
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DoSysLog {
|
||||
/**
|
||||
* 是否开启日志
|
||||
*/
|
||||
boolean isLog() default false;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.imitate.common.bean;
|
||||
|
||||
|
||||
import com.imitate.common.constant.ApiResultCsts;
|
||||
|
||||
public class ApiResult<T> {
|
||||
|
||||
private int code = ApiResultCsts.CODE_SUCCESS;
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ApiResult() {
|
||||
}
|
||||
|
||||
public ApiResult(int code, String msg, T data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> ApiResult<T> successResult(T data) {
|
||||
return successResult("success", data);
|
||||
}
|
||||
|
||||
public static <T> ApiResult<T> successResult(String msg, T data) {
|
||||
return new ApiResult<>(0, msg, data);
|
||||
}
|
||||
|
||||
public static <T> ApiResult<T> failResult(int code, String msg, T data) {
|
||||
return new ApiResult<>(code, msg, data);
|
||||
}
|
||||
|
||||
public static <T> ApiResult<T> failResult(int code, String msg) {
|
||||
return new ApiResult<>(code, msg, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.imitate.common.bean;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BridgePage<T> {
|
||||
|
||||
private List<T> data;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
private Long total;
|
||||
|
||||
public BridgePage(Page<T> page) {
|
||||
this.data = page.getResult();
|
||||
this.pageNum = page.getPageNum();
|
||||
this.pageSize = page.getPageSize();
|
||||
this.total = page.getTotal();
|
||||
}
|
||||
|
||||
public List<T> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<T> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.imitate.common.bean;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* shell执行结果
|
||||
*
|
||||
* @author 威少
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShellResult {
|
||||
/**
|
||||
* 退出码
|
||||
*/
|
||||
private Integer exitStatus;
|
||||
/**
|
||||
* 实际输出
|
||||
*/
|
||||
private String out;
|
||||
|
||||
public enum ExitStatus {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS(0),
|
||||
/**
|
||||
* 超时
|
||||
*/
|
||||
TIMEOUT(124),
|
||||
/**
|
||||
* 默认失败
|
||||
*/
|
||||
FAIL(-1);
|
||||
|
||||
private int code;
|
||||
|
||||
ExitStatus(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.imitate.common.config;
|
||||
|
||||
import com.imitate.common.util.RedisPool;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
@Component
|
||||
public class InitListener implements ApplicationListener<ApplicationReadyEvent> {
|
||||
private static final Logger log = LoggerFactory.getLogger(InitListener.class);
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationReadyEvent event) {
|
||||
String active = System.getProperty("spring.profiles.active");
|
||||
// 本地不初始化这些信息
|
||||
Jedis jedis = null;
|
||||
try {
|
||||
if (!StringUtils.equals(active, "local")) {
|
||||
// 初始化redis
|
||||
jedis = RedisPool.getJedis();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("项目启动失败", e);
|
||||
if ("jedisPool初始化错误".equals(e.getMessage())) {
|
||||
Runtime.getRuntime().exit(-1);
|
||||
}
|
||||
} finally {
|
||||
RedisPool.returnResource(jedis);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.imitate.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
|
||||
@Order(1)
|
||||
@Configuration
|
||||
public class RedisListenerConfig {
|
||||
|
||||
@Bean
|
||||
RedisMessageListenerContainer listenerContainer(RedisConnectionFactory connectionFactory) {
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(connectionFactory);
|
||||
return container;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.imitate.common.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yanchao
|
||||
*/
|
||||
@Configuration
|
||||
@Order(1)
|
||||
@Slf4j
|
||||
public class WebMvcConfig extends WebMvcConfigurationSupport {
|
||||
|
||||
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
|
||||
log.debug("【配置argumentResolver】ok");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedHeaders("Content-Type", "x-requested-with", "X-Custom-Header")
|
||||
.allowedOriginPatterns("*")
|
||||
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.imitate.common.constant;
|
||||
|
||||
public interface ApiResultCsts {
|
||||
int CODE_SUCCESS = 0;
|
||||
int CODE_FAIL = -1;
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.imitate.common.enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 全局错误枚举
|
||||
*
|
||||
* @author yanchao
|
||||
*/
|
||||
public enum ErrorCodeEnum {
|
||||
SUCCESS("000000", "成功"),
|
||||
INVALID_ARG_EXCEPTION("000001", "参数验证异常"),
|
||||
BIND_EXCEPTION("000007", "参数绑定异常"),
|
||||
MVC_BIND_EXCEPTION("000014", "请求参数绑定异常"),
|
||||
METHOD_NOT_ALLOWED_EXCEPTION("000008", "请求方式异常"),
|
||||
EXCEPTION("999999", "系统异常"),
|
||||
DATAFLOW_EXCEPTION("000010", "默认数据异常"),
|
||||
BUSINESS_EXCEPTION("000011", "默认业务异常"),
|
||||
LOGIN_EXPIRE_TIME("000013", "登录已过期,请重新登录"),
|
||||
USER_LOGIN_DISABLE("000014", "账号已经锁定,请联系管理员"),
|
||||
NO_AUTH("000012", "未认证登录状态"),
|
||||
AFTERMATH_EXP("000013", "评测线程出错,善后处理发生异常"),
|
||||
GIT_FAIL("000014", "获取git凭证失败: "),
|
||||
GIT_CREDENTIAL_FAIL("000015", "设置git凭证失败:"),
|
||||
|
||||
CLONE_FAIL("100001", "克隆失败"),
|
||||
EVALUATION_SHELL_FAIL("100002", "生成评测脚本失败"),
|
||||
WRITE_FILE_CODE_FAIL("100003", "写代码文件失败"),
|
||||
UPDATE_VERSION_REPOSITORY_FAIL("100004", "更新版本库失败"),
|
||||
SYNC_CLUSTER_VERSION_REPOSITORY_FAIL("100005", "远程集群版本库同步失败"),
|
||||
PUSH_FAIL("100006", "push版本库失败"),
|
||||
JUPYTER_ADD_OR_COMMIT_FAIL("100007", "Jupyter添加提交失败"),
|
||||
VERSION_REPOSITORY_NOT_EXIST("10000", "主机名不存在");
|
||||
|
||||
String value;
|
||||
String description;
|
||||
|
||||
ErrorCodeEnum(String value, String description) {
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static ErrorCodeEnum getByDescription(String description) {
|
||||
return Arrays.stream(values()).filter(errorCodeEnum -> errorCodeEnum.getDescription().equals(description))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.imitate.common.exception;
|
||||
|
||||
import com.imitate.common.enums.ErrorCodeEnum;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*
|
||||
* @author yanchao
|
||||
*/
|
||||
public class BusinessException extends RuntimeException {
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private String errCode = ErrorCodeEnum.DATAFLOW_EXCEPTION.getValue();
|
||||
|
||||
public BusinessException(ErrorCodeEnum errorCodeEnum) {
|
||||
super(errorCodeEnum.getDescription());
|
||||
setErrCode(errorCodeEnum.getValue());
|
||||
}
|
||||
|
||||
public BusinessException(String code, String msg) {
|
||||
super(msg);
|
||||
setErrCode(code);
|
||||
}
|
||||
|
||||
public void setErrCode(String errCode) {
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
public String getErrCode() {
|
||||
return errCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 表网关实体公共字段抽离DO抽象类
|
||||
* @author yanchao
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public abstract class AbstractDO implements Serializable{
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Long id;
|
||||
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import com.imitate.common.util.AbstractDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
import tk.mybatis.mapper.common.MySqlMapper;
|
||||
|
||||
/**
|
||||
* 通用mapper整合桥梁
|
||||
* @author yanchao
|
||||
*/
|
||||
public interface BaseMapper<T extends AbstractDO> extends Mapper<T>, MySqlMapper<T> {
|
||||
// 特别注意,该接口不能被扫描到,否则会出错
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 基础分页视图对象
|
||||
* @author yanchao
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BasePageCondition implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public final static int DEFAULT_PAGE_SIZE = 10;
|
||||
|
||||
private Integer pageNumber;
|
||||
private Integer pageSize;
|
||||
private Integer pageStart;
|
||||
|
||||
private String orderField;
|
||||
private String orderDirection;
|
||||
private String keywords;
|
||||
|
||||
public BasePageCondition(){
|
||||
this.pageNumber = 1;
|
||||
this.pageSize = 0;
|
||||
this.pageStart = 0;
|
||||
}
|
||||
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startDate;
|
||||
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endDate;
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
|
||||
|
||||
public int getPageStart() {
|
||||
return pageNumber > 0 ? (pageNumber - 1) * getPageSize() :0;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import com.imitate.common.enums.ErrorCodeEnum;
|
||||
import com.imitate.common.exception.BusinessException;
|
||||
import com.imitate.common.util.R;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.ObjectError;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yanchao
|
||||
*/
|
||||
public class BasicController {
|
||||
public R actionResultWithBindingResult(ErrorCodeEnum errorCodeEnum, BindingResult bindingResult){
|
||||
String errMsg = getBindingResultErrors(bindingResult);
|
||||
if(StringUtils.isBlank(errMsg)){
|
||||
return R.error(errorCodeEnum.getDescription());
|
||||
}
|
||||
throw new BusinessException(errorCodeEnum.getValue(),errorCodeEnum.getDescription() + "," + errMsg);
|
||||
}
|
||||
public String getBindingResultErrors(BindingResult bindingResult){
|
||||
if (null == bindingResult || !bindingResult.hasErrors()) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder errorStrBuilder = new StringBuilder();
|
||||
List<ObjectError> errorList = bindingResult.getAllErrors();
|
||||
for (ObjectError error : errorList) {
|
||||
errorStrBuilder.append(error.getDefaultMessage()).append(";");
|
||||
}
|
||||
return StringUtils.removeEnd(errorStrBuilder.toString(), ";");
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLConnection;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 文件上传与下载
|
||||
* @author yanchao
|
||||
*/
|
||||
public class FileDownloadUtil {
|
||||
|
||||
/**
|
||||
* 下载单文件
|
||||
* @param file
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void fileDownload(File file, HttpServletResponse response) throws IOException {
|
||||
if (file.exists()) {
|
||||
String mimeType = URLConnection.guessContentTypeFromName(file.getName());
|
||||
if (mimeType == null) {
|
||||
mimeType = "application/octet-stream";
|
||||
}
|
||||
response.setContentType(mimeType);
|
||||
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + file.getName() + "\""));
|
||||
response.setContentLength((int) file.length());
|
||||
InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
|
||||
FileCopyUtils.copy(inputStream, response.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 在classpath下创建文件
|
||||
* @param resourceDirPath
|
||||
* @param createFileName
|
||||
* @throws IOException
|
||||
*/
|
||||
public static File createFile(String resourceDirPath,String createFileName) throws IOException {
|
||||
File tmpFile = new File(resourceDirPath + File.separator + createFileName);
|
||||
if (tmpFile.exists()) {
|
||||
tmpFile.delete();
|
||||
}
|
||||
tmpFile.createNewFile();
|
||||
return tmpFile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* files打成压缩包,多文件打包
|
||||
* @param files
|
||||
* @param zipTmpFile
|
||||
*/
|
||||
public static void zipFile(List<File> files, File zipTmpFile) throws IOException {
|
||||
// 创建文件输出流
|
||||
FileOutputStream fous = new FileOutputStream(zipTmpFile);
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(fous);
|
||||
int size = files.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
File file = files.get(i);
|
||||
zipFile(file, zipOutputStream);
|
||||
}
|
||||
zipOutputStream.close();
|
||||
fous.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 多文件打包
|
||||
* @param inputFile
|
||||
* @param ouputStream
|
||||
*/
|
||||
private static void zipFile(File inputFile, ZipOutputStream ouputStream) {
|
||||
try {
|
||||
if (inputFile.exists()) {
|
||||
if (inputFile.isFile()) {
|
||||
FileInputStream IN = new FileInputStream(inputFile);
|
||||
BufferedInputStream bins = new BufferedInputStream(IN, 512);
|
||||
ZipEntry entry = new ZipEntry(inputFile.getName());
|
||||
ouputStream.putNextEntry(entry);
|
||||
|
||||
int nNumber;
|
||||
byte[] buffer = new byte[512];
|
||||
while ((nNumber = bins.read(buffer)) != -1) {
|
||||
ouputStream.write(buffer, 0, nNumber);
|
||||
}
|
||||
|
||||
bins.close();
|
||||
IN.close();
|
||||
} else {
|
||||
try {
|
||||
File[] files = inputFile.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
zipFile(files[i], ouputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* http上下文
|
||||
* @author 悟空
|
||||
*/
|
||||
public class HttpContextUtils {
|
||||
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
}
|
||||
|
||||
|
||||
public static String getDomain(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
|
||||
}
|
||||
|
||||
public static String getOrigin(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
return request.getHeader("Origin");
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*******************************************************************************
|
||||
case_consumer * Copyright (c) 2005, 2014 springside.github.io
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
*******************************************************************************/
|
||||
package com.imitate.common.util;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mumu
|
||||
*
|
||||
*/
|
||||
public final class JsonUtils {
|
||||
|
||||
private static ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public static String toJson(Object object) {
|
||||
|
||||
try {
|
||||
return mapper.writeValueAsString(object);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T toBean(String content, Class<T> clazz) {
|
||||
|
||||
try {
|
||||
return mapper.readValue(content, clazz);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T toBean(String content, TypeReference<T> valueTypeRef) {
|
||||
|
||||
try {
|
||||
return mapper.readValue(content, valueTypeRef);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/**
|
||||
* MD5 工具
|
||||
*/
|
||||
public final class MD5Util {
|
||||
private static final Logger log = LoggerFactory.getLogger(MD5Util.class);
|
||||
|
||||
/**
|
||||
* md5 加密
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String toMd5(String input) {
|
||||
try {
|
||||
MessageDigest md5 = MessageDigest.getInstance("md5");
|
||||
md5.update(input.getBytes());
|
||||
return byteToString(md5.digest());
|
||||
} catch (Exception e) {
|
||||
log.error("计算container信息md5出错", e);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节转字符串
|
||||
*
|
||||
* @param byteValue
|
||||
* @return
|
||||
*/
|
||||
private static String byteToString(byte[] byteValue) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len = byteValue.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte b = byteValue[i];
|
||||
String hex = Integer.toHexString(0xFF & b);
|
||||
if (hex.length() == 1) {
|
||||
sb.append("0");
|
||||
}
|
||||
sb.append(hex);
|
||||
}
|
||||
return sb.subSequence(8, 24).toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.imitate.common.enums.ErrorCodeEnum;
|
||||
import org.apache.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 前端统一返回数据
|
||||
* @author yanchao
|
||||
*/
|
||||
public class R extends HashMap<String,Object> {
|
||||
|
||||
|
||||
@Override
|
||||
public Object get(Object key) {
|
||||
return this.get(key);
|
||||
}
|
||||
|
||||
public R(){
|
||||
put("result","success");
|
||||
put("errorCode", ErrorCodeEnum.SUCCESS.getValue());
|
||||
put("errorMsg","");
|
||||
put("data",new JSONArray());
|
||||
}
|
||||
|
||||
public static R error(){
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR,"未知异常,请联系管理员");
|
||||
}
|
||||
public static R error(String msg){
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR,msg);
|
||||
}
|
||||
public static R error(int code, String msg){
|
||||
R r = new R();
|
||||
r.put("result","fail");
|
||||
r.put("errorCode",code);
|
||||
r.put("errorMsg",msg);
|
||||
return r;
|
||||
}
|
||||
public static R error(String code, String msg){
|
||||
R r = new R();
|
||||
r.put("result","fail");
|
||||
r.put("errorCode",code);
|
||||
r.put("errorMsg",msg);
|
||||
return r;
|
||||
}
|
||||
public static R ok(String msg){
|
||||
R r = new R();
|
||||
r.put("errorMsg",msg);
|
||||
return r;
|
||||
}
|
||||
public static R ok(Map<String,Object> map){
|
||||
R r = new R();
|
||||
r.putAll(map);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(){
|
||||
return new R();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R put(String key, Object value){
|
||||
super.put(key,value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public R setData(Object data) {
|
||||
if(data == null || data == ""){
|
||||
put("data",new JSONArray());
|
||||
}else{
|
||||
JSONArray rst = new JSONArray();
|
||||
rst.add(data);
|
||||
put("data",rst);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
public class SimpleFileUtils {
|
||||
public static MultipartFile getMultipartFile(File file) {
|
||||
FileItem item = new DiskFileItemFactory().createItem("file"
|
||||
, MediaType.MULTIPART_FORM_DATA_VALUE
|
||||
, true
|
||||
, file.getName());
|
||||
try (InputStream input = new FileInputStream(file);
|
||||
OutputStream os = item.getOutputStream()) {
|
||||
// 流转移
|
||||
IOUtils.copy(input, os);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Invalid file: " + e, e);
|
||||
}
|
||||
|
||||
return new CommonsMultipartFile(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件字符串内容
|
||||
* @param file 文件
|
||||
* @return fileContent
|
||||
*/
|
||||
public static String fileToString(MultipartFile file){
|
||||
String fileContent = "";
|
||||
try {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
fileContent = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return fileContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件字符串内容
|
||||
* @param file 文件
|
||||
* @return fileContent
|
||||
*/
|
||||
public static String fileToString(File file){
|
||||
String fileContent = "";
|
||||
try {
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
fileContent = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return fileContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串内容变成文件导出
|
||||
* @param response HttpServletResponse
|
||||
* @param context 内容
|
||||
* @param fileName 文件名
|
||||
*/
|
||||
public static void stringToFileExport(HttpServletResponse response, String context, String fileName){
|
||||
response.setContentType("text/plain");
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
response.setHeader("Content-Disposition","attachment; filename=" + fileName);
|
||||
BufferedOutputStream buff = null;
|
||||
StringBuffer write = new StringBuffer();
|
||||
ServletOutputStream outSos = null;
|
||||
try {
|
||||
outSos = response.getOutputStream();
|
||||
buff = new BufferedOutputStream(outSos);
|
||||
//把内容写入文件
|
||||
write.append(context);
|
||||
|
||||
buff.write(write.toString().getBytes(StandardCharsets.UTF_8));
|
||||
buff.flush();
|
||||
buff.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (buff!=null){
|
||||
buff.close();
|
||||
}
|
||||
if (outSos!=null){
|
||||
outSos.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.imitate.common.util;
|
||||
|
||||
import cn.hutool.crypto.Mode;
|
||||
import cn.hutool.crypto.Padding;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author yanchao
|
||||
*/
|
||||
public class SymmetricCryptoUtil {
|
||||
/**
|
||||
* 16字节
|
||||
*/
|
||||
private static final String ENCODE_KEY = "1234567812345678";
|
||||
private static final String IV_KEY = "0000000000000000";
|
||||
|
||||
|
||||
public static String encryptFromString(String data, Mode mode, Padding padding) {
|
||||
AES aes;
|
||||
if (Mode.CBC == mode) {
|
||||
aes = new AES(mode, padding,
|
||||
new SecretKeySpec(ENCODE_KEY.getBytes(), "AES"),
|
||||
new IvParameterSpec(IV_KEY.getBytes()));
|
||||
} else {
|
||||
aes = new AES(mode, padding,
|
||||
new SecretKeySpec(ENCODE_KEY.getBytes(), "AES"));
|
||||
}
|
||||
return aes.encryptBase64(data, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static String decryptFromString(String data, Mode mode, Padding padding) {
|
||||
AES aes;
|
||||
if (Mode.CBC == mode) {
|
||||
aes = new AES(mode, padding,
|
||||
new SecretKeySpec(ENCODE_KEY.getBytes(), "AES"),
|
||||
new IvParameterSpec(IV_KEY.getBytes()));
|
||||
} else {
|
||||
aes = new AES(mode, padding,
|
||||
new SecretKeySpec(ENCODE_KEY.getBytes(), "AES"));
|
||||
}
|
||||
byte[] decryptDataBase64 = aes.decrypt(data);
|
||||
return new String(decryptDataBase64, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
#Auto Configure
|
@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.14.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.14.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.32" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.5.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.5.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.5.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.4.7" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:2.4.7" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.19.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.9.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.8.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.spring4all:swagger-spring-boot-starter:1.9.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:2.9.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.12.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.54" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.54" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.69.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.83" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.54" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:easyexcel:2.1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
|
||||
<orderEntry type="library" name="Maven: cglib:cglib:3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ow2.asm:asm:4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.32" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ehcache:ehcache:3.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.7.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.1.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.27" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.2.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.1.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:4.9.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.5.31" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.aliyun:aliyun-java-sdk-core:4.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jacoco:org.jacoco.agent:runtime:0.8.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.imitate</groupId>
|
||||
<artifactId>imitsys</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>imitsys</name>
|
||||
<description>imitsys</description>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>parent</module>
|
||||
<module>common</module>
|
||||
<module>web</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
@ -0,0 +1,30 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.imitate</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>web</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>web</name>
|
||||
<description>web</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.imitate</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,16 @@
|
||||
package com.imitate.web;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.ComponentScans;
|
||||
import tk.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@MapperScan(basePackages = { "com.imitate.web.persistence.mapper" })
|
||||
@ComponentScans(value = { @ComponentScan("com.imitate.common") })
|
||||
@SpringBootApplication
|
||||
public class WebApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WebApplication.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.imitate.web.init;
|
||||
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.imitate.common.util.SimpleFileUtils;
|
||||
import com.imitate.web.persistence.beans.DeviceType;
|
||||
import com.imitate.web.persistence.beans.Producer;
|
||||
import com.imitate.web.persistence.mapper.DeviceTypeMapper;
|
||||
import com.imitate.web.persistence.mapper.ProducerMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class Runner{
|
||||
|
||||
@Autowired
|
||||
private DeviceTypeMapper deviceTypeMapper;
|
||||
@Autowired
|
||||
private ProducerMapper producerMapper;
|
||||
|
||||
@Value("${imitate.init.path}")
|
||||
private String initPath;
|
||||
@Value("${imitate.init.xlsx}")
|
||||
private String initExcelName;
|
||||
@Value("${imitate.init.xml}")
|
||||
private String initXmlName;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
log.info("-------init db from excel or xml--------");
|
||||
File file = new File(initPath+ File.separator +initExcelName);
|
||||
if (!file.exists()){
|
||||
file = new File(initPath+ File.separator +initXmlName);
|
||||
if (!file.exists()){
|
||||
log.error("-------init db failed : no such file---"+file.getPath());
|
||||
}else {
|
||||
try {
|
||||
String xmlData = SimpleFileUtils.fileToString(file);
|
||||
Document document= XmlUtil.parseXml(xmlData);
|
||||
//获得XML文档根节点
|
||||
Element rootElement= XmlUtil.getRootElement(document);
|
||||
//解析厂商数据
|
||||
Element producerInfoElement = XmlUtil.getElement(rootElement, "producer-info");
|
||||
List<Element> producerElements = XmlUtil.getElements(producerInfoElement, "producer");
|
||||
List<Producer> producerList = new ArrayList<>();
|
||||
for (Element producerElement : producerElements){
|
||||
Producer producer = new Producer();
|
||||
producer.setName(producerElement.getAttribute("name"));
|
||||
producer.setAddress(producerElement.getAttribute("address"));
|
||||
producer.setProducerNumber(producerElement.getAttribute("producerNumber"));
|
||||
producer.setContacts1(producerElement.getAttribute("contacts1"));
|
||||
producer.setTel1(producerElement.getAttribute("tel1"));
|
||||
producer.setPhone1(producerElement.getAttribute("phone1"));
|
||||
producer.setCreateTime(LocalDateTime.now());
|
||||
producerList.add(producer);
|
||||
}
|
||||
producerMapper.insertList(producerList);
|
||||
//解析设备类型数据
|
||||
Element deviceTypeInfoElement = XmlUtil.getElement(rootElement, "device-type-info");
|
||||
List<Element> deviceTypeElements = XmlUtil.getElements(deviceTypeInfoElement, "device-type");
|
||||
List<DeviceType> deviceTypeList = new ArrayList<>();
|
||||
for (Element deviceTypeElement : deviceTypeElements){
|
||||
DeviceType deviceType = new DeviceType();
|
||||
deviceType.setName(deviceTypeElement.getAttribute("name"));
|
||||
deviceType.setTypeNumber(deviceTypeElement.getAttribute("typeNumber"));
|
||||
deviceType.setPattern(deviceTypeElement.getAttribute("pattern"));
|
||||
deviceType.setSecretLevel(deviceTypeElement.getAttribute("secretLevel"));
|
||||
deviceType.setManagementLevel(deviceTypeElement.getAttribute("managementLevel"));
|
||||
deviceType.setCreateTime(LocalDateTime.now());
|
||||
deviceTypeList.add(deviceType);
|
||||
}
|
||||
deviceTypeMapper.insertList(deviceTypeList);
|
||||
}catch (Exception e){
|
||||
log.error("-------init db failed : init error-------");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
try{
|
||||
List<DeviceType> deviceTypeList = EasyExcel.read(file, DeviceType.class,null)
|
||||
.sheet(5).headRowNumber(2).doReadSync();
|
||||
List<Producer> producerList = EasyExcel.read(file, Producer.class,null)
|
||||
.sheet(4).headRowNumber(2).doReadSync();
|
||||
|
||||
deviceTypeMapper.insertList(deviceTypeList);
|
||||
producerMapper.insertList(producerList);
|
||||
}catch (Exception e){
|
||||
log.error("-------init db failed : init error-------");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.imitate.web.module.simulation.controller;
|
||||
|
||||
import com.imitate.common.util.R;
|
||||
import com.imitate.web.module.simulation.service.SysDictService;
|
||||
import com.imitate.web.vo.DeviceManagerInitVO;
|
||||
import com.imitate.web.vo.DeviceResourceInitVO;
|
||||
import com.imitate.web.vo.DeviceSoftwareInitVO;
|
||||
import com.imitate.web.vo.LocalManagerInitVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 下拉列表字典值Controller
|
||||
*
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(value = "下拉列表字典值控制器", hidden = true)
|
||||
@RestController
|
||||
@RequestMapping("/sysDict")
|
||||
public class SysDictController {
|
||||
@Autowired
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@ApiOperation(value = "模训系统Dict", httpMethod = "GET")
|
||||
@RequestMapping(path = "/all",method = RequestMethod.GET)
|
||||
public R allDict(){
|
||||
log.info("[start]获取模训系统Dict");
|
||||
List<Object> res = sysDictService.getAllDict();
|
||||
log.info("[end]获取模训系统Dict");
|
||||
return R.ok().setData(res);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.imitate.web.module.simulation.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 资源类型枚举类
|
||||
* @author jshixiong
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum SecretKeyTypeEnum {
|
||||
|
||||
PREFORMED_RESOURCE("1","预制资源加密"),
|
||||
PUBLIC_KEY("2","公钥编制"),
|
||||
ALGORITHM_PARAMETERS("3","算法参数加密"),
|
||||
ALGORITHM_LOGIC("4","算法逻辑加密"),
|
||||
SOFTWARE("5","软件加密");
|
||||
|
||||
|
||||
private String value;
|
||||
private String description;
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.utils.StringUtils;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.imitate.common.util.SimpleFileUtils;
|
||||
import com.imitate.web.params.DataTerminalParam;
|
||||
import com.imitate.web.persistence.beans.DataTerminal;
|
||||
import com.imitate.web.persistence.mapper.DataTerminalMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据终端表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-28
|
||||
*/
|
||||
@Service
|
||||
public class DataTerminalService {
|
||||
|
||||
@Autowired
|
||||
private DataTerminalMapper dataTerminalMapper;
|
||||
|
||||
public DataTerminal getById(Long id){
|
||||
return dataTerminalMapper.getById(id);
|
||||
}
|
||||
|
||||
public int updateOrAdd(DataTerminal dataTerminal){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (null == dataTerminal.getId()){
|
||||
if(StringUtils.isEmpty(dataTerminal.getName())){
|
||||
dataTerminal.setName("终端/服务器"+ DateUtil.format(now,"yyyyMMddHHmmss"));
|
||||
}
|
||||
dataTerminal.setCreateTime(now);
|
||||
return dataTerminalMapper.insertSelective(dataTerminal);
|
||||
}else {
|
||||
dataTerminal.setUpdateTime(now);
|
||||
return dataTerminalMapper.updateByPrimaryKeySelective(dataTerminal);
|
||||
}
|
||||
}
|
||||
|
||||
public int deleteById(Long id){
|
||||
return dataTerminalMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public PageInfo<DataTerminal> page(DataTerminalParam param){
|
||||
PageHelper.startPage(param.getPageNumber(), param.getPageSize());
|
||||
List<DataTerminal> deviceList = dataTerminalMapper.selectAllPro(param.getType());
|
||||
PageInfo<DataTerminal> page = new PageInfo<>(deviceList);
|
||||
return page;
|
||||
}
|
||||
|
||||
public String resourceExport(Long id){
|
||||
DataTerminal dataTerminal = dataTerminalMapper.getById(id);
|
||||
return JSONObject.toJSONString(dataTerminal);
|
||||
}
|
||||
|
||||
public Boolean isTerminalOpen(String type){
|
||||
if (null!=dataTerminalMapper.getTerminalOpen(type)){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public DataTerminal openTerminal(DataTerminal dataTerminal){
|
||||
dataTerminal.setStatus(Boolean.TRUE);
|
||||
dataTerminalMapper.updateByPrimaryKeySelective(dataTerminal);
|
||||
return dataTerminal;
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.imitate.web.params.DistributionListParam;
|
||||
import com.imitate.web.params.DistributionParam;
|
||||
import com.imitate.web.persistence.beans.Device;
|
||||
import com.imitate.web.persistence.beans.DeviceDistribution;
|
||||
import com.imitate.web.persistence.mapper.DeviceDistributionMapper;
|
||||
import com.imitate.web.persistence.mapper.DeviceMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备配发/调拨单 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-08-02
|
||||
*/
|
||||
@Service
|
||||
public class DeviceDistributionService {
|
||||
|
||||
@Autowired
|
||||
private DeviceDistributionMapper deviceDistributionMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
public PageInfo<DeviceDistribution> page(DistributionListParam param){
|
||||
PageHelper.startPage(param.getPageNumber(), param.getPageSize());
|
||||
List<DeviceDistribution> list = deviceDistributionMapper.selectAllPro(param);
|
||||
list.forEach(e->{
|
||||
e.setDeviceCount(e.getDeviceList().size());
|
||||
});
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int editOrAdd(DistributionParam param){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int lc;
|
||||
if (null == param.getId()){
|
||||
param.setBeginTime(now);
|
||||
param.setCreateTime(now);
|
||||
param.setEndTime(now.plusDays(30*3));
|
||||
param.setStatus("1");
|
||||
param.setNumber("CK"+ DateUtil.format(now,"yyyyMMddHHmmss"));
|
||||
lc = deviceDistributionMapper.insertSelective(param.getDeviceDistribution());
|
||||
|
||||
param.setDeviceCount(param.getDeviceList().size());
|
||||
param.getDeviceList().forEach(e->{
|
||||
e.setUpdateTime(now);
|
||||
e.setDistributionId(param.getId());
|
||||
deviceMapper.updateByPrimaryKeySelective(e);
|
||||
});
|
||||
}else {
|
||||
param.setUpdateTime(now);
|
||||
lc = deviceDistributionMapper.updateByPrimaryKeySelective(param.getDeviceDistribution());
|
||||
deviceMapper.updateDistributionId(param.getId());
|
||||
param.getDeviceList().forEach(e->{
|
||||
e.setUpdateTime(now);
|
||||
e.setDistributionId(param.getId());
|
||||
deviceMapper.updateByPrimaryKeySelective(e);
|
||||
});
|
||||
}
|
||||
return lc;
|
||||
}
|
||||
|
||||
public DeviceDistribution getById(Long id){
|
||||
return deviceDistributionMapper.getById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DeviceDistribution deleteById(Long id){
|
||||
DeviceDistribution byId = deviceDistributionMapper.getById(id);
|
||||
//删除配发单
|
||||
deviceDistributionMapper.deleteByPrimaryKey(id);
|
||||
//将配发设备还原,解除配发
|
||||
deviceMapper.updateDistributionId(id);
|
||||
return byId;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-25
|
||||
*/
|
||||
@Service
|
||||
public class DeviceTypeProducerService {
|
||||
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.imitate.web.persistence.mapper.DeviceTypeMapper;
|
||||
import com.imitate.web.persistence.mapper.DeviceTypeProducerMapper;
|
||||
import com.imitate.web.persistence.beans.DeviceType;
|
||||
import com.imitate.web.persistence.beans.DeviceTypeProducer;
|
||||
import com.imitate.web.params.DeviceTypeParam;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备类型表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-25
|
||||
*/
|
||||
@Service
|
||||
public class DeviceTypeService {
|
||||
|
||||
@Autowired
|
||||
private DeviceTypeMapper deviceTypeMapper;
|
||||
@Autowired
|
||||
private DeviceTypeProducerMapper typeProducerMapper;
|
||||
|
||||
public DeviceType getById(Long id){
|
||||
return deviceTypeMapper.getById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteById(Long id){
|
||||
//删除所有 类型-厂商 中间表
|
||||
typeProducerMapper.deleteByTypeId(id);
|
||||
return deviceTypeMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteByTypeList(List<DeviceType> deviceTypeList){
|
||||
deviceTypeList.forEach(deviceType -> {
|
||||
typeProducerMapper.deleteByTypeId(deviceType.getId());
|
||||
deviceTypeMapper.deleteByPrimaryKey(deviceType.getId());
|
||||
});
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateOrAddProducer(DeviceTypeParam deviceTypeParam){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DeviceType deviceType = new DeviceType();
|
||||
BeanUtils.copyProperties(deviceTypeParam,deviceType);
|
||||
|
||||
List<DeviceTypeProducer> typeProducerList = new ArrayList<>();
|
||||
|
||||
Example example = new Example(DeviceType.class);
|
||||
example.createCriteria().andEqualTo("typeNumber",deviceTypeParam.getTypeNumber());
|
||||
DeviceType oneByExample = deviceTypeMapper.selectOneByExample(example);
|
||||
|
||||
if (deviceTypeParam.getId() == null){
|
||||
if (null!=oneByExample){
|
||||
return -1;
|
||||
}
|
||||
//新增设备类型
|
||||
deviceType.setCreateTime(now);
|
||||
int i = deviceTypeMapper.insertSelective(deviceType);
|
||||
if (null == deviceTypeParam.getProducerIdList() || i<0){
|
||||
return i;
|
||||
}
|
||||
//批量新增 设备类型-厂商 中间表
|
||||
deviceTypeParam.getProducerIdList().forEach(pid->{
|
||||
DeviceTypeProducer deviceTypeProducer = new DeviceTypeProducer();
|
||||
deviceTypeProducer.setTypeId(deviceType.getId());
|
||||
deviceTypeProducer.setProducerId(pid);
|
||||
deviceTypeProducer.setCreateTime(now);
|
||||
typeProducerList.add(deviceTypeProducer);
|
||||
});
|
||||
typeProducerMapper.insertList(typeProducerList);
|
||||
return i;
|
||||
}else {
|
||||
if (null!=oneByExample && !deviceTypeParam.getId().equals(oneByExample.getId())){
|
||||
return -1;
|
||||
}
|
||||
//先删除所有该设备类型与厂商的中间表,再新增。
|
||||
typeProducerMapper.deleteByTypeId(deviceType.getId());
|
||||
if (null != deviceTypeParam.getProducerIdList()){
|
||||
//批量新增 设备类型-厂商 中间表
|
||||
deviceTypeParam.getProducerIdList().forEach(pid->{
|
||||
DeviceTypeProducer deviceTypeProducer = new DeviceTypeProducer();
|
||||
deviceTypeProducer.setTypeId(deviceType.getId());
|
||||
deviceTypeProducer.setProducerId(pid);
|
||||
deviceTypeProducer.setCreateTime(now);
|
||||
typeProducerList.add(deviceTypeProducer);
|
||||
});
|
||||
typeProducerMapper.insertList(typeProducerList);
|
||||
}
|
||||
|
||||
deviceType.setUpdateTime(now);
|
||||
return deviceTypeMapper.updateByPrimaryKeySelective(deviceType);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int addByList(List<DeviceTypeParam> typeParamList){
|
||||
int sum = 0;
|
||||
for (DeviceTypeParam param : typeParamList){
|
||||
int i = updateOrAddProducer(param);
|
||||
sum+=i;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
public List<DeviceType> list(){
|
||||
return deviceTypeMapper.selectAll();
|
||||
}
|
||||
|
||||
public PageInfo<DeviceType> page(DeviceTypeParam param){
|
||||
PageHelper.startPage(param.getPageNumber(), param.getPageSize());
|
||||
List<DeviceType> typeList = deviceTypeMapper.selectByKey(param);
|
||||
return new PageInfo<>(typeList);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.imitate.web.persistence.mapper.DeviceMapper;
|
||||
import com.imitate.web.persistence.beans.Producer;
|
||||
import com.imitate.web.persistence.mapper.ProducerMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产厂商表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-14
|
||||
*/
|
||||
@Service
|
||||
public class ProducerService {
|
||||
|
||||
@Autowired
|
||||
private ProducerMapper producerMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
public Producer getById(Long id){
|
||||
return producerMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public int updateOrAddProducer(Producer producer){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (producer.getId() == null){
|
||||
producer.setCreateTime(now);
|
||||
return producerMapper.insertSelective(producer);
|
||||
}else {
|
||||
producer.setUpdateTime(now);
|
||||
return producerMapper.updateByPrimaryKey(producer);
|
||||
}
|
||||
}
|
||||
|
||||
public int deleteProducerById(Long id){
|
||||
if (deviceMapper.selectCountById(id)>0){
|
||||
return -1;
|
||||
}
|
||||
return producerMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<Producer> listProducer(){
|
||||
return producerMapper.selectAll();
|
||||
}
|
||||
|
||||
public PageInfo<Producer> pageProducer(Integer pageNum, Integer pageSize){
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<Producer> producerList = producerMapper.selectAll();
|
||||
PageInfo<Producer> page = new PageInfo<>(producerList);
|
||||
return page;
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.utils.StringUtils;
|
||||
import com.imitate.common.util.SimpleFileUtils;
|
||||
import com.imitate.web.params.SecretKeyParam;
|
||||
import com.imitate.web.persistence.beans.SecretKey;
|
||||
import com.imitate.web.module.simulation.enums.SecretKeyTypeEnum;
|
||||
import com.imitate.web.persistence.mapper.SecretKeyMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 密钥存储表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-14
|
||||
*/
|
||||
@Service
|
||||
public class SecretKeyService{
|
||||
|
||||
@Autowired
|
||||
private SecretKeyMapper secretKeyMapper;
|
||||
|
||||
public String[] resourceSecretKey(List<String> fileList){
|
||||
//删除所有数据
|
||||
secretKeyMapper.deleteAll();
|
||||
String[] msg = {"","","",""};
|
||||
for (int i = 0; i < fileList.size(); i++){
|
||||
String f = fileList.get(i);
|
||||
if (!StringUtils.isEmpty(f)){
|
||||
try {
|
||||
File file = new File(f);
|
||||
String fileToString = SimpleFileUtils.fileToString(SimpleFileUtils.getMultipartFile(file));
|
||||
SecretKey secretKey = JSONObject.parseObject(fileToString, SecretKey.class);
|
||||
if (addEncryptionKeyList(secretKey,secretKey.getType())<0){
|
||||
msg[i] = f+"资源文件"+(i+1)+"内容格式错误!";
|
||||
}
|
||||
}catch (IllegalArgumentException e){
|
||||
msg[i] = f+"系统找不到指定的文件"+(i+1)+"!";
|
||||
}catch (Exception e){
|
||||
msg[i] = f+"资源文件"+(i+1)+"内容格式错误!";
|
||||
}
|
||||
}
|
||||
}
|
||||
fileList.forEach(f->{
|
||||
|
||||
});
|
||||
return msg;
|
||||
}
|
||||
|
||||
public int addEncryptionKeyList(SecretKey secretKey,String inType){
|
||||
int lc = -1;
|
||||
if (!inType.equals(secretKey.getType())){
|
||||
return -2;
|
||||
}
|
||||
if (SecretKeyTypeEnum.PUBLIC_KEY.getValue().equals(secretKey.getType())){
|
||||
//如果是公钥类型,必须有算法类型参数
|
||||
if (StringUtils.isEmpty(secretKey.getAlgorithm())){
|
||||
return lc;
|
||||
}
|
||||
secretKey.setLength(null);
|
||||
lc = secretKeyMapper.updateByAlgorithmAndType(secretKey);
|
||||
if (lc<=0){
|
||||
secretKey.setCreateTime(LocalDateTime.now());
|
||||
lc = secretKeyMapper.insertSelective(secretKey);
|
||||
}
|
||||
}else {
|
||||
//如果是其他类型,必须有长度参数
|
||||
if (null == secretKey.getLength()){
|
||||
return lc;
|
||||
}
|
||||
secretKey.setAlgorithm(null);
|
||||
lc = secretKeyMapper.updateByLengthAndType(secretKey);
|
||||
if (lc<=0){
|
||||
secretKey.setCreateTime(LocalDateTime.now());
|
||||
lc = secretKeyMapper.insertSelective(secretKey);
|
||||
}
|
||||
}
|
||||
return lc;
|
||||
}
|
||||
|
||||
public List<SecretKey> selectStatisticsByType(String type){
|
||||
return secretKeyMapper.selectStatisticsByType(type);
|
||||
}
|
||||
|
||||
public int pushByLengthAndType(SecretKey secretKey){
|
||||
if(SecretKeyTypeEnum.PUBLIC_KEY.getValue().equals(secretKey.getType())){
|
||||
//如果是公钥类型,必须有算法类型参数
|
||||
if (StringUtils.isEmpty(secretKey.getAlgorithm())){
|
||||
return -1;
|
||||
}
|
||||
secretKey.setLength(null);
|
||||
}else{
|
||||
//如果是其他类型,必须有长度参数
|
||||
if (null == secretKey.getLength()){
|
||||
return -1;
|
||||
}
|
||||
secretKey.setAlgorithm(null);
|
||||
}
|
||||
return secretKeyMapper.pushByLengthAndType(secretKey);
|
||||
}
|
||||
|
||||
public String resourceEncryption(SecretKeyParam param){
|
||||
SecretKey secretKey = param.getSecretKey();
|
||||
if(SecretKeyTypeEnum.PUBLIC_KEY.getValue().equals(secretKey.getType())){
|
||||
//如果是公钥类型,必须有算法类型参数
|
||||
if (StringUtils.isEmpty(secretKey.getAlgorithm())){
|
||||
return "";
|
||||
}
|
||||
}else{
|
||||
//如果是其他类型,必须有长度参数
|
||||
if (null == secretKey.getLength()){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return JSONObject.toJSONString(secretKey);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,253 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.imitate.common.util.SimpleFileUtils;
|
||||
import com.imitate.web.vo.DeviceManagerInitVO;
|
||||
import com.imitate.web.vo.DeviceResourceInitVO;
|
||||
import com.imitate.web.vo.DeviceSoftwareInitVO;
|
||||
import com.imitate.web.vo.LocalManagerInitVO;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Service
|
||||
public class SysDictService {
|
||||
@Value("${imitate.init.path}")
|
||||
private String initPath;
|
||||
@Value("${imitate.init.xlsx}")
|
||||
private String initExcelName;
|
||||
@Value("${imitate.init.xml}")
|
||||
private String initXmlName;
|
||||
|
||||
public List<Object> getAllDict(){
|
||||
File file = new File(initPath+ File.separator +initExcelName);
|
||||
if (!file.exists()){
|
||||
file = new File(initPath+ File.separator +initXmlName);
|
||||
if (!file.exists()){
|
||||
return null;
|
||||
}else {
|
||||
//解析xml
|
||||
String xmlData = SimpleFileUtils.fileToString(file);
|
||||
Document document= XmlUtil.parseXml(xmlData);
|
||||
//获得XML文档根节点
|
||||
Element rootElement= XmlUtil.getRootElement(document);
|
||||
DeviceSoftwareInitVO resList1 = resourceDictXml(rootElement);
|
||||
DeviceManagerInitVO resList2 = dataDictXml(rootElement);
|
||||
LocalManagerInitVO resList3 = localManagerDictXml(rootElement);
|
||||
List<Object> res = new ArrayList<>();
|
||||
res.add(resList1);
|
||||
res.add(resList2);
|
||||
res.add(resList3);
|
||||
return res;
|
||||
}
|
||||
}else {
|
||||
//解析Excel
|
||||
DeviceSoftwareInitVO resList1 = resourceDictExcel(file);
|
||||
DeviceManagerInitVO resList2 = dataDictExcel(file);
|
||||
LocalManagerInitVO resList3 = localManagerDictExcel(file);
|
||||
// DeviceResourceInitVO resList4 = configureDeviceExcel(file);
|
||||
List<Object> res = new ArrayList<>();
|
||||
res.add(resList1);
|
||||
res.add(resList2);
|
||||
res.add(resList3);
|
||||
// res.add(resList4);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
private DeviceSoftwareInitVO resourceDictExcel(File file){
|
||||
List<DeviceSoftwareInitVO> list = EasyExcel.read(file, DeviceSoftwareInitVO.class,null)
|
||||
.sheet(0).headRowNumber(2).doReadSync();
|
||||
DeviceSoftwareInitVO resList = new DeviceSoftwareInitVO();
|
||||
|
||||
//选择单位
|
||||
List<String> firstUnitList = list.stream()
|
||||
.map(DeviceSoftwareInitVO::getFirstUnit)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//选择保障单位
|
||||
List<String> supportUnitList = list.stream()
|
||||
.map(DeviceSoftwareInitVO::getSupportUnit)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//选择管理节点
|
||||
List<String> managerNodeList = list.stream()
|
||||
.map(DeviceSoftwareInitVO::getManagerNode)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//数据库类型
|
||||
List<String> dbTypeList = list.stream()
|
||||
.map(DeviceSoftwareInitVO::getDbType)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
resList.setDbTypeList(firstUnitList);
|
||||
resList.setSupportUnitList(supportUnitList);
|
||||
resList.setManagerNodeList(managerNodeList);
|
||||
resList.setDbTypeList(dbTypeList);
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
private DeviceSoftwareInitVO resourceDictXml(Element rootElement){
|
||||
Element softwareElement = XmlUtil.getElement(rootElement, "device-manager-software");
|
||||
|
||||
DeviceSoftwareInitVO resList = new DeviceSoftwareInitVO(true);
|
||||
NodeList firstUnitNodes = XmlUtil.getElement(softwareElement, "firstUnit").getElementsByTagName("lt");
|
||||
for (int i = 0; i <firstUnitNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getFirstUnitList().add(firstUnitNodes.item(i).getTextContent());
|
||||
}
|
||||
NodeList supportUnitNodes = XmlUtil.getElement(softwareElement, "supportUnit").getElementsByTagName("lt");
|
||||
for (int i = 0; i <supportUnitNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getSupportUnitList().add(supportUnitNodes.item(i).getTextContent());
|
||||
}
|
||||
NodeList managerNodeNodes = XmlUtil.getElement(softwareElement, "managerNode").getElementsByTagName("lt");
|
||||
for (int i = 0; i <managerNodeNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getManagerNodeList().add(managerNodeNodes.item(i).getTextContent());
|
||||
}
|
||||
NodeList dbTypeNodes = XmlUtil.getElement(softwareElement, "dbType").getElementsByTagName("lt");
|
||||
for (int i = 0; i <dbTypeNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getDbTypeList().add(dbTypeNodes.item(i).getTextContent());
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
private DeviceManagerInitVO dataDictExcel(File file){
|
||||
List<DeviceManagerInitVO> list = EasyExcel.read(file, DeviceManagerInitVO.class,null)
|
||||
.sheet(1).headRowNumber(2).doReadSync();
|
||||
DeviceManagerInitVO resList = new DeviceManagerInitVO();
|
||||
//密钥长度
|
||||
List<String> keyLengthList = list.stream()
|
||||
.map(DeviceManagerInitVO::getKeyLength)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//算法类型
|
||||
List<String> algorithmList = list.stream()
|
||||
.map(DeviceManagerInitVO::getAlgorithm)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
resList.setKeyLengthList(keyLengthList);
|
||||
resList.setAlgorithmList(algorithmList);
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
private DeviceManagerInitVO dataDictXml(Element rootElement){
|
||||
Element terminalElement = XmlUtil.getElement(rootElement, "device-manager-terminal");
|
||||
|
||||
DeviceManagerInitVO resList = new DeviceManagerInitVO(true);
|
||||
NodeList keyLengthNodes = XmlUtil.getElement(terminalElement, "keyLength").getElementsByTagName("lt");
|
||||
for (int i = 0; i <keyLengthNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getKeyLengthList().add(keyLengthNodes.item(i).getTextContent());
|
||||
}
|
||||
NodeList algorithmNodes = XmlUtil.getElement(terminalElement, "algorithm").getElementsByTagName("lt");
|
||||
for (int i = 0; i <algorithmNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getAlgorithmList().add(algorithmNodes.item(i).getTextContent());
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
private LocalManagerInitVO localManagerDictExcel(File file){
|
||||
List<LocalManagerInitVO> list = EasyExcel.read(file, LocalManagerInitVO.class,null)
|
||||
.sheet(2).headRowNumber(2).doReadSync();
|
||||
LocalManagerInitVO resList = new LocalManagerInitVO();
|
||||
//配发节点
|
||||
List<String> distributionNodeList = list.stream()
|
||||
.map(LocalManagerInitVO::getDistributionNode)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//配发状态
|
||||
List<String> distributionStatusList = list.stream()
|
||||
.map(LocalManagerInitVO::getDistributionStatus)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//密钥长度
|
||||
List<String> keyLengthList = list.stream()
|
||||
.map(LocalManagerInitVO::getKeyLength)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//密钥发送节点
|
||||
List<String> keyNodeList = list.stream()
|
||||
.map(LocalManagerInitVO::getKeyNode)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
resList.setDistributionNodeList(distributionNodeList);
|
||||
resList.setDistributionStatusList(distributionStatusList);
|
||||
resList.setKeyLengthList(keyLengthList);
|
||||
resList.setKeyNodeList(keyNodeList);
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
private LocalManagerInitVO localManagerDictXml(Element rootElement){
|
||||
Element localElement = XmlUtil.getElement(rootElement, "local-manager-terminal");
|
||||
|
||||
LocalManagerInitVO resList = new LocalManagerInitVO(true);
|
||||
NodeList distributionNodeNodes = XmlUtil.getElement(localElement, "distributionNode").getElementsByTagName("lt");
|
||||
for (int i = 0; i <distributionNodeNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getDistributionNodeList().add(distributionNodeNodes.item(i).getTextContent());
|
||||
}
|
||||
NodeList keyLengthNodes = XmlUtil.getElement(localElement, "keyLength").getElementsByTagName("lt");
|
||||
for (int i = 0; i <keyLengthNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getKeyLengthList().add(keyLengthNodes.item(i).getTextContent());
|
||||
}
|
||||
NodeList keyNodeNodes = XmlUtil.getElement(localElement, "keyNode").getElementsByTagName("lt");
|
||||
for (int i = 0; i <keyNodeNodes.getLength() ; i++) {
|
||||
//标签的文本
|
||||
resList.getKeyNodeList().add(keyNodeNodes.item(i).getTextContent());
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
private DeviceResourceInitVO configureDeviceExcel(File file){
|
||||
List<DeviceResourceInitVO> list = EasyExcel.read(file, DeviceResourceInitVO.class,null)
|
||||
.sheet(3).headRowNumber(2).doReadSync();
|
||||
DeviceResourceInitVO resList = new DeviceResourceInitVO();
|
||||
//状态
|
||||
List<String> resourceStatusList = list.stream()
|
||||
.map(DeviceResourceInitVO::getResourceStatus)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
resList.setResourceStatusList(resourceStatusList);
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.imitate.web.module.simulation.service;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.imitate.web.persistence.beans.SysLog;
|
||||
import com.imitate.web.persistence.mapper.SysLogMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysLogService {
|
||||
|
||||
@Autowired
|
||||
private SysLogMapper sysLogMapper;
|
||||
|
||||
public SysLog getById(Long id){
|
||||
return sysLogMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<SysLog> list(String operation){
|
||||
return sysLogMapper.selectAllByOperation(operation);
|
||||
}
|
||||
|
||||
public PageInfo<SysLog> page(Integer pageNum,Integer pageSize){
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<SysLog> logList = sysLogMapper.selectAll();
|
||||
PageInfo<SysLog> page = new PageInfo<>(logList);
|
||||
return page;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.web.persistence.beans.Certificate;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 证书管理系统开通
|
||||
* @author yanchao
|
||||
*/
|
||||
@Data
|
||||
public class CertificateOpenParam implements Serializable {
|
||||
|
||||
@Valid
|
||||
@Delegate
|
||||
private Certificate certificate;
|
||||
|
||||
{
|
||||
certificate = new Certificate();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.common.util.BasePageCondition;
|
||||
import com.imitate.web.persistence.beans.DataTerminal;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class DataTerminalParam extends BasePageCondition implements Serializable {
|
||||
|
||||
@Valid
|
||||
@Delegate
|
||||
private DataTerminal dataTerminal;
|
||||
|
||||
{
|
||||
dataTerminal = new DataTerminal();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.common.util.BasePageCondition;
|
||||
import com.imitate.web.persistence.beans.Device;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class DeviceListParam extends BasePageCondition implements Serializable {
|
||||
|
||||
@Delegate
|
||||
private Device device;
|
||||
|
||||
{
|
||||
device = new Device();
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.web.persistence.beans.Device;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class DeviceParam implements Serializable {
|
||||
|
||||
@Valid
|
||||
@Delegate
|
||||
private Device device;
|
||||
|
||||
{
|
||||
device = new Device();
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.common.util.BasePageCondition;
|
||||
import com.imitate.web.persistence.beans.DeviceType;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class DeviceTypeParam extends BasePageCondition implements Serializable {
|
||||
|
||||
@Valid
|
||||
@Delegate
|
||||
private DeviceType deviceType;
|
||||
|
||||
{
|
||||
deviceType = new DeviceType();
|
||||
}
|
||||
|
||||
private List<Long> producerIdList;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.common.util.BasePageCondition;
|
||||
import com.imitate.web.persistence.beans.DeviceDistribution;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class DistributionListParam extends BasePageCondition implements Serializable {
|
||||
@Delegate
|
||||
private DeviceDistribution deviceDistribution;
|
||||
|
||||
{
|
||||
deviceDistribution = new DeviceDistribution();
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.web.persistence.beans.DeviceDistribution;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class DistributionParam implements Serializable {
|
||||
@Valid
|
||||
@Delegate
|
||||
private DeviceDistribution deviceDistribution;
|
||||
|
||||
{
|
||||
deviceDistribution = new DeviceDistribution();
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.web.persistence.beans.Producer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class ProducerParam implements Serializable {
|
||||
|
||||
@Valid
|
||||
@Delegate
|
||||
private Producer producer;
|
||||
|
||||
{
|
||||
producer = new Producer();
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
|
||||
|
||||
import com.imitate.web.persistence.beans.Resource;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 资源管理系统开通
|
||||
* @author yanchao
|
||||
*/
|
||||
@Data
|
||||
public class ResourceOpenParam implements Serializable {
|
||||
@Valid
|
||||
@Delegate
|
||||
private Resource resource;
|
||||
|
||||
{
|
||||
resource = new Resource();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.imitate.web.params;
|
||||
|
||||
import com.imitate.web.persistence.beans.SecretKey;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Delegate;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jshixiong
|
||||
*/
|
||||
@Data
|
||||
public class SecretKeyParam implements Serializable {
|
||||
|
||||
@Valid
|
||||
@Delegate
|
||||
private SecretKey secretKey;
|
||||
|
||||
{
|
||||
secretKey = new SecretKey();
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.imitate.web.persistence.beans;
|
||||
|
||||
import com.imitate.common.util.AbstractDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* 证书系统开通
|
||||
* @author yanchao
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = "certificate")
|
||||
public class Certificate extends AbstractDO {
|
||||
|
||||
@Column(name = "status")
|
||||
private Boolean status;
|
||||
|
||||
@NotBlank(message = "单位不能为空")
|
||||
@Column(name = "company")
|
||||
private String company;
|
||||
|
||||
@NotBlank(message = "数据库类型不能为空")
|
||||
@Column(name = "db_type")
|
||||
private String dbType;
|
||||
|
||||
@NotBlank(message = "数据库驱动不能为空")
|
||||
@Column(name = "db_drive")
|
||||
private String dbDrive;
|
||||
|
||||
@NotBlank(message = "数据库ip不能为空")
|
||||
@Column(name = "db_ip")
|
||||
private String dbIp;
|
||||
|
||||
@NotBlank(message = "数据库端口不能为空")
|
||||
@Column(name = "db_port")
|
||||
private String dbPort;
|
||||
|
||||
@NotBlank(message = "数据库名称不能为空")
|
||||
@Column(name = "db_name")
|
||||
private String dbName;
|
||||
|
||||
@NotBlank(message = "数据库密码不能为空")
|
||||
@Column(name = "db_passwd")
|
||||
private String dbPasswd;
|
||||
|
||||
@Column(name = "db_is_conn")
|
||||
private Boolean dbIsConn;
|
||||
|
||||
@NotBlank(message = "目标服务器地址不能为空")
|
||||
@Column(name = "target_ip")
|
||||
private String targetIp;
|
||||
|
||||
@NotBlank(message = "目标服务器端口不能为空")
|
||||
@Column(name = "target_port")
|
||||
private String targetPort;
|
||||
|
||||
@NotBlank(message = "用户dn不能为空")
|
||||
@Column(name = "target_userdn")
|
||||
private String targetUserdn;
|
||||
|
||||
@NotBlank(message = "用户口令不能为空")
|
||||
@Column(name = "target_passwd")
|
||||
private String targetPasswd;
|
||||
|
||||
@NotBlank(message = "用户证书发布配置文件路径不能为空")
|
||||
@Column(name = "cert_url")
|
||||
private String certUrl;
|
||||
|
||||
@NotNull(message = "CRL发布点中的证书数量")
|
||||
@Column(name = "cert_num")
|
||||
private Integer certNum;
|
||||
|
||||
@NotNull(message = "CRL发布周期")
|
||||
@Column(name = "cert_cycle")
|
||||
private Integer certCycle;
|
||||
|
||||
@NotBlank(message = "导入证书文件1不能为空")
|
||||
@Column(name = "import_cert_file1")
|
||||
private String importCertFile1;
|
||||
|
||||
@NotBlank(message = "导入证书文件2不能为空")
|
||||
@Column(name = "import_cert_file2")
|
||||
private String importCertFile2;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.imitate.web.persistence.beans;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.imitate.common.util.AbstractDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备类型表
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = "device_type")
|
||||
public class DeviceType extends AbstractDO {
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@ExcelProperty(value = "装备名称")
|
||||
@NotBlank(message = "设备型号名称不能为空")
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型编号
|
||||
*/
|
||||
@ExcelProperty(value = "装备代号")
|
||||
@NotBlank(message = "设备型号编号不能为空")
|
||||
@Column(name = "type_number")
|
||||
private String typeNumber;
|
||||
|
||||
/**
|
||||
* 工作模式
|
||||
*/
|
||||
@ExcelProperty(value = "工作模式")
|
||||
@NotBlank(message = "工作模式不能为空")
|
||||
@Column(name = "pattern")
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 密级
|
||||
*/
|
||||
@ExcelProperty(value = "装备密级")
|
||||
@NotBlank(message = "密级不能为空")
|
||||
@Column(name = "secret_level")
|
||||
private String secretLevel;
|
||||
|
||||
/**
|
||||
* 管理层级
|
||||
*/
|
||||
@ExcelProperty(value = "管理层级")
|
||||
@NotBlank(message = "管理等级不能为空")
|
||||
@Column(name = "management_level")
|
||||
private String managementLevel;
|
||||
|
||||
@Transient
|
||||
private List<Producer> producerList;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.imitate.web.persistence.beans;
|
||||
|
||||
import com.imitate.common.util.AbstractDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = "device_type_producer")
|
||||
public class DeviceTypeProducer extends AbstractDO {
|
||||
|
||||
/**
|
||||
* 设备类型ID
|
||||
*/
|
||||
@Column(name = "type_id")
|
||||
private Long typeId;
|
||||
|
||||
/**
|
||||
* 生产厂商ID
|
||||
*/
|
||||
@Column(name = "producer_id")
|
||||
private Long producerId;
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.imitate.web.persistence.beans;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.imitate.common.util.AbstractDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产厂商表
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-14
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = "producer")
|
||||
public class Producer extends AbstractDO {
|
||||
|
||||
/**
|
||||
* 厂商名称
|
||||
*/
|
||||
@ExcelProperty(value = "厂商全名")
|
||||
@NotBlank(message = "厂商名称不能为空")
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 厂商编号
|
||||
*/
|
||||
@ExcelProperty(value = "厂商代号")
|
||||
@NotBlank(message = "厂商编号不能为空")
|
||||
@Column(name = "producer_number")
|
||||
private String producerNumber;
|
||||
|
||||
/**
|
||||
* 厂商简称
|
||||
*/
|
||||
@Column(name = "simple_name")
|
||||
private String simpleName;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@ExcelProperty(value = "厂商地址")
|
||||
@NotBlank(message = "地址不能为空")
|
||||
@Column(name = "address")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 联系人姓名1
|
||||
*/
|
||||
@ExcelProperty(value = "联系人姓名")
|
||||
@NotBlank(message = "联系人姓名1不能为空")
|
||||
@Column(name = "contacts1")
|
||||
private String contacts1;
|
||||
|
||||
/**
|
||||
* 联系手机1
|
||||
*/
|
||||
@ExcelProperty(value = "联系人手机")
|
||||
@NotBlank(message = "联系手机1不能为空")
|
||||
@Column(name = "phone1")
|
||||
private String phone1;
|
||||
|
||||
/**
|
||||
* 联系电话1
|
||||
*/
|
||||
@ExcelProperty(value = "联系人电话")
|
||||
@NotBlank(message = "联系电话1不能为空")
|
||||
@Column(name = "tel1")
|
||||
private String tel1;
|
||||
|
||||
/**
|
||||
* 联系邮箱1
|
||||
*/
|
||||
@Column(name = "email1")
|
||||
private String email1;
|
||||
|
||||
/**
|
||||
* 联系人姓名2
|
||||
*/
|
||||
@Column(name = "contacts2")
|
||||
private String contacts2;
|
||||
|
||||
/**
|
||||
* 联系手机2
|
||||
*/
|
||||
@Column(name = "phone2")
|
||||
private String phone2;
|
||||
|
||||
/**
|
||||
* 联系电话2
|
||||
*/
|
||||
@Column(name = "tel2")
|
||||
private String tel2;
|
||||
|
||||
/**
|
||||
* 联系邮箱2
|
||||
*/
|
||||
@Column(name = "email2")
|
||||
private String email2;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Column(name = "remarks")
|
||||
private String remarks;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.imitate.web.persistence.beans;
|
||||
|
||||
import com.imitate.common.util.AbstractDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* 资源管理系统开通
|
||||
* @author yanchao
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = "resource")
|
||||
public class Resource extends AbstractDO {
|
||||
|
||||
@Column(name = "status")
|
||||
private Boolean status;
|
||||
@NotBlank(message = "数据库用户名不能为空")
|
||||
@Column(name = "db_user")
|
||||
private String dbUser;
|
||||
@NotBlank(message = "数据库密码不能为空")
|
||||
@Column(name = "db_passwd")
|
||||
private String dbPasswd;
|
||||
@NotBlank(message = "数据库服务器ip地址不能为空")
|
||||
@Column(name = "db_server_ip")
|
||||
private String dbServerIp;
|
||||
@NotNull(message = "type类型不能为空")
|
||||
@Column(name = "type")
|
||||
private Byte type;
|
||||
@NotBlank(message = "数据中心名称不能为空")
|
||||
@Column(name = "data_name")
|
||||
private String dataName;
|
||||
@NotBlank(message = "管理节点名称不能为空")
|
||||
@Column(name = "node_name")
|
||||
private String nodeName;
|
||||
@NotBlank(message = "设备出厂编号不能为空")
|
||||
@Column(name = "device_no")
|
||||
private String deviceNo;
|
||||
@NotBlank(message = "保障单位不能为空")
|
||||
@Column(name = "support_unit")
|
||||
private String supportUnit;
|
||||
@NotBlank(message = "管理节点不能为空")
|
||||
@Column(name = "manager_node")
|
||||
private String managerNode;
|
||||
@NotBlank(message = "导入文件1不能为空")
|
||||
@Column(name = "file1")
|
||||
private String file1;
|
||||
@NotBlank(message = "导入文件2不能为空")
|
||||
@Column(name = "file2")
|
||||
private String file2;
|
||||
@NotBlank(message = "导入文件3不能为空")
|
||||
@Column(name = "file3")
|
||||
private String file3;
|
||||
@NotBlank(message = "导入文件4不能为空")
|
||||
@Column(name = "file4")
|
||||
private String file4;
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
|
||||
package com.imitate.web.persistence.beans;
|
||||
|
||||
import com.imitate.common.util.AbstractDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 系统日志
|
||||
* @author 悟空
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = "sys_log")
|
||||
public class SysLog extends AbstractDO {
|
||||
|
||||
/**
|
||||
* 用户操作
|
||||
*/
|
||||
@Column(name = "operation")
|
||||
private String operation;
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
@Column(name = "module_name")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
@Column(name = "method")
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@Column(name = "params")
|
||||
private String params;
|
||||
|
||||
/**
|
||||
* 执行时长(毫秒)
|
||||
*/
|
||||
@Column(name = "time")
|
||||
private Integer time;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
@Column(name = "ip")
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 方法路由
|
||||
*/
|
||||
@Column(name = "method_path")
|
||||
private String methodPath;
|
||||
|
||||
|
||||
/**
|
||||
* 类路由
|
||||
*/
|
||||
@Column(name = "class_path")
|
||||
private String classPath;
|
||||
|
||||
|
||||
/**
|
||||
* 请求类型 GET或POST
|
||||
*/
|
||||
@Column(name = "http_type")
|
||||
private String httpType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 返回结果
|
||||
*/
|
||||
@Column(name = "result")
|
||||
private String result;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.persistence.beans.Certificate;
|
||||
import com.imitate.web.persistence.beans.Resource;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 证书系统开通
|
||||
* @author yanchao
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface CertificateMapper extends BaseMapper<Certificate> {
|
||||
|
||||
Certificate selectRecentCertificate();
|
||||
|
||||
void truncateTable();
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.persistence.beans.DataTerminal;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据终端表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-28
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface DataTerminalMapper extends BaseMapper<DataTerminal> {
|
||||
|
||||
/**
|
||||
* 根据类型查所有数据终端
|
||||
* @param type 类型
|
||||
* @return List
|
||||
*/
|
||||
List<DataTerminal> selectAllPro(@Param("type") String type);
|
||||
|
||||
/**
|
||||
* 通过ID获取数据终端
|
||||
* @param id ID
|
||||
* @return DataTerminal
|
||||
*/
|
||||
DataTerminal getById(Long id);
|
||||
|
||||
/**
|
||||
* 查询已开通的数据终端
|
||||
* @param type 数据终端类型
|
||||
* @return DataTerminal
|
||||
*/
|
||||
DataTerminal getTerminalOpen(@Param("type") String type);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.params.DistributionListParam;
|
||||
import com.imitate.web.persistence.beans.DeviceDistribution;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备配发/调拨单 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-08-02
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface DeviceDistributionMapper extends BaseMapper<DeviceDistribution> {
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
* @param param DistributionListParam
|
||||
* @return List
|
||||
*/
|
||||
List<DeviceDistribution> selectAllPro(@Param("param") DistributionListParam param);
|
||||
|
||||
/**
|
||||
* 通过id获取详情
|
||||
* @param id ID
|
||||
* @return DeviceDistribution
|
||||
*/
|
||||
DeviceDistribution getById(Long id);
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.persistence.beans.Device;
|
||||
import com.imitate.web.params.DeviceListParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 模拟设备表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-14
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface DeviceMapper extends BaseMapper<Device> {
|
||||
|
||||
/**
|
||||
* 查所有设备详情列表
|
||||
* @param param 查询条件
|
||||
* @return List
|
||||
*/
|
||||
List<Device> selectAllPro(@Param("param") DeviceListParam param);
|
||||
|
||||
/**
|
||||
* 根据类型查设备列表
|
||||
* @return List
|
||||
*/
|
||||
List<Device> selectDeviceByType();
|
||||
|
||||
/**
|
||||
* id获取设备
|
||||
* @param id ID
|
||||
* @return Device
|
||||
*/
|
||||
Device getById(Long id);
|
||||
|
||||
/**
|
||||
* 查询有多少使用该ID厂商的设备
|
||||
* @param producerId 厂商ID
|
||||
* @return Integer
|
||||
*/
|
||||
Integer selectCountById(Long producerId);
|
||||
|
||||
/**
|
||||
* 还原设备配发状态
|
||||
* @param distributionId 配发单ID
|
||||
* @return int
|
||||
*/
|
||||
int updateDistributionId (Long distributionId);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.params.DeviceTypeParam;
|
||||
import com.imitate.web.persistence.beans.DeviceType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备类型表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-25
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface DeviceTypeMapper extends BaseMapper<DeviceType> {
|
||||
|
||||
/**
|
||||
* 根据ID获取类型详情
|
||||
* @param id ID
|
||||
* @return DeviceType
|
||||
*/
|
||||
DeviceType getById(Long id);
|
||||
|
||||
/**
|
||||
* 条件查询列表
|
||||
* @param param DeviceTypeParam
|
||||
* @return List
|
||||
*/
|
||||
List<DeviceType> selectByKey(@Param("param") DeviceTypeParam param);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.persistence.beans.DeviceTypeProducer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-25
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface DeviceTypeProducerMapper extends BaseMapper<DeviceTypeProducer> {
|
||||
|
||||
/**
|
||||
* 根据typeId删除所有相关 类型-厂商表
|
||||
* @param id ID
|
||||
* @return int
|
||||
*/
|
||||
int deleteByTypeId(Long id);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.persistence.beans.Producer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产厂商表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author jshixiong
|
||||
* @since 2022-07-14
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ProducerMapper extends BaseMapper<Producer> {
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.persistence.beans.Resource;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ResourceMapper extends BaseMapper<Resource> {
|
||||
|
||||
Resource selectRecentResource();
|
||||
|
||||
|
||||
void truncateTable();
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.imitate.web.persistence.mapper;
|
||||
|
||||
import com.imitate.common.util.BaseMapper;
|
||||
import com.imitate.web.persistence.beans.SysLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface SysLogMapper extends BaseMapper<SysLog> {
|
||||
/**
|
||||
* 根据操作名查日志
|
||||
* @param operation 操作
|
||||
* @return List
|
||||
*/
|
||||
List<SysLog> selectAllByOperation(@Param("operation") String operation);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue