重新初始化项目

This commit is contained in:
bo.wu@finesys.com.cn 2025-12-15 11:20:18 +08:00
commit 83e6421559
1857 changed files with 439993 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

47
.gitignore vendored Normal file
View File

@ -0,0 +1,47 @@
######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### JRebel ###
rebel.xml
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml

201
LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2022 tony Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

36
README.en.md Normal file
View File

@ -0,0 +1,36 @@
# rz_wms
#### Description
日照港仓储管理系统
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

42
README.md Normal file
View File

@ -0,0 +1,42 @@
# rz_wms
#### 介绍
日照港仓储管理系统
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
# nohup java -jar rzg.jar > /dev/null 2 > out.log &
# nginx 启动配置文件需全路径

12
bin/clean.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 清理工程target生成路径。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean
pause

12
bin/package.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 打包Web工程生成war/jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean package -Dmaven.test.skip=true
pause

14
bin/run.bat Normal file
View File

@ -0,0 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Web工程。
echo.
cd %~dp0
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% ruoyi-admin.jar
cd bin
pause

View File

@ -0,0 +1,103 @@
若依系统开发环境搭建手册
1. 准备工作
1.1 前置环境准备 -- -- 安装Maven
若依基于Maven管理项目的构建需要先安装好相应的版本。
1.2 开发工具
若依系统采用Eclipse作为开发工具。但不局限于Eclipse。此处仅介绍在Eclipse搭建开发环境所需的操作。
2. 开发环境搭建
2.1 开发工具的配置
2.1.1 配置Maven
进入Window->Preferences->Maven->Installations页面设置已经安装好的Maven
2.1.2 配置Maven仓库路径
进入Window->Preferences->Maven->User Settings页面配置仓库路径
2.1.4 关闭校验
进入Window->Preferences->Validation页面勾选"Suspend all validators",关闭校验
2.2 导入工程
通过Eclipse导入工程步骤如下
(1)点击左侧项目区域 -- >Import...
(2)选择RuoYi
(3)点击Finish
(4)RuoYi的代码就被导出到Eclipse中了此时可以在工程视图中看到。
3. 运行若依系统
3.1 必要的配置
3.1.1 修改数据库连接
编辑src/main/ resources目录下的application-druid.yml 文件,修改数据库地址账号信息。
执行sql/ ry_20180423.sqlquartz.sql 两个文件 日期随版本变化
3.1.2 开发环境配置
编辑src/main/ resources目录下的application.yml 文件,
默认端口为80
3.1.3 代码生成配置
编辑src/main/ resources目录下的application.yml 文件,
默认为module根据实际情况修改即可。生成的表要有注释
如对模板有特殊需求可自行修改。编辑src/main/ resources/templates/vm目录下
3.1.4 日志配置
编辑src/main/ resources目录下的logback.yml 文件
<property name="log.path" value="/home/ruoyi/logs" />
改为自己需要的路径
3.2 启动及验证(后台)
启动RuoYiApplication.java 出现如下图表示启动成功
打开浏览器输入http://localhost:8080/captchaImage
若能正确显示返回信息,搭建后台成功。
3.3 启动及验证(前台)
# 进入项目目录
cd ruoyi-ui
npm install --registry=https://registry.npm.taobao.org
npm run dev
打开浏览器输入http://localhost:80 (默认账户 admin/admin123
若能正确展示登录页面,并能成功登录,菜单及页面展示正常,则表明环境搭建成功
注意执行npm命令需要配置node环境
4. 部署若依系统
4.1 war部署方式
4.1.1 修改pom.xml文件。将jar修改为war
如果是分模块需要修改ruoyi-admin
4.1.2 在spring-boot-starter依赖中移除tomcat模块
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
4.1.3 部署到tomcat的webapps目录下面
默认为RuoYi.war
4.1.4 启动及验证
运行startup.bat 出现如下图即部署成功
4.2 Jar方式部署
执行命令java - jar RuoYi.jar
脚本执行ry.sh start 启动stop 停止
4.2 前端部署
# 打包正式环境
npm run build:prod
# 打包预发布环境
npm run build:stage
构建打包成功之后,会在根目录生成 dist 文件夹,里面就是构建打包好的文件,通常是 ***.js 、***.css、index.html 等静态文件。发布到你的 nginx 或者静态服务器即可,其中的 index.html 是后台服务的入口页面。
演示地址ruoyi.vip
文档地址doc.ruoyi.vip

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "rz_wms",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}

248
pom.xml Normal file
View File

@ -0,0 +1,248 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zbf</groupId>
<artifactId>zbf</artifactId>
<version>3.8.7</version>
<name>zbf</name>
<url>http://www.rzport.com/</url>
<description>日照港仓储管理系统</description>
<properties>
<zbf.version>3.8.7</zbf.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.20</druid.version>
<bitwalker.version>1.21</bitwalker.version>
<swagger.version>3.0.0</swagger.version>
<kaptcha.version>2.3.3</kaptcha.version>
<pagehelper.boot.version>1.4.7</pagehelper.boot.version>
<fastjson.version>2.0.43</fastjson.version>
<oshi.version>6.4.13</oshi.version>
<commons.io.version>2.13.0</commons.io.version>
<poi.version>4.1.2</poi.version>
<velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version>
<flowable.version>6.7.2</flowable.version>
<mybatis-plus-version>3.4.2</mybatis-plus-version>
<lombok.version>1.18.12</lombok.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.5.15</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 阿里数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- 解析客户端操作系统、浏览器等 -->
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>${bitwalker.version}</version>
</dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- 获取系统信息 -->
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>${oshi.version}</version>
</dependency>
<!-- Swagger3依赖 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<!-- velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- Token生成与解析-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jwt.version}</version>
</dependency>
<!-- 验证码 -->
<dependency>
<groupId>pro.fessional</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-quartz</artifactId>
<version>${zbf.version}</version>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-generator</artifactId>
<version>${zbf.version}</version>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-framework</artifactId>
<version>${zbf.version}</version>
</dependency>
<!-- 系统模块-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-system</artifactId>
<version>${zbf.version}</version>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-common</artifactId>
<version>${zbf.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus-version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>zbf-admin</module>
<module>zbf-framework</module>
<module>zbf-system</module>
<module>zbf-quartz</module>
<module>zbf-generator</module>
<module>zbf-common</module>
</modules>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

67
ry.bat Normal file
View File

@ -0,0 +1,67 @@
@echo off
rem jar平级目录
set AppName=ruoyi-admin.jar
rem JVM参数
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
ECHO.
ECHO. [1] 启动%AppName%
ECHO. [2] 关闭%AppName%
ECHO. [3] 重启%AppName%
ECHO. [4] 启动状态 %AppName%
ECHO. [5] 退 出
ECHO.
ECHO.请输入选择项目的序号:
set /p ID=
IF "%id%"=="1" GOTO start
IF "%id%"=="2" GOTO stop
IF "%id%"=="3" GOTO restart
IF "%id%"=="4" GOTO status
IF "%id%"=="5" EXIT
PAUSE
:start
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a
set image_name=%%b
)
if defined pid (
echo %%is running
PAUSE
)
start javaw %JVM_OPTS% -jar %AppName%
echo starting……
echo Start %AppName% success...
goto:eof
rem 函数stop通过jps命令查找pid并结束进程
:stop
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a
set image_name=%%b
)
if not defined pid (echo process %AppName% does not exists) else (
echo prepare to kill %image_name%
echo start kill %pid% ...
rem 根据进程IDkill进程
taskkill /f /pid %pid%
)
goto:eof
:restart
call :stop
call :start
goto:eof
:status
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a
set image_name=%%b
)
if not defined pid (echo process %AppName% is dead ) else (
echo %image_name% is running
)
goto:eof

86
ry.sh Normal file
View File

@ -0,0 +1,86 @@
#!/bin/sh
# ./ry.sh start 启动 stop 停止 restart 重启 status 状态
AppName=ruoyi-admin.jar
# JVM参数
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
APP_HOME=`pwd`
LOG_PATH=$APP_HOME/logs/$AppName.log
if [ "$1" = "" ];
then
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
exit 1
fi
if [ "$AppName" = "" ];
then
echo -e "\033[0;31m 未输入应用名 \033[0m"
exit 1
fi
function start()
{
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
if [ x"$PID" != x"" ]; then
echo "$AppName is running..."
else
nohup java $JVM_OPTS -jar $AppName > /dev/null 2>&1 &
echo "Start $AppName success..."
fi
}
function stop()
{
echo "Stop $AppName"
PID=""
query(){
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
}
query
if [ x"$PID" != x"" ]; then
kill -TERM $PID
echo "$AppName (pid:$PID) exiting..."
while [ x"$PID" != x"" ]
do
sleep 1
query
done
echo "$AppName exited."
else
echo "$AppName already stopped."
fi
}
function restart()
{
stop
sleep 2
start
}
function status()
{
PID=`ps -ef |grep java|grep $AppName|grep -v grep|wc -l`
if [ $PID != 0 ];then
echo "$AppName is running..."
else
echo "$AppName is not running..."
fi
}
case $1 in
start)
start;;
stop)
stop;;
restart)
restart;;
status)
status;;
*)
esac

3
sql/Menu.sql Normal file
View File

@ -0,0 +1,3 @@
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2288, '托盘导入', 2158, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:pallet:import', '#', 'admin', '2024-08-28 18:10:11', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2290, '供应商管理导入', 2080, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:provider:import', '#', 'admin', '2024-08-28 18:41:56', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2291, '物料管理导入', 2086, 6, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:goods:import', '#', 'admin', '2024-08-28 18:42:47', '', NULL, '');

2
sql/README.md Normal file
View File

@ -0,0 +1,2 @@
## 数据库导入说明
只需要导入tony-flowable.sql, 其它两个若依默认的SQL文件不要执行

174
sql/quartz.sql Normal file
View File

@ -0,0 +1,174 @@
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
DROP TABLE IF EXISTS QRTZ_LOCKS;
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
DROP TABLE IF EXISTS QRTZ_CALENDARS;
-- ----------------------------
-- 1、存储每一个已配置的 jobDetail 的详细信息
-- ----------------------------
create table QRTZ_JOB_DETAILS (
sched_name varchar(120) not null comment '调度名称',
job_name varchar(200) not null comment '任务名称',
job_group varchar(200) not null comment '任务组名',
description varchar(250) null comment '相关介绍',
job_class_name varchar(250) not null comment '执行任务类名称',
is_durable varchar(1) not null comment '是否持久化',
is_nonconcurrent varchar(1) not null comment '是否并发',
is_update_data varchar(1) not null comment '是否更新数据',
requests_recovery varchar(1) not null comment '是否接受恢复执行',
job_data blob null comment '存放持久化job对象',
primary key (sched_name, job_name, job_group)
) engine=innodb comment = '任务详细信息表';
-- ----------------------------
-- 2、 存储已配置的 Trigger 的信息
-- ----------------------------
create table QRTZ_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment '触发器的名字',
trigger_group varchar(200) not null comment '触发器所属组的名字',
job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键',
job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键',
description varchar(250) null comment '相关介绍',
next_fire_time bigint(13) null comment '上一次触发时间(毫秒)',
prev_fire_time bigint(13) null comment '下一次触发时间(默认为-1表示不触发',
priority integer null comment '优先级',
trigger_state varchar(16) not null comment '触发器状态',
trigger_type varchar(8) not null comment '触发器的类型',
start_time bigint(13) not null comment '开始时间',
end_time bigint(13) null comment '结束时间',
calendar_name varchar(200) null comment '日程表名称',
misfire_instr smallint(2) null comment '补偿执行的策略',
job_data blob null comment '存放持久化job对象',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, job_name, job_group) references QRTZ_JOB_DETAILS(sched_name, job_name, job_group)
) engine=innodb comment = '触发器详细信息表';
-- ----------------------------
-- 3、 存储简单的 Trigger包括重复次数间隔以及已触发的次数
-- ----------------------------
create table QRTZ_SIMPLE_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
repeat_count bigint(7) not null comment '重复的次数统计',
repeat_interval bigint(12) not null comment '重复的间隔时间',
times_triggered bigint(10) not null comment '已经触发的次数',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) engine=innodb comment = '简单触发器的信息表';
-- ----------------------------
-- 4、 存储 Cron Trigger包括 Cron 表达式和时区信息
-- ----------------------------
create table QRTZ_CRON_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
cron_expression varchar(200) not null comment 'cron表达式',
time_zone_id varchar(80) comment '时区',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) engine=innodb comment = 'Cron类型的触发器表';
-- ----------------------------
-- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型JobStore 并不知道如何存储实例的时候)
-- ----------------------------
create table QRTZ_BLOB_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
blob_data blob null comment '存放持久化Trigger对象',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) engine=innodb comment = 'Blob类型的触发器表';
-- ----------------------------
-- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围
-- ----------------------------
create table QRTZ_CALENDARS (
sched_name varchar(120) not null comment '调度名称',
calendar_name varchar(200) not null comment '日历名称',
calendar blob not null comment '存放持久化calendar对象',
primary key (sched_name, calendar_name)
) engine=innodb comment = '日历信息表';
-- ----------------------------
-- 7、 存储已暂停的 Trigger 组的信息
-- ----------------------------
create table QRTZ_PAUSED_TRIGGER_GRPS (
sched_name varchar(120) not null comment '调度名称',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
primary key (sched_name, trigger_group)
) engine=innodb comment = '暂停的触发器表';
-- ----------------------------
-- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息
-- ----------------------------
create table QRTZ_FIRED_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
entry_id varchar(95) not null comment '调度器实例id',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
instance_name varchar(200) not null comment '调度器实例名',
fired_time bigint(13) not null comment '触发的时间',
sched_time bigint(13) not null comment '定时器制定的时间',
priority integer not null comment '优先级',
state varchar(16) not null comment '状态',
job_name varchar(200) null comment '任务名称',
job_group varchar(200) null comment '任务组名',
is_nonconcurrent varchar(1) null comment '是否并发',
requests_recovery varchar(1) null comment '是否接受恢复执行',
primary key (sched_name, entry_id)
) engine=innodb comment = '已触发的触发器表';
-- ----------------------------
-- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例
-- ----------------------------
create table QRTZ_SCHEDULER_STATE (
sched_name varchar(120) not null comment '调度名称',
instance_name varchar(200) not null comment '实例名称',
last_checkin_time bigint(13) not null comment '上次检查时间',
checkin_interval bigint(13) not null comment '检查间隔时间',
primary key (sched_name, instance_name)
) engine=innodb comment = '调度器状态表';
-- ----------------------------
-- 10、 存储程序的悲观锁的信息(假如使用了悲观锁)
-- ----------------------------
create table QRTZ_LOCKS (
sched_name varchar(120) not null comment '调度名称',
lock_name varchar(40) not null comment '悲观锁名称',
primary key (sched_name, lock_name)
) engine=innodb comment = '存储的悲观锁信息表';
-- ----------------------------
-- 11、 Quartz集群实现同步机制的行锁表
-- ----------------------------
create table QRTZ_SIMPROP_TRIGGERS (
sched_name varchar(120) not null comment '调度名称',
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数',
str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数',
str_prop_3 varchar(512) null comment 'String类型的trigger的第三个参数',
int_prop_1 int null comment 'int类型的trigger的第一个参数',
int_prop_2 int null comment 'int类型的trigger的第二个参数',
long_prop_1 bigint null comment 'long类型的trigger的第一个参数',
long_prop_2 bigint null comment 'long类型的trigger的第二个参数',
dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个参数',
dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个参数',
bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个参数',
bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个参数',
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
) engine=innodb comment = '同步机制的行锁表';
commit;

700
sql/ry_20231130.sql Normal file
View File

