init
This commit is contained in:
44
template/.devcontainer/devcontainer.json
Normal file
44
template/.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "devcontainer",
|
||||
"image": "registry.cn-hangzhou.aliyuncs.com/zeroware/devcontainer:latest",
|
||||
"runArgs": ["--name", "${localWorkspaceFolderBasename}_devcontainer", "--env-file",".env"],
|
||||
"forwardPorts": [
|
||||
8080
|
||||
],
|
||||
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
|
||||
"containerUser": "ubuntu",
|
||||
"remoteUser": "ubuntu",
|
||||
"containerEnv": {
|
||||
"HOME": "/home/ubuntu"
|
||||
},
|
||||
"remoteEnv": {
|
||||
"HOME": "/home/ubuntu"
|
||||
},
|
||||
"updateRemoteUserUID": true,
|
||||
"mounts": [
|
||||
{
|
||||
"source": "${localEnv:HOME}${localEnv:USERPROFILE}/.m2/repository",
|
||||
"target": "/home/ubuntu/.m2/repository",
|
||||
"type": "bind"
|
||||
},
|
||||
{
|
||||
"source": "${localEnv:HOME}${localEnv:USERPROFILE}/.ssh",
|
||||
"target": "/home/ubuntu/.ssh",
|
||||
"type": "bind"
|
||||
}
|
||||
],
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"extensions": [
|
||||
"vscjava.vscode-java-dependency",
|
||||
"vscjava.vscode-maven",
|
||||
"vscjava.vscode-java-test",
|
||||
"vscjava.vscode-java-debug",
|
||||
"vscjava.vscode-java-pack",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
12
template/.env
Normal file
12
template/.env
Normal file
@@ -0,0 +1,12 @@
|
||||
DB_HOST=116.63.207.117:13306
|
||||
|
||||
ROCKETMQ_HOST=116.63.207.117:19876
|
||||
|
||||
OPENSEARCH_HOST=116.63.207.117:19200
|
||||
OPENSEARCH_PASSWORD=UW15/xI9CRFfAexPJWWZ6g
|
||||
|
||||
XXL_JOB_ADMIN_ADDRESS=https://xxljob.byteawake.com/xxl-job-admin
|
||||
XXL_JOB_ADMIN_PASSWORD=7t/IbuxDLIU
|
||||
|
||||
REDIS_HOST=116.63.207.117:16379
|
||||
REDIS_PASSWORD=9P7Alc4bicS/rC992aO45Q
|
||||
33
template/.gitignore
vendored
Normal file
33
template/.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
## java
|
||||
bin/
|
||||
classes/
|
||||
|
||||
|
||||
## eclipse
|
||||
.settings/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
## idea
|
||||
*.iml
|
||||
.idea/**
|
||||
HELP.md
|
||||
!.idea/dataSources.xml
|
||||
|
||||
## vscode
|
||||
.vscode/
|
||||
.factorypath
|
||||
|
||||
## maven:
|
||||
target/
|
||||
test-output/
|
||||
|
||||
## system
|
||||
.DS_Store
|
||||
logs/
|
||||
*.log
|
||||
|
||||
## vs
|
||||
.vs
|
||||
modules/**
|
||||
!modules/.gitkeep
|
||||
4
template/.gitlab-ci.yml
Normal file
4
template/.gitlab-ci.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
include:
|
||||
- project: 'internal/gitlab-ci-template'
|
||||
ref: master
|
||||
file: '/vs-server-generate-ci.yml'
|
||||
16
template/.idea/dataSources.xml
generated
Normal file
16
template/.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="{{ .db_database }}" uuid="{{ uuidv4 }}">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
{{- if eq .dbType "mysql" }}
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
{{- else if eq .dbType "postgresql" }}
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
{{- end }}
|
||||
<jdbc-url>jdbc:{{ .dbType }}://{{ .db_address }}/{{ .db_database }}</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
1
template/.mvn/jvm.config
Normal file
1
template/.mvn/jvm.config
Normal file
@@ -0,0 +1 @@
|
||||
-Xmx1536m
|
||||
BIN
template/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
template/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
20
template/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
20
template/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# 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
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://maven.aliyun.com/repository/public/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
|
||||
distributionSha256Sum=7822eb593d29558d8edf87845a2c47e36e2a89d17a84cd2390824633214ed423
|
||||
wrapperUrl=https://maven.aliyun.com/repository/public/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
wrapperUrlSha256Sum=e63a53cfb9c4d291ebe3c2b0edacb7622bbc480326beaa5a0456e412f52f066a
|
||||
1
template/.values.yml
Normal file
1
template/.values.yml
Normal file
@@ -0,0 +1 @@
|
||||
{{ toYaml . }}
|
||||
21
template/Dockerfile
Normal file
21
template/Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
# syntax=registry.cn-hangzhou.aliyuncs.com/imageacc/dockerfile:experimental
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/zeroware/javaapp-builder:latest as builder
|
||||
WORKDIR source
|
||||
COPY ./ ./
|
||||
ARG JAR_FILE=entrance/web/target/*.jar
|
||||
RUN --mount=type=cache,target=/root/.m2/repository,rw --mount=type=tmpfs,target=/root/.m2/repository/{{ .groupId | replace "." "/" }} mvnd clean package -Dmaven.test.skip=true
|
||||
RUN cp ${JAR_FILE} app.jar
|
||||
RUN java -Djarmode=layertools -jar ./app.jar extract
|
||||
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/zeroware/openjdk-17:latest
|
||||
WORKDIR /application
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
RUN echo 'Asia/Shanghai' >/etc/timezone
|
||||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
|
||||
COPY --from=builder source/dependencies/ ./
|
||||
COPY --from=builder source/snapshot-dependencies/ ./
|
||||
COPY --from=builder source/spring-boot-loader/ ./
|
||||
COPY --from=builder source/application/ ./
|
||||
ENV JAVA_OPTS="-Xms512m -Xmx512m"
|
||||
ENV MAIN_CLASS="org.springframework.boot.loader.JarLauncher"
|
||||
ENTRYPOINT ["sh", "-c", "exec java ${JAVA_OPTS} -Djava.security.egd=file:dev/./urandom ${MAIN_CLASS}"]
|
||||
34
template/devfile.yaml
Normal file
34
template/devfile.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
schemaVersion: 2.2.0
|
||||
|
||||
metadata:
|
||||
name: {{ .projectName }}
|
||||
|
||||
components:
|
||||
- name: tools
|
||||
container:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/zeroware/devcontainer:latest
|
||||
memoryLimit: 4Gi
|
||||
|
||||
endpoints:
|
||||
- name: http
|
||||
exposure: public
|
||||
protocol: http
|
||||
targetPort: 8080
|
||||
|
||||
- name: ssh-service
|
||||
kubernetes:
|
||||
deployByDefault: true
|
||||
inlined: |
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .projectName }}-ssh
|
||||
spec:
|
||||
ports:
|
||||
- name: ssh
|
||||
port: 22222
|
||||
protocol: TCP
|
||||
targetPort: 22222
|
||||
selector:
|
||||
controller.devfile.io/devworkspace_name: {{ .projectName }}
|
||||
type: NodePort
|
||||
42
template/environment.yml
Normal file
42
template/environment.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
groupId: {{ .groupId }}
|
||||
artifactId: {{ .artifactId }}
|
||||
projectName: {{ .projectName }}
|
||||
applicationName: {{ .applicationName }}
|
||||
branchName: {{ .branchName }}
|
||||
clusterName: {{ .clusterName }}
|
||||
version: {{ .version }}
|
||||
dbType: {{ .dbType }}
|
||||
__package: {{ .package }}
|
||||
__packagePath: {{ .packagePath }}
|
||||
__resources:
|
||||
db:
|
||||
address: {{ .db_address }}
|
||||
database: {{ .db_database }}
|
||||
username: {{ .db_username }}
|
||||
password: {{ .db_password }}
|
||||
rocketmq:
|
||||
address: {{ .rocketmq_address }}
|
||||
topic: {{ .rocketmq_topic }}
|
||||
consumerGroup: {{ .rocketmq_consumerGroup }}
|
||||
producerGroup: {{ .rocketmq_producerGroup }}
|
||||
elasticsearch:
|
||||
host: {{ .elasticsearch_host }}
|
||||
port: {{ .elasticsearch_port }}
|
||||
scheme: {{ .elasticsearch_scheme }}
|
||||
username: {{ .elasticsearch_username }}
|
||||
password: {{ .elasticsearch_password }}
|
||||
xxljob:
|
||||
address: {{ .xxljob_address }}
|
||||
username: {{ .xxljob_username }}
|
||||
password: {{ .xxljob_password }}
|
||||
accessToken: {{ .xxljob_accessToken }}
|
||||
redis:
|
||||
address: {{ .redis_address }}
|
||||
password: {{ .redis_password }}
|
||||
maxTotal: {{ .redis_maxTotal }}
|
||||
maxIdle: {{ .redis_maxIdle }}
|
||||
minIdle: {{ .redis_minIdle }}
|
||||
__platforms:
|
||||
git_url: {{ .git_url }}
|
||||
git_ssh_url: {{ .git_ssh_url }}
|
||||
freeway_url: {{ .freeway_url }}
|
||||
444
template/insiis-web/pom.xml
Normal file
444
template/insiis-web/pom.xml
Normal file
@@ -0,0 +1,444 @@
|
||||
<?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>
|
||||
|
||||
<artifactId>insiis-web</artifactId>
|
||||
<groupId>com.insigma</groupId>
|
||||
<version>1.1.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>insiis-web</name>
|
||||
<description>Web project for Insiis7</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis7</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<leaf-framework.version>7.0.0-SNAPSHOT</leaf-framework.version>
|
||||
<ucenter-sdk.version>1.2</ucenter-sdk.version>
|
||||
<odin-est.version>1.0.8</odin-est.version>
|
||||
<oracle.version>12.2.0.1</oracle.version>
|
||||
<mysql.version>8.0.31</mysql.version>
|
||||
<kingbase8.version>8.6.0</kingbase8.version>
|
||||
<oceanbase.version>2.4.0</oceanbase.version>
|
||||
<postgresql.version>42.5.6</postgresql.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<junit.version>4.12</junit.version>
|
||||
<vs.common.util.version>1.2.2</vs.common.util.version>
|
||||
<vs.common.version>1.2.0</vs.common.version>
|
||||
<ox.sprintboot.web.starter.version>1.0-SNAPSHOT</ox.sprintboot.web.starter.version>
|
||||
<lombok.version>1.18.20</lombok.version>
|
||||
<javax.annotation.api.version>1.3.2</javax.annotation.api.version>
|
||||
<logback.classic.version>1.2.3</logback.classic.version>
|
||||
<ox.basidc.common>1.0-SNAPSHOT</ox.basidc.common>
|
||||
<flyway.version>5.2.4</flyway.version>
|
||||
<vs.common.rpc.version>1.3.0-SNAPSHOT</vs.common.rpc.version>
|
||||
<vs.sqlmapper.spring>1.0.0-SNAPSHOT</vs.sqlmapper.spring>
|
||||
<vs.mock.spring>1.0.0-SNAPSHOT</vs.mock.spring>
|
||||
<vs.elasticsearch.version>1.0.0-SNAPSHOT</vs.elasticsearch.version>
|
||||
<org.hibernate.core>5.5.7.Final</org.hibernate.core>
|
||||
<vs.bo.common>1.0-SNAPSHOT</vs.bo.common>
|
||||
<cn.hutool.all>5.7.4</cn.hutool.all>
|
||||
<vs.debug.version>1.0.0-SNAPSHOT</vs.debug.version>
|
||||
<javax.persistence-api>2.2</javax.persistence-api>
|
||||
<elasticsearch.version>7.3.1</elasticsearch.version>
|
||||
<dist.version>1.2.2</dist.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${cn.hutool.all}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.persistence</groupId>
|
||||
<artifactId>javax.persistence-api</artifactId>
|
||||
<version>${javax.persistence-api}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>${org.hibernate.core}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>ox-bo-common</artifactId>
|
||||
<version>${vs.bo.common}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>dist</artifactId>
|
||||
<version>${dist.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>${javax.annotation.api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback.classic.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>ox-basidc-common</artifactId>
|
||||
<version>${ox.basidc.common}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
<version>${flyway.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>common-rpc</artifactId>
|
||||
<version>${vs.common.rpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>vs-sqlmapper-spring</artifactId>
|
||||
<version>${vs.sqlmapper.spring}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>vs-elasticsearch</artifactId>
|
||||
<version>${vs.elasticsearch.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>vs-mock-web</artifactId>
|
||||
<version>${vs.mock.spring}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>vs-debug-agent</artifactId>
|
||||
<version>${vs.debug.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>vs-debug-plugin</artifactId>
|
||||
<version>${vs.debug.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>vs.common.util</artifactId>
|
||||
<version>${vs.common.util.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>ox-bo-common</artifactId>
|
||||
<version>${vs.bo.common}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>common-rpc</artifactId>
|
||||
<version>${vs.common.rpc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-encryptor</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-core</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-commons</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-securities</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-web-support</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-scheduler</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-dfs</artifactId>
|
||||
<version>${revision}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cn.ctyun</groupId>
|
||||
<artifactId>oos-sdk</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-export-queue</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>ucenter-sdk</artifactId>
|
||||
<version>${ucenter-sdk.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>common-rpc</artifactId>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vs</groupId>
|
||||
<artifactId>vs-sqlmapper-spring</artifactId>
|
||||
</dependency>
|
||||
<!-- 服务网关客户端 -->
|
||||
<dependency>
|
||||
<groupId>com.epsoft.isp</groupId>
|
||||
<artifactId>isp-assist-client</artifactId>
|
||||
<version>5.0.5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.github.danielwegener</groupId>
|
||||
<artifactId>logback-kafka-appender</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<!--链路监控-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||
</dependency>
|
||||
<!--feignclient调用服务-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<!-- Druid数据源 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<!-- Oracle 驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.oracle.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>${oracle.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oceanbase</groupId>
|
||||
<artifactId>oceanbase-client</artifactId>
|
||||
<version>${oceanbase.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.com.kingbase</groupId>
|
||||
<artifactId>kingbase8</artifactId>
|
||||
<version>${kingbase8.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
</dependency>
|
||||
<!-- gaussdb driver -->
|
||||
<!--<dependency>
|
||||
<groupId>org.opengauss</groupId>
|
||||
<artifactId>opengauss-jdbc</artifactId>
|
||||
<version>2.1.0-h0.csi.gaussdb_kernel.opengaussjdbc.r8</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mohrss.leaf</groupId>
|
||||
<artifactId>leaf-core-framework</artifactId>
|
||||
<version>${leaf-framework.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<groupId>com.baomidou</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mohrss.leaf</groupId>
|
||||
<artifactId>leaf-uni-common</artifactId>
|
||||
<version>${leaf-framework.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>odin-est</artifactId>
|
||||
<version>${odin-est.version}</version>
|
||||
</dependency>
|
||||
<!-- nacos配置中心 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 添加代码生成器依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>${mybaits-plus.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 覆盖升级 -->
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.1.3-jre</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.14.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.14.3</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jettison</groupId>
|
||||
<artifactId>jettison</artifactId>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.woodstox</groupId>
|
||||
<artifactId>woodstox-core</artifactId>
|
||||
<version>6.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.insigma</groupId>
|
||||
<artifactId>insiis-data-firewall</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.demoyjh</groupId>
|
||||
<artifactId>demo_person-entrance-web</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.demoyjh</groupId>
|
||||
<artifactId>demo_person-entrance-rpc</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
<finalName>insiis7</finalName>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.insigma;
|
||||
|
||||
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||
import com.vs.sqlmapper.spring.scan.VSDaoBeanScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients
|
||||
@SpringBootApplication(scanBasePackages = {"{{.groupId}}", "com.vs","com.insigma"})
|
||||
@VSDaoBeanScan(basePackages = {"com.vs","{{.groupId}}"})
|
||||
@Import({DataSourceConfig.class,com.vs.sqlmapper.spring.DataSourceConfig.class})
|
||||
public class InsiisWebApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(InsiisWebApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||
return builder.sources(InsiisWebApplication.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.insigma.business.common.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.repository.SysUserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/6/15
|
||||
* @since 2.6.5
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common/search")
|
||||
public class CommonSearchController {
|
||||
|
||||
@Autowired
|
||||
private SysUserRepository sysUserRepository;
|
||||
|
||||
@PostMapping("/person")
|
||||
public ResponseMessage personSearch(@RequestBody JSONObject jsonObject) {
|
||||
String keyWord = jsonObject.getString("keyWord");
|
||||
Integer page = jsonObject.getInteger("page");
|
||||
Integer size = jsonObject.getInteger("size");
|
||||
SysUser params = new SysUser();
|
||||
params.setLogonName(keyWord);
|
||||
page = page < 0 ? 0 : page;
|
||||
Pageable pageable = PageRequest.of(page, size, Sort.by(Sort.Order.asc("logonName")));
|
||||
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()
|
||||
.withMatcher("logonName", ExampleMatcher.GenericPropertyMatchers.contains());
|
||||
Page<SysUser> p = sysUserRepository.findAll(Example.of(params, matcher), pageable);
|
||||
PageInfo<SysUser> pageInfo = new PageInfo<>();
|
||||
pageInfo.setTotal(p.getTotalElements());
|
||||
pageInfo.setData(p.getContent());
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.insigma.business.demo.blo;
|
||||
|
||||
import com.insigma.business.demo.dto.DemoPersonDTO;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import org.mohrss.leaf.core.framework.domain.blo.IBLO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/3/12
|
||||
*/
|
||||
public interface DemoPersonBLO extends IBLO {
|
||||
|
||||
DemoPersonDTO queryPerson(String id);
|
||||
|
||||
void deletePersons(List<String> ids);
|
||||
|
||||
void savePerson(DemoPersonDTO demoPersonDTO);
|
||||
|
||||
PageInfo<DemoPersonDTO> queryPersonList(DemoPersonDTO queryDTO, Integer page, Integer size);
|
||||
|
||||
DemoPersonDTO selectOne(DemoPersonDTO demoPersonDTO);
|
||||
|
||||
PageInfo<DemoPersonDTO> queryPersonListByExport(DemoPersonDTO queryDTO, Integer page, Integer size);
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.insigma.business.demo.blo.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.insigma.business.demo.blo.DemoPersonBLO;
|
||||
import com.insigma.business.demo.dao.DemoPersonDAO;
|
||||
import com.insigma.business.demo.dto.DemoPersonDTO;
|
||||
import com.insigma.business.demo.entity.DemoPerson;
|
||||
import com.insigma.framework.db.JdbcPageHelper;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.util.DtoEntityUtil;
|
||||
import com.insigma.framework.util.IDUtil;
|
||||
import com.insigma.web.support.util.SysFunctionManager;
|
||||
import lombok.SneakyThrows;
|
||||
import org.mohrss.leaf.uni.common.domain.blo.impl.BLOImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/3/12
|
||||
*/
|
||||
@Service
|
||||
public class DemoPersonBLOImpl extends BLOImpl implements DemoPersonBLO {
|
||||
|
||||
@Autowired
|
||||
private DemoPersonDAO demoPersonDAO;
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Override
|
||||
public DemoPersonDTO queryPerson(String id) {
|
||||
DemoPerson dp = demoPersonDAO.selectDemoPersonById(id);
|
||||
// DemoPerson dp = demoPersonDAO.sqlSession().selectOne("selectDemoPersonById", id);
|
||||
// DemoPerson dp = demoPersonDAO.getById(id);
|
||||
DemoPersonDTO dto = DtoEntityUtil.trans(dp, DemoPersonDTO.class);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePersons(List<String> ids) {
|
||||
demoPersonDAO.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void savePerson(DemoPersonDTO demoPersonDTO) {
|
||||
DemoPerson dp = DtoEntityUtil.trans(demoPersonDTO, DemoPerson.class);
|
||||
String id = null;
|
||||
if (ObjectUtils.isEmpty(demoPersonDTO.getId())) { // 新增
|
||||
|
||||
id = IDUtil.generateUUID();
|
||||
} else {
|
||||
id = demoPersonDTO.getId();
|
||||
}
|
||||
dp.setId(id);
|
||||
dp.setCreate_time(new Date());
|
||||
// HList hList = new HList(JSON.parseObject(JSON.toJSONString(dp)));
|
||||
// hList.setNVarchar2Columns("address");
|
||||
// hList.save("demo_person", "address;name", "id", HList.SAVEMODE_INSERT_OR_UPDATE);
|
||||
demoPersonDAO.insertOrUpdate(dp);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public PageInfo<DemoPersonDTO> queryPersonList(DemoPersonDTO queryDTO, Integer page, Integer size) {
|
||||
//查询条件为时间段选项
|
||||
SimpleDateFormat st = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date oTime = null;
|
||||
Date pTime = null;
|
||||
if (!ObjectUtils.isEmpty(queryDTO.getStartTime())) {
|
||||
oTime = st.parse(queryDTO.getStartTime().split(",")[0]);
|
||||
pTime = st.parse(queryDTO.getStartTime().split(",")[1]);
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<DemoPerson> wrapper = new QueryWrapper<DemoPerson>().lambda();
|
||||
wrapper.like(!ObjectUtils.isEmpty(queryDTO.getName()), DemoPerson::getName, "%" + queryDTO.getName() + "%")
|
||||
.eq(!ObjectUtils.isEmpty(queryDTO.getSex()), DemoPerson::getSex, queryDTO.getSex())
|
||||
.ge(!ObjectUtils.isEmpty(queryDTO.getStartTime()), DemoPerson::getBirthday, oTime)
|
||||
.le(!ObjectUtils.isEmpty(queryDTO.getStartTime()), DemoPerson::getBirthday, pTime)
|
||||
.orderByDesc(DemoPerson::getCreate_time);
|
||||
|
||||
Page<DemoPerson> dpPage = new Page<>(page, size);
|
||||
|
||||
IPage<DemoPerson> mapIPage = demoPersonDAO.page(dpPage, wrapper);
|
||||
List<DemoPerson> records = mapIPage.getRecords();
|
||||
List<DemoPersonDTO> list = DtoEntityUtil.trans(records, DemoPersonDTO.class);
|
||||
|
||||
PageInfo<DemoPersonDTO> pageInfo = new PageInfo<>();
|
||||
pageInfo.setTotal(mapIPage.getTotal());
|
||||
pageInfo.setData(list);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DemoPersonDTO selectOne(DemoPersonDTO demoPersonDTO) {
|
||||
LambdaQueryWrapper<DemoPerson> wrapper = new QueryWrapper<DemoPerson>().lambda();
|
||||
wrapper.eq(!ObjectUtils.isEmpty(demoPersonDTO.getName()), DemoPerson::getName, demoPersonDTO.getName())
|
||||
.eq(!ObjectUtils.isEmpty(demoPersonDTO.getSex()), DemoPerson::getSex, demoPersonDTO.getSex())
|
||||
.eq(!ObjectUtils.isEmpty(demoPersonDTO.getBirthday()), DemoPerson::getBirthday, demoPersonDTO.getBirthday())
|
||||
.eq(!ObjectUtils.isEmpty(demoPersonDTO.getMobile()), DemoPerson::getMobile, demoPersonDTO.getAddress())
|
||||
.eq(!ObjectUtils.isEmpty(demoPersonDTO.getAddress()), DemoPerson::getAddress, demoPersonDTO.getAddress());
|
||||
//查询有没有相同的数据
|
||||
DemoPerson demoPerson = demoPersonDAO.selectOne(wrapper);
|
||||
DemoPersonDTO personDTO = DtoEntityUtil.trans(demoPerson, DemoPersonDTO.class);
|
||||
return personDTO;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public PageInfo<DemoPersonDTO> queryPersonListByExport(DemoPersonDTO queryDTO, Integer page, Integer size) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
StringBuffer sql = new StringBuffer("select * from demo_person where 1=1 ");
|
||||
if (!ObjectUtils.isEmpty(queryDTO.getName())) {
|
||||
sql.append(" and name like :name");
|
||||
params.put("name", "%" + queryDTO.getName() + "%");
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(queryDTO.getSex())) {
|
||||
sql.append(" and sex = :sex");
|
||||
params.put("sex", queryDTO.getSex());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(queryDTO.getStartTime())) {
|
||||
//查询条件为时间段选项
|
||||
SimpleDateFormat st = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date oTime = st.parse(queryDTO.getStartTime().split(",")[0]);
|
||||
Date pTime = st.parse(queryDTO.getStartTime().split(",")[1]);
|
||||
sql.append(" and birthday > :startTime and birthday < :endTime");
|
||||
params.put("startTime", oTime);
|
||||
params.put("endTime", pTime);
|
||||
}
|
||||
JdbcPageHelper jdbcPageHelper = new JdbcPageHelper(jdbcTemplate, page, size, "grid", SysFunctionManager.getFunctionId());
|
||||
return jdbcPageHelper.queryPagination(sql.toString(), params, DemoPersonDTO.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.insigma.business.demo.bpo;
|
||||
|
||||
import com.insigma.business.demo.dto.DemoPersonDTO;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import org.mohrss.leaf.core.framework.domain.bpo.IBPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/3/12
|
||||
*/
|
||||
public interface DemoPersonBPO extends IBPO {
|
||||
|
||||
DemoPersonDTO queryPerson(String id);
|
||||
|
||||
void deletePersons(List<String> ids);
|
||||
|
||||
void savePerson(DemoPersonDTO demoPersonDTO);
|
||||
|
||||
PageInfo<DemoPersonDTO> queryPersonList(DemoPersonDTO queryDTO, Integer page, Integer size);
|
||||
|
||||
|
||||
DemoPersonDTO selectOne(DemoPersonDTO demoPersonDTO);
|
||||
|
||||
PageInfo<DemoPersonDTO> queryPersonListByExport(DemoPersonDTO queryDTO, Integer page, Integer size);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.insigma.business.demo.bpo.impl;
|
||||
|
||||
import com.insigma.business.demo.blo.DemoPersonBLO;
|
||||
import com.insigma.business.demo.bpo.DemoPersonBPO;
|
||||
import com.insigma.business.demo.dto.DemoPersonDTO;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import org.mohrss.leaf.uni.common.domain.bpo.impl.BPOImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/3/12
|
||||
*/
|
||||
@Service
|
||||
public class DemoPersonBPOImpl extends BPOImpl implements DemoPersonBPO {
|
||||
|
||||
@Autowired
|
||||
private DemoPersonBLO demoPersonBLO;
|
||||
|
||||
@Override
|
||||
public DemoPersonDTO queryPerson(String id) {
|
||||
DemoPersonDTO demoPersonDTO = demoPersonBLO.queryPerson(id);
|
||||
return demoPersonDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePersons(List<String> ids) {
|
||||
demoPersonBLO.deletePersons(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void savePerson(DemoPersonDTO demoPersonDTO) {
|
||||
demoPersonBLO.savePerson(demoPersonDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<DemoPersonDTO> queryPersonList(DemoPersonDTO queryDTO, Integer page, Integer size) {
|
||||
return demoPersonBLO.queryPersonList(queryDTO, page, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DemoPersonDTO selectOne(DemoPersonDTO demoPersonDTO) {
|
||||
return demoPersonBLO.selectOne(demoPersonDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<DemoPersonDTO> queryPersonListByExport(DemoPersonDTO queryDTO, Integer page, Integer size) {
|
||||
return demoPersonBLO.queryPersonListByExport(queryDTO, page, size);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.insigma.business.demo.controller;
|
||||
|
||||
import com.insigma.business.demo.bpo.DemoPersonBPO;
|
||||
import com.insigma.business.demo.dto.DemoPersonDTO;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.web.support.annotation.OdinRequest;
|
||||
import com.insigma.web.support.annotation.OdinRequestParam;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 人员增删改查demo
|
||||
* <p>
|
||||
* 实体类传参开发方式,需继承BaseController,并且需要实体类传参的方法上加上@OdinRequest
|
||||
* 在doInit方法上需要加上注解@OdinRequest(init = true),init = true为初始化字典数据和模块信息,其他方法上只需加@OdinRequest即可,不需要参数
|
||||
* 方法参数如果不指定@OdinRequestParam注解,则按照参数名去取前端传过来的数据,并将其转化成实体类
|
||||
* 如果指定了@OdinRequestParam注解,并且设定了value值,则根据value值去取前端传过来的数据
|
||||
* 其中@OdinRequestParam参数required默认为true,即如果找不到对应的数据,则返回错误,当设置成false,则不会
|
||||
* 如果需要接收前端传过来的表格数据,则可以通过定义PageInfo<T>来接收数据
|
||||
*
|
||||
* @author yinjh
|
||||
* @since 2020-05-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/demo/DemoPerson")
|
||||
public class DemoPersonController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DemoPersonBPO demoPersonBPO;
|
||||
|
||||
@OdinRequest(init = true)
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(DemoPersonDTO f_form, Integer t_tableData_size) {
|
||||
tableDataQuery(f_form, 1, t_tableData_size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@OdinRequestParam("f_form") DemoPersonDTO queryDTO,
|
||||
//@OdinRequestParam("t_tableData") PageInfo<DemoPersonDTO> pageInfo, // 没用到,只作如何取表格数据的演示
|
||||
Integer t_tableData_size) {
|
||||
tableDataQuery(queryDTO, 1, t_tableData_size);
|
||||
// this.set("page", 1); // 需要将前端表格中:currentPage定义的值设置成1
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/doGridQuery/{name}")
|
||||
public ResponseMessage doGridQuery(@OdinRequestParam("f_form") DemoPersonDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData_page") Integer page,
|
||||
@OdinRequestParam("t_tableData_size") Integer size,
|
||||
@PathVariable String name) {
|
||||
tableDataQuery(queryDTO, page, size);
|
||||
// this.set("page", page); // 需要将t_tableData_page的值赋值到前端表格:currentPage的值中
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/add")
|
||||
public ResponseMessage add() {
|
||||
this.clearForm("f_personForm");
|
||||
this.set("dialogFormVisible", true);
|
||||
this.set("dialogFormTitle", "新增人员");
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/update")
|
||||
public ResponseMessage update(String id) {
|
||||
DemoPersonDTO dto = demoPersonBPO.queryPerson(id);
|
||||
this.toForm("f_personForm", dto);
|
||||
this.set("dialogFormVisible", true);
|
||||
this.set("dialogFormTitle", "修改人员");
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest(refresh = true)
|
||||
@PostMapping("/batchDelete")
|
||||
public ResponseMessage batchDelete() {
|
||||
List<DemoPersonDTO> list = this.getCheckedTableData("t_tableData", DemoPersonDTO.class);
|
||||
if (list.size() == 0) {
|
||||
return this.error("请勾选需要删除的人员!");
|
||||
}
|
||||
List<String> ids = list.stream().map(o -> o.getId()).collect(Collectors.toList());
|
||||
demoPersonBPO.deletePersons(ids);
|
||||
// this.refresh();
|
||||
return this.ok("删除成功!");
|
||||
}
|
||||
|
||||
@OdinRequest(refresh = true) // refresh = true 请求结束后刷新页面
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(String id) {
|
||||
List<String> ids = Arrays.asList(id);
|
||||
demoPersonBPO.deletePersons(ids);
|
||||
// this.refresh();
|
||||
return this.ok("删除成功!");
|
||||
}
|
||||
|
||||
@OdinRequest(refresh = true)
|
||||
@PostMapping("/doSave/{name}")
|
||||
public ResponseMessage doSave(@OdinRequestParam("f_personForm") DemoPersonDTO demoPersonDTO, @PathVariable String name) {
|
||||
|
||||
if (ObjectUtils.isEmpty(demoPersonDTO.getId())) {
|
||||
DemoPersonDTO dto = demoPersonBPO.selectOne(demoPersonDTO);
|
||||
if (dto != null) {
|
||||
return this.error("不可添加重复数据!!");
|
||||
}
|
||||
}
|
||||
demoPersonBPO.savePerson(demoPersonDTO);
|
||||
this.set("dialogFormVisible", false);
|
||||
//this.refresh();
|
||||
return this.ok("保存成功!");
|
||||
}
|
||||
|
||||
public void tableDataQuery(DemoPersonDTO queryDTO, Integer t_tableData_page, Integer t_tableData_size) {
|
||||
this.pageQuery("t_tableData", () -> {
|
||||
this.set("page", t_tableData_page); // 需要将前端表格中:currentPage定义的值设置成page的值
|
||||
return demoPersonBPO.queryPersonListByExport(queryDTO, t_tableData_page, t_tableData_size);
|
||||
}, (demoPersonDTO, checkbox) -> {
|
||||
if ("1".equals(demoPersonDTO.getSex())) {
|
||||
// checkbox.setDisabled(true); // 设置行复选框不可编辑
|
||||
} else {
|
||||
// checkbox.setChecked(true); // 设置行复选框已选中
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.insigma.business.demo.dao;
|
||||
|
||||
import com.insigma.business.demo.entity.DemoPerson;
|
||||
import com.insigma.framework.mybatis.BaseDAO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yinjh
|
||||
* @since 2020-05-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface DemoPersonDAO extends BaseDAO<DemoPerson> {
|
||||
|
||||
DemoPerson selectDemoPersonById(String id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.insigma.business.demo.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2020/5/28.
|
||||
*/
|
||||
@Data
|
||||
public class DemoPersonDTO implements Serializable {
|
||||
private Boolean checked;//用于设置复选框是否选中
|
||||
|
||||
private Boolean disabled;//用于设置复选框是否可编辑
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String sex;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date birthday;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String address;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private Date create_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.insigma.business.demo.dto;
|
||||
|
||||
import com.insigma.framework.data.firewall.desensitization.annotation.NameDesensitization;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @since 2024/5/22
|
||||
*/
|
||||
@Data
|
||||
public class TestDTO implements Serializable {
|
||||
|
||||
@NameDesensitization
|
||||
private String name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.insigma.business.demo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author yinjh
|
||||
* @since 2020-05-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("DEMO_PERSON")
|
||||
public class DemoPerson implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId("ID")
|
||||
private String id;
|
||||
|
||||
@TableField("NAME")
|
||||
private String name;
|
||||
|
||||
@TableField("SEX")
|
||||
private String sex;
|
||||
|
||||
@TableField("BIRTHDAY")
|
||||
private Date birthday;
|
||||
|
||||
@TableField("MOBILE")
|
||||
private String mobile;
|
||||
|
||||
@TableField("ADDRESS")
|
||||
private String address;
|
||||
|
||||
@TableField("PRSENO")
|
||||
private Long prseno;
|
||||
|
||||
@TableField("CREATE_TIME")
|
||||
private Date create_time;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.insigma.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* @author Linwj
|
||||
* @version 2019/6/12 10:26
|
||||
*/
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
|
||||
@Value("${sys.rest-template.connect-timeout:30000}")
|
||||
private int connectTimeout;
|
||||
|
||||
@Value("${sys.rest-template.read-timeout:30000}")
|
||||
private int readTimeout;
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public RestTemplate restTemplate(ClientHttpRequestFactory factory){
|
||||
return new RestTemplate(factory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHttpRequestFactory simpleClientHttpRequestFactory(){
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setConnectTimeout(connectTimeout);
|
||||
factory.setReadTimeout(readTimeout);
|
||||
return factory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.insigma.sys.common;
|
||||
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.sys.entity.Aa26;
|
||||
import com.insigma.sys.entity.SysOrg;
|
||||
import com.insigma.sys.entity.SysRole;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.repository.Aa26Repository;
|
||||
import com.insigma.sys.repository.RoleRepository;
|
||||
import com.insigma.sys.repository.SysOrgRepository;
|
||||
import com.insigma.sys.repository.SysUserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/12/8
|
||||
*/
|
||||
@Component
|
||||
public class CommonValidator {
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@Autowired
|
||||
private SysOrgRepository sysOrgRepository;
|
||||
|
||||
@Autowired
|
||||
private Aa26Repository aa26Repository;
|
||||
|
||||
@Autowired
|
||||
private SysUserRepository sysUserRepository;
|
||||
|
||||
/**
|
||||
* 校验当前登录用户是否有相应角色的操作权限
|
||||
* @param roleId 角色ID
|
||||
* @return
|
||||
*/
|
||||
public boolean validateRole(String roleId) {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
SysRole sysRole = roleRepository.findById(roleId).orElseThrow(() -> new AppException("角色不存在!"));
|
||||
if ("1".equals(sysUser.getUserType())) {
|
||||
return true;
|
||||
} else if ("2".equals(sysUser.getUserType())) {
|
||||
if (sysUser.getAreaId() != null && sysUser.getAreaId().equals(sysRole.getAreaid())) {
|
||||
return true;
|
||||
}
|
||||
} else if ("3".equals(sysUser.getUserType())) {
|
||||
if (sysUser.getOrgId() != null && sysUser.getOrgId().equals(sysRole.getOrgid())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色列表
|
||||
* @param roleIds
|
||||
* @return
|
||||
*/
|
||||
public boolean validateRoleIds(List<String> roleIds) {
|
||||
for (int i = 0; i < roleIds.size(); i++) {
|
||||
if (!validateRole(roleIds.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验当前登录用户是否有相应行政区划的操作权限
|
||||
* @param areaId 区域ID
|
||||
* @return
|
||||
*/
|
||||
public boolean validateArea(String areaId, String userType) {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
if ("1".equals(sysUser.getUserType()) && "1".equals(userType)) {
|
||||
return true;
|
||||
}
|
||||
Aa26 aa26 = aa26Repository.findById(areaId).orElseThrow(() -> new AppException("行政区划不存在!"));
|
||||
if ("1".equals(sysUser.getUserType())) {
|
||||
return true;
|
||||
} else if ("2".equals(sysUser.getUserType())) {
|
||||
List<Aa26> list = aa26Repository.findByAab301AndIdPath(sysUser.getAreaId() + "", aa26.getIdpath());
|
||||
if (list.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
} else if ("3".equals(sysUser.getUserType())) {
|
||||
if (aa26.getAab301().equals(sysUser.getAreaId() + "")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验当前登录用户是否有相应机构的操作权限
|
||||
* @param orgId 机构ID
|
||||
* @return
|
||||
*/
|
||||
public boolean validateOrg(Long orgId, String userType) {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
if ("1".equals(userType)) {
|
||||
return "1".equals(sysUser.getUserType());
|
||||
}
|
||||
SysOrg sysOrg = sysOrgRepository.findById(orgId).orElseThrow(() -> new AppException("机构不存在!"));
|
||||
if ("1".equals(sysUser.getUserType())) {
|
||||
return true;
|
||||
} else if ("2".equals(sysUser.getUserType())) {
|
||||
List<SysOrg> list = sysOrgRepository.findByRegioncodeAndIdPath(sysUser.getAreaId() + "", sysOrg.getIdpath());
|
||||
if (list.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
} else if ("3".equals(sysUser.getUserType())) {
|
||||
if (sysOrg.getOrgid().equals(orgId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验当前登录用户是否有相应用户的操作权限
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public boolean validateUser(String userId) {
|
||||
SysUser sysUser = sysUserRepository.findById(userId).orElseThrow(() -> new AppException("用户不存在!"));
|
||||
return validateOrg(sysUser.getOrgId(), sysUser.getUserType());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.insigma.sys.common;
|
||||
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
|
||||
/**
|
||||
* 获取当前用户信息服务类
|
||||
* @author jinw
|
||||
* @version 2019/1/9
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
|
||||
public interface CurrentUserService {
|
||||
|
||||
SysUser getCurrentUser();
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.insigma.sys.common;
|
||||
|
||||
import com.insigma.framework.util.SysUtils;
|
||||
import com.insigma.odin.framework.est.EstException;
|
||||
import com.insigma.odin.framework.est.auth.ClientAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetails;
|
||||
import org.springframework.security.web.authentication.logout.LogoutHandler;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2020/2/7
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
public class OdinClientAuth implements ClientAuth {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OdinClientAuth.class);
|
||||
|
||||
@Override
|
||||
public boolean syslogon(String loginName, HttpServletRequest request) throws EstException {
|
||||
UserDetailsService userDetailsService;
|
||||
ApplicationContext applicationContext = WebApplicationContextUtils.findWebApplicationContext(request.getServletContext());
|
||||
if (SysUtils.getAppContext() != null) {
|
||||
userDetailsService = SysUtils.getBean(UserDetailsService.class);
|
||||
} else {
|
||||
userDetailsService = applicationContext.getBean(UserDetailsService.class);
|
||||
}
|
||||
UserDetails userDetails = userDetailsService.loadUserByUsername(loginName);
|
||||
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities());
|
||||
token.setDetails(new WebAuthenticationDetails(request));
|
||||
SecurityContextHolder.getContext().setAuthentication(token);
|
||||
request.getSession().setAttribute("SPRING_SECURITY_CONTEXT", SecurityContextHolder.getContext());
|
||||
request.getSession().setAttribute(OdinClientAuthExtendFilter.IS_SAVE_LOGONLOG_SESSION_KEY, Boolean.TRUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean syslogout(String loginName, HttpServletRequest request, HttpServletResponse response) throws EstException {
|
||||
LogoutHandler logoutHandler;
|
||||
if (SysUtils.getAppContext() != null) {
|
||||
logoutHandler = SysUtils.getBean("myLogoutHandler", LogoutHandler.class);;
|
||||
} else {
|
||||
logoutHandler = WebApplicationContextUtils.findWebApplicationContext(request.getServletContext()).getBean("myLogoutHandler",LogoutHandler.class);
|
||||
}
|
||||
SecurityContext securityContext = (SecurityContext) request.getSession().getAttribute("SPRING_SECURITY_CONTEXT");
|
||||
if (securityContext != null) {
|
||||
logoutHandler.logout(request, response, securityContext.getAuthentication());
|
||||
request.getSession().removeAttribute("SPRING_SECURITY_CONTEXT");
|
||||
}
|
||||
request.getSession().invalidate();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.insigma.sys.common;
|
||||
|
||||
import com.insigma.framework.util.SysUtils;
|
||||
import com.insigma.framework.util.UserAgentUtil;
|
||||
import com.insigma.framework.web.securities.commons.SecurityUtils;
|
||||
import com.insigma.framework.web.securities.entity.SysLogonLog;
|
||||
import com.insigma.framework.web.securities.entity.SysUserDetails;
|
||||
import com.insigma.framework.web.securities.service.SysLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2020/2/13
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Component
|
||||
@WebFilter(filterName = "odinClientExtendFilter",urlPatterns = "/*")
|
||||
@Slf4j
|
||||
public class OdinClientAuthExtendFilter extends OncePerRequestFilter {
|
||||
|
||||
public static final String IS_SAVE_LOGONLOG_SESSION_KEY = "save_logonlog_flag";
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
Boolean isSaveLogonlog = null;
|
||||
try {
|
||||
isSaveLogonlog = (Boolean) session.getAttribute(IS_SAVE_LOGONLOG_SESSION_KEY);
|
||||
if (isSaveLogonlog != null && isSaveLogonlog.booleanValue()) {
|
||||
SysLogonLog logonLog = SysUtils.getBean(SysLogService.class).saveLogonLog(SecurityUtils.getIpAddr(httpServletRequest), session.getId(), UserAgentUtil.getBrowser(httpServletRequest), UserAgentUtil.getSystem(httpServletRequest));
|
||||
SysUserDetails userDetails = (SysUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
if (userDetails != null) {
|
||||
userDetails.getOthers().put("logid", logonLog.getLogonlogid());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("记录登录日志失败!", e);
|
||||
} finally {
|
||||
if (isSaveLogonlog != null) {
|
||||
session.removeAttribute(IS_SAVE_LOGONLOG_SESSION_KEY);
|
||||
}
|
||||
}
|
||||
filterChain.doFilter(httpServletRequest, httpServletResponse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.insigma.sys.common;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.util.SysUtils;
|
||||
import com.insigma.sys.service.SysHashService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.persistence.PostPersist;
|
||||
import javax.persistence.PostRemove;
|
||||
import javax.persistence.PostUpdate;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2021/8/16
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Slf4j
|
||||
public class SysEntityListener {
|
||||
|
||||
@PostPersist
|
||||
public void postPersist(Object entity) {
|
||||
saveEntityHashCode(entity, PostMode.SAVE);
|
||||
}
|
||||
|
||||
@PostUpdate
|
||||
public void postUpdate(Object entity) {
|
||||
saveEntityHashCode(entity, PostMode.UPDATE);
|
||||
}
|
||||
|
||||
@PostRemove
|
||||
public void postRemove(Object entity) {
|
||||
saveEntityHashCode(entity, PostMode.DELETE);
|
||||
}
|
||||
|
||||
public void saveEntityHashCode(Object entity, PostMode postMode) {
|
||||
log.debug("Class: {}, Spe: {}", entity.getClass().getCanonicalName(), JSONObject.toJSONString(entity));
|
||||
SysHashService sysHashService = SysUtils.getBean(SysHashService.class);
|
||||
sysHashService.saveHash(entity);
|
||||
}
|
||||
|
||||
private enum PostMode {
|
||||
SAVE,
|
||||
UPDATE,
|
||||
DELETE
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.insigma.sys.common;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2020/5/19
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Component
|
||||
public final class SysManageMode {
|
||||
|
||||
@Value("${sys.mode.triple:false}")
|
||||
private boolean tripleMode;
|
||||
|
||||
private static boolean TRIPLE_MODE = false;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
TRIPLE_MODE = tripleMode;
|
||||
}
|
||||
|
||||
public static boolean isTripleMode() {
|
||||
return TRIPLE_MODE;
|
||||
}
|
||||
|
||||
public static <T> T doActionInTripleMode(Supplier<T> tripleModeAction) {
|
||||
if (TRIPLE_MODE)
|
||||
return tripleModeAction.get();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void doActionInTripleMode(Runnable tripleModeRun) {
|
||||
if (TRIPLE_MODE)
|
||||
tripleModeRun.run();
|
||||
}
|
||||
|
||||
public static void doAction(Runnable tripleModeRun, Runnable notTripleModeRun) {
|
||||
if (TRIPLE_MODE) {
|
||||
tripleModeRun.run();
|
||||
} else {
|
||||
notTripleModeRun.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.insigma.sys.common.impl;
|
||||
|
||||
import com.insigma.framework.exception.UserNoLoginException;
|
||||
import com.insigma.framework.web.securities.entity.SysUserDetails;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.repository.SysUserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2019/1/15.
|
||||
*/
|
||||
@Service
|
||||
public class CurrentUserServiceImpl implements CurrentUserService {
|
||||
@Autowired
|
||||
private SysUserRepository sysUserRepository;
|
||||
|
||||
@Override
|
||||
public SysUser getCurrentUser() {
|
||||
SysUser sysUser = currentUserFromSecurityContext();
|
||||
if (sysUser == null) {
|
||||
throw new UserNoLoginException("获取不到当前登录用户信息!");
|
||||
}
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从SpringSecurity中获取当前用户信息 jinw
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private SysUser currentUserFromSecurityContext() {
|
||||
SysUser sysUser = null;
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null && authentication.getPrincipal() != null) {
|
||||
if (authentication.getPrincipal() instanceof SysUserDetails) {
|
||||
SysUserDetails userDetails = (SysUserDetails) authentication.getPrincipal();
|
||||
sysUser = (SysUser) userDetails.getOthers().get("sysUser");
|
||||
if (sysUser == null) {
|
||||
sysUser = sysUserRepository.findByLogonName(userDetails.getUsername()).get(0);
|
||||
userDetails.getOthers().put("sysUser", sysUser);
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
request.getSession().setAttribute("SPRING_SECURITY_CONTEXT", SecurityContextHolder.getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
return sysUser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.insigma.sys.common.impl;
|
||||
|
||||
import com.insigma.odin.framework.est.EstException;
|
||||
import com.insigma.odin.framework.est.auth.LogoutOrFailedExceptionHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/9/1
|
||||
*/
|
||||
@Slf4j
|
||||
public class MyLogoutOrFailedExceptionHandler extends LogoutOrFailedExceptionHandler {
|
||||
|
||||
@Override
|
||||
public void handle(EstException ex, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
log.debug("异常处理:", ex);
|
||||
response.sendError(401, "登录已失效,请重新登录!");
|
||||
} catch (IOException e) {
|
||||
log.error("返回异常码时失败!", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.insigma.sys.common.impl;
|
||||
|
||||
import com.insigma.framework.data.firewall.permission.validate.ValidateKeyValueStore;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.framework.web.securities.auth.SysLoginHandler;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.SysHashService;
|
||||
import com.insigma.sys.service.SysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MySysLoginHandler implements SysLoginHandler {
|
||||
|
||||
@Value("${sys.hash.enabled:false}")
|
||||
private boolean hashEnabled;
|
||||
|
||||
@Autowired
|
||||
private SysHashService sysHashService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private ValidateKeyValueStore validateKeyValueStore;
|
||||
|
||||
@Override
|
||||
public void success(String username, HttpServletRequest request) {
|
||||
request.getSession().setAttribute("auth_filter_ignored",Boolean.TRUE);
|
||||
log.info("{} 登录成功!", username);
|
||||
if (hashEnabled) {
|
||||
SysUser sysUser = sysUserService.findUserByLogonName(username);
|
||||
if (!sysHashService.checkHash(sysUser)) {
|
||||
throw new AppException("用户数据不合法!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 测试数据与安全
|
||||
SysUser sysUser = sysUserService.findUserByLogonName(username);
|
||||
validateKeyValueStore.set("orgid", String.valueOf(sysUser.getOrgId()));
|
||||
if ("admin".equals(sysUser.getLogonName())) {
|
||||
validateKeyValueStore.skip();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(String username, HttpServletRequest request) {
|
||||
log.info("{} 登录失败!", username);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.insigma.sys.common.impl;
|
||||
|
||||
import com.insigma.framework.web.securities.auth.ExtSysLogoutHandler;
|
||||
import com.insigma.odin.framework.est.service.SSOServiceFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/5/10
|
||||
* @since 2.6.5
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(prefix = "sso", name = "app-name", matchIfMissing = false)
|
||||
public class MySysLogoutHandler implements ExtSysLogoutHandler {
|
||||
|
||||
@Value("${sso.app-name:}")
|
||||
private String appName;
|
||||
|
||||
@Override
|
||||
public void logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
String est = (String) request.getSession().getAttribute("est");
|
||||
if (est != null) {
|
||||
log.info("存在est令牌,执行注销操作!est: {}, appName: {}", est, appName);
|
||||
SSOServiceFactory.logoutService().logout(est, appName, request);
|
||||
} else {
|
||||
log.info("无est令牌,不执行注销操作!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.insigma.sys.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2019/6/28.
|
||||
*/
|
||||
@Configuration
|
||||
public class JdbcConfig {
|
||||
|
||||
@Bean
|
||||
public NamedParameterJdbcTemplate namedParameterJdbcTemplate(JdbcTemplate jdbcTemplate) {
|
||||
return new NamedParameterJdbcTemplate(jdbcTemplate);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.insigma.sys.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2021/8/16
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Configuration
|
||||
@EnableJpaAuditing
|
||||
public class JpaConfig {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.insigma.sys.config;
|
||||
|
||||
import com.insigma.framework.web.securities.config.SysSecurityConfig;
|
||||
import com.insigma.framework.web.securities.config.SysSecurityNoopConfig;
|
||||
import com.insigma.odin.framework.est.auth.GenericAuthFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2020/2/7
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(SSOConfigProperties.class)
|
||||
@AutoConfigureAfter({SysSecurityConfig.class, SysSecurityNoopConfig.class})
|
||||
@ConditionalOnProperty(prefix = "sso", name = "app-name", matchIfMissing = false)
|
||||
public class SSOConfig {
|
||||
|
||||
@Autowired
|
||||
private SSOConfigProperties configProperties;
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean genericAuth() {
|
||||
FilterRegistrationBean<GenericAuthFilter> filterRegistrationBean = new FilterRegistrationBean<>();
|
||||
filterRegistrationBean.setFilter(new GenericAuthFilter());
|
||||
Map<String, String> initParameters = new HashMap<>();
|
||||
/*initParameters.put("app-name", "odin7c");
|
||||
initParameters.put("auth-service-root-url", "http://127.0.0.1:8080/");
|
||||
initParameters.put("client-auth-class", "com.insigma.sys.common.OdinClientAuth");
|
||||
initParameters.put("free-urls", "/login");*/
|
||||
initParameters.put("app-name", configProperties.getAppName());
|
||||
initParameters.put("auth-service-root-url", configProperties.getAuthServiceRootUrl());
|
||||
initParameters.put("auth-logon-page-root-url", configProperties.getAuthLogonPageRootUrl());
|
||||
initParameters.put("client-auth-class", configProperties.getClientAuthClass());
|
||||
initParameters.put("free-urls", configProperties.getFreeUrls());
|
||||
initParameters.put("auth-mode", configProperties.getAuthMode());
|
||||
if (!ObjectUtils.isEmpty(configProperties.getAuthServiceContextPath())) {
|
||||
initParameters.put("auth-service-context-path", configProperties.getAuthServiceContextPath());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(configProperties.getLogoutOrFailedExceptionHandler())) {
|
||||
initParameters.put("logout-or-failed-exception-handler", configProperties.getLogoutOrFailedExceptionHandler());
|
||||
}
|
||||
filterRegistrationBean.setInitParameters(initParameters);
|
||||
filterRegistrationBean.addUrlPatterns("/*");
|
||||
filterRegistrationBean.setOrder(-100);
|
||||
return filterRegistrationBean;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.insigma.sys.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2020/2/7
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "sso")
|
||||
@Data
|
||||
public class SSOConfigProperties {
|
||||
|
||||
private String appName;
|
||||
private String authServiceRootUrl;
|
||||
private String authLogonPageRootUrl;
|
||||
private String clientAuthClass = "com.insigma.sys.common.OdinClientAuth";
|
||||
private String freeUrls;
|
||||
private String authMode;
|
||||
private String authServiceContextPath;
|
||||
private String logoutOrFailedExceptionHandler;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.encryption.util.SM3Utils;
|
||||
import com.insigma.framework.util.IpUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2019/10/14.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired(required = false)
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@GetMapping("/getToken")
|
||||
public ResponseMessage getToken(HttpServletRequest request) {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
Date date = new Date();
|
||||
long timetamp = date.getTime();
|
||||
String token = SM3Utils.digest(IpUtil.getClientIp(request) + ";" + sysUser.getLogonName() + ";" + timetamp); // 生成token
|
||||
redisTemplate.opsForValue().set(token, sysUser);
|
||||
redisTemplate.expire(token, 300, TimeUnit.SECONDS);
|
||||
return ResponseMessage.ok("", token);
|
||||
}
|
||||
|
||||
@PostMapping("/getUserInfo")
|
||||
public ResponseMessage getUserInfo(@RequestBody JSONObject jsonObject) {
|
||||
String token = jsonObject.getString("token");
|
||||
SysUser sysUser = (SysUser) redisTemplate.opsForValue().get(token);
|
||||
if(sysUser == null) {
|
||||
return ResponseMessage.error("获取用户信息失败!");
|
||||
}
|
||||
return ResponseMessage.ok(sysUser);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.sys.entity.SysHoliday;
|
||||
import com.insigma.sys.service.HolidayService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/6/16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/holiday")
|
||||
public class HolidayController {
|
||||
|
||||
@Autowired
|
||||
private HolidayService holidayService;
|
||||
|
||||
@GetMapping("/query")
|
||||
public ResponseMessage getHolidayList(int year){
|
||||
List<SysHoliday> holidayList = holidayService.queryHolidayList(year);
|
||||
if (holidayList == null || holidayList.isEmpty()) {
|
||||
holidayList = holidayService.getWeekdays(year);
|
||||
holidayService.updateHolidays(year, holidayList);
|
||||
}
|
||||
List<String> dates = holidayToDate(holidayList);
|
||||
return ResponseMessage.ok(dates);
|
||||
}
|
||||
|
||||
@PostMapping("/{year}/update")
|
||||
public ResponseMessage updateHolidays(@PathVariable int year, @RequestBody JSONObject jsonObject){
|
||||
List<String> holidays = jsonObject.getJSONArray("holidays").toJavaList(String.class);
|
||||
holidayService.updateHolidays(year, dateToHoliday(holidays));
|
||||
return ResponseMessage.ok("保存成功!");
|
||||
}
|
||||
|
||||
private List<String> holidayToDate(List<SysHoliday> holidays) {
|
||||
return holidays.stream().map(s -> s.getYear() + "-" + (s.getMonth() < 10 ? "0" : "") + s.getMonth() + "-" + (s.getDay() < 10 ? "0" : "") + s.getDay()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<SysHoliday> dateToHoliday(List<String> dates) {
|
||||
return dates.stream().map(s -> {
|
||||
String[] date = s.split("-");
|
||||
SysHoliday sysHoliday = new SysHoliday();
|
||||
sysHoliday.setYear(Integer.parseInt(date[0]));
|
||||
sysHoliday.setMonth(Integer.parseInt(date[1]));
|
||||
sysHoliday.setDay(Integer.parseInt(date[2]));
|
||||
return sysHoliday;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.encryption.util.SM3Utils;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.framework.web.securities.commons.SM3PasswordEncoder;
|
||||
import com.insigma.framework.web.securities.entity.SysLogonLog;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.SysUserService;
|
||||
import com.insigma.sys.service.SyslogonLogService;
|
||||
import com.insigma.web.support.config.SysConfigProperties;
|
||||
import com.insigma.web.support.repository.Aa01Repository;
|
||||
import com.insigma.web.support.entity.Aa01;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 首页面公共Controller,密码修改等在首页面的请求处理可统一放到这里来
|
||||
* @author jinw
|
||||
* @version 2019/4/2
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class HomeController {
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private SysConfigProperties sysConfigProperties;
|
||||
|
||||
@Autowired
|
||||
private Aa01Repository aa01Repository;
|
||||
|
||||
@Autowired
|
||||
private SyslogonLogService syslogonLogService;
|
||||
|
||||
@PostMapping("/sys/modifypd")
|
||||
public ResponseMessage modifyPasswd(@RequestBody JSONObject data) {
|
||||
SysUser currentUser = currentUserService.getCurrentUser();
|
||||
try {
|
||||
String oldPass=data.getString("opasswd");
|
||||
String newPass=data.getString("npasswd");
|
||||
String confirmPass = data.getString("rpasswd");
|
||||
if (ObjectUtils.isEmpty(newPass) || !newPass.equals(confirmPass)){
|
||||
throw new AppException("新密码为空或两次输入不等!");
|
||||
}
|
||||
String sm3LogonName = SM3Utils.digest(currentUser.getLogonName());
|
||||
String sm3ReverseLogonName = SM3Utils.digest(new StringBuffer(currentUser.getLogonName()).reverse().toString());
|
||||
if (sm3LogonName.equals(newPass) || sm3ReverseLogonName.equals(newPass)) {
|
||||
throw new AppException("新密码不能与登录名(包含逆序)相同!");
|
||||
}
|
||||
sysUserService.updataPassWD(oldPass,newPass);
|
||||
return ResponseMessage.ok("修改密码成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return ResponseMessage.error("修改密码失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/sys/checkDefaultPasswd")
|
||||
public ResponseMessage checkDefaultPasswd() {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
sysUser = sysUserService.findUserByLogonName(sysUser.getLogonName());
|
||||
Date date = sysUser.getPwEditDate();
|
||||
if(date==null){
|
||||
return ResponseMessage.ok(true);
|
||||
}
|
||||
String passwd = sysUser.getPassWD();
|
||||
String defaultPasswd = sysConfigProperties.getDefaultPassword();
|
||||
if(ObjectUtils.isEmpty(defaultPasswd)) {
|
||||
return ResponseMessage.ok(false);
|
||||
}
|
||||
return ResponseMessage.ok(new SM3PasswordEncoder().matches(SM3Utils.digest(defaultPasswd), passwd));
|
||||
}
|
||||
|
||||
@PostMapping("/sys/checkPasswordDisabled")
|
||||
public ResponseMessage checkPasswordDisabled() {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
sysUser = sysUserService.findUserByLogonName(sysUser.getLogonName());
|
||||
if ("1".equals(sysUser.getPwExpireType())) {
|
||||
// 密码周期过期
|
||||
Aa01 aa01 = aa01Repository.findByAaa001("PASSWORD_EXPIRED_PERIOD");
|
||||
if (aa01 != null) {
|
||||
Long period = Long.valueOf(aa01.getAaa005());
|
||||
if (sysUser.getPwEditDate() != null) {
|
||||
// 密码修改过,以修改之后的周期计算
|
||||
if (sysUser.getPwEditDate().getTime() + period * 24 * 60 * 60 * 1000 <= System.currentTimeMillis()) {
|
||||
return ResponseMessage.ok(true);
|
||||
}
|
||||
} else {
|
||||
// 密码没有修改过,以新建用户之后的周期计算
|
||||
if (sysUser.getCreateTime().getTime() + period * 24 * 60 * 60 * 1000 <= System.currentTimeMillis()) {
|
||||
return ResponseMessage.ok(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("3".equals(sysUser.getPwExpireType())) {
|
||||
// 指定日期过期
|
||||
if (sysUser.getPwExpireDate() != null && sysUser.getPwExpireDate().getTime() <= System.currentTimeMillis()) {
|
||||
return ResponseMessage.ok(true);
|
||||
}
|
||||
}
|
||||
return ResponseMessage.ok(false);
|
||||
}
|
||||
|
||||
@GetMapping("/sys/getLastLoginTime")
|
||||
public ResponseMessage getLastLoginTime() {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<SysLogonLog> list = syslogonLogService.getLastLoginTime(sysUser.getUserId());
|
||||
String lastLoginTime = "首次登录";
|
||||
if(list != null&& list.size() > 1){
|
||||
lastLoginTime = sdf.format(list.get(1).getLogontime());
|
||||
}
|
||||
return ResponseMessage.ok("", lastLoginTime);
|
||||
}
|
||||
|
||||
@GetMapping("/sys/getUserInfo")
|
||||
public ResponseMessage getUserInfo(){
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
// SysUser sysUser = sysUserService.queryOneUser(currentUserService.getCurrentUser().getUserId());
|
||||
return ResponseMessage.ok(sysUser);
|
||||
}
|
||||
|
||||
@PostMapping("/sys/updateUserInfo")
|
||||
public ResponseMessage updateUserInfo(@RequestBody SysUser sysUser){
|
||||
sysUserService.updateUser(sysUser);
|
||||
return ResponseMessage.ok("修改成功");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.ImportConfigReDTO;
|
||||
import com.insigma.sys.dto.MenuDTO;
|
||||
import com.insigma.sys.service.MenuService;
|
||||
import com.insigma.web.support.dto.ImportConfigDTO;
|
||||
import com.insigma.web.support.dto.ImportConfigDetailDTO;
|
||||
import com.insigma.web.support.fileaccess.excel.ExcelFactory;
|
||||
import com.insigma.web.support.service.ImportConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2023/7/18
|
||||
* @since 2.7.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/import/config")
|
||||
public class ImportConfigController {
|
||||
|
||||
@Autowired
|
||||
private ImportConfigService importConfigService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@GetMapping("/queryMenuList")
|
||||
public ResponseMessage queryMenuList() {
|
||||
List<MenuDTO> menuDTOS = menuService.getMenuList(currentUserService.getCurrentUser());
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(menuDTOS)), "functionid", "parentid", "children", "0");
|
||||
return ResponseMessage.ok("查询成功", jsonArray);
|
||||
}
|
||||
|
||||
@GetMapping("/query")
|
||||
public ResponseMessage query(String configCode, String configName) {
|
||||
List<ImportConfigDTO> list = importConfigService.queryConfigList(configCode, configName);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("/queryConfig")
|
||||
public ResponseMessage queryConfig(String configId) {
|
||||
ImportConfigDTO config = importConfigService.queryConfig(configId);
|
||||
List<ImportConfigDetailDTO> details = importConfigService.queryConfigDetails(configId);
|
||||
ImportConfigReDTO reDTO = new ImportConfigReDTO();
|
||||
reDTO.setConfig(config);
|
||||
reDTO.setDetails(details);
|
||||
return ResponseMessage.ok(reDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/importExcelTemplate")
|
||||
public ResponseMessage importExcelTemplate(MultipartFile file, String sheetNameOrIndex, Integer headerRowIndex) {
|
||||
try {
|
||||
List<ImportConfigDetailDTO> list = new ArrayList<>();
|
||||
ExcelFactory.readSax(file.getInputStream(), sheetNameOrIndex, (sheetIndexOrName, rowIndex, rowList) -> {
|
||||
if (rowIndex == headerRowIndex) {
|
||||
for (Object field : rowList) {
|
||||
ImportConfigDetailDTO detailDTO = new ImportConfigDetailDTO();
|
||||
detailDTO.setOriginFieldName(String.valueOf(field));
|
||||
detailDTO.setFieldType("0");
|
||||
list.add(detailDTO);
|
||||
}
|
||||
}
|
||||
});
|
||||
return ResponseMessage.ok(list);
|
||||
} catch (Exception e) {
|
||||
throw new AppException("读取模板失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public ResponseMessage save(@RequestBody ImportConfigReDTO reqDTO) {
|
||||
importConfigService.saveConfig(reqDTO.getConfig(), reqDTO.getDetails());
|
||||
return ResponseMessage.ok("保存成功");
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{configId}")
|
||||
public ResponseMessage delete(@PathVariable String configId) {
|
||||
importConfigService.deleteConfig(configId);
|
||||
return ResponseMessage.ok("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.MenuDTO;
|
||||
import com.insigma.sys.dto.SysAppDTO;
|
||||
import com.insigma.sys.entity.SysMenu;
|
||||
import com.insigma.sys.service.MenuService;
|
||||
import com.insigma.sys.service.SysAppService;
|
||||
import com.insigma.sys.service.SysCodeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/menu")
|
||||
public class MenuController {
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private SysCodeService sysCodeService;
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
@Autowired
|
||||
private SysAppService sysAppService;
|
||||
/**
|
||||
* 初始化页面数据
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/initCodeTypes")
|
||||
public ResponseMessage initCodeTypes(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
JSONObject codeTypes = sysCodeService.getCodeTypes(jsonObject);
|
||||
List<SysAppDTO> list = sysAppService.querySysAppDTO();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (SysAppDTO sysAppDTO : list) {
|
||||
JSONObject j = new JSONObject();
|
||||
j.put("value",sysAppDTO.getAppName());
|
||||
j.put("key",sysAppDTO.getAppId());
|
||||
jsonArray.add(j);
|
||||
}
|
||||
codeTypes.put("APPID",jsonArray);
|
||||
return ResponseMessage.ok(codeTypes);
|
||||
} catch (Exception e) {
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@GetMapping("/queryTree")
|
||||
public ResponseMessage queryTable(){
|
||||
List<MenuDTO> menuDTOS = menuService.queryAllMenu();
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(menuDTOS)), "functionid", "parentid", "children");
|
||||
return ResponseMessage.ok("查询成功", jsonArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拖拽成功完成时触发
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/nodeDrop")
|
||||
public ResponseMessage nodeDrop(@RequestBody JSONObject jsonObject){
|
||||
System.out.println(jsonObject);
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject oneMenu = jsonArray.getJSONObject(i);
|
||||
SysMenu sysMenu = new SysMenu();
|
||||
sysMenu.setFunctionid(oneMenu.getLong("functionid"));
|
||||
sysMenu.setFunorder(oneMenu.getInteger("funorder"));
|
||||
sysMenu.setParentid(oneMenu.getLong("parentid"));
|
||||
sysMenu.setTitle(oneMenu.getString("title"));
|
||||
menuService.update(sysMenu);
|
||||
System.out.println(sysMenu);
|
||||
}
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
/**
|
||||
* 点击左侧菜单后
|
||||
*/
|
||||
@PostMapping("/nodeClick")
|
||||
public ResponseMessage nodeClick(@RequestBody() JSONObject jsonObject) {
|
||||
SysMenu sysMenu;
|
||||
String a=jsonObject.get("functionid").toString();
|
||||
if (a!=null){
|
||||
long functionid =(long)Integer.parseInt(a);
|
||||
sysMenu =menuService.findMenuById(functionid);
|
||||
List<SysMenu> menulist=menuService.findTreesByPId(sysMenu.getFunctionid());
|
||||
if (menulist.size()>0){
|
||||
//有子类
|
||||
return ResponseMessage.ok(sysMenu);
|
||||
}else {
|
||||
//没有子类
|
||||
return ResponseMessage.ok("重复",sysMenu);
|
||||
}
|
||||
}else {
|
||||
return ResponseMessage.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查找对象
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/queryById")
|
||||
public ResponseMessage queryById(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String id=jsonObject.get("functionid").toString();
|
||||
String funtype=jsonObject.get("funtype").toString();
|
||||
List<MenuDTO> menuDTOS=menuService.queryMenuByFuntypeAndActive(funtype);
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(menuDTOS)), "functionid", "parentid", "children");
|
||||
jsonObject.put("treedata",jsonArray);
|
||||
long fId=Integer.parseInt(id);
|
||||
SysMenu menu=menuService.findMenuById(fId);
|
||||
List list=new ArrayList();
|
||||
if(menu!=null){
|
||||
String [] ms=menu.getIdpath().split("/");
|
||||
if (ms.length>0){
|
||||
for (String s:ms){
|
||||
if(s.equals("0")){
|
||||
continue;
|
||||
}
|
||||
list.add(Long.valueOf(s));
|
||||
}
|
||||
}}
|
||||
jsonObject.put("pname",list);
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
}catch (Exception e){
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询是否多于三层
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/querySumIsThree")
|
||||
public ResponseMessage querySumIsThree(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String id=jsonObject.get("functionid").toString();
|
||||
Map<String,List> list= (Map<String, List>) jsonObject.get("pname");
|
||||
long fId=Integer.parseInt(id);
|
||||
SysMenu sysMenu=menuService.findMenuById(fId);
|
||||
List<SysMenu> menu=menuService.findNodes(sysMenu.getIdpath());//查询当前子节点
|
||||
for(int i=0;i<list.get("value").size();i++){
|
||||
for (SysMenu menu1:menu){
|
||||
if(String.valueOf(menu1.getFunctionid()).equals(list.get("value").get(i).toString())){
|
||||
return ResponseMessage.error("上级菜单无法选择本身及下级菜单");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResponseMessage.ok();
|
||||
}catch (Exception e){
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@PostMapping("/saveMenu")
|
||||
public ResponseMessage saveMenu(@RequestBody JSONObject pageData){
|
||||
Map<String,Object> map= (Map<String, Object>) pageData.get("form");
|
||||
SysMenu sysMenu = menuService.getSysMenuBean(map);
|
||||
boolean flag = menuService.isManyLocations(sysMenu);
|
||||
if (flag) {
|
||||
return ResponseMessage.error("路径重复");
|
||||
}
|
||||
try {
|
||||
menuService.save(sysMenu);
|
||||
return ResponseMessage.ok("保存成功", sysMenu);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("保存失败,失败原因:" +e.getMessage());
|
||||
}
|
||||
}
|
||||
@PostMapping("/deleteMenu")
|
||||
public ResponseMessage deleteMenu(@RequestBody JSONObject pageData){
|
||||
if (!"1".equals(currentUserService.getCurrentUser().getUserType())) {
|
||||
return ResponseMessage.error("无权操作!");
|
||||
}
|
||||
Long node=Long.valueOf(pageData.get("node").toString());
|
||||
boolean withRole= (boolean) pageData.get("withRole");
|
||||
List<SysMenu> m=menuService.findNodes(menuService.findMenuById(node).getIdpath());
|
||||
//当withRole为false时,和角色没有关系,如果是1就和角色有关系
|
||||
try {
|
||||
if (m!=null){
|
||||
menuService.delete(m,withRole);
|
||||
return ResponseMessage.ok("删除成功");
|
||||
}else{
|
||||
return ResponseMessage.error("删除失败");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("删除失败,失败原因:" +e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查找是否有角色关系
|
||||
*/
|
||||
@PostMapping("/queryRoleBy")
|
||||
public ResponseMessage queryRoleBy(@RequestBody JSONObject pageData){
|
||||
Map<String,Object> map= (Map<String, Object>) pageData.get("form");
|
||||
SysMenu sysMenu=menuService.getSysMenuBean(map);
|
||||
boolean f=menuService.findFunctionRoles(sysMenu);
|
||||
if (f==true){
|
||||
return ResponseMessage.error("有权限");
|
||||
}else if (f==false){
|
||||
return ResponseMessage.ok("没有权限");
|
||||
}else {
|
||||
return ResponseMessage.error();
|
||||
}
|
||||
}
|
||||
//判断是否三级
|
||||
@PostMapping("queryMenuByPid")
|
||||
public ResponseMessage queryMenuByPid(@RequestBody JSONObject pageData) {
|
||||
ResponseMessage rm=new ResponseMessage();
|
||||
String a=pageData.get("parentid").toString();
|
||||
if (a!=null){
|
||||
int parentid =Integer.parseInt(a);
|
||||
SysMenu menu=menuService.queryByFuncID(parentid);
|
||||
if (menu!=null){
|
||||
SysMenu menu1=menuService.queryByFuncID(menu.getParentid());
|
||||
if (menu1!=null){
|
||||
rm= ResponseMessage.error("最多添加三级");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
rm= ResponseMessage.error("没取到父节点");
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.MonitorCentersDTO;
|
||||
import com.insigma.sys.entity.SysMenu;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.MonitorCentersService;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @ClassName: MonitorCentersController
|
||||
* @Description: 监控中心
|
||||
* @version 2021/12/7 14:53
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/monitoringcenter/MonitoringDetails")
|
||||
public class MonitorCentersController extends BaseController {
|
||||
@Autowired
|
||||
MonitorCentersService monitorCentersService;
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
/**
|
||||
* 查询应用数据源信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/querServiceDataSouce")
|
||||
public JSONObject querServiceDataSouce(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.querServiceDataSouce(monitorCentersDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用SQL监控列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/querServiceDataSqlList")
|
||||
public JSONObject querServiceDataSqlList(@RequestBody MonitorCentersDTO MonitorCentersDTO) {
|
||||
return monitorCentersService.querServiceDataSqlList(MonitorCentersDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询WBEAPP监控信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/querServiceWebApp")
|
||||
public JSONObject querServiceWebApp(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.querServiceWebApp(monitorCentersDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用URI监控列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/querServiceDataUriList")
|
||||
public JSONObject querServiceDataUriList(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.querServiceDataUriList(monitorCentersDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用Session监控列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/querServiceDataSessionList")
|
||||
public JSONObject querServiceDataSessionList(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.querServiceDataSessionList(monitorCentersDTO);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询每个应用下对应的实例IP
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/querServiceIp")
|
||||
public JSONObject querServiceIp(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.querServiceIp(monitorCentersDTO);
|
||||
}
|
||||
|
||||
//获取菜单名称和id实体
|
||||
@PostMapping("/queryEntity")
|
||||
public ResponseMessage queryEntity(@RequestBody JSONObject jsonObject) {
|
||||
String url = jsonObject.getString("url");
|
||||
SysMenu sysMenu = monitorCentersService.queryEntity(url);
|
||||
return ResponseMessage.ok(sysMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理全部监控数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/clearAllMonitorData")
|
||||
public JSONObject clearAllMonitorData() {
|
||||
return monitorCentersService.clearAllMonitorData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理对应的监控数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/clearOneServiceData")
|
||||
public JSONObject clearOneServiceData(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.clearOneServiceData(monitorCentersDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//查询用户是否为超级管理员
|
||||
@GetMapping("/queryUser")
|
||||
public ResponseMessage queryUser() {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
//超级管理员
|
||||
if ("1".equals(sysUser.getUserType())) {
|
||||
return ResponseMessage.ok(true);
|
||||
} else {
|
||||
return ResponseMessage.ok(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.sys.dto.MonitorCentersDTO;
|
||||
import com.insigma.sys.service.MonitorCentersService;
|
||||
import com.insigma.sys.util.WordUtil;
|
||||
import com.insigma.web.support.fileaccess.excel.ExcelFactory;
|
||||
import com.insigma.web.support.fileaccess.excel.ExcelWriter;
|
||||
import com.insigma.web.support.fileaccess.excel.config.ExcelColConfig;
|
||||
import com.insigma.web.support.fileaccess.excel.config.ExcelConfig;
|
||||
import com.insigma.web.support.fileaccess.excel.enums.ExcelTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @version 2022/3/8 16:46
|
||||
* @ClassName: MonitorDataController
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/monitoringcenter/index")
|
||||
public class MonitorDataController {
|
||||
|
||||
@Autowired
|
||||
MonitorCentersService monitorCentersService;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Value("${spring.application.name}")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 获取报告数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getReportData")
|
||||
public JSONObject getReportData(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.getReportData(monitorCentersDTO);
|
||||
}
|
||||
|
||||
|
||||
//导出监控大屏数据
|
||||
@GetMapping("/dataExport")
|
||||
public void dataExport(@RequestParam("excelName") String excelName, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(excelName, "utf-8"));
|
||||
|
||||
ExcelTypeEnum excelType = excelName.endsWith(".xls") ? ExcelTypeEnum.XLS : ExcelTypeEnum.XLSX;
|
||||
ExcelWriter writer = ExcelFactory.getWriter(response.getOutputStream(), new ExcelConfig(excelType, true,
|
||||
ExcelColConfig.of("CREATE_TIME", "创建时间"),
|
||||
ExcelColConfig.of("START_TIME", "统计开始时间"),
|
||||
ExcelColConfig.of("END_TIME", "统计结束时间"),
|
||||
ExcelColConfig.of("SQL_EXECUTE_COUNT", "SQL执行总数"),
|
||||
ExcelColConfig.of("SQL_TOTAL_TIME", "SQL耗时总数"),
|
||||
ExcelColConfig.of("SQL_AVG_TIME", "SQL执行平均耗时"),
|
||||
ExcelColConfig.of("SQL_SLOWEST_TIME", "SQL执行最慢耗时"),
|
||||
ExcelColConfig.of("SQL_AVG_READ_ROWS", "SQL单次平均读取行数"),
|
||||
ExcelColConfig.of("URL_EXECUTE_COUNT", "URL执行总数"),
|
||||
ExcelColConfig.of("URL_TOTAL_TIME", "URL耗时总数"),
|
||||
ExcelColConfig.of("URL_AVG_TIME", "URL执行平均耗时"),
|
||||
ExcelColConfig.of("URL_SLOWEST_TIME", "URL执行最慢耗时"),
|
||||
ExcelColConfig.of("URL_AVG_JDBC_COUNT", "URL单次平均JDBC执行数"),
|
||||
ExcelColConfig.of("SLOW_SQL_ONE", "慢SQL最慢第一段个数"),
|
||||
ExcelColConfig.of("SLOW_SQL_TWO", "慢SQL最慢第二段个数"),
|
||||
ExcelColConfig.of("SLOW_SQL_THREE", "慢SQL最慢第三段个数"),
|
||||
ExcelColConfig.of("SLOW_SQL_AVG_ONE", "慢SQL平均第一段个数"),
|
||||
ExcelColConfig.of("SLOW_SQL_AVG_TWO", "慢SQL平均第二段个数"),
|
||||
ExcelColConfig.of("SLOW_SQL_AVG_THREE", "慢SQL平均第三段个数"),
|
||||
ExcelColConfig.of("SQL_ERROR_COUNT", "SQL执行错误数"),
|
||||
ExcelColConfig.of("URL_JDBC_ERROR_COUNT", "URLJDBC执行错误数"),
|
||||
ExcelColConfig.of("SCORE", "得分"),
|
||||
ExcelColConfig.of("SCORE_SLOW_SQL", "慢SQL影响分"),
|
||||
ExcelColConfig.of("SCORE_ERROR_SQL", "错误SQL影响分"),
|
||||
ExcelColConfig.of("SCORE_SLOW_URL", "慢URL影响分"),
|
||||
ExcelColConfig.of("SCORE_JDBC_ERROR_URL", "JDBC错误URL影响分"),
|
||||
ExcelColConfig.of("INSTANCE_COUNT", "集群实例数"),
|
||||
ExcelColConfig.of("DS_MAX_ACTIVE", "数据库最大连接数")
|
||||
));
|
||||
final int[] index = {0};
|
||||
List<Map> mapList = monitorCentersService.getDataExport(appName);
|
||||
for (Map map : mapList) {
|
||||
writer.writeRow(map, ++index[0]);
|
||||
}
|
||||
writer.finish();
|
||||
}
|
||||
|
||||
|
||||
//获取word文档数据
|
||||
@PostMapping("/getWrodData")
|
||||
public Map<String, Object> getWrodData(@RequestBody MonitorCentersDTO monitorCentersDTO) {
|
||||
return monitorCentersService.getReportDetailedData(monitorCentersDTO);
|
||||
}
|
||||
|
||||
//导出word文档
|
||||
@GetMapping("/word")
|
||||
public void generateWord(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
MonitorCentersDTO dto = new MonitorCentersDTO();
|
||||
dto.setAppName(appName);
|
||||
// 要填入模本的数据文件
|
||||
Map<String, Object> dataMap = monitorCentersService.getReportDetailedData(dto);
|
||||
|
||||
//提示:在调用工具类生成Word文档之前应当检查所有字段是否完整
|
||||
//否则Freemarker的模板殷勤在处理时可能会因为找不到值而报错,这里暂时忽略这个步骤
|
||||
File file = null;
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
|
||||
try {
|
||||
//调用工具类WordGenerator的createDoc方法生成Word文档
|
||||
file = WordUtil.createDoc(dataMap, "monReportTemplet");
|
||||
in = new FileInputStream(file);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/msword");
|
||||
out = response.getOutputStream();
|
||||
//缓冲区
|
||||
byte[] bytes = new byte[2048];
|
||||
int len;
|
||||
// 通过循环将读入的Word文件的内容输出到浏览器中
|
||||
while ((len = in.read(bytes)) > 0) {
|
||||
out.write(bytes, 0, len);
|
||||
}
|
||||
out.flush();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
log.error("报告导出异常", ex);
|
||||
} finally {
|
||||
//释放资源
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
log.error("IO close error!", e);
|
||||
}
|
||||
}
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
log.error("IO close error!", e);
|
||||
}
|
||||
}
|
||||
if (file != null) {
|
||||
// 删除临时文件
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.oplog.dto.UserLogDTO;
|
||||
import com.insigma.framework.oplog.entity.SbdsUserLog;
|
||||
import com.insigma.framework.oplog.service.OpLogService;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.entity.SysMenu;
|
||||
import com.insigma.sys.service.MenuService;
|
||||
import com.insigma.web.support.service.PageInitService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2019/1/29.
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/oplog")
|
||||
public class OpLogController {
|
||||
|
||||
@Autowired
|
||||
private OpLogService opLogService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private PageInitService pageInitService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@PostMapping("/initSysFunctions")
|
||||
public ResponseMessage initSysFuntions(@RequestBody JSONObject jsonObject) {
|
||||
jsonObject = pageInitService.loadCustomCodeType(jsonObject, "sysfunction", "functionid", "title", "nodetype='2'", "SYSFUNCTIONS");
|
||||
return ResponseMessage.ok(jsonObject.getJSONObject("codeTypes"));
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@RequestBody JSONObject jsonObject) throws SQLException {
|
||||
Integer page = jsonObject.getInteger("page");
|
||||
Integer size = jsonObject.getInteger("size");
|
||||
UserLogDTO queryParam = jsonObject.toJavaObject(UserLogDTO.class);
|
||||
Boolean more = jsonObject.getBoolean("more");
|
||||
if (more != null && !more) {
|
||||
if (queryParam.getAae036() != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String aae036 = sdf.format(queryParam.getAae036());
|
||||
queryParam.setStartTime(aae036 + " 00:00:00");
|
||||
queryParam.setEndTime(aae036 + " 23:59:59");
|
||||
}
|
||||
}
|
||||
PageInfo<UserLogDTO> pageInfo = opLogService.queryUserLogList(queryParam, page, size);
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
@GetMapping("/location")
|
||||
public ResponseMessage getLocation(Long opseno) {
|
||||
SbdsUserLog log = opLogService.getOpLog(opseno);
|
||||
if (log != null) {
|
||||
Long functionId = log.getFunctionid();
|
||||
SysMenu sysMenu = menuService.findMenuById(functionId);
|
||||
return ResponseMessage.ok("", sysMenu.getLocation());
|
||||
}
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/orisource")
|
||||
public ResponseMessage getOriSource(Long opseno) {
|
||||
String oriSource = opLogService.getOriSource(opseno);
|
||||
return ResponseMessage.ok("", oriSource);
|
||||
}
|
||||
|
||||
@GetMapping("/oridata")
|
||||
public ResponseMessage getOriData(Long opseno) {
|
||||
String oriData = opLogService.getOriData(opseno);
|
||||
return ResponseMessage.ok("", oriData);
|
||||
}
|
||||
|
||||
@GetMapping("/rollback")
|
||||
public ResponseMessage rollback(Long opseno) {
|
||||
try {
|
||||
String logonName = currentUserService.getCurrentUser().getLogonName();
|
||||
opLogService.rollBack(opseno, logonName);
|
||||
} catch (Exception e) {
|
||||
log.error("回退失败!", e);
|
||||
return ResponseMessage.error("回退失败:" + e.getMessage());
|
||||
}
|
||||
return ResponseMessage.ok("回退成功!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.entity.Aa26;
|
||||
import com.insigma.sys.entity.SysOrg;
|
||||
import com.insigma.sys.service.SysCodeService;
|
||||
import com.insigma.sys.service.SysOrgService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/org")
|
||||
public class OrgController {
|
||||
@Autowired
|
||||
private SysOrgService sysOrgService;
|
||||
@Autowired
|
||||
private SysCodeService sysCodeService;
|
||||
/**
|
||||
* 初始化页面数据
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(@RequestBody JSONObject jsonObject) {
|
||||
List<SysOrg> orgs=sysOrgService.queryAllOrg();
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(orgs)), "orgid", "parentid", "children");
|
||||
return ResponseMessage.ok("查询成功", jsonArray);
|
||||
}
|
||||
/**
|
||||
* 根据id查找org对象
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findOrgById")
|
||||
public ResponseMessage findOrgById(@RequestBody JSONObject jsonObject) {
|
||||
ResponseMessage rm;
|
||||
String a=jsonObject.get("orgid").toString();
|
||||
SysOrg sysOrg;
|
||||
if (a!=null){
|
||||
int orgid= Integer.parseInt(a) ;
|
||||
sysOrg=sysOrgService.findByOrgid((long) orgid);
|
||||
rm= ResponseMessage.ok(sysOrg);
|
||||
}else {
|
||||
rm= ResponseMessage.error();
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
/**
|
||||
* 根据id查找险种
|
||||
* @return
|
||||
*/
|
||||
// @PostMapping("/findInsTypeById")
|
||||
// public ResponseMessage findInTypeById(@RequestBody JSONObject jsonObject) {
|
||||
// ResponseMessage rm;
|
||||
// String a=jsonObject.get("regioncode").toString();
|
||||
// List list=new ArrayList();
|
||||
// if (a!=null){
|
||||
// long regioncode=Long.valueOf(a);
|
||||
// List<SysOrgInsType> ins=sysOrgService.queryInsTypeById(regioncode);
|
||||
// for (SysOrgInsType s:ins){
|
||||
// list.add(s.getInstype());
|
||||
// }
|
||||
// rm=ResponseMessage.ok(list);
|
||||
// }else {
|
||||
// rm=ResponseMessage.error();
|
||||
// }
|
||||
// return rm;
|
||||
// }
|
||||
/**
|
||||
* 保存机构
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saveOrg")
|
||||
public ResponseMessage saveOrg(@RequestBody JSONObject jsonObject) {
|
||||
ResponseMessage rm=null;
|
||||
//List checkedCities= (List) jsonObject.get("checkedCities");
|
||||
Map<String,Object> map= (Map<String, Object>) jsonObject.get("form");
|
||||
SysOrg sysOrg=sysOrgService.getSysOrgBean(map);
|
||||
Boolean flag=sysOrgService.isMany(sysOrg);
|
||||
try {
|
||||
if (flag==false){
|
||||
//没有重复
|
||||
if (sysOrg!=null){
|
||||
sysOrgService.saveOrg(sysOrg);
|
||||
rm= ResponseMessage.ok("保存成功");
|
||||
}
|
||||
}else {
|
||||
//重复
|
||||
rm= ResponseMessage.error("重复");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
/**
|
||||
* 初始化页面aa26
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/initAA26")
|
||||
public ResponseMessage initAA26() {
|
||||
ResponseMessage rm;
|
||||
try {
|
||||
List<Aa26> aa26s = sysOrgService.getAA26();
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(aa26s)), "aab301", "aaa148", "children");
|
||||
rm= ResponseMessage.ok(orgNodes);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
/**
|
||||
根据id查找aa26
|
||||
*/
|
||||
@PostMapping("/queryAa26By301/{id}")
|
||||
public ResponseMessage queryAa26By301(@PathVariable("id") String aab301) {
|
||||
ResponseMessage rm;
|
||||
try {
|
||||
Aa26 aa26s = sysOrgService.queryAa26By301(aab301);
|
||||
rm= ResponseMessage.ok(aa26s);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
/**
|
||||
* 初始化页面数据
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/initCodeTypes")
|
||||
public ResponseMessage initCodeTypes(@RequestBody JSONObject jsonObject) {
|
||||
ResponseMessage rm;
|
||||
try {
|
||||
JSONObject codeTypes = sysCodeService.getCodeTypes(jsonObject);
|
||||
rm = ResponseMessage.ok(codeTypes);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/queryUserOrg")
|
||||
public ResponseMessage queryUserOrg(@RequestBody JSONObject jsonObject) {
|
||||
ResponseMessage rm;
|
||||
String regioncode="";
|
||||
long node=Long.valueOf(jsonObject.get("node").toString());
|
||||
Map<String,Object> form= (Map<String, Object>) jsonObject.get("form");
|
||||
// JSONArray orgTreeData=jsonObject.getJSONArray("orgTreeData"); // 首先转成 JSONArray 对象
|
||||
// String trees=orgTreeData.toJSONString();
|
||||
List<SysOrg> list=sysOrgService.findNodes(node);
|
||||
boolean s =sysOrgService.findByArea(list);
|
||||
if (s==true){
|
||||
rm= ResponseMessage.ok("有联系");
|
||||
}else {
|
||||
rm= ResponseMessage.error("没联系");
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
/**
|
||||
* 删除机构
|
||||
*/
|
||||
@PostMapping("/deleteOrg")
|
||||
public ResponseMessage deleteMenu(@RequestBody JSONObject pageData){
|
||||
ResponseMessage rm;
|
||||
long node=Long.valueOf(pageData.get("node").toString());
|
||||
boolean withUser= (boolean) pageData.get("withUser");
|
||||
List<SysOrg> list=sysOrgService.findNodes(node);
|
||||
try {
|
||||
if (list.size()>0){
|
||||
//withUser为true则和用户有关
|
||||
sysOrgService.delOrg(list,withUser);
|
||||
rm= ResponseMessage.ok("删除成功");
|
||||
}else {
|
||||
rm= ResponseMessage.error("数据不存在");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
|
||||
return rm;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.sys.service.ParamConfigService;
|
||||
import com.insigma.web.support.entity.Aa01;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/10/17
|
||||
* @since 2.7.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/param/config")
|
||||
public class ParamConfigController {
|
||||
|
||||
@Autowired
|
||||
private ParamConfigService paramConfigService;
|
||||
|
||||
@GetMapping("/query")
|
||||
public ResponseMessage query(String aaa001, String aaa002, Integer page, Integer size) {
|
||||
PageInfo<Aa01> pageInfo = paramConfigService.query(aaa001, aaa002, page, size);
|
||||
return ResponseMessage.ok(null, pageInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/insert")
|
||||
public ResponseMessage insert(@RequestBody Aa01 aa01) {
|
||||
paramConfigService.save(aa01, false);
|
||||
return ResponseMessage.ok("保存成功");
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public ResponseMessage update(@RequestBody Aa01 aa01) {
|
||||
paramConfigService.save(aa01, true);
|
||||
return ResponseMessage.ok("修改成功");
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(@RequestBody JSONObject jsonObject) throws AppException {
|
||||
String aaa001 = jsonObject.getString("aaa001");
|
||||
paramConfigService.delete(aaa001);
|
||||
return ResponseMessage.ok("删除成功");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.PageResponseMessage;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.commons.syslog.Syslog;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.common.SysManageMode;
|
||||
import com.insigma.sys.dto.MenuDTO;
|
||||
import com.insigma.sys.dto.SysRoleDTO;
|
||||
import com.insigma.sys.dto.UserDTO;
|
||||
import com.insigma.sys.entity.SysRole;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.MenuService;
|
||||
import com.insigma.sys.service.RoleService;
|
||||
import com.insigma.sys.service.SysCodeService;
|
||||
import com.insigma.web.support.service.CodeTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by zhangxy on 2019/1/4.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/role")
|
||||
public class RoleController {
|
||||
@Autowired
|
||||
private CodeTypeService codeService;
|
||||
@Autowired
|
||||
private SysCodeService sysCodeService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
/**
|
||||
* 初始化页面数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage initPageDate(@RequestBody JSONObject jsonObject) {
|
||||
JSONObject codeTypes = jsonObject.getJSONObject("codeTypes");
|
||||
JSONObject codeTypesRes = codeService.getCodeTypes(codeTypes);
|
||||
jsonObject.put("codeTypes", codeTypesRes);
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/initCodeTypes")
|
||||
public ResponseMessage initCodeTypes(@RequestBody JSONObject jsonObject) {
|
||||
ResponseMessage rm;
|
||||
try {
|
||||
JSONObject codeTypes = roleService.getCodeTypes(jsonObject);
|
||||
rm = ResponseMessage.ok(codeTypes);
|
||||
} catch (Exception e) {
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
return rm;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Syslog("${sysRole.rolename}")
|
||||
@PostMapping("/save")
|
||||
public ResponseMessage saveRole(@RequestBody SysRole sysRole) {
|
||||
PageResponseMessage rm = null;
|
||||
String roleid = sysRole.getRoleid();
|
||||
String rolename = sysRole.getRolename();
|
||||
boolean flag = false; //true代表有重复
|
||||
/*if(!"".equals(roleid) && roleid!=null){
|
||||
//flag=false;
|
||||
flag=roleService.checkRoleByRolename(rolename);
|
||||
if(flag){
|
||||
flag=false;
|
||||
}else{
|
||||
rm = ResponseMessage.error("该角色名称已被其他行政区或机构占用!");
|
||||
return rm;
|
||||
}
|
||||
}else{
|
||||
flag=roleService.checkRoleByRolename(rolename);
|
||||
}*/
|
||||
|
||||
flag = roleService.checkRoleByRolename(rolename);
|
||||
if (!"".equals(roleid) && roleid != null) {//说明是更新
|
||||
flag = roleService.checkRoleByRolenameAndRoleid(rolename, roleid);
|
||||
}
|
||||
if (flag) {
|
||||
try {
|
||||
/*List<SysUser> listUser= currentUserService.getCurrentUserByLoginname("admin");
|
||||
long areaid=listUser.get(0).getAreaId();
|
||||
long orgid=listUser.get(0).getOrgId();
|
||||
String userid=listUser.get(0).getUserId();*/
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
/* long areaid = listUser.get(0).getAreaId();
|
||||
long orgid = listUser.get(0).getOrgId();
|
||||
String userid = listUser.get(0).getUserId();
|
||||
String usertype = listUser.get(0).getUserType();*/
|
||||
Long areaid = sysUser.getAreaId();
|
||||
Long orgid = sysUser.getOrgId();
|
||||
String userid = sysUser.getUserId();
|
||||
String usertype = sysUser.getUserType();
|
||||
sysRole.setAreaid(areaid);
|
||||
sysRole.setOrgid(orgid);
|
||||
sysRole.setCreatorid(userid);
|
||||
roleService.save(sysRole);
|
||||
rm = PageResponseMessage.ok("保存成功");
|
||||
} catch (Exception e) {
|
||||
rm = PageResponseMessage.error(e.getMessage());
|
||||
}
|
||||
} else {
|
||||
rm = PageResponseMessage.error("该角色名称已被其他行政区或机构占用!");
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
|
||||
|
||||
/* @PostMapping("/queryRole")
|
||||
public ResponseMessage queryRole(@RequestBody JSONObject pageData){
|
||||
ResponseMessage rm;
|
||||
try {
|
||||
List<SysRole> sysRoles=roleService.queryRole(pageData);
|
||||
rm=ResponseMessage.ok("",sysRoles);
|
||||
}catch (Exception e){
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
return rm;
|
||||
}*/
|
||||
|
||||
/*@PostMapping("/queryRole")
|
||||
public ResponseMessage queryRole(@RequestParam(name="rolename")String rolename,@RequestParam(name="roledesc")
|
||||
String roledesc,
|
||||
@RequestParam(name="roletype")String roletype,@RequestParam(name="page")Integer
|
||||
page,
|
||||
@RequestParam(name="size") Integer size){
|
||||
ResponseMessage rm;
|
||||
try {
|
||||
SysRoleDTO sysRoleDTO=roleService.query(rolename, roledesc, roletype, page, size);
|
||||
rm=ResponseMessage.ok("",sysRoleDTO);
|
||||
}catch (Exception e){
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
return rm;
|
||||
}*/
|
||||
|
||||
@GetMapping("/queryRole")
|
||||
public ResponseMessage queryRole(@RequestParam(name = "rolename") String rolename, @RequestParam(name = "roledesc"
|
||||
) String roledesc,
|
||||
@RequestParam(name = "roletype") String roletype,
|
||||
@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "size") Integer size) {
|
||||
ResponseMessage rm;
|
||||
//查询当前登录用户信息
|
||||
//List<SysUser> listUser = currentUserService.getCurrentUserByLoginname("admin");
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
/* long areaid = listUser.get(0).getAreaId();
|
||||
long orgid = listUser.get(0).getOrgId();
|
||||
String userid = listUser.get(0).getUserId();
|
||||
String usertype = listUser.get(0).getUserType();*/
|
||||
Long areaid = sysUser.getAreaId();
|
||||
Long orgid = sysUser.getOrgId();
|
||||
String userid = sysUser.getUserId();
|
||||
String usertype = sysUser.getUserType();
|
||||
|
||||
if (SysManageMode.isTripleMode()) {//三员制
|
||||
if ("5".equals(usertype)) {//安全管理员
|
||||
usertype = "1";//按照超级管理员处理,可以查询所有的角色
|
||||
}
|
||||
}
|
||||
SysRoleDTO sysRoleDTO = null;
|
||||
if (!"".equals(usertype) && usertype != null) {
|
||||
//查询当前用户拥有的角色
|
||||
//List<SysRole> listRole=roleService.queryRoleByUserId(userid);
|
||||
try {
|
||||
sysRoleDTO = roleService.query(rolename, roledesc, roletype, page, size, areaid, orgid, usertype);
|
||||
rm = ResponseMessage.ok("", sysRoleDTO);
|
||||
} catch (Exception e) {
|
||||
rm = ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
} else {//非管理员角色,不能看到任何角色
|
||||
rm = ResponseMessage.ok();
|
||||
}
|
||||
|
||||
return rm;
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(@RequestBody SysRole sysRole) {
|
||||
SysRole role = roleService.getRoleById(sysRole.getRoleid());
|
||||
if (role == null) {
|
||||
return ResponseMessage.error("角色不存在");
|
||||
}
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
if (!roleService.roleCanOperate(sysUser, role)) {
|
||||
return ResponseMessage.error("无权操作");
|
||||
}
|
||||
roleService.deleteRoleRef(sysRole);
|
||||
return ResponseMessage.ok("删除成功");
|
||||
}
|
||||
|
||||
@GetMapping("/queryTree")
|
||||
public ResponseMessage queryTable(String roletype) {
|
||||
String funtype = "";
|
||||
if (roletype != null && !"".equals(roletype)) {
|
||||
if ("1".equals(roletype)) {//管理员角色
|
||||
funtype = "1";
|
||||
} else if ("2".equals(roletype)) {
|
||||
funtype = "2";
|
||||
} else if ("3".equals(roletype)) {
|
||||
funtype = "3";
|
||||
} else if ("4".equals(roletype)) {
|
||||
funtype = "4";
|
||||
}
|
||||
}
|
||||
List<MenuDTO> menuDTOS = menuService.queryMenuByFuntypeAndActive(funtype);
|
||||
/*SysUser sysUser = currentUserService.getCurrentUser();
|
||||
List<MenuDTO> menuDTOS = new ArrayList<>();
|
||||
if ("1".equals(sysUser.getUserType())) {
|
||||
// 超级管理员,查询所有
|
||||
menuDTOS = menuService.queryMenuByFuntypeAndActive(funtype);
|
||||
} else if ("2".equals(sysUser.getUserType()) || "3".equals(sysUser.getUserType())) {
|
||||
// 行政区管理员和机构管理员查询自己拥有的角色
|
||||
menuDTOS = menuService.queryMenusByUserId(sysUser.getUserId());
|
||||
} else {
|
||||
// 其他无权限查询
|
||||
throw new AppException("无权查询!");
|
||||
}*/
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(menuDTOS)), "functionid"
|
||||
, "parentid", "children", "0");
|
||||
return ResponseMessage.ok("查询成功", jsonArray);
|
||||
}
|
||||
|
||||
@GetMapping("/getCheckedTree")
|
||||
public ResponseMessage getCheckedTree(String roleId) {
|
||||
List<Long> list = roleService.queryFuncitonidByRoleid(roleId);
|
||||
return ResponseMessage.ok("查询成功", list);
|
||||
}
|
||||
|
||||
@PostMapping("/addRoleRef")
|
||||
public ResponseMessage addRoleRef(@RequestBody JSONObject jsonObject) {
|
||||
String roleid = (String) jsonObject.get("roleId");
|
||||
SysRole role = roleService.getRoleById(roleid);
|
||||
if (role == null) {
|
||||
return ResponseMessage.error("角色不存在");
|
||||
}
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
if (!roleService.roleCanOperate(sysUser, role)) {
|
||||
return ResponseMessage.error("无权操作");
|
||||
}
|
||||
roleService.saveGrant(currentUserService.getCurrentUser(), role, jsonObject);
|
||||
return ResponseMessage.ok("授权成功");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getRoleTypeCode")
|
||||
public ResponseMessage getUserTypeCode() {
|
||||
List<Map<String, Object>> list = roleService.findRoleTypesCode();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("/queryToGrantUser")
|
||||
public ResponseMessage queryToGrantUser(
|
||||
@RequestParam(name = "roleId") String roleId,
|
||||
@RequestParam(name = "roleType") String roleType,
|
||||
@RequestParam(name = "logonname") String logonname,
|
||||
@RequestParam(name = "displayname") String displayname,
|
||||
@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "size") Integer size) throws SQLException {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
PageInfo<UserDTO> list = roleService.queryToGrantUser(roleId, roleType, logonname, displayname, page, size);
|
||||
return ResponseMessage.ok("查询成功", list);
|
||||
}
|
||||
|
||||
@GetMapping("/queryGrantedUser")
|
||||
public ResponseMessage queryGrantedUser(@RequestParam(name = "roleId") String roleId) throws SQLException {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
SysRole sysRole = roleService.getRoleById(roleId);
|
||||
if (!roleService.roleCanOperate(sysUser, sysRole)) {
|
||||
return ResponseMessage.error("无权访问");
|
||||
}
|
||||
List<UserDTO> list = roleService.queryGrantedUser(roleId);
|
||||
return ResponseMessage.ok("查询成功", list);
|
||||
}
|
||||
|
||||
@GetMapping("/removeGrantUserRole")
|
||||
public ResponseMessage removeGrantUserRole(@RequestParam(name = "roleId") String roleId,
|
||||
@RequestParam(name = "userId") String userId) throws SQLException {
|
||||
roleService.removeGrantUserRole(roleId, userId);
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/saveGrantUser")
|
||||
public ResponseMessage saveGrantUser(@RequestBody JSONObject jsonObject) throws SQLException {
|
||||
roleService.saveGrantUser(jsonObject);
|
||||
return ResponseMessage.ok("保存成功");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.web.securities.auth.SysLoginHandler;
|
||||
import com.insigma.framework.web.securities.dto.BaseUserInfo;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 获取当前登录人
|
||||
* Created by yinjh on 2020/2/21.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping({"/sso", "/check"})
|
||||
public class SSOController {
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private SysLoginHandler sysLoginHandler;
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseMessage login(HttpServletRequest request) {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
BaseUserInfo userInfo = new BaseUserInfo();
|
||||
userInfo.setUserid(sysUser.getUserId());
|
||||
userInfo.setUsername(sysUser.getLogonName());
|
||||
userInfo.setNickname(sysUser.getDisplayName());
|
||||
|
||||
sysLoginHandler.success(userInfo.getUsername(), request);
|
||||
|
||||
return ResponseMessage.ok(userInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.system.safety.log.dto.SafetyFilterLogDTO;
|
||||
import com.insigma.framework.system.safety.log.service.SafetyFilterLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/9/15
|
||||
* @since 2.7.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/safety/filter/log")
|
||||
public class SafetyFilterLogController {
|
||||
|
||||
@Autowired
|
||||
private SafetyFilterLogService safetyFilterLogService;
|
||||
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@RequestBody SafetyFilterLogDTO safetyFilterLogDTO) {
|
||||
PageInfo<SafetyFilterLogDTO> pageInfo = safetyFilterLogService.query(safetyFilterLogDTO);
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.ScmMyFavoritesDTO;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.ScmMyFavoritesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Author tanyj
|
||||
* @Version 2022/8/23 11:27
|
||||
* @since 2.7.0
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/scmMyFavorites")
|
||||
public class ScmMyFavoritesController {
|
||||
|
||||
@Autowired
|
||||
private ScmMyFavoritesService scmMyFavoritesService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
/**
|
||||
* 新增我的收藏
|
||||
*
|
||||
* @param jsonObject jsonObject
|
||||
*/
|
||||
@PostMapping("/addScmMyFavorites")
|
||||
public ResponseMessage addScmMyFavorites(@RequestBody JSONObject jsonObject) {
|
||||
ScmMyFavoritesDTO scmMyFavoritesDTO = new ScmMyFavoritesDTO();
|
||||
scmMyFavoritesDTO.setTitle(jsonObject.getString("title"));
|
||||
scmMyFavoritesDTO.setFunctionRoutePath(jsonObject.getString("path"));
|
||||
SysUser currentUser = currentUserService.getCurrentUser();
|
||||
return scmMyFavoritesService.addScmMyFavorites(currentUser.getUserId(), scmMyFavoritesDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id查询我的收藏
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getScmMyFavorites")
|
||||
public ResponseMessage getScmMyFavorites() {
|
||||
SysUser currentUser = currentUserService.getCurrentUser();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data", scmMyFavoritesService.getScmMyFavorites(currentUser.getUserId()));
|
||||
jsonObject.put("total", scmMyFavoritesService.getScmMyFavorites(currentUser.getUserId()).size());
|
||||
return ResponseMessage.ok("查询成功", jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id删除我的收藏
|
||||
*
|
||||
* @param jsonObject jsonObject
|
||||
*/
|
||||
@RequestMapping("/deleteScmMyFavorites")
|
||||
public ResponseMessage deleteScmMyFavorites(@RequestBody JSONObject jsonObject) {
|
||||
ScmMyFavoritesDTO scmMyFavoritesDTO = new ScmMyFavoritesDTO();
|
||||
scmMyFavoritesDTO.setTitle(jsonObject.getString("title"));
|
||||
scmMyFavoritesDTO.setFunctionRoutePath(jsonObject.getString("functionRoutePath"));
|
||||
SysUser currentUser = currentUserService.getCurrentUser();
|
||||
scmMyFavoritesService.deleteScmMyFavorites(currentUser.getUserId(), scmMyFavoritesDTO);
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id更新我的收藏
|
||||
*
|
||||
* @param jsonObject jsonObject
|
||||
*/
|
||||
@RequestMapping("/orderScmMyFavorites")
|
||||
public ResponseMessage orderScmMyFavorites(@RequestBody JSONObject jsonObject){
|
||||
System.out.println(jsonObject);
|
||||
SysUser currentUser = currentUserService.getCurrentUser();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject oneSmf = jsonArray.getJSONObject(i);
|
||||
ScmMyFavoritesDTO scmMyFavoritesDTO = new ScmMyFavoritesDTO();
|
||||
scmMyFavoritesDTO.setTitle(oneSmf.getString("title"));
|
||||
scmMyFavoritesDTO.setFunctionRoutePath(oneSmf.getString("functionRoutePath"));
|
||||
scmMyFavoritesDTO.setOrderNo(i);
|
||||
scmMyFavoritesService.orderScmMyFavorites(currentUser.getUserId(), scmMyFavoritesDTO);
|
||||
}
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.encryption.util.SM3Utils;
|
||||
import com.insigma.framework.util.StringUtil;
|
||||
import com.insigma.framework.web.securities.commons.SM3PasswordEncoder;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.SysAppAddressDTO;
|
||||
import com.insigma.sys.dto.SysAppDTO;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.SysAppService;
|
||||
import com.insigma.web.support.annotation.OdinRequest;
|
||||
import com.insigma.web.support.annotation.OdinRequestParam;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import com.insigma.web.support.service.token.AppTokenService;
|
||||
import com.insigma.web.support.util.pe.PageTable;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 应用系统管理接口
|
||||
*
|
||||
* @author GH
|
||||
* @version 2022/3/28
|
||||
* @since 2.6.5
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/sysapp/sysApp")
|
||||
public class SysAppController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
@Autowired
|
||||
private SysAppService sysAppService;
|
||||
@Autowired
|
||||
private AppTokenService appTokenService;
|
||||
|
||||
|
||||
@OdinRequest(init = true)
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(@OdinRequestParam("f_form") SysAppDTO queryDTO, Integer size) throws SQLException {
|
||||
tableDataQuery(queryDTO, 1, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage doGridQuery(@OdinRequestParam("f_form") SysAppDTO queryDTO,
|
||||
Integer size) {
|
||||
tableDataQuery(queryDTO, 1, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/doGridQuery/{name}")
|
||||
public ResponseMessage doGridQuery(@OdinRequestParam("f_form") SysAppDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData_page") Integer page,
|
||||
@OdinRequestParam("t_tableData_size") Integer size,
|
||||
@PathVariable String name) {
|
||||
tableDataQuery(queryDTO, page, size);
|
||||
this.set("page", page);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
public void tableDataQuery(SysAppDTO queryDTO, Integer page, Integer size) {
|
||||
this.pageQuery("t_tableData", () -> {
|
||||
this.set("page", page); // 需要将前端表格中:currentPage定义的值设置成page的值
|
||||
return sysAppService.pageQuery(queryDTO, page, size);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/add")
|
||||
public ResponseMessage add() {
|
||||
this.set("dialogFormVisible", true);
|
||||
this.set("dialogFormTitle", "新增应用");
|
||||
this.clearForm("f_sysAppForm");
|
||||
this.getTable("t_tableData1").setData(new ArrayList<>());
|
||||
this.getTable("t_tableData1").setTotal(0L);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/doSave/{name}")
|
||||
public ResponseMessage doSave(@OdinRequestParam("f_sysAppForm") SysAppDTO queryDTO) {
|
||||
PageTable t_tableData1 = this.getTable("t_tableData1");
|
||||
List<SysAppAddressDTO> listsysAppAddressDTO = t_tableData1.getData(SysAppAddressDTO.class);
|
||||
String portalurl = null;
|
||||
String appurl = null;
|
||||
for (int i = 0; i < listsysAppAddressDTO.size(); i++) {
|
||||
portalurl = listsysAppAddressDTO.get(i).getPortalUrl();
|
||||
if (portalurl == null || "".equals(portalurl)) {
|
||||
return this.error("门户名称不能为空");
|
||||
}
|
||||
appurl = listsysAppAddressDTO.get(i).getAppUrl();
|
||||
if (appurl == null || "".equals(appurl)) {
|
||||
return this.error("应用地址不能为空");
|
||||
} else {
|
||||
if (appurl.indexOf("http://") == 0 || appurl.indexOf("https://") == 0) {
|
||||
|
||||
} else {
|
||||
return this.error("门户名称为" + portalurl + "的应用地址不合法,请检查!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isEmpty(queryDTO.getAppId())) {
|
||||
boolean flag = sysAppService.selectAppCode(queryDTO.getAppCode());
|
||||
if (flag) {
|
||||
return ResponseMessage.error("异常应用编码重复!");
|
||||
}
|
||||
}
|
||||
String secretKey = null;
|
||||
if (StringUtil.isEmpty(queryDTO.getAppId())) {
|
||||
secretKey = appTokenService.generateSecretKey();
|
||||
}
|
||||
String appId = sysAppService.saveSysAppDTO(queryDTO, secretKey);
|
||||
if ("".equals(appId) && appId == null) {
|
||||
return ResponseMessage.error("保存失败!");
|
||||
}else {
|
||||
sysAppService.saveSysAppAddressDTO(listsysAppAddressDTO, appId);
|
||||
}
|
||||
this.set("dialogFormVisible", false);
|
||||
this.clearForm("f_sysAppForm");
|
||||
this.getTable("t_tableData1").setData(new ArrayList<>());
|
||||
this.getTable("t_tableData1").setTotal(0L);
|
||||
this.refresh();
|
||||
return this.ok("保存成功!");
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/update")
|
||||
public ResponseMessage update(String appId) {
|
||||
SysAppDTO sysAppDTO = sysAppService.querySysApp(appId);
|
||||
this.toForm("f_sysAppForm", sysAppDTO);
|
||||
List<SysAppAddressDTO> list = sysAppService.querySysAddressDTO(appId);
|
||||
this.getTable("t_tableData1").setData(list);
|
||||
this.set("dialogFormVisible", true);
|
||||
this.set("dialogFormTitle", "修改应用");
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest(refresh = true) // refresh = true 请求结束后刷新页面
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(String appId) {
|
||||
sysAppService.deleteSysApp(appId);
|
||||
sysAppService.deleteSysAppAddressByAppId(appId);
|
||||
return this.ok("删除成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/deleteSysAppAddress")
|
||||
public ResponseMessage deleteSysAppAddress(@RequestBody SysAppAddressDTO sysAppAddressDTO) {
|
||||
if (sysAppAddressDTO.getAddressId() == null || "".equals(sysAppAddressDTO.getAddressId())) {
|
||||
return this.ok("删除成功!");
|
||||
}
|
||||
sysAppService.deleteSysAppAddress(sysAppAddressDTO.getAddressId());
|
||||
return this.ok("删除成功!");
|
||||
}
|
||||
|
||||
@GetMapping("/toActiveSysApp")
|
||||
public ResponseMessage toActiveSysApp(@RequestParam(name = "appId") String appId) {
|
||||
sysAppService.toActiveSysApp(appId);
|
||||
return this.ok("启用成功!");
|
||||
}
|
||||
|
||||
@GetMapping("/toNotActiveSysApp")
|
||||
public ResponseMessage toNotActiveSysApp(@RequestParam(name = "appId") String appId) {
|
||||
sysAppService.toNotActiveSysApp(appId);
|
||||
return this.ok("禁用成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/verify")
|
||||
public ResponseMessage verify(@RequestBody JSONObject jsonObject) {
|
||||
//获取当前登录人去验证密码是否正确
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
String password = jsonObject.getString("password");
|
||||
String id = jsonObject.getString("id");
|
||||
SM3PasswordEncoder sm3PasswordEncoder = new SM3PasswordEncoder();
|
||||
boolean b = sm3PasswordEncoder.matches(SM3Utils.digest(password), sysUser.getPassWD());
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
if(b){
|
||||
//查询安全key
|
||||
SysAppDTO sysAppDTO = sysAppService.querySysApp(id);
|
||||
map.put("appId",sysAppDTO.getAppId());
|
||||
map.put("secretKey",sysAppDTO.getSecretKey());
|
||||
map.put("verify",b);
|
||||
}
|
||||
map.put("verify",b);
|
||||
return ResponseMessage.ok(map);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.audit.dto.AuditConfig;
|
||||
import com.insigma.framework.audit.service.SysAuditConfigService;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/11/15
|
||||
* @since 2.7.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/audit/config")
|
||||
public class SysAuditConfigController {
|
||||
|
||||
@Autowired
|
||||
private SysAuditConfigService sysAuditConfigService;
|
||||
|
||||
@GetMapping("/query")
|
||||
public ResponseMessage query(String functionName, Integer page, Integer size) throws SQLException {
|
||||
PageInfo<AuditConfig> pageInfo = sysAuditConfigService.query(functionName, page, size);
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public ResponseMessage save(@RequestBody AuditConfig auditConfig) {
|
||||
if (auditConfig.getFunctionId() == null) {
|
||||
return ResponseMessage.error("请选择功能模块");
|
||||
}
|
||||
if (auditConfig.getAuditTotalLevel() == null) {
|
||||
return ResponseMessage.error("请输入审核总级别");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(auditConfig.getServiceName())) {
|
||||
return ResponseMessage.error("请输入服务名称");
|
||||
}
|
||||
sysAuditConfigService.save(auditConfig);
|
||||
return ResponseMessage.ok("保存成功");
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(@RequestBody AuditConfig auditConfig) throws AppException {
|
||||
if (ObjectUtils.isEmpty(auditConfig.getId())) {
|
||||
return ResponseMessage.error("请选择需要删除的配置");
|
||||
}
|
||||
sysAuditConfigService.delete(auditConfig.getId());
|
||||
return ResponseMessage.ok("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.audit.dto.AuditHistory;
|
||||
import com.insigma.framework.audit.dto.AuditInfo;
|
||||
import com.insigma.framework.audit.dto.AuditResult;
|
||||
import com.insigma.framework.audit.service.SysAuditService;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/11/14
|
||||
* @since 2.7.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/audit")
|
||||
public class SysAuditController {
|
||||
|
||||
@Autowired
|
||||
private SysAuditService sysAuditService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
/**
|
||||
* 待审核列表
|
||||
* @param functionId 模块ID
|
||||
* @param level 审核级别
|
||||
* @param page 分页
|
||||
* @param size 大小
|
||||
* @return 审核列表
|
||||
*/
|
||||
@GetMapping("/{functionId}/{level}/list")
|
||||
public ResponseMessage list(@PathVariable Long functionId, @PathVariable Integer level, Integer page, Integer size) throws SQLException {
|
||||
PageInfo<AuditInfo> pageInfo = sysAuditService.query(functionId, level, page, size);
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param functionId 模块ID
|
||||
* @param level 审核级别
|
||||
* @param auditResult 审核信息
|
||||
* @return 审核结果
|
||||
*/
|
||||
@PostMapping("/{functionId}/{level}/post")
|
||||
public ResponseMessage audit(@PathVariable Long functionId, @PathVariable Integer level, @RequestBody AuditResult auditResult) {
|
||||
if (CollectionUtils.isEmpty(auditResult.getOpsenos())) {
|
||||
return ResponseMessage.error("请选择需要审核的业务!");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(auditResult.getResult())) {
|
||||
return ResponseMessage.error("审核结果不能为空!");
|
||||
}
|
||||
if ("0".equals(auditResult.getResult()) && ObjectUtils.isEmpty(auditResult.getReason())) {
|
||||
return ResponseMessage.error("审核不通过时,审核原因不能为空!");
|
||||
}
|
||||
sysAuditService.audit(currentUserService.getCurrentUser().getLogonName(), functionId, level, auditResult);
|
||||
return ResponseMessage.ok("审核成功!");
|
||||
}
|
||||
|
||||
@GetMapping("/{functionId}/{level}/history")
|
||||
public ResponseMessage history(@PathVariable Long functionId, @PathVariable Integer level, Long opseno) {
|
||||
List<AuditHistory> histories = sysAuditService.queryHistories(opseno);
|
||||
return ResponseMessage.ok(histories);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.sys.dto.CodeDTO;
|
||||
import com.insigma.sys.entity.Aa10;
|
||||
import com.insigma.sys.service.SysCodeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2019/1/9.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/code")
|
||||
public class SysCodeController {
|
||||
|
||||
@Autowired
|
||||
private SysCodeService sysCodeService;
|
||||
|
||||
@PostMapping("/initCodeTypes")
|
||||
public ResponseMessage initCodeTypes(@RequestBody JSONObject jsonObject) {
|
||||
JSONObject codeTypes = sysCodeService.getCodeTypes(jsonObject);
|
||||
return ResponseMessage.ok(codeTypes);
|
||||
}
|
||||
|
||||
@GetMapping("/query")
|
||||
public ResponseMessage query(String aaa100, String aaa103, Integer page, Integer size) {
|
||||
CodeDTO codeDTO = sysCodeService.query(aaa100, aaa103, page, size);
|
||||
return ResponseMessage.ok(null, codeDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public ResponseMessage save(@RequestBody Aa10 aa10) {
|
||||
sysCodeService.saveCode(aa10);
|
||||
return ResponseMessage.ok("保存成功");
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(@RequestBody JSONObject jsonObject) throws AppException {
|
||||
try {
|
||||
Long aaz093=Long.valueOf(jsonObject.get("aaz093").toString());
|
||||
sysCodeService.deleteCode(aaz093);
|
||||
}catch (Exception e){
|
||||
throw new AppException("数据转换异常!");
|
||||
}
|
||||
return ResponseMessage.ok("删除成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,351 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.dfs.FSObject;
|
||||
import com.insigma.framework.dfs.FSService;
|
||||
import com.insigma.framework.dfs.exception.DfsException;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.framework.util.StringUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.SysDownloadCenterDTO;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.SysDownloadCenterService;
|
||||
import com.insigma.web.support.annotation.OdinRequest;
|
||||
import com.insigma.web.support.annotation.OdinRequestParam;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @ClassName: SysDownloadCenterController
|
||||
* @Description:
|
||||
* @version 2021/8/4 10:13
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/downloadcenter/DownloadCenter")
|
||||
public class SysDownloadCenterController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SysDownloadCenterService sysDownloadCenterService;
|
||||
|
||||
@Autowired(required = false)
|
||||
private FSService fsService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param f_form
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest(init = true)
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(SysDownloadCenterDTO f_form, Integer size) {
|
||||
tableDataQuery(f_form, 1, size);
|
||||
return this.ok();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param queryDTO
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@OdinRequestParam("f_form") SysDownloadCenterDTO queryDTO,
|
||||
Integer size) {
|
||||
tableDataQuery(queryDTO, 1, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @Description: 分页查询
|
||||
* @author GH
|
||||
* @version 2021/8/4 13:29
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/doGridQuery/{name}")
|
||||
public ResponseMessage doGridQuery(@OdinRequestParam("f_form") SysDownloadCenterDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData_page") Integer page,
|
||||
@OdinRequestParam("t_tableData_size") Integer size,
|
||||
@PathVariable String name) {
|
||||
tableDataQuery(queryDTO, page, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
|
||||
private void tableDataQuery(SysDownloadCenterDTO queryDTO, Integer page, Integer size) {
|
||||
this.pageQuery("t_tableData", () -> {
|
||||
this.set("page", page); // 需要将前端表格中:currentPage定义的值设置成page的值
|
||||
return sysDownloadCenterService.queryDownloadCenterList(queryDTO, page, size);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/add")
|
||||
public ResponseMessage add() {
|
||||
this.clearForm("f_downloadCenterForm");
|
||||
this.set("sysDownloadCenterDTO", new Object[]{});
|
||||
this.set("fileList", new Object[]{});
|
||||
this.set("dialogFormVisible", true);
|
||||
this.set("dialogFormTitle", "材料新增");
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sysDownloadCenterDTO
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest(refresh = true) // refresh = true 请求结束后刷新页面
|
||||
@PostMapping("/doSave/{name}")
|
||||
public ResponseMessage doSave(@OdinRequestParam("f_downloadCenterForm") SysDownloadCenterDTO sysDownloadCenterDTO,
|
||||
@PathVariable String name, @RequestBody JSONObject jsonObjecte) throws DfsException {
|
||||
if(sysDownloadCenterDTO.getMaterial_type()==null|| "".equals(sysDownloadCenterDTO.getMaterial_type())){
|
||||
return this.error("请选择文件类型!");
|
||||
}
|
||||
//设置保留位数
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
JSONArray array = jsonObjecte.getJSONArray("sysDownloadCenterDTO");
|
||||
List<SysDownloadCenterDTO> list = array.toJavaList(SysDownloadCenterDTO.class);
|
||||
if (list.size() < 1) {
|
||||
return ResponseMessage.error("请上传附件!");
|
||||
} else {
|
||||
for (SysDownloadCenterDTO downloadCenterDTO : list) {
|
||||
//录入数据库
|
||||
SysDownloadCenterDTO dto = new SysDownloadCenterDTO();
|
||||
dto.setId(downloadCenterDTO.getId());
|
||||
dto.setMaterial_name(downloadCenterDTO.getMaterial_name());
|
||||
String size;
|
||||
//字节
|
||||
long baty = Long.parseLong(downloadCenterDTO.getMaterial_size());
|
||||
//小于M用kb
|
||||
if (baty < 1048576 && baty > 0) {
|
||||
String kb = df.format((double) baty / 1024);
|
||||
size = kb + "KB";
|
||||
} else if (baty >= 1048576 && baty < 1073741824) { //用m表示
|
||||
String m = df.format((double) baty / 1048576);
|
||||
size = m + "M";
|
||||
} else { //G表示
|
||||
String g = df.format((double) baty / 1073741824);
|
||||
size = g + "G";
|
||||
}
|
||||
dto.setMaterial_size(size);
|
||||
dto.setMaterial_type(sysDownloadCenterDTO.getMaterial_type());
|
||||
dto.setUpload_time(new Date());
|
||||
sysDownloadCenterService.saveDownloadCenter(dto);
|
||||
}
|
||||
this.set("dialogFormVisible", false);
|
||||
return this.ok("保存成功!!!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest(refresh = true) // refresh = true 请求结束后刷新页面
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(String id) throws DfsException {
|
||||
sysDownloadCenterService.delete(id);
|
||||
fsService.deleteObject(id);
|
||||
return this.ok("删除成功!");
|
||||
|
||||
}
|
||||
|
||||
//移除文件
|
||||
@GetMapping("/del/{id}")
|
||||
public ResponseMessage del(@PathVariable String id) throws DfsException {
|
||||
fsService.deleteObject(id);
|
||||
return this.ok("文件移除成功!");
|
||||
}
|
||||
|
||||
//批量下载
|
||||
@GetMapping("/batchDownload/{ids}")
|
||||
public void batchDownload(@PathVariable String ids, HttpServletResponse response) throws DfsException {
|
||||
String[] s = ids.split(",");
|
||||
String zipFileName = "batchDownload.zip";
|
||||
// response.reset();
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + zipFileName);
|
||||
ZipOutputStream zos = null;
|
||||
try {
|
||||
zos = new ZipOutputStream(response.getOutputStream());
|
||||
for (String fileId : s) {
|
||||
FSObject fsObject;
|
||||
try {
|
||||
fsObject = fsService.getObject(fileId);
|
||||
} catch (DfsException e) {
|
||||
log.error("{}文件不存在!", fileId);
|
||||
continue;
|
||||
}
|
||||
InputStream is = fsObject.getInputStream();
|
||||
BufferedInputStream bis = null;
|
||||
try {
|
||||
bis = new BufferedInputStream(is);
|
||||
//将文件写入zip内,即将文件进行打包
|
||||
zos.putNextEntry(new ZipEntry(fsObject.getName()));
|
||||
//写入文件的方法,同上
|
||||
int size = 0;
|
||||
byte[] buffer = new byte[1024];
|
||||
//设置读取数据缓存大小
|
||||
while ((size = bis.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, size);
|
||||
}
|
||||
//关闭输入输出流
|
||||
zos.closeEntry();
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
if (bis != null) {
|
||||
bis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new AppException("批量下载失败");
|
||||
} finally {
|
||||
if (zos != null) {
|
||||
try {
|
||||
zos.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/download/{id}")
|
||||
public void download(@PathVariable String id, HttpServletResponse response) throws IOException {
|
||||
FSObject fsObject = null;
|
||||
try {
|
||||
fsObject = fsService.getObject(id);
|
||||
} catch (Exception e) {
|
||||
response.sendError(404, "文件不存在!");
|
||||
return;
|
||||
}
|
||||
sysDownloadCenterService.saveDownloadLog(id, currentUserService.getCurrentUser().getLogonName());
|
||||
OutputStream out = null;
|
||||
InputStream in = fsObject.getInputStream();
|
||||
try {
|
||||
response.addHeader("content-type", "application/octet-stream");
|
||||
response.setContentType("application/octet-stream");
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + new String(fsObject.getName().getBytes("UTF-8"), "ISO8859-1"));
|
||||
out = response.getOutputStream();
|
||||
|
||||
byte[] bytes = new byte[2048];
|
||||
int len;
|
||||
while ((len = in.read(bytes)) > 0) {
|
||||
out.write(bytes, 0, len);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("文件下载异常", e);
|
||||
} finally {
|
||||
//释放资源
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
log.error("IO close error!", e);
|
||||
}
|
||||
}
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
log.error("IO close error!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//上传
|
||||
@PostMapping("/upload")
|
||||
public ResponseMessage upload(@RequestParam MultipartFile file, HttpServletRequest request) throws IOException, DfsException {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
if (!"1".equals(sysUser.getUserType())) {
|
||||
return ResponseMessage.error("只允许超级管理员上传附件!");
|
||||
}
|
||||
ResponseMessage rm;
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
String fileType = originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||
/*if (!".zip".equals(fileType)) {
|
||||
rm = ResponseMessage.ok("文件类型不对!!!");
|
||||
return rm;
|
||||
}*/
|
||||
//创建文件存储对象
|
||||
FSObject fsObject = new FSObject();
|
||||
fsObject.setName(file.getOriginalFilename());
|
||||
fsObject.setContentType(file.getContentType());
|
||||
fsObject.setInputStream(file.getInputStream());
|
||||
fsObject.setSize(file.getSize());
|
||||
//该id在文件存入后由mongodb返回
|
||||
String id = fsService.pubObject(fsObject);
|
||||
if (StringUtil.isNotEmpty(id)) {
|
||||
SysDownloadCenterDTO dto = new SysDownloadCenterDTO();
|
||||
dto.setId(id);
|
||||
dto.setMaterial_size(Long.toString(fsObject.getSize()));
|
||||
dto.setMaterial_name(fsObject.getName());
|
||||
rm = ResponseMessage.ok("文件上传成功!!!", dto);
|
||||
} else {
|
||||
rm = ResponseMessage.ok("文件上传失败!!!");
|
||||
}
|
||||
return rm;
|
||||
}
|
||||
|
||||
|
||||
//查询用户是否为超级管理员
|
||||
@GetMapping("/queryUser")
|
||||
public ResponseMessage queryUser() {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
//超级管理员
|
||||
if ("1".equals(sysUser.getUserType())) {
|
||||
return ResponseMessage.ok(true);
|
||||
} else {
|
||||
return ResponseMessage.ok(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.JdbcPageHelper;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.sys.entity.SysError;
|
||||
import com.insigma.sys.service.SysErrorService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 异常信息维护
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/error")
|
||||
public class SysErrorController {
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private SysErrorService sysErrorService;
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(@RequestBody JSONObject pageData) throws SQLException {
|
||||
|
||||
Integer size = pageData.getInteger("size");
|
||||
HashMap<String, Object> tableData = tableDataQuery(pageData, 1, size);
|
||||
pageData.put("t_tableData", tableData);
|
||||
|
||||
/* List<SysError> errors=sysErrorService.queryAllErrors();
|
||||
// JSONArray array1=new JSONArray();
|
||||
JSONArray array=JSONArray.parseArray(JSONArray.toJSONString(errors));
|
||||
JSONObject tableData = new JSONObject();
|
||||
|
||||
tableData.put("Data",array);
|
||||
tableData.put("total",errors.size());*/
|
||||
pageData.put("t_tableData", tableData);
|
||||
return ResponseMessage.ok(pageData);
|
||||
}
|
||||
@PostMapping("/doQuery/goIt")
|
||||
public ResponseMessage queryBySome(@RequestBody JSONObject pageData){
|
||||
Map<String, HashMap<String,String>> map= (Map<String, HashMap<String, String>>) pageData.get("f_form1_n");
|
||||
String serviceName=map.get("serviceName").get("value");
|
||||
String functionName=map.get("functionName").get("value");
|
||||
String errorCode= map.get("errorCode").get("value");
|
||||
List<SysError> errors=sysErrorService.findAllBySome(serviceName,functionName,errorCode);
|
||||
JSONArray array=JSONArray.parseArray(JSONArray.toJSONString(errors));
|
||||
JSONObject tableData = new JSONObject();
|
||||
tableData.put("Data",array);
|
||||
tableData.put("total",errors.size());
|
||||
pageData.put("t_tableData", tableData);
|
||||
return ResponseMessage.ok(pageData);
|
||||
}
|
||||
@PostMapping("/doGridQuery/{id}")
|
||||
public ResponseMessage doGridQuery(@RequestBody JSONObject jsonObject, @PathVariable String id) throws SQLException {
|
||||
Integer page = jsonObject.getInteger("t_tableData_page");
|
||||
Integer size = jsonObject.getInteger("t_tableData_size");
|
||||
HashMap<String, Object> tableData = tableDataQuery(jsonObject, page, size);
|
||||
jsonObject.put("t_tableData", tableData);
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
}
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage deleteError(@RequestBody JSONObject pageData){
|
||||
Map<String,String> map= (Map<String,String>) pageData.get("data");
|
||||
try {
|
||||
SysError sysError=sysErrorService.getSysErrorBean2(map);
|
||||
sysErrorService.deleteError(sysError);
|
||||
List<SysError> errors=sysErrorService.queryAllErrors();
|
||||
JSONArray array=JSONArray.parseArray(JSONArray.toJSONString(errors));
|
||||
JSONObject tableData = new JSONObject();
|
||||
tableData.put("Data",array);
|
||||
tableData.put("total",errors.size());
|
||||
return ResponseMessage.ok("删除成功",tableData);
|
||||
}catch (Exception e){
|
||||
return ResponseMessage.error("删除失败");
|
||||
}
|
||||
}
|
||||
@PostMapping("/doSave/addError")
|
||||
public ResponseMessage addError(@RequestBody JSONObject pageData){
|
||||
try {
|
||||
Map<String,HashMap<String,String>> map= (Map<String,HashMap<String,String>>) pageData.get("f_errorForm_n");
|
||||
SysError sysError=sysErrorService.getSysErrorBean1(map);
|
||||
sysErrorService.save(sysError);
|
||||
List<SysError> errors=sysErrorService.queryAllErrors();
|
||||
JSONArray array=JSONArray.parseArray(JSONArray.toJSONString(errors));
|
||||
JSONObject tableData = new JSONObject();
|
||||
tableData.put("Data",array);
|
||||
tableData.put("total",errors.size());
|
||||
//将table装载到pageData
|
||||
pageData.put("t_tableData", tableData);
|
||||
pageData.put("dialogFormVisible",false);
|
||||
return ResponseMessage.ok("增加成功",pageData);
|
||||
}catch (Exception e){
|
||||
pageData.put("dialogFormVisible",false);
|
||||
return ResponseMessage.error("异常编码重复");
|
||||
}
|
||||
}
|
||||
@PostMapping("/doCheck/{checkname}")
|
||||
public ResponseMessage updateError(@RequestBody JSONObject pageData){
|
||||
try {
|
||||
int index=Integer.parseInt(pageData.get("index").toString());
|
||||
HashMap<String,Object> maps= (HashMap<String,Object>) pageData.get("t_tableData_n");
|
||||
// String datas=maps.get("Data").toString();
|
||||
String datas=JSONObject.toJSONString(maps.get("Data"));
|
||||
JSONArray jsonArray = JSON.parseArray(datas);
|
||||
SysError sysError=JSON.toJavaObject(jsonArray.getJSONObject(index),SysError.class);
|
||||
sysErrorService.save(sysError);
|
||||
List<SysError> errors=sysErrorService.queryAllErrors();
|
||||
JSONArray array=JSONArray.parseArray(JSONArray.toJSONString(errors));
|
||||
JSONObject tableData = new JSONObject();
|
||||
tableData.put("Data",array);
|
||||
tableData.put("total",errors.size());
|
||||
//将table装载到pageData
|
||||
pageData.put("t_tableData_n", tableData);
|
||||
return ResponseMessage.ok("修改成功",pageData);
|
||||
}catch (Exception e){
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/queryIsMany")
|
||||
public ResponseMessage queryIsMany(@RequestBody JSONObject pageData){
|
||||
Map<String,HashMap<String,String>> map= (Map<String,HashMap<String,String>>) pageData.get("f_errorForm_n");
|
||||
String errCode=map.get("errorCode1").get("value");
|
||||
boolean flag=sysErrorService.queryByErrCode(errCode);
|
||||
if (flag==true){
|
||||
map.get("errorCode1").put("value","");
|
||||
pageData.put("f_errorForm",map);
|
||||
return ResponseMessage.error("异常编码重复");
|
||||
}
|
||||
return ResponseMessage.ok(pageData);
|
||||
}
|
||||
public HashMap<String, Object> tableDataQuery(JSONObject jsonObject, Integer page, Integer size) throws SQLException {
|
||||
StringBuffer querySQL = new StringBuffer("select * from syserror where 1=1 ");
|
||||
|
||||
JdbcPageHelper helper = new JdbcPageHelper(jdbcTemplate, page, size);
|
||||
PageInfo<Map<String, Object>> data = helper.queryPagination(querySQL.toString(), new ArrayList<>(), rs -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", rs.getString("id"));
|
||||
map.put("serviceName", rs.getString("servicename"));
|
||||
map.put("functionName", rs.getString("functionname"));
|
||||
map.put("errorCode", rs.getString("errorcode"));
|
||||
map.put("message", rs.getString("message"));
|
||||
map.put("createTime", rs.getDate("createtime"));
|
||||
return map;
|
||||
});
|
||||
|
||||
HashMap<String, Object> gridData = new HashMap<>();
|
||||
gridData.put("total", data.getTotal());
|
||||
gridData.put("Data", data.getData());
|
||||
return gridData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.dfs.FSObject;
|
||||
import com.insigma.framework.dfs.FSService;
|
||||
import com.insigma.sys.dto.FeedbackAnswerDTO;
|
||||
import com.insigma.sys.dto.FeedbackDTO;
|
||||
import com.insigma.sys.service.SysFeedbackService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/2/23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/feedback")
|
||||
public class SysFeedbackController {
|
||||
|
||||
@Autowired
|
||||
private SysFeedbackService sysFeedbackService;
|
||||
|
||||
@Autowired(required = false)
|
||||
private FSService fsService;
|
||||
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@RequestBody JSONObject jsonObject) throws SQLException {
|
||||
FeedbackDTO queryDTO = jsonObject.toJavaObject(FeedbackDTO.class);
|
||||
Integer page = jsonObject.getInteger("page");
|
||||
Integer size = jsonObject.getInteger("size");
|
||||
PageInfo<FeedbackDTO> pageInfo = sysFeedbackService.page(queryDTO, page, size);
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public ResponseMessage save(@RequestBody FeedbackDTO feedbackDTO) {
|
||||
if (ObjectUtils.isEmpty(feedbackDTO.getTitle())) {
|
||||
return ResponseMessage.error("意见标题不能为空!");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(feedbackDTO.getContent())) {
|
||||
return ResponseMessage.error("意见内容不能为空!");
|
||||
}
|
||||
sysFeedbackService.save(feedbackDTO);
|
||||
return ResponseMessage.ok("提交成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/get/{id}")
|
||||
public ResponseMessage get(@PathVariable String id) {
|
||||
if (ObjectUtils.isEmpty(id)) {
|
||||
return ResponseMessage.error("意见ID不能为空!");
|
||||
}
|
||||
FeedbackDTO feedbackDTO = sysFeedbackService.get(id);
|
||||
return ResponseMessage.ok(feedbackDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/saveAnswer")
|
||||
public ResponseMessage saveAnswer(@RequestBody FeedbackAnswerDTO feedbackAnswerDTO) {
|
||||
if (ObjectUtils.isEmpty(feedbackAnswerDTO.getFeedbackId())) {
|
||||
return ResponseMessage.error("意见ID不能为空!");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(feedbackAnswerDTO.getContent())) {
|
||||
return ResponseMessage.error("回复内容不能为空!");
|
||||
}
|
||||
sysFeedbackService.saveAnswer(feedbackAnswerDTO);
|
||||
return ResponseMessage.ok("提交成功!");
|
||||
}
|
||||
|
||||
@PostMapping("/images")
|
||||
public ResponseMessage upload(MultipartFile file) {
|
||||
try {
|
||||
if (fsService == null) {
|
||||
return ResponseMessage.error("未启用FS");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(file.getContentType())) {
|
||||
return ResponseMessage.error("content-type不能为空");
|
||||
}
|
||||
if (!file.getContentType().toLowerCase().contains("image")) {
|
||||
return ResponseMessage.error("图片格式不正确");
|
||||
}
|
||||
FSObject fsObject = new FSObject();
|
||||
fsObject.setName(file.getOriginalFilename());
|
||||
fsObject.setUploadDate(new Date());
|
||||
fsObject.setInputStream(file.getInputStream());
|
||||
fsObject.setContentType(file.getContentType());
|
||||
fsObject.setSize(file.getSize());
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("location", "/sys/feedback/static/images/" + fsService.pubObject(fsObject) + file.getContentType().substring(file.getContentType().lastIndexOf("/")).toLowerCase().replace("/", "."));
|
||||
return ResponseMessage.ok(result);
|
||||
} catch (Exception e) {
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/static/images/{prefix}.{suffix}")
|
||||
public ResponseEntity view(@PathVariable String prefix, @PathVariable String suffix) {
|
||||
try {
|
||||
if (fsService == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
FSObject fsObject;
|
||||
try {
|
||||
fsObject = fsService.getObject(prefix);
|
||||
} catch (Exception e) {
|
||||
fsObject = null;
|
||||
}
|
||||
if (fsObject == null || !fsObject.getContentType().toLowerCase().contains(suffix.toLowerCase())) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
return ResponseEntity.ok()
|
||||
.header("Pragma", "no-cache")
|
||||
.header("Cache-Control", "no-cache")
|
||||
.header("Expires", "0")
|
||||
.header("Content-Type", fsObject.getContentType())
|
||||
.header("Content-Length", String.valueOf(fsObject.getSize()))
|
||||
.body(new InputStreamResource(fsObject.getInputStream()));
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.dfs.FSObject;
|
||||
import com.insigma.framework.dfs.FSService;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.MenuDTO;
|
||||
import com.insigma.sys.dto.SysFunctionDocDTO;
|
||||
import com.insigma.sys.entity.SysMenu;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.MenuService;
|
||||
import com.insigma.sys.service.SysFunctionDocService;
|
||||
import com.insigma.web.support.annotation.OdinRequest;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import com.insigma.web.support.repository.MdParamRepository;
|
||||
import com.insigma.web.support.entity.MdParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/sysFunctionDoc")
|
||||
public class SysFunctionDocController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SysFunctionDocService sysFunctionDocService;
|
||||
|
||||
@Autowired
|
||||
private MdParamRepository mdParamRepository;
|
||||
|
||||
@Autowired(required = false)
|
||||
private FSService fsService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@GetMapping("/queryTree")
|
||||
public ResponseMessage queryTable(){
|
||||
List<MenuDTO> menuDTOS = menuService.queryAllMenu();
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(menuDTOS)), "functionid", "parentid", "children");
|
||||
return ResponseMessage.ok("查询成功", jsonArray);
|
||||
}
|
||||
|
||||
@PostMapping("/nodeClick")
|
||||
public ResponseMessage nodeClick(@RequestBody JSONObject jsonObject) {
|
||||
SysMenu sysMenu;
|
||||
String a=jsonObject.get("functionid").toString();
|
||||
if (a!=null){
|
||||
long functionid =(long)Integer.parseInt(a);
|
||||
sysMenu =menuService.findMenuById(functionid);
|
||||
List<SysMenu> menulist=menuService.findTreesByPId(sysMenu.getFunctionid());
|
||||
if (menulist.size()>0){
|
||||
//有子类
|
||||
return ResponseMessage.ok(sysMenu);
|
||||
}else {
|
||||
//没有子类
|
||||
return ResponseMessage.ok("重复",sysMenu);
|
||||
}
|
||||
}else {
|
||||
return ResponseMessage.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查找对象
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/queryById")
|
||||
public ResponseMessage queryById(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String id=jsonObject.get("functionid").toString();
|
||||
String funtype=jsonObject.get("funtype").toString();
|
||||
List<MenuDTO> menuDTOS=menuService.queryMenuByFuntypeAndActive(funtype);
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(menuDTOS)), "functionid", "parentid", "children");
|
||||
jsonObject.put("treedata",jsonArray);
|
||||
long fId=Integer.parseInt(id);
|
||||
SysMenu menu=menuService.findMenuById(fId);
|
||||
List list=new ArrayList();
|
||||
if(menu!=null){
|
||||
String [] ms=menu.getIdpath().split("/");
|
||||
if (ms.length>0){
|
||||
for (String s:ms){
|
||||
if(s.equals("0")){
|
||||
continue;
|
||||
}
|
||||
list.add(Long.valueOf(s));
|
||||
}
|
||||
}}
|
||||
jsonObject.put("pname",list);
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
}catch (Exception e){
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/doQuery")
|
||||
public ResponseMessage doQuery(@RequestBody JSONObject jsonObject) {
|
||||
String tmp = jsonObject.getString("functionid");
|
||||
Long functionid;
|
||||
if (ObjectUtils.isEmpty(tmp)) {
|
||||
String location = jsonObject.getString("location");
|
||||
if (ObjectUtils.isEmpty(location)) {
|
||||
return ResponseMessage.error("传入菜单ID为空");
|
||||
}
|
||||
MdParam mdParam = mdParamRepository.findByLocation(location);
|
||||
if (mdParam == null) {
|
||||
return ResponseMessage.error("模块不存在");
|
||||
}
|
||||
functionid = mdParam.getFunctionid();
|
||||
} else {
|
||||
functionid = Long.parseLong(tmp);
|
||||
}
|
||||
SysFunctionDocDTO aysFunctionDocDTO = sysFunctionDocService.queryByFunctionID(functionid);
|
||||
if (aysFunctionDocDTO == null) {
|
||||
return ResponseMessage.error("未配置该模块的功能介绍");
|
||||
}
|
||||
return ResponseMessage.ok(aysFunctionDocDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/doSave")
|
||||
public ResponseMessage doSave(@RequestBody SysFunctionDocDTO sysFunctionDocDTO ) {
|
||||
try {
|
||||
sysFunctionDocService.saveDoc(sysFunctionDocDTO);
|
||||
return ResponseMessage.ok();
|
||||
} catch (Exception e) {
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/deleteMenu")
|
||||
public ResponseMessage delete(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String tmp = jsonObject.get("functionid").toString();
|
||||
Long functionid = Long.parseLong(tmp);
|
||||
if(functionid==0){
|
||||
return ResponseMessage.error("传入菜单ID为空");
|
||||
}
|
||||
sysFunctionDocService.deleteByFunctionid(functionid);
|
||||
return ResponseMessage.ok();
|
||||
} catch (Exception e) {
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/images")
|
||||
public ResponseMessage upload(MultipartFile file, String messageId) {
|
||||
try {
|
||||
if (fsService == null) {
|
||||
return ResponseMessage.error("未启用FS");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(file.getContentType())) {
|
||||
return ResponseMessage.error("content-type不能为空");
|
||||
}
|
||||
if (!file.getContentType().toLowerCase().contains("image")) {
|
||||
return ResponseMessage.error("图片格式不正确");
|
||||
}
|
||||
FSObject fsObject = new FSObject();
|
||||
fsObject.setName(file.getOriginalFilename());
|
||||
fsObject.setUploadDate(new Date());
|
||||
fsObject.setInputStream(file.getInputStream());
|
||||
fsObject.setContentType(file.getContentType());
|
||||
fsObject.setSize(file.getSize());
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("location", "/sys/sysFunctionDoc/static/images/" + fsService.pubObject(fsObject) + file.getContentType().substring(file.getContentType().lastIndexOf("/")).toLowerCase().replace("/", ".") + "?messageId=" + messageId);
|
||||
return ResponseMessage.ok(result);
|
||||
} catch (Exception e) {
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@GetMapping("/static/images/{prefix}.{suffix}")
|
||||
public ResponseEntity view(@PathVariable String prefix, @PathVariable String suffix, String messageId) {
|
||||
try {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
SysFunctionDocDTO sysFunctionDocDTO = sysFunctionDocService.queryByFunctionID(Long.parseLong(messageId));
|
||||
if (sysFunctionDocDTO != null ) {
|
||||
if (sysFunctionDocDTO == null) {
|
||||
return ResponseEntity.status(403).build();
|
||||
}
|
||||
}
|
||||
if (fsService == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
FSObject fsObject;
|
||||
try {
|
||||
fsObject = fsService.getObject(prefix);
|
||||
} catch (Exception e) {
|
||||
fsObject = null;
|
||||
}
|
||||
if (fsObject == null || !fsObject.getContentType().toLowerCase().contains(suffix.toLowerCase())) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
return ResponseEntity.ok()
|
||||
.header("Pragma", "no-cache")
|
||||
.header("Cache-Control", "no-cache")
|
||||
.header("Expires", "0")
|
||||
.header("Content-Type", fsObject.getContentType())
|
||||
.header("Content-Length", String.valueOf(fsObject.getSize()))
|
||||
.body(new InputStreamResource(fsObject.getInputStream()));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CommonValidator;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.UserDTO;
|
||||
import com.insigma.sys.entity.*;
|
||||
import com.insigma.sys.service.Aa26Service;
|
||||
import com.insigma.sys.service.SysOrgService;
|
||||
import com.insigma.sys.service.SysUserService;
|
||||
import com.insigma.web.support.service.CodeTypeService;
|
||||
import com.insigma.web.support.util.JavaBeanUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sys/grant")
|
||||
@Slf4j
|
||||
public class SysGrantController {
|
||||
@Autowired
|
||||
private CodeTypeService codeTypeService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private SysOrgService sysOrgService;
|
||||
|
||||
@Autowired
|
||||
private Aa26Service aa26Service;
|
||||
|
||||
@Autowired
|
||||
private CommonValidator validator;
|
||||
|
||||
/**
|
||||
* 初始化页面数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage initPageDate(@RequestBody JSONObject jsonObject) {
|
||||
String userType = currentUserService.getCurrentUser().getUserType();//获取当前登录用户类型
|
||||
JSONObject codeTypes = jsonObject.getJSONObject("codeTypes");
|
||||
JSONObject codeTypesRes = codeTypeService.getCodeTypes(codeTypes);
|
||||
jsonObject.put("codeTypes", codeTypesRes);
|
||||
jsonObject.put("currentUserType", userType);//设置当前登录用户类型
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户
|
||||
*
|
||||
* @param pageData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doSave")
|
||||
public ResponseMessage save(@RequestBody JSONObject pageData) {
|
||||
try {
|
||||
SysUser sysUser = JavaBeanUtils.pageElementToBean(pageData,SysUser.class);
|
||||
JSONArray roleIds = pageData.getJSONObject("roleIds").getJSONArray("value");
|
||||
List<SysUserRole> list = new ArrayList<>();
|
||||
for (Object roleId : roleIds) {
|
||||
if (roleId != null) {
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setRoleId(roleId.toString());
|
||||
list.add(sysUserRole);
|
||||
}
|
||||
}
|
||||
if (!validator.validateRoleIds(roleIds.toJavaList(String.class))) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUser.setSysUserRoleList(list);
|
||||
sysUserService.saveUserRole(sysUser);
|
||||
ResponseMessage rm = ResponseMessage.ok("保存成功");
|
||||
|
||||
return rm;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("保存失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/queryOneUser/{userId}")
|
||||
public ResponseMessage queryOneUser(@PathVariable String userId) throws AppException {
|
||||
SysUser sysUser = sysUserService.queryOneUser(userId);
|
||||
//sysUser.setPassWD(null);
|
||||
List<SysUserRole> roleList = sysUserService.queryUserRole(userId);
|
||||
List<SysUserArea> areaList = sysUserService.queryUserArea(userId);
|
||||
SysOrg sysOrg = sysOrgService.findByOrgid(sysUser.getOrgId());
|
||||
Aa26 aa26 = aa26Service.findByAab301(sysUser.getAreaId() + "");
|
||||
Map<String, Object> map = new ConcurrentHashMap<>();
|
||||
map.put("sysUser", sysUser);
|
||||
map.put("roleList", roleList);
|
||||
map.put("areaList", areaList);
|
||||
|
||||
if (sysOrg != null) {
|
||||
map.put("orgId", sysUser.getOrgId());
|
||||
map.put("sysOrgs",sysOrg);
|
||||
//sysOrgService.findByRegioncode(sysUser.getAreaId()+"")
|
||||
}
|
||||
if (aa26 != null)
|
||||
map.put("aa26", aa26);
|
||||
return ResponseMessage.ok(map);
|
||||
}
|
||||
|
||||
@GetMapping("/queryTable")
|
||||
public ResponseMessage queryTable(@RequestParam(name = "logonName") String logonName,
|
||||
@RequestParam(name = "displayName") String displayName,
|
||||
@RequestParam(name = "orgId") String orgId,
|
||||
@RequestParam(name = "userState") String userState,
|
||||
@RequestParam(name = "userType") String userType,
|
||||
@RequestParam(name = "aa26") String aa26,
|
||||
@RequestParam(name = "cardId") String cardId,
|
||||
@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "size") Integer size) {
|
||||
Page<UserDTO> list = sysUserService.findAll(logonName, displayName, orgId, userState,userType,aa26,cardId, page, size,"3");
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/logoutUser")
|
||||
public ResponseMessage logoutUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.logoutUser(userId);
|
||||
return ResponseMessage.ok("注销成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("注销失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/unlockUser")
|
||||
public ResponseMessage unlockUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.unlockUser(userId);
|
||||
return ResponseMessage.ok("解锁成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("解锁失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/lockUser")
|
||||
public ResponseMessage lockUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.lockUser(userId);
|
||||
return ResponseMessage.ok("锁定成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("锁定失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/resetPassWD")
|
||||
public ResponseMessage resetPassWD(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.resetPassWD(userId);
|
||||
return ResponseMessage.ok("重置密码成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("重置密码失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/editPass")
|
||||
public ResponseMessage editPassWD(@RequestBody(required = true) JSONObject data){
|
||||
try {
|
||||
String oldPass=data.getString("oldPass");
|
||||
String newPass=data.getString("newPass");
|
||||
sysUserService.updataPassWD(oldPass,newPass);
|
||||
return ResponseMessage.ok("修改密码成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("修改密码失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getOrgTreeNodes/{areaId}")
|
||||
public ResponseMessage getOrgTreeNodes(@PathVariable String areaId) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.queryOrgNodes(areaId))), "orgid", "parentid", "children");
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
|
||||
@GetMapping("/getAa26TreeNodes/{userType}")
|
||||
public ResponseMessage getAa26TreeNodes(@PathVariable String userType) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.queryAa26Nodes())), "aab301", "aaa148", "children");
|
||||
//orgNodes= JSONArray.parseArray(JSONArray.toJSONString(orgNodes).replace("aab301","id"));
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
@GetMapping("/getOrgTreeNodes1/{userType}")
|
||||
public ResponseMessage getOrgTreeNodes1(@PathVariable String userType) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.findAllOrg())), "orgid", "parentid", "children");
|
||||
//orgNodes= JSONArray.parseArray(JSONArray.toJSONString(orgNodes).replace("aab301","id"));
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
@GetMapping("getUserTypeCode")
|
||||
public ResponseMessage getUserTypeCode() {
|
||||
List<Map<String, Object>> list = sysUserService.findUsetTypeCode();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("getSlevel")
|
||||
public ResponseMessage getSlevel() {
|
||||
List<Map<String, Object>> list = sysUserService.findSlevel();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("getUserStateCode")
|
||||
public ResponseMessage getUserStateCode() {
|
||||
return ResponseMessage.ok(sysUserService.getUserStateCode());
|
||||
}
|
||||
|
||||
@GetMapping("/getRoleList/{userType}")
|
||||
public ResponseMessage getRoleList(@PathVariable("userType") String userType) {
|
||||
List<SysRole> list = sysUserService.findByRoleType(userType);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping("/doCheck/{id}")
|
||||
public ResponseMessage doCheck(@PathVariable("id") String id, @RequestBody JSONObject data) {
|
||||
boolean bool = true;//校验是否通过
|
||||
if ("logonName".equals(id)) {
|
||||
String logonName = data.getJSONObject("logonName").getString("value");
|
||||
String userId=data.getJSONObject("userId").getString("value");
|
||||
bool = sysUserService.checkLogonName(logonName,userId);
|
||||
}
|
||||
if (bool) {
|
||||
ResponseMessage rm = ResponseMessage.error("存在相同登录名");
|
||||
return rm;
|
||||
} else {
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有机构
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllOrg")
|
||||
private ResponseMessage findAllOrg() {
|
||||
List<SysOrg> list = sysUserService.findAllOrg();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有区域
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllAa26")
|
||||
private ResponseMessage findAllAa26() {
|
||||
List<Aa26> list = sysOrgService.getAA26();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有机构,返回格式为树结构
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllOrgTree")
|
||||
private ResponseMessage findAllOrgTree() {
|
||||
List<SysOrg> list = sysUserService.findAllOrg();
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(list)), "orgid", "parentid", "children");
|
||||
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用获取下拉框选项
|
||||
* @param codeType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAa10Code/{codeType}")
|
||||
public ResponseMessage getAa10Code(@PathVariable String codeType){
|
||||
List<Map<String, Object>> list = sysUserService.getAa10Code(codeType);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCurrentUser")
|
||||
public ResponseMessage getCurrentUser(){
|
||||
return ResponseMessage.ok(currentUserService.getCurrentUser());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.sys.dto.SysGuideDTO;
|
||||
import com.insigma.sys.service.SysGuideService;
|
||||
import com.insigma.web.support.annotation.OdinRequest;
|
||||
import com.insigma.web.support.annotation.OdinRequestParam;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sys/guide/Guide")
|
||||
public class SysGuideController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SysGuideService sysGuideService;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param f_form
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest(init = true)
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(SysGuideDTO f_form, Integer size) {
|
||||
tableDataQuery(f_form, 1, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryDTO
|
||||
* @param page
|
||||
* @param size
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/doGridQuery/{name}")
|
||||
public ResponseMessage doGridQuery(@OdinRequestParam("f_form") SysGuideDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData_page") Integer page,
|
||||
@OdinRequestParam("t_tableData_size") Integer size,
|
||||
@PathVariable String name) {
|
||||
tableDataQuery(queryDTO, page, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param queryDTO
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@OdinRequestParam("f_form") SysGuideDTO queryDTO,
|
||||
Integer size) {
|
||||
tableDataQuery(queryDTO, 1, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
private void tableDataQuery(SysGuideDTO queryDTO, Integer page, Integer size) {
|
||||
this.pageQuery("t_tableData", () -> {
|
||||
this.set("page", page); // 需要将前端表格中:currentPage定义的值设置成page的值
|
||||
return sysGuideService.queryGuideList(queryDTO, page, size);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/add")
|
||||
public ResponseMessage add() {
|
||||
this.clearForm("f_guideForm");
|
||||
this.set("dialogFormVisible", true);
|
||||
this.set("dialogFormTitle", "新增");
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/update")
|
||||
public ResponseMessage update(String id) {
|
||||
SysGuideDTO dto = sysGuideService.queryGuide(id);
|
||||
|
||||
if(!ObjectUtils.isEmpty(dto.getAnswer_content())){
|
||||
String s = dto.getAnswer_content().replaceAll("<br/>", "\n");
|
||||
dto.setAnswer_content(s);
|
||||
}
|
||||
|
||||
this.toForm("f_guideForm", dto);
|
||||
this.set("dialogFormVisible", true);
|
||||
this.set("dialogFormTitle", "修改");
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest(refresh = true)
|
||||
@PostMapping("/batchDelete")
|
||||
public ResponseMessage batchDelete() {
|
||||
List<SysGuideDTO> list = this.getCheckedTableData("t_tableData", SysGuideDTO.class);
|
||||
if (list.size() == 0) {
|
||||
return this.error("请勾选需要删除的内容!");
|
||||
}
|
||||
sysGuideService.deleteGuides(list);
|
||||
return this.ok("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(String id) {
|
||||
sysGuideService.delete(id);
|
||||
this.setBackFunType("rQuery");
|
||||
return this.ok("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sysGuideDTO
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@OdinRequest
|
||||
@PostMapping("/doSave/{name}")
|
||||
public ResponseMessage doSave(@OdinRequestParam("f_guideForm") SysGuideDTO sysGuideDTO, @PathVariable String name) {
|
||||
sysGuideService.saveGuide(sysGuideDTO);
|
||||
this.set("dialogFormVisible", false);
|
||||
// doInit(new SysGuideDTO(),size);
|
||||
this.setBackFunType("rQuery");
|
||||
return this.ok("保存成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击问题名称触发热度+1
|
||||
*/
|
||||
@GetMapping("/hot/{id}")
|
||||
public ResponseMessage hot(@PathVariable String id) {
|
||||
sysGuideService.hot(id);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 根据不同选择进行详细的查询数据
|
||||
* @author GH
|
||||
* @version 2021/7/23 14:53
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findByQuestion_type")
|
||||
public ResponseMessage findByQuestion_type(@RequestBody JSONObject jsonObjecte) {
|
||||
Integer page = jsonObjecte.getInteger("page");
|
||||
Integer size = jsonObjecte.getInteger("size");
|
||||
String question_type = jsonObjecte.getString("question_type");
|
||||
String sort = jsonObjecte.getString("sort");
|
||||
String str = jsonObjecte.getString("str");
|
||||
return ResponseMessage.ok(sysGuideService.findByQuestion_type(question_type,sort,str,page,size));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 查询首页引导信息
|
||||
* @author GH
|
||||
* @version 2021/7/30 13:09
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findFrontPage")
|
||||
public ResponseMessage findFrontPage() {
|
||||
List<HashMap<String, Object>> map = sysGuideService.findFrontPage();
|
||||
return ResponseMessage.ok(map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 更多详情页面
|
||||
* @author GH
|
||||
* @version 2021/7/30 13:09
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findDetailsPage/{id}")
|
||||
public ResponseMessage findDetailsPage(@PathVariable String id) {
|
||||
sysGuideService.hot(id);
|
||||
return ResponseMessage.ok(sysGuideService.findDetailsPage(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.dfs.FSObject;
|
||||
import com.insigma.framework.dfs.FSService;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.MessageDTO;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.SysMessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2020/6/16.
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/message")
|
||||
public class SysMessageController {
|
||||
|
||||
@Autowired
|
||||
private SysMessageService sysMessageService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired(required = false)
|
||||
private FSService fsService;
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseMessage list(@RequestBody JSONObject jsonObject) throws SQLException {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
MessageDTO queryDTO = jsonObject.toJavaObject(MessageDTO.class);
|
||||
Integer page = jsonObject.getInteger("page");
|
||||
Integer size = jsonObject.getInteger("size");
|
||||
PageInfo<MessageDTO> pageInfo = sysMessageService.getSysMessageList(sysUser, queryDTO, page, size, false);
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public ResponseMessage save(@RequestBody MessageDTO messageDTO) {
|
||||
String userId = currentUserService.getCurrentUser().getUserId();
|
||||
if (ObjectUtils.isEmpty(messageDTO.getTitle())) {
|
||||
return ResponseMessage.error("消息标题不能为空!");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(messageDTO.getContent())) {
|
||||
return ResponseMessage.error("消息内容不能为空!");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(messageDTO.getType())) {
|
||||
return ResponseMessage.error("消息类型不能为空!");
|
||||
}
|
||||
if ("1".equals(messageDTO.getType())) {
|
||||
if (messageDTO.getUserIds() == null || messageDTO.getUserIds().size() == 0) {
|
||||
return ResponseMessage.error("消息通知目标不能为空!");
|
||||
}
|
||||
}
|
||||
sysMessageService.save(userId, messageDTO);
|
||||
return ResponseMessage.ok("保存成功!");
|
||||
}
|
||||
|
||||
@GetMapping("/read")
|
||||
public ResponseMessage read(String messageId) {
|
||||
String userId = currentUserService.getCurrentUser().getUserId();
|
||||
MessageDTO messageDTO = sysMessageService.getSysMessage(userId, messageId);
|
||||
if ("1".equals(messageDTO.getType()) && "-1".equals(messageDTO.getFlag())) {
|
||||
return ResponseMessage.error("无权查看!");
|
||||
}
|
||||
if (!"1".equals(messageDTO.getFlag())) {
|
||||
sysMessageService.updateFlag(userId, messageId);
|
||||
}
|
||||
return ResponseMessage.ok(messageDTO);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/static/images/{prefix}.{suffix}")
|
||||
public ResponseEntity view(@PathVariable String prefix, @PathVariable String suffix, String messageId) {
|
||||
try {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
MessageDTO messageDTO = sysMessageService.getSysMessage(messageId);
|
||||
if (messageDTO != null && "1".equals(messageDTO.getType()) && !"1".equals(sysUser.getUserType())) {
|
||||
messageDTO = sysMessageService.getSysUserMessage(sysUser.getUserId(), messageId);
|
||||
if (messageDTO == null) {
|
||||
return ResponseEntity.status(403).build();
|
||||
}
|
||||
}
|
||||
if (fsService == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
FSObject fsObject;
|
||||
try {
|
||||
fsObject = fsService.getObject(prefix);
|
||||
} catch (Exception e) {
|
||||
fsObject = null;
|
||||
}
|
||||
if (fsObject == null || !fsObject.getContentType().toLowerCase().contains(suffix.toLowerCase())) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
return ResponseEntity.ok()
|
||||
.header("Pragma", "no-cache")
|
||||
.header("Cache-Control", "no-cache")
|
||||
.header("Expires", "0")
|
||||
.header("Content-Type", fsObject.getContentType())
|
||||
.header("Content-Length", String.valueOf(fsObject.getSize()))
|
||||
.body(new InputStreamResource(fsObject.getInputStream()));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.framework.dfs.FSObject;
|
||||
import com.insigma.framework.dfs.FSService;
|
||||
import com.insigma.framework.util.IDUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.LazyTreeNode;
|
||||
import com.insigma.sys.dto.MessageDTO;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.SysMessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/8/23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/message/manage")
|
||||
public class SysMessageManageController {
|
||||
|
||||
@Autowired
|
||||
private SysMessageService sysMessageService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired(required = false)
|
||||
private FSService fsService;
|
||||
|
||||
@PostMapping("/init")
|
||||
public ResponseMessage init() {
|
||||
return ResponseMessage.ok("", IDUtil.generateUUID());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseMessage list(@RequestBody JSONObject jsonObject) throws SQLException {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
MessageDTO queryDTO = jsonObject.toJavaObject(MessageDTO.class);
|
||||
Integer page = jsonObject.getInteger("page");
|
||||
Integer size = jsonObject.getInteger("size");
|
||||
PageInfo<MessageDTO> pageInfo = sysMessageService.getSysMessageList(sysUser, queryDTO, page, size, true);
|
||||
return ResponseMessage.ok(pageInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public ResponseMessage save(@RequestBody MessageDTO messageDTO) {
|
||||
String userId = currentUserService.getCurrentUser().getUserId();
|
||||
if (ObjectUtils.isEmpty(messageDTO.getTitle())) {
|
||||
return ResponseMessage.error("消息标题不能为空!");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(messageDTO.getContent())) {
|
||||
return ResponseMessage.error("消息内容不能为空!");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(messageDTO.getType())) {
|
||||
return ResponseMessage.error("消息类型不能为空!");
|
||||
}
|
||||
if ("1".equals(messageDTO.getType())) {
|
||||
if (messageDTO.getUserIds() == null || messageDTO.getUserIds().size() == 0) {
|
||||
return ResponseMessage.error("消息通知目标不能为空!");
|
||||
}
|
||||
}
|
||||
MessageDTO message = sysMessageService.getSysMessage(messageDTO.getMessageId());
|
||||
if (message == null) {
|
||||
sysMessageService.save(userId, messageDTO);
|
||||
} else {
|
||||
sysMessageService.update(userId, messageDTO);
|
||||
}
|
||||
return ResponseMessage.ok("保存成功!");
|
||||
}
|
||||
|
||||
@GetMapping("/read")
|
||||
public ResponseMessage read(String messageId) {
|
||||
MessageDTO messageDTO = sysMessageService.getSysMessage(messageId);
|
||||
return ResponseMessage.ok(messageDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseMessage delete(@RequestBody MessageDTO messageDTO) {
|
||||
if (ObjectUtils.isEmpty(messageDTO.getMessageId())) {
|
||||
return ResponseMessage.error("消息ID不能为空!");
|
||||
}
|
||||
sysMessageService.deleteSysMessage(messageDTO.getMessageId());
|
||||
return ResponseMessage.ok("删除成功!");
|
||||
}
|
||||
|
||||
@GetMapping("/userOrgTree")
|
||||
public ResponseMessage getUserOrgTree(String parentId) {
|
||||
List<LazyTreeNode<String>> list = sysMessageService.getUserOrgTree(parentId);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping("/images")
|
||||
public ResponseMessage upload(MultipartFile file, String messageId) {
|
||||
try {
|
||||
if (fsService == null) {
|
||||
return ResponseMessage.error("未启用FS");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(file.getContentType())) {
|
||||
return ResponseMessage.error("content-type不能为空");
|
||||
}
|
||||
if (!file.getContentType().toLowerCase().contains("image")) {
|
||||
return ResponseMessage.error("图片格式不正确");
|
||||
}
|
||||
FSObject fsObject = new FSObject();
|
||||
fsObject.setName(file.getOriginalFilename());
|
||||
fsObject.setUploadDate(new Date());
|
||||
fsObject.setInputStream(file.getInputStream());
|
||||
fsObject.setContentType(file.getContentType());
|
||||
fsObject.setSize(file.getSize());
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("location", "/sys/message/static/images/" + fsService.pubObject(fsObject) + file.getContentType().substring(file.getContentType().lastIndexOf("/")).toLowerCase().replace("/", ".") + "?messageId=" + messageId);
|
||||
return ResponseMessage.ok(result);
|
||||
} catch (Exception e) {
|
||||
return ResponseMessage.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.sys.dto.SysOperateLogDTO;
|
||||
import com.insigma.sys.service.SysOperateLogService;
|
||||
import com.insigma.web.support.annotation.OdinRequest;
|
||||
import com.insigma.web.support.annotation.OdinRequestParam;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* fukq 2020/6/1
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/sysoplog")
|
||||
public class SysOpLogController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
SysOperateLogService sysOperateLogService;
|
||||
|
||||
@OdinRequest(init = true)
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(SysOperateLogDTO f_form, Integer page, Integer size) {
|
||||
tableDataQuery(f_form, page, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/doGridQuery/{name}")
|
||||
public ResponseMessage doGridQuery(@OdinRequestParam("f_form") SysOperateLogDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData_page") Integer page,
|
||||
@OdinRequestParam("t_tableData_size") Integer size,
|
||||
@PathVariable String name) {
|
||||
tableDataQuery(queryDTO, page, size);
|
||||
this.set("page", page);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@OdinRequestParam("f_form") SysOperateLogDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData") PageInfo<SysOperateLogDTO> pageInfo,
|
||||
Integer size) {
|
||||
tableDataQuery(queryDTO, 1, size);
|
||||
this.set("page", 1);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
|
||||
public void tableDataQuery(SysOperateLogDTO queryDTO, Integer page, Integer size) {
|
||||
this.pageQuery("t_tableData", () -> sysOperateLogService.querySysOperateLogList(queryDTO, page, size));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,476 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.encryption.util.SM3Utils;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.framework.util.IDCardUtil;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CommonValidator;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.UserDTO;
|
||||
import com.insigma.sys.entity.*;
|
||||
import com.insigma.sys.service.Aa26Service;
|
||||
import com.insigma.sys.service.SysOrgService;
|
||||
import com.insigma.sys.service.SysUserService;
|
||||
import com.insigma.web.support.service.CodeTypeService;
|
||||
import com.insigma.web.support.util.JavaBeanUtils;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Author: caic
|
||||
* @version: 10:40 2019/1/7
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@RestController
|
||||
@RequestMapping("/sys/user")
|
||||
@Slf4j
|
||||
public class SysUserController {
|
||||
@Autowired
|
||||
private CodeTypeService codeTypeService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private SysOrgService sysOrgService;
|
||||
|
||||
@Autowired
|
||||
private Aa26Service aa26Service;
|
||||
|
||||
@Autowired
|
||||
private CommonValidator validator;
|
||||
|
||||
Pattern patternCn = Pattern.compile("^[\u4E00-\u9FA5]+$");
|
||||
Pattern patternEn = Pattern.compile("^[A-Za-z]+$");
|
||||
Pattern patternEnCn = Pattern.compile("^[0-9a-zA-Z]+$");
|
||||
|
||||
/**
|
||||
* 初始化页面数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage initPageDate(@RequestBody JSONObject jsonObject) {
|
||||
String userType = currentUserService.getCurrentUser().getUserType();//获取当前登录用户类型
|
||||
JSONObject codeTypes = jsonObject.getJSONObject("codeTypes");
|
||||
JSONObject codeTypesRes = codeTypeService.getCodeTypes(codeTypes);
|
||||
jsonObject.put("codeTypes", codeTypesRes);
|
||||
jsonObject.put("currentUserType", userType);//设置当前登录用户类型
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户
|
||||
*
|
||||
* @param pageData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doSave")
|
||||
public ResponseMessage save(@RequestBody JSONObject pageData) {
|
||||
try {
|
||||
SysUser sysUser = JavaBeanUtils.pageElementToBean(pageData,SysUser.class);
|
||||
if (!patternEnCn.matcher(sysUser.getLogonName()).matches()) {
|
||||
throw new AppException("登录名必须是英文或数字");
|
||||
}
|
||||
if (!patternCn.matcher(sysUser.getDisplayName()).matches() && !patternEn.matcher(sysUser.getDisplayName()).matches()) {
|
||||
throw new AppException("姓名必须是中文或英文");
|
||||
}
|
||||
if ("1".equals(sysUser.getCardType()) && !IDCardUtil.verify(sysUser.getCardId())) {
|
||||
throw new AppException("身份证号码格式不正确");
|
||||
}
|
||||
if ("1".equals(sysUser.getUserType()) && !"1".equals(currentUserService.getCurrentUser().getUserType())) {
|
||||
throw new AppException("非超级管理员不能创建超级管理员");
|
||||
}
|
||||
String sm3LogonName = SM3Utils.digest(sysUser.getLogonName());
|
||||
String sm3ReverseLogonName = SM3Utils.digest(new StringBuffer(sysUser.getLogonName()).reverse().toString());
|
||||
if (sm3LogonName.equals(sysUser.getPassWD()) || sm3ReverseLogonName.equals(sysUser.getPassWD())) {
|
||||
throw new AppException("新密码不能与登录名(包含逆序)相同!");
|
||||
}
|
||||
sysUser.setUserState("1");
|
||||
JSONArray orgIds = pageData.getJSONObject("orgId").getJSONArray("value");
|
||||
if (orgIds.size() > 0)
|
||||
sysUser.setOrgId(Long.parseLong(orgIds.get(orgIds.size() - 1) + ""));
|
||||
|
||||
JSONArray aa26Ids = pageData.getJSONObject("aa26").getJSONArray("value");
|
||||
if (aa26Ids.size() > 0)
|
||||
sysUser.setAreaId(Long.parseLong(aa26Ids.get(aa26Ids.size() - 1) + ""));
|
||||
|
||||
JSONArray roleIds = pageData.getJSONObject("roleIds").getJSONArray("value");
|
||||
List<SysUserRole> list = new ArrayList<>();
|
||||
for (Object roleId : roleIds) {
|
||||
if (roleId != null) {
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setRoleId(roleId.toString());
|
||||
list.add(sysUserRole);
|
||||
}
|
||||
}
|
||||
sysUser.setSysUserRoleList(list);
|
||||
sysUser.setCreateTime(new Date());
|
||||
// 设定用户过期时间
|
||||
sysUser.setUserExpireDate(pageData.getJSONObject("userExpireDate").getDate("value"));
|
||||
// 获取密码过期策略
|
||||
String pwExpireType = (String) pageData.getJSONObject("pwExpireType").get("value");
|
||||
if (!ObjectUtils.isEmpty(pwExpireType) && pwExpireType.equals("1")) {
|
||||
// 系统配置周期
|
||||
long l = new Date().getTime() + 7 * 24 * 3600 * 1000;
|
||||
sysUser.setPwExpireDate(new Date(l));
|
||||
} else if (ObjectUtils.isEmpty(pwExpireType) || pwExpireType.equals("2")) {
|
||||
// 永不过期
|
||||
sysUser.setPwExpireDate(null);
|
||||
} else if (!ObjectUtils.isEmpty(pwExpireType) && pwExpireType.equals("3")) {
|
||||
// 指定日期
|
||||
sysUser.setPwExpireDate(pageData.getJSONObject("pwExpireDate").getDate("value"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
JSONArray areaIds = pageData.getJSONObject("aa26Tree").getJSONArray("value");
|
||||
List<String> addAreaIds = new ArrayList<>();
|
||||
List<String> removeAreaIds = new ArrayList<>();
|
||||
for (int i = 0; i < areaIds.size(); i++) {
|
||||
JSONObject obj = areaIds.getJSONObject(i);
|
||||
if ((boolean) obj.get("value")) {
|
||||
addAreaIds.add(obj.get("key").toString());
|
||||
} else {
|
||||
removeAreaIds.add(obj.get("key").toString());
|
||||
}
|
||||
}
|
||||
Map<String, List<String>> map = new ConcurrentHashMap<>();
|
||||
map.put("addAreaIds", addAreaIds);
|
||||
map.put("removeAreaIds", removeAreaIds);
|
||||
|
||||
if (!validator.validateArea(sysUser.getAreaId() + "", sysUser.getUserType())
|
||||
|| !validator.validateOrg(sysUser.getOrgId(), sysUser.getUserType())
|
||||
|| !validator.validateRoleIds(roleIds.toJavaList(String.class))) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
|
||||
sysUserService.saveUser(sysUser, map);
|
||||
|
||||
return ResponseMessage.ok("保存成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("保存失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/queryOneUser/{userId}")
|
||||
public ResponseMessage queryOneUser(@PathVariable String userId) throws AppException {
|
||||
SysUser sysUser = sysUserService.queryOneUser(userId);
|
||||
if (!validator.validateUser(sysUser.getUserId())) {
|
||||
throw new AppException("无权查看");
|
||||
}
|
||||
//sysUser.setPassWD(null);
|
||||
List<SysUserRole> roleList = sysUserService.queryUserRole(userId);
|
||||
List<SysUserArea> areaList = sysUserService.queryUserArea(userId);
|
||||
SysOrg sysOrg = sysOrgService.findByOrgid(sysUser.getOrgId());
|
||||
Aa26 aa26 = aa26Service.findByAab301(sysUser.getAreaId() + "");
|
||||
Map<String, Object> map = new ConcurrentHashMap<>();
|
||||
map.put("sysUser", sysUser);
|
||||
map.put("roleList", roleList);
|
||||
map.put("areaList", areaList);
|
||||
|
||||
if (sysOrg != null) {
|
||||
map.put("orgId", sysUser.getOrgId());
|
||||
map.put("sysOrgs",sysOrg);
|
||||
//sysOrgService.findByRegioncode(sysUser.getAreaId()+"")
|
||||
}
|
||||
if (aa26 != null)
|
||||
map.put("aa26", aa26);
|
||||
return ResponseMessage.ok(map);
|
||||
}
|
||||
|
||||
@GetMapping("/queryTable")
|
||||
public ResponseMessage queryTable(@RequestParam(name = "logonName") String logonName,
|
||||
@RequestParam(name = "displayName") String displayName,
|
||||
@RequestParam(name = "orgId") String orgId,
|
||||
@RequestParam(name = "userState") String userState,
|
||||
@RequestParam(name = "userType") String userType,
|
||||
@RequestParam(name = "aa26") String aa26,
|
||||
@RequestParam(name = "cardId") String cardId,
|
||||
@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "size") Integer size) {
|
||||
Page<UserDTO> list = sysUserService.findAll(logonName, displayName, orgId, userState,userType,aa26,cardId, page, size,"1");
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
JSONArray jsonArray=JSONArray.parseArray(JSONArray.toJSONString(list.getContent()));
|
||||
for(int i=0; i < jsonArray.size(); i++){
|
||||
if(jsonArray.getJSONObject(i).getString("orgId") != null) {
|
||||
SysOrg sysOrg = sysOrgService.findByOrgid(Long.valueOf(jsonArray.getJSONObject(i).getString("orgId")));
|
||||
if(sysOrg != null){
|
||||
jsonArray.getJSONObject(i).put("orgId", sysOrg.getOrgname());
|
||||
}else{
|
||||
jsonArray.getJSONObject(i).put("orgId", "");
|
||||
}
|
||||
}
|
||||
if(jsonArray.getJSONObject(i).getString("areaId") != null) {
|
||||
Aa26 a=aa26Service.findByAab301(jsonArray.getJSONObject(i).getString("areaId"));
|
||||
if(a != null) {
|
||||
jsonArray.getJSONObject(i).put("areaId", a.getAaa146());
|
||||
}else{
|
||||
jsonArray.getJSONObject(i).put("areaId", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
jsonObject.put("totalElements",list.getTotalElements());
|
||||
jsonObject.put("content",jsonArray);
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制用户
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/copyUser")
|
||||
public ResponseMessage copyUser(@RequestBody JSONObject data){
|
||||
try {
|
||||
if (!validator.validateUser(currentUserService.getCurrentUser().getUserId())) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.copyUser(data);
|
||||
return ResponseMessage.ok("复制成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("复制失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 注销用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/logoutUser")
|
||||
public ResponseMessage logoutUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.logoutUser(userId);
|
||||
sysUserService.clearSessions(userId);
|
||||
return ResponseMessage.ok("注销成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("注销失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/unlockUser")
|
||||
public ResponseMessage unlockUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.unlockUser(userId);
|
||||
return ResponseMessage.ok("解锁成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("解锁失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/lockUser")
|
||||
public ResponseMessage lockUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.lockUser(userId);
|
||||
sysUserService.clearSessions(userId);
|
||||
return ResponseMessage.ok("锁定成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("锁定失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/resetPassWD")
|
||||
public ResponseMessage resetPassWD(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
if (!validator.validateUser(userId)) {
|
||||
throw new AppException("无权操作");
|
||||
}
|
||||
sysUserService.resetPassWD(userId);
|
||||
// return ResponseMessage.ok("重置密码成功,默认密码为:" + resetPassWD);
|
||||
return ResponseMessage.ok("重置密码成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("重置密码失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/editPass")
|
||||
public ResponseMessage editPassWD(@RequestBody(required = true) JSONObject data){
|
||||
try {
|
||||
String oldPass=data.getString("oldPass");
|
||||
String newPass=data.getString("newPass");
|
||||
sysUserService.updataPassWD(oldPass,newPass);
|
||||
return ResponseMessage.ok("修改密码成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("修改密码失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getOrgTreeNodes/{areaId}")
|
||||
public ResponseMessage getOrgTreeNodes(@PathVariable String areaId) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.queryOrgNodes(areaId))), "orgid", "parentid", "children");
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
|
||||
@GetMapping("/getAa26TreeNodes/{userType}")
|
||||
public ResponseMessage getAa26TreeNodes(@PathVariable String userType) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.queryAa26Nodes())), "aab301", "aaa148", "children");
|
||||
//orgNodes= JSONArray.parseArray(JSONArray.toJSONString(orgNodes).replace("aab301","id"));
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
@GetMapping("/getOrgTreeNodes1/{userType}")
|
||||
public ResponseMessage getOrgTreeNodes1(@PathVariable String userType) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.findAllOrg())), "orgid", "parentid", "children");
|
||||
//orgNodes= JSONArray.parseArray(JSONArray.toJSONString(orgNodes).replace("aab301","id"));
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
@GetMapping("getUserTypeCode")
|
||||
public ResponseMessage getUserTypeCode() {
|
||||
List<Map<String, Object>> list = sysUserService.findUsetTypeCode();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("getUserStateCode")
|
||||
public ResponseMessage getUserStateCode() {
|
||||
return ResponseMessage.ok(sysUserService.getUserStateCode());
|
||||
}
|
||||
|
||||
@GetMapping("/getRoleList/{userType}")
|
||||
public ResponseMessage getRoleList(@PathVariable("userType") String userType) {
|
||||
List<SysRole> list = sysUserService.findByRoleType(userType);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping("/doCheck/{id}")
|
||||
public ResponseMessage doCheck(@PathVariable("id") String id, @RequestBody JSONObject data) {
|
||||
boolean bool = true;//校验是否通过
|
||||
if ("logonName".equals(id)) {
|
||||
String logonName = data.getJSONObject("logonName").getString("value");
|
||||
String userId=data.getJSONObject("userId").getString("value");
|
||||
bool = sysUserService.checkLogonName(logonName,userId);
|
||||
}
|
||||
if (bool) {
|
||||
ResponseMessage rm = ResponseMessage.error("存在相同登录名");
|
||||
return rm;
|
||||
} else {
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有机构
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllOrg")
|
||||
private ResponseMessage findAllOrg() {
|
||||
List<SysOrg> list = sysUserService.findAllOrg();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有区域
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllAa26")
|
||||
private ResponseMessage findAllAa26() {
|
||||
List<Aa26> list = sysOrgService.getAA26();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有机构,返回格式为树结构
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllOrgTree")
|
||||
private ResponseMessage findAllOrgTree() {
|
||||
List<SysOrg> list = sysUserService.findAllOrg();
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(list)), "orgid", "parentid", "children");
|
||||
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用获取下拉框选项
|
||||
* @param codeType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAa10Code/{codeType}")
|
||||
public ResponseMessage getAa10Code(@PathVariable String codeType){
|
||||
List<Map<String, Object>> list = sysUserService.getAa10Code(codeType);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCurrentUser")
|
||||
public ResponseMessage getCurrentUser(){
|
||||
return ResponseMessage.ok(currentUserService.getCurrentUser());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前登录用户
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUserSlevel")
|
||||
public ResponseMessage getUserSlevel(){
|
||||
|
||||
/*return ResponseMessage.ok(sysUserService.getUserSlevel());*/
|
||||
ResponseMessage t = new ResponseMessage();
|
||||
t.setStatus("0");
|
||||
t.setData(sysUserService.getUserSlevel());
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.exception.AppException;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.common.SysManageMode;
|
||||
import com.insigma.sys.dto.UserDTO;
|
||||
import com.insigma.sys.entity.*;
|
||||
import com.insigma.sys.service.Aa26Service;
|
||||
import com.insigma.sys.service.SysOrgService;
|
||||
import com.insigma.sys.service.SysUserService;
|
||||
import com.insigma.web.support.service.CodeTypeService;
|
||||
import com.insigma.web.support.util.JavaBeanUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sys/usertms")
|
||||
@Slf4j
|
||||
public class SysUsertmsController {
|
||||
@Autowired
|
||||
private CodeTypeService codeTypeService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private SysOrgService sysOrgService;
|
||||
|
||||
@Autowired
|
||||
private Aa26Service aa26Service;
|
||||
|
||||
/**
|
||||
* 初始化页面数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage initPageDate(@RequestBody JSONObject jsonObject) {
|
||||
String userType = currentUserService.getCurrentUser().getUserType();//获取当前登录用户类型
|
||||
JSONObject codeTypes = jsonObject.getJSONObject("codeTypes");
|
||||
JSONObject codeTypesRes = codeTypeService.getCodeTypes(codeTypes);
|
||||
jsonObject.put("codeTypes", codeTypesRes);
|
||||
jsonObject.put("currentUserType", userType);//设置当前登录用户类型
|
||||
return ResponseMessage.ok(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户
|
||||
*
|
||||
* @param pageData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doSave")
|
||||
public ResponseMessage save(@RequestBody JSONObject pageData) {
|
||||
try {
|
||||
SysUser sysUser = JavaBeanUtils.pageElementToBean(pageData,SysUser.class);
|
||||
sysUser.setUserState("1");
|
||||
JSONArray orgIds = pageData.getJSONObject("orgId").getJSONArray("value");
|
||||
if (orgIds.size() > 0)
|
||||
sysUser.setOrgId(Long.parseLong(orgIds.get(orgIds.size() - 1) + ""));
|
||||
|
||||
JSONArray aa26Ids = pageData.getJSONObject("aa26").getJSONArray("value");
|
||||
if (aa26Ids.size() > 0)
|
||||
sysUser.setAreaId(Long.parseLong(aa26Ids.get(aa26Ids.size() - 1) + ""));
|
||||
|
||||
if(!SysManageMode.isTripleMode()){//不是三员制
|
||||
JSONArray roleIds = pageData.getJSONObject("roleIds").getJSONArray("value");
|
||||
List<SysUserRole> list = new ArrayList<>();
|
||||
for (Object roleId : roleIds) {
|
||||
if (roleId != null) {
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setRoleId(roleId.toString());
|
||||
list.add(sysUserRole);
|
||||
}
|
||||
}
|
||||
sysUser.setSysUserRoleList(list);
|
||||
}
|
||||
JSONArray areaIds = pageData.getJSONObject("aa26Tree").getJSONArray("value");
|
||||
List<String> addAreaIds = new ArrayList<>();
|
||||
List<String> removeAreaIds = new ArrayList<>();
|
||||
for (int i = 0; i < areaIds.size(); i++) {
|
||||
JSONObject obj = (JSONObject) areaIds.get(i);
|
||||
if ((boolean) obj.get("value")) {
|
||||
addAreaIds.add(obj.get("key").toString());
|
||||
} else {
|
||||
removeAreaIds.add(obj.get("key").toString());
|
||||
}
|
||||
}
|
||||
Map<String, List<String>> map = new ConcurrentHashMap<>();
|
||||
map.put("addAreaIds", addAreaIds);
|
||||
map.put("removeAreaIds", removeAreaIds);
|
||||
|
||||
sysUserService.saveUser(sysUser, map);
|
||||
ResponseMessage rm = ResponseMessage.ok("保存成功");
|
||||
|
||||
return rm;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("保存失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/queryOneUser/{userId}")
|
||||
public ResponseMessage queryOneUser(@PathVariable String userId) throws AppException {
|
||||
SysUser sysUser = sysUserService.queryOneUser(userId);
|
||||
//sysUser.setPassWD(null);
|
||||
List<SysUserRole> roleList = sysUserService.queryUserRole(userId);
|
||||
List<SysUserArea> areaList = sysUserService.queryUserArea(userId);
|
||||
SysOrg sysOrg = sysOrgService.findByOrgid(sysUser.getOrgId());
|
||||
Aa26 aa26 = aa26Service.findByAab301(sysUser.getAreaId() + "");
|
||||
Map<String, Object> map = new ConcurrentHashMap<>();
|
||||
map.put("sysUser", sysUser);
|
||||
map.put("roleList", roleList);
|
||||
map.put("areaList", areaList);
|
||||
|
||||
if (sysOrg != null) {
|
||||
map.put("orgId", sysUser.getOrgId());
|
||||
map.put("sysOrgs",sysOrg);
|
||||
//sysOrgService.findByRegioncode(sysUser.getAreaId()+"")
|
||||
}
|
||||
if (aa26 != null)
|
||||
map.put("aa26", aa26);
|
||||
return ResponseMessage.ok(map);
|
||||
}
|
||||
|
||||
@GetMapping("/queryTable")
|
||||
public ResponseMessage queryTable(@RequestParam(name = "logonName") String logonName,
|
||||
@RequestParam(name = "displayName") String displayName,
|
||||
@RequestParam(name = "orgId") String orgId,
|
||||
@RequestParam(name = "userState") String userState,
|
||||
@RequestParam(name = "userType") String userType,
|
||||
@RequestParam(name = "aa26") String aa26,
|
||||
@RequestParam(name = "cardId") String cardId,
|
||||
@RequestParam(name = "page") Integer page,
|
||||
@RequestParam(name = "size") Integer size) {
|
||||
Page<UserDTO> list = sysUserService.findAll(logonName, displayName, orgId, userState,userType,aa26,cardId, page, size,"2");
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/logoutUser")
|
||||
public ResponseMessage logoutUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
sysUserService.logoutUser(userId);
|
||||
return ResponseMessage.ok("注销成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("注销失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/unlockUser")
|
||||
public ResponseMessage unlockUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
sysUserService.unlockUser(userId);
|
||||
return ResponseMessage.ok("解锁成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("解锁失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁定用户
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/lockUser")
|
||||
public ResponseMessage lockUser(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
sysUserService.lockUser(userId);
|
||||
return ResponseMessage.ok("锁定成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("锁定失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/resetPassWD")
|
||||
public ResponseMessage resetPassWD(@RequestBody(required = true) JSONObject data) {
|
||||
try {
|
||||
String userId = data.getString("userId");
|
||||
sysUserService.resetPassWD(userId);
|
||||
return ResponseMessage.ok("重置密码成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("重置密码失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/editPass")
|
||||
public ResponseMessage editPassWD(@RequestBody(required = true) JSONObject data){
|
||||
try {
|
||||
String oldPass=data.getString("oldPass");
|
||||
String newPass=data.getString("newPass");
|
||||
sysUserService.updataPassWD(oldPass,newPass);
|
||||
return ResponseMessage.ok("修改密码成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return ResponseMessage.error("修改密码失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getOrgTreeNodes/{areaId}")
|
||||
public ResponseMessage getOrgTreeNodes(@PathVariable String areaId) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.queryOrgNodes(areaId))), "orgid", "parentid", "children");
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
|
||||
@GetMapping("/getAa26TreeNodes/{userType}")
|
||||
public ResponseMessage getAa26TreeNodes(@PathVariable String userType) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.queryAa26Nodes())), "aab301", "aaa148", "children");
|
||||
//orgNodes= JSONArray.parseArray(JSONArray.toJSONString(orgNodes).replace("aab301","id"));
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
@GetMapping("/getOrgTreeNodes1/{userType}")
|
||||
public ResponseMessage getOrgTreeNodes1(@PathVariable String userType) {
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(sysUserService.findAllOrg())), "orgid", "parentid", "children");
|
||||
//orgNodes= JSONArray.parseArray(JSONArray.toJSONString(orgNodes).replace("aab301","id"));
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
@GetMapping("getUserTypeCode")
|
||||
public ResponseMessage getUserTypeCode() {
|
||||
List<Map<String, Object>> list = sysUserService.findUsetTypeCode();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("getSlevel")
|
||||
public ResponseMessage getSlevel() {
|
||||
List<Map<String, Object>> list = sysUserService.findSlevel();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("getUserStateCode")
|
||||
public ResponseMessage getUserStateCode() {
|
||||
return ResponseMessage.ok(sysUserService.getUserStateCode());
|
||||
}
|
||||
|
||||
@GetMapping("/getRoleList/{userType}")
|
||||
public ResponseMessage getRoleList(@PathVariable("userType") String userType) {
|
||||
List<SysRole> list = sysUserService.findByRoleType(userType);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping("/doCheck/{id}")
|
||||
public ResponseMessage doCheck(@PathVariable("id") String id, @RequestBody JSONObject data) {
|
||||
boolean bool = true;//校验是否通过
|
||||
if ("logonName".equals(id)) {
|
||||
String logonName = data.getJSONObject("logonName").getString("value");
|
||||
String userId=data.getJSONObject("userId").getString("value");
|
||||
bool = sysUserService.checkLogonName(logonName,userId);
|
||||
}
|
||||
if (bool) {
|
||||
ResponseMessage rm = ResponseMessage.error("存在相同登录名");
|
||||
return rm;
|
||||
} else {
|
||||
return ResponseMessage.ok();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有机构
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllOrg")
|
||||
private ResponseMessage findAllOrg() {
|
||||
List<SysOrg> list = sysUserService.findAllOrg();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有区域
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllAa26")
|
||||
private ResponseMessage findAllAa26() {
|
||||
List<Aa26> list = sysOrgService.getAA26();
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有机构,返回格式为树结构
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findAllOrgTree")
|
||||
private ResponseMessage findAllOrgTree() {
|
||||
List<SysOrg> list = sysUserService.findAllOrg();
|
||||
JSONArray orgNodes = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(list)), "orgid", "parentid", "children");
|
||||
|
||||
return ResponseMessage.ok(orgNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用获取下拉框选项
|
||||
* @param codeType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAa10Code/{codeType}")
|
||||
public ResponseMessage getAa10Code(@PathVariable String codeType){
|
||||
List<Map<String, Object>> list = sysUserService.getAa10Code(codeType);
|
||||
return ResponseMessage.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCurrentUser")
|
||||
public ResponseMessage getCurrentUser(){
|
||||
return ResponseMessage.ok(currentUserService.getCurrentUser());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.db.PageInfo;
|
||||
import com.insigma.sys.dto.SysLogonLogDTO;
|
||||
import com.insigma.sys.service.SyslogonLogService;
|
||||
import com.insigma.web.support.annotation.OdinRequest;
|
||||
import com.insigma.web.support.annotation.OdinRequestParam;
|
||||
import com.insigma.web.support.controller.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* fukq 2020/6/2
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/syslogonlog")
|
||||
public class SyslogonLogController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
SyslogonLogService syslogonLogService;
|
||||
|
||||
@OdinRequest(init = true)
|
||||
@PostMapping("/doInit")
|
||||
public ResponseMessage doInit(SysLogonLogDTO f_form, Integer page, Integer size) {
|
||||
tableDataQuery(f_form, page, size);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/doGridQuery/{name}")
|
||||
public ResponseMessage doGridQuery(@OdinRequestParam("f_form") SysLogonLogDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData_page") Integer page,
|
||||
@OdinRequestParam("t_tableData_size") Integer size,
|
||||
@PathVariable String name) {
|
||||
tableDataQuery(queryDTO, page, size);
|
||||
this.set("page", page);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@OdinRequest
|
||||
@PostMapping("/query")
|
||||
public ResponseMessage query(@OdinRequestParam("f_form") SysLogonLogDTO queryDTO,
|
||||
@OdinRequestParam("t_tableData") PageInfo<SysLogonLogDTO> pageInfo,
|
||||
Integer size) {
|
||||
tableDataQuery(queryDTO, 1, size);
|
||||
this.set("page", 1);
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
|
||||
public void tableDataQuery(SysLogonLogDTO queryDTO, Integer page, Integer size) {
|
||||
this.pageQuery("t_tableData", () -> syslogonLogService.querySysLogonList(queryDTO, page, size));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class SystemConfigController {
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@GetMapping("/getSystemPeiz")
|
||||
public ResponseMessage getSystemPeiz() {
|
||||
String sql="select aaa001,aaa005 from aa01 where aaa001 in('logo_url','sidebar_backgroundImage','home_image','sidebar_title','sidebar_color'\n" +
|
||||
",'home_title','login_title')";
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
jdbcTemplate.query(sql, (rs, i) -> {
|
||||
map.put(rs.getString("aaa001"), rs.getString("aaa005"));
|
||||
return map;
|
||||
});
|
||||
return ResponseMessage.ok(map);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.insigma.sys.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.insigma.framework.ResponseMessage;
|
||||
import com.insigma.framework.util.TreeUtil;
|
||||
import com.insigma.sys.common.CurrentUserService;
|
||||
import com.insigma.sys.dto.MenuDTO;
|
||||
import com.insigma.sys.entity.SysUser;
|
||||
import com.insigma.sys.service.MenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2019/3/15.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/usermenu")
|
||||
public class UserMenuController {
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private CurrentUserService currentUserService;
|
||||
|
||||
@GetMapping("/getMenuList")
|
||||
public ResponseMessage getMenuList() {
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
List<MenuDTO> menuDTOS = menuService.getMenuList(sysUser);
|
||||
JSONArray jsonArray = TreeUtil.listToTree(JSONArray.parseArray(JSONArray.toJSONString(menuDTOS)), "functionid", "parentid", "children", "0");
|
||||
return ResponseMessage.ok("查询成功", jsonArray);
|
||||
}
|
||||
|
||||
@GetMapping("/getButtonAuthList")
|
||||
public ResponseMessage getButtonList(String location) {
|
||||
if (ObjectUtils.isEmpty(location)) {
|
||||
return ResponseMessage.error("location不能为空!");
|
||||
}
|
||||
SysUser sysUser = currentUserService.getCurrentUser();
|
||||
List<String> buttonAuthList = menuService.getButtonAuthList(sysUser, location);
|
||||
return ResponseMessage.ok(buttonAuthList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.insigma.sys.entity.Aa10;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2019/1/9.
|
||||
*/
|
||||
@Data
|
||||
public class CodeDTO implements Serializable {
|
||||
|
||||
private Long total;
|
||||
|
||||
private List<Aa10> data;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/2/23
|
||||
*/
|
||||
@Data
|
||||
public class FeedbackAnswerDTO implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String content;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String displayName;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String type;
|
||||
|
||||
private String feedbackId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.insigma.sys.entity.SysFeedbackAnswer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2022/2/23
|
||||
*/
|
||||
@Data
|
||||
public class FeedbackDTO implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String displayName;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String answered;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private List<Date> dateRange;
|
||||
|
||||
List<FeedbackAnswerDTO> answerList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.insigma.web.support.dto.ImportConfigDTO;
|
||||
import com.insigma.web.support.dto.ImportConfigDetailDTO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2023/7/18
|
||||
* @since 2.7.0
|
||||
*/
|
||||
@Data
|
||||
public class ImportConfigReDTO implements Serializable {
|
||||
|
||||
private ImportConfigDTO config;
|
||||
|
||||
private List<ImportConfigDetailDTO> details;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author yinjh
|
||||
* @version 2021/8/23
|
||||
*/
|
||||
@Data
|
||||
public class LazyTreeNode<T> implements Serializable {
|
||||
|
||||
private T id;
|
||||
|
||||
private String label;
|
||||
|
||||
private T parent;
|
||||
|
||||
private Boolean isLeaf;
|
||||
|
||||
private Object extra;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class MenuDTO implements Serializable {
|
||||
private long functionid; //功能ID
|
||||
private String path;//链接
|
||||
private String title;//标题
|
||||
private long parentid;//父功能ID
|
||||
private String icon;//节点图标
|
||||
private int funorder;//排序号
|
||||
private String nodetype;//节点类型:1-菜单节点,2-菜单叶子
|
||||
private String description; // 功能描述
|
||||
private String appid;//所属应用系统
|
||||
private String openmode;//打开模式:1-tab页打开,2-浏览器tab页打开
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2020/6/15.
|
||||
*/
|
||||
@Data
|
||||
public class MessageDTO implements Serializable {
|
||||
|
||||
private String messageId;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
private String creator;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String flag; // 0:未读,1:已读
|
||||
|
||||
private List<String> userIds;
|
||||
|
||||
private Date startDate;
|
||||
|
||||
private Date endDate;
|
||||
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @ClassName: MonitorCentersDTO
|
||||
* @Description:
|
||||
* @version 2021/12/7 15:49
|
||||
*/
|
||||
@Data
|
||||
public class MonitorCentersDTO implements Serializable {
|
||||
private String ip;
|
||||
private String appName;
|
||||
private String timeStart;
|
||||
private String timeEnd;
|
||||
private String start;
|
||||
private String rows;
|
||||
private String uriFieldName;
|
||||
private String sessionFieldName;
|
||||
private String sqlFieldName;
|
||||
private String sort;
|
||||
|
||||
private String appId;
|
||||
private String title;
|
||||
private String company;
|
||||
private Date ctime;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.insigma.sys.entity.SysOrg;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2019/1/4
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Data
|
||||
public class OrgDTO extends SysOrg {
|
||||
|
||||
/**
|
||||
* 机构险种编码集合
|
||||
*/
|
||||
private List<String> instypes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by zxy on 2019/1/7.
|
||||
*/
|
||||
@Data
|
||||
public class RoleDTO implements Serializable {
|
||||
private String rolename;
|
||||
private String roledesc;
|
||||
private String roletype;
|
||||
private int orgid;
|
||||
private int areaid;
|
||||
private String creatorid;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author tanyj
|
||||
* @Version 2022/8/22 17:13
|
||||
* @since 2.7.0
|
||||
**/
|
||||
@Data
|
||||
public class ScmMyFavoritesDTO {
|
||||
|
||||
private String id;
|
||||
|
||||
private Integer functionId;
|
||||
|
||||
private String functionRoutePath;
|
||||
|
||||
private String userid;
|
||||
|
||||
private Date favorTime;
|
||||
|
||||
private Integer orderNo;
|
||||
|
||||
private String title;
|
||||
|
||||
private Boolean tableDelFlag;
|
||||
|
||||
private String icon;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @version 2022/3/28
|
||||
* @since 2.6.5
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SysAppAddressDTO implements Serializable {
|
||||
private String addressId;
|
||||
private String portalUrl;
|
||||
private String appUrl;
|
||||
private String appId;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @version 2022/3/28
|
||||
* @since 2.6.5
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SysAppDTO implements Serializable {
|
||||
private String appId;
|
||||
private String appCode;
|
||||
private String appName;
|
||||
private Long orderNo;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private String active;
|
||||
private String secretKey;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @ClassName: SysDownloadCenterDTO
|
||||
* @Description:
|
||||
* @version 2021/8/4 10:11
|
||||
*/
|
||||
@Data
|
||||
public class SysDownloadCenterDTO implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
//材料名称
|
||||
private String material_name;
|
||||
|
||||
//材料类型
|
||||
private String material_type;
|
||||
|
||||
//材料大小
|
||||
private String material_size;
|
||||
|
||||
//上传时间
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date upload_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@Data
|
||||
public class SysErrorDTO {
|
||||
private String id;
|
||||
private String serviceName;
|
||||
private String functionName;
|
||||
private String errorCode;
|
||||
private String message;
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class SysFunctionDocDTO {
|
||||
|
||||
private long functionid;
|
||||
private String overview;
|
||||
private String detailed_view;
|
||||
private Date update_time;
|
||||
private String update_name;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SysGuideDTO implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String question_name;
|
||||
|
||||
private String question_type;
|
||||
|
||||
private String answer_type;
|
||||
|
||||
private String answer_content;
|
||||
|
||||
private String link_url;
|
||||
|
||||
//@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date create_time;
|
||||
|
||||
//热度
|
||||
private long hot_count;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@Data
|
||||
public class SysLogonLogDTO {
|
||||
|
||||
private String logonlogid;
|
||||
private String userid;
|
||||
private String logonip;
|
||||
private Date logontime;
|
||||
private Date logofftime;
|
||||
private String successflag = "1";
|
||||
private String failreason;
|
||||
private String logoffreason;
|
||||
private String sessionid;
|
||||
private String logonname;
|
||||
private String displayname;
|
||||
private String opDate;
|
||||
private String browser;
|
||||
private String os;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SysOperateLogDTO {
|
||||
private String operatelogid;
|
||||
private String userid;
|
||||
private String logonlogid;
|
||||
private String logonip;
|
||||
private String operate;
|
||||
private String url;
|
||||
private Date begintime;
|
||||
private Date endtime;
|
||||
private String functionid;
|
||||
private String description;
|
||||
private String logonname;
|
||||
private String displayname;
|
||||
private String title;
|
||||
private String opDate;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
|
||||
import com.insigma.sys.entity.SysRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2019/1/9.
|
||||
*/
|
||||
public class SysRoleDTO {
|
||||
private Long total;
|
||||
private List<SysRole> data;
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<SysRole> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<SysRole> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2019/1/7
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Data
|
||||
public class TreeNode<T> implements Serializable {
|
||||
|
||||
private T id;
|
||||
private String label;
|
||||
private List<TreeNode<T>> children;
|
||||
private T parent;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.insigma.sys.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* @Author: caic
|
||||
* @version: 16:15 2019/1/11
|
||||
* @Description:
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="sysuser")
|
||||
@Data
|
||||
public class UserDTO {
|
||||
@Id
|
||||
private String userId;
|
||||
private String logonName;
|
||||
private String displayName;
|
||||
private Long orgId;
|
||||
private String userState;
|
||||
private String userType;
|
||||
private String areaId;
|
||||
private String cardType;
|
||||
private String cardId;
|
||||
private String tel;
|
||||
private String visible;
|
||||
|
||||
// @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
// @JoinColumn(name = "userType",referencedColumnName="aaa102",insertable=false,updatable=false)
|
||||
// private Aa10 userTypeCode;
|
||||
|
||||
// @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
// @JoinColumn(name = "userState",referencedColumnName="aaa102")
|
||||
// private Aa10 userStateCode;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.insigma.sys.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by yinjh on 2019/1/9.
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "AA10")
|
||||
public class Aa10 implements Serializable {
|
||||
|
||||
@Id
|
||||
//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SQ_AAZ093")
|
||||
// @SequenceGenerator(name = "sq_aaz093", sequenceName = "sq_aaz093", allocationSize = 1)
|
||||
/*@TableGenerator(name = "sq_aaz093",
|
||||
table = "sys_sequence",
|
||||
pkColumnName = "sequence_name",
|
||||
valueColumnName = "sequence_next_value",
|
||||
pkColumnValue = "sq_aaz093",
|
||||
allocationSize = 1)
|
||||
@GeneratedValue(strategy = GenerationType.TABLE, generator = "sq_aaz093")*/
|
||||
@GenericGenerator( name="sq_aaz093", strategy="com.insigma.framework.db.generator.TableOrSequenceGenerator",
|
||||
parameters = {
|
||||
@Parameter( name = "table_name", value = "sys_sequence"),
|
||||
@Parameter( name = "value_column_name", value = "sequence_next_value"),
|
||||
@Parameter( name = "segment_column_name",value = "sequence_name"),
|
||||
@Parameter( name = "segment_value", value = "sq_aaz093"),
|
||||
@Parameter( name = "increment_size", value = "10"),
|
||||
@Parameter( name = "optimizer",value = "pooled-lo")
|
||||
})
|
||||
@GeneratedValue(generator="sq_aaz093")
|
||||
private Long aaz093;
|
||||
|
||||
private String aaa100;
|
||||
|
||||
private String aaa102;
|
||||
|
||||
private String aaa103;
|
||||
|
||||
private String aaa105;
|
||||
|
||||
private String aae100;
|
||||
|
||||
private String aaa104;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.insigma.sys.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jinw
|
||||
* @version 2019/1/8
|
||||
* <p>epsoft - insiis7</p>
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
public class Aa26 implements Serializable {
|
||||
|
||||
@Id
|
||||
private String aab301;
|
||||
private String aaa146;
|
||||
private String aaa147;
|
||||
private String aaa148;
|
||||
private String eae037;
|
||||
private String idpath;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.insigma.sys.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author tanyj
|
||||
* @Version 2022/8/22 17:13
|
||||
* @since 2.7.0
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name = "SCM_MY_FAVORITES")
|
||||
public class ScmMyFavorites implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
private String id;
|
||||
|
||||
@Column(name = "FUNCTIONID")
|
||||
private int functionId;
|
||||
|
||||
@Column(name = "FUNCTION_ROUTE_PATH")
|
||||
private String functionRoutePath;
|
||||
|
||||
@Column(name = "USERID")
|
||||
private String userid;
|
||||
|
||||
@Column(name = "FAVOR_TIME")
|
||||
private Date favorTime;
|
||||
|
||||
@Column(name = "ORDER_NO")
|
||||
private int orderNo;
|
||||
|
||||
@Column(name = "TITLE")
|
||||
private String title;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.insigma.sys.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 应用表
|
||||
*
|
||||
* @author yinjh
|
||||
* @version 2022/3/28
|
||||
* @since 2.6.5
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "SYSAPP")
|
||||
@Entity
|
||||
public class SysApp {
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
@Id
|
||||
@GenericGenerator(name="idGenerator",strategy = "uuid")
|
||||
@GeneratedValue(generator = "idGenerator")
|
||||
@Column(name = "APP_ID")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 应用编码
|
||||
*/
|
||||
@Column(name = "APP_CODE")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
@Column(name = "APP_NAME")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
@Column(name = "ORDER_NO")
|
||||
private Long orderNo;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "CREATE_TIME")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Column(name = "UPDATE_TIME")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 是否有效,1:有效,0:无效
|
||||
*/
|
||||
@Column(name = "ACTIVE")
|
||||
private String active;
|
||||
|
||||
/**
|
||||
* 应用安全key
|
||||
*/
|
||||
@Column(name = "SECRET_KEY")
|
||||
private String secretKey;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.insigma.sys.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 应用地址配置表
|
||||
*
|
||||
* @author yinjh
|
||||
* @version 2022/3/28
|
||||
* @since 2.6.5
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "SYSAPPADDRESS")
|
||||
@Entity
|
||||
public class SysAppAddress {
|
||||
|
||||
/**
|
||||
* 应用地址ID
|
||||
*/
|
||||
@Id
|
||||
@GenericGenerator(name="idGenerator",strategy = "uuid")
|
||||
@GeneratedValue(generator = "idGenerator")
|
||||
@Column(name = "ADDRESS_ID")
|
||||
private String addressId;
|
||||
|
||||
/**
|
||||
* 门户地址
|
||||
*/
|
||||
@Column(name = "PORTAL_URL")
|
||||
private String portalUrl;
|
||||
|
||||
/**
|
||||
* 应用地址
|
||||
*/
|
||||
@Column(name = "APP_URL")
|
||||
private String appUrl;
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
@Column(name = "APP_ID")
|
||||
private String appId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.insigma.sys.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GH
|
||||
* @ClassName: SysDownloadCenter
|
||||
* @Description: 下载中心实体类
|
||||
* @version 2021/8/4 9:53
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="SYSDOWNLOADCENTER")
|
||||
@Data
|
||||
public class SysDownloadCenter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
//材料名称
|
||||
private String material_name;
|
||||
|
||||
//材料类型
|
||||
private String material_type;
|
||||
|
||||
//材料大小
|
||||
private String material_size;
|
||||
|
||||
//上传时间
|
||||
private Date upload_time;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user