@ -0,0 +1,700 @@
-- ----------------------------
-- 1、部门表
-- ----------------------------
drop table if exists sys_dept;
create table sys_dept (
dept_id bigint(20) not null auto_increment comment '部门id',
parent_id bigint(20) default 0 comment '父部门id',
ancestors varchar(50) default '' comment '祖级列表',
dept_name varchar(30) default '' comment '部门名称',
order_num int(4) default 0 comment '显示顺序',
leader varchar(20) default null comment '负责人',
phone varchar(11) default null comment '联系电话',
email varchar(50) default null comment '邮箱',
status char(1) default '0' comment '部门状态0正常 1停用',
del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (dept_id)
) engine=innodb auto_increment=200 comment = '部门表';
-- ----------------------------
-- 初始化-部门表数据
-- ----------------------------
insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null);
-- ----------------------------
-- 2、用户信息表
-- ----------------------------
drop table if exists sys_user;
create table sys_user (
user_id bigint(20) not null auto_increment comment '用户ID',
dept_id bigint(20) default null comment '部门ID',
user_name varchar(30) not null comment '用户账号',
nick_name varchar(30) not null comment '用户名称',
user_type varchar(2) default '00' comment '用户类型00系统用户',
email varchar(50) default '' comment '用户邮箱',
phonenumber varchar(11) default '' comment '手机号码',
sex char(1) default '0' comment '用户性别0男 1女 2未知',
avatar varchar(100) default '' comment '头像地址',
password varchar(100) default '' comment '密码',
status char(1) default '0' comment '帐号状态0正常 1停用',
del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除',
login_ip varchar(128) default '' comment '最后登录IP',
login_date datetime comment '最后登录时间',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (user_id)
) engine=innodb auto_increment=100 comment = '用户信息表';
-- ----------------------------
-- 初始化-用户信息表数据
-- ----------------------------
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '管理员');
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '测试员');
-- ----------------------------
-- 3、岗位信息表
-- ----------------------------
drop table if exists sys_post;
create table sys_post
(
post_id bigint(20) not null auto_increment comment '岗位ID',
post_code varchar(64) not null comment '岗位编码',
post_name varchar(50) not null comment '岗位名称',
post_sort int(4) not null comment '显示顺序',
status char(1) not null comment '状态0正常 1停用',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (post_id)
) engine=innodb comment = '岗位信息表';
-- ----------------------------
-- 初始化-岗位信息表数据
-- ----------------------------
insert into sys_post values(1, 'ceo', '董事长', 1, '0', 'admin', sysdate(), '', null, '');
insert into sys_post values(2, 'se', '项目经理', 2, '0', 'admin', sysdate(), '', null, '');
insert into sys_post values(3, 'hr', '人力资源', 3, '0', 'admin', sysdate(), '', null, '');
insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', sysdate(), '', null, '');
-- ----------------------------
-- 4、角色信息表
-- ----------------------------
drop table if exists sys_role;
create table sys_role (
role_id bigint(20) not null auto_increment comment '角色ID',
role_name varchar(30) not null comment '角色名称',
role_key varchar(100) not null comment '角色权限字符串',
role_sort int(4) not null comment '显示顺序',
data_scope char(1) default '1' comment '数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限',
menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示',
dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示',
status char(1) not null comment '角色状态0正常 1停用',
del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (role_id)
) engine=innodb auto_increment=100 comment = '角色信息表';
-- ----------------------------
-- 初始化-角色信息表数据
-- ----------------------------
insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员');
insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色');
-- ----------------------------
-- 5、菜单权限表
-- ----------------------------
drop table if exists sys_menu;
create table sys_menu (
menu_id bigint(20) not null auto_increment comment '菜单ID',
menu_name varchar(50) not null comment '菜单名称',
parent_id bigint(20) default 0 comment '父菜单ID',
order_num int(4) default 0 comment '显示顺序',
path varchar(200) default '' comment '路由地址',
component varchar(255) default null comment '组件路径',
query varchar(255) default null comment '路由参数',
is_frame int(1) default 1 comment '是否为外链0是 1否',
is_cache int(1) default 0 comment '是否缓存0缓存 1不缓存',
menu_type char(1) default '' comment '菜单类型M目录 C菜单 F按钮',
visible char(1) default 0 comment '菜单状态0显示 1隐藏',
status char(1) default 0 comment '菜单状态0正常 1停用',
perms varchar(100) default null comment '权限标识',
icon varchar(100) default '#' comment '菜单图标',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default '' comment '备注',
primary key (menu_id)
) engine=innodb auto_increment=2000 comment = '菜单权限表';
-- ----------------------------
-- 初始化-菜单信息表数据
-- ----------------------------
-- 一级菜单
insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate(), '', null, '系统管理目录');
insert into sys_menu values('2', '系统监控', '0', '2', 'monitor', null, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate(), '', null, '系统监控目录');
insert into sys_menu values('3', '系统工具', '0', '3', 'tool', null, '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate(), '', null, '系统工具目录');
insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', null, '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate(), '', null, '若依官网地址');
-- 二级菜单
insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate(), '', null, '用户管理菜单');
insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate(), '', null, '角色管理菜单');
insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate(), '', null, '菜单管理菜单');
insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate(), '', null, '部门管理菜单');
insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate(), '', null, '岗位管理菜单');
insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单');
insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单');
insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单');
insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单');
insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单');
insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单');
insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单');
insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单');
insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, '缓存监控菜单');
insert into sys_menu values('114', '缓存列表', '2', '6', 'cacheList', 'monitor/cache/list', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', sysdate(), '', null, '缓存列表菜单');
insert into sys_menu values('115', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单');
insert into sys_menu values('116', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单');
insert into sys_menu values('117', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单');
-- 三级菜单
insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单');
insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单');
-- 用户管理按钮
insert into sys_menu values('1000', '用户查询', '100', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1001', '用户新增', '100', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1002', '用户修改', '100', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1003', '用户删除', '100', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1004', '用户导出', '100', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1005', '用户导入', '100', '6', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1006', '重置密码', '100', '7', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, '');
-- 角色管理按钮
insert into sys_menu values('1007', '角色查询', '101', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1008', '角色新增', '101', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1009', '角色修改', '101', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1010', '角色删除', '101', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1011', '角色导出', '101', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate(), '', null, '');
-- 菜单管理按钮
insert into sys_menu values('1012', '菜单查询', '102', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1013', '菜单新增', '102', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1014', '菜单修改', '102', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1015', '菜单删除', '102', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate(), '', null, '');
-- 部门管理按钮
insert into sys_menu values('1016', '部门查询', '103', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1017', '部门新增', '103', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1018', '部门修改', '103', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1019', '部门删除', '103', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate(), '', null, '');
-- 岗位管理按钮
insert into sys_menu values('1020', '岗位查询', '104', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1021', '岗位新增', '104', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1022', '岗位修改', '104', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1023', '岗位删除', '104', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1024', '岗位导出', '104', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate(), '', null, '');
-- 字典管理按钮
insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate(), '', null, '');
-- 参数设置按钮
insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate(), '', null, '');
-- 通知公告按钮
insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate(), '', null, '');
-- 操作日志按钮
insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1041', '日志导出', '500', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, '');
-- 登录日志按钮
insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1045', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', sysdate(), '', null, '');
-- 在线用户按钮
insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, '');
-- 定时任务按钮
insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1054', '任务导出', '110', '6', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, '');
-- 代码生成按钮
insert into sys_menu values('1055', '生成查询', '116', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1056', '生成修改', '116', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1057', '生成删除', '116', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1058', '导入代码', '116', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1059', '预览代码', '116', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1060', '生成代码', '116', '6', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, '');
-- ----------------------------
-- 6、用户和角色关联表 用户N-1角色
-- ----------------------------
drop table if exists sys_user_role;
create table sys_user_role (
user_id bigint(20) not null comment '用户ID',
role_id bigint(20) not null comment '角色ID',
primary key(user_id, role_id)
) engine=innodb comment = '用户和角色关联表';
-- ----------------------------
-- 初始化-用户和角色关联表数据
-- ----------------------------
insert into sys_user_role values ('1', '1');
insert into sys_user_role values ('2', '2');
-- ----------------------------
-- 7、角色和菜单关联表 角色1-N菜单
-- ----------------------------
drop table if exists sys_role_menu;
create table sys_role_menu (
role_id bigint(20) not null comment '角色ID',
menu_id bigint(20) not null comment '菜单ID',
primary key(role_id, menu_id)
) engine=innodb comment = '角色和菜单关联表';
-- ----------------------------
-- 初始化-角色和菜单关联表数据
-- ----------------------------
insert into sys_role_menu values ('2', '1');
insert into sys_role_menu values ('2', '2');
insert into sys_role_menu values ('2', '3');
insert into sys_role_menu values ('2', '4');
insert into sys_role_menu values ('2', '100');
insert into sys_role_menu values ('2', '101');
insert into sys_role_menu values ('2', '102');
insert into sys_role_menu values ('2', '103');
insert into sys_role_menu values ('2', '104');
insert into sys_role_menu values ('2', '105');
insert into sys_role_menu values ('2', '106');
insert into sys_role_menu values ('2', '107');
insert into sys_role_menu values ('2', '108');
insert into sys_role_menu values ('2', '109');
insert into sys_role_menu values ('2', '110');
insert into sys_role_menu values ('2', '111');
insert into sys_role_menu values ('2', '112');
insert into sys_role_menu values ('2', '113');
insert into sys_role_menu values ('2', '114');
insert into sys_role_menu values ('2', '115');
insert into sys_role_menu values ('2', '116');
insert into sys_role_menu values ('2', '117');
insert into sys_role_menu values ('2', '500');
insert into sys_role_menu values ('2', '501');
insert into sys_role_menu values ('2', '1000');
insert into sys_role_menu values ('2', '1001');
insert into sys_role_menu values ('2', '1002');
insert into sys_role_menu values ('2', '1003');
insert into sys_role_menu values ('2', '1004');
insert into sys_role_menu values ('2', '1005');
insert into sys_role_menu values ('2', '1006');
insert into sys_role_menu values ('2', '1007');
insert into sys_role_menu values ('2', '1008');
insert into sys_role_menu values ('2', '1009');
insert into sys_role_menu values ('2', '1010');
insert into sys_role_menu values ('2', '1011');
insert into sys_role_menu values ('2', '1012');
insert into sys_role_menu values ('2', '1013');
insert into sys_role_menu values ('2', '1014');
insert into sys_role_menu values ('2', '1015');
insert into sys_role_menu values ('2', '1016');
insert into sys_role_menu values ('2', '1017');
insert into sys_role_menu values ('2', '1018');
insert into sys_role_menu values ('2', '1019');
insert into sys_role_menu values ('2', '1020');
insert into sys_role_menu values ('2', '1021');
insert into sys_role_menu values ('2', '1022');
insert into sys_role_menu values ('2', '1023');
insert into sys_role_menu values ('2', '1024');
insert into sys_role_menu values ('2', '1025');
insert into sys_role_menu values ('2', '1026');
insert into sys_role_menu values ('2', '1027');
insert into sys_role_menu values ('2', '1028');
insert into sys_role_menu values ('2', '1029');
insert into sys_role_menu values ('2', '1030');
insert into sys_role_menu values ('2', '1031');
insert into sys_role_menu values ('2', '1032');
insert into sys_role_menu values ('2', '1033');
insert into sys_role_menu values ('2', '1034');
insert into sys_role_menu values ('2', '1035');
insert into sys_role_menu values ('2', '1036');
insert into sys_role_menu values ('2', '1037');
insert into sys_role_menu values ('2', '1038');
insert into sys_role_menu values ('2', '1039');
insert into sys_role_menu values ('2', '1040');
insert into sys_role_menu values ('2', '1041');
insert into sys_role_menu values ('2', '1042');
insert into sys_role_menu values ('2', '1043');
insert into sys_role_menu values ('2', '1044');
insert into sys_role_menu values ('2', '1045');
insert into sys_role_menu values ('2', '1046');
insert into sys_role_menu values ('2', '1047');
insert into sys_role_menu values ('2', '1048');
insert into sys_role_menu values ('2', '1049');
insert into sys_role_menu values ('2', '1050');
insert into sys_role_menu values ('2', '1051');
insert into sys_role_menu values ('2', '1052');
insert into sys_role_menu values ('2', '1053');
insert into sys_role_menu values ('2', '1054');
insert into sys_role_menu values ('2', '1055');
insert into sys_role_menu values ('2', '1056');
insert into sys_role_menu values ('2', '1057');
insert into sys_role_menu values ('2', '1058');
insert into sys_role_menu values ('2', '1059');
insert into sys_role_menu values ('2', '1060');
-- ----------------------------
-- 8、角色和部门关联表 角色1-N部门
-- ----------------------------
drop table if exists sys_role_dept;
create table sys_role_dept (
role_id bigint(20) not null comment '角色ID',
dept_id bigint(20) not null comment '部门ID',
primary key(role_id, dept_id)
) engine=innodb comment = '角色和部门关联表';
-- ----------------------------
-- 初始化-角色和部门关联表数据
-- ----------------------------
insert into sys_role_dept values ('2', '100');
insert into sys_role_dept values ('2', '101');
insert into sys_role_dept values ('2', '105');
-- ----------------------------
-- 9、用户与岗位关联表 用户1-N岗位
-- ----------------------------
drop table if exists sys_user_post;
create table sys_user_post
(
user_id bigint(20) not null comment '用户ID',
post_id bigint(20) not null comment '岗位ID',
primary key (user_id, post_id)
) engine=innodb comment = '用户与岗位关联表';
-- ----------------------------
-- 初始化-用户与岗位关联表数据
-- ----------------------------
insert into sys_user_post values ('1', '1');
insert into sys_user_post values ('2', '2');
-- ----------------------------
-- 10、操作日志记录
-- ----------------------------
drop table if exists sys_oper_log;
create table sys_oper_log (
oper_id bigint(20) not null auto_increment comment '日志主键',
title varchar(50) default '' comment '模块标题',
business_type int(2) default 0 comment '业务类型0其它 1新增 2修改 3删除',
method varchar(100) default '' comment '方法名称',
request_method varchar(10) default '' comment '请求方式',
operator_type int(1) default 0 comment '操作类别0其它 1后台用户 2手机端用户',
oper_name varchar(50) default '' comment '操作人员',
dept_name varchar(50) default '' comment '部门名称',
oper_url varchar(255) default '' comment '请求URL',
oper_ip varchar(128) default '' comment '主机地址',
oper_location varchar(255) default '' comment '操作地点',
oper_param varchar(2000) default '' comment '请求参数',
json_result varchar(2000) default '' comment '返回参数',
status int(1) default 0 comment '操作状态0正常 1异常',
error_msg varchar(2000) default '' comment '错误消息',
oper_time datetime comment '操作时间',
cost_time bigint(20) default 0 comment '消耗时间',
primary key (oper_id),
key idx_sys_oper_log_bt (business_type),
key idx_sys_oper_log_s (status),
key idx_sys_oper_log_ot (oper_time)
) engine=innodb auto_increment=100 comment = '操作日志记录';
-- ----------------------------
-- 11、字典类型表
-- ----------------------------
drop table if exists sys_dict_type;
create table sys_dict_type
(
dict_id bigint(20) not null auto_increment comment '字典主键',
dict_name varchar(100) default '' comment '字典名称',
dict_type varchar(100) default '' comment '字典类型',
status char(1) default '0' comment '状态0正常 1停用',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (dict_id),
unique (dict_type)
) engine=innodb auto_increment=100 comment = '字典类型表';
insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', sysdate(), '', null, '用户性别列表');
insert into sys_dict_type values(2, '菜单状态', 'sys_show_hide', '0', 'admin', sysdate(), '', null, '菜单状态列表');
insert into sys_dict_type values(3, '系统开关', 'sys_normal_disable', '0', 'admin', sysdate(), '', null, '系统开关列表');
insert into sys_dict_type values(4, '任务状态', 'sys_job_status', '0', 'admin', sysdate(), '', null, '任务状态列表');
insert into sys_dict_type values(5, '任务分组', 'sys_job_group', '0', 'admin', sysdate(), '', null, '任务分组列表');
insert into sys_dict_type values(6, '系统是否', 'sys_yes_no', '0', 'admin', sysdate(), '', null, '系统是否列表');
insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0', 'admin', sysdate(), '', null, '通知类型列表');
insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', sysdate(), '', null, '通知状态列表');
insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表');
insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表');
-- ----------------------------
-- 12、字典数据表
-- ----------------------------
drop table if exists sys_dict_data;
create table sys_dict_data
(
dict_code bigint(20) not null auto_increment comment '字典编码',
dict_sort int(4) default 0 comment '字典排序',
dict_label varchar(100) default '' comment '字典标签',
dict_value varchar(100) default '' comment '字典键值',
dict_type varchar(100) default '' comment '字典类型',
css_class varchar(100) default null comment '样式属性(其他样式扩展)',
list_class varchar(100) default null comment '表格回显样式',
is_default char(1) default 'N' comment '是否默认Y是 N否',
status char(1) default '0' comment '状态0正常 1停用',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (dict_code)
) engine=innodb auto_increment=100 comment = '字典数据表';
insert into sys_dict_data values(1, 1, '', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', sysdate(), '', null, '性别男');
insert into sys_dict_data values(2, 2, '', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别女');
insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别未知');
insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '显示菜单');
insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '隐藏菜单');
insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
insert into sys_dict_data values(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', sysdate(), '', null, '默认分组');
insert into sys_dict_data values(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', sysdate(), '', null, '系统分组');
insert into sys_dict_data values(12, 1, '', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '系统默认是');
insert into sys_dict_data values(13, 2, '', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '系统默认否');
insert into sys_dict_data values(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', sysdate(), '', null, '通知');
insert into sys_dict_data values(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', sysdate(), '', null, '公告');
insert into sys_dict_data values(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
insert into sys_dict_data values(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '关闭状态');
insert into sys_dict_data values(18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '其他操作');
insert into sys_dict_data values(19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '新增操作');
insert into sys_dict_data values(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '修改操作');
insert into sys_dict_data values(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '删除操作');
insert into sys_dict_data values(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作');
insert into sys_dict_data values(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作');
insert into sys_dict_data values(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作');
insert into sys_dict_data values(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作');
insert into sys_dict_data values(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作');
insert into sys_dict_data values(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作');
insert into sys_dict_data values(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态');
insert into sys_dict_data values(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
-- ----------------------------
-- 13、参数配置表
-- ----------------------------
drop table if exists sys_config;
create table sys_config (
config_id int(5) not null auto_increment comment '参数主键',
config_name varchar(100) default '' comment '参数名称',
config_key varchar(100) default '' comment '参数键名',
config_value varchar(500) default '' comment '参数键值',
config_type char(1) default 'N' comment '系统内置Y是 N否',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (config_id)
) engine=innodb auto_increment=100 comment = '参数配置表';
insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' );
insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, '初始化密码 123456' );
insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, '深色主题theme-dark浅色主题theme-light' );
insert into sys_config values(4, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启验证码功能true开启false关闭');
insert into sys_config values(5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能true开启false关闭');
insert into sys_config values(6, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置登录IP黑名单限制多个匹配项以;分隔,支持匹配(*通配、网段)');
-- ----------------------------
-- 14、系统访问记录
-- ----------------------------
drop table if exists sys_logininfor;
create table sys_logininfor (
info_id bigint(20) not null auto_increment comment '访问ID',
user_name varchar(50) default '' comment '用户账号',
ipaddr varchar(128) default '' comment '登录IP地址',
login_location varchar(255) default '' comment '登录地点',
browser varchar(50) default '' comment '浏览器类型',
os varchar(50) default '' comment '操作系统',
status char(1) default '0' comment '登录状态0成功 1失败',
msg varchar(255) default '' comment '提示消息',
login_time datetime comment '访问时间',
primary key (info_id),
key idx_sys_logininfor_s (status),
key idx_sys_logininfor_lt (login_time)
) engine=innodb auto_increment=100 comment = '系统访问记录';
-- ----------------------------
-- 15、定时任务调度表
-- ----------------------------
drop table if exists sys_job;
create table sys_job (
job_id bigint(20) not null auto_increment comment '任务ID',
job_name varchar(64) default '' comment '任务名称',
job_group varchar(64) default 'DEFAULT' comment '任务组名',
invoke_target varchar(500) not null comment '调用目标字符串',
cron_expression varchar(255) default '' comment 'cron执行表达式',
misfire_policy varchar(20) default '3' comment '计划执行错误策略1立即执行 2执行一次 3放弃执行',
concurrent char(1) default '1' comment '是否并发执行0允许 1禁止',
status char(1) default '0' comment '状态0正常 1暂停',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default '' comment '备注信息',
primary key (job_id, job_name, job_group)
) engine=innodb auto_increment=100 comment = '定时任务调度表';
insert into sys_job values(1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
insert into sys_job values(2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, '');
-- ----------------------------
-- 16、定时任务调度日志表
-- ----------------------------
drop table if exists sys_job_log;
create table sys_job_log (
job_log_id bigint(20) not null auto_increment comment '任务日志ID',
job_name varchar(64) not null comment '任务名称',
job_group varchar(64) not null comment '任务组名',
invoke_target varchar(500) not null comment '调用目标字符串',
job_message varchar(500) comment '日志信息',
status char(1) default '0' comment '执行状态0正常 1失败',
exception_info varchar(2000) default '' comment '异常信息',
create_time datetime comment '创建时间',
primary key (job_log_id)
) engine=innodb comment = '定时任务调度日志表';
-- ----------------------------
-- 17、通知公告表
-- ----------------------------
drop table if exists sys_notice;
create table sys_notice (
notice_id int(4) not null auto_increment comment '公告ID',
notice_title varchar(50) not null comment '公告标题',
notice_type char(1) not null comment '公告类型1通知 2公告',
notice_content longblob default null comment '公告内容',
status char(1) default '0' comment '公告状态0正常 1关闭',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(255) default null comment '备注',
primary key (notice_id)
) engine=innodb auto_increment=10 comment = '通知公告表';
-- ----------------------------
-- 初始化-公告信息表数据
-- ----------------------------
insert into sys_notice values('1', '温馨提醒2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', sysdate(), '', null, '管理员');
insert into sys_notice values('2', '维护通知2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员');
-- ----------------------------
-- 18、代码生成业务表
-- ----------------------------
drop table if exists gen_table;
create table gen_table (
table_id bigint(20) not null auto_increment comment '编号',
table_name varchar(200) default '' comment '表名称',
table_comment varchar(500) default '' comment '表描述',
sub_table_name varchar(64) default null comment '关联子表的表名',
sub_table_fk_name varchar(64) default null comment '子表关联的外键名',
class_name varchar(100) default '' comment '实体类名称',
tpl_category varchar(200) default 'crud' comment '使用的模板crud单表操作 tree树表操作',
tpl_web_type varchar(30) default '' comment '前端模板类型element-ui模版 element-plus模版',
package_name varchar(100) comment '生成包路径',
module_name varchar(30) comment '生成模块名',
business_name varchar(30) comment '生成业务名',
function_name varchar(50) comment '生成功能名',
function_author varchar(50) comment '生成功能作者',
gen_type char(1) default '0' comment '生成代码方式0zip压缩包 1自定义路径',
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
options varchar(1000) comment '其它生成选项',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (table_id)
) engine=innodb auto_increment=1 comment = '代码生成业务表';
-- ----------------------------
-- 19、代码生成业务表字段
-- ----------------------------
drop table if exists gen_table_column;
create table gen_table_column (
column_id bigint(20) not null auto_increment comment '编号',
table_id bigint(20) comment '归属表编号',
column_name varchar(200) comment '列名称',
column_comment varchar(500) comment '列描述',
column_type varchar(100) comment '列类型',
java_type varchar(500) comment 'JAVA类型',
java_field varchar(200) comment 'JAVA字段名',
is_pk char(1) comment '是否主键1是',
is_increment char(1) comment '是否自增1是',
is_required char(1) comment '是否必填1是',
is_insert char(1) comment '是否为插入字段1是',
is_edit char(1) comment '是否编辑字段1是',
is_list char(1) comment '是否列表字段1是',
is_query char(1) comment '是否查询字段1是',
query_type varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)',
html_type varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)',
dict_type varchar(200) default '' comment '字典类型',
sort int comment '排序',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (column_id)
) engine=innodb auto_increment=1 comment = '代码生成业务表字段';

3637
sql/tony-flowable.sql Normal file

File diff suppressed because one or more lines are too long

149
zbf-admin/pom.xml Normal file
View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>zbf</artifactId>
<groupId>com.zbf</groupId>
<version>3.8.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>zbf-admin</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger3-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
</dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.zbf</groupId>
<artifactId>zbf-generator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<!-- Apache HttpCore, required for HttpClient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.14</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-process</artifactId>
<version>6.7.2</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
<version>6.7.2</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-bpmn-layout</artifactId>
<version>6.7.2</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.16.6</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.15</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>rzg</finalName>
</build>
</project>

View File

@ -0,0 +1,34 @@
package com.zbf;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.integration.config.EnableIntegration;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableIntegration
@EnableConfigurationProperties
public class ZbfApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(ZbfApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 日照港仓储系统运行成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -0,0 +1,18 @@
package com.zbf;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web容器中进行部署
*
* @author ruoyi
*/
public class ZbfServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(ZbfApplication.class);
}
}

View File

@ -0,0 +1,94 @@
package com.zbf.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.zbf.common.config.RuoYiConfig;
import com.zbf.common.constant.CacheConstants;
import com.zbf.common.constant.Constants;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.redis.RedisCache;
import com.zbf.common.utils.sign.Base64;
import com.zbf.common.utils.uuid.IdUtils;
import com.zbf.system.service.ISysConfigService;
/**
* 验证码操作处理
*
* @author ruoyi
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
* 生成验证码
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
if (!captchaEnabled)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

View File

@ -0,0 +1,168 @@
package com.zbf.web.controller.common;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zbf.system.service.ITSeqService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.zbf.common.config.RuoYiConfig;
import com.zbf.common.constant.Constants;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.file.FileUploadUtils;
import com.zbf.common.utils.file.FileUtils;
import com.zbf.framework.config.ServerConfig;
/**
* 通用请求处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/common")
public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
private final ServerConfig serverConfig;
private ITSeqService seqService;
private static final String FILE_DELIMETER = ",";
public CommonController(ServerConfig serverConfig, ITSeqService seqService) {
this.serverConfig = serverConfig;
this.seqService = seqService;
}
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
try {
if (!FileUtils.checkAllowDownload(fileName)) {
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete) {
FileUtils.deleteFile(filePath);
}
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
/**
* 通用上传请求单个
*/
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception {
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
* 通用上传请求多个
*/
@PostMapping("/uploads")
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>();
for (MultipartFile file : files) {
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
urls.add(url);
fileNames.add(fileName);
newFileNames.add(FileUtils.getName(fileName));
originalFilenames.add(file.getOriginalFilename());
}
AjaxResult ajax = AjaxResult.success();
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax;
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
if (!FileUtils.checkAllowDownload(resource)) {
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
/**
* 生成流水号key为前缀len为长度 
*/
@GetMapping("/generateSeq")
public AjaxResult generateSeq(@RequestParam Map<String, Object> params)
throws Exception {
AjaxResult ajax = AjaxResult.success();
ajax.put("seq", seqService.generateSeq(params.get("key").toString(), Integer.parseInt(params.get("len").toString())));
return ajax;
}
/**
* 生成流水号key为前缀len为长度 
*/
@GetMapping("/generateTempSeq")
public AjaxResult generateTempSeq(@RequestParam Map<String, Object> params)
throws Exception {
AjaxResult ajax = AjaxResult.success();
ajax.put("seq", seqService.generateTempSeq(params.get("key").toString(), Integer.parseInt(params.get("len").toString())));
return ajax;
}
}

View File

@ -0,0 +1,50 @@
package com.zbf.web.controller.common;
import com.zbf.common.annotation.Anonymous;
import com.zbf.common.config.RuoYiConfig;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.exception.NonCaptureException;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.file.FileUploadUtils;
import com.zbf.common.utils.file.FileUtils;
import com.zbf.framework.config.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/file")
public class FileUploadController {
private final Logger log = LoggerFactory.getLogger(FileUploadController.class);
@Autowired
private ServerConfig serverConfig;
@Anonymous
@PostMapping("/upload")
@SuppressWarnings("DuplicatedCode")
public AjaxResult uploadFile(MultipartFile file) {
try {
log.info("文件 {} 上传中...", file.getOriginalFilename());
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
log.info("文件 {} 上传成功!", file.getOriginalFilename());
return ajax;
} catch (Exception e) {
throw new NonCaptureException(StringUtils.format("文件 {} 上传失败!", file.getOriginalFilename()), e);
}
}
}

View File

@ -0,0 +1,233 @@
package com.zbf.web.controller.flowable;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.utils.StringUtils;
import com.zbf.system.domain.TCkOrders;
import com.zbf.system.service.ITCkOrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.flowable.bpmn.BpmnAutoLayout;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.*;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.runtime.Execution;
import org.flowable.task.api.Task;
import org.flowable.validation.ValidationError;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.*;
@Api(value = "动态流程接口")
@Controller
@RequestMapping("/dynamic/flow")
public class DynamicFlowController {
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@Resource
RepositoryService repositoryService;
@Resource
private HistoryService historyService;
@Autowired
private ITCkOrdersService tCkOrdersService;
@ApiOperation("遍历流程信息")
@GetMapping(value = "/info/{processInstanceId}")
@ResponseBody
public AjaxResult remove(@PathVariable String processInstanceId) {
String processDefinitionId = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult().getProcessDefinitionId();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof UserTask) {
UserTask userTask = (UserTask) flowElement;
System.out.println(flowElement.getName());
System.out.println(flowElement.getId());
System.out.println(userTask.getAssignee());
String assigneeEl = userTask.getAssignee();
if (StringUtils.isBlank(assigneeEl)) {
continue;
}
if (assigneeEl.startsWith("${") && assigneeEl.endsWith("}") && assigneeEl.length() > 3) {
String assignee = assigneeEl.substring(2, assigneeEl.length() - 2);
System.out.println("assignee:" + assignee);
}
}
}
return AjaxResult.success(flowElements);
}
@ApiOperation("撤销:强制结束一个流程")
@GetMapping(value = "/forceEnd/{taskId}")
@ResponseBody
public AjaxResult forceEnd(@PathVariable String taskId) {
Task t = taskService.createTaskQuery().taskId(taskId).singleResult();
String processDefinitionId = runtimeService.createProcessInstanceQuery().processInstanceId(t.getProcessInstanceId()).singleResult().getProcessDefinitionId();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
// 寻找流程实例当前任务的activeId
Execution execution = runtimeService.createExecutionQuery().executionId(t.getExecutionId()).singleResult();
String activityId = execution.getActivityId();
FlowNode currentNode = (FlowNode)bpmnModel.getMainProcess().getFlowElement(activityId);
// 创建结束节点和连接线
EndEvent end = new EndEvent();
end.setName("强制结束");
end.setId("forceEnd");
List<SequenceFlow> newSequenceFlowList = new ArrayList<SequenceFlow>();
SequenceFlow newSequenceFlow = new SequenceFlow();
newSequenceFlow.setId("newFlow");
newSequenceFlow.setSourceFlowElement(currentNode);
newSequenceFlow.setTargetFlowElement(end);
newSequenceFlowList.add(newSequenceFlow);
// 备份原有方向
List<SequenceFlow> dataflows = currentNode.getOutgoingFlows();
List<SequenceFlow> oriSequenceFlows = new ArrayList<SequenceFlow>();
oriSequenceFlows.addAll(dataflows);
// 清空原有方向
currentNode.getOutgoingFlows().clear();
// 设置新方向
currentNode.setOutgoingFlows(newSequenceFlowList);
// 完成当前任务
taskService.addComment(taskId, t.getProcessInstanceId(), "comment", "撤销流程");
taskService.complete(taskId);
// 恢复原有方向
currentNode.setOutgoingFlows(oriSequenceFlows);
return AjaxResult.success();
}
@ApiOperation("驳回或跳转到指定节点")
@GetMapping(value = "/jump/{taskId}/{sid}/{rejectReason}")
@ResponseBody
public AjaxResult jump(@PathVariable String taskId, @PathVariable String sid,@PathVariable String rejectReason) {
Task t = taskService.createTaskQuery().taskId(taskId).singleResult();
String processDefinitionId = runtimeService.createProcessInstanceQuery().processInstanceId(t.getProcessInstanceId()).singleResult().getProcessDefinitionId();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
// 寻找流程实例当前任务的activeId
Execution execution = runtimeService.createExecutionQuery().executionId(t.getExecutionId()).singleResult();
String activityId = execution.getActivityId();
FlowNode currentNode = (FlowNode)bpmnModel.getMainProcess().getFlowElement(activityId);
FlowNode targetNode = (FlowNode)bpmnModel.getMainProcess().getFlowElement(sid);
// 创建连接线
if(!"startOutbound".equals(sid)) {
List<SequenceFlow> newSequenceFlowList = new ArrayList<SequenceFlow>();
SequenceFlow newSequenceFlow = new SequenceFlow();
newSequenceFlow.setId("newFlow");
newSequenceFlow.setSourceFlowElement(currentNode);
newSequenceFlow.setTargetFlowElement(targetNode);
newSequenceFlowList.add(newSequenceFlow);
// 备份原有方向
List<SequenceFlow> dataflows = currentNode.getOutgoingFlows();
List<SequenceFlow> oriSequenceFlows = new ArrayList<SequenceFlow>();
oriSequenceFlows.addAll(dataflows);
// 清空原有方向
currentNode.getOutgoingFlows().clear();
// 设置新方向
currentNode.setOutgoingFlows(newSequenceFlowList);
// 完成当前任务
taskService.addComment(taskId, t.getProcessInstanceId(), "comment", "跳转节点");
taskService.complete(taskId);
// 恢复原有方向
currentNode.setOutgoingFlows(oriSequenceFlows);
}else{
//删除实例任务
System.out.println(rejectReason);
//更新出库通知单表
Map<String, Object> variables = runtimeService.getVariables(execution.getId());
System.out.println(variables);
String deliveryId =(String) variables.get("deliveryId");
TCkOrders tCkOrders1 = tCkOrdersService.selectTCkOrdersByDeliveryId(deliveryId);
TCkOrders tCkOrders = new TCkOrders();
tCkOrders.setId(tCkOrders1.getId());
tCkOrders.setAuditMan(t.getAssignee());
tCkOrders.setAuditDate(new Date());
tCkOrders.setIsAudit("3");
tCkOrders.setRejectReason(rejectReason);
tCkOrdersService.updateTCkOrders(tCkOrders);
runtimeService.deleteProcessInstance(t.getProcessInstanceId(),"流程结束删除");
}
return AjaxResult.success();
}
@ApiOperation("动态创建流程")
@GetMapping(value = "/createProcess")
@ResponseBody
public AjaxResult createProcess() {
// 开始节点的属性
StartEvent startEvent=new StartEvent();
startEvent.setId("start");
startEvent.setName("start");
// 普通UserTask节点
UserTask userTask=new UserTask();
userTask.setId("userTask");
userTask.setName("审批任务");
// 结束节点属性
EndEvent endEvent=new EndEvent();
endEvent.setId("end");
endEvent.setName("end");
// 连线信息
List<SequenceFlow> flows=new ArrayList<SequenceFlow>();
List<SequenceFlow> toEnd=new ArrayList<SequenceFlow>();
SequenceFlow s1=new SequenceFlow();
s1.setId("flow1");
s1.setName("flow1");
s1.setSourceRef(startEvent.getId());
s1.setTargetRef(userTask.getId());
flows.add(s1);
SequenceFlow s2=new SequenceFlow();
s2.setId("flow2");
s2.setName("flow2");
s2.setSourceRef(userTask.getId());
s2.setTargetRef(endEvent.getId());
toEnd.add(s2);
startEvent.setOutgoingFlows(flows);
userTask.setOutgoingFlows(toEnd);
// 给流程对象添加元素
Process process=new Process();
process.setId("dynamicProcess");
process.setName("动态流程");
process.addFlowElement(startEvent);
process.addFlowElement(s1);
process.addFlowElement(userTask);
process.addFlowElement(s2);
process.addFlowElement(endEvent);
// 创建模型对象
BpmnModel bpmnModel=new BpmnModel();
bpmnModel.addProcess(process);
// 流程图自动布局
new BpmnAutoLayout(bpmnModel).execute();
// 模型合法性校验
List<ValidationError> validationErrorList = repositoryService.validateProcess(bpmnModel);
if (validationErrorList.size() == 0) {
// 模型合法就部署流程
Deployment deploy = repositoryService.createDeployment().category("dynamic")
.key("dynamicProcess")
.addBpmnModel("dynamicProcess.bpmn20.xml", bpmnModel)
.deploy();
return AjaxResult.success("success");
} else {
return AjaxResult.error("fail");
}
}
}

View File

@ -0,0 +1,224 @@
package com.zbf.web.controller.flowable;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.IOUtils;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.editor.constants.ModelDataJsonConstants;
import org.flowable.editor.language.json.converter.BpmnJsonConverter;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.repository.Model;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.repository.ProcessDefinitionQuery;
import org.flowable.image.ProcessDiagramGenerator;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipInputStream;
import com.zbf.system.domain.Process;
/**
* 流程管理
*/
@Api(value = "部署管理接口")
@Controller
@RequestMapping("/flow/manage")
public class FlowController extends BaseController {
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@Resource
RepositoryService repositoryService;
@Resource
ProcessEngineConfiguration configuration;
private String prefix = "flowable/manage";
@GetMapping("")
public String processList()
{
return prefix + "/processList";
}
@GetMapping("deploy")
public String deploy()
{
return prefix + "/deployProcess";
}
@ApiOperation("上传一个工作流文件")
@RequestMapping(value = "/uploadworkflow", method = RequestMethod.POST)
@ResponseBody
public AjaxResult fileupload(@RequestParam MultipartFile uploadfile) {
try {
String filename = uploadfile.getOriginalFilename();
InputStream is = uploadfile.getInputStream();
if (filename.endsWith("zip")) {
repositoryService.createDeployment().name(filename).addZipInputStream(new ZipInputStream(is)).deploy();
} else if (filename.endsWith("bpmn") || filename.endsWith("xml")) {
repositoryService.createDeployment().name(filename).addInputStream(filename, is).deploy();
} else {
return AjaxResult.error("文件格式错误");
}
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("部署失败");
}
return AjaxResult.success("部署成功");
}
@ApiOperation("查询已部署工作流列表")
@RequestMapping(value = "/getprocesslists", method = RequestMethod.POST)
@ResponseBody
public TableDataInfo getlist(@RequestParam(required = false) String key, @RequestParam(required = false) String name,
@RequestParam(required = false) Boolean latest, Integer pageSize, Integer pageNum) {
ProcessDefinitionQuery queryCondition = repositoryService.createProcessDefinitionQuery();
if (StringUtils.isNotEmpty(key)) {
queryCondition.processDefinitionKey(key);
}
if (StringUtils.isNotEmpty(name)) {
queryCondition.processDefinitionName(name);
}
if (latest) {
queryCondition.latestVersion();
}
int total = queryCondition.list().size();
int start = (pageNum - 1) * pageSize;
List<ProcessDefinition> pageList = queryCondition.orderByDeploymentId().desc().listPage(start, pageSize);
List<Process> mylist = new ArrayList<Process>();
for (int i = 0; i < pageList.size(); i++) {
Process p = new Process();
p.setDeploymentId(pageList.get(i).getDeploymentId());
p.setId(pageList.get(i).getId());
p.setKey(pageList.get(i).getKey());
p.setName(pageList.get(i).getName());
p.setResourceName(pageList.get(i).getResourceName());
p.setDiagramresourceName(pageList.get(i).getDiagramResourceName());
p.setSuspended(pageList.get(i).isSuspended());
p.setVersion(pageList.get(i).getVersion());
mylist.add(p);
}
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(mylist);
rspData.setTotal(total);
return rspData;
}
@ApiOperation("删除一次部署的工作流")
@RequestMapping(value = "/remove/{deploymentId}", method = RequestMethod.POST)
@ResponseBody
public AjaxResult remove(@PathVariable String deploymentId) {
repositoryService.deleteDeployment(deploymentId, true);
return AjaxResult.success();
}
@ApiOperation("查看工作流图片")
@RequestMapping(value = "/showresource", method = RequestMethod.GET)
public void showresource(@RequestParam("pdid") String pdid,
HttpServletResponse response) throws Exception {
response.setContentType("image/jpeg;charset=UTF-8");
response.setHeader("Content-Disposition","inline;filename=process.jpg");
BpmnModel bpmnModel = repositoryService.getBpmnModel(pdid);
ProcessDiagramGenerator diagramGenerator = configuration.getProcessDiagramGenerator();
InputStream is = diagramGenerator.generateDiagram(bpmnModel, "png", "宋体", "宋体", "宋体", configuration.getClassLoader(), true);
ServletOutputStream output = response.getOutputStream();
IOUtils.copy(is, output);
}
@ApiOperation("查看工作流定义")
@RequestMapping(value = "/showProcessDefinition/{pdid}/{resource}", method = RequestMethod.GET)
public void showProcessDefinition(@PathVariable("pdid") String pdid, @PathVariable(value="resource") String resource,
HttpServletResponse response) throws Exception {
response.setContentType("application/xml");
response.setHeader("Content-Disposition","inline;filename=process.bpmn20.xml");
InputStream is = repositoryService.getResourceAsStream(pdid, resource);
ServletOutputStream output = response.getOutputStream();
IOUtils.copy(is, output);
}
@ApiOperation("将流程定义转为模型")
@RequestMapping(value = "/exchangeProcessToModel/{pdid}", method = RequestMethod.GET)
@ResponseBody
public String exchangeProcessToModel(@PathVariable("pdid") String pdid, HttpServletResponse response) throws Exception {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionId(pdid).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(definition.getId());
ObjectNode objectNode = new BpmnJsonConverter().convertToJson(bpmnModel);
Model modelData = repositoryService.newModel();
modelData.setKey(definition.getKey());
modelData.setName(definition.getName());
modelData.setCategory(definition.getCategory());
ObjectNode modelJson = new ObjectMapper().createObjectNode();
modelJson.put(ModelDataJsonConstants.MODEL_NAME, definition.getName());
modelJson.put(ModelDataJsonConstants.MODEL_DESCRIPTION, definition.getDescription());
List<Model> models = repositoryService.createModelQuery().modelKey(definition.getKey()).list();
if (models.size() > 0) {
Integer version = models.get(0).getVersion();
version++;
modelJson.put(ModelDataJsonConstants.MODEL_REVISION, version);
// 删除旧模型
repositoryService.deleteModel(models.get(0).getId());
modelData.setVersion(version);
} else {
modelJson.put(ModelDataJsonConstants.MODEL_REVISION, 1);
}
modelData.setMetaInfo(modelJson.toString());
modelData.setDeploymentId(definition.getDeploymentId());
// 保存新模型
repositoryService.saveModel(modelData);
// 保存模型json
repositoryService.addModelEditorSource(modelData.getId(), objectNode.toString().getBytes(StandardCharsets.UTF_8));
return objectNode.toString();
}
@ApiOperation("挂起一个流程定义")
@RequestMapping(value = "/suspendProcessDefinition", method = RequestMethod.GET)
@ResponseBody
public AjaxResult suspendProcessDefinition(@RequestParam("pdid") String pdid, @RequestParam("flag") Boolean flag,
@RequestParam(value="date", required = false) String date) throws Exception {
if (StringUtils.isNotEmpty(date)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
repositoryService.suspendProcessDefinitionById(pdid, flag, sdf.parse(date));
} else {
repositoryService.suspendProcessDefinitionById(pdid, flag, null);
}
return AjaxResult.success();
}
@ApiOperation("激活一个流程定义")
@RequestMapping(value = "/activateProcessDefinition", method = RequestMethod.GET)
@ResponseBody
public AjaxResult activateProcessDefinition(@RequestParam("pdid") String pdid, @RequestParam("flag") Boolean flag, @RequestParam(value="date", required = false) String date) throws Exception {
if (StringUtils.isNotEmpty(date)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
repositoryService.activateProcessDefinitionById(pdid, flag, sdf.parse(date));
} else {
repositoryService.activateProcessDefinitionById(pdid, flag, null);
}
return AjaxResult.success();
}
}

View File

@ -0,0 +1,143 @@
package com.zbf.web.controller.flowable;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.editor.constants.ModelDataJsonConstants;
import org.flowable.editor.language.json.converter.BpmnJsonConverter;
import org.flowable.engine.IdentityService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.repository.Model;
import org.flowable.validation.ProcessValidator;
import org.flowable.validation.ProcessValidatorFactory;
import org.flowable.validation.ValidationError;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping("/app/rest/")
public class FlowDesignerController {
@Autowired
RepositoryService repositoryService;
@Autowired
IdentityService identityService;
@Autowired
RuntimeService runtimeService;
@Autowired
TaskService taskService;
@Autowired
protected ObjectMapper objectMapper;
/**
* 获得
* @param modelId
* @return
*/
@RequestMapping(value = "/models/{modelId}/editor/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getModelJSON(@PathVariable String modelId) {
Model model = repositoryService.getModel(modelId);
ObjectNode modelNode = objectMapper.createObjectNode();
modelNode.put("modelId", model.getId());
modelNode.put("name", model.getName());
modelNode.put("key", model.getKey());
modelNode.put("description", JSONObject.parseObject(model.getMetaInfo()).getString("description"));
modelNode.putPOJO("lastUpdated", model.getLastUpdateTime());
byte[] modelEditorSource = repositoryService.getModelEditorSource(modelId);
if (null != modelEditorSource && modelEditorSource.length > 0) {
try {
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(modelEditorSource);
editorJsonNode.put("modelType", "model");
modelNode.put("model", editorJsonNode);
} catch (Exception e) {
e.printStackTrace();
}
} else {
ObjectNode editorJsonNode = objectMapper.createObjectNode();
editorJsonNode.put("id", "canvas");
editorJsonNode.put("resourceId", "canvas");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
editorJsonNode.put("modelType", "model");
modelNode.put("model", editorJsonNode);
}
return modelNode;
}
/**
* 保存
* @param modelId
* @param values
*/
@RequestMapping(value = "models/{modelId}/editor/json", method = RequestMethod.POST)
public void saveModel(@PathVariable String modelId, @RequestBody MultiValueMap<String, String> values) {
String json = values.getFirst("json_xml");
String name = values.getFirst("name");
String description = values.getFirst("description");
String key = values.getFirst("key");
Model modelData = repositoryService.getModel(modelId);
if (null == modelData) {
modelData = repositoryService.newModel();
}
ObjectNode modelNode = null;
try {
modelNode = (ObjectNode) new ObjectMapper().readTree(json);
} catch (IOException e) {
e.printStackTrace();
}
ObjectNode modelObjectNode = objectMapper.createObjectNode();
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, name);
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
description = StringUtils.defaultString(description);
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
modelData.setMetaInfo(modelObjectNode.toString());
modelData.setName(name);
modelData.setKey(StringUtils.defaultString(key));
// 显示发布按钮
modelData.setDeploymentId(null);
repositoryService.saveModel(modelData);
try {
repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
/**
* 校验流程图
*/
@PostMapping(value = "/model/validate", consumes = MediaType.APPLICATION_JSON_VALUE)
public List<ValidationError> validate(@RequestBody JsonNode body) {
if (body != null && body.has("stencilset")) {
BpmnModel bpmnModel = new BpmnJsonConverter().convertToBpmnModel(body);
ProcessValidator validator = new ProcessValidatorFactory().createDefaultProcessValidator();
List<ValidationError> errors = validator.validate(bpmnModel);
return errors;
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,456 @@
package com.zbf.web.controller.flowable;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.utils.SecurityUtils;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.bean.BeanUtils;
import com.zbf.system.domain.*;
import com.zbf.system.mapper.ActRuExecutionMapper;
import com.zbf.system.service.ISysUserService;
import com.zbf.web.util.ActivitiTracingChart;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.cmmn.engine.impl.behavior.impl.ChildTaskActivityBehavior;
import org.flowable.engine.*;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricDetail;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.impl.persistence.entity.HistoricDetailVariableInstanceUpdateEntity;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.runtime.ProcessInstanceQuery;
import org.flowable.engine.task.Comment;
import org.flowable.job.api.*;
import org.flowable.task.api.Task;
import org.flowable.variable.api.history.HistoricVariableInstance;
import org.flowable.variable.api.history.HistoricVariableInstanceQuery;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 流程监控
*/
@Api(value = "流程监控接口")
@Controller
@RequestMapping("/flow/monitor")
public class FlowMonitorController extends BaseController {
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@Resource
private HistoryService historyService;
@Resource
ManagementService managementService;
@Resource
RepositoryService repositoryService;
@Resource
ProcessEngineConfiguration configuration;
@Resource
private ActivitiTracingChart activitiTracingChart;
@Resource
ActRuExecutionMapper actRuExecutionMapper;
@Resource
private ISysUserService userService;
private String prefix = "flowable/monitor";
@GetMapping("/instance")
public String processList() {
return prefix + "/processInstance";
}
@GetMapping("/history")
public String processHistory() {
return prefix + "/processHistory";
}
@GetMapping("/execution")
public String execution() {
return prefix + "/execution";
}
@GetMapping("/historyDetail")
public String historyDetail(String processInstanceId, ModelMap mmap) {
mmap.put("processInstanceId", processInstanceId);
return prefix + "/processHistoryDetail";
}
@GetMapping("/processVariablesDetail")
public String processVariablesDetail(String processInstanceId, ModelMap mmap) {
mmap.put("processInstanceId", processInstanceId);
return prefix + "/processVariablesDetail";
}
@ApiOperation("查询所有正在运行的流程实例列表")
@RequestMapping(value = "/listProcess", method = RequestMethod.POST)
@ResponseBody
public TableDataInfo getlist(@RequestParam(required = false) String bussinesskey, @RequestParam(required = false) String name,
Integer pageSize, Integer pageNum) {
int start = (pageNum - 1) * pageSize;
ProcessInstanceQuery condition = runtimeService.createProcessInstanceQuery();
if (StringUtils.isNotEmpty(bussinesskey)) {
condition.processInstanceBusinessKey(bussinesskey);
}
if (StringUtils.isNotEmpty(name)) {
condition.processDefinitionName(name);
}
int total = condition.orderByProcessDefinitionId().desc().list().size();
List<ProcessInstance> processList = condition.orderByProcessDefinitionId().desc().listPage(start, pageSize);
List<FlowInfo> flows = new ArrayList<>();
processList.stream().forEach(p -> {
FlowInfo info = new FlowInfo();
info.setProcessInstanceId(p.getProcessInstanceId());
info.setBusinessKey(p.getBusinessKey());
info.setName(p.getProcessDefinitionName());
info.setStartTime(p.getStartTime());
info.setStartUserId(p.getStartUserId());
info.setSuspended(p.isSuspended());
info.setEnded(p.isEnded());
// 查看当前活动任务
List<Task> tasks = taskService.createTaskQuery().processInstanceId(p.getProcessInstanceId()).list();
String taskName = "";
String assignee = "";
for (Task t : tasks) {
taskName += t.getName() + ",";
assignee += t.getAssignee() + ",";
}
taskName = taskName.substring(0, taskName.length() -1);
assignee = assignee.substring(0, assignee.length() -1);
info.setCurrentTask(taskName);
info.setAssignee(assignee);
flows.add(info);
});
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(flows);
rspData.setTotal(total);
return rspData;
}
@ApiOperation("查询所有流程实例列表-包含在运行和已结束")
@RequestMapping(value = "/listHistoryProcess", method = RequestMethod.POST)
@ResponseBody
public TableDataInfo listHistoryProcess(@RequestParam(required = false) String bussinesskey, @RequestParam(required = false) String name,
Integer pageSize, Integer pageNum) {
int start = (pageNum - 1) * pageSize;
HistoricProcessInstanceQuery condition = historyService.createHistoricProcessInstanceQuery().finished(); //finished 只查询历史
if (StringUtils.isNotEmpty(bussinesskey)) {
condition.processInstanceBusinessKey(bussinesskey);
}
if (StringUtils.isNotEmpty(name)) {
condition.processDefinitionName(name);
}
//根据发起人查询
condition.startedBy(SecurityUtils.getUsername());
int total = condition.orderByProcessInstanceStartTime().desc().list().size();
List<HistoricProcessInstance> processList = condition.orderByProcessInstanceStartTime().desc().listPage(start, pageSize);
List<FlowInfo> flows = new ArrayList<>();
processList.stream().forEach(p -> {
FlowInfo info = new FlowInfo();
info.setProcessInstanceId(p.getId());
info.setBusinessKey(p.getBusinessKey());
if("Flowable_Pickingout".equalsIgnoreCase(p.getProcessDefinitionName()) ||
"Pickingout_Audit".equalsIgnoreCase(p.getProcessDefinitionName())){
info.setName("出库通知单审批申请");
}else{
info.setName(p.getProcessDefinitionName());
}
info.setStartTime(p.getStartTime());
info.setEndTime(p.getEndTime());
// info.setStartUserId(p.getStartUserId());
//根据用户id查询用户名称
SysUser user = userService.selectUserByUserName(p.getStartUserId());
info.setStartUserId(user.getNickName());
if (p.getEndTime() == null) {
info.setEnded(false);
// 查看当前活动任务
List<Task> tasks = taskService.createTaskQuery().processInstanceId(p.getId()).list();
String taskName = "";
String assignee = "";
for (Task t : tasks) {
taskName += t.getName() + ",";
assignee += t.getAssignee() + ",";
}
taskName = taskName.substring(0, taskName.length() -1);
assignee = assignee.substring(0, assignee.length() -1);
info.setCurrentTask(taskName);
info.setAssignee(assignee);
} else {
info.setEnded(true);
}
flows.add(info);
});
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(flows);
rspData.setTotal(total);
return rspData;
}
@ApiOperation("查询一个流程的活动历史")
@RequestMapping(value = "/history/{processInstanceId}", method = RequestMethod.POST)
@ResponseBody
public TableDataInfo history(@PathVariable String processInstanceId, Integer pageSize, Integer pageNum) {
int start = (pageNum - 1) * pageSize;
List<HistoricActivityInstance> history = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).activityType("userTask").orderByHistoricActivityInstanceStartTime().asc().listPage(start, pageSize);
int total = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).activityType("userTask").orderByHistoricActivityInstanceStartTime().asc().list().size();
//查看历史变量
List<HistoricVariableInstance> list = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processInstanceId)
.list();
List<TaskInfo> infos = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
history.stream().forEach(h->{
TaskInfo info = new TaskInfo();
info.setProcessInstanceId(h.getProcessInstanceId());
info.setStartTime(sdf.format(h.getStartTime()));
if (h.getEndTime() != null) {
info.setEndTime(sdf.format(h.getEndTime()));
}
SysUser user = userService.selectUserByUserName(h.getAssignee());
if(user != null){
info.setAssignee(user.getNickName());
}else{
info.setAssignee(h.getAssignee());
}
List<HistoricVariableInstance> variableInstances = list.stream()
.filter(s -> s.getVariableName().equals(h.getAssignee())) // 根据用户编号属性过滤
.collect(Collectors.toList());
if(variableInstances.size() > 0){
String r = (String)variableInstances.get(0).getValue();
info.setResult("true".equals(r) ? "同意" : ("false".equals(r) ? "拒绝" : ""));
}
info.setTaskName(h.getActivityName());
List<Comment> comments = taskService.getTaskComments(h.getTaskId());
if (comments.size() > 0) {
info.setComment(comments.get(0).getFullMessage());
}
infos.add(info);
});
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(infos);
rspData.setTotal(total);
return rspData;
}
@ApiOperation("查询所有正在运行的执行实例列表")
@RequestMapping(value = "/listExecutions", method = RequestMethod.POST)
@ResponseBody
public List<FlowInfo> listExecutions(@RequestParam(required = false) String name) {
List<ActRuExecution> executionList = actRuExecutionMapper.selectActRuExecutionListByProcessName(name);
List<FlowInfo> flows = new ArrayList<>();
executionList.stream().forEach(p -> {
FlowInfo info = new FlowInfo();
info.setProcessInstanceId(p.getProcInstId());
if (p.getSuspensionState() == 1L) {
info.setSuspended(false);
} else {
info.setSuspended(true);
}
if (p.getIsActive() == 0) {
info.setActive(false);
} else {
info.setActive(true);
}
if (p.getActId() != null) {
ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(p.getProcInstId()).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(process.getProcessDefinitionId());
Map<String, FlowElement> nodes = bpmnModel.getMainProcess().getFlowElementMap();
info.setCurrentTask(nodes.get(p.getActId()).getName());
info.setName(process.getProcessDefinitionName());
} else {
ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(p.getProcInstId()).singleResult();
info.setStartTime(process.getStartTime());
info.setStartUserId(process.getStartUserId());
info.setName(process.getProcessDefinitionName());
List<Task> tasks = taskService.createTaskQuery().processInstanceId(p.getProcInstId()).list();
String taskName = "";
for (Task t : tasks) {
taskName += t.getName() + ",";
}
taskName = taskName.substring(0, taskName.length() -1);
info.setCurrentTask(taskName);
}
info.setStartTime(p.getStartTime());
info.setExecutionId(p.getId());
if (p.getParentId() == null) {
info.setParentExecutionId("0");
} else {
info.setParentExecutionId(p.getParentId());
}
flows.add(info);
});
return flows;
}
@ApiOperation("流程图进度追踪")
@RequestMapping(value = {"/traceProcess/{processInstanceId}"}, method = RequestMethod.GET)
public void traceprocess(@PathVariable String processInstanceId, HttpServletResponse response) throws IOException {
response.setContentType("image/jpeg;charset=UTF-8");
response.setHeader("Content-Disposition", "inline; filename= trace.png");
activitiTracingChart.generateFlowChart(processInstanceId, response.getOutputStream());
}
@ApiOperation("挂起一个流程实例")
@RequestMapping(value = "/suspend/{processInstanceId}", method = RequestMethod.GET)
@ResponseBody
public AjaxResult suspend(@PathVariable String processInstanceId) {
runtimeService.suspendProcessInstanceById(processInstanceId);
return AjaxResult.success();
}
@ApiOperation("唤醒一个挂起的流程实例")
@RequestMapping(value = "/run/{processInstanceId}", method = RequestMethod.GET)
@ResponseBody
public AjaxResult rerun(@PathVariable String processInstanceId) {
runtimeService.activateProcessInstanceById(processInstanceId);
return AjaxResult.success();
}
@ApiOperation("查询一个流程的变量")
@RequestMapping(value = "/variables/{processInstanceId}", method = RequestMethod.POST)
@ResponseBody
public TableDataInfo variables(@PathVariable String processInstanceId, Integer pageSize, Integer pageNum) {
int start = (pageNum - 1) * pageSize;
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).orderByVariableName().asc().listPage(start, pageSize);
int total = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).orderByVariableName().asc().list().size();
List<VariableInfo> infos = new ArrayList<>();
variables.forEach(v->{
VariableInfo info = new VariableInfo();
BeanUtils.copyBeanProp(info, v);
if (v.getValue() != null) {
info.setValue(v.getValue().toString());
}
infos.add(info);
});
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(infos);
rspData.setTotal(total);
return rspData;
}
@ApiOperation("按类型查询所有的作业列表:定时作业、异步作业、挂起作业、死亡作业")
@PostMapping(value = "/listJobs")
@ResponseBody
public TableDataInfo listJobs(@RequestParam(required = false) String processDefinitionId, @RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate,@RequestParam Integer type, Integer pageSize, Integer pageNum) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int start = (pageNum - 1) * pageSize;
int total = 0;
List<Job> jobList = null;
ArrayList<DeadLetterJob> jobs = new ArrayList<>();
TableDataInfo rspData = new TableDataInfo();
if (type == 1) {
// 定时作业
TimerJobQuery condition = managementService.createTimerJobQuery();
if (StringUtils.isNotEmpty(processDefinitionId)) {
condition.processDefinitionId(processDefinitionId);
}
if (StringUtils.isNotEmpty(startDate)) {
condition.duedateHigherThan(sdf.parse(startDate));
}
if (StringUtils.isNotEmpty(endDate)) {
condition.duedateLowerThan(sdf.parse(endDate));
}
total = condition.orderByJobDuedate().desc().list().size();
jobList = condition.orderByJobDuedate().desc().listPage(start, pageSize);
rspData.setRows(jobList);
} else if (type == 2) {
// 异步作业
JobQuery condition = managementService.createJobQuery();
if (StringUtils.isNotEmpty(processDefinitionId)) {
condition.processDefinitionId(processDefinitionId);
}
if (StringUtils.isNotEmpty(startDate)) {
condition.duedateHigherThan(sdf.parse(startDate));
}
if (StringUtils.isNotEmpty(endDate)) {
condition.duedateLowerThan(sdf.parse(endDate));
}
total = condition.orderByJobDuedate().desc().list().size();
jobList = condition.orderByJobDuedate().desc().listPage(start, pageSize);
rspData.setRows(jobList);
} else if (type == 3) {
// 挂起作业
SuspendedJobQuery condition = managementService.createSuspendedJobQuery();
if (StringUtils.isNotEmpty(processDefinitionId)) {
condition.processDefinitionId(processDefinitionId);
}
if (StringUtils.isNotEmpty(startDate)) {
condition.duedateHigherThan(sdf.parse(startDate));
}
if (StringUtils.isNotEmpty(endDate)) {
condition.duedateLowerThan(sdf.parse(endDate));
}
total = condition.orderByJobDuedate().desc().list().size();
jobList = condition.orderByJobDuedate().desc().listPage(start, pageSize);
rspData.setRows(jobList);
} else if (type == 4) {
// 死亡作业
DeadLetterJobQuery condition = managementService.createDeadLetterJobQuery();
if (StringUtils.isNotEmpty(processDefinitionId)) {
condition.processDefinitionId(processDefinitionId);
}
if (StringUtils.isNotEmpty(startDate)) {
condition.duedateHigherThan(sdf.parse(startDate));
}
if (StringUtils.isNotEmpty(endDate)) {
condition.duedateLowerThan(sdf.parse(endDate));
}
total = condition.orderByJobDuedate().desc().list().size();
jobList = condition.orderByJobDuedate().desc().listPage(start, pageSize);
jobList.forEach(j->{
DeadLetterJob job = new DeadLetterJob();
job.setId(j.getId());
job.setDueDate(j.getDuedate());
job.setJobType(j.getJobType());
job.setExceptionMessage(j.getExceptionMessage());
job.setJobHandlerType(j.getJobHandlerType());
job.setProcessDefId(j.getProcessDefinitionId());
job.setProcessInstanceId(j.getProcessInstanceId());
job.setExecutionId(j.getExecutionId());
jobs.add(job);
});
rspData.setRows(jobs);
}
rspData.setCode(0);
rspData.setTotal(total);
return rspData;
}
}

View File

@ -0,0 +1,231 @@
package com.zbf.web.controller.flowable;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.SecurityUtils;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.Leaveapply;
import com.zbf.system.service.ILeaveapplyService;
import com.zbf.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* 请假Controller
*
* @author shenzhanwang
* @date 2022-04-02
*/
@Controller
@RequestMapping("/leaveapply")
public class LeaveapplyController extends BaseController
{
private String prefix = "flowable/leaveapply";
@Autowired
private ILeaveapplyService leaveapplyService;
@Autowired
private ISysUserService userService;
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@GetMapping()
public String leaveapply()
{
return prefix + "/leaveapply";
}
/**
* 部门领导审批
* @return
*/
@ApiOperation("部门领导审批")
@GetMapping("/deptleadercheck")
@ResponseBody
public AjaxResult deptleadercheck(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Leaveapply apply = leaveapplyService.selectLeaveapplyById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 人事审批
* @return
*/
@ApiOperation("人事审批")
@GetMapping("/hrcheck")
@ResponseBody
public AjaxResult hrcheck(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Leaveapply apply = leaveapplyService.selectLeaveapplyById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 销假
* @return
*/
@ApiOperation("销假")
@GetMapping("/destroyapply")
@ResponseBody
public AjaxResult destroyapply(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Leaveapply apply = leaveapplyService.selectLeaveapplyById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 调整申请
* @return
*/
@ApiOperation("调整申请")
@GetMapping("/modifyapply")
@ResponseBody
public AjaxResult modifyapply(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Leaveapply apply = leaveapplyService.selectLeaveapplyById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 发起请假申请
* 驳回后使用
* @return
*/
@ApiOperation("发起请假申请-驳回后使用")
@GetMapping("/addleave")
@ResponseBody
public AjaxResult addLeave(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Leaveapply apply = leaveapplyService.selectLeaveapplyById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 查询请假列表
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(Leaveapply leaveapply)
{
String username = getUsername();
leaveapply.setUserId(username);
startPage();
List<Leaveapply> list = leaveapplyService.selectLeaveapplyList(leaveapply);
return getDataTable(list);
}
/**
* 导出请假列表
*/
@Log(title = "请假", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(Leaveapply leaveapply)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
String username = getUsername();
leaveapply.setUserId(username);
List<Leaveapply> list = leaveapplyService.selectLeaveapplyList(leaveapply);
ExcelUtil<Leaveapply> util = new ExcelUtil<Leaveapply>(Leaveapply.class);
return util.exportExcel(list, "请假数据");
}
/**
* 当前登录用户
*/
@ApiOperation("当前登录用户")
@GetMapping("/cuurentUser")
@ResponseBody
public AjaxResult cuurentUser()
{
SysUser user = SecurityUtils.getLoginUser().getUser();
return AjaxResult.success(user);
}
/**
* 发起请假流程
*/
@Log(title = "请假", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Leaveapply leaveapply)
{
leaveapply.setApplyTime(new Date());
return toAjax(leaveapplyService.insertLeaveapply(leaveapply));
}
@PostMapping("/update")
@ResponseBody
public AjaxResult update(Leaveapply leaveapply)
{
return toAjax(leaveapplyService.updateLeaveapply(leaveapply));
}
/**
* 删除请假
*/
@Log(title = "请假", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(leaveapplyService.deleteLeaveapplyByIds(ids));
}
}

View File

@ -0,0 +1,133 @@
package com.zbf.web.controller.flowable;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.Meeting;
import com.zbf.system.service.IMeetingService;
import com.zbf.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("/meeting")
public class MeetingController extends BaseController {
private String prefix = "flowable/meeting";
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@Autowired
private ISysUserService userService;
@Autowired
private IMeetingService meetingService;
/**
* 查询会议列表
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(Meeting meeting)
{
startPage();
List<Meeting> list = meetingService.selectMeetingList(meeting);
return getDataTable(list);
}
/**
* 导出会议列表
*/
@PostMapping("/export")
@ResponseBody
public AjaxResult export(Meeting meeting)
{
List<Meeting> list = meetingService.selectMeetingList(meeting);
ExcelUtil<Meeting> util = new ExcelUtil<Meeting>(Meeting.class);
return util.exportExcel(list, "会议数据");
}
/**
* 新增保存会议
*/
@ApiOperation("新增保存会议")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Meeting meeting)
{
return toAjax(meetingService.insertMeeting(meeting));
}
@PostMapping("/edit")
@ResponseBody
public AjaxResult edit(Meeting meeting)
{
return toAjax(meetingService.updateMeeting(meeting));
}
/**
* 删除会议
*/
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(meetingService.deleteMeetingByIds(ids));
}
/**
* 会议签到
*/
@ApiOperation("会议签到")
@GetMapping("/signate")
@ResponseBody
public AjaxResult signate(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Meeting apply = meetingService.selectMeetingById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 填写会议纪要
*/
@ApiOperation("填写会议纪要")
@GetMapping("/input")
@ResponseBody
public AjaxResult input(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Meeting apply = meetingService.selectMeetingById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
}

View File

@ -0,0 +1,161 @@
package com.zbf.web.controller.flowable;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.utils.StringUtils;
import com.zbf.system.domain.ModelParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.util.IOUtils;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.editor.constants.ModelDataJsonConstants;
import org.flowable.editor.language.json.converter.BpmnJsonConverter;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.Model;
import org.flowable.engine.repository.ModelQuery;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
@Api(value = "模型管理接口")
@Controller
@RequestMapping("/model/manage")
public class ModelManageController extends BaseController {
@Resource
RepositoryService repositoryService;
@Resource
private ObjectMapper objectMapper;
private String prefix = "flowable/manage";
@ApiOperation("查询所有模型")
@RequestMapping(value = "/modelLists", method = RequestMethod.POST)
@ResponseBody
public TableDataInfo modelLists(@RequestParam(required = false) String key, @RequestParam(required = false) String name,
Integer pageSize, Integer pageNum) {
ModelQuery query = repositoryService.createModelQuery();
if (StringUtils.isNotEmpty(key)) {
query.modelKey(key);
}
if (StringUtils.isNotEmpty(name)) {
query.modelName(name);
}
int start = (pageNum - 1) * pageSize;
List<Model> page = query.orderByCreateTime().desc().listPage(start, pageSize);
int total = repositoryService.createModelQuery().list().size();
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(page);
rspData.setTotal(total);
return rspData;
}
/**
* 新增模型页面
* @return
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增模型
*/
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ModelParam modelRequest) throws JsonProcessingException {
Model model = repositoryService.newModel();
model.setCategory(modelRequest.getCategory());
model.setKey(modelRequest.getKey());
ObjectNode modelNode = objectMapper.createObjectNode();
modelNode.put(ModelDataJsonConstants.MODEL_NAME, modelRequest.getName());
modelNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, modelRequest.getDescription());
modelNode.put(ModelDataJsonConstants.MODEL_REVISION, modelRequest.getVersion());
model.setMetaInfo(modelNode.toString());
model.setName(modelRequest.getName());
model.setVersion(modelRequest.getVersion());
ModelQuery modelQuery = repositoryService.createModelQuery();
List<Model> list = modelQuery.modelKey(modelRequest.getKey()).list();
if (list.size() > 0) {
return AjaxResult.error("模型标识不能重复");
} else {
// 保存模型到act_re_model表
repositoryService.saveModel(model);
HashMap<String, Object> content = new HashMap();
content.put("resourceId", model.getId());
HashMap<String, String> properties = new HashMap();
properties.put("process_id", modelRequest.getKey());
properties.put("name", modelRequest.getName());
properties.put("category", modelRequest.getCategory());
content.put("properties", properties);
HashMap<String, String> stencilset = new HashMap();
stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
content.put("stencilset", stencilset);
// 保存模型文件到act_ge_bytearray表
repositoryService.addModelEditorSource(model.getId(), objectMapper.writeValueAsBytes(content));
return AjaxResult.success(model);
}
}
@RequestMapping("/deploy/{modelId}")
@ResponseBody
public AjaxResult modelDeployment(@PathVariable String modelId) {
try {
Model model = repositoryService.getModel(modelId);
byte[] modelData = repositoryService.getModelEditorSource(modelId);
JsonNode jsonNode = objectMapper.readTree(modelData);
BpmnModel bpmnModel = (new BpmnJsonConverter()).convertToBpmnModel(jsonNode);
Deployment deploy = repositoryService.createDeployment().category(model.getCategory())
.name(model.getName()).key(model.getKey())
.addBpmnModel(model.getKey() + ".bpmn20.xml", bpmnModel)
.deploy();
model.setDeploymentId(deploy.getId());
repositoryService.saveModel(model);
return AjaxResult.success();
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("流程图不合规范,请重新设计");
}
}
@PostMapping("/remove/{modelId}")
@ResponseBody
public AjaxResult removeModel(@PathVariable String modelId) {
repositoryService.deleteModel(modelId);
return AjaxResult.success("删除成功");
}
@GetMapping("/export/{modelId}")
public void modelExport(@PathVariable String modelId, HttpServletResponse response) throws IOException {
byte[] modelData = repositoryService.getModelEditorSource(modelId);
JsonNode jsonNode = objectMapper.readTree(modelData);
BpmnModel bpmnModel = (new BpmnJsonConverter()).convertToBpmnModel(jsonNode);
byte[] xmlBytes = (new BpmnXMLConverter()).convertToXML(bpmnModel, "UTF-8");
ByteArrayInputStream in = new ByteArrayInputStream(xmlBytes);
String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
response.setHeader("Content-Disposition","attachment;filename=" + filename);
response.setHeader("content-Type", "application/xml");
response.flushBuffer();
IOUtils.copy(in, response.getOutputStream());
}
}

View File

@ -0,0 +1,286 @@
package com.zbf.web.controller.flowable;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.Leaveapply;
import com.zbf.system.domain.OutBound;
import com.zbf.system.service.IOutBoundService;
import com.zbf.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 出库申请单Controller
*
* @author tony
* @date 2024-08-07
*/
@RestController
@RequestMapping("/outbound")
public class OutBoundController extends BaseController
{
private String prefix = "flowable/outbound";
@Autowired
private IOutBoundService outBoundService;
@Autowired
private ISysUserService userService;
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@GetMapping()
public String outbound()
{
return prefix + "/outbound";
}
/**
* 查询出库申请单列表
*/
@GetMapping("/list")
public TableDataInfo list(OutBound outBound)
{
startPage();
List<OutBound> list = outBoundService.selectOutBoundList(outBound);
return getDataTable(list);
}
/**
* 导出出库申请单列表
*/
@Log(title = "出库申请单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OutBound outBound)
{
List<OutBound> list = outBoundService.selectOutBoundList(outBound);
ExcelUtil<OutBound> util = new ExcelUtil<OutBound>(OutBound.class);
util.exportExcel(response, list, "出库申请单数据");
}
/**
* 获取出库申请单详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(outBoundService.selectOutBoundById(id));
}
/**
* 新增出库申请单
*/
@Log(title = "出库申请单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OutBound outBound)
{
return toAjax(outBoundService.insertOutBound(outBound));
}
/**
* 修改出库申请单
*/
@Log(title = "出库申请单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OutBound outBound)
{
return toAjax(outBoundService.updateOutBound(outBound));
}
/**
* 删除出库申请单
*/
@Log(title = "出库申请单", businessType = BusinessType.DELETE)
@PostMapping("/remove")
public AjaxResult remove(String ids)
{
return toAjax(outBoundService.deleteOutBoundByIds(ids));
}
/**
* 启用
*/
@Log(title = "出库申请单", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(outBoundService.disabledOutBoundByIds(ids));
}
/**
* 禁用
*/
@Log(title = "出库申请单", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(outBoundService.enableOutBoundByIds(ids));
}
/**
* 修改状态
*/
@Log(title = "出库申请单", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody OutBound outBound) {
return toAjax(outBoundService.updateStatus(outBound));
}
/**
* 第一审批人
*/
@ApiOperation("第一审批人")
@GetMapping("/deptmanager")
@ResponseBody
public AjaxResult deptmanager(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
OutBound apply = outBoundService.selectOutBoundById(Long.parseLong(p.getBusinessKey()));
SysUser sysUser = userService.selectUserByUserName(apply.getApplyer());
if(sysUser != null){
apply.setApplyer(sysUser.getNickName());
}
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 第二审批人
*/
@ApiOperation("第二审批人")
@GetMapping("/managerName")
@ResponseBody
public AjaxResult manager(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
OutBound apply = outBoundService.selectOutBoundById(Long.parseLong(p.getBusinessKey()));
SysUser sysUser = userService.selectUserByUserName(apply.getApplyer());
if(sysUser != null){
apply.setApplyer(sysUser.getNickName());
}
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 第三审批人
*/
@ApiOperation("第三审批人")
@GetMapping("/crossDeptManager")
@ResponseBody
public AjaxResult crossDeptManager(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
OutBound apply = outBoundService.selectOutBoundById(Long.parseLong(p.getBusinessKey()));
SysUser sysUser = userService.selectUserByUserName(apply.getApplyer());
if(sysUser != null){
apply.setApplyer(sysUser.getNickName());
}
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
*
* 驳回后使用
* @return
*/
@ApiOperation("驳回")
@GetMapping("/reject")
@ResponseBody
public AjaxResult reject(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
OutBound apply = outBoundService.selectOutBoundById(Long.parseLong(p.getBusinessKey()));
SysUser sysUser = userService.selectUserByUserName(apply.getApplyer());
if(sysUser != null){
apply.setApplyer(sysUser.getNickName());
}
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 发起出库申请
* @return
*/
@ApiOperation("驳回到发起人")
@GetMapping("/addOutbound")
@ResponseBody
public AjaxResult addLeave(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
OutBound apply = outBoundService.selectOutBoundById(Long.parseLong(p.getBusinessKey()));
SysUser sysUser = userService.selectUserByUserName(apply.getApplyer());
if(sysUser != null){
apply.setApplyer(sysUser.getNickName());
}
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 调整申请
* @return
*/
@ApiOperation("调整申请")
@GetMapping("/modifyapply")
@ResponseBody
public AjaxResult modifyapply(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
OutBound apply = outBoundService.selectOutBoundById(Long.parseLong(p.getBusinessKey()));
SysUser sysUser = userService.selectUserByUserName(apply.getApplyer());
if(sysUser != null){
apply.setApplyer(sysUser.getNickName());
};
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
}

View File

@ -0,0 +1,221 @@
package com.zbf.web.controller.flowable;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.Purchase;
import com.zbf.system.service.IPurchaseService;
import com.zbf.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* 采购Controller
*
* @author shenzhanwang
* @date 2022-05-28
*/
@Controller
@RequestMapping("/purchase")
public class PurchaseController extends BaseController
{
private String prefix = "flowable/purchase";
@Autowired
private IPurchaseService purchaseService;
@Autowired
private ISysUserService userService;
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@GetMapping()
public String purchase()
{
return prefix + "/purchase";
}
/**
* 查询采购列表
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(Purchase purchase)
{
startPage();
List<Purchase> list = purchaseService.selectPurchaseList(purchase);
return getDataTable(list);
}
/**
* 导出采购列表
*/
@PostMapping("/export")
@ResponseBody
public AjaxResult export(Purchase purchase)
{
List<Purchase> list = purchaseService.selectPurchaseList(purchase);
ExcelUtil<Purchase> util = new ExcelUtil<Purchase>(Purchase.class);
return util.exportExcel(list, "采购数据");
}
/**
* 新增保存采购
*/
@ApiOperation("新增保存采购")
@Log(title = "采购", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Purchase purchase)
{
purchase.setApplytime(new Date());
return toAjax(purchaseService.insertPurchase(purchase));
}
@PostMapping("/edit")
@ResponseBody
public AjaxResult edit(Purchase purchase)
{
return toAjax(purchaseService.updatePurchase(purchase));
}
/**
* 删除采购
*/
@Log(title = "采购", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(purchaseService.deletePurchaseByIds(ids));
}
/**
* 采购经理审批
*/
@ApiOperation("采购经理审批")
@GetMapping("/purchasemanager")
@ResponseBody
public AjaxResult purchasemanager(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Purchase apply = purchaseService.selectPurchaseById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 财务审批
*/
@ApiOperation("财务审批")
@GetMapping("/finance")
@ResponseBody
public AjaxResult finance(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Purchase apply = purchaseService.selectPurchaseById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 总经理审批
*/
@ApiOperation("总经理审批")
@GetMapping("/manager")
@ResponseBody
public AjaxResult manager(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Purchase apply = purchaseService.selectPurchaseById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 出纳付款
*/
@ApiOperation("出纳付款")
@GetMapping("/pay")
@ResponseBody
public AjaxResult pay(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Purchase apply = purchaseService.selectPurchaseById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 收货确认
*/
@ApiOperation("收货确认")
@GetMapping("/receiveitem")
@ResponseBody
public AjaxResult receiveitem(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Purchase apply = purchaseService.selectPurchaseById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
/**
* 调整申请
*/
@ApiOperation("调整申请")
@GetMapping("/updateapply")
@ResponseBody
public AjaxResult updateapply(String taskid)
{
Task t = taskService.createTaskQuery().taskId(taskid).singleResult();
String processId = t.getProcessInstanceId();
ProcessInstance p = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
if (p != null) {
Purchase apply = purchaseService.selectPurchaseById(Long.parseLong(p.getBusinessKey()));
return AjaxResult.success(apply);
}
return AjaxResult.error("流程不存在");
}
}

View File

@ -0,0 +1,370 @@
package com.zbf.web.controller.flowable;
import cn.hutool.system.UserInfo;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.utils.SecurityUtils;
import com.zbf.common.utils.StringUtils;
import com.zbf.system.config.D_Service;
import com.zbf.system.domain.OutBound;
import com.zbf.system.domain.SysPost;
import com.zbf.system.domain.TCkOrders;
import com.zbf.system.domain.TaskInfo;
import com.zbf.system.mapper.OutBoundMapper;
import com.zbf.system.mapper.SysPostMapper;
import com.zbf.system.service.ISysPostService;
import com.zbf.system.service.ISysUserService;
import com.zbf.system.service.ITCkOrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import liquibase.pro.packaged.O;
import org.flowable.engine.FormService;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.user.UserRegistryMessageHandler;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.swing.text.StyledEditorKit;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Api(value = "待办任务接口")
@Controller
@RequestMapping("/task/manage")
public class TaskController extends BaseController {
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
FormService formService;
@Resource
private HistoryService historyService;
@Autowired
private ISysUserService userService;
@Autowired
private SysPostMapper sysPostMapper;
@Autowired
private ITCkOrdersService tCkOrdersService;
@Autowired
private D_Service d_service;
@Autowired
private OutBoundMapper outBoundMapper;
private String prefix = "flowable/task";
@GetMapping("/mytask")
public String mytasks() {
return prefix + "/mytasks";
}
@GetMapping("/alltasks")
public String alltasks() {
return prefix + "/alltasks";
}
/**
* 查询我的待办任务列表
*/
@ApiOperation("查询我的待办任务列表")
@PostMapping("/mylist")
@ResponseBody
public TableDataInfo mylist(TaskInfo param) {
SysUser user = SecurityUtils.getLoginUser().getUser();
String username = getUsername();
TaskQuery condition = taskService.createTaskQuery().taskAssignee(username);
if (StringUtils.isNotEmpty(param.getTaskName())) {
condition.taskName(param.getTaskName());
}
if (StringUtils.isNotEmpty(param.getProcessName())) {
condition.processDefinitionName(param.getProcessName());
}
// 过滤掉流程挂起的待办任务
int total = condition.active().orderByTaskCreateTime().desc().list().size();
int start = (param.getPageNum() - 1) * param.getPageSize();
List<Task> taskList = condition.active().orderByTaskCreateTime().desc().listPage(start, param.getPageSize());
List<TaskInfo> tasks = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
taskList.stream().forEach(a -> {
ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(a.getProcessInstanceId()).singleResult();
TaskInfo info = new TaskInfo();
SysUser user1 = userService.selectUserByUserName(a.getAssignee());
if (user1 == null) {
info.setAssignee(a.getAssignee());
} else {
info.setAssignee(user1.getNickName());
}
// info.setAssignee(a.getAssignee());
info.setBusinessKey(process.getBusinessKey());
info.setCreateTime(sdf.format(a.getCreateTime()));
info.setExecutionId(a.getExecutionId());
info.setProcessInstanceId(a.getProcessInstanceId());
info.setProcessName(process.getProcessDefinitionName());
info.setStarter(process.getStartUserId());
info.setStartTime(sdf.format(process.getStartTime()));
info.setTaskId(a.getId());
String formKey = formService.getTaskFormData(a.getId()).getFormKey();
info.setFormKey(formKey);
if (formKey.contains("outbound")) {
info.setTaskName("出库通知单审批申请");
} else {
info.setTaskName(a.getName());
}
tasks.add(info);
});
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(tasks);
rspData.setTotal(total);
return rspData;
}
/**
* 查询所有待办任务列表
*/
@ApiOperation("查询所有待办任务列表")
@PostMapping("/alllist")
@ResponseBody
public TableDataInfo alllist(TaskInfo param) {
TaskQuery condition = taskService.createTaskQuery();
if (StringUtils.isNotEmpty(param.getTaskName())) {
condition.taskName(param.getTaskName());
}
if (StringUtils.isNotEmpty(param.getProcessName())) {
condition.processDefinitionName(param.getProcessName());
}
int total = condition.active().orderByTaskCreateTime().desc().list().size();
int start = (param.getPageNum() - 1) * param.getPageSize();
List<Task> taskList = condition.active().orderByTaskCreateTime().desc().listPage(start, param.getPageSize());
List<TaskInfo> tasks = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
taskList.stream().forEach(a -> {
ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(a.getProcessInstanceId()).singleResult();
TaskInfo info = new TaskInfo();
SysUser user1 = userService.selectUserByUserName(a.getAssignee());
if (user1 == null) {
info.setAssignee(a.getAssignee());
} else {
info.setAssignee(user1.getNickName());
}
// info.setAssignee(a.getAssignee());
info.setBusinessKey(process.getBusinessKey());
info.setCreateTime(sdf.format(a.getCreateTime()));
// info.setTaskName(a.getName());
info.setExecutionId(a.getExecutionId());
info.setProcessInstanceId(a.getProcessInstanceId());
info.setProcessName(process.getProcessDefinitionName());
info.setStarter(process.getStartUserId());
info.setStartTime(sdf.format(process.getStartTime()));
info.setTaskId(a.getId());
String formKey = formService.getTaskFormData(a.getId()).getFormKey();
info.setFormKey(formKey);
if (formKey.contains("outbound")) {
info.setTaskName("出库通知单审批申请");
} else {
info.setTaskName(a.getName());
}
tasks.add(info);
});
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(tasks);
rspData.setTotal(total);
return rspData;
}
/**
* 用taskid查询formkey
**/
@ApiOperation("用taskid查询formkey")
@PostMapping("/forminfo/{taskId}")
@ResponseBody
public AjaxResult alllist(@PathVariable String taskId) {
String formKey = formService.getTaskFormData(taskId).getFormKey();
return AjaxResult.success(formKey);
}
@ApiOperation("办理一个用户任务")
@RequestMapping(value = "/completeTask/{taskId}", method = RequestMethod.POST)
@ResponseBody
public AjaxResult completeTask(@PathVariable("taskId") String taskId, @RequestBody(required = false) Map<String, Object> variables) {
logger.info("办理一个代办:{}",taskId);
String username = getUsername();
taskService.setAssignee(taskId, username);
//存储审核结果
variables.put(username, variables.get("result"));
SysUser user = userService.selectUserByUserName(username);
// 查出流程实例id
String processInstanceId = taskService.createTaskQuery().taskId(taskId).singleResult().getProcessInstanceId();
if (variables == null) {
taskService.complete(taskId);
} else {
// 添加审批意见
String comment = StringUtils.EMPTY;
if (variables.get("comment") != null) {
taskService.addComment(taskId, processInstanceId, (String) variables.get("comment"));
comment = (String) variables.get("comment");
variables.remove("comment");
}
String deliveryId = (String)runtimeService.getVariable(processInstanceId, "deliveryId");
TCkOrders tCkOrders1 = tCkOrdersService.selectTCkOrdersByDeliveryId(deliveryId);
TCkOrders tCkOrders = new TCkOrders();
tCkOrders.setId(tCkOrders1.getId());
String auditMan = tCkOrders1.getAuditMan();
if (StringUtils.isNotBlank(auditMan)) {
tCkOrders.setAuditMan(auditMan + "->" + user.getNickName());
} else {
tCkOrders.setAuditMan(user.getNickName());
}
tCkOrders.setAuditDate(new Date());
//更新出库明细
String dResult = StringUtils.EMPTY;
if ("false".equals(variables.get("result"))) {
dResult = "refuse";
if (StringUtils.isNotBlank(comment)) {
if (StringUtils.isNotBlank(tCkOrders1.getRejectReason())) {
tCkOrders.setRejectReason(tCkOrders1.getRejectReason() + "|" + user.getNickName() + ":拒绝,原因:" + comment);
} else {
tCkOrders.setRejectReason(user.getNickName() + ":拒绝,原因:" + comment);
}
} else {
if (StringUtils.isNotBlank(tCkOrders1.getRejectReason())) {
tCkOrders.setRejectReason(tCkOrders1.getRejectReason() + "|" + user.getNickName() + ":拒绝");
} else
tCkOrders.setRejectReason(user.getNickName() + ":拒绝");
}
} else {
dResult = "agree";
if (StringUtils.isNotBlank(comment)) {
if (StringUtils.isNotBlank(tCkOrders1.getRejectReason())) {
tCkOrders.setRejectReason(tCkOrders1.getRejectReason() + "|" + user.getNickName() + ":同意,意见:" + comment);
} else {
tCkOrders.setRejectReason(user.getNickName() + ":同意,意见:" + comment);
}
} else {
if (StringUtils.isNotBlank(tCkOrders1.getRejectReason())) {
tCkOrders.setRejectReason(tCkOrders1.getRejectReason() + "|" + user.getNickName() + ":同意");
} else
tCkOrders.setRejectReason(user.getNickName() + ":同意");
}
}
tCkOrders.setRemark(dResult);
if("refuse".equalsIgnoreCase(dResult)){
tCkOrders.setIsAudit("3");
}
tCkOrdersService.updateTCkOrders(tCkOrders);
String instanceId = (String)runtimeService.getVariable(processInstanceId, "instanceId");
taskService.complete(taskId, variables);
//更新下一个任务id
List<Task> nextTasks = taskService.createTaskQuery()
.processInstanceId(processInstanceId) // 根据流程实例 ID 查询
.orderByTaskCreateTime().desc() // 按任务创建时间排序
.list();
if (!nextTasks.isEmpty()) {
Task nextTask = nextTasks.get(0); // 获取下一个任务
String nextTaskId = nextTask.getId();
System.out.println("下一个任务的 ID: " + nextTaskId);
OutBound outBound = new OutBound();
outBound.setfInstanceId(processInstanceId);
List<OutBound> outBounds = outBoundMapper.selectOutBoundList(outBound);
if(!outBounds.isEmpty()){
OutBound outBound1 = outBounds.get(0);
OutBound outBound44 = new OutBound();
outBound44.setId(outBound1.getId());
outBound44.setTaskId(nextTaskId);
outBound44.setUpdateTime(new Date());
outBound44.setFinishName(username);
outBoundMapper.updateOutBound(outBound44);
}
}
//同步钉钉
//根据taskId查询钉钉实例ID
// Map<String, Object> variables1 = taskService.getVariables(taskId);
// String instanceId = (String)runtimeService.getVariable(processInstanceId, "instanceId");
// String instanceId =(String) variables1.get("instanceId");
logger.info("发起同步钉钉,钉钉实例ID=====》》》》{} ",instanceId);
// logger.info("发起同步钉钉,获取所有变量:==》》》》{} ",variables1);
// variables1.forEach((key, value) -> logger.info(key + ": " + value));
if(StringUtils.isNotBlank(instanceId)) {
d_service.auditStatusToDd(instanceId, username, dResult);
}
}
return AjaxResult.success();
}
@ApiOperation("任务办理时间轴")
@RequestMapping(value = "/history/{taskId}", method = RequestMethod.GET)
@ResponseBody
public List<TaskInfo> history(@PathVariable String taskId) {
String processInstanceId = taskService.createTaskQuery().taskId(taskId).singleResult().getProcessInstanceId();
List<HistoricActivityInstance> history = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).activityType("userTask").orderByHistoricActivityInstanceStartTime().asc().list();
List<TaskInfo> infos = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
history.stream().forEach(h -> {
TaskInfo info = new TaskInfo();
info.setProcessInstanceId(h.getProcessInstanceId());
info.setStartTime(sdf.format(h.getStartTime()));
if (h.getEndTime() != null) {
info.setEndTime(sdf.format(h.getEndTime()));
}
//根据用户名或者昵称
Map<String, Object> variables = taskService.getVariables(taskId);
SysUser user = userService.selectUserByUserName(h.getAssignee());
// info.setAssignee(h.getAssignee());
StringBuilder userInfo = new StringBuilder();
if (user != null) {
List<SysPost> sysPosts = sysPostMapper.selectPostsByUserName(user.getUserName());
userInfo.append("" + user.getDept().getDeptName() + "");
userInfo.append("");
for (SysPost post : sysPosts) {
userInfo.append(post.getPostName()).append(" ");
}
;
userInfo.append("");
userInfo.append(user.getNickName());
} else {
userInfo.append(h.getAssignee());
}
String result = (String) variables.get(h.getAssignee());
info.setAssignee(userInfo.toString());
if ("true".equals(result)) {
info.setResult("同意");
} else if ("false".equals(result)) {
info.setResult("拒绝");
}
// info.setTaskName(h.getActivityName());
// info.setTaskName("出库通知单申请");
List<Comment> comments = taskService.getTaskComments(h.getTaskId());
if (comments.size() > 0) {
info.setComment(comments.get(0).getFullMessage());
}
infos.add(info);
});
return infos;
}
}

View File

@ -0,0 +1,120 @@
package com.zbf.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.constant.CacheConstants;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.utils.StringUtils;
import com.zbf.system.domain.SysCache;
/**
* 缓存监控
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
@Autowired
private RedisTemplate<String, String> redisTemplate;
private final static List<SysCache> caches = new ArrayList<SysCache>();
{
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames")
public AjaxResult cache()
{
return AjaxResult.success(caches);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}")
public AjaxResult getCacheKeys(@PathVariable String cacheName)
{
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
return AjaxResult.success(cacheKeys);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}")
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
{
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return AjaxResult.success(sysCache);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}")
public AjaxResult clearCacheName(@PathVariable String cacheName)
{
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}")
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
{
redisTemplate.delete(cacheKey);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll")
public AjaxResult clearCacheAll()
{
Collection<String> cacheKeys = redisTemplate.keys("*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
}

View File

@ -0,0 +1,27 @@
package com.zbf.web.controller.monitor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.framework.web.domain.Server;
/**
* 服务器监控
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController
{
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}

View File

@ -0,0 +1,82 @@
package com.zbf.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
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 com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.framework.web.service.SysPasswordService;
import com.zbf.system.domain.SysLogininfor;
import com.zbf.system.service.ISysLogininforService;
/**
* 系统访问记录
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{
@Autowired
private ISysLogininforService logininforService;
@Autowired
private SysPasswordService passwordService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return success();
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}")
public AjaxResult unlock(@PathVariable("userName") String userName)
{
passwordService.clearLoginRecordCache(userName);
return success();
}
}

View File

@ -0,0 +1,69 @@
package com.zbf.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
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 com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.SysOperLog;
import com.zbf.system.service.ISysOperLogService;
/**
* 操作日志记录
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return success();
}
}

View File

@ -0,0 +1,83 @@
package com.zbf.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.constant.CacheConstants;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.model.LoginUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.core.redis.RedisCache;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.StringUtils;
import com.zbf.system.domain.SysUserOnline;
import com.zbf.system.service.ISysUserOnlineService;
/**
* 在线用户监控
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
else if (StringUtils.isNotEmpty(ipaddr))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 强退用户
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return success();
}
}

View File

@ -0,0 +1,73 @@
package com.zbf.web.controller.section;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.generator.util.ColumnUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import static com.zbf.common.utils.PageUtils.startPage;
@Aspect
@Component
public class DataListAspect {
@Pointcut("@annotation(EnhanceDataList)")
public void dataListPointcut() {}
//分页不处理
@Around(value = "dataListPointcut()")
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
// 先执行目标方法
Object result = joinPoint.proceed();
// 检查结果是否为 TableDataInfo 实例
if (result instanceof TableDataInfo) {
TableDataInfo dataTable = (TableDataInfo) result;
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
EnhanceDataList enhanceDataList = signature.getMethod().getAnnotation(EnhanceDataList.class);
// 设置列信息
dataTable.setColumns(ColumnUtils.getColumnsJson(enhanceDataList.entityType()));
// 在这里添加其他逻辑来修改 dataTable
// 例如重新计算 total 或修改 rows
// dataTable.setTotal(newTotal);
// dataTable.setRows(newRows);
return dataTable; // 返回修改后的 dataTable
}
return result; // 如果结果不是 TableDataInfo 实例直接返回原结果
}
//集合类
@Pointcut("@annotation(ListColumns)")
public void list() {}
@Around("list()")
public Object lists(ProceedingJoinPoint joinPoint) throws Throwable {
Object result = joinPoint.proceed();
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
ListColumns columns = signature.getMethod().getAnnotation(ListColumns.class);
if (result instanceof Map) {
Map<String, Object> map = (Map<String, Object>) result;
// 确保list也被放入map中
if (joinPoint.getArgs().length > 0 && joinPoint.getArgs()[0] instanceof List) {
map.put("list", joinPoint.getArgs()[0]);
}
map.put("columns", ColumnUtils.getColumnsJson(columns.value()));
}
return result;
}
}

View File

@ -0,0 +1,12 @@
package com.zbf.web.controller.section;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EnhanceDataList {
Class<?> entityType();
}

View File

@ -0,0 +1,15 @@
package com.zbf.web.controller.section;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ListColumns {
Class<?> value();
}

View File

@ -0,0 +1,42 @@
package com.zbf.web.controller.system;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.system.domain.AppVersions;
import com.zbf.system.mapper.AppVersionsMapper;
import com.zbf.system.service.IAppVersionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/system/app")
public class AppVerController extends BaseController {
@Autowired
private AppVersionsMapper appVersionsMapper;
@GetMapping("/ver")
public AjaxResult list(AppVersions appVersions) {
AppVersions ver = appVersionsMapper.selectOne(null);
if (ver != null) {
if (ver.getHversion().equals(ver.getVersion())) {
return AjaxResult.warn("暂无更新");
}
}
return AjaxResult.success(ver);
}
}

View File

@ -0,0 +1,129 @@
package com.zbf.web.controller.system;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.system.domain.DeviceLog;
import com.zbf.system.service.IDeviceLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 请填写功能名称Controller
*
* @author tony
* @date 2024-10-22
*/
@RestController
@RequestMapping("/system/log")
public class DeviceLogController extends BaseController
{
@Autowired
private IDeviceLogService deviceLogService;
/**
* 查询请填写功能名称列表
*/
@GetMapping("/list")
public TableDataInfo list(DeviceLog deviceLog)
{
startPage();
List<DeviceLog> list = deviceLogService.selectDeviceLogList(deviceLog);
return getDataTable(list);
}
/**
* 导出请填写功能名称列表
*//*
@PreAuthorize("@ss.hasPermi('system:log:export')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DeviceLog deviceLog)
{
List<DeviceLog> list = deviceLogService.selectDeviceLogList(deviceLog);
ExcelUtil<DeviceLog> util = new ExcelUtil<DeviceLog>(DeviceLog.class);
util.exportExcel(response, list, "【请填写功能名称】数据");
}*/
/**
* 推送
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return deviceLogService.selectDeviceLogById(id);
}
/* *//**
* 新增请填写功能名称
*//*
@PreAuthorize("@ss.hasPermi('system:log:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DeviceLog deviceLog)
{
return toAjax(deviceLogService.insertDeviceLog(deviceLog));
}
*//**
* 修改请填写功能名称
*//*
@PreAuthorize("@ss.hasPermi('system:log:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DeviceLog deviceLog)
{
return toAjax(deviceLogService.updateDeviceLog(deviceLog));
}
*//**
* 删除请填写功能名称
*//*
@PreAuthorize("@ss.hasPermi('system:log:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deviceLogService.deleteDeviceLogByIds(ids));
}
*//**
* 启用
*//*
@PreAuthorize("@ss.hasPermi('system:log:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(deviceLogService.disabledDeviceLogByIds(ids));
}
*//**
* 禁用
*//*
@PreAuthorize("@ss.hasPermi('system:log:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PostMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(deviceLogService.enableDeviceLogByIds(ids));
}
*//**
* 修改状态
*//*
@PreAuthorize("@ss.hasPermi('system:log:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody DeviceLog deviceLog) {
return toAjax(deviceLogService.updateStatus(deviceLog));
}*/
}

View File

@ -0,0 +1,132 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.InventoryCheck;
import com.zbf.system.service.IInventoryCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 盘点主Controller
*
* @author tony
* @date 2024-10-31
*/
@RestController
@RequestMapping("/system/check")
public class InventoryCheckController extends BaseController
{
@Autowired
private IInventoryCheckService inventoryCheckService;
/**
* 查询盘点主列表
*/
@PreAuthorize("@ss.hasPermi('system:check:list')")
@GetMapping("/list")
public TableDataInfo list(InventoryCheck inventoryCheck)
{
startPage();
List<InventoryCheck> list = inventoryCheckService.selectInventoryCheckList(inventoryCheck);
return getDataTable(list);
}
/**
* 导出盘点主列表
*/
@PreAuthorize("@ss.hasPermi('system:check:export')")
@Log(title = "盘点主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, InventoryCheck inventoryCheck)
{
List<InventoryCheck> list = inventoryCheckService.selectInventoryCheckList(inventoryCheck);
ExcelUtil<InventoryCheck> util = new ExcelUtil<InventoryCheck>(InventoryCheck.class);
util.exportExcel(response, list, "盘点主数据");
}
/**
* 获取盘点主详细信息
*/
@PreAuthorize("@ss.hasPermi('system:check:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(inventoryCheckService.selectInventoryCheckById(id));
}
/**
* 新增盘点主
*/
@PreAuthorize("@ss.hasPermi('system:check:add')")
@Log(title = "盘点主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody InventoryCheck inventoryCheck)
{
return toAjax(inventoryCheckService.insertInventoryCheck(inventoryCheck));
}
/**
* 修改盘点主
*/
@PreAuthorize("@ss.hasPermi('system:check:edit')")
@Log(title = "盘点主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody InventoryCheck inventoryCheck)
{
return toAjax(inventoryCheckService.updateInventoryCheck(inventoryCheck));
}
/**
* 删除盘点主
*/
@PreAuthorize("@ss.hasPermi('system:check:remove')")
@Log(title = "盘点主", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(inventoryCheckService.deleteInventoryCheckByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:check:remove')")
@Log(title = "盘点主", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(inventoryCheckService.disabledInventoryCheckByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:check:edit')")
@Log(title = "盘点主", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(inventoryCheckService.enableInventoryCheckByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:check:edit')")
@Log(title = "盘点主", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody InventoryCheck inventoryCheck) {
return toAjax(inventoryCheckService.updateStatus(inventoryCheck));
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
package com.zbf.web.controller.system;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
import javax.net.ssl.SSLContext;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.TrustStrategy;
import java.security.cert.X509Certificate;
@Configuration
public class RestClientConfig {
@Bean(name = "defaultRestTemplate")
public RestTemplate restTemplates() throws Exception {
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy)
.build();
CloseableHttpClient httpClient = HttpClients.custom()
.setSslcontext(sslContext)
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
.build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);
return new RestTemplate(requestFactory);
}
}

View File

@ -0,0 +1,133 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.SysConfig;
import com.zbf.system.service.ISysConfigService;
/**
* 参数配置 信息操作处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{
@Autowired
private ISysConfigService configService;
/**
* 获取参数配置列表
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
util.exportExcel(response, list, "参数数据");
}
/**
* 根据参数编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId)
{
return success(configService.selectConfigById(configId));
}
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey)
{
return success(configService.selectConfigByKey(configKey));
}
/**
* 新增参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
configService.deleteConfigByIds(configIds);
return success();
}
/**
* 刷新参数缓存
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return success();
}
}

View File

@ -0,0 +1,155 @@
package com.zbf.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.constant.UserConstants;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysDept;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.StringUtils;
import com.zbf.system.service.ISysDeptService;
/**
* 部门信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
@Autowired
private ISysDeptService deptService;
/**
* 获取部门列表
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return success(depts);
}
@GetMapping("/supplier")
public AjaxResult supplier()
{
SysDept dept = new SysDept();
dept.setStatus("0");
dept.setDelFlag("0");
List<SysDept> depts = deptService.selectDeptList(dept);
List<SysDept> collect = depts.stream().filter(f -> f.getAncestors().split(",").length == 3).collect(Collectors.toList());
return success(collect);
}
/**
* 查询部门列表排除节点
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return success(depts);
}
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
/**
* 根据部门编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
deptService.checkDeptDataScope(deptId);
return success(deptService.selectDeptById(deptId));
}
/**
* 新增部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
{
if (!deptService.checkDeptNameUnique(dept))
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(getUsername());
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept))
{
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(deptId))
{
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
{
return error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
* 删除部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return warn("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return warn("部门存在用户,不允许删除");
}
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
}

View File

@ -0,0 +1,134 @@
package com.zbf.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysDictData;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.service.ISysDictDataService;
import com.zbf.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
{
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, list, "字典数据");
}
/**
* 查询字典数据详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
return success(dictDataService.selectDictDataById(dictCode));
}
/**
* 查询字典数据详细
*/
//@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/queryLabel")
public AjaxResult getInfo(SysDictData dictData)
{
return success(dictDataService.selectDictLabel(dictData.getDictType(),dictData.getDictValue()));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return success(data);
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
{
dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改保存字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{
dict.setUpdateBy(getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
}

View File

@ -0,0 +1,131 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysDictType;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController
{
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型");
}
/**
* 查询字典类型详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId)
{
return success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds)
{
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
/**
* 刷新字典缓存
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
dictTypeService.resetDictCache();
return success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return success(dictTypes);
}
}

View File

@ -0,0 +1,104 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.SysExpression;
import com.zbf.system.service.ISysExpressionService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* 流程达式Controller
*
* @author ruoyi
* @date 2022-12-12
*/
@RestController
@RequestMapping("/system/expression")
public class SysExpressionController extends BaseController
{
@Autowired
private ISysExpressionService sysExpressionService;
/**
* 查询流程达式列表
*/
@PreAuthorize("@ss.hasPermi('system:expression:list')")
@GetMapping("/list")
public TableDataInfo list(SysExpression sysExpression)
{
startPage();
List<SysExpression> list = sysExpressionService.selectSysExpressionList(sysExpression);
return getDataTable(list);
}
/**
* 导出流程达式列表
*/
@PreAuthorize("@ss.hasPermi('system:expression:export')")
@Log(title = "流程达式", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysExpression sysExpression)
{
List<SysExpression> list = sysExpressionService.selectSysExpressionList(sysExpression);
ExcelUtil<SysExpression> util = new ExcelUtil<SysExpression>(SysExpression.class);
util.exportExcel(response, list, "流程达式数据");
}
/**
* 获取流程达式详细信息
*/
@PreAuthorize("@ss.hasPermi('system:expression:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sysExpressionService.selectSysExpressionById(id));
}
/**
* 新增流程达式
*/
@PreAuthorize("@ss.hasPermi('system:expression:add')")
@Log(title = "流程达式", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysExpression sysExpression)
{
return toAjax(sysExpressionService.insertSysExpression(sysExpression));
}
/**
* 修改流程达式
*/
@PreAuthorize("@ss.hasPermi('system:expression:edit')")
@Log(title = "流程达式", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysExpression sysExpression)
{
return toAjax(sysExpressionService.updateSysExpression(sysExpression));
}
/**
* 删除流程达式
*/
@PreAuthorize("@ss.hasPermi('system:expression:remove')")
@Log(title = "流程达式", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysExpressionService.deleteSysExpressionByIds(ids));
}
}

View File

@ -0,0 +1,29 @@
package com.zbf.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.config.RuoYiConfig;
import com.zbf.common.utils.StringUtils;
/**
* 首页
*
* @author ruoyi
*/
@RestController
public class SysIndexController
{
/** 系统基础配置 */
@Autowired
private RuoYiConfig ruoyiConfig;
/**
* 访问首页提示语
*/
@RequestMapping("/")
public String index()
{
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
}
}

View File

@ -0,0 +1,104 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.SysListener;
import com.zbf.system.service.ISysListenerService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* 流程监听Controller
*
* @author Tony
* @date 2022-12-25
*/
@RestController
@RequestMapping("/system/listener")
public class SysListenerController extends BaseController
{
@Autowired
private ISysListenerService sysListenerService;
/**
* 查询流程监听列表
*/
@PreAuthorize("@ss.hasPermi('system:listener:list')")
@GetMapping("/list")
public TableDataInfo list(SysListener sysListener)
{
startPage();
List<SysListener> list = sysListenerService.selectSysListenerList(sysListener);
return getDataTable(list);
}
/**
* 导出流程监听列表
*/
@PreAuthorize("@ss.hasPermi('system:listener:export')")
@Log(title = "流程监听", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysListener sysListener)
{
List<SysListener> list = sysListenerService.selectSysListenerList(sysListener);
ExcelUtil<SysListener> util = new ExcelUtil<SysListener>(SysListener.class);
util.exportExcel(response, list, "流程监听数据");
}
/**
* 获取流程监听详细信息
*/
@PreAuthorize("@ss.hasPermi('system:listener:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sysListenerService.selectSysListenerById(id));
}
/**
* 新增流程监听
*/
@PreAuthorize("@ss.hasPermi('system:listener:add')")
@Log(title = "流程监听", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysListener sysListener)
{
return toAjax(sysListenerService.insertSysListener(sysListener));
}
/**
* 修改流程监听
*/
@PreAuthorize("@ss.hasPermi('system:listener:edit')")
@Log(title = "流程监听", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysListener sysListener)
{
return toAjax(sysListenerService.updateSysListener(sysListener));
}
/**
* 删除流程监听
*/
@PreAuthorize("@ss.hasPermi('system:listener:remove')")
@Log(title = "流程监听", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysListenerService.deleteSysListenerByIds(ids));
}
}

View File

@ -0,0 +1,142 @@
package com.zbf.web.controller.system;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.common.constant.Constants;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.TreeSelect;
import com.zbf.common.core.domain.entity.SysMenu;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.domain.model.LoginBody;
import com.zbf.common.utils.RsaUtils;
import com.zbf.common.utils.SecurityUtils;
import com.zbf.framework.web.service.SysLoginService;
import com.zbf.framework.web.service.SysPermissionService;
import com.zbf.system.domain.TBaseStorage;
import com.zbf.system.domain.TUserFavorites;
import com.zbf.system.domain.vo.MetaVo;
import com.zbf.system.domain.vo.RouterVo;
import com.zbf.system.mapper.TUserFavoritesMapper;
import com.zbf.system.service.ISysDeptService;
import com.zbf.system.service.ISysMenuService;
import com.zbf.system.service.ITBaseStorageService;
import cn.hutool.json.JSONUtil;
/**
* 登录验证
*
* @author ruoyi
*/
@RestController
public class SysLoginController {
private final SysLoginService loginService;
private final ISysMenuService menuService;
private final SysPermissionService permissionService;
@Autowired
private ITBaseStorageService baseStorageService;
private ISysDeptService deptService;
private TUserFavoritesMapper favoritesMapper;
public SysLoginController(ISysDeptService deptService, SysLoginService loginService, ISysMenuService menuService, SysPermissionService permissionService, TUserFavoritesMapper favoritesMapper) {
this.deptService = deptService;
this.loginService = loginService;
this.menuService = menuService;
this.permissionService = permissionService;
this.favoritesMapper = favoritesMapper;
}
/**
* 获取公钥 前端用来密码加密
*
* @return
*/
@GetMapping("/publicKey")
public RsaUtils.RsaKeyPair publicKey() {
return RsaUtils.rsaKeyPair();
}
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("getInfo")
public AjaxResult getInfo() {
SysUser user = SecurityUtils.getLoginUser().getUser();
List<TreeSelect> deptList = deptService.selectDeptTreeList(deptService.selectDeptById(user.getDeptId()));
// 根据用户ID查询出此用户所有收藏的状态为有效的路由 只查询10条
LambdaQueryWrapper<TUserFavorites> query = new LambdaQueryWrapper<TUserFavorites>();
query.eq(TUserFavorites::getUserId, user.getUserId());
query.eq(TUserFavorites::getStatus, "0");
query.orderByDesc(TUserFavorites::getUpdateTime);
List<TUserFavorites> favorites = favoritesMapper.selectList(query);
List<RouterVo> routers = favorites.stream().map(favorite -> {
MetaVo metaVo = JSONUtil.toBean(favorite.getMeta(), MetaVo.class);
RouterVo routerVo = new RouterVo();
routerVo.setId(favorite.getId());
routerVo.setMeta(metaVo);
routerVo.setPath(favorite.getFullPath());
routerVo.setName(favorite.getTitle());
return routerVo;
}).collect(Collectors.toList());
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
// 获取用户所属仓库列表
TBaseStorage baseStorage = new TBaseStorage();
baseStorage.setDeptId(user.getDeptId());
List<TBaseStorage> tStorages = baseStorageService.selectTBaseStorageList(baseStorage);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
ajax.put("deptList", deptList);
ajax.put("storageList", tStorages.stream().map(TBaseStorage::getStorageId).collect(Collectors.toList()));
int toIdx = routers.size() > 10 ? 10 : routers.size();
ajax.put("favoriteRouter", routers.subList(0, toIdx)); // 当前用户收藏的路由信息
return ajax;
}
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("getRouters")
public AjaxResult getRouters() {
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus));
}
}

View File

@ -0,0 +1,150 @@
package com.zbf.web.controller.system;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zbf.system.domain.TUserConfig;
import com.zbf.system.domain.TUserFavorites;
import com.zbf.system.mapper.TUserConfigMapper;
import com.zbf.system.mapper.TUserFavoritesMapper;
import com.zbf.system.service.ITUserConfigService;
import com.zbf.system.service.ITUserFavoritesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.constant.UserConstants;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysMenu;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.StringUtils;
import com.zbf.system.service.ISysMenuService;
/**
* 菜单信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController {
@Autowired
private ISysMenuService menuService;
@Autowired
private TUserFavoritesMapper userFavoritesMapper;
@Autowired
private TUserConfigMapper userConfigMapper;
/**
* 获取菜单列表
*/
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list")
public AjaxResult list(SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menus);
}
/**
* 根据菜单编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId) {
return success(menuService.selectMenuById(menuId));
}
/**
* 获取菜单下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menuService.buildMenuTreeSelect(menus));
}
/**
* 加载对应角色菜单列表树
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
List<SysMenu> menus = menuService.selectMenuList(getUserId());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
/**
* 新增菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} else if (menu.getMenuId().equals(menu.getParentId())) {
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
String oldPath = menuService.buildAllRouterPath(menu);
String newPath = menuService.buildAllRouterPath1(menu);
TUserFavorites tUserFavorites = new TUserFavorites();
tUserFavorites.setFullPath(newPath); // 新的路由地址
Wrapper wrapper = new QueryWrapper<TUserFavorites>().eq("full_path", oldPath); // 旧的路由地址
userFavoritesMapper.update(tUserFavorites, wrapper);
menu.setUpdateBy(getUsername());
return toAjax(menuService.updateMenu(menu));
}
/**
* 删除菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) {
return warn("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId)) {
return warn("菜单已分配,不允许删除");
}
// 根据条件routerPath等于要删除的菜单的组件路径, 删除userConfig表中的数据
SysMenu menu1 = menuService.selectMenuById(menuId);
Wrapper wrapper = new QueryWrapper<TUserConfig>().eq("router_path", menu1.getComponent());
userConfigMapper.delete(wrapper);
return toAjax(menuService.deleteMenuById(menuId));
}
}

View File

@ -0,0 +1,91 @@
package com.zbf.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.SysNotice;
import com.zbf.system.service.ISysNoticeService;
/**
* 公告 信息操作处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
{
@Autowired
private ISysNoticeService noticeService;
/**
* 获取通知公告列表
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
* 根据通知公告编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId)
{
return success(noticeService.selectNoticeById(noticeId));
}
/**
* 新增通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(getUsername());
return toAjax(noticeService.insertNotice(notice));
}
/**
* 修改通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(getUsername());
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -0,0 +1,129 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.SysPost;
import com.zbf.system.service.ISysPostService;
/**
* 岗位信息操作处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/post")
public class SysPostController extends BaseController
{
@Autowired
private ISysPostService postService;
/**
* 获取岗位列表
*/
@PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
}
/**
* 根据岗位编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId)
{
return success(postService.selectPostById(postId));
}
/**
* 新增岗位
*/
@PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(getUsername());
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(getUsername());
return toAjax(postService.updatePost(post));
}
/**
* 删除岗位
*/
@PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds)
{
return toAjax(postService.deletePostByIds(postIds));
}
/**
* 获取岗位选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysPost> posts = postService.selectPostAll();
return success(posts);
}
}

View File

@ -0,0 +1,141 @@
package com.zbf.web.controller.system;
import com.zbf.common.utils.RsaUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.zbf.common.annotation.Log;
import com.zbf.common.config.RuoYiConfig;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.domain.model.LoginUser;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.SecurityUtils;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.file.FileUploadUtils;
import com.zbf.common.utils.file.MimeTypeUtils;
import com.zbf.framework.web.service.TokenService;
import com.zbf.system.service.ISysUserService;
/**
* 个人信息 业务处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController
{
@Autowired
private ISysUserService userService;
@Autowired
private TokenService tokenService;
/**
* 个人信息
*/
@GetMapping
public AjaxResult profile()
{
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
return ajax;
}
/**
* 修改用户
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user)
{
LoginUser loginUser = getLoginUser();
SysUser currentUser = loginUser.getUser();
currentUser.setNickName(user.getNickName());
currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
{
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
}
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
{
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
}
if (userService.updateUserProfile(currentUser) > 0)
{
// 更新缓存用户信息
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改个人信息异常,请联系管理员");
}
/**
* 重置密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword) throws Exception {
LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername();
String password = loginUser.getPassword();
//解密
oldPassword = RsaUtils.decryptByPrivateKey(oldPassword);
newPassword = RsaUtils.decryptByPrivateKey(newPassword);
if (!SecurityUtils.matchesPassword(oldPassword, password))
{
return error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newPassword, password))
{
return error("新密码不能与旧密码相同");
}
newPassword = SecurityUtils.encryptPassword(newPassword);
if (userService.resetUserPwd(userName, newPassword) > 0)
{
// 更新缓存用户密码
loginUser.getUser().setPassword(newPassword);
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改密码异常,请联系管理员");
}
/**
* 头像上传
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
{
if (!file.isEmpty())
{
LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
{
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
// 更新缓存用户头像
loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return error("上传图片异常,请联系管理员");
}
}

View File

@ -0,0 +1,38 @@
package com.zbf.web.controller.system;
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.RestController;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.model.RegisterBody;
import com.zbf.common.utils.StringUtils;
import com.zbf.framework.web.service.SysRegisterService;
import com.zbf.system.service.ISysConfigService;
/**
* 注册验证
*
* @author ruoyi
*/
@RestController
public class SysRegisterController extends BaseController
{
@Autowired
private SysRegisterService registerService;
@Autowired
private ISysConfigService configService;
@PostMapping("/register")
public AjaxResult register(@RequestBody RegisterBody user)
{
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{
return error("当前系统没有开启注册功能!");
}
String msg = registerService.register(user);
return StringUtils.isEmpty(msg) ? success() : error(msg);
}
}

View File

@ -0,0 +1,275 @@
package com.zbf.web.controller.system;
import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysDept;
import com.zbf.common.core.domain.entity.SysRole;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.domain.model.LoginUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.framework.web.service.SysPermissionService;
import com.zbf.framework.web.service.TokenService;
import com.zbf.system.domain.SysUserRole;
import com.zbf.system.service.ISysDeptService;
import com.zbf.system.service.ISysRoleService;
import com.zbf.system.service.ISysUserService;
/**
* 角色信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/role")
public class SysRoleController extends BaseController
{
@Autowired
private ISysRoleService roleService;
@Autowired
private TokenService tokenService;
@Autowired
private SysPermissionService permissionService;
@Autowired
private ISysUserService userService;
@Autowired
private ISysDeptService deptService;
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list")
public TableDataInfo list(SysRole role)
{
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysRole role)
{
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
util.exportExcel(response, list, "角色数据");
}
/**
* 根据角色顺序最大值
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/selectMaxRoleSort")
public AjaxResult queryMaxRoleSort()
{
return success(roleService.selectMaxRoleSort());
}
/**
* 根据角色编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId)
{
roleService.checkRoleDataScope(roleId);
return success(roleService.selectRoleById(roleId));
}
/**
* 新增角色
*/
@PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role)
{
UUID uuid = UUID.randomUUID();
role.setRoleKey(String.valueOf(uuid));
roleService.checkRoleAllowed(role);
if (!roleService.checkRoleNameUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(getUsername());
return toAjax(roleService.insertRole(role));
}
/**
* 修改保存角色
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role)
{
roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(getUsername());
if (roleService.updateRole(role) > 0)
{
// 更新缓存用户权限
LoginUser loginUser = getLoginUser();
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
{
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser);
}
return success();
}
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
}
/**
* 修改保存数据权限
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role));
}
/**
* 状态修改
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(getUsername());
return toAjax(roleService.updateRoleStatus(role));
}
/**
* 删除角色
*/
@PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds)
{
return toAjax(roleService.deleteRoleByIds(roleIds));
}
/**
* 获取角色选择框列表
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
return success(roleService.selectRoleAll());
}
/**
* 查询已分配用户角色列表
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
}
/**
* 查询未分配用户角色列表
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}
/**
* 取消授权用户
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel")
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
{
return toAjax(roleService.deleteAuthUser(userRole));
}
/**
* 批量取消授权用户
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
* 批量选择用户授权
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
/**
* 获取对应角色部门树列表
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/deptTree/{roleId}")
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
{
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
return ajax;
}
}

View File

@ -0,0 +1,144 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.SysUserBusinessColumn;
import com.zbf.system.service.ISysUserBusinessColumnService;
/**
* 用户展示字段定义管理Controller
*
* @author tony
* @date 2024-06-16
*/
@RestController
@RequestMapping("/system/COLUMN")
public class SysUserBusinessColumnController extends BaseController
{
@Autowired
private ISysUserBusinessColumnService sysUserBusinessColumnService;
/**
* 查询用户展示字段定义管理列表
*/
@GetMapping("/list")
public TableDataInfo list(SysUserBusinessColumn sysUserBusinessColumn)
{
startPage();
List<SysUserBusinessColumn> list = sysUserBusinessColumnService.selectSysUserBusinessColumnList(sysUserBusinessColumn);
return getDataTable(list);
}
/**
* 导出用户展示字段定义管理列表
*/
@Log(title = "用户展示字段定义管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysUserBusinessColumn sysUserBusinessColumn)
{
List<SysUserBusinessColumn> list = sysUserBusinessColumnService.selectSysUserBusinessColumnList(sysUserBusinessColumn);
ExcelUtil<SysUserBusinessColumn> util = new ExcelUtil<SysUserBusinessColumn>(SysUserBusinessColumn.class);
util.exportExcel(response, list, "用户展示字段定义管理数据");
}
/**
* 获取用户展示字段定义管理详细信息
*/
@GetMapping(value = "/{ID}")
public AjaxResult getInfo(@PathVariable("ID") Long ID)
{
return success(sysUserBusinessColumnService.selectSysUserBusinessColumnByID(ID));
}
/**
* 新增用户展示字段定义管理
*/
@Log(title = "用户展示字段定义管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysUserBusinessColumn sysUserBusinessColumn)
{
return toAjax(sysUserBusinessColumnService.insertSysUserBusinessColumn(sysUserBusinessColumn));
}
/**
* 修改用户展示字段定义管理
*/
@Log(title = "用户展示字段定义管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysUserBusinessColumn sysUserBusinessColumn)
{
String userName = getLoginUser().getUsername();
String hideColumn = sysUserBusinessColumn.getColumnHide();
sysUserBusinessColumn.setColumnHide("");
sysUserBusinessColumn.setUserName(userName);
List<SysUserBusinessColumn> result = sysUserBusinessColumnService.selectSysUserBusinessColumnList(sysUserBusinessColumn);
if (result.size() == 0) {
sysUserBusinessColumn.setColumnHide(hideColumn);
return toAjax(sysUserBusinessColumnService.insertSysUserBusinessColumn(sysUserBusinessColumn));
}
SysUserBusinessColumn updateRecord = result.get(0);
updateRecord.setColumnHide(hideColumn);
return toAjax(sysUserBusinessColumnService.updateSysUserBusinessColumn(updateRecord));
}
/**
* 删除用户展示字段定义管理
*/
@Log(title = "用户展示字段定义管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{IDs}")
public AjaxResult remove(@PathVariable Long[] IDs)
{
return toAjax(sysUserBusinessColumnService.deleteSysUserBusinessColumnByIDs(IDs));
}
/**
* 启用
*/
@Log(title = "用户展示字段定义管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{IDs}")
public AjaxResult disable(@PathVariable Long[] IDs)
{
return toAjax(sysUserBusinessColumnService.disabledSysUserBusinessColumnByIDs(IDs));
}
/**
* 禁用
*/
@Log(title = "用户展示字段定义管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{IDs}")
public AjaxResult enable(@PathVariable Long[] IDs)
{
return toAjax(sysUserBusinessColumnService.enableSysUserBusinessColumnByIDs(IDs));
}
/**
* 修改状态
*/
@Log(title = "用户展示字段定义管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUserBusinessColumn sysUserBusinessColumn) {
return toAjax(sysUserBusinessColumnService.updateStatus(sysUserBusinessColumn));
}
}

View File

@ -0,0 +1,302 @@
package com.zbf.web.controller.system;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.entity.SysDept;
import com.zbf.common.core.domain.entity.SysRole;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.SecurityUtils;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.service.ISysDeptService;
import com.zbf.system.service.ISysPostService;
import com.zbf.system.service.ISysRoleService;
import com.zbf.system.service.ISysUserService;
/**
* 用户信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/user")
public class SysUserController extends BaseController
{
@Autowired
private ISysUserService userService;
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysDeptService deptService;
@Autowired
private ISysPostService postService;
/**
* 获取用户列表
*/
// @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}
// @PreAuthorize("@ss.hasPermi('system:user:list')")
//专门查询第三审核人的其他需求慎用
@GetMapping("/queryUserList")
public AjaxResult queryList(SysUser user)
{
user.setDeptId(getDeptId());
List<SysUser> sysUsers = userService.queryUserList(user);for(SysUser user1:sysUsers){
user1.setRoles(null);
user1.setFirstAuditList(null);
user1.setSecondAuditList(null);
user1.setPassword(null);
}
return success(sysUsers);
}
@GetMapping("/queryAuditUserList")
public AjaxResult queryAuditUserList()
{
SysUser user = new SysUser();
// user.setDeptId(getDeptId());
logger.info("申请获取审批人的登录人为:{}",getLoginUser().getUsername());
String ancestors = getLoginUser().getUser().getDept().getAncestors();
user.setDeptId(getDeptId());
if (ancestors.split(",").length == 4){
user.setDeptId(Long.parseLong(ancestors.split(",")[3]));
}
logger.info("获取的部门id:{}",user.getDeptId());
if(user.getDeptId() == null){
throw new RuntimeException("获取该用户部门ID为空异常");
}
user.setUserId(getUserId());
user.setAuditType(1);
List<SysUser> sysUsers1 = userService.queryAuditUserList(user);
user.setAuditType(2);
List<SysUser> sysUsers2 = userService.queryAuditUserList(user);
Map<String,List<SysUser>> listMap = new HashMap<>();
listMap.put("audit1",sysUsers1);
listMap.put("audit2",sysUsers2);
return success(listMap);
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysUser user)
{
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.exportExcel(response, list, "用户数据");
}
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = userService.importUser(userList, updateSupport, operName);
return success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.importTemplateExcel(response, "用户数据");
}
/**
* 根据用户编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = { "/", "/{userId}" })
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{
userService.checkUserDataScope(userId);
AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId))
{
SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
}
return ajax;
}
/**
* 新增用户
*/
@PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user)
{
if (!userService.checkUserNameUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setCreateBy(getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
if (!userService.checkUserNameUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(getUsername());
return toAjax(userService.updateUser(user));
}
/**
* 删除用户
*/
@PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
if (ArrayUtils.contains(userIds, getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds));
}
/**
* 重置密码
*/
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(getUsername());
return toAjax(userService.resetPwd(user));
}
/**
* 状态修改
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(getUsername());
return toAjax(userService.updateUserStatus(user));
}
/**
* 根据用户编号获取授权角色
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping("/authRole/{userId}")
public AjaxResult authRole(@PathVariable("userId") Long userId)
{
AjaxResult ajax = AjaxResult.success();
SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId);
ajax.put("user", user);
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return ajax;
}
/**
* 用户授权角色
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{
userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds);
return success();
}
/**
* 获取部门树列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/deptTree")
public AjaxResult deptTree()
{
return success(deptService.selectDeptTreeList(new SysDept()));
}
}

View File

@ -0,0 +1,135 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zbf.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.TAgv;
import com.zbf.system.service.ITAgvService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* agv列表Controller
*
* @author tony
* @date 2024-06-17
*/
@CrossOrigin
@RestController
@RequestMapping("/system/agv")
public class TAgvController extends BaseController
{
@Autowired
private ITAgvService tAgvService;
/**
* 查询agv列表列表
*/
@GetMapping("/list")
public TableDataInfo list(TAgv tAgv)
{
startPage();
List<TAgv> list = tAgvService.selectTAgvList(tAgv);
return getDataTable(list);
}
/**
* 导出agv列表列表
*/
/*
@PreAuthorize("@ss.hasPermi('system:agv:export')")
*/
@Log(title = "agv列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TAgv tAgv)
{
List<TAgv> list = tAgvService.selectTAgvList(tAgv);
ExcelUtil<TAgv> util = new ExcelUtil<TAgv>(TAgv.class);
util.exportExcel(response, list, "agv列表数据");
}
/**
* 获取agv列表详细信息
*/
@PreAuthorize("@ss.hasPermi('system:agv:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tAgvService.selectTAgvById(id));
}
/**
* 新增agv列表
*/
@PreAuthorize("@ss.hasPermi('system:agv:add')")
@Log(title = "agv列表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TAgv tAgv)
{
return toAjax(tAgvService.insertTAgv(tAgv));
}
/**
* 修改agv列表
*/
@PreAuthorize("@ss.hasPermi('system:agv:edit')")
@Log(title = "agv列表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TAgv tAgv)
{
return toAjax(tAgvService.updateTAgv(tAgv));
}
/**
* 删除agv列表
*/
@PreAuthorize("@ss.hasPermi('system:agv:remove')")
@Log(title = "agv列表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tAgvService.deleteTAgvByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:agv:remove')")
@Log(title = "agv列表", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(tAgvService.disabledTAgvByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:agv:edit')")
@Log(title = "agv列表", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(tAgvService.enableTAgvByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:agv:edit')")
@Log(title = "agv列表", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TAgv tAgv) {
return toAjax(tAgvService.updateStatus(tAgv));
}
}

View File

@ -0,0 +1,131 @@
package com.zbf.web.controller.system;
import cn.hutool.json.JSONArray;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.generator.util.ColumnUtils;
import com.zbf.system.domain.TBaseFinancialClass;
import com.zbf.system.domain.TBasePallet;
import com.zbf.system.service.ITBaseFinancialClassService;
import liquibase.pro.packaged.S;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 财务分类Controller
*
* @author sunits
* @date 2024-06-28
*/
@RestController
@RequestMapping("/system/financialClass")
public class TBaseFinancialClassController extends BaseController {
@Autowired
private ITBaseFinancialClassService tBaseFinancialClassService;
/**
* 查询财务分类列表
*/
//@PreAuthorize("@ss.hasPermi('system:financialClass:list')")
@GetMapping("/list")
public AjaxResult list(TBaseFinancialClass tBaseFinancialClass) {
Map<String, Object> map = new HashMap();
JSONArray columns = ColumnUtils.getColumnsJson(TBaseFinancialClass.class);
List<TBaseFinancialClass> list = tBaseFinancialClassService.selectTBaseFinancialClassList(tBaseFinancialClass);
map.put("list",list);
map.put("columns",columns);
return success(map);
}
/**
* 导出财务分类列表
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:export')")
@Log(title = "财务分类", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBaseFinancialClass tBaseFinancialClass) {
List<TBaseFinancialClass> list = tBaseFinancialClassService.selectTBaseFinancialClassList(tBaseFinancialClass);
ExcelUtil<TBaseFinancialClass> util = new ExcelUtil<TBaseFinancialClass>(TBaseFinancialClass.class);
util.exportExcel(response, list, "财务分类数据");
}
/**
* 获取财务分类详细信息
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tBaseFinancialClassService.selectTBaseFinancialClassById(id));
}
/**
* 新增财务分类
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:add')")
@Log(title = "财务分类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBaseFinancialClass tBaseFinancialClass) {
return toAjax(tBaseFinancialClassService.insertTBaseFinancialClass(tBaseFinancialClass));
}
/**
* 修改财务分类
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:edit')")
@Log(title = "财务分类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBaseFinancialClass tBaseFinancialClass) {
return toAjax(tBaseFinancialClassService.updateTBaseFinancialClass(tBaseFinancialClass));
}
/**
* 删除财务分类
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:remove')")
@Log(title = "财务分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tBaseFinancialClassService.deleteTBaseFinancialClassByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:remove')")
@Log(title = "财务分类", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids) {
return toAjax(tBaseFinancialClassService.disabledTBaseFinancialClassByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:edit')")
@Log(title = "财务分类", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids) {
return toAjax(tBaseFinancialClassService.enableTBaseFinancialClassByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:financialClass:edit')")
@Log(title = "财务分类", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TBaseFinancialClass tBaseFinancialClass) {
return toAjax(tBaseFinancialClassService.updateStatus(tBaseFinancialClass));
}
}

View File

@ -0,0 +1,132 @@
package com.zbf.web.controller.system;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.TBaseGoodsBom;
import com.zbf.system.service.ITBaseGoodsBomService;
import com.zbf.common.utils.poi.ExcelUtil;
/**
* 物料bomController
*
* @author tony
* @date 2024-06-16
*/
@RestController
@RequestMapping("/system/bom")
public class TBaseGoodsBomController extends BaseController {
@Autowired
private ITBaseGoodsBomService tBaseGoodsBomService;
/**
* 查询物料bom列表
*/
@PreAuthorize("@ss.hasPermi('system:bom:list')")
@GetMapping("/list")
public AjaxResult list(TBaseGoodsBom tBaseGoodsBom) {
HashMap<String, Object> map = new HashMap<>();
List<TBaseGoodsBom> list = tBaseGoodsBomService.selectTBaseGoodsBomList(tBaseGoodsBom);
map.put("list", list);
map.put("column", tBaseGoodsBom.getColumnsJson());
return success(map);
}
/**
* 导出物料bom列表
*/
@PreAuthorize("@ss.hasPermi('system:bom:export')")
@Log(title = "物料bom", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBaseGoodsBom tBaseGoodsBom) {
List<TBaseGoodsBom> list = tBaseGoodsBomService.selectTBaseGoodsBomList(tBaseGoodsBom);
ExcelUtil<TBaseGoodsBom> util = new ExcelUtil<TBaseGoodsBom>(TBaseGoodsBom.class);
util.exportExcel(response, list, "物料bom数据");
}
/**
* 获取物料bom详细信息
*/
@PreAuthorize("@ss.hasPermi('system:bom:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tBaseGoodsBomService.selectTBaseGoodsBomById(id));
}
/**
* 新增物料bom
*/
@PreAuthorize("@ss.hasPermi('system:bom:add')")
@Log(title = "物料bom", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBaseGoodsBom tBaseGoodsBom) {
return toAjax(tBaseGoodsBomService.insertTBaseGoodsBom(tBaseGoodsBom));
}
/**
* 修改物料bom
*/
@PreAuthorize("@ss.hasPermi('system:bom:edit')")
@Log(title = "物料bom", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBaseGoodsBom tBaseGoodsBom) {
return toAjax(tBaseGoodsBomService.updateTBaseGoodsBom(tBaseGoodsBom));
}
/**
* 删除物料bom
*/
@PreAuthorize("@ss.hasPermi('system:bom:remove')")
@Log(title = "物料bom", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tBaseGoodsBomService.deleteTBaseGoodsBomByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:bom:remove')")
@Log(title = "物料bom", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids) {
return toAjax(tBaseGoodsBomService.disabledTBaseGoodsBomByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:bom:edit')")
@Log(title = "物料bom", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids) {
return toAjax(tBaseGoodsBomService.enableTBaseGoodsBomByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:bom:edit')")
@Log(title = "物料bom", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TBaseGoodsBom tBaseGoodsBom) {
return toAjax(tBaseGoodsBomService.updateStatus(tBaseGoodsBom));
}
}

View File

@ -0,0 +1,169 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TBaseGoods;
import com.zbf.system.service.ITBaseGoodsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 物料Controller
*
* @author sunits
* @date 2024-06-15
*/
@RestController
@RequestMapping("/system/goods")
public class TBaseGoodsController extends BaseController {
@Autowired
private ITBaseGoodsService tBaseGoodsService;
/**
* 查询物料列表
*/
@PreAuthorize("@ss.hasPermi('system:goods:list')")
@GetMapping("/list")
public TableDataInfo list(TBaseGoods tBaseGoods) {
startPage();
List<TBaseGoods> list = tBaseGoodsService.selectTBaseGoodsList(tBaseGoods);
TableDataInfo dataTable = getDataTable(list);
dataTable.setColumns(tBaseGoods.getColumnsJson());
return dataTable;
}
/**
* 导出物料列表
*/
@PreAuthorize("@ss.hasPermi('system:goods:export')")
@Log(title = "物料", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBaseGoods tBaseGoods) {
List<TBaseGoods> list = tBaseGoodsService.selectTBaseGoodsList(tBaseGoods);
ExcelUtil<TBaseGoods> util = new ExcelUtil<TBaseGoods>(TBaseGoods.class);
util.exportExcel(response, list, "物料数据");
}
/**
* 获取物料详细信息
*/
@PreAuthorize("@ss.hasPermi('system:goods:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tBaseGoodsService.selectTBaseGoodsById(id));
}
/**
* 新增物料
*/
@PreAuthorize("@ss.hasPermi('system:goods:add')")
@Log(title = "物料", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBaseGoods tBaseGoods) {
logger.info("请求插入物料:{}", tBaseGoods);
if (StringUtils.isBlank(tBaseGoods.getGoodsId())) {
logger.error("物料编号不能为空");
throw new RuntimeException("物料编号不能为空");
}
if (StringUtils.isBlank(tBaseGoods.getGoodsName())) {
logger.error("物料名称不能为空");
throw new RuntimeException("物料名称不能为空");
}
if (StringUtils.isBlank(tBaseGoods.getUnit())) {
logger.error("单位不能为空");
throw new RuntimeException("单位不能为空");
}
return toAjax(tBaseGoodsService.insertTBaseGoods(tBaseGoods));
}
/**
* 修改物料
*/
@PreAuthorize("@ss.hasPermi('system:goods:edit')")
@Log(title = "物料", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBaseGoods tBaseGoods) {
logger.info("更改物料信息:{}", tBaseGoods);
return toAjax(tBaseGoodsService.updateTBaseGoods(tBaseGoods));
}
/**
* 删除物料
*/
@PreAuthorize("@ss.hasPermi('system:goods:remove')")
@Log(title = "物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
logger.info("删除物料信息:{}", ids);
return toAjax(tBaseGoodsService.deleteTBaseGoodsByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:goods:remove')")
@Log(title = "物料", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids) {
return toAjax(tBaseGoodsService.disabledTBaseGoodsByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:goods:edit')")
@Log(title = "物料", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids) {
return toAjax(tBaseGoodsService.enableTBaseGoodsByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:goods:edit')")
@Log(title = "物料", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TBaseGoods tBaseGoods) {
return toAjax(tBaseGoodsService.updateStatus(tBaseGoods));
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<TBaseGoods> util = new ExcelUtil<TBaseGoods>(TBaseGoods.class);
util.importTemplateExcel(response, "物料数据");
}
@Log(title = "物料", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:goods:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<TBaseGoods> util = new ExcelUtil<TBaseGoods>(TBaseGoods.class);
List<TBaseGoods> importList = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = tBaseGoodsService.importData(importList, updateSupport, operName);
return success(message);
}
@Log(title = "存入RFID", businessType = BusinessType.INSERT)
@PostMapping("/saveRfid")
public AjaxResult saveRfid(@RequestBody TBaseGoods goods) {
int i = tBaseGoodsService.saveRfid(goods);
if (i > 0) {
return AjaxResult.success();
}
return AjaxResult.error();
}
}

View File

@ -0,0 +1,141 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TBasePallet;
import com.zbf.system.domain.TBaseStorageAreaLocation;
import com.zbf.system.service.ITBasePalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 托盘Controller
*
* @author sunits
* @date 2024-06-16
*/
@RestController
@RequestMapping("/system/pallet")
public class TBasePalletController extends BaseController {
@Autowired
private ITBasePalletService tBasePalletService;
/**
* 查询托盘列表
*/
@PreAuthorize("@ss.hasPermi('system:pallet:list')")
@GetMapping("/list")
public TableDataInfo list(TBasePallet tBasePallet) {
startPage();
List<TBasePallet> list = tBasePalletService.selectTBasePalletList(tBasePallet);
TableDataInfo dataTable = getDataTable(list);
dataTable.setColumns(tBasePallet.getColumnsJson());
return dataTable;
}
/**
* 导出托盘列表
*/
@PreAuthorize("@ss.hasPermi('system:pallet:export')")
@Log(title = "托盘", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBasePallet tBasePallet) {
List<TBasePallet> list = tBasePalletService.selectTBasePalletList(tBasePallet);
ExcelUtil<TBasePallet> util = new ExcelUtil<TBasePallet>(TBasePallet.class);
util.exportExcel(response, list, "托盘数据");
}
/**
* 获取托盘详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pallet:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tBasePalletService.selectTBasePalletById(id));
}
/**
* 新增托盘
*/
@PreAuthorize("@ss.hasPermi('system:pallet:add')")
@Log(title = "托盘", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBasePallet tBasePallet) {
return toAjax(tBasePalletService.insertTBasePallet(tBasePallet));
}
/**
* 修改托盘
*/
@PreAuthorize("@ss.hasPermi('system:pallet:edit')")
@Log(title = "托盘", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBasePallet tBasePallet) {
return toAjax(tBasePalletService.updateTBasePallet(tBasePallet));
}
/**
* 删除托盘
*/
@PreAuthorize("@ss.hasPermi('system:pallet:remove')")
@Log(title = "托盘", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tBasePalletService.deleteTBasePalletByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:pallet:remove')")
@Log(title = "托盘", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids) {
return toAjax(tBasePalletService.disabledTBasePalletByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:pallet:edit')")
@Log(title = "托盘", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids) {
return toAjax(tBasePalletService.enableTBasePalletByIds(ids));
}
/**
* 更改禁用状态
*/
@Log(title = "托盘管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus/{ids}")
public AjaxResult changeStatus(@PathVariable Long[] ids,@RequestBody TBasePallet tBasePallet) {
return toAjax(tBasePalletService.changeStatus(ids,tBasePallet));
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<TBasePallet> util = new ExcelUtil<TBasePallet>(TBasePallet.class);
util.importTemplateExcel(response, "托盘数据");
}
@Log(title = "托盘", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:pallet:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<TBasePallet> util = new ExcelUtil<TBasePallet>(TBasePallet.class);
List<TBasePallet> importList = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = tBasePalletService.importData(importList, updateSupport, operName);
return success(message);
}
}

View File

@ -0,0 +1,142 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TBaseProvider;
import com.zbf.system.service.ITBaseProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 供应商管理Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/provider")
public class TBaseProviderController extends BaseController {
@Autowired
private ITBaseProviderService tBaseProviderService;
/**
* 查询供应商管理列表
*/
@PreAuthorize("@ss.hasPermi('system:provider:list')")
@GetMapping("/list")
public TableDataInfo list(TBaseProvider tBaseProvider) {
startPage();
List<TBaseProvider> list = tBaseProviderService.selectTBaseProviderList(tBaseProvider);
TableDataInfo dataTable = getDataTable(list);
dataTable.setColumns(tBaseProvider.getColumnsJson());
return dataTable;
}
/**
* 导出供应商管理列表
*/
@PreAuthorize("@ss.hasPermi('system:provider:export')")
@Log(title = "供应商管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBaseProvider tBaseProvider) {
List<TBaseProvider> list = tBaseProviderService.selectTBaseProviderList(tBaseProvider);
ExcelUtil<TBaseProvider> util = new ExcelUtil<TBaseProvider>(TBaseProvider.class);
util.exportExcel(response, list, "供应商管理数据");
}
/**
* 获取供应商管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:provider:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tBaseProviderService.selectTBaseProviderById(id));
}
/**
* 新增供应商管理
*/
@PreAuthorize("@ss.hasPermi('system:provider:add')")
@Log(title = "供应商管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBaseProvider tBaseProvider) {
return toAjax(tBaseProviderService.insertTBaseProvider(tBaseProvider));
}
/**
* 修改供应商管理
*/
@PreAuthorize("@ss.hasPermi('system:provider:edit')")
@Log(title = "供应商管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBaseProvider tBaseProvider) {
return toAjax(tBaseProviderService.updateTBaseProvider(tBaseProvider));
}
/**
* 删除供应商管理
*/
@PreAuthorize("@ss.hasPermi('system:provider:remove')")
@Log(title = "供应商管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tBaseProviderService.deleteTBaseProviderByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:provider:remove')")
@Log(title = "供应商管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids) {
return toAjax(tBaseProviderService.disabledTBaseProviderByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:provider:edit')")
@Log(title = "供应商管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids) {
return toAjax(tBaseProviderService.enableTBaseProviderByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:provider:edit')")
@Log(title = "供应商管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TBaseProvider tBaseProvider) {
return toAjax(tBaseProviderService.updateStatus(tBaseProvider));
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<TBaseProvider> util = new ExcelUtil<TBaseProvider>(TBaseProvider.class);
util.importTemplateExcel(response, "供应商数据");
}
@Log(title = "供应商管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:provider:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<TBaseProvider> util = new ExcelUtil<TBaseProvider>(TBaseProvider.class);
List<TBaseProvider> importList = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = tBaseProviderService.importData(importList, updateSupport, operName);
return success(message);
}
}

View File

@ -0,0 +1,125 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TBaseStorageArea;
import com.zbf.system.service.ITBaseStorageAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 仓库库区Controller
*
* @author tony
* @date 2024-06-16
*/
@RestController
@RequestMapping("/system/storageArea")
public class TBaseStorageAreaController extends BaseController {
@Autowired
private ITBaseStorageAreaService tBaseStorageAreaService;
/**
* 查询仓库库区列表
*/
//@PreAuthorize("@ss.hasPermi('system:area:list')")
@GetMapping("/list")
public TableDataInfo list(TBaseStorageArea tBaseStorageArea) {
startPage();
List<TBaseStorageArea> list = tBaseStorageAreaService.selectTBaseStorageAreaList(tBaseStorageArea);
TableDataInfo dataTable = getDataTable(list);
dataTable.setColumns(tBaseStorageArea.getColumnsJson());
return dataTable;
}
/**
* 导出仓库库区列表
*/
@PreAuthorize("@ss.hasPermi('system:area:export')")
@Log(title = "仓库库区", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBaseStorageArea tBaseStorageArea) {
List<TBaseStorageArea> list = tBaseStorageAreaService.selectTBaseStorageAreaList(tBaseStorageArea);
ExcelUtil<TBaseStorageArea> util = new ExcelUtil<TBaseStorageArea>(TBaseStorageArea.class);
util.exportExcel(response, list, "仓库库区数据");
}
/**
* 获取仓库库区详细信息
*/
@PreAuthorize("@ss.hasPermi('system:area:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tBaseStorageAreaService.selectTBaseStorageAreaById(id));
}
/**
* 新增仓库库区
*/
@PreAuthorize("@ss.hasPermi('system:area:add')")
@Log(title = "仓库库区", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBaseStorageArea tBaseStorageArea) {
return toAjax(tBaseStorageAreaService.insertTBaseStorageArea(tBaseStorageArea));
}
/**
* 修改仓库库区
*/
@PreAuthorize("@ss.hasPermi('system:area:edit')")
@Log(title = "仓库库区", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBaseStorageArea tBaseStorageArea) {
return toAjax(tBaseStorageAreaService.updateTBaseStorageArea(tBaseStorageArea));
}
/**
* 删除仓库库区
*/
@PreAuthorize("@ss.hasPermi('system:area:remove')")
@Log(title = "仓库库区", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tBaseStorageAreaService.deleteTBaseStorageAreaByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:area:remove')")
@Log(title = "仓库库区", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids) {
return toAjax(tBaseStorageAreaService.disabledTBaseStorageAreaByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:area:edit')")
@Log(title = "仓库库区", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids) {
return toAjax(tBaseStorageAreaService.enableTBaseStorageAreaByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:area:edit')")
@Log(title = "仓库库区", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TBaseStorageArea tBaseStorageArea) {
return toAjax(tBaseStorageAreaService.updateStatus(tBaseStorageArea));
}
}

View File

@ -0,0 +1,171 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.DataScope;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TBasePallet;
import com.zbf.system.domain.TBaseStorage;
import com.zbf.system.domain.TBaseStorageArea;
import com.zbf.system.domain.TBaseStorageAreaLocation;
import com.zbf.system.service.ITBaseStorageAreaLocationService;
import com.zbf.system.service.ITBaseStorageAreaService;
import com.zbf.system.service.ITBaseStorageService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 库位 Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/location")
public class TBaseStorageAreaLocationController extends BaseController {
private ITBaseStorageAreaLocationService tBaseStorageAreaLocationService;
private ITBaseStorageAreaService baseStorageAreaService;
public TBaseStorageAreaLocationController(ITBaseStorageAreaLocationService tBaseStorageAreaLocationService, ITBaseStorageAreaService baseStorageAreaService) {
this.tBaseStorageAreaLocationService = tBaseStorageAreaLocationService;
this.baseStorageAreaService = baseStorageAreaService;
}
/**
* 根据当前用的数据权限查询所管理的仓库信息
* @param tBaseStorageArea
* @return
*/
@PreAuthorize("@ss.hasPermi('system:location:list')")
@GetMapping("/getStorageAreaList")
public AjaxResult getStorageAreaList(TBaseStorageArea tBaseStorageArea) {
return success(baseStorageAreaService.getBaseStorageAreaList(tBaseStorageArea));
}
/**
* 查询库位 列表
*/
@PreAuthorize("@ss.hasPermi('system:location:list')")
@GetMapping("/list")
public TableDataInfo list(TBaseStorageAreaLocation tBaseStorageAreaLocation) {
startPage();
List<TBaseStorageAreaLocation> list = tBaseStorageAreaLocationService.selectTBaseStorageAreaLocationList(tBaseStorageAreaLocation);
TableDataInfo dataTable = getDataTable(list);
dataTable.setColumns(tBaseStorageAreaLocation.getColumnsJson());
return dataTable;
}
/**
* 查询库位占用
*/
@PreAuthorize("@ss.hasPermi('system:location:list')")
@GetMapping("/occupy")
public AjaxResult occupy() {
logger.info("调用库位占用接口");
return success(tBaseStorageAreaLocationService.occupy());
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:provider:remove')")
@Log(title = "库位管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids) {
return toAjax(tBaseStorageAreaLocationService.disabledTBaseStorageAreaLocationByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:provider:edit')")
@Log(title = "库位管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids) {
return toAjax(tBaseStorageAreaLocationService.enableTBaseStorageAreaLocationByIds(ids));
}
/**
* 更改禁用状态
*/
@Log(title = "库位管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus/{ids}")
public AjaxResult changeStatus(@PathVariable Long[] ids,@RequestBody TBaseStorageAreaLocation tBaseStorageAreaLocation) {
return toAjax(tBaseStorageAreaLocationService.changeStatus(ids,tBaseStorageAreaLocation));
}
/**
* 导出库位 列表
*/
@PreAuthorize("@ss.hasPermi('system:location:export')")
@Log(title = "库位 ", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBaseStorageAreaLocation tBaseStorageAreaLocation) {
List<TBaseStorageAreaLocation> list = tBaseStorageAreaLocationService.selectTBaseStorageAreaLocationList(tBaseStorageAreaLocation);
ExcelUtil<TBaseStorageAreaLocation> util = new ExcelUtil<TBaseStorageAreaLocation>(TBaseStorageAreaLocation.class);
util.exportExcel(response, list, "库位 数据");
}
/**
* 获取库位 详细信息
*/
@PreAuthorize("@ss.hasPermi('system:location:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tBaseStorageAreaLocationService.selectTBaseStorageAreaLocationById(id));
}
/**
* 新增库位
*/
@PreAuthorize("@ss.hasPermi('system:location:add')")
@Log(title = "库位 ", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBaseStorageAreaLocation tBaseStorageAreaLocation) {
return toAjax(tBaseStorageAreaLocationService.insertTBaseStorageAreaLocation(tBaseStorageAreaLocation));
}
/**
* 修改库位
*/
@PreAuthorize("@ss.hasPermi('system:location:edit')")
@Log(title = "库位 ", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBaseStorageAreaLocation tBaseStorageAreaLocation) {
return toAjax(tBaseStorageAreaLocationService.updateTBaseStorageAreaLocation(tBaseStorageAreaLocation));
}
/**
* 删除库位
*/
@PreAuthorize("@ss.hasPermi('system:location:remove')")
@Log(title = "库位 ", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tBaseStorageAreaLocationService.deleteTBaseStorageAreaLocationByIds(ids));
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<TBaseStorageAreaLocation> util = new ExcelUtil<TBaseStorageAreaLocation>(TBaseStorageAreaLocation.class);
util.importTemplateExcel(response, "库位数据");
}
@Log(title = "库位", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:location:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<TBaseStorageAreaLocation> util = new ExcelUtil<TBaseStorageAreaLocation>(TBaseStorageAreaLocation.class);
List<TBaseStorageAreaLocation> importList = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = tBaseStorageAreaLocationService.importData(importList, updateSupport, operName);
return success(message);
}
}

View File

@ -0,0 +1,176 @@
package com.zbf.web.controller.system;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.json.JSONArray;
import com.zbf.generator.util.ColumnUtils;
import com.zbf.web.controller.section.EnhanceDataList;
import com.zbf.web.controller.section.ListColumns;
import liquibase.pro.packaged.S;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TBaseStorage;
import com.zbf.system.domain.TBaseStorageLocationRecord;
import com.zbf.system.service.ITBaseStorageService;
/**
* 仓库管理Controller
*
* @author tony
* @date 2024-06-19
*/
@RestController
@RequestMapping("/system/storage")
public class TBaseStorageController extends BaseController
{
@Autowired
private ITBaseStorageService tBaseStorageService;
/**
* 查询仓库管理列表
*/
@PreAuthorize("@ss.hasPermi('system:storage:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TBaseStorage.class)
public TableDataInfo list(TBaseStorage tBaseStorage)
{
List<TBaseStorage> list = tBaseStorageService.selectTBaseStorageList(tBaseStorage);
TableDataInfo dataTable = getDataTable(list);
return dataTable; // 直接返回处理后的TableDataInfo对象
}
/**
* 查询仓库管理列表
*/
@GetMapping("/selectList")
public AjaxResult selectList(TBaseStorage tBaseStorage)
{
tBaseStorage.setDeptId(getDeptId());
List<TBaseStorage> list = tBaseStorageService.selectTBaseStorageList(tBaseStorage);
return success(list);
}
/**
* 导出仓库管理列表
*/
@PreAuthorize("@ss.hasPermi('system:storage:export')")
@Log(title = "仓库管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TBaseStorage tBaseStorage)
{
List<TBaseStorage> list = tBaseStorageService.selectTBaseStorageList(tBaseStorage);
ExcelUtil<TBaseStorage> util = new ExcelUtil<TBaseStorage>(TBaseStorage.class);
util.exportExcel(response, list, "仓库管理数据");
}
/**
* 获取仓库管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:storage:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tBaseStorageService.selectTBaseStorageById(id));
}
/**
* 新增仓库管理
*/
@PreAuthorize("@ss.hasPermi('system:storage:add')")
@Log(title = "仓库管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TBaseStorage tBaseStorage)
{
return toAjax(tBaseStorageService.insertTBaseStorage(tBaseStorage));
}
/**
* 修改仓库管理
*/
@PreAuthorize("@ss.hasPermi('system:storage:edit')")
@Log(title = "仓库管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TBaseStorage tBaseStorage)
{
return toAjax(tBaseStorageService.updateTBaseStorage(tBaseStorage));
}
/**
* 删除仓库管理
*/
@PreAuthorize("@ss.hasPermi('system:storage:remove')")
@Log(title = "仓库管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tBaseStorageService.deleteTBaseStorageByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:storage:remove')")
@Log(title = "仓库管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(tBaseStorageService.disabledTBaseStorageByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:storage:edit')")
@Log(title = "仓库管理", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(tBaseStorageService.enableTBaseStorageByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:storage:edit')")
@Log(title = "仓库管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TBaseStorage tBaseStorage) {
return toAjax(tBaseStorageService.updateStatus(tBaseStorage));
}
/**
* 查询仓库列表
*/
@PreAuthorize("@ss.hasPermi('system:storage:list')")
@GetMapping("/storageAreaLocationList")
public AjaxResult list(TBaseStorageLocationRecord tBaseStorage)
{
tBaseStorage.setDeptId(getDeptId());
List<TBaseStorageLocationRecord> list = tBaseStorageService.selectStorageAndAreaAndLocation(tBaseStorage);
return success(list);
}
/**
* 根据当前用的数据权限查询所管理的仓库信息
* @param tBaseStorage
* @return
*/
@PreAuthorize("@ss.hasPermi('system:storage:list')")
@GetMapping("/getStorageList")
public AjaxResult getStorageList(TBaseStorage tBaseStorage) {
tBaseStorage.setDeptId(getDeptId());
return success(tBaseStorageService.selectTBaseStorageList(tBaseStorage));
}
}

View File

@ -0,0 +1,184 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zbf.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TBaseStorage;
import com.zbf.system.domain.TCallNotice;
import com.zbf.system.service.ITBaseStorageService;
import com.zbf.system.service.ITCallNoticeService;
import com.zbf.web.controller.section.EnhanceDataList;
/**
* 请填写功能名称Controller
*
* @author tony
* @date 2024-07-11
*/
@RestController
@RequestMapping("/system/callNotice")
public class TCallNoticeController extends BaseController
{
@Autowired
private ITCallNoticeService tCallNoticeService;
@Autowired
private ITBaseStorageService baseStorageService;
/**
* 查询请填写功能名称列表
*/
@GetMapping("/list")
public TableDataInfo list(TCallNotice tCallNotice)
{
startPage();
List<TCallNotice> list = tCallNoticeService.selectTCallNoticeList(tCallNotice);
return getDataTable(list);
}
/**
* 查询请填写功能名称列表
*/
@GetMapping("/selectList")
@EnhanceDataList(entityType = TCallNotice.class)
public AjaxResult selectList(TCallNotice tCallNotice)
{
List<TCallNotice> list = tCallNoticeService.selectTCallNoticeList(tCallNotice);
list.forEach(tCallNotice1 -> {
if(StringUtils.isNotBlank(tCallNotice1.getShelfCtl())){
tCallNotice1.setCtl(tCallNotice1.getShelfCtl());
}else if(StringUtils.isNotBlank(tCallNotice1.getPickCtl())){
tCallNotice1.setCtl(tCallNotice1.getPickCtl());
}
if(StringUtils.isNotBlank(tCallNotice1.getrLocationId())){
tCallNotice1.setLocationId(tCallNotice1.getrLocationId());
}else if(StringUtils.isNotBlank(tCallNotice1.getcLocationId())){
tCallNotice1.setLocationId(tCallNotice1.getcLocationId());
}
});
return success(list);
}
/**
* 导出请填写功能名称列表
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TCallNotice tCallNotice)
{
List<TCallNotice> list = tCallNoticeService.selectTCallNoticeList(tCallNotice);
ExcelUtil<TCallNotice> util = new ExcelUtil<TCallNotice>(TCallNotice.class);
util.exportExcel(response, list, "【请填写功能名称】数据");
}
/**
* 获取请填写功能名称详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tCallNoticeService.selectTCallNoticeById(id));
}
/**
* 新增请填写功能名称
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TCallNotice tCallNotice)
{
return toAjax(tCallNoticeService.insertTCallNotice(tCallNotice));
}
/**
* 修改请填写功能名称
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TCallNotice tCallNotice)
{
return toAjax(tCallNoticeService.updateTCallNotice(tCallNotice));
}
/**
* 删除请填写功能名称
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tCallNoticeService.deleteTCallNoticeByIds(ids));
}
/**
* 启用
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tCallNoticeService.disabledTCallNoticeByIds(ids));
}
/**
* 禁用
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tCallNoticeService.enableTCallNoticeByIds(ids));
}
/**
* 修改状态
*/
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TCallNotice tCallNotice) {
return toAjax(tCallNoticeService.updateStatus(tCallNotice));
}
/**
* 获取部门权限
* @return
*/
@GetMapping("/getStorageList")
public AjaxResult list()
{
getDeptId();
List<TBaseStorage> storageList = getStorageList(getDeptId());
return success(storageList);
}
private List<TBaseStorage> getStorageList(Long deptId){
TBaseStorage baseStorage = new TBaseStorage();
baseStorage.setDeptId(deptId);
return baseStorageService.selectTBaseStorageList(baseStorage);
}
}

View File

@ -0,0 +1,155 @@
package com.zbf.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TCallNoticeOrder;
import com.zbf.system.service.ITCallNoticeOrderService;
import com.zbf.web.controller.section.EnhanceDataList;
/**
* 请填写功能名称Controller
*
* @author tony
* @date 2024-07-30
*/
@RestController
@RequestMapping("/system/callNoticeOrder")
public class TCallNoticeOrderController extends BaseController
{
@Autowired
private ITCallNoticeOrderService tCallNoticeOrderService;
/**
* 查询请填写功能名称列表
*/
@PreAuthorize("@ss.hasPermi('system:order:list')")
@GetMapping("/list")
public TableDataInfo list(TCallNoticeOrder tCallNoticeOrder)
{
startPage();
List<TCallNoticeOrder> list = tCallNoticeOrderService.selectTCallNoticeOrderList(tCallNoticeOrder);
return getDataTable(list);
}
/**
* 查询通知单消息列表
*/
@GetMapping("/selectList")
@EnhanceDataList(entityType = TCallNoticeOrder.class)
public AjaxResult selectList(TCallNoticeOrder tCallNoticeOrder)
{
List<TCallNoticeOrder> list = tCallNoticeOrderService.selectTCallNoticeOrderList(tCallNoticeOrder);
List<TCallNoticeOrder> collect = list.stream().filter(c -> c.getTaskType().equals("0")).collect(Collectors.toList());
return success(collect);
}
/**
* 导出请填写功能名称列表
*/
@PreAuthorize("@ss.hasPermi('system:order:export')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TCallNoticeOrder tCallNoticeOrder)
{
List<TCallNoticeOrder> list = tCallNoticeOrderService.selectTCallNoticeOrderList(tCallNoticeOrder);
ExcelUtil<TCallNoticeOrder> util = new ExcelUtil<TCallNoticeOrder>(TCallNoticeOrder.class);
util.exportExcel(response, list, "【请填写功能名称】数据");
}
/**
* 获取请填写功能名称详细信息
*/
@PreAuthorize("@ss.hasPermi('system:order:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tCallNoticeOrderService.selectTCallNoticeOrderById(id));
}
/**
* 新增请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:order:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TCallNoticeOrder tCallNoticeOrder)
{
return toAjax(tCallNoticeOrderService.insertTCallNoticeOrder(tCallNoticeOrder));
}
/**
* 修改请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:order:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TCallNoticeOrder tCallNoticeOrder)
{
return toAjax(tCallNoticeOrderService.updateTCallNoticeOrder(tCallNoticeOrder));
}
/**
* 删除请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:order:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tCallNoticeOrderService.deleteTCallNoticeOrderByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:order:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tCallNoticeOrderService.disabledTCallNoticeOrderByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:order:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tCallNoticeOrderService.enableTCallNoticeOrderByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:order:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TCallNoticeOrder tCallNoticeOrder) {
return toAjax(tCallNoticeOrderService.updateStatus(tCallNoticeOrder));
}
}

View File

@ -0,0 +1,159 @@
package com.zbf.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zbf.common.annotation.DataSource;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.enums.DataSourceType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TCkOrderdetail;
import com.zbf.system.domain.TMiStock;
import com.zbf.system.mapper.TMiStockMapper;
import com.zbf.system.service.ITCkOrderdetailService;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.List;
/**
* 出库物料明细Controller
*
* @author sunits
* @date 2024-06-21
*/
@RestController
@RequestMapping("/system/orderdetail")
public class TCkOrderdetailController extends BaseController {
@Autowired
private ITCkOrderdetailService tCkOrderdetailService;
@Autowired
private TMiStockMapper tMiStockMapper;
/**
* 查询出库物料明细列表
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TCkOrderdetail.class)
public TableDataInfo list(TCkOrderdetail tCkOrderdetail) {
startPage();
List<TCkOrderdetail> list = tCkOrderdetailService.selectTCkOrderdetailList(tCkOrderdetail);
return getDataTable(list);
}
/**
* 导出出库物料明细列表
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:export')")
@Log(title = "出库物料明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TCkOrderdetail tCkOrderdetail) {
List<TCkOrderdetail> list = tCkOrderdetailService.selectTCkOrderdetailList(tCkOrderdetail);
ExcelUtil<TCkOrderdetail> util = new ExcelUtil<TCkOrderdetail>(TCkOrderdetail.class);
util.exportExcel(response, list, "出库物料明细数据");
}
/**
* 获取出库物料明细详细信息
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(tCkOrderdetailService.selectTCkOrderdetailById(id));
}
/**
* 新增出库物料明细
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:add')")
@Log(title = "出库物料明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TCkOrderdetail tCkOrderdetail) {
return toAjax(tCkOrderdetailService.insertTCkOrderdetail(tCkOrderdetail));
}
/**
* 修改出库物料明细
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:edit')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TCkOrderdetail tCkOrderdetail) {
return tCkOrderdetailService.updateTCkOrderdetail(tCkOrderdetail);
}
/**
* 删除出库物料明细
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:remove')")
@Log(title = "出库物料明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tCkOrderdetailService.deleteTCkOrderdetailByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:remove')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
return toAjax(tCkOrderdetailService.disabledTCkOrderdetailByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:edit')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids) {
return toAjax(tCkOrderdetailService.enableTCkOrderdetailByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:orderdetail:edit')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TCkOrderdetail tCkOrderdetail) {
return toAjax(tCkOrderdetailService.updateStatus(tCkOrderdetail));
}
/**
* 下载模板
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<TCkOrderdetail> util = new ExcelUtil<TCkOrderdetail>(TCkOrderdetail.class);
util.importTemplateExcel(response, "出库单物料明细数据");
}
/**
* 导入数据
*/
@Log(title = "出库单物料明细", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:orderdetail:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception {
ExcelUtil<TCkOrderdetail> util = new ExcelUtil<TCkOrderdetail>(TCkOrderdetail.class);
InputStream inputStream = file.getInputStream();
List<TCkOrderdetail> list = util.importExcel(inputStream);
inputStream.close();
int count = tCkOrderdetailService.batchInsertTCkOrderdetail(list);
return AjaxResult.success("导入成功" + count + "条信息!");
}
}

View File

@ -0,0 +1,291 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.model.LoginUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TCkOrderdetail;
import com.zbf.system.domain.TCkOrders;
import com.zbf.system.domain.TRkWareNotice;
import com.zbf.system.domain.vo.TCkOrdersVo;
import com.zbf.system.service.ITCkOrdersService;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 出库Controller
*
* @author tony
* @date 2024-06-24
*/
@RestController
@RequestMapping("/system/ckOrders")
public class TCkOrdersController extends BaseController {
@Autowired
private ITCkOrdersService tCkOrdersService;
/**
* 查询出库列表
*/
//@PreAuthorize("@ss.hasPermi('system:ckOrders:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TCkOrders.class)
public TableDataInfo list(TCkOrders tCkOrders) {
startPage();
List<TCkOrders> list = tCkOrdersService.selectTCkOrdersList(tCkOrders);
return getDataTable(list);
}
/**
* 导出出库列表
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:export')")
@Log(title = "出库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TCkOrders tCkOrders) {
List<TCkOrders> list = tCkOrdersService.exportTCkOrdersList(tCkOrders);
ExcelUtil<TCkOrders> util = new ExcelUtil<TCkOrders>(TCkOrders.class);
util.exportExcel(response, list, "出库数据");
}
/**
* 获取出库详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:ckOrders:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
// TCkOrders tCkOrders = tCkOrdersService.selectTCkOrdersById(id);
return success(tCkOrdersService.selectTCkOrdersById(id));
}
/**
* 获取出库详细信息
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:query')")
@GetMapping(value = "/order/{id}")
public AjaxResult getOrderInfo(@PathVariable("id") String id) {
return success(tCkOrdersService.selectTCkOrdersByDeliveryId(id));
}
/**
* 新增出库
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:add')")
@Log(title = "新增出库", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TCkOrders tCkOrders) {
tCkOrders.setId(OrderCodeFactory.getOrderCode("", ""));
tCkOrders.setOrderId(OrderCodeFactory.getOrderCode("CK", ""));
tCkOrders.setDeptId(getDeptId());
tCkOrders.setRecordDate(new Date());
return toAjax(tCkOrdersService.insertTCkOrders(tCkOrders));
}
/**
* 新增出库明细
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:add')")
@Log(title = "出库", businessType = BusinessType.INSERT)
@PostMapping("/updateTckOrderDetails")
public AjaxResult updateTckOrderDetails(@RequestBody List<TCkOrderdetail> tCkOrderdetails) {
return toAjax(tCkOrdersService.insertTCkOrdersDetails(tCkOrderdetails));
}
/**
* 调拨创建
*/
@Log(title = "调拨创建", businessType = BusinessType.INSERT)
@PostMapping("/create")
public AjaxResult create(@RequestBody TCkOrdersVo tCkOrders) {
return toAjax(tCkOrdersService.install(tCkOrders));
}
/**
* 修改出库
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:edit')")
@Log(title = "出库", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TCkOrders tCkOrders) {
return toAjax(tCkOrdersService.updateTCkOrders(tCkOrders));
}
/**
* 删除出库
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:remove')")
@Log(title = "审核", businessType = BusinessType.UPDATE)
@DeleteMapping("auditCkOrders/{ids}")
public AjaxResult auditCkOrders(@PathVariable String[] ids) {
return toAjax(tCkOrdersService.auditCkOrdersTCkOrdersByIds(ids));
}
/**
* 生成出库任务
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:remove')")
@Log(title = "生成出库任务", businessType = BusinessType.DELETE)
@PostMapping("/confirmOut")
public AjaxResult confirmOut(@RequestBody TCkOrders tCkOrders) {
tCkOrders.setDeptId(getDeptId());
return toAjax(tCkOrdersService.confirmOut(tCkOrders));
}
/**
* 任务分配
*/
/*@PreAuthorize("@ss.hasPermi('system:ckOrders:remove')")*/
@Log(title = "出库任务分配", businessType = BusinessType.OTHER)
@PostMapping("/send")
public AjaxResult send(@RequestBody TCkOrders tCkOrders) {
tCkOrders.setDeptId(getDeptId());
return tCkOrdersService.send(tCkOrders);
}
/**
* 删除出库明细
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:remove')")
@Log(title = "出库", businessType = BusinessType.DELETE)
@DeleteMapping("/details/{ids}")
public AjaxResult removeDetails(@PathVariable String[] ids) {
return toAjax(tCkOrdersService.deleteTCkOrderDetailsByIds(ids));
}
/**
* 删除出库
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:remove')")
@Log(title = "出库", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tCkOrdersService.deleteTCkOrdersByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:remove')")
@Log(title = "出库", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
return toAjax(tCkOrdersService.disabledTCkOrdersByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:edit')")
@Log(title = "出库", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids) {
return toAjax(tCkOrdersService.enableTCkOrdersByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:ckOrders:edit')")
@Log(title = "出库", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TCkOrders tCkOrders) {
return toAjax(tCkOrdersService.updateStatus(tCkOrders));
}
@GetMapping("/homeCount")
public AjaxResult homeCount() {
TCkOrders tCkOrders = new TCkOrders();
TRkWareNotice notice = new TRkWareNotice();
Map<String, Integer> map = new HashMap<>();
map.put("out", tCkOrdersService.homeOutCount(tCkOrders));
map.put("in", tCkOrdersService.homeInCount(notice));
return AjaxResult.success(map);
}
/**
* 导入
*/
@Log(title = "出库数据", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<TCkOrderdetail> util = new ExcelUtil<TCkOrderdetail>(TCkOrderdetail.class);
List<TCkOrderdetail> trList = util.importExcel(file.getInputStream());
LoginUser loginUser = getLoginUser();
String operName = loginUser.getUsername();
String message = tCkOrdersService.importData(trList, updateSupport, operName);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<TCkOrderdetail> util = new ExcelUtil<TCkOrderdetail>(TCkOrderdetail.class);
util.importTemplateExcel(response,"出库通知单");
}
// /**
// * 发送出库通知单消息
// */
// @Log(title = "发送出库通知单消息", businessType = BusinessType.UPDATE)
// @PostMapping("/sendOrderNotice")
// public AjaxResult sendNotice(@RequestBody TCkOrders update) {
// update.setCreateBy(getUsername());
// update.setDeptId(getDeptId());
// return AjaxResult.success(tCkOrdersService.sendOrderNotice(update));
// }
/**
* 发送出库通知到iwms
*/
@Log(title = "发送出库通知单消息", businessType = BusinessType.UPDATE)
@PostMapping("/sendiwms")
public AjaxResult sendIwms(@RequestBody TCkOrders update) {
update.setCreateBy(getUsername());
update.setDeptId(getDeptId());
return AjaxResult.success(tCkOrdersService.sendIwms(update));
}
/**
* 手持出库
*/
@Log(title = "手持出库", businessType = BusinessType.UPDATE)
@PostMapping("/issue")
public AjaxResult handAddGoodsTab(@RequestBody TCkOrders update) {
return AjaxResult.success(tCkOrdersService.handAddGoodsTab(update));
}
/**
* 出库申请审核后数量统计
*/
@GetMapping("/statisticCallShelvesNum")
public AjaxResult statisticCallShelvesNum(TCkOrderdetail tCkOrderdetail) {
return AjaxResult.success(tCkOrdersService.statisticCallShelvesNum(tCkOrderdetail));
}
}

View File

@ -0,0 +1,147 @@
package com.zbf.web.controller.system;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.xml.crypto.Data;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.TCkPickingwavegoodsBak;
import com.zbf.system.service.ITCkPickingwavegoodsBakService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* 出库任务历史Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/ckPickingWavegoodsbak")
public class TCkPickingwavegoodsBakController extends BaseController {
@Autowired
private ITCkPickingwavegoodsBakService tCkPickingwavegoodsBakService;
/**
* 查询出库任务历史列表
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TCkPickingwavegoodsBak.class)
public TableDataInfo list(TCkPickingwavegoodsBak tCkPickingwavegoodsBak) {
startPage();
tCkPickingwavegoodsBak.setDeptId(getDeptId());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date now = new Date();
String formattedDate = formatter.format(now);
tCkPickingwavegoodsBak.setWareDate(formattedDate);
if (tCkPickingwavegoodsBak.getDate()!=null){
String[] date = tCkPickingwavegoodsBak.getDate();
tCkPickingwavegoodsBak.setStartTime(date[0]);
tCkPickingwavegoodsBak.setEndTime(date[1]);
}
List<TCkPickingwavegoodsBak> list = tCkPickingwavegoodsBakService.selectTCkPickingwavegoodsBakList(tCkPickingwavegoodsBak);
return getDataTable(list);
}
/**
* 导出出库任务历史列表
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:export')")
@Log(title = "出库任务历史", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TCkPickingwavegoodsBak tCkPickingwavegoodsBak) {
tCkPickingwavegoodsBak.setDeptId(getDeptId());
List<TCkPickingwavegoodsBak> list = tCkPickingwavegoodsBakService.selectTCkPickingwavegoodsBakList(tCkPickingwavegoodsBak);
ExcelUtil<TCkPickingwavegoodsBak> util = new ExcelUtil<TCkPickingwavegoodsBak>(TCkPickingwavegoodsBak.class);
util.exportExcel(response, list, "出库任务历史数据");
}
/**
* 获取出库任务历史详细信息
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(tCkPickingwavegoodsBakService.selectTCkPickingwavegoodsBakById(id));
}
/**
* 新增出库任务历史
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:add')")
@Log(title = "出库任务历史", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TCkPickingwavegoodsBak tCkPickingwavegoodsBak) {
tCkPickingwavegoodsBak.setDeptId(getDeptId());
return toAjax(tCkPickingwavegoodsBakService.insertTCkPickingwavegoodsBak(tCkPickingwavegoodsBak));
}
/**
* 修改出库任务历史
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:edit')")
@Log(title = "出库任务历史", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TCkPickingwavegoodsBak tCkPickingwavegoodsBak) {
return toAjax(tCkPickingwavegoodsBakService.updateTCkPickingwavegoodsBak(tCkPickingwavegoodsBak));
}
/**
* 删除出库任务历史
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:remove')")
@Log(title = "出库任务历史", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tCkPickingwavegoodsBakService.deleteTCkPickingwavegoodsBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:remove')")
@Log(title = "出库任务历史", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
return toAjax(tCkPickingwavegoodsBakService.disabledTCkPickingwavegoodsBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:edit')")
@Log(title = "出库任务历史", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids) {
return toAjax(tCkPickingwavegoodsBakService.enableTCkPickingwavegoodsBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:ckPickingWavegoodsbak:edit')")
@Log(title = "出库任务历史", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TCkPickingwavegoodsBak tCkPickingwavegoodsBak) {
return toAjax(tCkPickingwavegoodsBakService.updateStatus(tCkPickingwavegoodsBak));
}
}

View File

@ -0,0 +1,214 @@
package com.zbf.web.controller.system;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TCkOrderdetail;
import com.zbf.system.domain.TCkOrders;
import com.zbf.system.domain.TCkPickingwavegoods;
import com.zbf.system.domain.TOngoodsshelf;
import com.zbf.system.service.ITCkPickingwavegoodsService;
import com.zbf.web.controller.section.EnhanceDataList;
/**
* 出库任务Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/pickingwavegoods")
public class TCkPickingwavegoodsController extends BaseController {
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
/**
* 查询出库任务列表
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:list')")
@EnhanceDataList(entityType = TCkPickingwavegoods.class)
@GetMapping("/list")
public TableDataInfo list(TCkPickingwavegoods tCkPickingwavegoods) {
startPage();
// tCkPickingwavegoods.setDeptId(getDeptId());
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
// Date now = new Date();
// String formattedDate = formatter.format(now);
// tCkPickingwavegoods.setWareDate(formattedDate);
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return getDataTable(list);
}
/**
* 查询出库任务列表(不分页)
*/
//@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:list')")
@GetMapping("/selectList")
public AjaxResult selectList(TCkPickingwavegoods tCkPickingwavegoods) {
// tCkPickingwavegoods.setDeptId(getDeptId());
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return success(list);
}
/**
* 导出出库任务列表
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:export')")
@Log(title = "出库任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TCkPickingwavegoods tCkPickingwavegoods) {
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
ExcelUtil<TCkPickingwavegoods> util = new ExcelUtil<TCkPickingwavegoods>(TCkPickingwavegoods.class);
util.exportExcel(response, list, "出库任务数据");
}
/**
* 获取出库任务详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(tCkPickingwavegoodsService.selectTCkPickingwavegoodsById(id));
}
/**
* 新增出库任务
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:add')")
@Log(title = "出库任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TCkPickingwavegoods tCkPickingwavegoods) {
logger.info("新增出库请求:{}", tCkPickingwavegoods);
tCkPickingwavegoods.setDeptId(getDeptId());
return toAjax(tCkPickingwavegoodsService.insertTCkPickingwavegoods(tCkPickingwavegoods));
}
/**
* 修改出库任务
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:edit')")
@Log(title = "出库任务", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TCkPickingwavegoods tCkPickingwavegoods) {
logger.info("修改出库任务开始:{}", tCkPickingwavegoods);
return toAjax(tCkPickingwavegoodsService.updateTCkPickingwavegoods(tCkPickingwavegoods));
}
/**
* 删除出库任务
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:remove')")
@Log(title = "出库任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
logger.info("删除出库任务列表:{}", ids);
return toAjax(tCkPickingwavegoodsService.deleteTCkPickingwavegoodsByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:remove')")
@Log(title = "出库任务", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
return toAjax(tCkPickingwavegoodsService.disabledTCkPickingwavegoodsByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:edit')")
@Log(title = "出库任务", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids) {
return toAjax(tCkPickingwavegoodsService.enableTCkPickingwavegoodsByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:edit')")
@Log(title = "出库任务", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TCkPickingwavegoods tCkPickingwavegoods) {
return toAjax(tCkPickingwavegoodsService.updateStatus(tCkPickingwavegoods));
}
/**
* 更改物料货架信息
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:edit')")
@Log(title = "更改任务状态", businessType = BusinessType.UPDATE)
@PostMapping("/handleUpdateStatus/{ids}")
public AjaxResult handleUpdateStatus(@PathVariable List<String> ids, @RequestBody TCkPickingwavegoods tCkPickingwavegoods) {
logger.info("更改出库任务状态开始:{}", tCkPickingwavegoods);
return toAjax(tCkPickingwavegoodsService.updateStatusByPickingids(ids, tCkPickingwavegoods));
}
/**
* 新增出库任务列表
*/
@PreAuthorize("@ss.hasPermi('system:pickingwavegoods:add')")
@Log(title = "新增出库任务列表", businessType = BusinessType.INSERT)
@PostMapping("addTask")
public AjaxResult addTask(@RequestBody List<TCkOrderdetail> tCkOrderdetailList) {
logger.info("新增出库单出库请求列表:{}", tCkOrderdetailList);
return toAjax(tCkPickingwavegoodsService.insertTCkPickingwavegoodsList(tCkOrderdetailList));
}
/**
* 确认出库
*/
@PostMapping("/confirm")
public AjaxResult confirm(@RequestBody List<TCkPickingwavegoods> goodsList) {
logger.info("确认出库:{}", goodsList);
return toAjax(tCkPickingwavegoodsService.confirm(goodsList));
}
/**
* 首页出入库未完成数据统计
* @return
*/
@GetMapping("/home")
public AjaxResult home() {
Map<String, Integer> combinedResults = new HashMap<>();
TCkPickingwavegoods pickingwavegoods = new TCkPickingwavegoods();
pickingwavegoods.setDeptId(getDeptId());
TOngoodsshelf tOngoodsshelf = new TOngoodsshelf();
tOngoodsshelf.setDeptId(getDeptId());
TCkOrders tCkOrders = new TCkOrders();
combinedResults.put("out", tCkPickingwavegoodsService.homePickingwavegoodsCount(pickingwavegoods));
combinedResults.put("in", tCkPickingwavegoodsService.homeOngoodsshelfCount(tOngoodsshelf));
combinedResults.put("audit", tCkPickingwavegoodsService.homeTCkOrdersCount(tCkOrders));
return AjaxResult.success(combinedResults);
}
}

View File

@ -0,0 +1,138 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.TErrorLog;
import com.zbf.system.service.ITErrorLogService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* agv报警信息Controller
*
* @author tony
* @date 2024-06-17
*/
@RestController
@RequestMapping("/system/agvErrorlog")
public class TErrorLogController extends BaseController
{
@Autowired
private ITErrorLogService tErrorLogService;
/**
* 查询agv报警信息列表
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:list')")
@GetMapping("/list")
public TableDataInfo list(TErrorLog tErrorLog)
{
startPage();
List<TErrorLog> list = tErrorLogService.selectTErrorLogList(tErrorLog);
return getDataTable(list);
}
/**
* 导出agv报警信息列表
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:export')")
@Log(title = "agv报警信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TErrorLog tErrorLog)
{
List<TErrorLog> list = tErrorLogService.selectTErrorLogList(tErrorLog);
ExcelUtil<TErrorLog> util = new ExcelUtil<TErrorLog>(TErrorLog.class);
util.exportExcel(response, list, "agv报警信息数据");
}
/**
* 获取agv报警信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tErrorLogService.selectTErrorLogById(id));
}
/**
* 新增agv报警信息
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:add')")
@Log(title = "agv报警信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TErrorLog tErrorLog)
{
return toAjax(tErrorLogService.insertTErrorLog(tErrorLog));
}
/**
* 修改agv报警信息
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:edit')")
@Log(title = "agv报警信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TErrorLog tErrorLog)
{
return toAjax(tErrorLogService.updateTErrorLog(tErrorLog));
}
/**
* 删除agv报警信息
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:remove')")
@Log(title = "agv报警信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tErrorLogService.deleteTErrorLogByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:remove')")
@Log(title = "agv报警信息", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(tErrorLogService.disabledTErrorLogByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:edit')")
@Log(title = "agv报警信息", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(tErrorLogService.enableTErrorLogByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:agvErrorlog:edit')")
@Log(title = "agv报警信息", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TErrorLog tErrorLog) {
return toAjax(tErrorLogService.updateStatus(tErrorLog));
}
}

View File

@ -0,0 +1,103 @@
package com.zbf.web.controller.system;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.system.domain.vo.TMiStockVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zbf.common.core.controller.BaseController;
import com.zbf.system.domain.TMiStock;
import com.zbf.system.service.ITMiStockService;
import com.zbf.common.core.page.TableDataInfo;
/**
* 库存Controller
*
* @author tony
* @date 2024-06-12
*/
@RestController
@RequestMapping("/TMiBatchAdjustment/batch")
@Api(value = "库存批次调整", tags = {"库存管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class TMiBatchAdjustmentController extends BaseController {
private final ITMiStockService tMiStockService;
/**
* 查询库存列表
*/
@ApiOperation("查询库存列表")
// @PreAuthorize("@ss.hasPermi('TMiBatchAdjustment:batch:list')")
@GetMapping("/list")
public TableDataInfo list(TMiStock tMiStock) {
startPage();
List<TMiStock> listed = tMiStockService.list(new LambdaQueryWrapper<TMiStock>());
return getDataTable(listed);
}
/**
* 修改批次号
* @param stockId
* @param value
* @return
*/
@GetMapping("update/{stockId}/{value}")
public AjaxResult update(@PathVariable String[] stockId, @PathVariable String value) {
// 将数组转换为列表
List<String> ids = Arrays.asList(stockId);
// 调用服务层方法进行处理
boolean success = tMiStockService.updates(ids,value);
// 根据操作结果返回相应的AjaxResult
return success ? AjaxResult.success("批次号修改成功。") : AjaxResult.error("批次号修改失败。");
}
/**
* 生产日期
* @param stockId
* @param value
* @return
*/
@GetMapping("updateDate/{stockId}/{value}")
public AjaxResult updateDate(@PathVariable String[] stockId, @PathVariable Date value) {
// 将数组转换为列表
List<String> ids = Arrays.asList(stockId);
// 调用服务层方法进行处理
boolean success = tMiStockService.updateDate(ids,value);
// 根据操作结果返回相应的AjaxResult
return success ? AjaxResult.success("生产日期修改成功。") : AjaxResult.error("生产日期修改失败。");
}
/**
* 获取库存详细信息
*/
@ApiOperation("获取库存详细信息")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping(value = "/{stockId}")
public AjaxResult getInfo(@PathVariable("stockId") String stockId)
{
return success(tMiStockService.getById(stockId));
}
}

View File

@ -0,0 +1,140 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.TMiStockBak;
import com.zbf.system.service.ITMiStockBakService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* 库存备份Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/tMiStockbak")
public class TMiStockBakController extends BaseController
{
@Autowired
private ITMiStockBakService tMiStockBakService;
/**
* 查询库存备份列表
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:list')")
@GetMapping("/list")
public TableDataInfo list(TMiStockBak tMiStockBak)
{
startPage();
tMiStockBak.setDeptId(getDeptId());
List<TMiStockBak> list = tMiStockBakService.selectTMiStockBakList(tMiStockBak);
return getDataTable(list);
}
/**
* 导出库存备份列表
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:export')")
@Log(title = "库存备份", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TMiStockBak tMiStockBak)
{
tMiStockBak.setDeptId(getDeptId());
List<TMiStockBak> list = tMiStockBakService.selectTMiStockBakList(tMiStockBak);
ExcelUtil<TMiStockBak> util = new ExcelUtil<TMiStockBak>(TMiStockBak.class);
util.exportExcel(response, list, "库存备份数据");
}
/**
* 获取库存备份详细信息
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tMiStockBakService.selectTMiStockBakById(id));
}
/**
* 新增库存备份
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:add')")
@Log(title = "库存备份", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TMiStockBak tMiStockBak)
{
return toAjax(tMiStockBakService.insertTMiStockBak(tMiStockBak));
}
/**
* 修改库存备份
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:edit')")
@Log(title = "库存备份", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TMiStockBak tMiStockBak)
{
return toAjax(tMiStockBakService.updateTMiStockBak(tMiStockBak));
}
/**
* 删除库存备份
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:remove')")
@Log(title = "库存备份", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tMiStockBakService.deleteTMiStockBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:remove')")
@Log(title = "库存备份", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(tMiStockBakService.disabledTMiStockBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:edit')")
@Log(title = "库存备份", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(tMiStockBakService.enableTMiStockBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:tMiStockbak:edit')")
@Log(title = "库存备份", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TMiStockBak tMiStockBak) {
return toAjax(tMiStockBakService.updateStatus(tMiStockBak));
}
}

View File

@ -0,0 +1,342 @@
package com.zbf.web.controller.system;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.common.core.controller.ManualPagination;
import com.zbf.system.domain.RfidQuantityUpdateRequest;
import com.zbf.system.domain.RfidQueryRequest;
import com.zbf.system.service.ITBaseStorageService;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TMiStock;
import com.zbf.system.domain.TMiStockUpdate;
import com.zbf.system.service.ITMiStockService;
import com.zbf.system.service.ITOverdueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
/**
* 库存Controller
*
* @author tony
* @date 2024-06-12
*/
@RestController
@RequestMapping("/system/stock")
@Api(value = "库存控制器", tags = {"库存管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class TMiStockController extends BaseController {
private final ITMiStockService tMiStockService;
private final ITOverdueService overdueService;
private final ITBaseStorageService storageService;
/**
* 查询库存列表
*/
@ApiOperation("查询库存列表")
@PreAuthorize("@ss.hasPermi('system:stock:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TMiStock.class)
public TableDataInfo list(TMiStock tMiStock) {
startPage();
tMiStock.setDeptId(getDeptId());
if (tMiStock.getDate()!=null){
String[] date = tMiStock.getDate();
tMiStock.setStartTime(date[0]);
tMiStock.setEndTime(date[1]);
}
List<TMiStock> list = tMiStockService.selectTMiStockList(tMiStock);
return getDataTable(list);
}
@GetMapping("/lists")
@EnhanceDataList(entityType = TMiStock.class)
public AjaxResult lists(TMiStock tMiStock) {
if (tMiStock.getDate()!=null){
String[] date = tMiStock.getDate();
tMiStock.setStartTime(date[0]);
tMiStock.setEndTime(date[1]);
}
List<TMiStock> list = tMiStockService.select(tMiStock);
return AjaxResult.success(list);
}
/**
* 导出库存列表
*/
@ApiOperation("导出库存列表")
@PreAuthorize("@ss.hasPermi('system:stock:export')")
@Log(title = "库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TMiStock tMiStock) {
tMiStock.setDeptId(getDeptId());
if (tMiStock.getDate()!=null){
tMiStock.setStartTime(tMiStock.getDate()[0]);
tMiStock.setEndTime(tMiStock.getDate()[1]);
}
List<TMiStock> list = tMiStockService.selectTMiStockList(tMiStock);
ExcelUtil<TMiStock> util = new ExcelUtil<TMiStock>(TMiStock.class);
util.exportExcel(response, list, "库存数据");
}
/**
* 获取库存详细信息
*/
@ApiOperation("获取库存详细信息")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping(value = "/{stockId}")
public AjaxResult getInfo(@PathVariable("stockId") String stockId) {
return success(tMiStockService.getById(stockId));
}
/**
* 根据条件查询库存总数
*/
@ApiOperation("获取库存总数")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping(value = "/queryTotal")
public AjaxResult getTotal(TMiStock tMiStock) {
tMiStock.setDeptId(getDeptId());
return success(tMiStockService.getTotal(tMiStock));
}
@ApiOperation("统计查询库存列表")
@PreAuthorize("@ss.hasPermi('system:stock:list')")
@GetMapping("/countList")
public TableDataInfo countList(TMiStock tMiStock) {
tMiStock.setDeptId(getDeptId());
List<TMiStock> list = tMiStockService.selectCountStockList(tMiStock);
return ManualPagination.pagination(list);
}
/**
* 新增库存
*/
@ApiOperation("新增库存")
@PreAuthorize("@ss.hasPermi('system:stock:add')")
@Log(title = "库存", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TMiStock tMiStock) {
tMiStock.setDeptId(getDeptId());
return toAjax(tMiStockService.save(tMiStock));
}
/**
* 修改库存
*/
@ApiOperation("修改库存")
@PreAuthorize("@ss.hasPermi('system:stock:edit')")
@Log(title = "库存", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TMiStock tMiStock) {
return toAjax(tMiStockService.updateById(tMiStock));
}
/**
* 删除库存
*/
@ApiOperation("删除库存")
@PreAuthorize("@ss.hasPermi('system:stock:remove')")
@Log(title = "库存", businessType = BusinessType.DELETE)
@DeleteMapping("/{stockIds}")
public AjaxResult remove(@PathVariable String[] stockIds) {
return toAjax(tMiStockService.removeByIds(Arrays.asList(stockIds)));
}
/**
* 冻结库存操作
*
* @param 库存ID数组
* @return 返回操作结果
*/
@GetMapping("/frozen")
public AjaxResult frozen(@RequestParam(name = "stockIds", required = true) String stockIdsStr,
@RequestParam(name = "value", required = true) String value) {
// 将逗号分隔的字符串转换为ID列表
List<String> ids = Arrays.asList(stockIdsStr.split(","));
// 调用服务层方法进行处理
boolean success = tMiStockService.freezeStockByIds(ids, value);
// 根据操作结果返回相应的AjaxResult
return success ? AjaxResult.success("库存已成功冻结。") : AjaxResult.error("库存冻结失败。");
}
/**
* 解冻
*
* @param stockIds
* @return
*/
@GetMapping("/thaw/{stockIds}")
public AjaxResult thaw(@PathVariable String[] stockIds) {
// 将数组转换为列表
List<String> ids = Arrays.asList(stockIds);
// 调用服务层方法进行处理
boolean success = tMiStockService.thawStockByIds(ids);
// 根据操作结果返回相应的AjaxResult
return success ? AjaxResult.success("库存已成功解冻。") : AjaxResult.error("库存解冻失败。");
}
@ApiOperation("查询超期呆滞列表")
@PreAuthorize("@ss.hasPermi('system:stock:overdue')")
@GetMapping("/overdueByParam")
public TableDataInfo overdueListByParam(TMiStock tMiStock) {
//超期呆滞天数
String overdueDate = overdueService.getOverdueFromToday();
if (StringUtils.isNotEmpty(overdueDate)) {
tMiStock.setOverdueDate(overdueDate);
startPage();
List<TMiStock> list = tMiStockService.selectTMiStockList(tMiStock);
return getDataTable(list);
}
return getDataTable(new ArrayList<>());
}
@ApiOperation("查询超期呆滞列表")
@PreAuthorize("@ss.hasPermi('system:stock:overdue')")
@GetMapping("/overdue")
public TableDataInfo overdueList(TMiStock tMiStock) {
//超期呆滞
tMiStock.setFlag("1");
startPage();
List<TMiStock> list = tMiStockService.selectTMiStockList(tMiStock);
return getDataTable(list);
}
@ApiOperation("查询超期呆滞列表")
@PreAuthorize("@ss.hasPermi('system:stock:overdue')")
@GetMapping("/overInsured")
public TableDataInfo overInsured(TMiStock tMiStock) {
startPage();
List<TMiStock> list = tMiStockService.overInsured(tMiStock);
return getDataTable(list);
}
/**
* 手持库存查询
*/
@ApiOperation("库存信息查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/goodsStatistics")
public AjaxResult goodsStatistics(TMiStock tMiStock) {
return success(tMiStockService.inventoryStatisticsGoods(tMiStock));
}
/**
* 手持盘点库存查询
*/
@ApiOperation("手持盘点库存信息查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/pdaPanGoodsList")
public AjaxResult pdaPanGoodsList(TMiStock tMiStock) {
return success(tMiStockService.selectPanGoodsList(tMiStock));
}
/**
* 手持盘点当日变化库位查询
*/
@ApiOperation("手持盘点当日库位信息查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/dayLocation")
public AjaxResult dayLocation() {
return success(tMiStockService.selectPanTimeLocation());
}
/**
* 手持移位
*/
@ApiOperation("手持移位")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/reLocation")
public AjaxResult reLocation(@RequestBody TMiStockUpdate tMiStockUpdate) {
return success(tMiStockService.changeLocation(tMiStockUpdate));
}
@ApiOperation("查询物料")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/getStock")
public AjaxResult getStock(@RequestBody TMiStockUpdate tMiStockUpdate) {
TMiStock tMiStock = new TMiStock();
tMiStock.setLocationId(tMiStockUpdate.getFromLoc());
List<TMiStock> list = tMiStockService.list(new LambdaQueryWrapper<>(tMiStock).eq(TMiStock::getLocationId, tMiStockUpdate.getFromLoc()));
return AjaxResult.success(list);
}
/**
* 手持更换容器 托盘物料查询
*/
@ApiOperation("手持更换容器 托盘物料查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/getCtlNoGoods")
public AjaxResult getCtlNoGoods(TMiStock tMiStock) {
return success(tMiStockService.selectTMiStockListByCtl(tMiStock));
}
/**
* 手持更换容器
*/
@ApiOperation("手持更换容器")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/changeCtlNo")
public AjaxResult changeCtlNo(@RequestBody TMiStockUpdate tMiStockUpdate) {
return success(tMiStockService.changeCtlNo(tMiStockUpdate));
}
/**
* 手持拆分,合并容器
*/
@ApiOperation("手持拆分合并容器")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/splitCtlNo")
public AjaxResult splitCtlNo(@RequestBody TMiStockUpdate tMiStockUpdate) {
return success(tMiStockService.splitCtlNo(tMiStockUpdate));
}
@PostMapping("/queryByRfid")
public AjaxResult queryByRfid(@RequestBody RfidQueryRequest request) {
return AjaxResult.success(tMiStockService.rfid(request));
}
/**
* 更新RFID数量
*/
@ApiOperation("更新RFID数量")
@PreAuthorize("@ss.hasPermi('system:stock:edit')")
@Log(title = "RFID数量更新", businessType = BusinessType.UPDATE)
@PostMapping("/updateRfidQuantity")
public AjaxResult updateRfidQuantity(@Validated @RequestBody RfidQuantityUpdateRequest request) {
try {
return AjaxResult.success(tMiStockService.updateRfidQuantity(request));
} catch (Exception e) {
logger.error("RFID数量更新失败", e);
return AjaxResult.error("RFID数量更新失败: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,53 @@
package com.zbf.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.system.domain.TMiStockF;
import com.zbf.system.domain.TMiStockFUpdate;
import com.zbf.system.service.ITMiStockFService;
import io.swagger.annotations.ApiOperation;
/**
* 库存Controller
*
* @author tony
* @date 2024-07-27
*/
@RestController
@RequestMapping("/system/tMiStockf")
public class TMiStockFController extends BaseController
{
@Autowired
private ITMiStockFService tMiStockFService;
/**
* 查询库存列表
*/
@GetMapping("/selectList")
public AjaxResult selectlist(TMiStockF tMiStockF)
{
List<TMiStockF> list = tMiStockFService.selectTMiStockFList(tMiStockF);
return success(list);
}
/**
* 物料组盘生成真实入库上架任务
*/
@ApiOperation("物料组盘")
@PostMapping("/goodsMakeCtl")
public AjaxResult goodsMakeCtl(@RequestBody TMiStockFUpdate tMiStockFUpdate) {
return success(tMiStockFService.goodsMakeCtl(tMiStockFUpdate));
}
}

View File

@ -0,0 +1,338 @@
package com.zbf.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.controller.ManualPagination;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.model.LoginUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.StringUtils;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TCkOrderdetail;
import com.zbf.system.domain.TMiStock;
import com.zbf.system.domain.TMiStockUpdate;
import com.zbf.system.domain.TMiXnStock;
import com.zbf.system.service.ITBaseStorageService;
import com.zbf.system.service.ITMiStockService;
import com.zbf.system.service.ITMiXnStockService;
import com.zbf.system.service.ITOverdueService;
import com.zbf.web.controller.section.EnhanceDataList;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 库存Controller
*
* @author tony
* @date 2024-06-12
*/
@RestController
@RequestMapping("/system/xnstock")
@Api(value = "库存控制器", tags = {"库存管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class TMiXnStockController extends BaseController {
private final ITMiXnStockService tMiStockService;
private final ITOverdueService overdueService;
private final ITBaseStorageService storageService;
/**
* 查询库存列表
*/
@ApiOperation("查询库存列表")
@PreAuthorize("@ss.hasPermi('system:stock:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TMiXnStock.class)
public TableDataInfo list(TMiXnStock tMiStock) {
startPage();
tMiStock.setDeptId(getDeptId());
if (tMiStock.getDate()!=null){
String[] date = tMiStock.getDate();
tMiStock.setStartTime(date[0]);
tMiStock.setEndTime(date[1]);
}
List<TMiXnStock> list = tMiStockService.selectTMiStockList(tMiStock);
return getDataTable(list);
}
/**
* 导入
*/
@Log(title = "出库数据", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception
{
ExcelUtil<TMiXnStock> util = new ExcelUtil<TMiXnStock>(TMiXnStock.class);
List<TMiXnStock> trList = util.importExcel(file.getInputStream());
String message = tMiStockService.importData(trList, "");
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<TMiXnStock> util = new ExcelUtil<TMiXnStock>(TMiXnStock.class);
util.importTemplateExcel(response,"虚拟库存");
}
@GetMapping("/lists")
@EnhanceDataList(entityType = TMiXnStock.class)
public AjaxResult lists(TMiXnStock tMiStock) {
if (tMiStock.getDate()!=null){
String[] date = tMiStock.getDate();
tMiStock.setStartTime(date[0]);
tMiStock.setEndTime(date[1]);
}
List<TMiXnStock> list = tMiStockService.select(tMiStock);
return AjaxResult.success(list);
}
/**
* 导出库存列表
*/
@ApiOperation("导出库存列表")
@PreAuthorize("@ss.hasPermi('system:stock:export')")
@Log(title = "库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TMiXnStock tMiStock) {
tMiStock.setDeptId(getDeptId());
if (tMiStock.getDate()!=null){
tMiStock.setStartTime(tMiStock.getDate()[0]);
tMiStock.setEndTime(tMiStock.getDate()[1]);
}
List<TMiXnStock> list = tMiStockService.selectTMiStockList(tMiStock);
ExcelUtil<TMiXnStock> util = new ExcelUtil<TMiXnStock>(TMiXnStock.class);
util.exportExcel(response, list, "库存数据");
}
/**
* 获取库存详细信息
*/
@ApiOperation("获取库存详细信息")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping(value = "/{stockId}")
public AjaxResult getInfo(@PathVariable("stockId") String stockId) {
return success(tMiStockService.getById(stockId));
}
/**
* 根据条件查询库存总数
*/
@ApiOperation("获取库存总数")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping(value = "/queryTotal")
public AjaxResult getTotal(TMiXnStock tMiStock) {
tMiStock.setDeptId(getDeptId());
return success(tMiStockService.getTotal(tMiStock));
}
@ApiOperation("统计查询库存列表")
@PreAuthorize("@ss.hasPermi('system:stock:list')")
@GetMapping("/countList")
public TableDataInfo countList(TMiXnStock tMiStock) {
tMiStock.setDeptId(getDeptId());
List<TMiXnStock> list = tMiStockService.selectCountStockList(tMiStock);
return ManualPagination.pagination(list);
}
/**
* 新增库存
*/
@ApiOperation("新增库存")
@PreAuthorize("@ss.hasPermi('system:stock:add')")
@Log(title = "库存", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TMiXnStock tMiStock) {
tMiStock.setDeptId(getDeptId());
return toAjax(tMiStockService.save(tMiStock));
}
/**
* 修改库存
*/
@ApiOperation("修改库存")
@PreAuthorize("@ss.hasPermi('system:stock:edit')")
@Log(title = "库存", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TMiXnStock tMiStock) {
return toAjax(tMiStockService.updateById(tMiStock));
}
/**
* 删除库存
*/
@ApiOperation("删除库存")
@PreAuthorize("@ss.hasPermi('system:stock:remove')")
@Log(title = "库存", businessType = BusinessType.DELETE)
@DeleteMapping("/{stockIds}")
public AjaxResult remove(@PathVariable String[] stockIds) {
return toAjax(tMiStockService.removeByIds(Arrays.asList(stockIds)));
}
/**
* 冻结库存操作
*
* @param 库存ID数组
* @return 返回操作结果
*/
@GetMapping("/frozen")
public AjaxResult frozen(@RequestParam(name = "stockIds", required = true) String stockIdsStr,
@RequestParam(name = "value", required = true) String value) {
// 将逗号分隔的字符串转换为ID列表
List<String> ids = Arrays.asList(stockIdsStr.split(","));
// 调用服务层方法进行处理
boolean success = tMiStockService.freezeStockByIds(ids, value);
// 根据操作结果返回相应的AjaxResult
return success ? AjaxResult.success("库存已成功冻结。") : AjaxResult.error("库存冻结失败。");
}
/**
* 解冻
*
* @param stockIds
* @return
*/
@GetMapping("/thaw/{stockIds}")
public AjaxResult thaw(@PathVariable String[] stockIds) {
// 将数组转换为列表
List<String> ids = Arrays.asList(stockIds);
// 调用服务层方法进行处理
boolean success = tMiStockService.thawStockByIds(ids);
// 根据操作结果返回相应的AjaxResult
return success ? AjaxResult.success("库存已成功解冻。") : AjaxResult.error("库存解冻失败。");
}
@ApiOperation("查询超期呆滞列表")
@PreAuthorize("@ss.hasPermi('system:stock:overdue')")
@GetMapping("/overdueByParam")
public TableDataInfo overdueListByParam(TMiXnStock tMiStock) {
//超期呆滞天数
String overdueDate = overdueService.getOverdueFromToday();
if (StringUtils.isNotEmpty(overdueDate)) {
tMiStock.setOverdueDate(overdueDate);
startPage();
List<TMiXnStock> list = tMiStockService.selectTMiStockList(tMiStock);
return getDataTable(list);
}
return getDataTable(new ArrayList<>());
}
@ApiOperation("查询超期呆滞列表")
@PreAuthorize("@ss.hasPermi('system:stock:overdue')")
@GetMapping("/overdue")
public TableDataInfo overdueList(TMiXnStock tMiStock) {
//超期呆滞
tMiStock.setFlag("1");
startPage();
List<TMiXnStock> list = tMiStockService.selectTMiStockList(tMiStock);
return getDataTable(list);
}
@ApiOperation("查询超期呆滞列表")
@PreAuthorize("@ss.hasPermi('system:stock:overdue')")
@GetMapping("/overInsured")
public TableDataInfo overInsured(TMiXnStock tMiStock) {
startPage();
List<TMiXnStock> list = tMiStockService.overInsured(tMiStock);
return getDataTable(list);
}
/**
* 手持库存查询
*/
@ApiOperation("库存信息查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/goodsStatistics")
public AjaxResult goodsStatistics(TMiXnStock tMiStock) {
return success(tMiStockService.inventoryStatisticsGoods(tMiStock));
}
/**
* 手持盘点库存查询
*/
@ApiOperation("手持盘点库存信息查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/pdaPanGoodsList")
public AjaxResult pdaPanGoodsList(TMiXnStock tMiStock) {
return success(tMiStockService.selectPanGoodsList(tMiStock));
}
/**
* 手持盘点当日变化库位查询
*/
@ApiOperation("手持盘点当日库位信息查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/dayLocation")
public AjaxResult dayLocation() {
return success(tMiStockService.selectPanTimeLocation());
}
/**
* 手持移位
*/
@ApiOperation("手持移位")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/reLocation")
public AjaxResult reLocation(@RequestBody TMiStockUpdate tMiStockUpdate) {
return success(tMiStockService.changeLocation(tMiStockUpdate));
}
@ApiOperation("查询物料")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/getStock")
public AjaxResult getStock(@RequestBody TMiStockUpdate tMiStockUpdate) {
TMiXnStock tMiStock = new TMiXnStock();
tMiStock.setLocationId(tMiStockUpdate.getFromLoc());
List<TMiXnStock> list = tMiStockService.list(new LambdaQueryWrapper<>(tMiStock).eq(TMiXnStock::getLocationId, tMiStockUpdate.getFromLoc()));
return AjaxResult.success(list);
}
/**
* 手持更换容器 托盘物料查询
*/
@ApiOperation("手持更换容器 托盘物料查询")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@GetMapping("/getCtlNoGoods")
public AjaxResult getCtlNoGoods(TMiXnStock tMiStock) {
return success(tMiStockService.selectTMiStockListByCtl(tMiStock));
}
/**
* 手持更换容器
*/
@ApiOperation("手持更换容器")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/changeCtlNo")
public AjaxResult changeCtlNo(@RequestBody TMiStockUpdate tMiStockUpdate) {
return success(tMiStockService.changeCtlNo(tMiStockUpdate));
}
/**
* 手持拆分,合并容器
*/
@ApiOperation("手持拆分合并容器")
@PreAuthorize("@ss.hasPermi('system:stock:query')")
@PostMapping("/splitCtlNo")
public AjaxResult splitCtlNo(@RequestBody TMiStockUpdate tMiStockUpdate) {
return success(tMiStockService.splitCtlNo(tMiStockUpdate));
}
}

View File

@ -0,0 +1,152 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TOngoodsshelfBak;
import com.zbf.system.service.ITOngoodsshelfBakService;
/**
* 入库任务历史Controller
*
* @author tony
* @date 2024-06-18
*/
@RestController
@RequestMapping("/system/tOnGoodsShelfbak")
public class TOngoodsshelfBakController extends BaseController
{
@Autowired
private ITOngoodsshelfBakService tOngoodsshelfBakService;
/**
* 查询入库任务历史列表
*/
//@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TOngoodsshelfBak.class)
public TableDataInfo list(TOngoodsshelfBak tOngoodsshelfBak)
{
startPage();
tOngoodsshelfBak.setDeptId(getDeptId());
if (tOngoodsshelfBak.getDate()!=null){
String[] date = tOngoodsshelfBak.getDate();
tOngoodsshelfBak.setStartTime(date[0]);
tOngoodsshelfBak.setEndTime(date[1]);
}
List<TOngoodsshelfBak> list = tOngoodsshelfBakService.selectTOngoodsshelfBakList(tOngoodsshelfBak);
return getDataTable(list);
}
/**
* 导出入库任务历史列表
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:export')")
@Log(title = "入库任务历史", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TOngoodsshelfBak tOngoodsshelfBak)
{
tOngoodsshelfBak.setDeptId(getDeptId());
List<TOngoodsshelfBak> list = tOngoodsshelfBakService.selectTOngoodsshelfBakList(tOngoodsshelfBak);
ExcelUtil<TOngoodsshelfBak> util = new ExcelUtil<TOngoodsshelfBak>(TOngoodsshelfBak.class);
util.exportExcel(response, list, "入库任务历史数据");
}
/**
* 获取入库任务历史详细信息
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tOngoodsshelfBakService.selectTOngoodsshelfBakById(id));
}
/**
* 新增入库任务历史
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:add')")
@Log(title = "入库任务历史", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TOngoodsshelfBak tOngoodsshelfBak)
{
tOngoodsshelfBak.setId(OrderCodeFactory.getOrderCode("SHELF", ""));
return toAjax(tOngoodsshelfBakService.insertTOngoodsshelfBak(tOngoodsshelfBak));
}
/**
* 修改入库任务历史
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:edit')")
@Log(title = "入库任务历史", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TOngoodsshelfBak tOngoodsshelfBak)
{
return toAjax(tOngoodsshelfBakService.updateTOngoodsshelfBak(tOngoodsshelfBak));
}
/**
* 删除入库任务历史
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:remove')")
@Log(title = "入库任务历史", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tOngoodsshelfBakService.deleteTOngoodsshelfBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:remove')")
@Log(title = "入库任务历史", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tOngoodsshelfBakService.disabledTOngoodsshelfBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:edit')")
@Log(title = "入库任务历史", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tOngoodsshelfBakService.enableTOngoodsshelfBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:tOnGoodsShelfbak:edit')")
@Log(title = "入库任务历史", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TOngoodsshelfBak tOngoodsshelfBak) {
return toAjax(tOngoodsshelfBakService.updateStatus(tOngoodsshelfBak));
}
}

View File

@ -0,0 +1,148 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TOngoodsshelf;
import com.zbf.system.service.ITOngoodsshelfService;
import com.zbf.web.controller.section.EnhanceDataList;
/**
* 入库任务Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/ongoodsshelf")
public class TOngoodsshelfController extends BaseController {
@Autowired
private ITOngoodsshelfService tOngoodsshelfService;
/**
* 查询入库任务列表
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:list')")
@EnhanceDataList(entityType = TOngoodsshelf.class)
@GetMapping("/list")
public TableDataInfo list(TOngoodsshelf tOngoodsshelf) {
startPage();
// tOngoodsshelf.setDeptId(getDeptId());
List<TOngoodsshelf> list = tOngoodsshelfService.selectTOngoodsshelfList(tOngoodsshelf);
return getDataTable(list);
}
/**
* 导出入库任务列表
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:export')")
@Log(title = "入库任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TOngoodsshelf tOngoodsshelf) {
// tOngoodsshelf.setDeptId(getDeptId());
List<TOngoodsshelf> list = tOngoodsshelfService.selectTOngoodsshelfList(tOngoodsshelf);
ExcelUtil<TOngoodsshelf> util = new ExcelUtil<TOngoodsshelf>(TOngoodsshelf.class);
util.exportExcel(response, list, "入库任务数据");
}
/**
* 获取入库任务详细信息
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(tOngoodsshelfService.selectTOngoodsshelfById(id));
}
/**
* 新增入库任务
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:add')")
@Log(title = "入库任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TOngoodsshelf tOngoodsshelf) {
tOngoodsshelf.setDeptId(getDeptId());
tOngoodsshelf.setId(OrderCodeFactory.getOrderCode("SHELF", ""));
return toAjax(tOngoodsshelfService.insertTOngoodsshelf(tOngoodsshelf));
}
/**
* 修改入库任务
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:edit')")
@Log(title = "入库任务", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TOngoodsshelf tOngoodsshelf) {
return toAjax(tOngoodsshelfService.updateTOngoodsshelf(tOngoodsshelf));
}
/**
* 删除入库任务
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:remove')")
@Log(title = "入库任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tOngoodsshelfService.deleteTOngoodsshelfByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:remove')")
@Log(title = "入库任务", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
return toAjax(tOngoodsshelfService.disabledTOngoodsshelfByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:edit')")
@Log(title = "入库任务", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids) {
return toAjax(tOngoodsshelfService.enableTOngoodsshelfByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:ongoodsshelf:edit')")
@Log(title = "入库任务", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TOngoodsshelf tOngoodsshelf) {
return toAjax(tOngoodsshelfService.updateStatus(tOngoodsshelf));
}
/**
* 查询入库任务列表
*/
@GetMapping("/selectList")
public AjaxResult selectList(TOngoodsshelf tOngoodsshelf) {
// tOngoodsshelf.setDeptId(getDeptId());
List<TOngoodsshelf> list = tOngoodsshelfService.selectTOngoodsshelfList(tOngoodsshelf);
return success(list);
}
}

View File

@ -0,0 +1,132 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TPanDetail;
import com.zbf.system.service.ITPanDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 盘点明细Controller
*
* @author wgs
* @date 2024-11-01
*/
@RestController
@RequestMapping("/system/pan")
public class TPanDetailController extends BaseController
{
@Autowired
private ITPanDetailService tPanDetailService;
/**
* 查询盘点明细列表
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@GetMapping("/list")
public TableDataInfo list(TPanDetail tPanDetail)
{
startPage();
List<TPanDetail> list = tPanDetailService.selectTPanDetailList(tPanDetail);
return getDataTable(list);
}
/**
* 导出盘点明细列表
*/
@PreAuthorize("@ss.hasPermi('system:pan:export')")
@Log(title = "盘点明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TPanDetail tPanDetail)
{
List<TPanDetail> list = tPanDetailService.selectTPanDetailList(tPanDetail);
ExcelUtil<TPanDetail> util = new ExcelUtil<TPanDetail>(TPanDetail.class);
util.exportExcel(response, list, "盘点明细数据");
}
/**
* 获取盘点明细详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tPanDetailService.selectTPanDetailById(id));
}
/**
* 新增盘点明细
*/
@PreAuthorize("@ss.hasPermi('system:pan:add')")
@Log(title = "盘点明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TPanDetail tPanDetail)
{
return toAjax(tPanDetailService.insertTPanDetail(tPanDetail));
}
/**
* 修改盘点明细
*/
@PreAuthorize("@ss.hasPermi('system:pan:edit')")
@Log(title = "盘点修改库存数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TPanDetail tPanDetail)
{
return toAjax(tPanDetailService.updateTPanDetail(tPanDetail));
}
/**
* 删除盘点明细
*/
@PreAuthorize("@ss.hasPermi('system:pan:remove')")
@Log(title = "盘点明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tPanDetailService.deleteTPanDetailByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:pan:remove')")
@Log(title = "盘点明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable Long[] ids)
{
return toAjax(tPanDetailService.disabledTPanDetailByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:pan:edit')")
@Log(title = "盘点明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable Long[] ids)
{
return toAjax(tPanDetailService.enableTPanDetailByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:pan:edit')")
@Log(title = "盘点明细", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TPanDetail tPanDetail) {
return toAjax(tPanDetailService.updateStatus(tPanDetail));
}
}

View File

@ -0,0 +1,178 @@
package com.zbf.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TMiStock;
import com.zbf.system.domain.TPanOrder;
import com.zbf.system.service.ITMiStockService;
import com.zbf.system.service.ITPanDetailService;
import com.zbf.system.service.ITPanOrderService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 盘点单Controller
*
* @author wgs
* @date 2024-06-20
*/
@RestController
@RequestMapping("/system/pan/order")
public class TPanOrderController extends BaseController {
private final ITPanOrderService tPanOrderService;
private final ITPanDetailService detailService;
private ITMiStockService stockService;
public TPanOrderController(ITPanOrderService tPanOrderService, ITPanDetailService detailService, ITMiStockService stockService) {
this.tPanOrderService = tPanOrderService;
this.detailService = detailService;
this.stockService = stockService;
}
/**
* 保存单据主表跟单据从表的数据
*/
/*@PreAuthorize("@ss.hasPermi('system:pan:list')")
@Log(title = "保存盘点单主从表", businessType = BusinessType.EXPORT)
@PostMapping("/saveAll")
public AjaxResult saveAll(@RequestBody TPanVo panVo) {
TPanOrder panOrder = new TPanOrder();
BeanUtils.copyProperties(panVo, panOrder);
tPanOrderService.saveOrUpdate(panOrder);
List<TPanDetail> detailList = panVo.getDetailList();
detailList = detailList.stream().map(obj -> {
obj.setMainId(panOrder.getId());
return obj;
}).collect(Collectors.toList());
detailService.saveOrUpdateBatch(detailList);
return AjaxResult.success();
}*/
/**
* 根据当前库存生成盘点明细
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@GetMapping("/importCurrStock")
public TableDataInfo importCurrStock(@RequestParam Map<String, Object> params) {
startPage();
LambdaQueryWrapper<TMiStock> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(TMiStock::getStorageId, params.getOrDefault("storageId", ""));
queryWrapper.eq(TMiStock::getStorageAreaId, params.getOrDefault("storageAreaId", ""));
List<TMiStock> list = stockService.list(queryWrapper);
return getDataTable(list);
}
/**
* 查询盘点单列表 importCurrStock
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@GetMapping("/list")
public TableDataInfo list(TPanOrder tPanOrder) {
startPage();
tPanOrder.setDeptId(getDeptId());
List<TPanOrder> list = tPanOrderService.selectTPanOrderList(tPanOrder);
return getDataTable(list);
}
/**
* 导出盘点单列表
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@Log(title = "盘点单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TPanOrder tPanOrder) {
tPanOrder.setDeptId(getDeptId());
List<TPanOrder> list = tPanOrderService.selectTPanOrderList(tPanOrder);
ExcelUtil<TPanOrder> util = new ExcelUtil<TPanOrder>(TPanOrder.class);
util.exportExcel(response, list, "盘点单数据");
}
/**
* 获取盘点单详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(tPanOrderService.getById(id));
}
/**
* 新增盘点单
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@Log(title = "盘点单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TPanOrder tPanOrder) {
tPanOrder.setDeptId(getDeptId());
return toAjax(tPanOrderService.save(tPanOrder));
}
/**
* 修改盘点单
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@Log(title = "盘点单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TPanOrder tPanOrder) {
return toAjax(tPanOrderService.updateById(tPanOrder));
}
/**
* 删除盘点单
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@Log(title = "盘点单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tPanOrderService.removeById(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@Log(title = "盘点单", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
List<TPanOrder> list = new ArrayList<>();
for (String id : ids) {
TPanOrder tPanOrder = new TPanOrder();
tPanOrder.setId(id);
tPanOrder.setDelFlag(1);
}
return toAjax(tPanOrderService.updateBatchById(list));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:pan:list')")
@Log(title = "盘点单", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TPanOrder tPanOrder) {
return toAjax(tPanOrderService.updateById(tPanOrder));
}
/**
* 手持盘点提交
*/
@Log(title = "手持盘点", businessType = BusinessType.UPDATE)
@PutMapping("/pdaPanConfirm")
public AjaxResult pdaPanConfirm(@RequestBody List<TMiStock> tMiStockList) {
return tPanOrderService.pdaPanConfirm(tMiStockList);
}
}

View File

@ -0,0 +1,145 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TRkReceivingGoods;
import com.zbf.system.service.ITRkReceivingGoodsService;
/**
* 收货单Controller
*
* @author tony
* @date 2024-06-18
*/
@RestController
@RequestMapping("/system/rkRecevinggoods")
public class TRkReceivingGoodsController extends BaseController
{
@Autowired
private ITRkReceivingGoodsService tRkReceivingGoodsService;
/**
* 查询收货单列表
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:list')")
@GetMapping("/list")
public TableDataInfo list(TRkReceivingGoods tRkReceivingGoods)
{
startPage();
tRkReceivingGoods.setDeptId(getDeptId());
List<TRkReceivingGoods> list = tRkReceivingGoodsService.selectTRkReceivingGoodsList(tRkReceivingGoods);
return getDataTable(list);
}
/**
* 导出收货单列表
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:export')")
@Log(title = "收货单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TRkReceivingGoods tRkReceivingGoods)
{
tRkReceivingGoods.setDeptId(getDeptId());
List<TRkReceivingGoods> list = tRkReceivingGoodsService.selectTRkReceivingGoodsList(tRkReceivingGoods);
ExcelUtil<TRkReceivingGoods> util = new ExcelUtil<TRkReceivingGoods>(TRkReceivingGoods.class);
util.exportExcel(response, list, "收货单数据");
}
/**
* 获取收货单详细信息
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tRkReceivingGoodsService.selectTRkReceivingGoodsById(id));
}
/**
* 新增收货单
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:add')")
@Log(title = "收货单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TRkReceivingGoods tRkReceivingGoods)
{
tRkReceivingGoods.setId(OrderCodeFactory.getOrderCode("R", ""));
return toAjax(tRkReceivingGoodsService.insertTRkReceivingGoods(tRkReceivingGoods));
}
/**
* 修改收货单
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:edit')")
@Log(title = "收货单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TRkReceivingGoods tRkReceivingGoods)
{
return toAjax(tRkReceivingGoodsService.updateTRkReceivingGoods(tRkReceivingGoods));
}
/**
* 删除收货单
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:remove')")
@Log(title = "收货单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tRkReceivingGoodsService.deleteTRkReceivingGoodsByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:remove')")
@Log(title = "收货单", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tRkReceivingGoodsService.disabledTRkReceivingGoodsByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:edit')")
@Log(title = "收货单", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tRkReceivingGoodsService.enableTRkReceivingGoodsByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:rkRecevinggoods:edit')")
@Log(title = "收货单", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TRkReceivingGoods tRkReceivingGoods) {
return toAjax(tRkReceivingGoodsService.updateStatus(tRkReceivingGoods));
}
}

View File

@ -0,0 +1,138 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TRkWareNoticeBak;
import com.zbf.system.service.ITRkWareNoticeBakService;
/**
* 入库通知单历史表Controller
*
* @author tony
* @date 2024-06-18
*/
@RestController
@RequestMapping("/system/rkWareNoticeBak")
public class TRkWareNoticeBakController extends BaseController {
@Autowired
private ITRkWareNoticeBakService tRkWareNoticeBakService;
/**
* 查询入库通知单历史表列表
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TRkWareNoticeBak.class)
public TableDataInfo list(TRkWareNoticeBak tRkWareNoticeBak) {
startPage();
tRkWareNoticeBak.setDeptId(getDeptId());
List<TRkWareNoticeBak> list = tRkWareNoticeBakService.selectTRkWareNoticeBakList(tRkWareNoticeBak);
return getDataTable(list);
}
/**
* 导出入库通知单历史表列表
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:export')")
@Log(title = "入库通知单历史表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TRkWareNoticeBak tRkWareNoticeBak) {
tRkWareNoticeBak.setDeptId(getDeptId());
List<TRkWareNoticeBak> list = tRkWareNoticeBakService.selectTRkWareNoticeBakList(tRkWareNoticeBak);
ExcelUtil<TRkWareNoticeBak> util = new ExcelUtil<TRkWareNoticeBak>(TRkWareNoticeBak.class);
util.exportExcel(response, list, "入库通知单历史表数据");
}
/**
* 获取入库通知单历史表详细信息
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(tRkWareNoticeBakService.selectTRkWareNoticeBakById(id));
}
/**
* 新增入库通知单历史表
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:add')")
@Log(title = "入库通知单历史表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TRkWareNoticeBak tRkWareNoticeBak) {
tRkWareNoticeBak.setId(OrderCodeFactory.getOrderCode("TRK", ""));
return toAjax(tRkWareNoticeBakService.insertTRkWareNoticeBak(tRkWareNoticeBak));
}
/**
* 修改入库通知单历史表
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:edit')")
@Log(title = "入库通知单历史表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TRkWareNoticeBak tRkWareNoticeBak) {
return toAjax(tRkWareNoticeBakService.updateTRkWareNoticeBak(tRkWareNoticeBak));
}
/**
* 删除入库通知单历史表
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:remove')")
@Log(title = "入库通知单历史表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tRkWareNoticeBakService.deleteTRkWareNoticeBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:remove')")
@Log(title = "入库通知单历史表", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
return toAjax(tRkWareNoticeBakService.disabledTRkWareNoticeBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:edit')")
@Log(title = "入库通知单历史表", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids) {
return toAjax(tRkWareNoticeBakService.enableTRkWareNoticeBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeBak:edit')")
@Log(title = "入库通知单历史表", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TRkWareNoticeBak tRkWareNoticeBak) {
return toAjax(tRkWareNoticeBakService.updateStatus(tRkWareNoticeBak));
}
}

View File

@ -0,0 +1,344 @@
package com.zbf.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.system.domain.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.domain.model.LoginUser;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.SecurityUtils;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.print.SalesTicket;
import com.zbf.system.print.YcPrinter;
import com.zbf.system.service.ITRkWareNoticeService;
import com.zbf.web.controller.section.EnhanceDataList;
/**
* 入库通知单Controller
*
* @author tony
* @date 2024-06-18
*/
@RestController
@RequestMapping("/system/trkNotice")
public class TRkWareNoticeController extends BaseController {
@Autowired
private ITRkWareNoticeService tRkWareNoticeService;
/**
* 查询入库通知单列表
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:list')")
@GetMapping("/list")
@EnhanceDataList(entityType = TRkWareNotice.class)
public TableDataInfo list(TRkWareNotice tRkWareNotice) {
startPage();
tRkWareNotice.setDeptId(getDeptId());
List<TRkWareNotice> list = tRkWareNoticeService.selectTRkWareNoticeList(tRkWareNotice);
return getDataTable(list);
}
/**
* 导出入库通知单列表
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:export')")
@Log(title = "入库通知单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TRkWareNotice tRkWareNotice) {
tRkWareNotice.setDeptId(getDeptId());
List<TRkWareNotice> list = tRkWareNoticeService.exportTRkWareNoticeList(tRkWareNotice);
ExcelUtil<TRkWareNotice> util = new ExcelUtil<TRkWareNotice>(TRkWareNotice.class);
util.exportExcel(response, list, "入库通知单数据");
}
/**
* 获取入库通知单详细信息
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
TRkWareNotice tRkWareNotice = tRkWareNoticeService.selectTRkWareNoticeById(id);
if (tRkWareNotice == null) {
tRkWareNotice = new TRkWareNotice();
List<TRkWareNoticeTab> tabs = new ArrayList<TRkWareNoticeTab>();
tRkWareNotice.setTRkWareNoticeTabList(tabs);
}
return success(tRkWareNotice);
}
/**
* 获取入库通知单详细信息
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:query')")
@GetMapping(value = "/noticeId/{id}")
public AjaxResult getNoticeInfo(@PathVariable("id") String id) {
TRkWareNotice tRkWareNotice = tRkWareNoticeService.selectTRkWareNoticeByDeliveryId(id);
if (tRkWareNotice == null) {
tRkWareNotice = new TRkWareNotice();
List<TRkWareNoticeTab> tabs = new ArrayList<TRkWareNoticeTab>();
tRkWareNotice.setTRkWareNoticeTabList(tabs);
}
return success(tRkWareNotice);
}
/**
* 新增入库通知单
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:add')")
@Log(title = "入库通知单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TRkWareNotice tRkWareNotice) {
tRkWareNotice.setDeptId(getDeptId());
tRkWareNotice.setId(OrderCodeFactory.getOrderCode("", ""));
tRkWareNotice.setNoticeId(OrderCodeFactory.getOrderCode("TWO", ""));
tRkWareNotice.setApplicant(SecurityUtils.getUserNick());
tRkWareNotice.setCreateBy(getUsername());
tRkWareNotice.setReceivingStatus("0");
return toAjax(tRkWareNoticeService.insertTRkWareNotice(tRkWareNotice));
}
/**
* 修改入库通知单
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:edit')")
@Log(title = "入库通知单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TRkWareNotice tRkWareNotice) {
return toAjax(tRkWareNoticeService.updateTRkWareNotice(tRkWareNotice));
}
/**
* 删除入库通知单
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:remove')")
@Log(title = "入库通知单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult removeTabs(@PathVariable String[] ids) {
return toAjax(tRkWareNoticeService.deleteTRkWareNoticeByIds(ids));
}
/**
* 删除入库通知单明细
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:remove')")
@Log(title = "入库通知单", businessType = BusinessType.DELETE)
@DeleteMapping("/tabs/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
Map<String, String> result = tRkWareNoticeService.deleteTRkWareNoticeTabByIds(ids);
return success(result);
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:remove')")
@Log(title = "入库通知单", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids) {
return toAjax(tRkWareNoticeService.disabledTRkWareNoticeByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:edit')")
@Log(title = "入库通知单", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids) {
return toAjax(tRkWareNoticeService.enableTRkWareNoticeByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:edit')")
@Log(title = "入库通知单", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TRkWareNotice tRkWareNotice) {
return toAjax(tRkWareNoticeService.updateStatus(tRkWareNotice));
}
/**
* 收货接口
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:add')")
@Log(title = "确认入库通知单明细", businessType = BusinessType.INSERT)
@PostMapping("/confirmNoticeTab")
public AjaxResult confirmNoticeTab(@RequestBody TRkWareNoticeTabUpdate update) {
update.setDeptId(getDeptId());
update.setUserName(getLoginUser().getUser().getNickName());
Map<String, String> result = tRkWareNoticeService.confirmNoticeTab(update);
return success(result);
}
/**
* 入库通知单明细保存
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:add')")
@Log(title = "保存入库通知单明细", businessType = BusinessType.INSERT)
@PostMapping("/saveNoticeTab")
public AjaxResult saveNoticeTab(@RequestBody TRkWareNoticeTabUpdate update) {
update.setDeptId(getDeptId());
update.setUserName(getLoginUser().getUser().getNickName());
Map<String, String> result = tRkWareNoticeService.saveNoticeTab(update);
return success(result);
}
/**
* 入库通知单明细手动完成
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:add')")
@Log(title = "手动完成入库通知单明细", businessType = BusinessType.INSERT)
@PostMapping("/manualCompletion")
public AjaxResult manualCompletion(@RequestBody TRkWareNoticeTabUpdate update) {
update.setDeptId(getDeptId());
update.setUserName(getLoginUser().getUser().getNickName());
Map<String, String> result = tRkWareNoticeService.manualCompletion(update);
return success(result);
}
/**
* 上架入库
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:add')")
@Log(title = "入库任务上架入库", businessType = BusinessType.INSERT)
@PostMapping("/shelvesConfirm")
public AjaxResult shelvesConfirm(@RequestBody TRkWareNoticeTabUpdate update) {
update.setDeptId(getDeptId());
update.setUserName(getLoginUser().getUser().getNickName());
Map<String, String> result = tRkWareNoticeService.shelvesConfirm(update);
return success(result);
}
/**
* 导入
*/
@Log(title = "入库数据", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<TRkWareNoticeTab> util = new ExcelUtil<TRkWareNoticeTab>(TRkWareNoticeTab.class);
List<TRkWareNoticeTab> trList = util.importExcel(file.getInputStream());
LoginUser loginUser = getLoginUser();
String operName = loginUser.getUser().getNickName();
String message = tRkWareNoticeService.importData(trList, updateSupport, operName);
return AjaxResult.success(message);
}
/**
* 一级库导入
*/
@Log(title = "入库数据", businessType = BusinessType.IMPORT)
@PostMapping("/importExcelData")
public AjaxResult importExcelData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<TRkWareNoticeTabExcel> util = new ExcelUtil<TRkWareNoticeTabExcel>(TRkWareNoticeTabExcel.class);
List<TRkWareNoticeTabExcel> trList = util.importExcel(file.getInputStream());
LoginUser loginUser = getLoginUser();
String operName = loginUser.getUser().getNickName();
String message = tRkWareNoticeService.importExcelData(trList, updateSupport, operName);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<TRkWareNoticeTab> util = new ExcelUtil<TRkWareNoticeTab>(TRkWareNoticeTab.class);
util.importTemplateExcel(response,"入库通知单");
}
@PostMapping("/importExcelTemplate")
public void importExcelTemplate(HttpServletResponse response)
{
ExcelUtil<TRkWareNoticeTabExcel> util = new ExcelUtil<TRkWareNoticeTabExcel>(TRkWareNoticeTabExcel.class);
util.importTemplateExcel(response,"一级入库通知单");
}
@Log(title = "入库单条码打印", businessType = BusinessType.INSERT)
@PostMapping("/printBarCode")
public AjaxResult printBarCode(@RequestBody TRkWareNoticeTabUpdate update) {
int count = update.getPrintNum();
for (int i = 0; i < count; i++) {
SalesTicket stk = new SalesTicket(update,null);
YcPrinter p = new YcPrinter(stk);
p.printer();
}
return AjaxResult.success("打印成功");
}
/**
* 发送入库通知单消息
*/
@Log(title = "发送入库通知单消息", businessType = BusinessType.UPDATE)
@PostMapping("/sendOrderNotice")
public AjaxResult sendNotice(@RequestBody TRkWareNoticeTabUpdate update) {
update.setCreateBy(getLoginUser().getUser().getNickName());
update.setDeptId(getDeptId());
return AjaxResult.success(tRkWareNoticeService.sendOrderNotice(update));
}
@Log(title = "推送入库通知单", businessType = BusinessType.UPDATE)
@PostMapping("/sendIwms")
public AjaxResult sendIwms(@RequestBody TRkWareNoticeTabUpdate update) {
update.setCreateBy(getLoginUser().getUser().getNickName());
update.setDeptId(getDeptId());
return AjaxResult.success(tRkWareNoticeService.sendIwmsUnified(update));
}
/**
* 手动入库
*/
@Log(title = "无单收货", businessType = BusinessType.UPDATE)
@PostMapping("/handAddGoodsTab")
public AjaxResult handAddGoodsTab(@RequestBody TRkWareNoticeTabUpdate update) {
update.setId(OrderCodeFactory.getOrderCode("", ""));
update.setNoticeId(OrderCodeFactory.getOrderCode("TWO", ""));
return AjaxResult.success(tRkWareNoticeService.handAddGoodsTab(update));
}
/**
* 虚拟库位上架
*/
@Log(title = "虚拟库位上架", businessType = BusinessType.UPDATE)
@PostMapping("/virtualListing")
public AjaxResult virtualListing(@RequestBody TCkOrders orders) {
return AjaxResult.success(tRkWareNoticeService.virtualListing(orders));
}
/**
* 车间退货入库
*/
@Log(title = "车间退货入库", businessType = BusinessType.UPDATE)
@PostMapping("/workshopReturn")
public AjaxResult workshopReturn(@RequestBody TckOrdersBak orders) {
orders.setApplicant(getLoginUser().getUser().getNickName());
orders.setRecordPerson(getLoginUser().getUser().getNickName());
orders.setDeptId(getDeptId());
return AjaxResult.success(tRkWareNoticeService.workshopReturn(orders));
}
}

View File

@ -0,0 +1,193 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zbf.system.domain.TRkWareNoticeBak;
import com.zbf.system.mapper.TRkWareNoticeTabBakMapper;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TRkWareNoticeTabBak;
import com.zbf.system.service.ITRkWareNoticeTabBakService;
/**
* 入库通知单明细备份Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/rkWareNoticeTabBak")
public class TRkWareNoticeTabBakController extends BaseController
{
@Autowired
private ITRkWareNoticeTabBakService tRkWareNoticeTabBakService;
@Autowired
private TRkWareNoticeTabBakMapper tRkWareNoticeTabBakMapper;
/**
* 查询入库通知单明细备份列表
*/
@GetMapping("/list")
@EnhanceDataList(entityType = TRkWareNoticeTabBak.class)
public TableDataInfo list(TRkWareNoticeTabBak tRkWareNoticeTabBak)
{
startPage();
// tMiStock.setDeptId(getDeptId());
if (tRkWareNoticeTabBak.getDate()!=null){
String[] date = tRkWareNoticeTabBak.getDate();
tRkWareNoticeTabBak.setStartTime(date[0]);
tRkWareNoticeTabBak.setEndTime(date[1]);
}
List<TRkWareNoticeTabBak> list = tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakList(tRkWareNoticeTabBak);
return getDataTable(list);
}
@GetMapping("/listSupplier")
@EnhanceDataList(entityType = TRkWareNoticeTabBak.class)
public TableDataInfo listSupplier()
{
TRkWareNoticeTabBak tRkWareNoticeTabBak = new TRkWareNoticeTabBak();
List<TRkWareNoticeTabBak> list = tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakList(tRkWareNoticeTabBak);
return getDataTable(list);
}
@GetMapping("/syList")
public TableDataInfo syList(TRkWareNoticeTabBak tRkWareNoticeTabBak)
{
if (tRkWareNoticeTabBak.getDate()!=null){
String[] date = tRkWareNoticeTabBak.getDate();
tRkWareNoticeTabBak.setStartTime(date[0]);
tRkWareNoticeTabBak.setEndTime(date[1]);
}
List<TRkWareNoticeTabBak> list = tRkWareNoticeTabBakMapper.selectTRkWareNoticeTabBakLists();
return getDataTable(list);
}
@GetMapping("/listTotal")
public AjaxResult listTotal(TRkWareNoticeTabBak tRkWareNoticeTabBak)
{
if (tRkWareNoticeTabBak.getDate()!=null){
String[] date = tRkWareNoticeTabBak.getDate();
tRkWareNoticeTabBak.setStartTime(date[0]);
tRkWareNoticeTabBak.setEndTime(date[1]);
}
List<TRkWareNoticeTabBak> list = tRkWareNoticeTabBakService.select(tRkWareNoticeTabBak);
return AjaxResult.success(list);
}
/**
* 导出入库通知单明细备份列表
*/
// @PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:export')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TRkWareNoticeTabBak tRkWareNoticeTabBak)
{
List<TRkWareNoticeTabBak> list = tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakList(tRkWareNoticeTabBak);
ExcelUtil<TRkWareNoticeTabBak> util = new ExcelUtil<>(TRkWareNoticeTabBak.class);
util.exportExcel(response, list, "入库通知单明细备份数据");
}
/**
* 获取入库通知单明细备份详细信息
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakById(id));
}
/**
* 新增入库通知单明细备份
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:add')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TRkWareNoticeTabBak tRkWareNoticeTabBak)
{
tRkWareNoticeTabBak.setId(OrderCodeFactory.getOrderCode("TRKTAB", ""));
return toAjax(tRkWareNoticeTabBakService.insertTRkWareNoticeTabBak(tRkWareNoticeTabBak));
}
/**
* 修改入库通知单明细备份
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:edit')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TRkWareNoticeTabBak tRkWareNoticeTabBak)
{
return toAjax(tRkWareNoticeTabBakService.updateTRkWareNoticeTabBak(tRkWareNoticeTabBak));
}
/**
* 删除入库通知单明细备份
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:remove')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabBakService.deleteTRkWareNoticeTabBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:remove')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabBakService.disabledTRkWareNoticeTabBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:edit')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabBakService.enableTRkWareNoticeTabBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:edit')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TRkWareNoticeTabBak tRkWareNoticeTabBak) {
return toAjax(tRkWareNoticeTabBakService.updateStatus(tRkWareNoticeTabBak));
}
}

View File

@ -0,0 +1,141 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TRkWareNoticeTab;
import com.zbf.system.service.ITRkWareNoticeTabService;
/**
* 入库通知单明细Controller
*
* @author tony
* @date 2024-08-16
*/
@RestController
@RequestMapping("/system/trkWareNoticeTab")
public class TRkWareNoticeTabController extends BaseController
{
@Autowired
private ITRkWareNoticeTabService tRkWareNoticeTabService;
/**
* 查询入库通知单明细列表
*/
@PreAuthorize("@ss.hasPermi('system:trkNotice:list')")
@GetMapping("/list")
public TableDataInfo list(TRkWareNoticeTab tRkWareNoticeTab)
{
startPage();
List<TRkWareNoticeTab> list = tRkWareNoticeTabService.selectTRkWareNoticeTabList(tRkWareNoticeTab);
return getDataTable(list);
}
/**
* 导出入库通知单明细列表
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:export')")
@Log(title = "入库通知单明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TRkWareNoticeTab tRkWareNoticeTab)
{
List<TRkWareNoticeTab> list = tRkWareNoticeTabService.selectTRkWareNoticeTabList(tRkWareNoticeTab);
ExcelUtil<TRkWareNoticeTab> util = new ExcelUtil<TRkWareNoticeTab>(TRkWareNoticeTab.class);
util.exportExcel(response, list, "入库通知单明细数据");
}
/**
* 获取入库通知单明细详细信息
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tRkWareNoticeTabService.selectTRkWareNoticeTabById(id));
}
/**
* 新增入库通知单明细
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:add')")
@Log(title = "入库通知单明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TRkWareNoticeTab tRkWareNoticeTab)
{
return toAjax(tRkWareNoticeTabService.insertTRkWareNoticeTab(tRkWareNoticeTab));
}
/**
* 修改入库通知单明细
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:edit')")
@Log(title = "入库通知单明细", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TRkWareNoticeTab tRkWareNoticeTab)
{
return toAjax(tRkWareNoticeTabService.updateTRkWareNoticeTab(tRkWareNoticeTab));
}
/**
* 删除入库通知单明细
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:remove')")
@Log(title = "入库通知单明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabService.deleteTRkWareNoticeTabByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:remove')")
@Log(title = "入库通知单明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabService.disabledTRkWareNoticeTabByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:edit')")
@Log(title = "入库通知单明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabService.enableTRkWareNoticeTabByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:trkWareNoticeTab:edit')")
@Log(title = "入库通知单明细", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TRkWareNoticeTab tRkWareNoticeTab) {
return toAjax(tRkWareNoticeTabService.updateStatus(tRkWareNoticeTab));
}
}

View File

@ -0,0 +1,208 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.OrderCodeFactory;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TRkWareNoticeTabBak;
import com.zbf.system.domain.TRkXnWareNoticeTabBak;
import com.zbf.system.domain.TckXnOrderdetailBak;
import com.zbf.system.mapper.TRkWareNoticeTabBakMapper;
import com.zbf.system.mapper.TRkXnWareNoticeTabBakMapper;
import com.zbf.system.service.ITRkWareNoticeTabBakService;
import com.zbf.system.service.ITRkXnWareNoticeTabBakService;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 入库通知单明细备份Controller
*
* @author tony
* @date 2024-06-14
*/
@RestController
@RequestMapping("/system/rkXnWareNoticeTabBak")
public class TRkXnWareNoticeTabBakController extends BaseController
{
@Autowired
private ITRkXnWareNoticeTabBakService tRkWareNoticeTabBakService;
@Autowired
private TRkXnWareNoticeTabBakMapper tRkWareNoticeTabBakMapper;
/**
* 查询入库通知单明细备份列表
*/
@GetMapping("/list")
@EnhanceDataList(entityType = TRkXnWareNoticeTabBak.class)
public TableDataInfo list(TRkXnWareNoticeTabBak tRkWareNoticeTabBak)
{
startPage();
// tMiStock.setDeptId(getDeptId());
if (tRkWareNoticeTabBak.getDate()!=null){
String[] date = tRkWareNoticeTabBak.getDate();
tRkWareNoticeTabBak.setStartTime(date[0]);
tRkWareNoticeTabBak.setEndTime(date[1]);
}
List<TRkXnWareNoticeTabBak> list = tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakList(tRkWareNoticeTabBak);
return getDataTable(list);
}
@GetMapping("/listSupplier")
@EnhanceDataList(entityType = TRkWareNoticeTabBak.class)
public TableDataInfo listSupplier()
{
TRkXnWareNoticeTabBak tRkWareNoticeTabBak = new TRkXnWareNoticeTabBak();
List<TRkXnWareNoticeTabBak> list = tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakList(tRkWareNoticeTabBak);
return getDataTable(list);
}
@GetMapping("/syList")
public TableDataInfo syList(TRkWareNoticeTabBak tRkWareNoticeTabBak)
{
if (tRkWareNoticeTabBak.getDate()!=null){
String[] date = tRkWareNoticeTabBak.getDate();
tRkWareNoticeTabBak.setStartTime(date[0]);
tRkWareNoticeTabBak.setEndTime(date[1]);
}
List<TRkXnWareNoticeTabBak> list = tRkWareNoticeTabBakMapper.selectTRkWareNoticeTabBakLists();
return getDataTable(list);
}
@GetMapping("/listTotal")
public AjaxResult listTotal(TRkXnWareNoticeTabBak tRkWareNoticeTabBak)
{
if (tRkWareNoticeTabBak.getDate()!=null){
String[] date = tRkWareNoticeTabBak.getDate();
tRkWareNoticeTabBak.setStartTime(date[0]);
tRkWareNoticeTabBak.setEndTime(date[1]);
}
List<TRkXnWareNoticeTabBak> list = tRkWareNoticeTabBakService.select(tRkWareNoticeTabBak);
return AjaxResult.success(list);
}
/**
* 导出入库通知单明细备份列表
*/
// @PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:export')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TRkXnWareNoticeTabBak tRkWareNoticeTabBak)
{
List<TRkXnWareNoticeTabBak> list = tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakList(tRkWareNoticeTabBak);
ExcelUtil<TRkXnWareNoticeTabBak> util = new ExcelUtil<>(TRkXnWareNoticeTabBak.class);
util.exportExcel(response, list, "入库通知单明细备份数据");
}
/**
* 导入
*/
@Log(title = "出库数据", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception
{
ExcelUtil<TRkXnWareNoticeTabBak> util = new ExcelUtil<TRkXnWareNoticeTabBak>(TRkXnWareNoticeTabBak.class);
List<TRkXnWareNoticeTabBak> trList = util.importExcel(file.getInputStream());
String message = tRkWareNoticeTabBakService.importData(trList, "");
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<TRkXnWareNoticeTabBak> util = new ExcelUtil<TRkXnWareNoticeTabBak>(TRkXnWareNoticeTabBak.class);
util.importTemplateExcel(response,"虚拟出库记录");
}
/**
* 获取入库通知单明细备份详细信息
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tRkWareNoticeTabBakService.selectTRkWareNoticeTabBakById(id));
}
/**
* 新增入库通知单明细备份
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:add')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TRkXnWareNoticeTabBak tRkWareNoticeTabBak)
{
tRkWareNoticeTabBak.setId(OrderCodeFactory.getOrderCode("TRKTAB", ""));
return toAjax(tRkWareNoticeTabBakService.insertTRkWareNoticeTabBak(tRkWareNoticeTabBak));
}
/**
* 修改入库通知单明细备份
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:edit')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TRkXnWareNoticeTabBak tRkWareNoticeTabBak)
{
return toAjax(tRkWareNoticeTabBakService.updateTRkWareNoticeTabBak(tRkWareNoticeTabBak));
}
/**
* 删除入库通知单明细备份
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:remove')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabBakService.deleteTRkWareNoticeTabBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:remove')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabBakService.disabledTRkWareNoticeTabBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:edit')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tRkWareNoticeTabBakService.enableTRkWareNoticeTabBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:rkWareNoticeTabBak:edit')")
@Log(title = "入库通知单明细备份", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TRkXnWareNoticeTabBak tRkWareNoticeTabBak) {
return toAjax(tRkWareNoticeTabBakService.updateStatus(tRkWareNoticeTabBak));
}
}

View File

@ -0,0 +1,62 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.SafetyStockVO;
import com.zbf.system.service.ITSafetyStockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
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.HttpServletResponse;
import java.util.List;
/**
* 安全库存Controller
*
* @author sunits
* @date 2024-06-18
*/
@RestController
@RequestMapping("/system/safetyStock")
@Api(value = "安全库存控制器", tags = {"安全库存管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class TSafetyStockController extends BaseController {
private final ITSafetyStockService safetyStockService;
/**
* 查询库存列表
*/
@ApiOperation("查询库存列表")
@PreAuthorize("@ss.hasPermi('system:safetyStock:list')")
@GetMapping("/list")
public TableDataInfo list(SafetyStockVO safetyStockVO) {
startPage();
List<SafetyStockVO> list = safetyStockService.selectList(safetyStockVO);
return getDataTable(list);
}
/**
* 导出库存列表
*/
@ApiOperation("导出库存列表")
@PreAuthorize("@ss.hasPermi('system:safetyStock:export')")
@Log(title = "库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SafetyStockVO safetyStockVO) {
List<SafetyStockVO> list = safetyStockService.selectList(safetyStockVO);
ExcelUtil<SafetyStockVO> util = new ExcelUtil<SafetyStockVO>(SafetyStockVO.class);
util.exportExcel(response, list, "库存数据");
}
}

View File

@ -0,0 +1,105 @@
package com.zbf.web.controller.system;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TStockCheck;
import com.zbf.system.service.ITStockCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 盘点库存数据Controller
*
* @author tony
* @date 2024-10-31
*/
@RestController
@RequestMapping("/system/checkStock")
public class TStockCheckController extends BaseController
{
@Autowired
private ITStockCheckService tStockCheckService;
/**
* 查询盘点库存数据列表
*/
@PreAuthorize("@ss.hasPermi('system:check:list')")
@GetMapping("/list")
public TableDataInfo list(TStockCheck tStockCheck)
{
startPage();
List<TStockCheck> list = tStockCheckService.selectTStockCheckList(tStockCheck);
return getDataTable(list);
}
/**
* 导出盘点库存数据列表
*/
@PreAuthorize("@ss.hasPermi('system:check:export')")
@Log(title = "盘点库存数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TStockCheck tStockCheck)
{
List<TStockCheck> list = tStockCheckService.selectTStockCheckList(tStockCheck);
ExcelUtil<TStockCheck> util = new ExcelUtil<TStockCheck>(TStockCheck.class);
util.exportExcel(response, list, "盘点库存数据数据");
}
/**
* 获取盘点库存数据详细信息
*/
@PreAuthorize("@ss.hasPermi('system:check:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("checkId") String checkId)
{
startPage();
return success(tStockCheckService.selectTStockCheckById(checkId));
}
/**
* 新增盘点库存数据
*/
@PreAuthorize("@ss.hasPermi('system:check:add')")
@Log(title = "盘点库存数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TStockCheck tStockCheck)
{
return toAjax(tStockCheckService.insertTStockCheck(tStockCheck));
}
/**
* 修改盘点库存数据
*/
@PreAuthorize("@ss.hasPermi('system:check:edit')")
@Log(title = "盘点库存数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TStockCheck tStockCheck)
{
return toAjax(tStockCheckService.updateTStockCheck(tStockCheck));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:check:edit')")
@Log(title = "盘点库存数据", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TStockCheck tStockCheck) {
return toAjax(tStockCheckService.updateStatus(tStockCheck));
}
}

View File

@ -0,0 +1,135 @@
package com.zbf.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.system.mapper.TUserConfigMapper;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.TUserConfig;
import com.zbf.system.service.ITUserConfigService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* 用户配置文件Controller
*
* @author tony
* @date 2024-07-10
*/
@RestController
@RequestMapping("/system/UserConfiguration")
public class TUserConfigController extends BaseController {
@Autowired
private ITUserConfigService tUserConfigService;
@Autowired
private TUserConfigMapper tUserConfigMapper;
/**
* 查询用户配置文件列表
*/
@GetMapping("/list")
public TableDataInfo list(TUserConfig tUserConfig) {
startPage();
List<TUserConfig> list = tUserConfigService.list(new LambdaQueryWrapper<>(tUserConfig));
return getDataTable(list);
}
/**
* 导出用户配置文件列表
*/
@Log(title = "用户配置文件", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TUserConfig tUserConfig) {
List<TUserConfig> list = tUserConfigService.list(new LambdaQueryWrapper<>(tUserConfig));
ExcelUtil<TUserConfig> util = new ExcelUtil<TUserConfig>(TUserConfig.class);
util.exportExcel(response, list, "用户配置文件数据");
}
/**
* 获取用户配置文件详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tUserConfigService.getById(id));
}
/**
* 新增用户配置文件
*/
@Log(title = "用户配置文件", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TUserConfig tUserConfig) {
return toAjax(tUserConfigMapper.insert(tUserConfig));
}
/**
* 修改用户配置文件
*/
@Log(title = "用户配置文件", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TUserConfig tUserConfig) {
LambdaQueryWrapper<TUserConfig> query = new LambdaQueryWrapper<>();
query.eq(TUserConfig::getUserId, tUserConfig.getUserId());
query.eq(TUserConfig::getRouterPath, tUserConfig.getRouterPath());
query.eq(TUserConfig::getCompName, tUserConfig.getCompName());
List<TUserConfig> tUserConfigs = tUserConfigMapper.selectList(query);
if (tUserConfigs.size() > 0) {
TUserConfig userConfig = tUserConfigs.get(0);
userConfig.setCnfJson(tUserConfig.getCnfJson());
return toAjax(tUserConfigService.updateById(userConfig));
} else {
return toAjax(tUserConfigMapper.insert(tUserConfig));
}
}
/**
* 删除用户配置文件
*/
@Log(title = "用户配置文件", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tUserConfigService.removeById(ids));
}
/**
* 修改状态
*/
@Log(title = "用户配置文件", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TUserConfig tUserConfig) {
return toAjax(tUserConfigService.updateById(tUserConfig));
}
/**
* 根据id 和菜单查询
*
* @param config
* @return
*/
@PostMapping(value = "/information")
public AjaxResult getInfo(@RequestBody TUserConfig config) {
LambdaQueryWrapper<TUserConfig> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TUserConfig::getUserId, config.getUserId()); // 确保这里传入的是有效的userId
queryWrapper.eq(TUserConfig::getRouterPath, config.getRouterPath()); // 确保这里传入的是有效的routerPath
TUserConfig object = tUserConfigService.getOne(queryWrapper);
return AjaxResult.success(object);
}
}

View File

@ -0,0 +1,129 @@
package com.zbf.web.controller.system;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TUserFavorites;
import com.zbf.system.mapper.TUserFavoritesMapper;
import com.zbf.system.service.ITUserFavoritesService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 常用功能收藏夹Controller
*
* @author tony
* @date 2024-07-03
*/
@RestController
@RequestMapping("/system/favorites")
public class TUserFavoritesController extends BaseController {
private final ITUserFavoritesService tUserFavoritesService;
private TUserFavoritesMapper favoritesMapper;
public TUserFavoritesController(ITUserFavoritesService tUserFavoritesService, TUserFavoritesMapper favoritesMapper) {
this.tUserFavoritesService = tUserFavoritesService;
this.favoritesMapper = favoritesMapper;
}
/**
* 查询常用功能收藏夹列表
*/
@GetMapping("/list")
public TableDataInfo list(TUserFavorites tUserFavorites) {
LambdaQueryWrapper query = new LambdaQueryWrapper(tUserFavorites);
List<TUserFavorites> list = favoritesMapper.selectList(query);
return getDataTable(list);
}
/**
* 导出常用功能收藏夹列表
*/
@Log(title = "常用功能收藏夹", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TUserFavorites tUserFavorites) {
List<TUserFavorites> list = tUserFavoritesService.selectTUserFavoritesList(tUserFavorites);
ExcelUtil<TUserFavorites> util = new ExcelUtil<TUserFavorites>(TUserFavorites.class);
util.exportExcel(response, list, "常用功能收藏夹数据");
}
/**
* 获取常用功能收藏夹详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(tUserFavoritesService.selectTUserFavoritesById(id));
}
/**
* 新增常用功能收藏夹
*/
@Log(title = "常用功能收藏夹", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TUserFavorites tUserFavorites) {
favoritesMapper.insert(tUserFavorites);
AjaxResult ajax = AjaxResult.success();
ajax.put("favorites", tUserFavorites);
return ajax;
}
/**
* 修改常用功能收藏夹
*/
@Log(title = "常用功能收藏夹", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TUserFavorites tUserFavorites) {
return toAjax(favoritesMapper.updateById(tUserFavorites));
}
/**
* 删除常用功能收藏夹
*/
@Log(title = "常用功能收藏夹", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(tUserFavoritesService.deleteTUserFavoritesByIds(ids));
}
/**
* 禁用
*/
@Log(title = "常用功能收藏夹", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{id}")
public AjaxResult disable(@PathVariable String id) {
TUserFavorites favorites = new TUserFavorites();
favorites.setId(id);
favorites.setStatus("1"); // state=1 表示禁用
return toAjax(favoritesMapper.updateById(favorites));
}
/**
* 启用
*/
@Log(title = "常用功能收藏夹", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{id}")
public AjaxResult enable(@PathVariable String id) {
TUserFavorites favorites = new TUserFavorites();
favorites.setId(id);
favorites.setStatus("0");// state=1 表示启用
return toAjax(favoritesMapper.updateById(favorites));
}
/**
* 修改状态
*/
@Log(title = "常用功能收藏夹", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TUserFavorites tUserFavorites) {
return toAjax(tUserFavoritesService.updateStatus(tUserFavorites));
}
}

View File

@ -0,0 +1,247 @@
package com.zbf.web.controller.system;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.github.pagehelper.util.StringUtil;
import com.zbf.common.core.domain.TreeSelect;
import com.zbf.common.core.domain.entity.SysDept;
import com.zbf.common.core.domain.entity.SysUser;
import com.zbf.system.domain.TMiStock;
import com.zbf.system.service.ISysDeptService;
import com.zbf.system.service.ISysUserService;
import com.zbf.web.controller.section.EnhanceDataList;
import org.apache.commons.lang3.ObjectUtils;
import org.dom4j.util.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.enums.BusinessType;
import com.zbf.system.domain.TckOrderdetailBak;
import com.zbf.system.service.ITckOrderdetailBakService;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.common.core.page.TableDataInfo;
/**
* 出库物料明细Controller
*
* @author tony
* @date 2024-09-09
*/
@RestController
@RequestMapping("/system/tckOrderDetailbak")
public class TckOrderdetailBakController extends BaseController
{
@Autowired
private ITckOrderdetailBakService tckOrderdetailBakService;
@Autowired
private ISysDeptService sysDeptService;
@Autowired
private ISysUserService sysUserService;
/**
* 查询出库物料明细列表
*/
@GetMapping("/list")
@EnhanceDataList(entityType = TckOrderdetailBak.class)
public TableDataInfo list(TckOrderdetailBak tckOrderdetailBak)
{
startPage();
if (tckOrderdetailBak.getDate()!=null){
String[] date = tckOrderdetailBak.getDate();
tckOrderdetailBak.setStartTime(date[0]);
tckOrderdetailBak.setEndTime(date[1]);
}
if(StringUtil.isNotEmpty(tckOrderdetailBak.getSupplier())){
//查找该部门下对应的子部门
SysDept sysDept = new SysDept();
sysDept.setDeptName(tckOrderdetailBak.getSupplier());
List<SysDept> sysDepts = sysDeptService.selectDeptList(sysDept);
String deptId = String.valueOf(sysDepts.get(0).getDeptId());
List<SysDept> treeSelects = sysDeptService.selectDeptList(new SysDept());
List<SysDept> collect = treeSelects.stream()
.filter(f -> Arrays.asList(f.getAncestors().split(",")).contains(String.valueOf(deptId))
|| f.getDeptId() == sysDepts.get(0).getDeptId() )
.collect(Collectors.toList());
Long[] ids = collect.stream()
.map(SysDept::getDeptId) // 提取 ID
.toArray(Long[]::new);
//查询该部门下的所有员工
List<SysUser> sysUsers = sysUserService.selectUserByDeptIds(ids);
String[] nickName = sysUsers.stream().map(SysUser::getNickName).toArray(String[]::new);
if(StringUtil.isNotEmpty(tckOrderdetailBak.getApplicant())){
if (Arrays.asList(nickName).contains(tckOrderdetailBak.getApplicant())) {
// 包含
return getDataTable(tckOrderdetailBakService.selectTckOrderdetailBakList(tckOrderdetailBak));
}else{
TckOrderdetailBak tckOrderdetailBak1 = new TckOrderdetailBak();
tckOrderdetailBak1.setApplicant("不存在");
return getDataTable(tckOrderdetailBakService.selectTckOrderdetailBakList(tckOrderdetailBak1));
}
}
List<TckOrderdetailBak> list = tckOrderdetailBakService.selectTckOrderdetailBakList(new TckOrderdetailBak());
//查找表中符合的员工对应的数据
List<TckOrderdetailBak> filteredList = list.stream()
.filter(f -> StringUtil.isNotEmpty(f.getApplicant())&&
Arrays.stream(nickName)
.anyMatch(n -> f.getApplicant().contains(n)))
.collect(Collectors.toList());
return getDataTable(filteredList);
}else{
List<TckOrderdetailBak> list = tckOrderdetailBakService.selectTckOrderdetailBakList(tckOrderdetailBak);
for (TckOrderdetailBak t : list) {
SysUser sysUser = new SysUser();
sysUser.setNickName(t.getApplicant());
List<SysUser> sysUsers = sysUserService.selectUserList(sysUser);
if(ObjectUtils.isEmpty(sysUsers)){
t.setSupplier("");
}else{
Long deptId = sysUsers.get(0).getDeptId();
SysDept sysDept = new SysDept();
sysDept.setDeptId(deptId);
List<SysDept> sysDepts = sysDeptService.selectDeptList(sysDept);
if(ObjectUtils.isEmpty(sysDepts)){
t.setSupplier("");
}else{
SysDept sysDept1 = sysDepts.get(0);
if(sysDept1.getAncestors().split(",").length>3){
String s = sysDept1.getAncestors().split(",")[2];
sysDept.setDeptId(Long.valueOf(s));
List<SysDept> sysDepts1 = sysDeptService.selectDeptList(sysDept);
t.setSupplier(sysDepts1.get(0).getDeptName());
}else{
t.setSupplier(sysDept1.getDeptName());
}
}
}
}
return getDataTable(list);
}
}
// @GetMapping("/supplier")
// @EnhanceDataList(entityType = TckOrderdetailBak.class)
// public TableDataInfo supplier()
// {
// TckOrderdetailBak tckOrderdetailBak = new TckOrderdetailBak();
// List<TckOrderdetailBak> list = tckOrderdetailBakService.selectTckOrderdetailBakList(tckOrderdetailBak);
// return getDataTable(list);
// }
@GetMapping("/lists")
@EnhanceDataList(entityType = TMiStock.class)
public AjaxResult lists(TckOrderdetailBak tckOrderdetailBak) {
if (tckOrderdetailBak.getDate()!=null){
String[] date = tckOrderdetailBak.getDate();
tckOrderdetailBak.setStartTime(date[0]);
tckOrderdetailBak.setEndTime(date[1]);
}
List<TckOrderdetailBak> list = tckOrderdetailBakService.select(tckOrderdetailBak);
return AjaxResult.success(list);
}
/**
* 导出出库物料明细列表
*/
// @PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:export')")
@Log(title = "出库物料明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TckOrderdetailBak tckOrderdetailBak)
{
List<TckOrderdetailBak> list = tckOrderdetailBakService.selectTckOrderdetailBakList(tckOrderdetailBak);
ExcelUtil<TckOrderdetailBak> util = new ExcelUtil<TckOrderdetailBak>(TckOrderdetailBak.class);
util.exportExcel(response, list, "出库物料明细数据");
}
/**
* 获取出库物料明细详细信息
*/
@PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tckOrderdetailBakService.selectTckOrderdetailBakById(id));
}
/**
* 新增出库物料明细
*/
@PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:add')")
@Log(title = "出库物料明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TckOrderdetailBak tckOrderdetailBak)
{
return toAjax(tckOrderdetailBakService.insertTckOrderdetailBak(tckOrderdetailBak));
}
/**
* 修改出库物料明细
*/
@PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:edit')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TckOrderdetailBak tckOrderdetailBak)
{
return toAjax(tckOrderdetailBakService.updateTckOrderdetailBak(tckOrderdetailBak));
}
/**
* 删除出库物料明细
*/
@PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:remove')")
@Log(title = "出库物料明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tckOrderdetailBakService.deleteTckOrderdetailBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:remove')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tckOrderdetailBakService.disabledTckOrderdetailBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:edit')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tckOrderdetailBakService.enableTckOrderdetailBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:tckOrderDetailbak:edit')")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TckOrderdetailBak tckOrderdetailBak) {
return toAjax(tckOrderdetailBakService.updateStatus(tckOrderdetailBak));
}
}

View File

@ -0,0 +1,155 @@
package com.zbf.web.controller.system;
import com.alibaba.druid.util.StringUtils;
import com.zbf.common.annotation.Log;
import com.zbf.common.core.controller.BaseController;
import com.zbf.common.core.domain.AjaxResult;
import com.zbf.common.core.page.TableDataInfo;
import com.zbf.common.enums.BusinessType;
import com.zbf.common.utils.poi.ExcelUtil;
import com.zbf.system.domain.TckOrderdetailBak;
import com.zbf.system.domain.TckOrdersBak;
import com.zbf.system.service.ITckOrdersBakService;
import com.zbf.web.controller.section.EnhanceDataList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 出库单历史表Controller
*
* @author tony
* @date 2024-07-03
*/
@RestController
@RequestMapping("/system/tckOrdersbak")
public class TckOrdersBakController extends BaseController
{
@Autowired
private ITckOrdersBakService tckOrdersBakService;
/**
* 查询出库单历史表列表
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:list')")
@EnhanceDataList(entityType = TckOrdersBak.class)
@GetMapping("/list")
public TableDataInfo list(TckOrdersBak tckOrdersBak)
{
startPage();
List<TckOrdersBak> list = tckOrdersBakService.selectTckOrdersBakList(tckOrdersBak);
return getDataTable(list);
}
/* *
* 查询出库单历史表列表(退库入库)*/
@EnhanceDataList(entityType = TckOrdersBak.class)
@GetMapping("/selectList")
public TableDataInfo ckOrders(TckOrderdetailBak tckOrderdetailBak)
{
startPage();
if(!StringUtils.isEmpty(tckOrderdetailBak.getStartDate())) {
tckOrderdetailBak.setStartDate(tckOrderdetailBak.getStartDate() + " 00:00:00");
}
if(!StringUtils.isEmpty(tckOrderdetailBak.getEndDate())) {
tckOrderdetailBak.setEndDate(tckOrderdetailBak.getEndDate() + " 23:59:59");
}
List<TckOrderdetailBak> list = tckOrdersBakService.selectReturnTckOrdersBakList(tckOrderdetailBak);
return getDataTable(list);
}
/**
* 导出出库单历史表列表
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:export')")
@Log(title = "出库单历史表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TckOrdersBak tckOrdersBak)
{
List<TckOrdersBak> list = tckOrdersBakService.selectTckOrdersBakList(tckOrdersBak);
ExcelUtil<TckOrdersBak> util = new ExcelUtil<TckOrdersBak>(TckOrdersBak.class);
util.exportExcel(response, list, "出库单历史表数据");
}
/**
* 获取出库单历史表详细信息
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tckOrdersBakService.selectTckOrdersBakById(id));
}
/**
* 新增出库单历史表
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:add')")
@Log(title = "出库单历史表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TckOrdersBak tckOrdersBak)
{
return toAjax(tckOrdersBakService.insertTckOrdersBak(tckOrdersBak));
}
/**
* 修改出库单历史表
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:edit')")
@Log(title = "出库单历史表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TckOrdersBak tckOrdersBak)
{
return toAjax(tckOrdersBakService.updateTckOrdersBak(tckOrdersBak));
}
/**
* 删除出库单历史表
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:remove')")
@Log(title = "出库单历史表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tckOrdersBakService.deleteTckOrdersBakByIds(ids));
}
/**
* 启用
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:remove')")
@Log(title = "出库单历史表", businessType = BusinessType.UPDATE)
@DeleteMapping("/disable/{ids}")
public AjaxResult disable(@PathVariable String[] ids)
{
return toAjax(tckOrdersBakService.disabledTckOrdersBakByIds(ids));
}
/**
* 禁用
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:edit')")
@Log(title = "出库单历史表", businessType = BusinessType.UPDATE)
@DeleteMapping("/enable/{ids}")
public AjaxResult enable(@PathVariable String[] ids)
{
return toAjax(tckOrdersBakService.enableTckOrdersBakByIds(ids));
}
/**
* 修改状态
*/
@PreAuthorize("@ss.hasPermi('system:tckOrdersbak:edit')")
@Log(title = "出库单历史表", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody TckOrdersBak tckOrdersBak) {
return toAjax(tckOrdersBakService.updateStatus(tckOrdersBak));
}
}

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