初版作成

This commit is contained in:
梁州 2024-08-21 10:13:04 +08:00
parent c3712997b6
commit 5a3ac10c72
1809 changed files with 444854 additions and 2 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

21
.idea/compiler.xml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="wms-framework" />
<module name="wms-quartz" />
<module name="wms-admin" />
<module name="wms-generator" />
<module name="wms-system" />
<module name="wms-business" />
<module name="wms-common" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="8" />
</component>
</project>

22
.idea/encodings.xml Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-admin/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-admin/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-admin/src/main/resources/templates/business/goodsReport/goodReport.html" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-business/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-business/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-framework/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-framework/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-generator/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-generator/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-quartz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-quartz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-system/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wms-system/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<Languages>
<language minSize="338" name="Java" />
</Languages>
</inspection_tool>
</profile>
</component>

30
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="public" />
<option name="name" value="aliyun nexus" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://maven.aliyun.com/repository/central" />
</remote-repository>
</component>
</project>

17
.idea/misc.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$/wms-admin" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="corretto-1.8 (2)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

14
.idea/modules.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/wms-admin/wms-admin.iml" filepath="$PROJECT_DIR$/wms-admin/wms-admin.iml" />
<module fileurl="file://$PROJECT_DIR$/wms-business/wms-business.iml" filepath="$PROJECT_DIR$/wms-business/wms-business.iml" />
<module fileurl="file://$PROJECT_DIR$/wms-common/wms-common.iml" filepath="$PROJECT_DIR$/wms-common/wms-common.iml" />
<module fileurl="file://$PROJECT_DIR$/wms-framework/wms-framework.iml" filepath="$PROJECT_DIR$/wms-framework/wms-framework.iml" />
<module fileurl="file://$PROJECT_DIR$/wms-generator/wms-generator.iml" filepath="$PROJECT_DIR$/wms-generator/wms-generator.iml" />
<module fileurl="file://$PROJECT_DIR$/wms-quartz/wms-quartz.iml" filepath="$PROJECT_DIR$/wms-quartz/wms-quartz.iml" />
<module fileurl="file://$PROJECT_DIR$/wms-system/wms-system.iml" filepath="$PROJECT_DIR$/wms-system/wms-system.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2018 RuoYi
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

35
README-WMS.md Normal file
View File

@ -0,0 +1,35 @@
<p align="center">
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-dd77653d7c9f197dd9d93684f3c8dcfbab6.png">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v4.7.3</h1>
<h4 align="center">基于SpringBoot开发的轻量级Java快速开发框架</h4>
<p align="center">
<a href="https://gitee.com/y_project/RuoYi/stargazers"><img src="https://gitee.com/y_project/RuoYi/badge/star.svg?theme=gvp"></a>
<a href="https://gitee.com/y_project/RuoYi"><img src="https://img.shields.io/badge/RuoYi-v4.7.3-brightgreen.svg"></a>
<a href="https://gitee.com/y_project/RuoYi/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p>
## 平台简介
本系统是基于若依开源平台开发的仓库管理系统,提供现代化仓储一站式服务。
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存查询,删除、清空等操作。
17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。

36
README.en.md Normal file
View File

@ -0,0 +1,36 @@
# SmartWms
#### Description
wms仓库管理平台 若依版
#### 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/)

103
README.md
View File

@ -1,3 +1,102 @@
# wms_snN7pp_nantong
<p align="center">
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-dd77653d7c9f197dd9d93684f3c8dcfbab6.png">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v4.7.3</h1>
<h4 align="center">基于SpringBoot开发的轻量级Java快速开发框架</h4>
<p align="center">
<a href="https://gitee.com/y_project/RuoYi/stargazers"><img src="https://gitee.com/y_project/RuoYi/badge/star.svg?theme=gvp"></a>
<a href="https://gitee.com/y_project/RuoYi"><img src="https://img.shields.io/badge/RuoYi-v4.7.3-brightgreen.svg"></a>
<a href="https://gitee.com/y_project/RuoYi/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p>
南通深南N7PP
## 平台简介
一直想做一款后台管理系统看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序如网站管理后台网站会员中心CMSCRMOA。所有前端后台代码封装过后十分精简易上手出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
性别男,若依是给女儿取的名字(寓意:你若不离不弃,我必生死相依)
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前后端分离版本,请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 感谢 [hplus](https://gitee.com/hplus_admin/hplus) 后台主题 UI 框架。
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)&nbsp;&nbsp;
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)&nbsp;&nbsp;
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存查询,删除、清空等操作。
17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://ruoyi.vip
文档地址http://doc.ruoyi.vip
## 演示图
<table>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-42e518aa72a24d228427a1261cb3679f395.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-7f20dd0edba25e5187c5c4dd3ec7d3d9797.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-2dae3d87f6a8ca05057db059cd9a411d51d.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-ea4d98423471e55fba784694e45d12bd4bb.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-7f6c6e9f5873efca09bd2870ee8468b8fce.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-c708b65f2c382a03f69fe1efa8d341e6cff.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-9ab586c47dd5c7b92bca0d727962c90e3b8.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-ef954122a2080e02013112db21754b955c6.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-088edb4d531e122415a1e2342bccb1a9691.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-f886fe19bd820c0efae82f680223cac196c.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-c7a2eb71fa65d6e660294b4bccca613d638.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-e60137fb0787defe613bd83331dc4755a70.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-7c51c1b5758f0a0f92ed3c60469b7526f9f.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-15181aed45bb2461aa97b594cbf2f86ea5f.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-83326ad52ea63f67233d126226738054d98.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-3bd6d31e913b70df00107db51d64ef81df7.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-70a2225836bc82042a6785edf6299e2586a.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-0184d6ab01fdc6667a14327fcaf8b46345d.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-64d8086dc2c02c8f71170290482f7640098.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
</tr>
</table>
## 若依交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-1389287-blue.svg)](https://jq.qq.com/?_wv=1027&k=5HBAaYN) [![加入QQ群](https://img.shields.io/badge/已满-1679294-blue.svg)](https://jq.qq.com/?_wv=1027&k=5cHeRVW) [![加入QQ群](https://img.shields.io/badge/已满-1529866-blue.svg)](https://jq.qq.com/?_wv=1027&k=53R0L5Z) [![加入QQ群](https://img.shields.io/badge/已满-1772718-blue.svg)](https://jq.qq.com/?_wv=1027&k=5g75dCU) [![加入QQ群](https://img.shields.io/badge/已满-1366522-blue.svg)](https://jq.qq.com/?_wv=1027&k=58cPoHA) [![加入QQ群](https://img.shields.io/badge/已满-1382251-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb) [![加入QQ群](https://img.shields.io/badge/已满-1145125-blue.svg)](https://jq.qq.com/?_wv=1027&k=5yugASz) [![加入QQ群](https://img.shields.io/badge/已满-86752435-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Rf3d2P) [![加入QQ群](https://img.shields.io/badge/已满-134072510-blue.svg)](https://jq.qq.com/?_wv=1027&k=5ZIjaeP) [![加入QQ群](https://img.shields.io/badge/已满-210336300-blue.svg)](https://jq.qq.com/?_wv=1027&k=5CJw1jY) [![加入QQ群](https://img.shields.io/badge/已满-339522636-blue.svg)](https://jq.qq.com/?_wv=1027&k=5omzbKc) [![加入QQ群](https://img.shields.io/badge/已满-130035985-blue.svg)](https://jq.qq.com/?_wv=1027&k=qPIKBb7s) [![加入QQ群](https://img.shields.io/badge/已满-143151071-blue.svg)](https://jq.qq.com/?_wv=1027&k=4NsjKbtU) [![加入QQ群](https://img.shields.io/badge/已满-158781320-blue.svg)](https://jq.qq.com/?_wv=1027&k=VD2pkz2G) [![加入QQ群](https://img.shields.io/badge/已满-201531282-blue.svg)](https://jq.qq.com/?_wv=1027&k=HlshFwkJ) [![加入QQ群](https://img.shields.io/badge/已满-101526938-blue.svg)](https://jq.qq.com/?_wv=1027&k=0ARRrO9V) [![加入QQ群](https://img.shields.io/badge/已满-264355400-blue.svg)](https://jq.qq.com/?_wv=1027&k=up9k3ZXJ) [![加入QQ群](https://img.shields.io/badge/已满-298522656-blue.svg)](https://jq.qq.com/?_wv=1027&k=540WfdEr) [![加入QQ群](https://img.shields.io/badge/139845794-blue.svg)](https://jq.qq.com/?_wv=1027&k=ss91fC4t)

12
SmartWms.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

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,89 @@
若依系统开发环境搭建手册
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:80/
若能正确展示登录页面,并能成功登录,登录后菜单及页面展示正常,则表明环境搭建成功。
默认密码为 admin/admin123
演示地址http://ruoyi.vip
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 停止
演示地址ruoyi.vip
文档地址doc.ruoyi.vip

299
pom.xml Normal file
View File

@ -0,0 +1,299 @@
<?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.wms</groupId>
<artifactId>wms</artifactId>
<!--<version>4.7.3</version>-->
<version>1.0.0</version>
<name>SmartWms</name>
<url>http://www.ruoyi.vip</url>
<description>智能仓库管理系统 </description>
<properties>
<wms.version>1.0.0</wms.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>
<shiro.version>1.9.0</shiro.version>
<thymeleaf.extras.shiro.version>2.1.0</thymeleaf.extras.shiro.version>
<druid.version>1.2.8</druid.version>
<bitwalker.version>1.21</bitwalker.version>
<kaptcha.version>2.3.2</kaptcha.version>
<swagger.version>3.0.0</swagger.version>
<mybatis.version>3.5.8</mybatis.version>
<mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
<mybatis-plus-spring-boot.version>3.5.1</mybatis-plus-spring-boot.version>
<mybatis-spring-boot-autoconfigure.version>2.2.2</mybatis-spring-boot-autoconfigure.version>
<pagehelper.boot.version>1.4.1</pagehelper.boot.version>
<fastjson.version>1.2.80</fastjson.version>
<oshi.version>6.1.2</oshi.version>
<jna.version>5.10.0</jna.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version>
<poi.version>4.1.2</poi.version>
<velocity.version>2.3</velocity.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.5.13</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>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<!-- Shiro核心框架 -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<!-- Shiro使用Spring框架 -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<!-- Shiro使用EhCache缓存框架 -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>${shiro.version}</version>
</dependency>
<!-- thymeleaf模板引擎和shiro框架的整合 -->
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>${thymeleaf.extras.shiro.version}</version>
</dependency>
<!-- 解析客户端操作系统、浏览器等 -->
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>${bitwalker.version}</version>
</dependency>
<!-- SpringBoot集成mybatis框架 -->
<!--<dependency>-->
<!--<groupId>org.mybatis.spring.boot</groupId>-->
<!--<artifactId>mybatis-spring-boot-starter</artifactId>-->
<!--<version>${mybatis-spring-boot.version}</version>-->
<!--</dependency>-->
<!-- SpringBoot集成mybatis-plus框架 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus-spring-boot.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.mybatis</groupId>-->
<!--<artifactId>mybatis</artifactId>-->
<!--<version>${mybatis.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-autoconfigure</artifactId>
<version>${mybatis-spring-boot-autoconfigure.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>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>${jna.version}</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>${jna.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>
<!-- 文件上传工具类 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons.fileupload.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</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-quartz</artifactId>
<version>${wms.version}</version>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-generator</artifactId>
<version>${wms.version}</version>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-framework</artifactId>
<version>${wms.version}</version>
</dependency>
<!-- 系统模块-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-system</artifactId>
<version>${wms.version}</version>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-common</artifactId>
<version>${wms.version}</version>
</dependency>
<!--wms业务-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-business</artifactId>
<version>${wms.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>wms-admin</module>
<module>wms-framework</module>
<module>wms-system</module>
<module>wms-quartz</module>
<module>wms-generator</module>
<module>wms-common</module>
<module>wms-business</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

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;

2890
sql/ruoyi.html Normal file

File diff suppressed because it is too large Load Diff

4851
sql/ruoyi.pdm Normal file

File diff suppressed because it is too large Load Diff

713
sql/ry_20210924.sql Normal file
View File

@ -0,0 +1,713 @@
-- ----------------------------
-- 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',
login_name varchar(30) not null comment '登录账号',
user_name varchar(30) default '' comment '用户昵称',
user_type varchar(2) default '00' comment '用户类型00系统用户 01注册用户',
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(50) default '' comment '密码',
salt varchar(20) 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 '最后登录时间',
pwd_update_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', '', '29c67a30398638269fe600f73a054934', '111111', '0', '0', '127.0.0.1', sysdate(), sysdate(), 'admin', sysdate(), '', null, '管理员');
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '8e6d98b90472783cc73c17047ddccf36', '222222', '0', '0', '127.0.0.1', sysdate(), 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本部门及以下数据权限',
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, '0', '0', 'admin', sysdate(), '', null, '超级管理员');
insert into sys_role values('2', '普通角色', 'common', 2, 2, '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 '显示顺序',
url varchar(200) default '#' comment '请求地址',
target varchar(20) default '' comment '打开方式menuItem页签 menuBlank新窗口',
menu_type char(1) default '' comment '菜单类型M目录 C菜单 F按钮',
visible char(1) default 0 comment '菜单状态0显示 1隐藏',
is_refresh char(1) default 1 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', '#', '', 'M', '0', '1', '', 'fa fa-gear', 'admin', sysdate(), '', null, '系统管理目录');
insert into sys_menu values('2', '系统监控', '0', '2', '#', '', 'M', '0', '1', '', 'fa fa-video-camera', 'admin', sysdate(), '', null, '系统监控目录');
insert into sys_menu values('3', '系统工具', '0', '3', '#', '', 'M', '0', '1', '', 'fa fa-bars', 'admin', sysdate(), '', null, '系统工具目录');
insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', 'menuBlank', 'C', '0', '1', '', 'fa fa-location-arrow', 'admin', sysdate(), '', null, '若依官网地址');
-- 二级菜单
insert into sys_menu values('100', '用户管理', '1', '1', '/system/user', '', 'C', '0', '1', 'system:user:view', 'fa fa-user-o', 'admin', sysdate(), '', null, '用户管理菜单');
insert into sys_menu values('101', '角色管理', '1', '2', '/system/role', '', 'C', '0', '1', 'system:role:view', 'fa fa-user-secret', 'admin', sysdate(), '', null, '角色管理菜单');
insert into sys_menu values('102', '菜单管理', '1', '3', '/system/menu', '', 'C', '0', '1', 'system:menu:view', 'fa fa-th-list', 'admin', sysdate(), '', null, '菜单管理菜单');
insert into sys_menu values('103', '部门管理', '1', '4', '/system/dept', '', 'C', '0', '1', 'system:dept:view', 'fa fa-outdent', 'admin', sysdate(), '', null, '部门管理菜单');
insert into sys_menu values('104', '岗位管理', '1', '5', '/system/post', '', 'C', '0', '1', 'system:post:view', 'fa fa-address-card-o', 'admin', sysdate(), '', null, '岗位管理菜单');
insert into sys_menu values('105', '字典管理', '1', '6', '/system/dict', '', 'C', '0', '1', 'system:dict:view', 'fa fa-bookmark-o', 'admin', sysdate(), '', null, '字典管理菜单');
insert into sys_menu values('106', '参数设置', '1', '7', '/system/config', '', 'C', '0', '1', 'system:config:view', 'fa fa-sun-o', 'admin', sysdate(), '', null, '参数设置菜单');
insert into sys_menu values('107', '通知公告', '1', '8', '/system/notice', '', 'C', '0', '1', 'system:notice:view', 'fa fa-bullhorn', 'admin', sysdate(), '', null, '通知公告菜单');
insert into sys_menu values('108', '日志管理', '1', '9', '#', '', 'M', '0', '1', '', 'fa fa-pencil-square-o', 'admin', sysdate(), '', null, '日志管理菜单');
insert into sys_menu values('109', '在线用户', '2', '1', '/monitor/online', '', 'C', '0', '1', 'monitor:online:view', 'fa fa-user-circle', 'admin', sysdate(), '', null, '在线用户菜单');
insert into sys_menu values('110', '定时任务', '2', '2', '/monitor/job', '', 'C', '0', '1', 'monitor:job:view', 'fa fa-tasks', 'admin', sysdate(), '', null, '定时任务菜单');
insert into sys_menu values('111', '数据监控', '2', '3', '/monitor/data', '', 'C', '0', '1', 'monitor:data:view', 'fa fa-bug', 'admin', sysdate(), '', null, '数据监控菜单');
insert into sys_menu values('112', '服务监控', '2', '4', '/monitor/server', '', 'C', '0', '1', 'monitor:server:view', 'fa fa-server', 'admin', sysdate(), '', null, '服务监控菜单');
insert into sys_menu values('113', '缓存监控', '2', '5', '/monitor/cache', '', 'C', '0', '1', 'monitor:cache:view', 'fa fa-cube', 'admin', sysdate(), '', null, '缓存监控菜单');
insert into sys_menu values('114', '表单构建', '3', '1', '/tool/build', '', 'C', '0', '1', 'tool:build:view', 'fa fa-wpforms', 'admin', sysdate(), '', null, '表单构建菜单');
insert into sys_menu values('115', '代码生成', '3', '2', '/tool/gen', '', 'C', '0', '1', 'tool:gen:view', 'fa fa-code', 'admin', sysdate(), '', null, '代码生成菜单');
insert into sys_menu values('116', '系统接口', '3', '3', '/tool/swagger', '', 'C', '0', '1', 'tool:swagger:view', 'fa fa-gg', 'admin', sysdate(), '', null, '系统接口菜单');
-- 三级菜单
insert into sys_menu values('500', '操作日志', '108', '1', '/monitor/operlog', '', 'C', '0', '1', 'monitor:operlog:view', 'fa fa-address-book', 'admin', sysdate(), '', null, '操作日志菜单');
insert into sys_menu values('501', '登录日志', '108', '2', '/monitor/logininfor', '', 'C', '0', '1', 'monitor:logininfor:view', 'fa fa-file-image-o', 'admin', sysdate(), '', null, '登录日志菜单');
-- 用户管理按钮
insert into sys_menu values('1000', '用户查询', '100', '1', '#', '', 'F', '0', '1', 'system:user:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1001', '用户新增', '100', '2', '#', '', 'F', '0', '1', 'system:user:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1002', '用户修改', '100', '3', '#', '', 'F', '0', '1', 'system:user:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1003', '用户删除', '100', '4', '#', '', 'F', '0', '1', 'system:user:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1004', '用户导出', '100', '5', '#', '', 'F', '0', '1', 'system:user:export', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1005', '用户导入', '100', '6', '#', '', 'F', '0', '1', 'system:user:import', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1006', '重置密码', '100', '7', '#', '', 'F', '0', '1', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, '');
-- 角色管理按钮
insert into sys_menu values('1007', '角色查询', '101', '1', '#', '', 'F', '0', '1', 'system:role:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1008', '角色新增', '101', '2', '#', '', 'F', '0', '1', 'system:role:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1009', '角色修改', '101', '3', '#', '', 'F', '0', '1', 'system:role:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1010', '角色删除', '101', '4', '#', '', 'F', '0', '1', 'system:role:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1011', '角色导出', '101', '5', '#', '', 'F', '0', '1', 'system:role:export', '#', 'admin', sysdate(), '', null, '');
-- 菜单管理按钮
insert into sys_menu values('1012', '菜单查询', '102', '1', '#', '', 'F', '0', '1', 'system:menu:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1013', '菜单新增', '102', '2', '#', '', 'F', '0', '1', 'system:menu:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1014', '菜单修改', '102', '3', '#', '', 'F', '0', '1', 'system:menu:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1015', '菜单删除', '102', '4', '#', '', 'F', '0', '1', 'system:menu:remove', '#', 'admin', sysdate(), '', null, '');
-- 部门管理按钮
insert into sys_menu values('1016', '部门查询', '103', '1', '#', '', 'F', '0', '1', 'system:dept:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1017', '部门新增', '103', '2', '#', '', 'F', '0', '1', 'system:dept:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1018', '部门修改', '103', '3', '#', '', 'F', '0', '1', 'system:dept:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1019', '部门删除', '103', '4', '#', '', 'F', '0', '1', 'system:dept:remove', '#', 'admin', sysdate(), '', null, '');
-- 岗位管理按钮
insert into sys_menu values('1020', '岗位查询', '104', '1', '#', '', 'F', '0', '1', 'system:post:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1021', '岗位新增', '104', '2', '#', '', 'F', '0', '1', 'system:post:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1022', '岗位修改', '104', '3', '#', '', 'F', '0', '1', 'system:post:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1023', '岗位删除', '104', '4', '#', '', 'F', '0', '1', 'system:post:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1024', '岗位导出', '104', '5', '#', '', 'F', '0', '1', 'system:post:export', '#', 'admin', sysdate(), '', null, '');
-- 字典管理按钮
insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', 'F', '0', '1', 'system:dict:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', 'F', '0', '1', 'system:dict:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', 'F', '0', '1', 'system:dict:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', 'F', '0', '1', 'system:dict:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', 'F', '0', '1', 'system:dict:export', '#', 'admin', sysdate(), '', null, '');
-- 参数设置按钮
insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', 'F', '0', '1', 'system:config:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', 'F', '0', '1', 'system:config:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', 'F', '0', '1', 'system:config:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', 'F', '0', '1', 'system:config:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', 'F', '0', '1', 'system:config:export', '#', 'admin', sysdate(), '', null, '');
-- 通知公告按钮
insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', 'F', '0', '1', 'system:notice:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', 'F', '0', '1', 'system:notice:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', 'F', '0', '1', 'system:notice:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', 'F', '0', '1', 'system:notice:remove', '#', 'admin', sysdate(), '', null, '');
-- 操作日志按钮
insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', 'F', '0', '1', 'monitor:operlog:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', 'F', '0', '1', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1041', '详细信息', '500', '3', '#', '', 'F', '0', '1', 'monitor:operlog:detail', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1042', '日志导出', '500', '4', '#', '', 'F', '0', '1', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, '');
-- 登录日志按钮
insert into sys_menu values('1043', '登录查询', '501', '1', '#', '', 'F', '0', '1', 'monitor:logininfor:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1044', '登录删除', '501', '2', '#', '', 'F', '0', '1', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1045', '日志导出', '501', '3', '#', '', 'F', '0', '1', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1046', '账户解锁', '501', '4', '#', '', 'F', '0', '1', 'monitor:logininfor:unlock', '#', 'admin', sysdate(), '', null, '');
-- 在线用户按钮
insert into sys_menu values('1047', '在线查询', '109', '1', '#', '', 'F', '0', '1', 'monitor:online:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1048', '批量强退', '109', '2', '#', '', 'F', '0', '1', 'monitor:online:batchForceLogout', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1049', '单条强退', '109', '3', '#', '', 'F', '0', '1', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, '');
-- 定时任务按钮
insert into sys_menu values('1050', '任务查询', '110', '1', '#', '', 'F', '0', '1', 'monitor:job:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1051', '任务新增', '110', '2', '#', '', 'F', '0', '1', 'monitor:job:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1052', '任务修改', '110', '3', '#', '', 'F', '0', '1', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1053', '任务删除', '110', '4', '#', '', 'F', '0', '1', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1054', '状态修改', '110', '5', '#', '', 'F', '0', '1', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1055', '任务详细', '110', '6', '#', '', 'F', '0', '1', 'monitor:job:detail', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1056', '任务导出', '110', '7', '#', '', 'F', '0', '1', 'monitor:job:export', '#', 'admin', sysdate(), '', null, '');
-- 代码生成按钮
insert into sys_menu values('1057', '生成查询', '115', '1', '#', '', 'F', '0', '1', 'tool:gen:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1058', '生成修改', '115', '2', '#', '', 'F', '0', '1', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1059', '生成删除', '115', '3', '#', '', 'F', '0', '1', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1060', '预览代码', '115', '4', '#', '', 'F', '0', '1', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('1061', '生成代码', '115', '5', '#', '', 'F', '0', '1', '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', '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');
insert into sys_role_menu values ('2', '1061');
-- ----------------------------
-- 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 '操作时间',
primary key (oper_id)
) 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深蓝主题theme-blue');
insert into sys_config values(4, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能true开启false关闭');
insert into sys_config values(5, '用户管理-密码字符范围', 'sys.account.chrtype', '0', 'Y', 'admin', sysdate(), '', null, '默认任意字符范围0任意密码可以输入任意字符1数字密码只能为0-9数字2英文字母密码只能为a-z和A-Z字母3字母和数字密码必须包含字母数字,4字母数字和特殊字符目前支持的特殊字符包括~!@#$%^&*()-=_+');
insert into sys_config values(6, '用户管理-初始密码修改策略', 'sys.account.initPasswordModify', '0', 'Y', 'admin', sysdate(), '', null, '0初始密码修改策略关闭没有任何提示1提醒用户如果未修改初始密码则在登录时就会提醒修改密码对话框');
insert into sys_config values(7, '用户管理-账号密码更新周期', 'sys.account.passwordValidateDays', '0', 'Y', 'admin', sysdate(), '', null, '密码更新周期填写数字数据初始化值为0不限制若修改必须为大于0小于365的正整数如果超过这个周期登录系统时则在登录时就会提醒修改密码对话框');
insert into sys_config values(8, '主框架页-菜单导航显示风格', 'sys.index.menuStyle', 'default', 'Y', 'admin', sysdate(), '', null, '菜单导航显示风格default为左侧导航菜单topnav为顶部导航菜单');
insert into sys_config values(9, '主框架页-是否开启页脚', 'sys.index.footer', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启底部页脚显示true显示false隐藏');
insert into sys_config values(10, '主框架页-是否开启页签', 'sys.index.tagsView', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启菜单多页签显示true显示false隐藏');
-- ----------------------------
-- 14、系统访问记录
-- ----------------------------
drop table if exists sys_logininfor;
create table sys_logininfor (
info_id bigint(20) not null auto_increment comment '访问ID',
login_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)
) engine=innodb auto_increment=100 comment = '系统访问记录';
-- ----------------------------
-- 15、在线用户记录
-- ----------------------------
drop table if exists sys_user_online;
create table sys_user_online (
sessionId varchar(50) default '' comment '用户会话id',
login_name varchar(50) default '' comment '登录账号',
dept_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 varchar(10) default '' comment '在线状态on_line在线off_line离线',
start_timestamp datetime comment 'session创建时间',
last_access_time datetime comment 'session最后访问时间',
expire_time int(5) default 0 comment '超时时间,单位为分钟',
primary key (sessionId)
) engine=innodb comment = '在线用户记录';
-- ----------------------------
-- 16、定时任务调度表
-- ----------------------------
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, '');
-- ----------------------------
-- 17、定时任务调度日志表
-- ----------------------------
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 = '定时任务调度日志表';
-- ----------------------------
-- 18、通知公告表
-- ----------------------------
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 varchar(2000) 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, '管理员');
-- ----------------------------
-- 19、代码生成业务表
-- ----------------------------
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树表操作 sub主子表操作',
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 = '代码生成业务表';
-- ----------------------------
-- 20、代码生成业务表字段
-- ----------------------------
drop table if exists gen_table_column;
create table gen_table_column (
column_id bigint(20) not null auto_increment comment '编号',
table_id varchar(64) 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 = '代码生成业务表字段';

144
wms-admin/pom.xml Normal file
View File

@ -0,0 +1,144 @@
<?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>wms</artifactId>
<groupId>com.wms</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<artifactId>wms-admin</artifactId>
<description>
前端管理服务
</description>
<dependencies>
<!-- SpringBoot集成thymeleaf模板 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- 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.wms</groupId>
<artifactId>wms-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-generator</artifactId>
</dependency>
<!--wms业务模块-->
<dependency>
<groupId>com.wms</groupId>
<artifactId>wms-business</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.14</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</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.0.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
<!-- YUI Compressor (CSS/JS压缩)
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<jswarn>false</jswarn>
<nosuffix>true</nosuffix>
<linebreakpos>50000</linebreakpos>
<sourceDirectory>src/main/resources/static</sourceDirectory>
<force>true</force>
<includes>
<include>**/*.js</include>
<include>**/*.css</include>
</includes>
<excludes>
<exclude>**/*.min.js</exclude>
<exclude>**/*.min.css</exclude>
<exclude>**/fileinput.js</exclude>
<exclude>**/bootstrap-table/**</exclude>
</excludes>
</configuration>
</plugin> -->
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

View File

@ -0,0 +1,32 @@
package com.ruoyi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableTransactionManagement
public class RuoYiApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ WMS 系统启动 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

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

View File

@ -0,0 +1,192 @@
package com.ruoyi.web.controller.business;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.business.domain.TEbsRecord;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITEbsRecordService;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.business.utils.EbsUtils;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.web.service.DictService;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 在线检验不合格Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/comingInspection")
public class ComingInspectionController extends BaseController {
private String prefix = "business/comingInspection";
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ITEbsRecordService tEbsRecordService;
@Autowired
private ISysConfigService configService;
@Autowired
private DictService dict;
@RequiresPermissions("business:comingInspection:view")
@GetMapping()
public String stock(ModelMap mmap) throws Exception {
mmap.put("tMiStock", new TMiStock());
return prefix + "/comingInspection";
}
/**
* 查询
*/
@RequiresPermissions("business:comingInspection:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TMiStock tMiStock)
{
startPage();
tMiStock.setSts(dict.getType("stock_sts").get(5).getDictValue());
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
return getDataTable(list);
}
/**
* 更改物料状态
*
* @param locationIds
* @return
*/
@Log(title = "更改物料状态", businessType = BusinessType.UPDATE)
@RequiresPermissions("business:comingInspection:edit")
@PostMapping("/stsChange")
@ResponseBody
public AjaxResult stsChange(String locationIds) throws Exception {
// 查找对应库存
String[] locations = StringUtils.split(locationIds.trim(), ",");
TMiStock stockForQuery = new TMiStock();
stockForQuery.setSts("5");
for (int i = 0; i < locations.length; i++) {
stockForQuery.setLocationId(locations[i]);
List<TMiStock> list = tMiStockService.selectStock(stockForQuery);
if (list.size() < 1) {
return error("当前库位无待检库存");
}
// 更改库存状态同时转移子库存至合格库
TMiStock stock = list.get(0);
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(stock,
list.get(0).getWhseloc(),
"121-108"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stock.getGoodsId(), stock.getGoodsName(), stock.getProduclotid(), stock.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stock.getGoodsId(), stock.getGoodsName(), stock.getProduclotid(), stock.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stock.getGoodsId(), stock.getGoodsName(), stock.getProduclotid(), stock.getShelvesNum()));
return error("无转移子库存的物料");
}
JSONObject resultJsonWmsSubInvProc = (JSONObject) JSON.parseObject(resultWmsSubInvProc).get("obj");
List<JSONObject> dataWmsSubInvProc = JSON.parseArray(resultJsonWmsSubInvProc.getString("rows"), JSONObject.class);
if (!dataWmsSubInvProc.get(0).getString("processStatus").equals("PROCESSING")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stock.getGoodsId(), stock.getGoodsName(), stock.getProduclotid(), stock.getShelvesNum()));
return error(dataWmsSubInvProc.get(0).getString("errorMsg"));
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", stock.getGoodsId(), stock.getGoodsName(), stock.getProduclotid(), stock.getShelvesNum()));
stock.setSts(dict.getType("stock_sts").get(0).getDictValue());
stock.setWhseloc("121-108");
// 更新本地库存
if (tMiStockService.updateTMiStock(stock) < 1) {
return error("更新库存失败");
}
}
return success("来料检验成功");
}
/**
* 创建参数Json子库存转移
* @return
*/
public JSONObject createJsonWmsSubInvProc(TMiStock wmsStock, String fromSubInventoryCode, String toSubInventoryCode) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "wmsSubInvProc");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "E");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("transTypeId", 2);
businessData.put("organizationId", configService.selectConfigByKey("organizationId"));
businessData.put("itemId", wmsStock.getGoodsTypeid());
businessData.put("quantity", wmsStock.getShelvesNum());
businessData.put("subInventory", fromSubInventoryCode);
businessData.put("locatorId", EbsUtils.LOCATOR_AREA_MAP.get(fromSubInventoryCode));
businessData.put("transDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
businessData.put("transUom", wmsStock.getGoodsMeasureId());
businessData.put("transSubInventory", toSubInventoryCode);
businessData.put("transLocatorId", EbsUtils.LOCATOR_AREA_MAP.get(toSubInventoryCode));
businessData.put("transLotNumber", wmsStock.getProduclotid());
businessData.put("sourceHeaderId", 1);
businessData.put("sourceLineId", 1);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
}

View File

@ -0,0 +1,576 @@
package com.ruoyi.web.controller.business;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.ruoyi.business.domain.EbsStock;
import com.ruoyi.business.domain.TBaseGoods;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITBaseGoodsService;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.business.utils.EbsUtils;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* EBS现有量
*
* @author 梁州
*/
@Controller
@RequestMapping("/business/ebsConfirm")
public class EbsConfirmController extends BaseController {
private String prefix = "business/ebsConfirm";
// 现有量记录报表导出用
List<EbsStock> ebsStockListForExport;
// 现有量记录报表导出用-按批次
List<EbsStock> ebsStockLotListForExport;
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ISysConfigService configService;
@Autowired
private ITBaseGoodsService goodsService;
/**
* EBS现有量界面
*
* @param mmap
* @return
*/
@RequiresPermissions("business:ebsConfirm:view")
@GetMapping("/ebsConfirm")
public String ebsConfirm(ModelMap mmap) {
mmap.put("ebsStock", new EbsStock());
return prefix + "/ebsConfirm";
}
/**
* EBS现有量界面按批次
*
* @param mmap
* @return
*/
@RequiresPermissions("business:ebsConfirm:view")
@GetMapping("/ebsConfirmLot")
public String ebsConfirmLot(ModelMap mmap) {
mmap.put("ebsStock", new EbsStock());
return prefix + "/ebsConfirmLot";
}
/**
* EBS现有量主界面
*/
@RequiresPermissions("business:ebsConfirm:list")
@Log(title = "查询EBS现有量", businessType = BusinessType.INSERT)
@PostMapping("/ebsConfirm/main")
@ResponseBody
public TableDataInfo ebsConfirmMain(EbsStock ebsStock) throws Exception {
TMiStock stockForQuery = new TMiStock();
stockForQuery.setGoodsId(ebsStock.getGoodsId());
stockForQuery.setWhseloc(ebsStock.getSubInventory());
// 库存信息
List<TMiStock> stockList = tMiStockService.selectTMiStockOutList(stockForQuery);
// EBS现有量查询结果
List<EbsStock> ebsStockList = new LinkedList<>();
if (stockList.size() < 1) {
return getDataTable(ebsStockList);
}
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
// 一起查询
String params = JSON.toJSONString(createJsonList(stockList, ebsStock.getSubInventory(), null));
String result = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), params, token.get("access_token").toString());
JSONObject resultJson = (JSONObject) JSON.parseObject(result).get("obj");
List<ExistingStock> datas = JSON.parseArray(resultJson.getString("rows"), ExistingStock.class);
// 生成现有量数据
for (TMiStock stock : stockList) {
// 插入的EBS现有量数据
EbsStock temp = new EbsStock();
// 查询结果返回的总量
int sum = 0;
for (ExistingStock existingStock : datas) {
if (stock.getGoodsId().equals(existingStock.getItemCode())) {
sum += existingStock.getTransactionQuantity();
}
}
// 设定EBS现有量的数据
temp.setGoodsId(stock.getGoodsId());
temp.setGoodsName(stock.getGoodsName());
temp.setSubInventory(ebsStock.getSubInventory());
temp.setEbsNum(BigDecimal.valueOf(sum));
temp.setWmsNum(stock.getShelvesNum());
if (BigDecimal.valueOf(sum).compareTo(stock.getShelvesNum()) != 0) {
temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
temp.setSts("0");
} else {
temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
temp.setSts("1");
}
ebsStockList.add(temp);
}
// 更新逻辑
// 1. 传参变化只传子库
// String params = JSON.toJSONString(createJsonGetAll(ebsStock.getSubInventory()));
// String result = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), params, token.get("access_token").toString());
// JSONObject resultJson = (JSONObject) JSON.parseObject(result).get("obj");
// List<ExistingStock> datas = JSON.parseArray(resultJson.getString("rows"), ExistingStock.class);
// // 根据本地中库存生成一次现有量数据
// for (TMiStock stock : stockList) {
// // 插入的EBS现有量数据
// EbsStock temp = new EbsStock();
// // 查询结果返回的总量
// int sum = 0;
// for (ExistingStock existingStock : datas) {
// if (stock.getGoodsId().equals(existingStock.getItemCode())) {
// sum += existingStock.getTransactionQuantity();
// }
// }
// // 设定EBS现有量的数据
// temp.setGoodsId(stock.getGoodsId());
// temp.setGoodsName(stock.getGoodsName());
// temp.setSubInventory(ebsStock.getSubInventory());
// temp.setEbsNum(BigDecimal.valueOf(sum));
// temp.setWmsNum(stock.getShelvesNum());
// if (BigDecimal.valueOf(sum).compareTo(stock.getShelvesNum()) != 0) {
// temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
// temp.setSts("0");
// } else {
// temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
// temp.setSts("1");
// }
// ebsStockList.add(temp);
// }
// // 将本地库存中不存在的数据添加进现有量列表
// for (ExistingStock existingStock : datas) {
// // 判断当前物料是否已经存在
// if (ebsStockList.stream().anyMatch(ebsStock1 -> ebsStock1.getGoodsId().equals(existingStock.getItemCode()))) {
// continue;
// }
// // 插入的EBS现有量数据
// EbsStock temp = new EbsStock();
// // 对不存在的库存数据进行处理
// int sum = 0;
// for (ExistingStock existingStock1 : datas) {
// if (existingStock.getItemCode().equals(existingStock1.getItemCode())) {
// sum += existingStock1.getTransactionQuantity();
// }
// }
// // 先查询物料表根据当前的物料编码
// TBaseGoods goodsTemp = goodsService.selectTBaseGoodsByGoodsId(existingStock.getItemCode());
// // 设定EBS现有量的数据
// temp.setGoodsId(existingStock.getItemCode());
// if (goodsTemp != null) {
// temp.setGoodsName(goodsTemp.getGoodsName());
// }
// temp.setSubInventory(existingStock.getSubinventoryCode());
// temp.setEbsNum(BigDecimal.valueOf(sum));
// temp.setWmsNum(BigDecimal.valueOf(0));
// temp.setDiffNum(BigDecimal.valueOf(sum));
// temp.setSts("0");
// ebsStockList.add(temp);
// }
// 将不平衡的放到前面
ebsStockList.sort(Comparator.comparing(EbsStock::getSts));
// 将当前查询出的现有量保存到导出缓存中
ebsStockListForExport = new ArrayList<>(ebsStockList);
logger.info("当前现有量数据:{}", JSON.toJSONString(ebsStockListForExport));
// 返回分页数据
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
TableDataInfo rspData = new TableDataInfo();
// 分页数据设置
rspData.setCode(0);
rspData.setRows(PageUtils.startPageByList(ebsStockList, pageNum, pageSize));
rspData.setTotal(new PageInfo(ebsStockList).getTotal());
return rspData;
}
/**
* EBS现有量按批次主界面
*/
@RequiresPermissions("business:ebsConfirm:list")
@Log(title = "查询EBS现有量按批次", businessType = BusinessType.INSERT)
@PostMapping("/ebsConfirmLot/main")
@ResponseBody
public TableDataInfo ebsConfirmLotMain(EbsStock ebsStock) throws Exception {
TMiStock stockForQuery = new TMiStock();
stockForQuery.setGoodsId(ebsStock.getGoodsId());
stockForQuery.setProduclotid(ebsStock.getLotNumber());
stockForQuery.setWhseloc(ebsStock.getSubInventory());
// 库存信息
List<TMiStock> stockList = tMiStockService.selectTMiStockOutListByLot(stockForQuery);
// EBS现有量查询结果
List<EbsStock> ebsStockList = new LinkedList<>();
if (stockList.size() < 1) {
return getDataTable(ebsStockList);
}
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
// 一起查询
String params = JSON.toJSONString(createJsonList(stockList, ebsStock.getSubInventory(), null));
String result = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), params, token.get("access_token").toString());
JSONObject resultJson = (JSONObject) JSON.parseObject(result).get("obj");
List<ExistingStock> datas = JSON.parseArray(resultJson.getString("rows"), ExistingStock.class);
// 生成现有量数据
for (TMiStock stock : stockList) {
// 插入的EBS现有量数据
EbsStock temp = new EbsStock();
// 查询结果返回的总量
int sum = 0;
for (ExistingStock existingStock : datas) {
if (stock.getGoodsId().equals(existingStock.getItemCode()) && stock.getProduclotid().equals(existingStock.getLotNumber())) {
sum += existingStock.getTransactionQuantity();
}
}
// 设定EBS现有量的数据
temp.setGoodsId(stock.getGoodsId());
temp.setGoodsName(stock.getGoodsName());
temp.setLotNumber(stock.getProduclotid());
temp.setSubInventory(ebsStock.getSubInventory());
temp.setEbsNum(BigDecimal.valueOf(sum));
temp.setWmsNum(stock.getShelvesNum());
if (BigDecimal.valueOf(sum).compareTo(stock.getShelvesNum()) != 0) {
temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
temp.setSts("0");
} else {
temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
temp.setSts("1");
}
ebsStockList.add(temp);
}
// 更新逻辑
// 1. 传参变化只传子库
// String params = JSON.toJSONString(createJsonGetAll(ebsStock.getSubInventory()));
// String result = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), params, token.get("access_token").toString());
// JSONObject resultJson = (JSONObject) JSON.parseObject(result).get("obj");
// List<ExistingStock> datas = JSON.parseArray(resultJson.getString("rows"), ExistingStock.class);
// // 根据本地中库存生成一次现有量数据
// for (TMiStock stock : stockList) {
// // 插入的EBS现有量数据
// EbsStock temp = new EbsStock();
// // 查询结果返回的总量
// int sum = 0;
// if (StringUtils.isEmpty(stock.getProduclotid())) {// 本地库存批次号为空
// for (ExistingStock existingStock : datas) {
// if (stock.getGoodsId().equals(existingStock.getItemCode())) {
// sum += existingStock.getTransactionQuantity();
// }
// }
// } else {
// for (ExistingStock existingStock : datas) {
// if (StringUtils.isEmpty(existingStock.getLotNumber())) {// 批次号为空
// continue;
// }
// if (stock.getGoodsId().equals(existingStock.getItemCode()) && stock.getProduclotid().equals(existingStock.getLotNumber())) {
// sum += existingStock.getTransactionQuantity();
// }
// }
// }
// // 设定EBS现有量的数据
// temp.setGoodsId(stock.getGoodsId());
// temp.setGoodsName(stock.getGoodsName());
// temp.setLotNumber(stock.getProduclotid());
// temp.setSubInventory(ebsStock.getSubInventory());
// temp.setEbsNum(BigDecimal.valueOf(sum));
// temp.setWmsNum(stock.getShelvesNum());
// if (BigDecimal.valueOf(sum).compareTo(stock.getShelvesNum()) != 0) {
// temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
// temp.setSts("0");
// } else {
// temp.setDiffNum(BigDecimal.valueOf(sum).subtract(stock.getShelvesNum()));
// temp.setSts("1");
// }
// ebsStockList.add(temp);
// }
// // 将本地库存中不存在的数据添加进现有量列表
// for (ExistingStock existingStock : datas) {
// if (StringUtils.isEmpty(existingStock.getLotNumber())) {
// continue;
// }
// // 判断当前物料是否已经存在
// if (ebsStockList.stream().anyMatch(ebsStock1 -> ebsStock1.getGoodsId().equals(existingStock.getItemCode()) && ebsStock1.getLotNumber().equals(existingStock.getLotNumber()))) {
// continue;
// }
// // 插入的EBS现有量数据
// EbsStock temp = new EbsStock();
// // 对不存在的库存数据进行处理
// int sum = 0;
// for (ExistingStock existingStock1 : datas) {
// if (existingStock.getItemCode().equals(existingStock1.getItemCode()) && existingStock.getLotNumber().equals(existingStock1.getLotNumber())) {
// sum += existingStock1.getTransactionQuantity();
// }
// }
// // 先查询物料表根据当前的物料编码
// TBaseGoods goodsTemp = goodsService.selectTBaseGoodsByGoodsId(existingStock.getItemCode());
// // 设定EBS现有量的数据
// temp.setGoodsId(existingStock.getItemCode());
// if (goodsTemp != null) {
// temp.setGoodsName(goodsTemp.getGoodsName());
// }
// temp.setLotNumber(existingStock.getLotNumber());
// temp.setSubInventory(existingStock.getSubinventoryCode());
// temp.setEbsNum(BigDecimal.valueOf(sum));
// temp.setWmsNum(BigDecimal.valueOf(0));
// temp.setDiffNum(BigDecimal.valueOf(sum));
// temp.setSts("0");
// ebsStockList.add(temp);
// }
// 将不平衡的放到前面
ebsStockList.sort(Comparator.comparing(EbsStock::getSts));
// 将当前查询出的现有量保存到导出缓存中
ebsStockLotListForExport = new ArrayList<>(ebsStockList);
logger.info("当前现有量数据(带批次){}", JSON.toJSONString(ebsStockLotListForExport));
// 返回分页数据
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(PageUtils.startPageByList(ebsStockList, pageNum, pageSize));
rspData.setTotal(new PageInfo(ebsStockList).getTotal());
return rspData;
}
/**
* 导出EBS现有量记录
*/
@RequiresPermissions("business:ebsConfirm:export")
@Log(title = "导出EBS现有量记录", businessType = BusinessType.EXPORT)
@PostMapping("/ebsConfirm/export")
@ResponseBody
public AjaxResult export() {
ExcelUtil<EbsStock> util = new ExcelUtil<EbsStock>(EbsStock.class);
return util.exportExcel(ebsStockListForExport, "EBS现有量");
}
/**
* 导出EBS现有量记录
*/
@RequiresPermissions("business:ebsConfirm:export")
@Log(title = "导出EBS现有量(按批次)记录", businessType = BusinessType.EXPORT)
@PostMapping("/ebsConfirmLot/export")
@ResponseBody
public AjaxResult exportLot() {
ExcelUtil<EbsStock> util = new ExcelUtil<EbsStock>(EbsStock.class);
return util.exportExcel(ebsStockLotListForExport, "EBS现有量按批次");
}
/**
* 创建参数Json
*
* @return
*/
public JSONObject createJsonGetAll(String subInventoryCode) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", OrderCodeFactory.getOrderCode("ebs", ""));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "getExistingStock");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("organizationId", configService.selectConfigByKey("organizationId"));
baseQueryParams.put("startPosition", 1);
baseQueryParams.put("rowsCnt", 2000);
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("itemCode", null);
businessData.put("subInventoryCode", subInventoryCode);
businessData.put("locatorId", EbsUtils.LOCATOR_AREA_MAP.get(subInventoryCode));
businessData.put("lotNumber", null);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
/**
* 创建参数Json
*
* @return
*/
public JSONObject createJsonList(List<TMiStock> stocks, String subInventoryCode, String locatorId) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "getExistingStock");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("organizationId", configService.selectConfigByKey("organizationId"));
baseQueryParams.put("startPosition", 1);
baseQueryParams.put("rowsCnt", 2000);
// 创建数据(一起查询)
JSONArray jsonArray = new JSONArray();
String itemCode = "";
String lotNumber = "";
for (int i = 0; i < stocks.size(); i++) {
if (i == 0) {
itemCode = stocks.get(i).getGoodsId();
if (StringUtils.isNotEmpty(stocks.get(i).getProduclotid())) {
lotNumber = stocks.get(i).getProduclotid();
}
} else {
itemCode += "," + stocks.get(i).getGoodsId();
if (StringUtils.isNotEmpty(stocks.get(i).getProduclotid())) {
lotNumber += "," + stocks.get(i).getProduclotid();
}
}
}
JSONObject businessData = new JSONObject();
businessData.put("itemCode", itemCode);
businessData.put("subInventoryCode", subInventoryCode);
businessData.put("locatorId", locatorId);
businessData.put("lotNumber", lotNumber);
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
static class ExistingStock {
public String getInventoryItemId() {
return inventoryItemId;
}
public void setInventoryItemId(String inventoryItemId) {
this.inventoryItemId = inventoryItemId;
}
public String getItemCode() {
return itemCode;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public String getLotNumber() {
return lotNumber;
}
public void setLotNumber(String lotNumber) {
this.lotNumber = lotNumber;
}
public String getSubinventoryCode() {
return subinventoryCode;
}
public void setSubinventoryCode(String subinventoryCode) {
this.subinventoryCode = subinventoryCode;
}
public String getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(String expirationDate) {
this.expirationDate = expirationDate;
}
public String getOriginationDate() {
return originationDate;
}
public void setOriginationDate(String originationDate) {
this.originationDate = originationDate;
}
public int getTransactionQuantity() {
return transactionQuantity;
}
public void setTransactionQuantity(int transactionQuantity) {
this.transactionQuantity = transactionQuantity;
}
public int getPnalQty() {
return pnalQty;
}
public void setPnalQty(int pnalQty) {
this.pnalQty = pnalQty;
}
public int getOrganizationId() {
return organizationId;
}
public void setOrganizationId(int organizationId) {
this.organizationId = organizationId;
}
private String inventoryItemId;
private String itemCode;
private String lotNumber;
private String subinventoryCode;
private String expirationDate;
private String originationDate;
private int transactionQuantity;
private int pnalQty;
private int organizationId;
}
}

View File

@ -0,0 +1,302 @@
package com.ruoyi.web.controller.business;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.business.domain.TCkOrderdetail;
import com.ruoyi.business.domain.TEbsRecord;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITEbsRecordService;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 库存Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/ebsReport")
public class EbsReportController extends BaseController {
private String prefix = "/business/ebsReport";
@Autowired
private ITEbsRecordService tEbsRecordService;
@Autowired
private ISysConfigService configService;
@RequiresPermissions("business:ebsReport:view")
@GetMapping()
public String ebsReport(ModelMap mmap) throws Exception {
// 查询账户别名出库的结果
TEbsRecord wmsOthersProcResForQuery = new TEbsRecord("wmsOthersProc", 2, configService.selectConfigByKey("ebs_ip"), "", "", "0", "账户别名发放", "", "", "" , null);
List<TEbsRecord> wmsOthersProcResList = tEbsRecordService.selectTEbsRecordList(wmsOthersProcResForQuery);
// 查询子库存转移的结果
TEbsRecord WmsSubInvProcResForQuery = new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"), "", "", "0", "子库存转移", "", "", "" , null);
List<TEbsRecord> WmsSubInvProcResList = tEbsRecordService.selectTEbsRecordList(WmsSubInvProcResForQuery);
if (wmsOthersProcResList.size() < 1 && WmsSubInvProcResList.size() < 1) {
return prefix + "/ebsReport";
}
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
// 账户别名发放结果查询
for (TEbsRecord wmsOthersProcRes : wmsOthersProcResList) {
JSONObject resultJsonWmsOthersProc = (JSONObject) JSON.parseObject(wmsOthersProcRes.getResult()).get("obj");
List<JSONObject> dataWmsOthersProc = JSON.parseArray(resultJsonWmsOthersProc.getString("rows"), JSONObject.class);
String requestId = dataWmsOthersProc.get(0).getString("requestId");
String lastUpdateDate = dataWmsOthersProc.get(0).getString("lastUpdateDate");
String paramGetOthersInf = JSON.toJSONString(createJsonGetOthersInf(requestId, lastUpdateDate));
String resultGetOthersInf = "";
try {
resultGetOthersInf = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramGetOthersInf, token.get("access_token").toString());
} catch (Exception e) {
// 接口调用失败
return prefix + "/ebsReport";
}
System.out.println(resultGetOthersInf);
JSONObject resultJsonGetOthersInf = (JSONObject) JSON.parseObject(resultGetOthersInf).get("obj");
List<JSONObject> dataGetOthersInf = JSON.parseArray(resultJsonGetOthersInf.getString("rows"), JSONObject.class);
if (dataGetOthersInf.size() > 0 && dataGetOthersInf.get(0).getString("processStatus").equals("SUCCESS")) {
// 更新账户别名发放结果
wmsOthersProcRes.setStatus("1");
wmsOthersProcRes.setResult(resultGetOthersInf);
tEbsRecordService.updateTEbsRecord(wmsOthersProcRes);
} else if (dataGetOthersInf.size() > 0 && dataGetOthersInf.get(0).getString("processStatus").equals("ERROR")) {
// 更新账户别名发放结果
wmsOthersProcRes.setStatus("-1");
wmsOthersProcRes.setResult(resultGetOthersInf);
tEbsRecordService.updateTEbsRecord(wmsOthersProcRes);
}
}
// 子库存转移结果查询
for (TEbsRecord WmsSubInvProcRes : WmsSubInvProcResList) {
JSONObject resultJsonWmsSubInvProc = (JSONObject) JSON.parseObject(WmsSubInvProcRes.getResult()).get("obj");
List<JSONObject> dataWmsSubInvProc = JSON.parseArray(resultJsonWmsSubInvProc.getString("rows"), JSONObject.class);
String requestId = dataWmsSubInvProc.get(0).getString("requestId");
String lastUpdateDate = dataWmsSubInvProc.get(0).getString("lastUpdateDate");
String paramGetSubinvInf = JSON.toJSONString(createJsonGetSubinvIntf(requestId, lastUpdateDate));
String resultGetSubinvInf = "";
try {
resultGetSubinvInf = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramGetSubinvInf, token.get("access_token").toString());
} catch (Exception e) {
// 接口调用失败
return prefix + "/ebsReport";
}
System.out.println(resultGetSubinvInf);
JSONObject resultJsonGetSubinvInf = (JSONObject) JSON.parseObject(resultGetSubinvInf).get("obj");
List<JSONObject> dataGetSubinvInf = JSON.parseArray(resultJsonGetSubinvInf.getString("rows"), JSONObject.class);
if (dataGetSubinvInf.size() > 0 && dataGetSubinvInf.get(0).getString("processStatus").equals("SUCCESS")) {
// 更新子库存转移
WmsSubInvProcRes.setStatus("1");
WmsSubInvProcRes.setResult(resultGetSubinvInf);
tEbsRecordService.updateTEbsRecord(WmsSubInvProcRes);
} else if (dataGetSubinvInf.size() > 0 && dataGetSubinvInf.get(0).getString("processStatus").equals("ERROR")) {
// 更新子库存转移
WmsSubInvProcRes.setStatus("-1");
WmsSubInvProcRes.setResult(resultGetSubinvInf);
tEbsRecordService.updateTEbsRecord(WmsSubInvProcRes);
}
}
return prefix + "/ebsReport";
}
@RequiresPermissions("business:ekpReport:view")
@GetMapping("/ekp")
public String ekpReport(ModelMap mmap) throws Exception {
return prefix + "/ekpReport";
}
/**
* 查询EBS接口记录
*/
@RequiresPermissions("business:ebsReport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TEbsRecord ebsRecord)
{
startPage();
// 子查询写入的ebs
ebsRecord.setApiId(2);
List<TEbsRecord> list = tEbsRecordService.selectTEbsRecordList(ebsRecord);
return getDataTable(list);
}
/**
* 查询ekp申报记录
*/
@RequiresPermissions("business:ekpReport:list")
@PostMapping("/ekp/list")
@ResponseBody
public TableDataInfo ekpList(TEbsRecord ebsRecord)
{
startPage();
// 子查询写入的ebs
ebsRecord.setApiId(3);
List<TEbsRecord> list = tEbsRecordService.selectTEbsRecordList(ebsRecord);
return getDataTable(list);
}
/**
* 导出ebs接口记录
*/
@RequiresPermissions("business:ebsReport:export")
@Log(title = "导出ebs接口记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TEbsRecord ebsRecord)
{
// 子查询写入的ebs
ebsRecord.setApiId(2);
List<TEbsRecord> list = tEbsRecordService.selectTEbsRecordList(ebsRecord);
ExcelUtil<TEbsRecord> util = new ExcelUtil<TEbsRecord>(TEbsRecord.class);
return util.exportExcel(list, "ebs接口记录表");
}
/**
* 导出ekp申报记录
*/
@RequiresPermissions("business:ekpReport:export")
@Log(title = "导出ekp申报记录", businessType = BusinessType.EXPORT)
@PostMapping("/ekp/export")
@ResponseBody
public AjaxResult ekpExport(TEbsRecord ebsRecord)
{
ebsRecord.setApiId(3);
List<TEbsRecord> list = tEbsRecordService.selectTEbsRecordList(ebsRecord);
ExcelUtil<TEbsRecord> util = new ExcelUtil<TEbsRecord>(TEbsRecord.class);
return util.exportExcel(list, "ekp申报记录");
}
/**
* 创建参数Json(子库存转移结果查询)
* @return
*/
public JSONObject createJsonGetSubinvIntf(String requestId, String lastUpdateDate) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "getSubinvIntf");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("lastUpdateDateF", lastUpdateDate);
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("requestId", requestId);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
/**
* 创建参数Json(账户别名发放结果查询)
* @return
*/
public JSONObject createJsonGetOthersInf(String requestId, String lastUpdateDate) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "getOthersIntf");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("lastUpdateDateF", lastUpdateDate);
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("requestId", requestId);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
/**
* 创建参数Json(EKP申报过期结果查询)
* @return
*/
public JSONObject createJsonGetEkpExpireItem(String fdId) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "WMS");
systemParams.put("sourceSystem", "WMS");
systemParams.put("targetSystem", "EKP");
systemParams.put("serviceName", "getEkpExpireItem");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("fdId", fdId);
businessData.put("itemNo", "");
businessData.put("lotNumber", "");
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
}

View File

@ -0,0 +1,144 @@
package com.ruoyi.web.controller.business;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.ITBaseHcService;
import com.ruoyi.business.service.ITOngoodsshelfService;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Controller
@RequestMapping("/business/emptyCtl")
public class EmptyCtlController extends BaseController {
private String prefix = "business/emptyCtl";
@Autowired
private ITBaseHcService tBaseHcService;
@Autowired
private ITOngoodsshelfService tOngoodsshelfService;
/**
* 空托调度
* @param mmap
* @return
*/
@RequiresPermissions("business:emptyCtl:view")
@GetMapping()
public String ebsConfirm(ModelMap mmap) {
mmap.put("hc", new TBaseHC());
return prefix + "/emptyCtlControl";
}
/**
* 查询缓存位列表
*/
@RequiresPermissions("business:emptyCtl:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TBaseHC tBaseHC)
{
startPage();
List<TBaseHC> list = tBaseHcService.list(new LambdaQueryWrapper<TBaseHC>()
.eq(StringUtils.isNotEmpty(tBaseHC.getAreaCode()), TBaseHC::getAreaCode, tBaseHC.getAreaCode()));
return getDataTable(list);
}
/**
* 选择移库库位
*/
@RequiresPermissions("business:emptyCtl:edit")
@GetMapping("/emptyCtlInputModal/{areaCode}")
public String selMoveLocation(@PathVariable("areaCode") String areaCode, ModelMap mmap)
{
mmap.put("areaCode", areaCode);
return prefix + "/emptyCtlInputModal";
}
/**
* 生成空托->缓存位任务
*/
@RequiresPermissions("business:emptyCtl:edit")
@Log(title = "生成空托->缓存位任务", businessType = BusinessType.UPDATE)
@PostMapping("/inEmptyCtl")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public AjaxResult inEmptyCtl(TBaseHC tBaseHC) {
if (tBaseHC == null || StringUtils.isEmpty(tBaseHC.getAreaCode())
|| StringUtils.isEmpty(tBaseHC.getLastCtl())) {
return error("参数缺少缓存位或托盘号。");
}
// 查询当前缓存位是否已经有任务
TOngoodsshelf query = new TOngoodsshelf();
query.setTasktype(String.valueOf(11));
query.setAgvbgn("D00591");
query.setAgvend(tBaseHC.getAreaCode());
List<TOngoodsshelf> oldTaskList = tOngoodsshelfService.selectTOngoodsshelfList(query);
if (oldTaskList != null && oldTaskList.size() > 0) {
return error("当前缓存位已有任务,请勿重复下发。");
}
// 生成任务
TOngoodsshelf newTask = new TOngoodsshelf();
newTask.setLotId(OrderCodeFactory.getOrderCode("INEMPTY", ""));
newTask.setTasktype(String.valueOf(11));
newTask.setInstatus("0");
newTask.setAgvbgn("D00591");
newTask.setAgvend(tBaseHC.getAreaCode());
int insertResult = tOngoodsshelfService.insertTOngoodsshelf(newTask);
if (insertResult > 0) {
return success("生成任务成功。");
} else {
return error("生成任务失败。");
}
}
/**
* 生成缓存位->月台任务
*/
@RequiresPermissions("business:emptyCtl:edit")
@Log(title = "生成缓存位->月台任务", businessType = BusinessType.UPDATE)
@PostMapping("/outEmptyCtl")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public AjaxResult outEmptyCtl(TBaseHC tBaseHC) {
if (tBaseHC == null || StringUtils.isEmpty(tBaseHC.getAreaCode())) {
return error("参数缺少缓存位。");
}
TOngoodsshelf query = new TOngoodsshelf();
query.setTasktype(String.valueOf(12));
query.setAgvbgn(tBaseHC.getAreaCode());
query.setAgvend("PPS02");
List<TOngoodsshelf> oldTaskList = tOngoodsshelfService.selectTOngoodsshelfList(query);
if (oldTaskList != null && oldTaskList.size() > 0) {
return error("当前缓存位已有任务,请勿重复下发。");
}
// 生成任务
TOngoodsshelf newTask = new TOngoodsshelf();
newTask.setLotId(OrderCodeFactory.getOrderCode("OUTEMPTY", ""));
newTask.setTasktype(String.valueOf(12));
newTask.setInstatus("0");
newTask.setAgvbgn(tBaseHC.getAreaCode());
newTask.setAgvend("PPS02");
int insertResult = tOngoodsshelfService.insertTOngoodsshelf(newTask);
if (insertResult > 0) {
return success("生成任务成功。");
} else {
return error("生成任务失败。");
}
}
}

View File

@ -0,0 +1,83 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import com.ruoyi.framework.web.service.DictService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 空托盘库存表Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/emptyReport")
public class EmptyStockController extends BaseController
{
private String prefix = "business/stockReport";
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private DictService dict;
@RequiresPermissions("business:emptyReport:view")
@GetMapping()
public String stock(ModelMap mmap)
{
mmap.put("tMiStock", new TMiStock());
return prefix + "/emptyReport";
}
/**
* 查询空托盘库存
*/
@RequiresPermissions("business:emptyReport:list")
@PostMapping("/empty")
@ResponseBody
public TableDataInfo empty(TMiStock tMiStock)
{
startPage();
List<TMiStock> list = tMiStockService.selectStockEmpty(tMiStock);
return getDataTable(list);
}
/**
* 导出库存列表
*/
@RequiresPermissions("business:emptyReport:export")
@Log(title = "空托盘库存表", businessType = BusinessType.EXPORT)
@PostMapping("/emptyExport")
@ResponseBody
public AjaxResult emptyExport(TMiStock tMiStock)
{
List<TMiStock> list = tMiStockService.selectStockEmpty(tMiStock);
ExcelUtil<TMiStock> util = new ExcelUtil<TMiStock>(TMiStock.class);
return util.exportExcel(list, "空托盘库存表");
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
}

View File

@ -0,0 +1,113 @@
package com.ruoyi.web.controller.business;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.DictService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 库存Controller
*
* @author wms
* @date 2022-07-26
*/
@Controller
@RequestMapping("/business/goodsReport")
public class GoodReportController extends BaseController {
private String prefix = "business/goodsReport";
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private DictService dict;
@RequiresPermissions("business:goodsReport:view")
@GetMapping()
public String goodReport(ModelMap mmap)
{
mmap.put("tMiStock", new TMiStock());
return prefix + "/goodReport";
}
/**
* 查询库存列表
*/
@RequiresPermissions("business:goodsReport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TMiStock tMiStock)
{
startPage();
// tMiStock.setSts(dict.getType("stock_sts").get(0).getDictValue());
List<TMiStock> list = tMiStockService.selectTMiStockOutList(tMiStock);
return getDataTable(list);
}
/**
* 导出库存列表
*/
@RequiresPermissions("business:goodsReport:export")
@Log(title = "库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TMiStock tMiStock)
{
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
ExcelUtil<TMiStock> util = new ExcelUtil<TMiStock>(TMiStock.class);
return util.exportExcel(list, "库存数据");
}
/**
* 新增库存
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/stockModal";
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
/**
* 根据状态筛选库存数据
*/
@PostMapping("/filter/{sts}")
@ResponseBody
public TableDataInfo filter(@PathVariable("sts") String sts)
{
startPage();
TMiStock tMiStock = new TMiStock();
tMiStock.setSts(sts);
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
return getDataTable(list);
}
}

View File

@ -0,0 +1,122 @@
package com.ruoyi.web.controller.business;
import com.ruoyi.business.domain.TCkPickingwavegoods;
import com.ruoyi.business.domain.TConveyorStatus;
import com.ruoyi.business.service.ITCkPickingwavegoodsService;
import com.ruoyi.business.service.ITConveyorStatusService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 报废管理Controller
*
* @author hw
* @date 2022-06-25
*/
@Controller
@RequestMapping("/business/goodsScrap")
public class GoodsScrapController extends BaseController
{
private String prefix = "business/goodsScrap";
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
@Autowired
private ITConveyorStatusService itConveyorStatusService;
@RequiresPermissions("business:goodsScrap:view")
@GetMapping()
public String goodsScrapInit(ModelMap mmap)
{
// 获取当前用户
SysUser sysUser = ShiroUtils.getCurrentUser();
TConveyorStatus tConveyorStatus = new TConveyorStatus();
// 用户登录IP
tConveyorStatus.setPcip(ShiroUtils.getIp());
List<TConveyorStatus> tConveyorStatusList = itConveyorStatusService.selectTConveyorStatusList(tConveyorStatus);
if (tConveyorStatusList != null && tConveyorStatusList.size() > 0) {
tConveyorStatus = tConveyorStatusList.get(0);
// 获取用户登录的站台号
sysUser.setOutStand(tConveyorStatus.getConveryorId());
}
mmap.put("sysUser", sysUser);
return prefix + "/goodsScrap";
}
/**
* 查询出库物料明细列表
*/
@RequiresPermissions("business:goodsScrap:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TCkPickingwavegoods tCkPickingwavegoods)
{
startPage();
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return getDataTable(list);
}
/**
* 修改出库任务
*/
@RequiresPermissions("business:pickingwavegoods:edit")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PostMapping("/updateResult")
@ResponseBody
public AjaxResult updateResult(TCkPickingwavegoods tCkPickingwavegoods)
{
return toAjax(tCkPickingwavegoodsService.updateGoodsOutResult(tCkPickingwavegoods));
}
/**
* 判断站台上的空托盘是否为空如果不为空根据托盘号获取出库任务信息
*/
@RequiresPermissions("business:pickingwavegoods:edit")
@GetMapping("/queryByCtl")
@ResponseBody
public AjaxResult queryByCtl()
{
TConveyorStatus tConveyorStatus = new TConveyorStatus();
// 用户登录IP
SysUser sysUser = ShiroUtils.getCurrentUser();
tConveyorStatus.setPcip(ShiroUtils.getIp());
List<TConveyorStatus> tConveyorStatusList = itConveyorStatusService.selectTConveyorStatusList(tConveyorStatus);
if (tConveyorStatusList != null && tConveyorStatusList.size() > 0) {
tConveyorStatus = tConveyorStatusList.get(0);
// 判断当前站台上的托盘是否为空不为空时根据托盘获取出库任务数据
if (StringUtils.isNotEmpty(tConveyorStatus.getBarcode())) {
TCkPickingwavegoods tCkPickingwavegoods = new TCkPickingwavegoods();
// 托盘号
tCkPickingwavegoods.setCtl(tConveyorStatus.getBarcode());
// 状态
tCkPickingwavegoods.setOutstatus("0");
// 站台号
tCkPickingwavegoods.setOutstand(tConveyorStatus.getConveryorId());
// 获取任务列表
List<TCkPickingwavegoods> tCkPickingwavegoodsList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (tCkPickingwavegoodsList != null && tCkPickingwavegoodsList.size() > 0) {
return success(tCkPickingwavegoodsList.get(0));
}
}
}
return null;
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import com.ruoyi.business.domain.TInspectReport;
import com.ruoyi.business.service.ITInspectReportService;
import com.ruoyi.framework.web.service.DictService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 检验记录报表Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/inspectReport")
public class InspectReportController extends BaseController
{
private String prefix = "business/inspectReport";
@Autowired
private ITInspectReportService tInspectReportService;
@Autowired
private DictService dict;
@RequiresPermissions("business:inspectReport:view")
@GetMapping()
public String stock(ModelMap mmap)
{
mmap.put("tInspectReport", new TInspectReport());
return prefix + "/inspectReportMain";
}
/**
* 查询检验记录报表
*/
@RequiresPermissions("business:inspectReport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo empty(TInspectReport tInspectReport)
{
startPage();
List<TInspectReport> list = tInspectReportService.selectTInspectReportList(tInspectReport);
return getDataTable(list);
}
/**
* 导出检验记录报表
*/
@RequiresPermissions("business:inspectReport:export")
@Log(title = "导出检验记录表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult emptyExport(TInspectReport tInspectReport)
{
List<TInspectReport> list = tInspectReportService.selectTInspectReportList(tInspectReport);
ExcelUtil<TInspectReport> util = new ExcelUtil<TInspectReport>(TInspectReport.class);
return util.exportExcel(list, "检验记录报表");
}
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.web.controller.business;
import com.ruoyi.business.domain.TBaseStorageAreaLocation;
import com.ruoyi.business.domain.TOngoodsshelf;
import com.ruoyi.business.domain.Task;
import com.ruoyi.business.service.ITBaseStorageAreaLocationService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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;
@Controller
@RequestMapping("/business/locationMonitor")
public class LocationController extends BaseController {
private String prefix = "business/locationMonitor";
@Autowired
private ITBaseStorageAreaLocationService locationService;
@RequiresPermissions("business:locationMonitor:view")
@GetMapping()
public String locationMonitor(ModelMap mmap)
{
mmap.put("locationMonitor", new TBaseStorageAreaLocation());
return prefix + "/locationMonitor";
}
/**
* 查询库位列表
*/
@RequiresPermissions("business:locationMonitor:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TBaseStorageAreaLocation location)
{
startPage();
return getDataTable(locationService.selectTBaseStorageAreaLocationList(location));
}
/**
* 是否锁定库位
*/
@Log(title = "是否锁定库位", businessType = BusinessType.UPDATE)
@PostMapping("/lockLocation")
@ResponseBody
@RequiresPermissions("business:locationMonitor:update")
public AjaxResult lockLocation(TBaseStorageAreaLocation location) {
try {
TBaseStorageAreaLocation currentLocation = locationService.selectTBaseStorageAreaLocationByLocationId(location.getLocationId());
if (currentLocation != null && StringUtils.isNotEmpty(location.getIslock())) {
currentLocation.setIslock(location.getIslock());
locationService.updateTBaseStorageAreaLocation(currentLocation);
}
} catch (Exception e) {
return error("-1");
}
return success("1");
}
/**
* 是否占用库位
*/
@Log(title = "是否占用库位", businessType = BusinessType.UPDATE)
@PostMapping("/occupyLocation")
@ResponseBody
@RequiresPermissions("business:locationMonitor:update")
public AjaxResult occupyLocation(TBaseStorageAreaLocation location) {
try {
TBaseStorageAreaLocation currentLocation = locationService.selectTBaseStorageAreaLocationByLocationId(location.getLocationId());
if (currentLocation != null && StringUtils.isNotEmpty(location.getStatus())) {
currentLocation.setStatus(location.getStatus());
locationService.updateTBaseStorageAreaLocation(currentLocation);
}
} catch (Exception e) {
return error("-1");
}
return success("1");
}
}

View File

@ -0,0 +1,556 @@
package com.ruoyi.web.controller.business;
import java.math.BigDecimal;
import java.util.*;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.framework.web.service.DictService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Mes出库任务控制类
*
* @author liangzhou
* @date 2022-09-29
*/
@Controller
@RequestMapping("/business/mesManage")
public class MesTaskManageController extends BaseController {
private String prefix = "business/mesManage";
@Autowired
private ITConveyorStatusService tConveyorStatusService;
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
@Autowired
private ITConveyorStatusService itConveyorStatusService;
@Autowired
private ITCkOrderdetailService tCkOrderdetailService;
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private IVehicleService vehicleService;
@Autowired
private IOrderManageService orderManageService;
@Autowired
private ITCkPicktaskService tCkPicktaskService;
@Autowired
private DictService dict;
/**
* 工单出库界面
*
* @param mmap
* @return
*/
@RequiresPermissions("business:orderTask:view")
@GetMapping("/orderTaskOut")
public String orderTaskOut(ModelMap mmap) {
// 获取当前用户
SysUser sysUser = ShiroUtils.getCurrentUser();
TConveyorStatus tConveyorStatus = new TConveyorStatus();
// 用户登录IP
tConveyorStatus.setPcip(ShiroUtils.getIp());
sysUser.setLoginIp(ShiroUtils.getIp());
List<TConveyorStatus> tConveyorStatusList = itConveyorStatusService.selectTConveyorStatusList(tConveyorStatus);
if (tConveyorStatusList != null && tConveyorStatusList.size() > 0) {
tConveyorStatus = tConveyorStatusList.get(0);
// 获取用户登录的站台号
sysUser.setOutStand(tConveyorStatus.getConveryorId());
}
mmap.put("sysUser", sysUser);
mmap.put("orderManage", new OrderManage());
return prefix + "/orderTaskOut";
}
/**
* 工单出库界面详情
*/
@RequiresPermissions("business:orderTask:list")
@PostMapping("/orderTaskOut/main")
@ResponseBody
public TableDataInfo taskOutMain(TCkPickingwavegoods tCkPickingwavegoods) {
startPage();
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return getDataTable(list);
}
/**
* 工单出库任务执行
*/
@RequiresPermissions("business:orderTask:add")
@Log(title = "工单出库", businessType = BusinessType.INSERT)
@PostMapping("/orderTaskOut/updateTask")
@ResponseBody
public AjaxResult updateTask(TCkOrderdetail tCkOrderdetail) {
// 检查当前站台是否有正在出库的任务
TCkPickingwavegoods tCkPickingwavegoods = new TCkPickingwavegoods();
tCkPickingwavegoods.setOutstand(tCkOrderdetail.getOutStand());
List<TCkPickingwavegoods> outTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (outTaskList.size() > 0) {
return success("-2");
}
// 更新未选择则默认选择第一条
OrderManage orderManageForSel = new OrderManage();
orderManageForSel.setGoodsId(tCkOrderdetail.getGoodId());
orderManageForSel.setStatus("0");
List<OrderManage> mesTaskList = orderManageService.selectOrderListForOut(orderManageForSel);
if (mesTaskList.size() < 0) {
// 返回无任务
return success("-3");
}
// start 检查当前库存是否充足(只查合格品)
TMiStock tMiStock = new TMiStock();
tMiStock.setGoodsId(mesTaskList.get(0).getGoodsId());
tMiStock.setSts("0");
List<TMiStock> list = tMiStockService.selectTMiStockOutList(tMiStock);
if (list.size() > 0) {
if (list.get(0).getShelvesNum().compareTo(mesTaskList.get(0).getWaitNum()) >= 0) {// 库存充足
TCkOrderdetail tCkOrderdetailForOut = new TCkOrderdetail();
tCkOrderdetailForOut.setGoodId(mesTaskList.get(0).getGoodsId());
tCkOrderdetailForOut.setOutStand(tCkOrderdetail.getOutStand());
tCkOrderdetailForOut.setPickNum(mesTaskList.get(0).getWaitNum());
tCkOrderdetailForOut.setCkId(OrderCodeFactory.getOrderCode("CK", ""));
tCkOrderdetailForOut.setCkType("4");
tCkOrderdetailForOut.setStatus("0");
tCkOrderdetailForOut.setAddtime(new Date());
// 用户名为MES
tCkOrderdetailForOut.setUserName("MES");
return toAjax(tCkOrderdetailService.insertTCkOrderdetail(tCkOrderdetailForOut));
} else {// 库存不足
return success("0");
}
}
// end 检查当前库存是否充足
return success("-1");
}
/**
* 工单拣选
*/
@RequiresPermissions("business:orderTask:add")
@Log(title = "工单拣选出库", businessType = BusinessType.INSERT)
@PostMapping("/orderTaskOut/checkOut")
@ResponseBody
public AjaxResult orderCheckOut(TCkPickingwavegoods tCkPickingwavegoods) {
// 查询当前操作工单
OrderManage orderManageForUpdate = orderManageService.selectOrderManageByOrderId(tCkPickingwavegoods.getOutId());
// 插入任务成功同时更新当前的工单信息并且导出下一条待出库工单
if (orderManageForUpdate.getWaitNum().compareTo(tCkPickingwavegoods.getPickingNum()) < 0) {// 发料数量不够
// 更新已发数量
orderManageForUpdate.setFinishNum(orderManageForUpdate.getFinishNum().add(tCkPickingwavegoods.getPickingNum()));
// 更新待发数量
orderManageForUpdate.setWaitNum(orderManageForUpdate.getWaitNum().subtract(tCkPickingwavegoods.getPickingNum()));
// 更新当前出库任务信息为可回库
tCkPickingwavegoods.setOutstatus("3");
List<TCkPickingwavegoods> waitForScanTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (waitForScanTaskList.size() < 1) {
return error("0");
}
TCkPickingwavegoods scanTask = waitForScanTaskList.get(0);
scanTask.setOutstatus("4");
if (tCkPickingwavegoodsService.updateScanGoodsResult(scanTask) < 1) {
return error("-2");
}
} else {
// 更新已发数量
orderManageForUpdate.setFinishNum(orderManageForUpdate.getNeedNum());
// 更新待发数量
orderManageForUpdate.setWaitNum(BigDecimal.ZERO);
// 状态置为完成
orderManageForUpdate.setStatus("1");
// 插入任务
if (!createPickTask(tCkPickingwavegoods)) {
return error("-2");
}
}
if (orderManageService.updateOrderManage(orderManageForUpdate) > 0) {
// 获取下一条工单
return success(orderManageService.selectNextOrder(tCkPickingwavegoods.getGoodId()));
} else {
// 更新当前出库任务信息为可回库
tCkPickingwavegoods.setOutstatus("3");
List<TCkPickingwavegoods> waitForScanTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (waitForScanTaskList.size() < 1) {
return error("0");
}
TCkPickingwavegoods scanTask = waitForScanTaskList.get(0);
scanTask.setOutstatus("4");
if (tCkPickingwavegoodsService.updateScanGoodsResult(scanTask) < 1) {
return error("-2");
}
}
return success();
}
/**
* 结束本次发料
*/
@RequiresPermissions("business:orderTask:add")
@Log(title = "结束本次发料", businessType = BusinessType.INSERT)
@PostMapping("/orderTaskOut/endGoodsOut")
@ResponseBody
public AjaxResult endGoodsOut(TCkPickingwavegoods tCkPickingwavegoods) {
// 更新当前出库任务信息为可回库
tCkPickingwavegoods.setOutstatus("3");
List<TCkPickingwavegoods> waitForScanTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (waitForScanTaskList.size() < 1) {
return success("0");
}
TCkPickingwavegoods scanTask = waitForScanTaskList.get(0);
scanTask.setOutstatus("4");
if (tCkPickingwavegoodsService.updateScanGoodsResult(scanTask) < 1) {
return success("-2");
}
return success("1");
}
/**
* 生成一个工单任务
*
* @param tCkPickingwavegoods
* @return
*/
private boolean createPickTask(TCkPickingwavegoods tCkPickingwavegoods) {
TCkPicktask tCkPicktask = new TCkPicktask();
// 任务号
tCkPicktask.setTaskid(OrderCodeFactory.getOrderCode("CK", ""));
// 任务类型
tCkPicktask.setTaskType(2);
// 起始站台号
tCkPicktask.setOrigin(Objects.equals(tCkPickingwavegoods.getOutstand(), "1001") ? "306" : "406");
// 托盘号
Vehicle vehicle_sel = new Vehicle();
vehicle_sel.setStandId(Objects.equals(tCkPickingwavegoods.getOutstand(), "1001") ? "305" : "405");
vehicle_sel.setStatus("0");
List<Vehicle> vehicleSelList = vehicleService.selectVehicleList(vehicle_sel);
if (vehicleSelList.size() < 1) {
return false;
}
tCkPicktask.setVesselNo(vehicleSelList.get(0).getVehicleId());
// 任务状态
tCkPicktask.setTaskStatus(0);
// 创建时间
tCkPicktask.setCreateTime(new Date());
// 工单
tCkPicktask.setWipentity(tCkPickingwavegoods.getCustomermemberid());
// 物料编码
tCkPicktask.setGoodsId(tCkPickingwavegoods.getGoodId());
// 数量
tCkPicktask.setGoodsNum(tCkPickingwavegoods.getPickingNum());
// 批次号
tCkPicktask.setBatchNo(tCkPickingwavegoods.getProduclotid());
return tCkPicktaskService.insertTCkPicktask(tCkPicktask) > 0;
}
/**
* 弹框表格
*/
@GetMapping("/orderTaskOut/pickingTask")
public String pickingTask() {
return prefix + "/pickingTask";
}
/**
* 查询工单出库任务列表
*/
@RequiresPermissions("business:orderTask:list")
@PostMapping("/orderTaskOut/query")
@ResponseBody
public TableDataInfo pickingTaskQuery(OrderManage orderManage) {
startPage();
List<OrderManage> list = orderManageService.selectOrderListForOut(orderManage);
return getDataTable(list);
}
/**
* 工单管理界面
*
* @param mmap
* @return
*/
@RequiresPermissions("business:orderTaskManage:view")
@GetMapping("/orderTaskManage")
public String orderTaskManage(ModelMap mmap) {
mmap.put("orderManage", new OrderManage());
return prefix + "/orderTaskManage";
}
/**
* 工单管理界面详情
*/
@RequiresPermissions("business:orderTaskManage:list")
@PostMapping("/orderTaskManage/main")
@ResponseBody
public TableDataInfo taskMain(OrderManage orderManage) {
startPage();
List<OrderManage> list = orderManageService.selectOrderManageList(orderManage);
return getDataTable(list);
}
/**
* 更改工单顺序
*/
@RequiresPermissions("business:orderTaskManage:update")
@Log(title = "更改工单顺序", businessType = BusinessType.UPDATE)
@PostMapping("/orderTaskManage/reorder")
@ResponseBody
public AjaxResult reorder(OrderManage orderManage) {
// 查询需要调整的工单
OrderManage orM = orderManageService.selectOrderManageList(orderManage).get(0);
// 查询上一条工单
OrderManage preOrder = orderManageService.selectPreOrder(orM);
// 更新顺序
orderManage.setSortIndex(preOrder.getSortIndex());
return success(orderManageService.upOneOrder(orderManage) > 0 ? "1" : "0");
}
/**
* 工单取消
*
* @param orderIds
* @return
*/
@Log(title = "工单取消", businessType = BusinessType.UPDATE)
@RequiresPermissions("business:orderTaskManage:cancel")
@PostMapping("/orderTaskManage/cancelOrder")
@ResponseBody
public AjaxResult cancelOrder(String orderIds) {
// 取消工单
if (orderManageService.cancelOrdersByOrderIds(orderIds) > 0) {
return success();
}
return error();
}
/**
* 载具A界面
*
* @param mmap
* @return
*/
@RequiresPermissions("business:vehicle:view")
@GetMapping("/vehicleA")
public String vehicleA(ModelMap mmap) {
// 站台状态---是否启用
String switchA = "1";
TConveyorStatus status = new TConveyorStatus();
status.setConveryorId("1001");
List<TConveyorStatus> tConveyorStatuses = tConveyorStatusService.selectTConveyorStatusList(status);
if(tConveyorStatuses != null && tConveyorStatuses.size() > 0) {
switchA = tConveyorStatuses.get(0).getMovests();
}
mmap.put("switchA", switchA);
mmap.put("vehicleA", new Vehicle());
return prefix + "/vehicleA";
}
/**
* 查询载具A的详情
*/
@RequiresPermissions("business:vehicle:list")
@PostMapping("/vehicleA/vehicleInfo")
@ResponseBody
public TableDataInfo vehicleAInfo(Vehicle vehicleA) {
startPage();
vehicleA.setStandId("A");
List<Vehicle> list = vehicleService.selectVehicleList(vehicleA);
return getDataTable(list);
}
/**
* 载具A更改状态为已出库
*
* @param vehicleIds
* @return
*/
@Log(title = "更改载具状态", businessType = BusinessType.UPDATE)
@RequiresPermissions("business:vehicle:update")
@PostMapping("/vehicleA/checkOut")
@ResponseBody
public AjaxResult checkOutA(String vehicleIds) {
// 更改载具状态
if (vehicleService.updateVehicleStsByVehicleIds(vehicleIds) > 0) {
return success();
}
return error();
}
/**
* 取消此条agv任务同时重新下发一条agv取载具的命令
*
* @param vehicleIds
* @return
*/
@Log(title = "呼叫AGV工单出库", businessType = BusinessType.INSERT)
@RequiresPermissions("business:vehicle:update")
@PostMapping("/vehicleA/callAgvOut")
@ResponseBody
public AjaxResult callAgvOutA(String vehicleIds) {
// TODO: 2022/11/7 具体实现未确定
// 更改载具状态
if (vehicleService.updateVehicleStsByVehicleIds(vehicleIds) > 0) {
return success();
}
return error();
}
/**
* 呼叫AGV取空载具
*
* @param vehicleIds
* @return
*/
@Log(title = "呼叫AGV取空载具", businessType = BusinessType.INSERT)
@RequiresPermissions("business:vehicle:update")
@PostMapping("/vehicleA/callAgvTakeEmpty")
@ResponseBody
public AjaxResult callAgvTakeEmptyA(String vehicleIds) {
// TODO: 2022/11/7 具体实现未确定
// 更改载具状态
if (vehicleService.updateVehicleStsByVehicleIds(vehicleIds) > 0) {
return success();
}
return error();
}
/**
* 载具B界面
*
* @param mmap
* @return
*/
@RequiresPermissions("business:vehicle:view")
@GetMapping("/vehicleB")
public String vehicleB(ModelMap mmap) {
// 站台状态---是否启用
String switchB = "1";
TConveyorStatus status = new TConveyorStatus();
status.setConveryorId("1002");
List<TConveyorStatus> tConveyorStatuses = tConveyorStatusService.selectTConveyorStatusList(status);
if(tConveyorStatuses != null && tConveyorStatuses.size() > 0) {
switchB = tConveyorStatuses.get(0).getMovests();
}
mmap.put("switchB", switchB);
mmap.put("vehicleB", new Vehicle());
return prefix + "/vehicleB";
}
/**
* 查询载具B的详情
*/
@RequiresPermissions("business:vehicle:list")
@PostMapping("/vehicleB/vehicleInfo")
@ResponseBody
public TableDataInfo vehicleBInfo(Vehicle vehicleB) {
startPage();
vehicleB.setStandId("B");
List<Vehicle> list = vehicleService.selectVehicleList(vehicleB);
return getDataTable(list);
}
/**
* 载具B更改状态为已出库
*
* @param vehicleIds
* @return
*/
@Log(title = "更改载具状态", businessType = BusinessType.INSERT)
@RequiresPermissions("business:vehicle:update")
@PostMapping("/vehicleB/checkOut")
@ResponseBody
public AjaxResult checkOutB(String vehicleIds) {
// 更改载具状态
if (vehicleService.updateVehicleStsByVehicleIds(vehicleIds) > 0) {
return success();
}
return error();
}
/**
* 取消此条agv任务同时重新下发一条agv取载具的命令
*
* @param vehicleIds
* @return
*/
@Log(title = "呼叫AGV工单出库", businessType = BusinessType.INSERT)
@RequiresPermissions("business:vehicle:update")
@PostMapping("/vehicleB/callAgvOut")
@ResponseBody
public AjaxResult callAgvOutB(String vehicleIds) {
// TODO: 2022/11/7 具体实现未确定
// 更改载具状态
if (vehicleService.updateVehicleStsByVehicleIds(vehicleIds) > 0) {
return success();
}
return error();
}
/**
* 呼叫AGV取空载具
*
* @param vehicleIds
* @return
*/
@Log(title = "呼叫AGV取空载具", businessType = BusinessType.INSERT)
@RequiresPermissions("business:vehicle:update")
@PostMapping("/vehicleB/callAgvTakeEmpty")
@ResponseBody
public AjaxResult callAgvTakeEmptyB(String vehicleIds) {
// TODO: 2022/11/7 具体实现未确定
// 更改载具状态
if (vehicleService.updateVehicleStsByVehicleIds(vehicleIds) > 0) {
return success();
}
return error();
}
/**
* 回库
*/
@Log(title = "返库", businessType = BusinessType.UPDATE)
@PostMapping("/backStock")
@ResponseBody
public AjaxResult backStock(TCkPickingwavegoods tCkPickingwavegoods) {
TCkPickingwavegoods forSel = new TCkPickingwavegoods();
forSel.setOutstand(tCkPickingwavegoods.getOutstand());
forSel.setOutstatus("4");
List<TCkPickingwavegoods> waitForBackTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(forSel);
if (waitForBackTaskList.size() < 1) {
return success("0");
}
TCkPickingwavegoods backTask = waitForBackTaskList.get(0);
backTask.setOutstatus("2");
// 更新实际拣货数量
backTask.setPickingNum(tCkPickingwavegoods.getPickingNum());
return toAjax(tCkPickingwavegoodsService.updateGoodsOutResult(backTask));
}
}

View File

@ -0,0 +1,270 @@
package com.ruoyi.web.controller.business;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.business.domain.TEbsRecord;
import com.ruoyi.business.domain.TInspectReport;
import com.ruoyi.business.service.ITEbsRecordService;
import com.ruoyi.business.service.ITInspectReportService;
import com.ruoyi.business.utils.EbsUtils;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.web.service.DictService;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 在线检验不合格Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/onlineInspection")
public class OnlineInspectionController extends BaseController
{
private String prefix = "business/onlineInspection";
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ITInspectReportService tInspectReportService;
@Autowired
private ITEbsRecordService tEbsRecordService;
@Autowired
private ISysConfigService configService;
@Autowired
private DictService dict;
@RequiresPermissions("business:onlineInspection:view")
@GetMapping()
public String stock(ModelMap mmap) throws Exception {
mmap.put("tMiStock", new TMiStock());
return prefix + "/onlineInspection";
}
/**
* 查询库存列表
*/
@RequiresPermissions("business:onlineInspection:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TMiStock tMiStock)
{
startPage();
// tMiStock.setSts(dict.getType("stock_sts").get(0).getDictValue());
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
return getDataTable(list);
}
/**
* 在线检验界面
*/
@RequiresPermissions("business:onlineInspection:edit")
@GetMapping("/edit/{data}")
public String edit(@PathVariable("data") String data, ModelMap mmap)
{
Map dataMap = JSON.parseObject(data);
TMiStock tMiStockQuery = new TMiStock();
tMiStockQuery.setGoodsId(String.valueOf(dataMap.get("goodsId")));
tMiStockQuery.setProduclotid(String.valueOf(dataMap.get("produclotid")));
tMiStockQuery.setCtl(String.valueOf(dataMap.get("ctl")));
// tMiStockQuery.setGoodsId(goodsId);
TMiStock tMiStock = tMiStockService.selectStock(tMiStockQuery).get(0);
mmap.put("tMiStock", tMiStock);
return prefix + "/edit";
}
/**
* 更新库存状态
*/
@Log(title = "更新库存状态", businessType = BusinessType.UPDATE)
@RequiresPermissions("business:onlineInspection:edit")
@PostMapping("/update")
@ResponseBody
public AjaxResult update(TMiStock tMiStock) throws Exception {
TMiStock tMiStockSel = new TMiStock();
tMiStockSel.setGoodsId(tMiStock.getGoodsId());
tMiStockSel.setProduclotid(tMiStock.getProduclotid());
tMiStockSel.setCtl(tMiStock.getCtl());
TMiStock tMiStockUpdate = tMiStockService.selectStock(tMiStockSel).get(0);
tMiStockUpdate.setMark(tMiStock.getMark());
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
if (Objects.equals(tMiStockUpdate.getSts(), dict.getType("stock_sts").get(0).getDictValue())) {
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(tMiStockUpdate,
tMiStockUpdate.getWhseloc(),
"121-124"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
return error("无转移子库存的物料");
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
tMiStockUpdate.setSts(dict.getType("stock_sts").get(1).getDictValue());
tMiStockUpdate.setWhseloc("121-124");
} else {
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(tMiStockUpdate,
tMiStockUpdate.getWhseloc(),
"121-108"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
return error("无转移子库存的物料");
}
JSONObject resultJsonWmsSubInvProc = (JSONObject) JSON.parseObject(resultWmsSubInvProc).get("obj");
List<JSONObject> dataWmsSubInvProc = JSON.parseArray(resultJsonWmsSubInvProc.getString("rows"), JSONObject.class);
if (!dataWmsSubInvProc.get(0).getString("processStatus").equals("PROCESSING")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
return error(dataWmsSubInvProc.get(0).getString("errorMsg"));
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", tMiStockUpdate.getGoodsId(), tMiStockUpdate.getGoodsName(), tMiStockUpdate.getProduclotid(), tMiStockUpdate.getShelvesNum()));
tMiStockUpdate.setSts(dict.getType("stock_sts").get(0).getDictValue());
tMiStockUpdate.setWhseloc("121-108");
}
// 库存状态更新成功之后插入检验记录表
if (tMiStockService.updateTMiStock(tMiStockUpdate) > 0) {
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
TInspectReport tInspectReport = new TInspectReport();
tInspectReport.setInspectid(OrderCodeFactory.getOrderCode("JY", ""));
tInspectReport.setGoodsid(tMiStockUpdate.getGoodsId());
tInspectReport.setCtl(tMiStockUpdate.getCtl());
tInspectReport.setGoodsname(tMiStockUpdate.getGoodsName());
tInspectReport.setProductlotid(tMiStockUpdate.getProduclotid());
tInspectReport.setProvider(tMiStockUpdate.getProviderId());
tInspectReport.setProductiondate(tMiStockUpdate.getProductionDate());
tInspectReport.setExpirationdate(tMiStockUpdate.getExpirationDate());
tInspectReport.setShelfnum(tMiStockUpdate.getShelvesNum().toString());
tInspectReport.setCreateTime(new Date());
tInspectReport.setUsername(sysUser.getUserName());
tInspectReport.setStatus(tMiStockUpdate.getSts());
tInspectReport.setLocation(tMiStockUpdate.getLocationId());
if (tInspectReportService.insertTInspectReport(tInspectReport) > 0) {
return success();
}
}
return error();
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
/**
* 创建参数Json子库存转移
* @return
*/
public JSONObject createJsonWmsSubInvProc(TMiStock wmsStock, String fromSubInventoryCode, String toSubInventoryCode) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "wmsSubInvProc");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "E");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("transTypeId", 2);
businessData.put("organizationId", configService.selectConfigByKey("organizationId"));
businessData.put("itemId", wmsStock.getGoodsTypeid());
businessData.put("quantity", wmsStock.getShelvesNum());
businessData.put("subInventory", fromSubInventoryCode);
businessData.put("locatorId", EbsUtils.LOCATOR_AREA_MAP.get(fromSubInventoryCode));
businessData.put("transDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
businessData.put("transUom", wmsStock.getGoodsMeasureId());
businessData.put("transSubInventory", toSubInventoryCode);
businessData.put("transLocatorId", EbsUtils.LOCATOR_AREA_MAP.get(toSubInventoryCode));
businessData.put("transLotNumber", wmsStock.getProduclotid());
businessData.put("sourceHeaderId", 1);
businessData.put("sourceLineId", 1);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
}

View File

@ -0,0 +1,216 @@
package com.ruoyi.web.controller.business;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 品质检验Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/qualityInspect")
public class QualityInspectController extends BaseController {
private String prefix = "business/qualityInspect";
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
@Autowired
private ITCkPickingwavegoodsBackService tCkPickingwavegoodsBackService;
@Autowired
private ITCkOrderdetailService tCkOrderdetailService;
@Autowired
private ITConveyorStatusService itConveyorStatusService;
@RequiresPermissions("business:qualityInspect:view")
@GetMapping()
public String main(ModelMap mmap)
{
// 获取当前用户
SysUser sysUser = ShiroUtils.getCurrentUser();
TConveyorStatus tConveyorStatus = new TConveyorStatus();
// 用户登录IP
tConveyorStatus.setPcip(ShiroUtils.getIp());
sysUser.setLoginIp(ShiroUtils.getIp());
List<TConveyorStatus> tConveyorStatusList = itConveyorStatusService.selectTConveyorStatusList(tConveyorStatus);
if (tConveyorStatusList != null && tConveyorStatusList.size() > 0) {
tConveyorStatus = tConveyorStatusList.get(0);
// 获取用户登录的站台号
sysUser.setOutStand(tConveyorStatus.getConveryorId());
}
mmap.put("sysUser", sysUser);
mmap.put("tCkPickingwavegoods", new TCkPickingwavegoods());
return prefix + "/qualityInspect";
}
/**
* 查询退货信息列表
*/
@RequiresPermissions("business:qualityInspect:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TCkPickingwavegoods tCkPickingwavegoods)
{
startPage();
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return getDataTable(list);
}
/**
* 添加品质检验任务
*/
@RequiresPermissions("business:qualityInspect:add")
@Log(title = "品质检验", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TCkOrderdetail tCkOrderdetail)
{
// start 检查当前站台是否有正在出库的任务
TCkPickingwavegoods tCkPickingwavegoods = new TCkPickingwavegoods();
tCkPickingwavegoods.setOutstand(tCkOrderdetail.getOutStand());
List<TCkPickingwavegoods> outTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (outTaskList.size() > 0) {
return success("-2");
}
// end 检查当前站台是否有正在出库的任务
TMiStock tMiStock = new TMiStock();
tMiStock.setGoodsId(tCkOrderdetail.getGoodId());
tMiStock.setProduclotid(tCkOrderdetail.getPutinId());
List<TMiStock> list = tMiStockService.selectTMiStockOutList(tMiStock);
if (list.size() > 0) {
tCkOrderdetail.setCkId(OrderCodeFactory.getOrderCode("ZJ", ""));
tCkOrderdetail.setPickNum(BigDecimal.ZERO);
tCkOrderdetail.setStatus("0");
tCkOrderdetail.setAddtime(new Date());
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
tCkOrderdetail.setUserName(sysUser.getUserName());
return toAjax(tCkOrderdetailService.insertTCkOrderdetail(tCkOrderdetail));
}
return success("-1");
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/stockSelect";
}
/**
* 查询出库用库存列表
*/
@RequiresPermissions("business:qualityInspect:list")
@PostMapping("/query")
@ResponseBody
public TableDataInfo query(TMiStock tMiStock)
{
startPage();
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
return getDataTable(list);
}
/**
* 回库
*/
@Log(title = "返库", businessType = BusinessType.UPDATE)
@PostMapping("/backStock")
@ResponseBody
public AjaxResult backStock(TCkPickingwavegoods tCkPickingwavegoods)
{
tCkPickingwavegoods.setOutstatus("4");
List<TCkPickingwavegoods> waitForBackTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (waitForBackTaskList.size() < 1) {
return success("0");
}
TCkPickingwavegoods backTask = waitForBackTaskList.get(0);
backTask.setOutstatus("2");
return toAjax(tCkPickingwavegoodsService.updateGoodsOutResult(backTask));
}
/**
* 品质检验记录报表画面
* @return
*/
@RequiresPermissions("business:qualityInspect:view")
@GetMapping("/report")
public String report()
{
return prefix + "/qualityInspectReport";
}
/**
* 查询品质检验记录列表
*/
@RequiresPermissions("business:qualityInspect:list")
@PostMapping("/report")
@ResponseBody
public TableDataInfo reportList(DateCover date)
{
startPage();
List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "5", date.getSearch());
return getDataTable(list);
}
/**
* 导出品质检验记录报表
*/
@RequiresPermissions("business:qualityInspect:export")
@Log(title = "导出品质检验记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(DateCover date)
{
// tCkPickingwavegoodsBack.setCkType("5");
// List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBackWithoutEmpty(tCkPickingwavegoodsBack);
List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "5", date.getSearch());
ExcelUtil<TCkPickingwavegoodsBack> util = new ExcelUtil<TCkPickingwavegoodsBack>(TCkPickingwavegoodsBack.class);
return util.exportExcel(list, "品质检验记录表");
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
}

View File

@ -0,0 +1,191 @@
package com.ruoyi.web.controller.business;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
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 com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 退货Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/returnGoods")
public class ReturnGoodsController extends BaseController
{
private String prefix = "business/returnGoods";
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
@Autowired
private ITCkOrderdetailService tCkOrderdetailService;
@Autowired
private ITBaseStorageAreaLocationService locationService;
@RequiresPermissions("business:returnGoods:view")
@GetMapping()
public String main(ModelMap mmap)
{
// 获取当前用户
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
mmap.put("tCkPickingwavegoods", new TCkPickingwavegoods());
return prefix + "/returnGoods";
}
/**
* 查询退货信息列表
*/
@RequiresPermissions("business:returnGoods:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TCkPickingwavegoods tCkPickingwavegoods)
{
startPage();
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return getDataTable(list);
}
/**
* 添加不合格品出库任务
*/
@RequiresPermissions("business:returnGoods:add")
@Log(title = "不合格品退货", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public AjaxResult addSave(TCkPickingwavegoods tCkPickingwavegoods)
{
logger.info("接收到退货请求:{}", JSON.toJSONString(tCkPickingwavegoods));
try {
TMiStock tMiStock = new TMiStock();
tMiStock.setGoodsId(tCkPickingwavegoods.getGoodId());
tMiStock.setProduclotid(tCkPickingwavegoods.getProduclotid());
tMiStock.setCtl(tCkPickingwavegoods.getCtl());
List<TMiStock> list = tMiStockService.selectTMiStockList(tMiStock);
if (list.size() > 0) {
TMiStock stock = list.get(0);
stock.setFlag("1");
tMiStockService.updateTMiStock(stock);
logger.info("更新库存状态成功");
// 填写库存信息
TCkPickingwavegoods temp = new TCkPickingwavegoods();
temp.setGoodId(tCkPickingwavegoods.getGoodId());
temp.setProduclotid(tCkPickingwavegoods.getProduclotid());
temp.setGoodsName(stock.getGoodsName());
temp.setMistockNum(stock.getShelvesNum());
temp.setPickingNum(tCkPickingwavegoods.getPickingNum());
temp.setLocId(stock.getLocationId());
temp.setProductionDate(stock.getProductionDate());
temp.setExpiryDate(stock.getExpirationDate());
temp.setCtl(stock.getCtl());
temp.setPickingid(OrderCodeFactory.getOrderCode("TH", ""));
temp.setPutinId(stock.getPutinId());
temp.setOutstatus("0");
temp.setSts("0");
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
temp.setUserName(sysUser.getUserName());
temp.setCreateTime(new Date());
temp.setOutstand(selectOutStand(stock.getLocationId()));
temp.setCkType("6");
logger.info("插入入库任务表");
if (tCkPickingwavegoodsService.insertTCkPickingwavegoods(temp) < 1) {
stock.setFlag("0");
tMiStockService.updateTMiStock(stock);
return error("生成出库任务失败,请重试");
}
return success("出库成功");
} else {
return error("无对应库存");
}
} catch (Exception e) {
logger.error("错误:{}", JSON.toJSONString(e));
return error("错误");
}
}
/**
* 判断哪个站台
* @param locationId 库位编号
* @return 对应的出库站台
*/
public String selectOutStand(String locationId){
TBaseStorageAreaLocation location = locationService.selectTBaseStorageAreaLocationByLocationId(locationId);
if (location.getAbcId().equals("2")) {
return "D58400";
} else if (location.getAbcId().equals("1")) {
return "D58300";
}
return "null";
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/badStockModal";
}
/**
* 查询出库用库存列表
*/
@RequiresPermissions("business:returnGoods:list")
@PostMapping("/query")
@ResponseBody
public TableDataInfo query(TMiStock tMiStock)
{
startPage();
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
return getDataTable(list);
}
/**
* 回库
*/
@Log(title = "返库", businessType = BusinessType.UPDATE)
@PostMapping("/backStock")
@ResponseBody
public AjaxResult backStock(TCkPickingwavegoods tCkPickingwavegoods)
{
tCkPickingwavegoods.setOutstatus("4");
List<TCkPickingwavegoods> waitForBackTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (waitForBackTaskList.size() < 1) {
return success("0");
}
TCkPickingwavegoods backTask = waitForBackTaskList.get(0);
backTask.setOutstatus("2");
return toAjax(tCkPickingwavegoodsService.updateGoodsOutResult(backTask));
}
}

View File

@ -0,0 +1,91 @@
package com.ruoyi.web.controller.business;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.ruoyi.business.domain.DateCover;
import com.ruoyi.business.domain.TCkPickingwavegoodsBack;
import com.ruoyi.business.service.ITCkPickingwavegoodsBackService;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 退货记录表 Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/returnGoodsReport")
public class ReturnGoodsReportController extends BaseController
{
private String prefix = "business/returnGoods";
@Autowired
private ITCkPickingwavegoodsBackService tCkPickingwavegoodsBackService;
@RequiresPermissions("business:returnGoodsReport:view")
@GetMapping()
public String outReportMain(ModelMap mmap)
{
// 获取用户
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
return prefix + "/returnGoodsReport";
}
/**
* 查询退货记录列表
*/
@RequiresPermissions("business:returnGoodsReport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(DateCover date)
{
startPage();
List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "6", date.getSearch());
return getDataTable(list);
}
/**
* 导出出库任务单列表
*/
@RequiresPermissions("business:returnGoodsReport:export")
@Log(title = "导出退货记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(DateCover date)
{
List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "6", date.getSearch());
// tCkPickingwavegoodsBack.setCkType("6");
// List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBackWithoutEmpty(tCkPickingwavegoodsBack);
ExcelUtil<TCkPickingwavegoodsBack> util = new ExcelUtil<TCkPickingwavegoodsBack>(TCkPickingwavegoodsBack.class);
return util.exportExcel(list, "退货记录表");
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
}

View File

@ -0,0 +1,183 @@
package com.ruoyi.web.controller.business;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 退库Controller
*
* @author
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/returnStock")
public class ReturnStockController extends BaseController
{
private String prefix = "business/returnStock";
@Autowired
private ITOngoodsshelfService tOngoodsshelfService;
@Autowired
private ITOngoodsshelfBakService tOngoodsshelfServiceBak;
@Autowired
private ITConveyorStatusService tConveyorStatusService;
@RequiresPermissions("business:returnStock:view")
@GetMapping()
public String returnStock(ModelMap mmap)
{
// 获取用户
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
return prefix + "/returnStock";
}
/**
* 查询入库任务单列表
*/
@RequiresPermissions("business:returnStock:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TOngoodsshelf tOngoodsshelf)
{
startPage();
// List<TOngoodsshelf> list = tOngoodsshelfService.selectTOngoodsshelfList(tOngoodsshelf);
List<TOngoodsshelf> list = new ArrayList<>();
return getDataTable(list);
}
@GetMapping(value = "/getBarcode")
@ResponseBody
public AjaxResult getbarcode(){
List<TConveyorStatus> tConveyorStatuses = getTConveyorStatus();
if(tConveyorStatuses != null && tConveyorStatuses.size() > 0) {
return success(tConveyorStatuses.get(0));
}
logger.error("没有查询到该设备对应的站台信息………………………………");
return toAjax(false);
}
/**
* 结束入库
*/
@RequiresPermissions("business:returnStock:add")
@Log(title = "入库", businessType = BusinessType.INSERT)
@PostMapping(value = "/finishNoErpIn",consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public AjaxResult finishNoErpIn(@RequestBody List<TOngoodsshelf> tOngoodsshelves){
logger.info("接收到入库请求:{}",tOngoodsshelves);
if(tOngoodsshelves.size() <= 0){
logger.error("提交入库的数据为空");
return error();
}
// 入库id
String lotId = OrderCodeFactory.getOrderCode("TK", "");
// 创建日期
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
for (TOngoodsshelf s:
tOngoodsshelves) {
s.setTasktype("1");
s.setLotId(lotId);
s.setOrderId(initOrderId());
s.setCreateDate(sdf.format(date));
s.setInstatus("0");
s.setUserName(sysUser.getUserName());
}
return toAjax(tOngoodsshelfService.insertTOngoodsshelfValues(tOngoodsshelves));
}
/**
* 退库记录报表界面
* @return
*/
@RequiresPermissions("business:returnStock:view")
@GetMapping("/report")
public String report()
{
return prefix + "/returnStockReport";
}
/**
* 查询退库任务单列表
*/
@RequiresPermissions("business:returnStock:list")
@PostMapping("/report")
@ResponseBody
public TableDataInfo reportList(DateCover date)
{
startPage();
List<TOngoodsshelfBak> list = tOngoodsshelfServiceBak.selectTOngoodsshelfBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "1", date.getSearch());
return getDataTable(list);
}
/**
* 导出退库任务单列表
*/
@RequiresPermissions("business:returnStock:export")
@Log(title = "导出退库记录报表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(DateCover date)
{
// tOngoodsshelfBak.setTasktype("1");
// List<TOngoodsshelfBak> list = tOngoodsshelfServiceBak.selectTOngoodsshelfBakWithoutEmpty(tOngoodsshelfBak);
List<TOngoodsshelfBak> list = tOngoodsshelfServiceBak.selectTOngoodsshelfBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "1", date.getSearch());
ExcelUtil<TOngoodsshelfBak> util = new ExcelUtil<TOngoodsshelfBak>(TOngoodsshelfBak.class);
return util.exportExcel(list, "退库记录报表");
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
/**
* 生成订单号
*/
private String initOrderId() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
return "SJD" + sdf.format(date) + (int)(Math.random() * 10);
}
private List<TConveyorStatus> getTConveyorStatus(){
SysUser sysUser = ShiroUtils.getCurrentUser();
String loginIp = ShiroUtils.getIp();
TConveyorStatus status = new TConveyorStatus();
status.setPcip(loginIp);
List<TConveyorStatus> tConveyorStatuses = tConveyorStatusService.selectTConveyorStatusList(status);
return tConveyorStatuses;
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import com.ruoyi.business.domain.TScrapReport;
import com.ruoyi.business.service.ITScrapReportService;
import com.ruoyi.framework.web.service.DictService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 报废记录报表Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/scrapReport")
public class ScrapReportController extends BaseController
{
private String prefix = "business/scrapReport";
@Autowired
private ITScrapReportService tScrapReportService;
@Autowired
private DictService dict;
@RequiresPermissions("business:scrapReport:view")
@GetMapping()
public String stock(ModelMap mmap)
{
mmap.put("tScrapReport", new TScrapReport());
return prefix + "/scrapReportMain";
}
/**
* 查询报废记录报表
*/
@RequiresPermissions("business:scrapReport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo empty(TScrapReport tScrapReport)
{
startPage();
List<TScrapReport> list = tScrapReportService.selectTScrapReportList(tScrapReport);
return getDataTable(list);
}
/**
* 导出报废记录报表
*/
@RequiresPermissions("business:scrapReport:export")
@Log(title = "导出报废记录报表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult emptyExport(TScrapReport tScrapReport)
{
List<TScrapReport> list = tScrapReportService.selectTScrapReportList(tScrapReport);
ExcelUtil<TScrapReport> util = new ExcelUtil<TScrapReport>(TScrapReport.class);
return util.exportExcel(list, "报废记录报表");
}
}

View File

@ -0,0 +1,136 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TBaseGoods;
import com.ruoyi.business.service.ITBaseGoodsService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 商品资料Controller
*
* @author wms
* @date 2022-05-07
*/
@Controller
@RequestMapping("/business/goods")
public class TBaseGoodsController extends BaseController
{
private String prefix = "business/goods";
@Autowired
private ITBaseGoodsService tBaseGoodsService;
@RequiresPermissions("business:goods:view")
@GetMapping()
public String goods()
{
return prefix + "/goods";
}
/**
* 查询商品资料列表
*/
@RequiresPermissions("business:goods:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TBaseGoods tBaseGoods)
{
startPage();
List<TBaseGoods> list = tBaseGoodsService.selectTBaseGoodsList(tBaseGoods);
return getDataTable(list);
}
/**
* 导出商品资料列表
*/
@RequiresPermissions("business:goods:export")
@Log(title = "商品资料", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TBaseGoods tBaseGoods)
{
List<TBaseGoods> list = tBaseGoodsService.selectTBaseGoodsList(tBaseGoods);
ExcelUtil<TBaseGoods> util = new ExcelUtil<TBaseGoods>(TBaseGoods.class);
return util.exportExcel(list, "商品资料数据");
}
/**
* 新增商品资料
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存商品资料
*/
@RequiresPermissions("business:goods:add")
@Log(title = "商品资料", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TBaseGoods tBaseGoods)
{
return toAjax(tBaseGoodsService.insertTBaseGoods(tBaseGoods));
}
/**
* 修改商品资料
*/
@RequiresPermissions("business:goods:edit")
@GetMapping("/edit/{goodsId}")
public String edit(@PathVariable("goodsId") String goodsId, ModelMap mmap)
{
TBaseGoods tBaseGoods = tBaseGoodsService.selectTBaseGoodsByGoodsId(goodsId);
mmap.put("tBaseGoods", tBaseGoods);
return prefix + "/edit";
}
/**
* 修改保存商品资料
*/
@RequiresPermissions("business:goods:edit")
@Log(title = "商品资料", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TBaseGoods tBaseGoods)
{
return toAjax(tBaseGoodsService.updateTBaseGoods(tBaseGoods));
}
/**
* 删除商品资料
*/
@RequiresPermissions("business:goods:remove")
@Log(title = "商品资料", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tBaseGoodsService.deleteTBaseGoodsByGoodsIds(ids));
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/goodsModal";
}
}

View File

@ -0,0 +1,163 @@
package com.ruoyi.web.controller.business;
import java.util.Date;
import java.util.List;
import com.ruoyi.business.domain.TCkPickingwavegoods;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITCkPickingwavegoodsService;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.OrderUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TCkOrderdetail;
import com.ruoyi.business.service.ITCkOrderdetailService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 出库物料明细Controller
*
* @author wms
* @date 2022-06-11
*/
@Controller
@RequestMapping("/business/orderdetail")
public class TCkOrderdetailController extends BaseController
{
private String prefix = "business/orderdetail";
@Autowired
private ITCkOrderdetailService tCkOrderdetailService;
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
@RequiresPermissions("business:orderdetail:view")
@GetMapping()
public String orderdetail()
{
return prefix + "/orderdetail";
}
/**
* 查询出库物料明细列表
*/
@RequiresPermissions("business:orderdetail:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TCkOrderdetail tCkOrderdetail)
{
startPage();
List<TCkOrderdetail> list = tCkOrderdetailService.selectTCkOrderdetailList(tCkOrderdetail);
return getDataTable(list);
}
/**
* 导出出库物料明细列表
*/
@RequiresPermissions("business:orderdetail:export")
@Log(title = "导出出库物料明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TCkOrderdetail tCkOrderdetail)
{
List<TCkOrderdetail> list = tCkOrderdetailService.selectTCkOrderdetailList(tCkOrderdetail);
ExcelUtil<TCkOrderdetail> util = new ExcelUtil<TCkOrderdetail>(TCkOrderdetail.class);
return util.exportExcel(list, "出库物料明细数据");
}
/**
* 新增出库物料明细
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存出库物料明细
*/
@RequiresPermissions("business:orderdetail:add")
@Log(title = "出库", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TCkOrderdetail tCkOrderdetail)
{
// start 检查当前库存是否充足(只查合格品)
TMiStock tMiStock = new TMiStock();
tMiStock.setGoodsId(tCkOrderdetail.getGoodId());
tMiStock.setProduclotid(tCkOrderdetail.getPutinId());
tMiStock.setSts("0");
List<TMiStock> list = tMiStockService.selectTMiStockOutList(tMiStock);
if (list.size() > 0) {
if (list.get(0).getShelvesNum().compareTo(tCkOrderdetail.getPickNum()) >= 0) {// 库存充足
tCkOrderdetail.setCkId(OrderCodeFactory.getOrderCode("CK", ""));
tCkOrderdetail.setStatus("0");
tCkOrderdetail.setAddtime(new Date());
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
tCkOrderdetail.setUserName(sysUser.getUserName());
return toAjax(tCkOrderdetailService.insertTCkOrderdetail(tCkOrderdetail));
} else {// 库存不足
return success("0");
}
}
// end 检查当前库存是否充足
return success("-1");
}
/**
* 修改出库物料明细
*/
@RequiresPermissions("business:orderdetail:edit")
@GetMapping("/edit/{ckId}")
public String edit(@PathVariable("ckId") String ckId, ModelMap mmap)
{
TCkOrderdetail tCkOrderdetail = tCkOrderdetailService.selectTCkOrderdetailByCkId(ckId);
mmap.put("tCkOrderdetail", tCkOrderdetail);
return prefix + "/edit";
}
/**
* 修改保存出库物料明细
*/
@RequiresPermissions("business:orderdetail:edit")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TCkOrderdetail tCkOrderdetail)
{
return toAjax(tCkOrderdetailService.updateTCkOrderdetail(tCkOrderdetail));
}
/**
* 删除出库物料明细
*/
@RequiresPermissions("business:orderdetail:remove")
@Log(title = "出库物料明细", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tCkOrderdetailService.deleteTCkOrderdetailByCkIds(ids));
}
}

View File

@ -0,0 +1,586 @@
package com.ruoyi.web.controller.business;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.EbsUtils;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.web.service.DictService;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 出库物料明细Controller
*
* @author tony.wu
* @date 2022-05-31
*/
@Controller
@RequestMapping("/business/pickingwavegoods")
public class TCkPickingwavegoodsController extends BaseController
{
private String prefix = "business/pickingwavegoods";
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
@Autowired
private ITConveyorStatusService itConveyorStatusService;
@Autowired
private ITCkOrderdetailService tCkOrderdetailService;
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ITEbsRecordService tEbsRecordService;
@Autowired
private ISysConfigService configService;
@Autowired
private ITBaseStorageAreaLocationService locationService;
@Autowired
private DictService dict;
@RequiresPermissions("business:pickingwavegoods:view")
@GetMapping()
public String pickingwavegoods(ModelMap mmap)
{
// 获取当前用户
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
mmap.put("tMiStock", new TMiStock());
return prefix + "/pickingwavegoods";
}
/**
* 查询出库物料明细列表
*/
@RequiresPermissions("business:pickingwavegoods:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TCkPickingwavegoods tCkPickingwavegoods)
{
startPage();
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return getDataTable(list);
}
/**
* 导出出库物料明细列表
*/
@RequiresPermissions("business:pickingwavegoods:export")
@Log(title = "导出出库物料明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TCkPickingwavegoods tCkPickingwavegoods)
{
List<TCkPickingwavegoods> list = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
ExcelUtil<TCkPickingwavegoods> util = new ExcelUtil<TCkPickingwavegoods>(TCkPickingwavegoods.class);
return util.exportExcel(list, "出库物料明细数据");
}
/**
* 新增出库物料明细
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存出库物料明细
*/
@RequiresPermissions("business:pickingwavegoods:add")
@Log(title = "出库物料明细", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public AjaxResult addSave(TCkPickingwavegoods tCkPickingwavegoods)
{
TMiStock stockForQuery = new TMiStock();
stockForQuery.setGoodsId(tCkPickingwavegoods.getGoodId());
stockForQuery.setProduclotid(tCkPickingwavegoods.getProduclotid());
stockForQuery.setSts("0");
BigDecimal allNum = tCkPickingwavegoods.getPickingNum();
List<TMiStock> stocks = tMiStockService.selectTMiStockList(stockForQuery);
for (TMiStock stock : stocks) {
if (allNum.compareTo(stock.getShelvesNum()) > 0) {
stock.setFlag("1");
tMiStockService.updateTMiStock(stock);
// 填写库存信息
TCkPickingwavegoods temp = new TCkPickingwavegoods();
temp.setGoodId(tCkPickingwavegoods.getGoodId());
temp.setProduclotid(tCkPickingwavegoods.getProduclotid());
temp.setGoodsName(stock.getGoodsName());
temp.setMistockNum(stock.getShelvesNum());
temp.setPickingNum(stock.getShelvesNum());
temp.setLocId(stock.getLocationId());
temp.setProductionDate(stock.getProductionDate());
temp.setExpiryDate(stock.getExpirationDate());
temp.setCtl(stock.getCtl());
temp.setPickingid(OrderCodeFactory.getOrderCode("CK", ""));
temp.setPutinId(stock.getPutinId());
temp.setSts("0");
temp.setOutstatus("0");
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
temp.setUserName(sysUser.getUserName());
temp.setCreateTime(new Date());
temp.setOutstand(selectOutStand(stock.getLocationId()));
temp.setCkType("6");
if (tCkPickingwavegoodsService.insertTCkPickingwavegoods(temp) < 1) {
stock.setFlag("0");
tMiStockService.updateTMiStock(stock);
return error("生成出库任务失败,请重试");
}
allNum = allNum.subtract(stock.getShelvesNum());
} else {
stock.setFlag("1");
tMiStockService.updateTMiStock(stock);
// 填写库存信息
TCkPickingwavegoods temp = new TCkPickingwavegoods();
temp.setGoodId(tCkPickingwavegoods.getGoodId());
temp.setProduclotid(tCkPickingwavegoods.getProduclotid());
temp.setGoodsName(stock.getGoodsName());
temp.setMistockNum(stock.getShelvesNum());
temp.setPickingNum(allNum);
temp.setLocId(stock.getLocationId());
temp.setProductionDate(stock.getProductionDate());
temp.setExpiryDate(stock.getExpirationDate());
temp.setCtl(stock.getCtl());
temp.setPickingid(OrderCodeFactory.getOrderCode("CK", ""));
temp.setPutinId(stock.getPutinId());
temp.setSts("0");
temp.setOutstatus("0");
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
temp.setUserName(sysUser.getUserName());
temp.setCreateTime(new Date());
temp.setOutstand(selectOutStand(stock.getLocationId()));
temp.setCkType("6");
if (tCkPickingwavegoodsService.insertTCkPickingwavegoods(temp) < 1) {
stock.setFlag("0");
tMiStockService.updateTMiStock(stock);
return error("生成出库任务失败,请重试");
}
break;
}
}
return success("生成出库任务成功");
}
/**
* 判断哪个站台
* @param locationId 库位编号
* @return 对应的出库站台
*/
public String selectOutStand(String locationId){
TBaseStorageAreaLocation location = locationService.selectTBaseStorageAreaLocationByLocationId(locationId);
if (location.getAbcId().equals("2")) {
return "D58700";
} else if (location.getAbcId().equals("1")) {
return "D00580";
}
return "null";
}
/**
* 修改出库物料明细
*/
@RequiresPermissions("business:pickingwavegoods:edit")
@GetMapping("/edit/{pickingid}")
public String edit(@PathVariable("pickingid") String pickingid, ModelMap mmap)
{
TCkPickingwavegoods tCkPickingwavegoods = tCkPickingwavegoodsService.selectTCkPickingwavegoodsByPickingid(pickingid);
mmap.put("tCkPickingwavegoods", tCkPickingwavegoods);
return prefix + "/edit";
}
/**
* 修改保存出库物料明细
*/
@RequiresPermissions("business:pickingwavegoods:edit")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TCkPickingwavegoods tCkPickingwavegoods)
{
return toAjax(tCkPickingwavegoodsService.updateTCkPickingwavegoods(tCkPickingwavegoods));
}
/**
* 修改出库任务
*/
@RequiresPermissions("business:pickingwavegoods:edit")
@Log(title = "出库物料明细", businessType = BusinessType.UPDATE)
@PostMapping("/updateResult")
@ResponseBody
public AjaxResult updateResult(TCkPickingwavegoods tCkPickingwavegoods)
{
return toAjax(tCkPickingwavegoodsService.updateGoodsOutResult(tCkPickingwavegoods));
}
/**
* 删除出库物料明细
*/
@RequiresPermissions("business:pickingwavegoods:remove")
@Log(title = "出库物料明细", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tCkPickingwavegoodsService.deleteTCkPickingwavegoodsByPickingids(ids));
}
/**
* 判断站台上的空托盘是否为空如果不为空根据托盘号获取出库任务信息
*/
@RequiresPermissions("business:pickingwavegoods:edit")
@GetMapping("/queryByCtl")
@ResponseBody
public AjaxResult queryByCtl()
{
TConveyorStatus tConveyorStatus = new TConveyorStatus();
// 用户登录IP
SysUser sysUser = ShiroUtils.getCurrentUser();
tConveyorStatus.setPcip(ShiroUtils.getIp());
List<TConveyorStatus> tConveyorStatusList = itConveyorStatusService.selectTConveyorStatusList(tConveyorStatus);
if (tConveyorStatusList != null && tConveyorStatusList.size() > 0) {
tConveyorStatus = tConveyorStatusList.get(0);
// 判断当前站台上的托盘是否为空不为空时根据托盘获取出库任务数据
if (StringUtils.isNotEmpty(tConveyorStatus.getBarcode())) {
TCkPickingwavegoods tCkPickingwavegoods = new TCkPickingwavegoods();
// 托盘号
tCkPickingwavegoods.setCtl(tConveyorStatus.getBarcode());
// 状态
tCkPickingwavegoods.setOutstatus("0");
// 站台号
tCkPickingwavegoods.setOutstand(tConveyorStatus.getConveryorId());
// 获取任务列表
List<TCkPickingwavegoods> tCkPickingwavegoodsList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (tCkPickingwavegoodsList != null && tCkPickingwavegoodsList.size() > 0) {
return success(tCkPickingwavegoodsList.get(0));
}
}
}
return null;
}
/**
* 出库扫码校验
*/
@Log(title = "出库扫码校验", businessType = BusinessType.UPDATE)
@PostMapping("/scanGoods")
@ResponseBody
public AjaxResult scanGoods(TCkPickingwavegoods tCkPickingwavegoods)
{
tCkPickingwavegoods.setOutstatus("3");
List<TCkPickingwavegoods> waitForScanTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (waitForScanTaskList.size() < 1) {
return success("0");
}
TCkPickingwavegoods scanTask = waitForScanTaskList.get(0);
scanTask.setOutstatus("4");
return toAjax(tCkPickingwavegoodsService.updateScanGoodsResult(scanTask));
}
/**
* 回库
*/
@Log(title = "返库", businessType = BusinessType.UPDATE)
@PostMapping("/backStock")
@ResponseBody
public AjaxResult backStock(TCkPickingwavegoods tCkPickingwavegoods)
{
tCkPickingwavegoods.setOutstatus("4");
List<TCkPickingwavegoods> waitForBackTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (waitForBackTaskList.size() < 1) {
return success("0");
}
TCkPickingwavegoods backTask = waitForBackTaskList.get(0);
backTask.setOutstatus("2");
return toAjax(tCkPickingwavegoodsService.updateGoodsOutResult(backTask));
}
/**
* 弹框表格
*/
@GetMapping("/selEbsAccountName")
public String table()
{
return prefix + "/ebsAccountName";
}
/**
* 获取账户别名
*/
@RequiresPermissions("business:pickingwavegoods:list")
@PostMapping("/getEbsAccountName")
@ResponseBody
public TableDataInfo getEbsAccountName(EbsAccountName ebsAccountName) throws Exception {
// 返回分页数据
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
TableDataInfo rspData = new TableDataInfo();
List<EbsAccountName> ebsAccountNames = new LinkedList<EbsAccountName>();
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
// tEbsRecordService.insertTEbsRecord(new TEbsRecord("token", 1, "http://10.10.90.193:8899/oauth/token?grant_type=client_credentials",
// "", JSON.toJSONString(token), "1", "获取token"));
// 获取账户别名
String paramsGetEbsAccountName = JSON.toJSONString(createJsonGetEbsAccountName());
String resultGetEbsAccountName = "";
try {
resultGetEbsAccountName = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsGetEbsAccountName, token.get("access_token").toString());
} catch (Exception e) {
// tEbsRecordService.insertTEbsRecord(new TEbsRecord("getEbsAccountName", 2, "http://10.10.90.193:9000/esb/intergrateService",
// paramsGetEbsAccountName, resultGetEbsAccountName, "-1", "获取账户别名"));
// 接口失败
return getDataTable(ebsAccountNames);
}
System.out.println(resultGetEbsAccountName);
// tEbsRecordService.insertTEbsRecord(new TEbsRecord("getEbsAccountName", 2, "http://10.10.90.193:9000/esb/intergrateService",
// paramsGetEbsAccountName, resultGetEbsAccountName, "1", "获取账户别名"));
JSONObject resultJsonGetEbsAccountName = (JSONObject) JSON.parseObject(resultGetEbsAccountName).get("obj");
List<JSONObject> dataGetEbsAccountNames = JSON.parseArray(resultJsonGetEbsAccountName.getString("rows"), JSONObject.class);
for (JSONObject dataEbsAccountName : dataGetEbsAccountNames) {
EbsAccountName tempName = new EbsAccountName();
tempName.setDispositionId(dataEbsAccountName.getIntValue("dispositionId"));
tempName.setDescription(dataEbsAccountName.getString("description"));
tempName.setSegment1(dataEbsAccountName.getString("segment1"));
ebsAccountNames.add(tempName);
}
rspData.setCode(0);
rspData.setRows(PageUtils.startPageByList(ebsAccountNames, pageNum, pageSize));
rspData.setTotal(new PageInfo(ebsAccountNames).getTotal());
return rspData;
}
/**
* 账户别名出库
*/
@RequiresPermissions("business:orderdetail:add")
@Log(title = "账户别名出库", businessType = BusinessType.INSERT)
@PostMapping("/othersProc")
@ResponseBody
public AjaxResult othersProc(TCkOrderdetail tCkOrderdetail) throws Exception {
// start 检查当前站台是否有正在出库的任务
TCkPickingwavegoods tCkPickingwavegoods = new TCkPickingwavegoods();
tCkPickingwavegoods.setOutstand(tCkOrderdetail.getOutStand());
List<TCkPickingwavegoods> outTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
if (outTaskList.size() > 0) {
return error("当前站台有出库任务未结束");
}
// end 检查当前站台是否有正在出库的任务
// start 检查当前库存是否充足(只查合格品)
TMiStock tMiStock = new TMiStock();
tMiStock.setGoodsId(tCkOrderdetail.getGoodId());
tMiStock.setProduclotid(tCkOrderdetail.getPutinId());
tMiStock.setSts("0");
List<TMiStock> list = tMiStockService.selectTMiStockOutList(tMiStock);
if (list.size() > 0) {
if (list.get(0).getShelvesNum().compareTo(tCkOrderdetail.getPickNum()) >= 0) {// 库存充足
tCkOrderdetail.setCkId(OrderCodeFactory.getOrderCode("CK", ""));
tCkOrderdetail.setStatus("0");
tCkOrderdetail.setAddtime(new Date());
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
tCkOrderdetail.setUserName(sysUser.getUserName());
// 开始账户别名出库
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
// tEbsRecordService.insertTEbsRecord(new TEbsRecord("token", 1, "http://10.10.90.193:8899/oauth/token?grant_type=client_credentials",
// "", JSON.toJSONString(token), "1", "获取token"));
// 账户别名发放
List<TMiStock> stockForOthersProc = tMiStockService.selectStock(tMiStock);
String paramsWmsOthersProc = JSON.toJSONString(createJsonWmsOthersProc(stockForOthersProc.get(0), tCkOrderdetail));
String resultWmsOthersProc = "";
try {
resultWmsOthersProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsOthersProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsOthersProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsOthersProc, resultWmsOthersProc, "-1", "账户别名发放", list.get(0).getGoodsId(), list.get(0).getGoodsName(), tCkOrderdetail.getPutinId(), tCkOrderdetail.getPickNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsOthersProc);
if (!JSON.parseObject(resultWmsOthersProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsOthersProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsOthersProc, resultWmsOthersProc, "-1", "账户别名发放", list.get(0).getGoodsId(), list.get(0).getGoodsName(), tCkOrderdetail.getPutinId(), tCkOrderdetail.getPickNum()));
return error("账户别名发放失败:" + JSON.parseObject(resultWmsOthersProc).getString("msg"));
}
JSONObject resultJsonWmsOthersProc = (JSONObject) JSON.parseObject(resultWmsOthersProc).get("obj");
List<JSONObject> dataWmsOthersProc = JSON.parseArray(resultJsonWmsOthersProc.getString("rows"), JSONObject.class);
if (!dataWmsOthersProc.get(0).getString("processStatus").equals("PROCESSING")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsOthersProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsOthersProc, resultWmsOthersProc, "-1", "账户别名发放", list.get(0).getGoodsId(), list.get(0).getGoodsName(), tCkOrderdetail.getPutinId(), tCkOrderdetail.getPickNum()));
return error(dataWmsOthersProc.get(0).getString("errorMsg"));
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsOthersProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsOthersProc, resultWmsOthersProc, "0", "账户别名发放", list.get(0).getGoodsId(), list.get(0).getGoodsName(), tCkOrderdetail.getPutinId(), tCkOrderdetail.getPickNum()));
if (tCkOrderdetailService.insertTCkOrderdetail(tCkOrderdetail) < 1) {
return error("插入出库任务失败");
}
} else {// 库存不足
return error("合格品库存不足");
}
}
// end 检查当前库存是否充足
return success("创建出库任务成功");
}
/**
* 创建参数Json(获取账户别名)
* @return
*/
public JSONObject createJsonGetEbsAccountName() {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "getEbsAccountName");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("organizationId", configService.selectConfigByKey("organizationId"));
// 创建数据
JSONObject businessData = new JSONObject();
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
/**
* 创建参数Json(账户别名出库)
* @return
*/
public JSONObject createJsonWmsOthersProc(TMiStock stock, TCkOrderdetail order) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "wmsOthersProc");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "E");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("organizationId", configService.selectConfigByKey("organizationId"));
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("transTypeId", 31);
businessData.put("organizationId", configService.selectConfigByKey("organizationId"));
businessData.put("itemId", stock.getGoodsTypeid());
businessData.put("subInventory", stock.getWhseloc());
businessData.put("locatorId", EbsUtils.LOCATOR_AREA_MAP.get(stock.getWhseloc()));
businessData.put("transSourceName", order.getSpecification());
businessData.put("transSourceId", order.getBusinessid());
businessData.put("transLotNumber", stock.getProduclotid());
businessData.put("quantity", Math.negateExact(order.getPickNum().intValue()));
businessData.put("transDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
businessData.put("transUom", stock.getGoodsMeasureId());
businessData.put("sourceHeaderId", 1);
businessData.put("sourceLineId", 1);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
static class EbsAccountName {
private int dispositionId;
private String segment1;
private String description;
public int getDispositionId() {
return dispositionId;
}
public void setDispositionId(int dispositionId) {
this.dispositionId = dispositionId;
}
public String getSegment1() {
return segment1;
}
public void setSegment1(String segment1) {
this.segment1 = segment1;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
}

View File

@ -0,0 +1,127 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TConveyorStatus;
import com.ruoyi.business.service.ITConveyorStatusService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 请填写功能名称Controller
*
* @author wms
* @date 2022-06-11
*/
@Controller
@RequestMapping("/business/status")
public class TConveyorStatusController extends BaseController
{
private String prefix = "business/status";
@Autowired
private ITConveyorStatusService tConveyorStatusService;
@RequiresPermissions("business:status:view")
@GetMapping()
public String status()
{
return prefix + "/status";
}
/**
* 查询请填写功能名称列表
*/
@RequiresPermissions("business:status:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TConveyorStatus tConveyorStatus)
{
startPage();
List<TConveyorStatus> list = tConveyorStatusService.selectTConveyorStatusList(tConveyorStatus);
return getDataTable(list);
}
/**
* 导出请填写功能名称列表
*/
@RequiresPermissions("business:status:export")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TConveyorStatus tConveyorStatus)
{
List<TConveyorStatus> list = tConveyorStatusService.selectTConveyorStatusList(tConveyorStatus);
ExcelUtil<TConveyorStatus> util = new ExcelUtil<TConveyorStatus>(TConveyorStatus.class);
return util.exportExcel(list, "【请填写功能名称】数据");
}
/**
* 新增请填写功能名称
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存请填写功能名称
*/
@RequiresPermissions("business:status:add")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TConveyorStatus tConveyorStatus)
{
return toAjax(tConveyorStatusService.insertTConveyorStatus(tConveyorStatus));
}
/**
* 修改请填写功能名称
*/
@RequiresPermissions("business:status:edit")
@GetMapping("/edit/{converyorId}")
public String edit(@PathVariable("converyorId") String converyorId, ModelMap mmap)
{
TConveyorStatus tConveyorStatus = tConveyorStatusService.selectTConveyorStatusByConveryorId(converyorId);
mmap.put("tConveyorStatus", tConveyorStatus);
return prefix + "/edit";
}
/**
* 修改保存请填写功能名称
*/
@RequiresPermissions("business:status:edit")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TConveyorStatus tConveyorStatus)
{
return toAjax(tConveyorStatusService.updateTConveyorStatus(tConveyorStatus));
}
/**
* 删除请填写功能名称
*/
@RequiresPermissions("business:status:remove")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tConveyorStatusService.deleteTConveyorStatusByConveryorIds(ids));
}
}

View File

@ -0,0 +1,136 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TCusCustomer;
import com.ruoyi.business.service.ITCusCustomerService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 请填写功能名称Controller
*
* @author wms
* @date 2022-06-12
*/
@Controller
@RequestMapping("/business/customer")
public class TCusCustomerController extends BaseController
{
private String prefix = "business/customer";
@Autowired
private ITCusCustomerService tCusCustomerService;
@RequiresPermissions("business:customer:view")
@GetMapping()
public String customer()
{
return prefix + "/customer";
}
/**
* 查询请填写功能名称列表
*/
@RequiresPermissions("business:customer:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TCusCustomer tCusCustomer)
{
startPage();
List<TCusCustomer> list = tCusCustomerService.selectTCusCustomerList(tCusCustomer);
return getDataTable(list);
}
/**
* 导出请填写功能名称列表
*/
@RequiresPermissions("business:customer:export")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TCusCustomer tCusCustomer)
{
List<TCusCustomer> list = tCusCustomerService.selectTCusCustomerList(tCusCustomer);
ExcelUtil<TCusCustomer> util = new ExcelUtil<TCusCustomer>(TCusCustomer.class);
return util.exportExcel(list, "【请填写功能名称】数据");
}
/**
* 新增请填写功能名称
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存请填写功能名称
*/
@RequiresPermissions("business:customer:add")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TCusCustomer tCusCustomer)
{
return toAjax(tCusCustomerService.insertTCusCustomer(tCusCustomer));
}
/**
* 修改请填写功能名称
*/
@RequiresPermissions("business:customer:edit")
@GetMapping("/edit/{customerId}")
public String edit(@PathVariable("customerId") String customerId, ModelMap mmap)
{
TCusCustomer tCusCustomer = tCusCustomerService.selectTCusCustomerByCustomerId(customerId);
mmap.put("tCusCustomer", tCusCustomer);
return prefix + "/edit";
}
/**
* 修改保存请填写功能名称
*/
@RequiresPermissions("business:customer:edit")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TCusCustomer tCusCustomer)
{
return toAjax(tCusCustomerService.updateTCusCustomer(tCusCustomer));
}
/**
* 删除请填写功能名称
*/
@RequiresPermissions("business:customer:remove")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tCusCustomerService.deleteTCusCustomerByCustomerIds(ids));
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/customerModal";
}
}

View File

@ -0,0 +1,116 @@
package com.ruoyi.web.controller.business;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.alibaba.druid.sql.ast.statement.SQLUnionQuery;
import com.alibaba.fastjson.JSON;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hpsf.GUID;
import org.apache.poi.openxml4j.opc.internal.ContentType;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import static java.lang.System.out;
/**
* 入库报表Controller
*
* @author liangzhou
* @date 2022-06-20
*/
@Controller
@RequestMapping("/business/inreport")
public class TInReportController extends BaseController
{
private String prefix = "business/inreport";
@Autowired
private ITOngoodsshelfBakService tOngoodsshelfServiceBak;
@RequiresPermissions("business:inreport:view")
@GetMapping()
public String inReportMain(ModelMap mmap)
{
// 获取用户
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
return prefix + "/inreportmain";
}
/**
* 查询入库任务单列表
*/
@RequiresPermissions("business:inreport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(DateCover date)
{
startPage();
List<TOngoodsshelfBak> list = tOngoodsshelfServiceBak.selectTOngoodsshelfBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "0", date.getSearch());
return getDataTable(list);
}
/**
* 导出入库任务单列表
*/
@RequiresPermissions("business:inreport:export")
@Log(title = "导出入库任务单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(DateCover date)
{
List<TOngoodsshelfBak> list = tOngoodsshelfServiceBak.selectTOngoodsshelfBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "0", date.getSearch());
// tOngoodsshelfBak.setTasktype("0");
// List<TOngoodsshelfBak> list = tOngoodsshelfServiceBak.selectTOngoodsshelfBakWithoutEmpty(tOngoodsshelfBak);
ExcelUtil<TOngoodsshelfBak> util = new ExcelUtil<TOngoodsshelfBak>(TOngoodsshelfBak.class);
return util.exportExcel(list, "入库任务单数据");
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
/**
* 筛选入库任务单
*/
@PostMapping("/filter/{date}")
@ResponseBody
public TableDataInfo filter(@PathVariable("date") String date)
{
startPage();
Map dateMap = JSON.parseObject(date);
List<TOngoodsshelfBak> list = tOngoodsshelfServiceBak.selectTOngoodsshelfBakByCreateDate(
String.valueOf(dateMap.get("startDate")).replace("-", ""),
String.valueOf(dateMap.get("endDate")).replace("-", ""), "0", "");
return getDataTable(list);
}
}

View File

@ -0,0 +1,150 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TMiStock;
import com.ruoyi.business.service.ITMiStockService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 库存Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/stock")
public class TMiStockController extends BaseController
{
private String prefix = "business/stock";
@Autowired
private ITMiStockService tMiStockService;
@RequiresPermissions("business:stock:view")
@GetMapping()
public String stock(ModelMap mmap)
{
mmap.put("tMiStock", new TMiStock());
return prefix + "/stock";
}
/**
* 查询库存列表
*/
@RequiresPermissions("business:stock:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TMiStock tMiStock)
{
startPage();
List<TMiStock> list = tMiStockService.selectTMiStockList(tMiStock);
return getDataTable(list);
}
/**
* 导出库存列表
*/
@RequiresPermissions("business:stock:export")
@Log(title = "库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TMiStock tMiStock)
{
List<TMiStock> list = tMiStockService.selectTMiStockList(tMiStock);
ExcelUtil<TMiStock> util = new ExcelUtil<TMiStock>(TMiStock.class);
return util.exportExcel(list, "库存数据");
}
/**
* 新增库存
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存库存
*/
@RequiresPermissions("business:stock:add")
@Log(title = "库存", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TMiStock tMiStock)
{
return toAjax(tMiStockService.insertTMiStock(tMiStock));
}
/**
* 修改库存
*/
@RequiresPermissions("business:stock:edit")
@GetMapping("/edit/{stockId}")
public String edit(@PathVariable("stockId") String stockId, ModelMap mmap)
{
TMiStock tMiStock = tMiStockService.selectTMiStockByStockId(stockId);
mmap.put("tMiStock", tMiStock);
return prefix + "/edit";
}
/**
* 修改保存库存
*/
@RequiresPermissions("business:stock:edit")
@Log(title = "库存", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TMiStock tMiStock)
{
return toAjax(tMiStockService.updateTMiStock(tMiStock));
}
/**
* 删除库存
*/
@RequiresPermissions("business:stock:remove")
@Log(title = "库存", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tMiStockService.deleteTMiStockByStockIds(ids));
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/stockModal";
}
/**
* 查询出库用库存列表
*/
@RequiresPermissions("business:stock:outlist")
@PostMapping("/outlist")
@ResponseBody
public TableDataInfo outList(TMiStock tMiStock)
{
startPage();
List<TMiStock> list = tMiStockService.selectTMiStockOutList(tMiStock);
return getDataTable(list);
}
}

View File

@ -0,0 +1,807 @@
package com.ruoyi.web.controller.business;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.EbsUtils;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hpsf.GUID;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 入库任务单Controller
*
* @author tony.wu
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/ongoodsshelf")
public class TOngoodsshelfController extends BaseController
{
private String prefix = "business/ongoodsshelf";
@Autowired
private ITOngoodsshelfService tOngoodsshelfService;
@Autowired
private ITOngoodsshelfBakService tOngoodsshelfBakService;
@Autowired
private ITCkOrderdetailService tckOrderdetailService;
@Autowired
private ITConveyorStatusService tConveyorStatusService;
@Autowired
private ITEbsRecordService tEbsRecordService;
@Autowired
private ISysConfigService configService;
@Autowired
private ITEbsOrderService itEbsOrderService;
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ITBaseGoodsService goodsService;
@RequiresPermissions("business:ongoodsshelf:view")
@GetMapping()
public String ongoodsshelf(ModelMap mmap)
{
// 获取用户
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
return prefix + "/ongoodsshelf";
}
/**
* 查询入库任务单列表
*/
@RequiresPermissions("business:ongoodsshelf:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TOngoodsshelf tOngoodsshelf)
{
startPage();
List<TOngoodsshelf> list = new ArrayList<>();
return getDataTable(list);
}
/**
* 导出入库任务单列表
*/
@RequiresPermissions("business:ongoodsshelf:export")
@Log(title = "导出入库任务单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TOngoodsshelf tOngoodsshelf)
{
List<TOngoodsshelf> list = tOngoodsshelfService.selectTOngoodsshelfList(tOngoodsshelf);
ExcelUtil<TOngoodsshelf> util = new ExcelUtil<TOngoodsshelf>(TOngoodsshelf.class);
return util.exportExcel(list, "入库任务单数据");
}
/**
* 新增入库任务单
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
@GetMapping(value = "/getBarcode")
@ResponseBody
public AjaxResult getbarcode(){
List<TConveyorStatus> tConveyorStatuses = getTConveyorStatus();
if(tConveyorStatuses != null && tConveyorStatuses.size() > 0) {
return success(tConveyorStatuses.get(0));
}
logger.error("没有查询到该设备对应的站台信息………………………………");
return toAjax(false);
}
/**
* 结束入库
*/
@Log(title = "入库", businessType = BusinessType.INSERT)
@PostMapping(value = "/finishIn",consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public AjaxResult finishIn(@RequestBody List<TOngoodsshelf> tOngoodsshelves) throws Exception {
logger.info("接收到入库请求:{}",tOngoodsshelves.toString());
if(tOngoodsshelves.size() == 0){
logger.error("提交入库的数据为空");
return error();
}
// 入库id
String lotId = OrderCodeFactory.getOrderCode("RK", "");
// 创建日期
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SysUser sysUser = new SysUser();
if (StringUtils.isEmpty(tOngoodsshelves.get(0).getUserName())) {
// 获取用户名
sysUser = ShiroUtils.getCurrentUser();
} else {
sysUser.setUserName(tOngoodsshelves.get(0).getUserName());
}
for (TOngoodsshelf s:
tOngoodsshelves) {
s.setAgvsts("0");
s.setTasktype("0");
s.setLotId(lotId);
s.setOrderId(initOrderId());
s.setCreateDate(sdf.format(date));
s.setInstatus("0");
s.setUserName(sysUser.getUserName());
// 设置子库ID
s.setWhseloc("121-108");
}
// 开始对接ebs
String ebsCongfirmResult = ebsConfirm(tOngoodsshelves);
if (StringUtils.isNotEmpty(ebsCongfirmResult)) {
return error(ebsCongfirmResult);
}
if (tOngoodsshelfService.insertTOngoodsshelfValues(tOngoodsshelves) < 1) {
return error("生成入库任务失败");
}
return success("生成入库任务成功");
}
/**
* 写入Ebs
*/
@Log(title = "写入Ebs", businessType = BusinessType.INSERT)
@PostMapping(value = "/wmsRcvProc",consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public AjaxResult wmsRcvProc(@RequestBody List<TOngoodsshelf> tOngoodsshelves) throws Exception {
logger.info("接收写入参数:{}", tOngoodsshelves.toString());
// 查询任务
TOngoodsshelf queryOnTask = new TOngoodsshelf();
queryOnTask.setInstand(tOngoodsshelves.get(0).getInstand());
queryOnTask.setInstatus(tOngoodsshelves.get(0).getInstatus());
List<TOngoodsshelf> tOngoodsshelvesNew = tOngoodsshelfService.selectTOngoodsshelfList(queryOnTask);
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
for (TOngoodsshelf tOngoodsshelve : tOngoodsshelvesNew) {
// 获取本地缓存过的订单信息
TEbsOrder queryOrder = new TEbsOrder();
queryOrder.setPhaSegment1(tOngoodsshelve.getWmsorderid());// 订单号
queryOrder.setItemId(Integer.parseInt(tOngoodsshelve.getGoodsTypeid()));
TEbsOrder ebsOrder = itEbsOrderService.selectTEbsOrderList(queryOrder).get(0);
// 开始写入EBS
String paramsWmsRcvProc = JSON.toJSONString(createJsonWmsRcvProc(ebsOrder, tOngoodsshelve));
logger.info("写入EBS参数{}", paramsWmsRcvProc);
String resultWmsRcvProc = "";
try {
resultWmsRcvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsRcvProc, token.get("access_token").toString());
logger.info("写入EBS响应结果{}", resultWmsRcvProc);
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "-1", "写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsRcvProc);
if (!JSON.parseObject(resultWmsRcvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "-1", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
return error("写入EBS失败:" + JSON.parseObject(resultWmsRcvProc).getString("msg"));
}
JSONObject resultJsonWmsRcvProc = (JSONObject) JSON.parseObject(resultWmsRcvProc).get("obj");
JSONObject dataWmsRcvProc = JSON.parseArray(resultJsonWmsRcvProc.getString("rows"), JSONObject.class).get(0);
if (!dataWmsRcvProc.getString("processStatus").equals("SUCCESS")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "-1", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
return error("写入EBS失败");
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsRcvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsRcvProc, resultWmsRcvProc, "0", "物料入库写入EBS", tOngoodsshelve.getGoodsid(), ebsOrder.getItemDescription(), tOngoodsshelve.getProduclotid(), tOngoodsshelve.getShelfNum()));
// 用于查询检验结果
tOngoodsshelve.setDecid(dataWmsRcvProc.getString("lineLocationId"));
// 待检----待检状态无法出库
tOngoodsshelve.setAccStatus("5");
// 更新信息
tOngoodsshelfService.updateTOngoodsshelf(tOngoodsshelve);
}
return success("写入EBS成功");
}
/**
* 对接ebs
*
* @param tOngoodsshelves
* @return
* @throws Exception
*/
public String ebsConfirm(List<TOngoodsshelf> tOngoodsshelves) {
try {
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
// 查询物料ID
for (TOngoodsshelf tOngoodsshelve : tOngoodsshelves) {
// 物料id
int itemId;
// 先查询物料表根据当前的物料编码
TBaseGoods goodsTemp = goodsService.selectTBaseGoodsByGoodsId(tOngoodsshelve.getGoodsid());
if (goodsTemp != null) {
itemId = Integer.parseInt(goodsTemp.getGoodsTypeId());
} else {
JSONObject dataGetInvItemId = getInvItemId(tOngoodsshelve.getGoodsid(), token.get("access_token").toString());
logger.info("查询到的物料ID结果{}", JSON.toJSONString(dataGetInvItemId));
itemId = dataGetInvItemId.getIntValue("inventoryItemId");
// 将查到的信息存放到Goods表
TBaseGoods newGoods = new TBaseGoods();
// 物料ID
newGoods.setGoodsTypeId(String.valueOf(dataGetInvItemId.getIntValue("inventoryItemId")));
// 物料编码
newGoods.setGoodsId(dataGetInvItemId.getString("itemCode"));
// 物料描述
newGoods.setGoodsName(dataGetInvItemId.getString("itemDesc"));
// 单位
newGoods.setUnit(dataGetInvItemId.getString("primaryUnitOfMeasure"));
goodsService.insertTBaseGoods(newGoods);
}
// 订单号
String poOrder = tOngoodsshelve.getWmsorderid();
// 根据物料Id和订单号获取EBS内订单
List<TEbsOrder> targetOrders;
// 先查询本地数据库中是否已经缓存过
TEbsOrder queryOrder = new TEbsOrder();
queryOrder.setPhaSegment1(poOrder);// 订单号
queryOrder.setItemId(itemId);
List<TEbsOrder> ebsOrders = itEbsOrderService.selectTEbsOrderList(queryOrder);
logger.info("查询到的本地缓存订单:{}", JSON.toJSONString(ebsOrders));
if (ebsOrders.size() > 0) {// 本地数据库中缓存过
targetOrders = ebsOrders;
} else {
targetOrders = getLinesAll(itemId, poOrder, token.get("access_token").toString());
logger.info("通过ebs查询到的订单信息{}", JSON.toJSONString(targetOrders));
if (targetOrders == null) {
return "当前入库物料在EBS中没有对应订单";
}
// 插入ebsOrder表
for (TEbsOrder targetOrder : targetOrders) {
itEbsOrderService.insertTEbsOrder(targetOrder);
}
}
// 当前任务的入库数量
double tempInQuantity = tOngoodsshelve.getShelfNum().doubleValue();
for (TEbsOrder targetOrder : targetOrders) {
// 获取数量
double msQuantity = targetOrder.getMsQuantity();
if (msQuantity >= tempInQuantity) {
// 更新本地的可接收数量
targetOrder.setMsQuantity(msQuantity - tempInQuantity);
// 物料描述
tOngoodsshelve.setGoodsname(targetOrder.getItemDescription());
// 单位
tOngoodsshelve.setGoodsMeasureId(targetOrder.getUnitMeasLookupCode());
// itemID
tOngoodsshelve.setGoodsTypeid(targetOrder.getItemId().toString());
// 供应商名称
tOngoodsshelve.setCustomerId(targetOrder.getVendorName());
// 更新剩余入库数量
tempInQuantity = 0;
break;
} else {
// 更新本地的可接收数量
targetOrder.setMsQuantity(0.0);
// 物料描述
tOngoodsshelve.setGoodsname(targetOrder.getItemDescription());
// 单位
tOngoodsshelve.setGoodsMeasureId(targetOrder.getUnitMeasLookupCode());
// itemID
tOngoodsshelve.setGoodsTypeid(targetOrder.getItemId().toString());
// 供应商名称
tOngoodsshelve.setCustomerId(targetOrder.getVendorName());
// 更新剩余入库数量
tempInQuantity -= msQuantity;
}
}
if (tempInQuantity > 0) {
// 报错信息入库数量超过EBS内订单数量这条订单无法同步EBS
return "入库数量超过EBS内订单可接收数量。</br>这条订单无法同步EBS。";
} else {
for (TEbsOrder targetOrder : targetOrders) {
// 更新EBS缓存的订单信息
itEbsOrderService.updateTEbsOrder(targetOrder);
}
}
}
} catch (Exception e) {
logger.error("出现异常:{}", JSON.toJSONString(e));
return "出现异常";
}
return null;
}
/**
* 结束入库
*/
@Log(title = "入库", businessType = BusinessType.INSERT)
@PostMapping(value = "/finishNoErpIn",consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public AjaxResult finishNoErpIn(@RequestBody List<TOngoodsshelf> tOngoodsshelves) throws Exception {
logger.info("接收到入库请求:{}",tOngoodsshelves);
if(tOngoodsshelves.size() == 0){
logger.error("提交入库的数据为空");
return error();
}
// 入库id
String lotId = OrderCodeFactory.getOrderCode("RK", "");
// 创建日期
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SysUser sysUser = new SysUser();
if (StringUtils.isEmpty(tOngoodsshelves.get(0).getUserName())) {
// 获取用户名
sysUser = ShiroUtils.getCurrentUser();
} else {
sysUser.setUserName(tOngoodsshelves.get(0).getUserName());
}
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
for (TOngoodsshelf s:
tOngoodsshelves) {
s.setAgvsts("0");
s.setTasktype("0");
s.setLotId(lotId);
s.setOrderId(initOrderId());
s.setCreateDate(sdf.format(date));
s.setInstatus("0");
s.setUserName(sysUser.getUserName());
// 设置子库ID
s.setWhseloc("121-108");
// 合格
s.setAccStatus("0");
JSONObject dataGetInvItemId = getInvItemId(s.getGoodsid(), token.get("access_token").toString());
// 物料描述
s.setGoodsname(dataGetInvItemId.getString("itemDesc"));
// 单位
s.setGoodsMeasureId(dataGetInvItemId.getString("primaryUnitOfMeasure"));
// itemID
s.setGoodsTypeid(dataGetInvItemId.getString("inventoryItemId"));
}
return toAjax(tOngoodsshelfService.insertTOngoodsshelfValues(tOngoodsshelves));
}
/**
* 更新库存
*/
@Log(title = "更新库存", businessType = BusinessType.INSERT)
@PostMapping(value = "/MistockIn",consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public AjaxResult MistockIn(@RequestBody TOngoodsshelf tOngoodsshelve) throws Exception {
// 查找对应任务
TOngoodsshelf temp = tOngoodsshelfService.selectTOngoodsshelfByLotId(tOngoodsshelve.getLotId());
logger.info("根据lotId{}查询到的入库任务信息:{}", tOngoodsshelve.getLotId(), JSON.toJSONString(temp));
// 将任务插入备份表
TOngoodsshelfBak tempBak = new TOngoodsshelfBak();
tempBak.setWmsorderid(temp.getWmsorderid());
tempBak.setGoodsid(temp.getGoodsid());
tempBak.setGoodsname(temp.getGoodsname());
tempBak.setProduclotid(temp.getProduclotid());
tempBak.setShelfNum(temp.getShelfNum());
tempBak.setProductionDate(temp.getProductionDate());
tempBak.setExpirationDate(temp.getExpirationDate());
tempBak.setProviderId(temp.getProviderId());
tempBak.setWgh(temp.getWgh());
tempBak.setLocationId(temp.getLocationId());
tempBak.setInstand(temp.getInstand());
tempBak.setCtl(temp.getCtl());
tempBak.setUserName(temp.getUserName());
tempBak.setCreateDate(temp.getCreateDate());
tempBak.setLotId(temp.getLotId());
tempBak.setStoNum(temp.getStoNum());
tempBak.setAccNum(temp.getAccNum());
tempBak.setStockNum(temp.getStockNum());
tempBak.setOndate(temp.getOndate());
tempBak.setOnshelfuserid(temp.getOnshelfuserid());
tempBak.setStorageId(temp.getStorageId());
tempBak.setStorageAreaId(temp.getStorageAreaId());
tempBak.setUpgoodsId(temp.getUpgoodsId());
tempBak.setHasvolume(temp.getHasvolume());
tempBak.setGoodsTypeid(temp.getGoodsTypeid());
tempBak.setStorageMode(temp.getStorageMode());
tempBak.setGoodsvolume(temp.getGoodsvolume());
tempBak.setBarcode(temp.getBarcode());
tempBak.setCustomerId(temp.getCustomerId());
tempBak.setPlcid(temp.getPlcid());
tempBak.setHigh(temp.getHigh());
tempBak.setInstatus(temp.getInstatus());
tempBak.setUnit(temp.getUnit());
tempBak.setBaozhiqi(temp.getBaozhiqi());
tempBak.setWhseloc(temp.getWhseloc());
tempBak.setDecid(temp.getDecid());
tempBak.setTasktype(temp.getTasktype());
tempBak.setGoodsMeasureId(temp.getGoodsMeasureId());
tempBak.setPackingNum(temp.getPackingNum());
tempBak.setDamageNum(temp.getDamageNum());
tempBak.setDamageLocation(temp.getDamageLocation());
tempBak.setWarehousingId(temp.getWarehousingId());
tempBak.setNetWeigh(temp.getNetWeigh());
tempBak.setRoughWeight(temp.getRoughWeight());
tempBak.setScaleUnit(temp.getScaleUnit());
tempBak.setTotalVolume(temp.getTotalVolume());
tempBak.setTotalRoughWeight(temp.getTotalRoughWeight());
tempBak.setTotalNetWeigh(temp.getTotalNetWeigh());
tempBak.setTotalMoney(temp.getTotalMoney());
tempBak.setFlag(temp.getFlag());
tempBak.setStandard(temp.getStandard());
tempBak.setInnerBatchNo(temp.getInnerBatchNo());
tempBak.setPrintsts(temp.getPrintsts());
tempBak.setPrintcs(temp.getPrintcs());
tempBak.setPurchasetype(temp.getPurchasetype());
tempBak.setAccStatus(temp.getAccStatus());
tempBak.setManualTrayState(temp.getManualTrayState());
tempBak.setAcceId(temp.getAcceId());
tempBak.setSpec(temp.getSpec());
tempBak.setBatchno(temp.getBatchno());
tempBak.setPrintusid(temp.getPrintusid());
tempBak.setAgvsts(temp.getAgvsts());
tempBak.setAgvbgn(temp.getAgvbgn());
tempBak.setAgvend(temp.getAgvend());
tempBak.setOrderId(temp.getOrderId());
// 插入库存表
TMiStock stockTemp = new TMiStock();
stockTemp.setShelvesNum(temp.getShelfNum());
stockTemp.setSts("0");
stockTemp.setFlag("0");
stockTemp.setStockId(String.valueOf(temp.getPlcid()));
stockTemp.setStorageId("SCC");
stockTemp.setGoodsId(temp.getGoodsid());
stockTemp.setGoodsName(temp.getGoodsname());
stockTemp.setGoodsTypeid(temp.getGoodsTypeid());
stockTemp.setAreaId(temp.getLotId());
stockTemp.setCtl(temp.getCtl());
stockTemp.setLocationId(temp.getLocationId());
stockTemp.setProduclotid(temp.getProduclotid());
stockTemp.setProviderId(temp.getProviderId());
stockTemp.setPutinId(new GUID().toString());
stockTemp.setWareDate(new Date());
stockTemp.setBarcode(temp.getBarcode());
stockTemp.setWgh(temp.getWgh());
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
stockTemp.setProductionDate(sdf.parse("20" + temp.getProductionDate()));
stockTemp.setExpirationDate(sdf.parse("20" + temp.getExpirationDate()));
stockTemp.setCustomerId(temp.getCustomerId());
stockTemp.setWhseloc(temp.getWhseloc());
stockTemp.setGoodsMeasureId(temp.getGoodsMeasureId());
try {
// 插入任务备份表
tOngoodsshelfBakService.insertTOngoodsshelfBak(tempBak);
logger.info("插入入库任务记录成功:{}", JSON.toJSONString(tempBak));
// 删除入库任务
tOngoodsshelfService.deleteTOngoodsshelfByLotId(temp.getLotId());
logger.info("删除入库任务成功:{}", JSON.toJSONString(temp));
// 插入库存
tMiStockService.insertTMiStock(stockTemp);
logger.info("插入库存成功:{}", JSON.toJSONString(stockTemp));
} catch (Exception e) {
return error(JSON.toJSONString(e));
}
return success();
}
/**
* 生成订单号
*/
private String initOrderId() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
return "SJD" + sdf.format(date) + (int)(Math.random() * 10);
}
/**
* 新增保存入库任务单
*/
@RequiresPermissions("business:ongoodsshelf:add")
@Log(title = "入库任务单", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TOngoodsshelf tOngoodsshelf)
{
return toAjax(tOngoodsshelfService.insertTOngoodsshelf(tOngoodsshelf));
}
/**
* 修改入库任务单
*/
@RequiresPermissions("business:ongoodsshelf:edit")
@GetMapping("/edit/{lotId}")
public String edit(@PathVariable("lotId") String lotId, ModelMap mmap)
{
TOngoodsshelf tOngoodsshelf = tOngoodsshelfService.selectTOngoodsshelfByLotId(lotId);
mmap.put("tOngoodsshelf", tOngoodsshelf);
return prefix + "/edit";
}
/**
* 修改保存入库任务单
*/
@RequiresPermissions("business:ongoodsshelf:edit")
@Log(title = "入库任务单", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TOngoodsshelf tOngoodsshelf)
{
return toAjax(tOngoodsshelfService.updateTOngoodsshelf(tOngoodsshelf));
}
/**
* 空托入库
*/
@Log(title = "空托入库",businessType = BusinessType.INSERT)
@GetMapping("/emptyPalletIn")
@ResponseBody
public AjaxResult emptyPalletIn(){
logger.info("空托入库开始");
TOngoodsshelf tOngoodsshelf = new TOngoodsshelf();
tOngoodsshelf.setTasktype("0");
tOngoodsshelf.setLotId(OrderCodeFactory.getOrderCode("RK", ""));
tOngoodsshelf.setGoodsid("000000000");
tOngoodsshelf.setShelfNum(BigDecimal.ONE);
tOngoodsshelf.setWgh("0");
tOngoodsshelf.setInstatus("0");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
tOngoodsshelf.setCreateDate(sdf.format(new Date()));
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
tOngoodsshelf.setUserName(sysUser.getUserName());
return toAjax(tOngoodsshelfService.insertTOngoodsshelf(tOngoodsshelf));
}
/**
* 空托出库
*/
@Log(title = "空托出库",businessType = BusinessType.INSERT)
@GetMapping("/emptyPalletOut")
@ResponseBody
public AjaxResult emptyPalletOut(){
logger.info("空托出库开始");
TCkOrderdetail tCkOrderdetail = new TCkOrderdetail();
tCkOrderdetail.setCkId(OrderCodeFactory.getOrderCode("CK",null));
tCkOrderdetail.setGoodId("000000000");
tCkOrderdetail.setCreateTime(new Date());
tCkOrderdetail.setPickNum(BigDecimal.ONE);
tCkOrderdetail.setStatus("0");
tCkOrderdetail.setAddtime(new Date());
// 获取用户名
SysUser sysUser = ShiroUtils.getCurrentUser();
tCkOrderdetail.setUserName(sysUser.getUserName());
return toAjax(tckOrderdetailService.insertTCkOrderdetail(tCkOrderdetail));
}
private List<TConveyorStatus> getTConveyorStatus(){
SysUser sysUser = ShiroUtils.getCurrentUser();
String loginIp = ShiroUtils.getIp();
TConveyorStatus status = new TConveyorStatus();
status.setPcip(loginIp);
List<TConveyorStatus> tConveyorStatuses = tConveyorStatusService.selectTConveyorStatusList(status);
return tConveyorStatuses;
}
/**
* 删除入库任务单
*/
@RequiresPermissions("business:ongoodsshelf:remove")
@Log(title = "入库任务单", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tOngoodsshelfService.deleteTOngoodsshelfByLotIds(ids));
}
/**
* 创建参数Json(写入ebs)
* @return
*/
public JSONObject createJsonWmsRcvProc(TEbsOrder dataGetAll, TOngoodsshelf tOngoodsshelve) throws ParseException {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "wmsRcvProc");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "E");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("organizationId", configService.selectConfigByKey("organizationId"));
businessData.put("poHeaderId", dataGetAll.getPoHeaderId());
businessData.put("poLineId", dataGetAll.getPoLineId());
businessData.put("lineLocationId", dataGetAll.getLineLocationId());
businessData.put("poDistributionId", dataGetAll.getPoDistributionId());
businessData.put("itemId", dataGetAll.getItemId());
businessData.put("quantity", tOngoodsshelve.getShelfNum());
businessData.put("subInventory", "");
// businessData.put("subInventory", tOngoodsshelve.getWhseloc());
businessData.put("locatorId", null);
// businessData.put("locatorId", EbsUtils.LOCATOR_AREA_MAP.get(tOngoodsshelve.getWhseloc()));
if (!"不控制".equals(dataGetAll.getLotControl())) {
businessData.put("lotNumber", tOngoodsshelve.getProduclotid());
}
businessData.put("receiptDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
businessData.put("expirationDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new SimpleDateFormat("yyyyMMdd").parse("20" + tOngoodsshelve.getExpirationDate())));
businessData.put("OriginationDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new SimpleDateFormat("yyyyMMdd").parse("20" + tOngoodsshelve.getProductionDate())));
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
/**
* 获取物料ID
* @param goodsId 物料编码
* @return
*/
public JSONObject getInvItemId (String goodsId, String token) {
String paramsGetInvItemId = JSON.toJSONString(createJsonGetInvItemInfosForPcbAps(goodsId));
logger.info("通过EBS查询物料ID参数{}", paramsGetInvItemId);
String resultGetInvItemId = "";
try {
resultGetInvItemId = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsGetInvItemId, token);
} catch (Exception e) {
// 接口失败
return null;
}
JSONObject resultJsonGetInvItemId = (JSONObject) JSON.parseObject(resultGetInvItemId).get("obj");
return JSON.parseArray(resultJsonGetInvItemId.getString("rows"), JSONObject.class).get(0);
}
/**
* 根据物料ID和订单号获取EBS内订单
* @param itemId
* @param poOrder
* @return
*/
public List<TEbsOrder> getLinesAll(int itemId, String poOrder, String token) {
String paramsGetAll = JSON.toJSONString(createJsonGetLinesAll(itemId, poOrder));
logger.info("通过EBS查询订单参数{}", paramsGetAll);
String resultGetAll = "";
try {
resultGetAll = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsGetAll, token);
} catch (Exception e) {
// 接口失败
return null;
}
JSONObject resultJsonGetAll = (JSONObject) JSON.parseObject(resultGetAll).get("obj");
if (resultJsonGetAll.getIntValue("total") < 1) {
return null;
}
return JSON.parseArray(resultJsonGetAll.getString("rows"), TEbsOrder.class);
}
/**
* 创建参数Json(获取物料ID)
* @return
*/
public JSONObject createJsonGetInvItemInfosForPcbAps(String itemCode) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "PCB_APS");
systemParams.put("sourceSystem", "APS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "getInvItemInfosForPcbAps");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("organizationId", configService.selectConfigByKey("organizationId"));
baseQueryParams.put("startPosition", 1);
baseQueryParams.put("rowsCnt", 500);
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("itemCode", itemCode);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
/**
* 创建参数Json(根据物料ID和订单号获取EBS内订单)
* @return
*/
public JSONObject createJsonGetLinesAll(int itemId, String poOrder) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "getLinesAll");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "S");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
baseQueryParams.put("organizationId", configService.selectConfigByKey("organizationId"));
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("poOrder", poOrder);
businessData.put("itemId", itemId);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
}

View File

@ -0,0 +1,91 @@
package com.ruoyi.web.controller.business;
import com.alibaba.fastjson.JSON;
import com.ruoyi.business.domain.DateCover;
import com.ruoyi.business.domain.TCkPickingwavegoods;
import com.ruoyi.business.domain.TCkPickingwavegoodsBack;
import com.ruoyi.business.domain.TOngoodsshelfBak;
import com.ruoyi.business.service.ITCkPickingwavegoodsBackService;
import com.ruoyi.business.service.ITCkPickingwavegoodsService;
import com.ruoyi.business.service.ITOngoodsshelfBakService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 入库报表Controller
*
* @author liangzhou
* @date 2022-06-20
*/
@Controller
@RequestMapping("/business/outreport")
public class TOutReportController extends BaseController {
private String prefix = "business/outreport";
@Autowired
private ITCkPickingwavegoodsBackService tCkPickingwavegoodsBackService;
@RequiresPermissions("business:outreport:view")
@GetMapping()
public String outReportMain(ModelMap mmap) {
// 获取用户
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
return prefix + "/outreportmain";
}
/**
* 查询出库任务单列表
*/
@RequiresPermissions("business:outreport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(DateCover date) {
startPage();
List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "4", date.getSearch());
return getDataTable(list);
}
/**
* 导出出库任务单列表
*/
@RequiresPermissions("business:outreport:export")
@Log(title = "导出出库记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(DateCover date) {
// tCkPickingwavegoodsBack.setCkType("4");
// List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBackWithoutEmpty(tCkPickingwavegoodsBack);
List<TCkPickingwavegoodsBack> list = tCkPickingwavegoodsBackService.selectTCkPickingwavegoodsBakByCreateDate(
date.getStartDate(),
date.getEndDate(), "4", date.getSearch());
ExcelUtil<TCkPickingwavegoodsBack> util = new ExcelUtil<TCkPickingwavegoodsBack>(TCkPickingwavegoodsBack.class);
return util.exportExcel(list, "出库记录表");
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe() {
return prefix + "/stsdescribe";
}
}

View File

@ -0,0 +1,136 @@
package com.ruoyi.web.controller.business;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.TCusCustomer;
import com.ruoyi.business.service.ITCusCustomerService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 货主管理Controller
*
* @author wms
* @date 2022-06-24
*/
@Controller
@RequestMapping("/business/owner")
public class TOwnerController extends BaseController
{
private String prefix = "business/owner";
@Autowired
private ITCusCustomerService tCusCustomerService;
@RequiresPermissions("business:owner:view")
@GetMapping()
public String customer()
{
return prefix + "/ownerMain";
}
/**
* 查询请填写功能名称列表
*/
@RequiresPermissions("business:owner:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TCusCustomer tCusCustomer)
{
startPage();
List<TCusCustomer> list = tCusCustomerService.selectTCusCustomerList(tCusCustomer);
return getDataTable(list);
}
/**
* 导出请填写功能名称列表
*/
@RequiresPermissions("business:owner:export")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TCusCustomer tCusCustomer)
{
List<TCusCustomer> list = tCusCustomerService.selectTCusCustomerList(tCusCustomer);
ExcelUtil<TCusCustomer> util = new ExcelUtil<TCusCustomer>(TCusCustomer.class);
return util.exportExcel(list, "【请填写功能名称】数据");
}
/**
* 新增请填写功能名称
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存请填写功能名称
*/
@RequiresPermissions("business:owner:add")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TCusCustomer tCusCustomer)
{
return toAjax(tCusCustomerService.insertTCusCustomer(tCusCustomer));
}
/**
* 修改请填写功能名称
*/
@RequiresPermissions("business:owner:edit")
@GetMapping("/edit/{customerId}")
public String edit(@PathVariable("customerId") String customerId, ModelMap mmap)
{
TCusCustomer tCusCustomer = tCusCustomerService.selectTCusCustomerByCustomerId(customerId);
mmap.put("tCusCustomer", tCusCustomer);
return prefix + "/edit";
}
/**
* 修改保存请填写功能名称
*/
@RequiresPermissions("business:owner:edit")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TCusCustomer tCusCustomer)
{
return toAjax(tCusCustomerService.updateTCusCustomer(tCusCustomer));
}
/**
* 删除请填写功能名称
*/
@RequiresPermissions("business:owner:remove")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tCusCustomerService.deleteTCusCustomerByCustomerIds(ids));
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/customerModal";
}
}

View File

@ -0,0 +1,657 @@
package com.ruoyi.web.controller.business;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.business.utils.EbsUtils;
import com.ruoyi.business.utils.OrderCodeFactory;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.web.service.DictService;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 库存Controller
*
* @author wms
* @date 2022-05-29
*/
@Controller
@RequestMapping("/business/stockReport")
public class TStockReportController extends BaseController
{
private String prefix = "business/stockReport";
@Autowired
private ITMiStockService tMiStockService;
@Autowired
private ISysConfigService configService;
@Autowired
private ITEbsRecordService tEbsRecordService;
@Autowired
private ITTransferRecordService tTransferRecordService;
@Autowired
private ITTaskMoveService tTaskMoveService;
@Autowired
private ITBaseStorageAreaLocationService tBaseStorageAreaLocationService;
@Autowired
private DictService dict;
@RequiresPermissions("business:stockReport:view")
@GetMapping()
public String stock(ModelMap mmap)
{
mmap.put("tMiStock", new TMiStock());
return prefix + "/stockReport";
}
/**
* 移库
* @param mmap
* @return
*/
@RequiresPermissions("business:stockReport:view")
@GetMapping("/moveStock")
public String ebsConfirm(ModelMap mmap) {
mmap.put("tMiStock", new TMiStock());
return prefix + "/stockForMove";
}
/**
* 查询库存列表
*/
@RequiresPermissions("business:stockReport:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TMiStock tMiStock)
{
startPage();
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
return getDataTable(list);
}
/**
* 导出库存列表
*/
@RequiresPermissions("business:stockReport:export")
@Log(title = "导出库存表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TMiStock tMiStock)
{
List<TMiStock> list = tMiStockService.selectStock(tMiStock);
ExcelUtil<TMiStock> util = new ExcelUtil<TMiStock>(TMiStock.class);
return util.exportExcel(list, "库存数据");
}
/**
* 导入库存列表
*/
@RequiresPermissions("business:stockReport:import")
@Log(title = "导入库存表", businessType = BusinessType.EXPORT)
@PostMapping("/importExcel")
@ResponseBody
public AjaxResult importExcel(TMiStock tMiStock) {
InputStream is = null;
try {
is = new FileInputStream("D:\\库存数据.xlsx");
} catch (FileNotFoundException e) {
return error(e.getMessage());
}
ExcelUtil<TMiStock> util = new ExcelUtil<TMiStock>(TMiStock.class);
List<TMiStock> stockList;
try {
stockList = util.importExcel(is);
} catch (Exception e) {
return error(e.getMessage());
}
for (TMiStock stock : stockList) {
if (tMiStockService.insertTMiStock(stock) < 1) {
return error("导入数据失败");
}
}
return success("导入成功");
}
/**
* 新增库存
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 弹框表格
*/
@GetMapping("/modalPage")
public String table()
{
return prefix + "/stockModal";
}
/**
* 状态说明弹框
*/
@GetMapping("/stsDescribe")
public String stsDescribe()
{
return prefix + "/stsdescribe";
}
/**
* 更新库存状态
*/
@RequiresPermissions("business:stockReport:edit")
@GetMapping("/changeStockSts/{stock}")
public String edit(@PathVariable("stock") String stock, ModelMap mmap)
{
Map stockMap = JSON.parseObject(stock);
TMiStock tMiStockQuery = new TMiStock();
tMiStockQuery.setGoodsId(String.valueOf(stockMap.get("goodsId")));
tMiStockQuery.setProduclotid(String.valueOf(stockMap.get("produclotid")));
tMiStockQuery.setCtl(String.valueOf(stockMap.get("ctl")));
tMiStockQuery.setSts(String.valueOf(stockMap.get("sts")));
TMiStock tMiStock = tMiStockService.selectStock(tMiStockQuery).get(0);
mmap.put("tMiStock", tMiStock);
return prefix + "/changeStockSts";
}
/**
* 选择移库库位
*/
@RequiresPermissions("business:stockReport:edit")
@GetMapping("/selDestinationLocation/{stock}")
public String selMoveLocation(@PathVariable("stock") String stock, ModelMap mmap)
{
// 请求库存信息
TMiStock requestStock = JSON.parseObject(stock, TMiStock.class);
// 当前库位信息
TBaseStorageAreaLocation currentLocation = tBaseStorageAreaLocationService.getOne(
new LambdaQueryWrapper<TBaseStorageAreaLocation>()
.select(TBaseStorageAreaLocation::getLocationId, TBaseStorageAreaLocation::getLocationHeight)
.eq(TBaseStorageAreaLocation::getLocationId, requestStock.getLocationId())
);
// 移库信息
TTaskMove moveTask = new TTaskMove();
moveTask.setVehicleId(requestStock.getCtl());
moveTask.setOrigin(requestStock.getLocationId());
mmap.put("moveTask", moveTask);
List<String> destinations = new ArrayList<>();
LambdaQueryWrapper<TBaseStorageAreaLocation> queryWrapper = new LambdaQueryWrapper<TBaseStorageAreaLocation>()
.select(TBaseStorageAreaLocation::getLocationId)
.eq(TBaseStorageAreaLocation::getStatus, "0")
.eq(TBaseStorageAreaLocation::getIslock, "0");
// if (Objects.equals(currentLocation.getLocationHeight(), "2")) {
// queryWrapper.eq(TBaseStorageAreaLocation::getLocationHeight, "2");
// }
List<TBaseStorageAreaLocation> locations = tBaseStorageAreaLocationService.list(queryWrapper);
for (TBaseStorageAreaLocation location : locations) {
destinations.add(location.getLocationId());
}
mmap.put("locations", destinations);
return prefix + "/moveDestinationSelect";
}
/**
* 生成移库任务
*/
@RequiresPermissions("business:stockReport:edit")
@Log(title = "生成移库任务", businessType = BusinessType.UPDATE)
@PostMapping("/generateMoveTask")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public AjaxResult generateMoveTask(TTaskMove moveTask) {
if (moveTask == null || StringUtils.isEmpty(moveTask.getVehicleId())
|| StringUtils.isEmpty(moveTask.getOrigin())
||StringUtils.isEmpty(moveTask.getDestination())) {
return error("缺少必填项");
}
TBaseStorageAreaLocation originLocation = tBaseStorageAreaLocationService.getOne(
new LambdaQueryWrapper<TBaseStorageAreaLocation>()
.select(TBaseStorageAreaLocation::getLocationId, TBaseStorageAreaLocation::getLocationHeight, TBaseStorageAreaLocation::getAbcId)
.eq(TBaseStorageAreaLocation::getLocationId, moveTask.getOrigin()));
TBaseStorageAreaLocation destinationLocation = tBaseStorageAreaLocationService.getOne(
new LambdaQueryWrapper<TBaseStorageAreaLocation>()
.select(TBaseStorageAreaLocation::getLocationId, TBaseStorageAreaLocation::getLocationHeight, TBaseStorageAreaLocation::getAbcId, TBaseStorageAreaLocation::getIslock, TBaseStorageAreaLocation::getStatus)
.eq(TBaseStorageAreaLocation::getLocationId, moveTask.getDestination())
);
if (originLocation == null || destinationLocation == null) {
return error("库位错误,查不到指定库位");
}
// if (Objects.equals(originLocation.getLocationHeight(), "2") && Objects.equals(destinationLocation.getLocationHeight(), "1")) {
// return error("高位不能移入低位");
// }
if (!Objects.equals(destinationLocation.getIslock(), "0") || !Objects.equals(destinationLocation.getStatus(), "0")) {
return error("所选库位不可使用,请重新选择可用库位");
}
// 查询库存是否可用
TMiStock moveStock = tMiStockService.getOne(
new LambdaQueryWrapper<TMiStock>()
.select(TMiStock::getCtl, TMiStock::getFlag)
.eq(TMiStock::getCtl, moveTask.getVehicleId()));
if (moveStock == null || !Objects.equals(moveStock.getFlag(), "0")) {
return error("当前库存不可移库");
}
TTaskMove newMove = new TTaskMove();
newMove.setTaskId(OrderCodeFactory.getOrderCode("MOVE_", ""));
newMove.setTaskType(1);
newMove.setTaskStatus(0);
newMove.setVehicleId(moveTask.getVehicleId());
newMove.setOrigin(originLocation.getLocationId());
newMove.setDestination(destinationLocation.getLocationId());
if (!Objects.equals(originLocation.getAbcId(), destinationLocation.getAbcId())) {
newMove.setIsCrossTunnel(1);// 跨巷道
} else {
newMove.setIsCrossTunnel(0);// 本巷道
}
try {
// 生成移库任务
tTaskMoveService.save(newMove);
// 锁定库位
tBaseStorageAreaLocationService.update(new LambdaUpdateWrapper<TBaseStorageAreaLocation>()
.set(TBaseStorageAreaLocation::getStatus, "1")
.eq(TBaseStorageAreaLocation::getLocationId, moveTask.getDestination()));
// 锁定库存
tMiStockService.update(new LambdaUpdateWrapper<TMiStock>()
.set(TMiStock::getFlag, "1")
.eq(TMiStock::getCtl, moveTask.getVehicleId()));
return success("生成移库任务成功");
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return error("生成移库任务失败");
}
}
/**
* 更新库存状态
*/
@Log(title = "更新库存状态", businessType = BusinessType.UPDATE)
@PostMapping("/updateStockSts")
@ResponseBody
public AjaxResult update(@RequestBody TMiStock tMiStock) throws Exception {
logger.info("接收子库转移请求:{}", JSON.toJSONString(tMiStock));
if (StringUtils.isEmpty(tMiStock.getGoodsId())
|| StringUtils.isEmpty(tMiStock.getProduclotid())
|| StringUtils.isEmpty(tMiStock.getCtl())
|| StringUtils.isEmpty(tMiStock.getSts())) {
return error("请求缺少必须信息,物料编码、批次号、托盘号、更新后的状态为必须信息。");
}
TMiStock stockForSelOrigin = new TMiStock();
stockForSelOrigin.setGoodsId(tMiStock.getGoodsId());
stockForSelOrigin.setProduclotid(tMiStock.getProduclotid());
stockForSelOrigin.setCtl(tMiStock.getCtl());
// 原来的库存信息
List<TMiStock> origins = tMiStockService.selectStock(stockForSelOrigin);
logger.info("根据请求参数查询到的库存数量: {}", origins.size());
if (origins.size() > 0) {// 库中存在的库存转移子库
// 原来的库存信息
TMiStock stockOrigin = origins.get(0);
// 更新后的库存
TMiStock stockAfter = new TMiStock();
BeanUtils.copyProperties(stockOrigin, stockAfter);
logger.info("原始库存: {}", JSON.toJSONString(stockOrigin));
if (StringUtils.isEmpty(stockOrigin.getGoodsId())) {
return error("对应库存缺少物料编码");
}
if (StringUtils.isEmpty(stockOrigin.getProduclotid())) {
return error("对应库存缺少批次号");
}
if (StringUtils.isEmpty(stockOrigin.getGoodsMeasureId())) {
return error("对应库存缺少单位");
}
if (StringUtils.isEmpty(stockOrigin.getGoodsTypeid())) {
return error("对应库存缺少item_id");
}
if (StringUtils.isEmpty(stockOrigin.getWhseloc())) {
return error("对应库存缺少子库编码");
}
// 分库存状态来操作
if ("0".equals(tMiStock.getSts())) {// 合格
// 待检-合格
stockAfter.setSts(tMiStock.getSts());
stockAfter.setWhseloc("121-108");
} else if ("1".equals(tMiStock.getSts())) {// 不合格
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(stockOrigin,
stockOrigin.getWhseloc(),
"121-124"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("无转移子库存的物料");
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
stockAfter.setSts(tMiStock.getSts());
// 不合格原因
stockAfter.setMark(tMiStock.getMark());
stockAfter.setWhseloc("121-124");
} else if ("2".equals(tMiStock.getSts())) {// 延期
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(stockOrigin,
stockOrigin.getWhseloc(),
"121-121"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("无转移子库存的物料");
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
stockAfter.setSts(tMiStock.getSts());
// 将有效日期设置为延期日期
stockAfter.setExpirationDate(tMiStock.getExpirationDate());
stockAfter.setWhseloc("121-121");
} else if ("3".equals(tMiStock.getSts())) {// 报废
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(stockOrigin,
stockOrigin.getWhseloc(),
"121-127"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("无转移子库存的物料");
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
stockAfter.setSts(tMiStock.getSts());
// 报废流程编号
stockAfter.setMark(tMiStock.getMark());
stockAfter.setWhseloc("121-127");
} else if ("4".equals(tMiStock.getSts())) {// 锁定
// 合格-锁定
stockAfter.setSts(tMiStock.getSts());
} else if ("-1".equals(tMiStock.getSts())){// 出库
logger.info("出库请求");
logger.info("出库请求原始库存:{}", stockOrigin.getWhseloc());
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(stockOrigin,
"121-108",
"121-141"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
return error("无转移子库存的物料");
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", stockOrigin.getGoodsId(), stockOrigin.getGoodsName(), stockOrigin.getProduclotid(), stockOrigin.getShelvesNum()));
stockAfter.setSts(tMiStock.getSts());
// 设定子库
stockAfter.setWhseloc("121-141");
}
// 库存状态更新成功之后插入检验记录表
if (tMiStockService.updateTMiStock(stockAfter) > 0) {
TTransferRecord transferRecord = new TTransferRecord();
if ("0".equals(stockAfter.getSts())) {
transferRecord.setTransferid(OrderCodeFactory.getOrderCode("HG", ""));
} else if ("1".equals(stockAfter.getSts())) {
transferRecord.setTransferid(OrderCodeFactory.getOrderCode("BHG", ""));
} else if ("2".equals(stockAfter.getSts())) {
transferRecord.setTransferid(OrderCodeFactory.getOrderCode("YQ", ""));
transferRecord.setDelaydate(stockAfter.getExpirationDate());
} else if ("3".equals(stockAfter.getSts())) {
transferRecord.setTransferid(OrderCodeFactory.getOrderCode("BF", ""));
} else if ("4".equals(stockAfter.getSts())) {
transferRecord.setTransferid(OrderCodeFactory.getOrderCode("SD", ""));
} else if ("-1".equals(stockAfter.getSts())) {
transferRecord.setTransferid(OrderCodeFactory.getOrderCode("CK", ""));
}
transferRecord.setGoodsid(stockAfter.getGoodsId());
transferRecord.setGoodsname(stockAfter.getGoodsName());
transferRecord.setProductlotid(stockAfter.getProduclotid());
transferRecord.setShelfnum(stockAfter.getShelvesNum().toString());
transferRecord.setLocation(stockAfter.getLocationId());
transferRecord.setCtl(stockAfter.getCtl());
transferRecord.setProductiondate(stockOrigin.getProductionDate());
transferRecord.setExpirationdate(stockOrigin.getExpirationDate());
transferRecord.setCreateTime(new Date());
transferRecord.setFromstatus(stockOrigin.getSts());
transferRecord.setTostatus(stockAfter.getSts());
if (tTransferRecordService.insertTTransferRecord(transferRecord) > 0) {
return success();
}
}
} else {// 退库时转移子库
logger.info("退库请求");
// 退库后新生成的库存
TMiStock stockAfter = new TMiStock();
BeanUtils.copyProperties(tMiStock, stockAfter);
logger.info("退库请求的库存:{}", stockAfter.getWhseloc());
logger.info("接收子库转移请求:{}", JSON.toJSONString(stockAfter));
if (StringUtils.isEmpty(stockAfter.getGoodsId())) {
return error("缺少物料编码");
}
if (StringUtils.isEmpty(stockAfter.getProduclotid())) {
return error("缺少批次号");
}
if (StringUtils.isEmpty(stockAfter.getGoodsMeasureId())) {
return error("缺少单位");
}
if (StringUtils.isEmpty(stockAfter.getGoodsTypeid())) {
return error("缺少item_id");
}
if (StringUtils.isEmpty(stockAfter.getWhseloc())) {
return error("缺少子库编码");
}
// 获取token
JSONObject token = JSON.parseObject(HttpUtils.httpPostJson(configService.selectConfigByKey("token_ip"), "", ""));
String paramsWmsSubInvProc = JSON.toJSONString(createJsonWmsSubInvProc(stockAfter,
"121-141",
"121-108"));
String resultWmsSubInvProc = "";
try {
resultWmsSubInvProc = HttpUtils.httpPostJson(configService.selectConfigByKey("ebs_ip"), paramsWmsSubInvProc, token.get("access_token").toString());
} catch (Exception e) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockAfter.getGoodsId(), stockAfter.getGoodsName(), stockAfter.getProduclotid(), stockAfter.getShelvesNum()));
// 接口失败
return error("连接EBS失败");
}
System.out.println(resultWmsSubInvProc);
// 子库存转移结果
if (!JSON.parseObject(resultWmsSubInvProc).getBoolean("success")) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockAfter.getGoodsId(), stockAfter.getGoodsName(), stockAfter.getProduclotid(), stockAfter.getShelvesNum()));
return error("子库存转移失败");
}
if (JSON.parseObject(JSON.parseObject(resultWmsSubInvProc).getString("obj")).getIntValue("total") < 1) {
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "-1", "子库存转移", stockAfter.getGoodsId(), stockAfter.getGoodsName(), stockAfter.getProduclotid(), stockAfter.getShelvesNum()));
return error("无转移子库存的物料");
}
tEbsRecordService.insertTEbsRecord(new TEbsRecord("wmsSubInvProc", 2, configService.selectConfigByKey("ebs_ip"),
paramsWmsSubInvProc, resultWmsSubInvProc, "0", "子库存转移", stockAfter.getGoodsId(), stockAfter.getGoodsName(), stockAfter.getProduclotid(), stockAfter.getShelvesNum()));
TTransferRecord transferRecord = new TTransferRecord();
transferRecord.setTransferid(OrderCodeFactory.getOrderCode("TK", ""));
transferRecord.setGoodsid(stockAfter.getGoodsId());
transferRecord.setGoodsname(stockAfter.getGoodsName());
transferRecord.setProductlotid(stockAfter.getProduclotid());
transferRecord.setShelfnum(stockAfter.getShelvesNum().toString());
transferRecord.setLocation(stockAfter.getLocationId());
transferRecord.setCtl(stockAfter.getCtl());
transferRecord.setProductiondate(stockAfter.getProductionDate());
transferRecord.setExpirationdate(stockAfter.getExpirationDate());
transferRecord.setCreateTime(new Date());
transferRecord.setFromstatus(stockAfter.getSts());
transferRecord.setTostatus(stockAfter.getSts());
if (tTransferRecordService.insertTTransferRecord(transferRecord) > 0) {
return success();
}
}
return error();
}
/**
* 创建参数Json子库存转移
* @return
*/
public JSONObject createJsonWmsSubInvProc(TMiStock wmsStock, String fromSubInventoryCode, String toSubInventoryCode) {
// 创建系统参数
JSONObject systemParams = new JSONObject();
systemParams.put("requestId", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
systemParams.put("application", "NT_WMS");
systemParams.put("sourceSystem", "NT_WMS");
systemParams.put("targetSystem", "EBS");
systemParams.put("serviceName", "wmsSubInvProc");
systemParams.put("nonce", 1);
systemParams.put("timestamp", 1);
systemParams.put("serviceOperation", "E");
systemParams.put("serviceVersion", "1.0");
systemParams.put("token", "fd");
// 创建查询参数
JSONObject baseQueryParams = new JSONObject();
// 创建数据
JSONObject businessData = new JSONObject();
businessData.put("transTypeId", 2);
businessData.put("organizationId", configService.selectConfigByKey("organizationId"));
businessData.put("itemId", wmsStock.getGoodsTypeid());
businessData.put("quantity", wmsStock.getShelvesNum());
businessData.put("subInventory", fromSubInventoryCode);
businessData.put("locatorId", EbsUtils.LOCATOR_AREA_MAP.get(fromSubInventoryCode));
businessData.put("transDate", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
businessData.put("transUom", wmsStock.getGoodsMeasureId());
businessData.put("transSubInventory", toSubInventoryCode);
businessData.put("transLocatorId", EbsUtils.LOCATOR_AREA_MAP.get(toSubInventoryCode));
businessData.put("transLotNumber", wmsStock.getProduclotid());
businessData.put("sourceHeaderId", 1);
businessData.put("sourceLineId", 1);
JSONArray jsonArray = new JSONArray();
jsonArray.add(businessData);
JSONObject result = new JSONObject();
result.put("systemParams", systemParams);
result.put("baseQueryParams", baseQueryParams);
result.put("businessData", jsonArray);
return result;
}
}

View File

@ -0,0 +1,377 @@
package com.ruoyi.web.controller.business;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.service.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* @author liangzhou
* @Description 任务监视画面
*/
@Controller
@RequestMapping("/business/taskMonitor")
public class TaskController extends BaseController {
private String prefix = "business/taskMonitor";
@Autowired
private ITOngoodsshelfService tOngoodsshelfService;
@Autowired
private ITCkPickingwavegoodsService tCkPickingwavegoodsService;
@Autowired
private ITBaseStorageAreaLocationService locationService;
@Autowired
private ITMiStockService stockService;
@Autowired
private ITEbsOrderService itEbsOrderService;
@Autowired
private ITTaskMoveService taskMoveService;
@RequiresPermissions("business:taskMonitor:view")
@GetMapping()
public String stock(ModelMap mmap)
{
mmap.put("taskMonitor", new Task());
return prefix + "/taskMonitor";
}
@RequiresPermissions("business:taskMonitor:view")
@GetMapping("/moveTask")
public String moveTask(ModelMap mmap)
{
mmap.put("moveTaskMonitor", new TTaskMove());
return prefix + "/moveTaskMonitor";
}
/**
* 查询库存列表
*/
@RequiresPermissions("business:taskMonitor:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(Task taskMonitor)
{
startPage();
// 如果任务Id非空
if (StringUtils.isNotEmpty(taskMonitor.getTaskId())) {
return getDataTable(selectTaskByTaskId(taskMonitor.getTaskId()));
}
return getDataTable(selectTask());
}
/**
* 查询库存列表
*/
@RequiresPermissions("business:taskMonitor:list")
@PostMapping("/moveTask/list")
@ResponseBody
public TableDataInfo moveTaskList(TTaskMove moveTask)
{
startPage();
LambdaQueryWrapper<TTaskMove> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(moveTask.getVehicleId())) {
queryWrapper.eq(TTaskMove::getVehicleId, moveTask.getVehicleId());
}
return getDataTable(taskMoveService.list(queryWrapper));
}
/**
* 修改移库任务状态
*/
@Log(title = "修改移库任务状态", businessType = BusinessType.UPDATE)
@PostMapping("/moveTask/changeMoveTask")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public AjaxResult changeMoveTask(TTaskMove moveTask) {
if (moveTask == null || StringUtils.isEmpty(moveTask.getTaskId()) || moveTask.getTaskStatus() == null) {
return error("缺少必填项");
}
TTaskMove needUpdateTask = taskMoveService.getOne(
new LambdaQueryWrapper<TTaskMove>()
.eq(TTaskMove::getTaskId, moveTask.getTaskId())
);
if (needUpdateTask == null) {
return error("移库任务不存在");
}
if (moveTask.getTaskStatus() == 0 || moveTask.getTaskStatus() == 2) {// 重置或者完成任务
needUpdateTask.setTaskStatus(moveTask.getTaskStatus());
try {
taskMoveService.update(needUpdateTask, new LambdaUpdateWrapper<TTaskMove>().eq(TTaskMove::getTaskId, moveTask.getTaskId()));
return success("更改移库任务状态成功");
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return error("更改移库任务状态发生异常");
}
}
if (moveTask.getTaskStatus() == 9) {// 取消任务
try {
// 恢复库存状态
LambdaUpdateWrapper<TMiStock> stockUpdateWrapper = new LambdaUpdateWrapper<TMiStock>()
.set(TMiStock::getFlag, "0")
.eq(TMiStock::getCtl, needUpdateTask.getVehicleId());
stockService.update(stockUpdateWrapper);
// 还原库位状态
LambdaUpdateWrapper<TBaseStorageAreaLocation> locationUpdateWrapper = new LambdaUpdateWrapper<TBaseStorageAreaLocation>()
.set(TBaseStorageAreaLocation::getStatus, "0")
.eq(TBaseStorageAreaLocation::getLocationId, needUpdateTask.getDestination());
locationService.update(locationUpdateWrapper);
// 删除移库任务
taskMoveService.remove(new LambdaQueryWrapper<TTaskMove>().eq(TTaskMove::getTaskId, moveTask.getTaskId()));
return success("取消移库任务成功");
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return error("取消移库任务发生异常");
}
}
return error("没有可进行的操作");
}
/**
* 删除任务
*/
@Log(title = "删除任务", businessType = BusinessType.DELETE)
@PostMapping("/delTask")
@ResponseBody
public AjaxResult delTask(Task taskMonitor) {
try {
if (taskMonitor.getTaskMode().equals("1")) {
// 查询到需要删除的任务
TOngoodsshelf targetTask = tOngoodsshelfService.selectTOngoodsshelfByLotId(taskMonitor.getTaskNo());
// 删除入库任务
tOngoodsshelfService.deleteTOngoodsshelfByLotId(targetTask.getLotId());
// 恢复库位状态
TBaseStorageAreaLocation targetLocation = locationService.selectTBaseStorageAreaLocationByLocationId(targetTask.getLocationId());
targetLocation.setStatus("0");
locationService.updateTBaseStorageAreaLocation(targetLocation);
// 查询本地缓存的对应的订单信息
TEbsOrder ebsOrder = new TEbsOrder();
ebsOrder.setPhaSegment1(targetTask.getWmsorderid());// 订单号
ebsOrder.setItemId(Integer.valueOf(targetTask.getGoodsTypeid()));
// 删除本地缓存的订单
itEbsOrderService.deleteTEbsOrder(ebsOrder);
} else {
// 查询到需要删除的任务
TCkPickingwavegoods targetTask = tCkPickingwavegoodsService.selectTCkPickingwavegoodsByPickingid(taskMonitor.getTaskNo());
// 删除出库任务
tCkPickingwavegoodsService.deleteTCkPickingwavegoodsByPickingid(targetTask.getPickingid());
// 恢复库存状态
TMiStock query = new TMiStock();
query.setLocationId(targetTask.getLocId());
query.setCtl(targetTask.getCtl());
List<TMiStock> targetStockList = stockService.selectTMiStockList(query);
if (targetStockList.size() < 1) {
return error("0");
}
TMiStock targetStock = targetStockList.get(0);
targetStock.setFlag("0");
stockService.updateTMiStock(targetStock);
}
} catch (Exception e) {
return error("-1");
}
return success("1");
}
/**
* 已处理任务
*/
@Log(title = "已处理任务", businessType = BusinessType.UPDATE)
@PostMapping("/solveTask")
@ResponseBody
public AjaxResult solveTask(Task taskMonitor) {
try {
if (taskMonitor.getTaskMode().equals("1")) {
// 查询到需要的任务
TOngoodsshelf targetTask = tOngoodsshelfService.selectTOngoodsshelfByLotId(taskMonitor.getTaskNo());
// 更新入库任务状态为已完成
targetTask.setInstatus("2");
tOngoodsshelfService.updateTOngoodsshelf(targetTask);
} else {
// 查询到需要删除的任务
TCkPickingwavegoods targetTask = tCkPickingwavegoodsService.selectTCkPickingwavegoodsByPickingid(taskMonitor.getTaskNo());
// 更新出库任务状态为完成
targetTask.setOutstatus("2");
tCkPickingwavegoodsService.updateTCkPickingwavegoods(targetTask);
}
} catch (Exception e) {
return error("-1");
}
return success("1");
}
/**
* 已处理任务
*/
@Log(title = "已处理任务", businessType = BusinessType.UPDATE)
@PostMapping("/agvComplete")
@ResponseBody
public AjaxResult agvComplete(Task taskMonitor) {
try {
if (taskMonitor.getTaskMode().equals("1")) {
// 查询到需要的任务
TOngoodsshelf targetTask = tOngoodsshelfService.selectTOngoodsshelfByLotId(taskMonitor.getTaskNo());
// 更新AGV任务状态为已完成
targetTask.setAgvsts("2");
tOngoodsshelfService.updateTOngoodsshelf(targetTask);
}
} catch (Exception e) {
return error("-1");
}
return success("1");
}
/**
* 重置任务
*/
@Log(title = "重置任务", businessType = BusinessType.UPDATE)
@PostMapping("/rebootTask")
@ResponseBody
public AjaxResult rebootTask(Task taskMonitor) {
try {
if (taskMonitor.getTaskMode().equals("1")) {
// 查询到需要的任务
TOngoodsshelf targetTask = tOngoodsshelfService.selectTOngoodsshelfByLotId(taskMonitor.getTaskNo());
// 更新入库任务状态为已完成
targetTask.setInstatus("0");
tOngoodsshelfService.updateTOngoodsshelf(targetTask);
} else {
// 查询到需要删除的任务
TCkPickingwavegoods targetTask = tCkPickingwavegoodsService.selectTCkPickingwavegoodsByPickingid(taskMonitor.getTaskNo());
// 更新出库任务状态为完成
targetTask.setOutstatus("0");
tCkPickingwavegoodsService.updateTCkPickingwavegoods(targetTask);
}
} catch (Exception e) {
return error("-1");
}
return success("1");
}
/**
* 根据任务Id查找任务
* @param taskId
* @return
*/
public List<Task> selectTaskByTaskId(String taskId) {
// 获取入库任务列表
TOngoodsshelf tOngoodsshelf = new TOngoodsshelf();
tOngoodsshelf.setPlcid(Long.valueOf(taskId));
List<TOngoodsshelf> inTaskList = tOngoodsshelfService.selectTOngoodsshelfList(tOngoodsshelf);
// 获取出库任务列表
TCkPickingwavegoods tCkPickingwavegoods = new TCkPickingwavegoods();
tCkPickingwavegoods.setPlcid(taskId);
List<TCkPickingwavegoods> outTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(tCkPickingwavegoods);
return setTask(inTaskList, outTaskList);
}
/**
* 查询所有任务
* @return
*/
public List<Task> selectTask() {
// 获取入库任务列表
List<TOngoodsshelf> inTaskList = tOngoodsshelfService.selectTOngoodsshelfList(new TOngoodsshelf());
// 获取出库任务列表
List<TCkPickingwavegoods> outTaskList = tCkPickingwavegoodsService.selectTCkPickingwavegoodsList(new TCkPickingwavegoods());
return setTask(inTaskList, outTaskList);
}
/**
* 根据入库任务出库任务设置任务列表
* @param inTaskList
* @param outTaskList
* @return
*/
private List<Task> setTask(List<TOngoodsshelf> inTaskList, List<TCkPickingwavegoods> outTaskList) {
// 生成任务监控列表
List<Task> taskList = new ArrayList<Task>();
// 日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 入库任务插入任务列表
for (TOngoodsshelf inTask : inTaskList) {
Task tempTask = new Task();
// 任务编号
tempTask.setTaskNo(inTask.getLotId());
// 任务时间
tempTask.setTaskTime(inTask.getCreateDate());
// 任务ID
tempTask.setTaskId(String.valueOf(inTask.getPlcid()));
// 物料编号
tempTask.setGoodsId(inTask.getGoodsid());
// 数量
tempTask.setOpNumber(inTask.getShelfNum());
// 起始货位
tempTask.setStartLocation(inTask.getInstand());
// 目标货位
tempTask.setTargetLocation(inTask.getLocationId());
// 托盘号
tempTask.setCtl(inTask.getCtl());
// 任务模式
tempTask.setTaskMode("1");
// 任务状态
tempTask.setStatus(inTask.getInstatus());
taskList.add(tempTask);
}
// 出库任务插入任务列表
for (TCkPickingwavegoods outTask : outTaskList) {
Task tempTask = new Task();
// 任务编号
tempTask.setTaskNo(outTask.getPickingid());
// 任务时间
tempTask.setTaskTime(sdf.format(outTask.getCreateTime()));
// 任务ID
tempTask.setTaskId(outTask.getPlcid());
// 物料编号
tempTask.setGoodsId(outTask.getGoodId());
// 数量
tempTask.setOpNumber(outTask.getPickingNum());
// 起始货位
tempTask.setStartLocation(outTask.getLocId());
// 目标货位
tempTask.setTargetLocation(outTask.getOutstand());
// 托盘号
tempTask.setCtl(outTask.getCtl());
// 任务模式
tempTask.setTaskMode("2");
// 任务状态
tempTask.setStatus(outTask.getOutstatus());
taskList.add(tempTask);
}
return taskList;
}
}

View File

@ -0,0 +1,166 @@
package com.ruoyi.web.controller.common;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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 org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.config.ServerConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
/**
* 通用请求处理
*
* @author ruoyi
*/
@Controller
@RequestMapping("/common")
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
private static final String FILE_DELIMETER = ",";
/**
* 通用下载请求
*
* @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")
@ResponseBody
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")
@ResponseBody
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);
}
}
}

View File

@ -0,0 +1,98 @@
package com.ruoyi.web.controller.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 模态窗口
*
* @author ruoyi
*/
@Controller
@RequestMapping("/demo/modal")
public class DemoDialogController
{
private String prefix = "demo/modal";
/**
* 模态窗口
*/
@GetMapping("/dialog")
public String dialog()
{
return prefix + "/dialog";
}
/**
* 弹层组件
*/
@GetMapping("/layer")
public String layer()
{
return prefix + "/layer";
}
/**
* 表单
*/
@GetMapping("/form")
public String form()
{
return prefix + "/form";
}
/**
* 表格
*/
@GetMapping("/table")
public String table()
{
return prefix + "/table";
}
/**
* 表格check
*/
@GetMapping("/check")
public String check()
{
return prefix + "/table/check";
}
/**
* 表格radio
*/
@GetMapping("/radio")
public String radio()
{
return prefix + "/table/radio";
}
/**
* 表格回传父窗体
*/
@GetMapping("/parent")
public String parent()
{
return prefix + "/table/parent";
}
/**
* 多层窗口frame1
*/
@GetMapping("/frame1")
public String frame1()
{
return prefix + "/table/frame1";
}
/**
* 多层窗口frame2
*/
@GetMapping("/frame2")
public String frame2()
{
return prefix + "/table/frame2";
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,35 @@
package com.ruoyi.web.controller.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 图标相关
*
* @author ruoyi
*/
@Controller
@RequestMapping("/demo/icon")
public class DemoIconController
{
private String prefix = "demo/icon";
/**
* FontAwesome图标
*/
@GetMapping("/fontawesome")
public String fontAwesome()
{
return prefix + "/fontawesome";
}
/**
* Glyphicons图标
*/
@GetMapping("/glyphicons")
public String glyphicons()
{
return prefix + "/glyphicons";
}
}

View File

@ -0,0 +1,326 @@
package com.ruoyi.web.controller.demo.controller;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.controller.demo.domain.CustomerModel;
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
/**
* 操作控制
*
* @author ruoyi
*/
@Controller
@RequestMapping("/demo/operate")
public class DemoOperateController extends BaseController
{
private String prefix = "demo/operate";
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
{
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
}
/**
* 表格
*/
@GetMapping("/table")
public String table()
{
return prefix + "/table";
}
/**
* 其他
*/
@GetMapping("/other")
public String other()
{
return prefix + "/other";
}
/**
* 查询数据
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(UserOperateModel userModel)
{
TableDataInfo rspData = new TableDataInfo();
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
// 查询条件过滤
if (StringUtils.isNotEmpty(userModel.getSearchValue()))
{
userList.clear();
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
{
if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
{
userList.add(entry.getValue());
}
}
}
else if (StringUtils.isNotEmpty(userModel.getUserName()))
{
userList.clear();
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
{
if (entry.getValue().getUserName().equals(userModel.getUserName()))
{
userList.add(entry.getValue());
}
}
}
PageDomain pageDomain = TableSupport.buildPageRequest();
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
{
rspData.setRows(userList);
rspData.setTotal(userList.size());
return rspData;
}
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
Integer pageSize = pageDomain.getPageNum() * 10;
if (pageSize > userList.size())
{
pageSize = userList.size();
}
rspData.setRows(userList.subList(pageNum, pageSize));
rspData.setTotal(userList.size());
return rspData;
}
/**
* 新增用户
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
return prefix + "/add";
}
/**
* 新增保存用户
*/
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(UserOperateModel user)
{
Integer userId = users.size() + 1;
user.setUserId(userId);
return AjaxResult.success(users.put(userId, user));
}
/**
* 新增保存主子表信息
*/
@PostMapping("/customer/add")
@ResponseBody
public AjaxResult addSave(CustomerModel customerModel)
{
System.out.println(customerModel.toString());
return AjaxResult.success();
}
/**
* 修改用户
*/
@GetMapping("/edit/{userId}")
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
{
mmap.put("user", users.get(userId));
return prefix + "/edit";
}
/**
* 修改保存用户
*/
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(UserOperateModel user)
{
return AjaxResult.success(users.put(user.getUserId(), user));
}
/**
* 导出
*/
@PostMapping("/export")
@ResponseBody
public AjaxResult export(UserOperateModel user)
{
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
return util.exportExcel(list, "用户数据");
}
/**
* 下载模板
*/
@GetMapping("/importTemplate")
@ResponseBody
public AjaxResult importTemplate()
{
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
return util.importTemplateExcel("用户数据");
}
/**
* 导入数据
*/
@PostMapping("/importData")
@ResponseBody
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
String message = importUser(userList, updateSupport);
return AjaxResult.success(message);
}
/**
* 删除用户
*/
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
Integer[] userIds = Convert.toIntArray(ids);
for (Integer userId : userIds)
{
users.remove(userId);
}
return AjaxResult.success();
}
/**
* 查看详细
*/
@GetMapping("/detail/{userId}")
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
{
mmap.put("user", users.get(userId));
return prefix + "/detail";
}
@PostMapping("/clean")
@ResponseBody
public AjaxResult clean()
{
users.clear();
return success();
}
/**
* 导入用户数据
*
* @param userList 用户数据列表
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @return 结果
*/
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
{
if (StringUtils.isNull(userList) || userList.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (UserOperateModel user : userList)
{
try
{
// 验证是否存在这个用户
boolean userFlag = false;
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
{
if (entry.getValue().getUserName().equals(user.getUserName()))
{
userFlag = true;
break;
}
}
if (!userFlag)
{
Integer userId = users.size() + 1;
user.setUserId(userId);
users.put(userId, user);
successNum++;
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
}
else if (isUpdateSupport)
{
users.put(user.getUserId(), user);
successNum++;
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
}
else
{
failureNum++;
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
}
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
}

View File

@ -0,0 +1,53 @@
package com.ruoyi.web.controller.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 报表
*
* @author ruoyi
*/
@Controller
@RequestMapping("/demo/report")
public class DemoReportController
{
private String prefix = "demo/report";
/**
* 百度ECharts
*/
@GetMapping("/echarts")
public String echarts()
{
return prefix + "/echarts";
}
/**
* 图表插件
*/
@GetMapping("/peity")
public String peity()
{
return prefix + "/peity";
}
/**
* 线状图插件
*/
@GetMapping("/sparkline")
public String sparkline()
{
return prefix + "/sparkline";
}
/**
* 图表组合
*/
@GetMapping("/metrics")
public String metrics()
{
return prefix + "/metrics";
}
}

View File

@ -0,0 +1,846 @@
package com.ruoyi.web.controller.demo.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 表格相关
*
* @author ruoyi
*/
@Controller
@RequestMapping("/demo/table")
public class DemoTableController extends BaseController
{
private String prefix = "demo/table";
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
{
users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
}
private final static List<AreaModel> areas = new ArrayList<AreaModel>();
{
areas.add(new AreaModel(1, 0, "广东省", "440000", "GDS", "GuangDongSheng", 1));
areas.add(new AreaModel(2, 0, "湖南省", "430000", "HNS", "HuNanSheng", 1));
areas.add(new AreaModel(3, 0, "河南省", "410000", "HNS", "HeNanSheng", 0));
areas.add(new AreaModel(4, 0, "湖北省", "420000", "HBS", "HuBeiSheng", 0));
areas.add(new AreaModel(5, 0, "辽宁省", "210000", "LNS", "LiaoNingSheng", 0));
areas.add(new AreaModel(6, 0, "山东省", "370000", "SDS", "ShanDongSheng", 0));
areas.add(new AreaModel(7, 0, "陕西省", "610000", "SXS", "ShanXiSheng", 0));
areas.add(new AreaModel(8, 0, "贵州省", "520000", "GZS", "GuiZhouSheng", 0));
areas.add(new AreaModel(9, 0, "上海市", "310000", "SHS", "ShangHaiShi", 0));
areas.add(new AreaModel(10, 0, "重庆市", "500000", "CQS", "ChongQingShi", 0));
areas.add(new AreaModel(11, 0, "若依省", "666666", "YYS", "RuoYiSheng", 0));
areas.add(new AreaModel(12, 0, "安徽省", "340000", "AHS", "AnHuiSheng", 0));
areas.add(new AreaModel(13, 0, "福建省", "350000", "FJS", "FuJianSheng", 0));
areas.add(new AreaModel(14, 0, "海南省", "460000", "HNS", "HaiNanSheng", 0));
areas.add(new AreaModel(15, 0, "江苏省", "320000", "JSS", "JiangSuSheng", 0));
areas.add(new AreaModel(16, 0, "青海省", "630000", "QHS", "QingHaiSheng", 0));
areas.add(new AreaModel(17, 0, "广西壮族自治区", "450000", "GXZZZZQ", "GuangXiZhuangZuZiZhiQu", 0));
areas.add(new AreaModel(18, 0, "宁夏回族自治区", "640000", "NXHZZZQ", "NingXiaHuiZuZiZhiQu", 0));
areas.add(new AreaModel(19, 0, "内蒙古自治区", "150000", "NMGZZQ", "NeiMengGuZiZhiQu", 0));
areas.add(new AreaModel(20, 0, "新疆维吾尔自治区", "650000", "XJWWEZZQ", "XinJiangWeiWuErZiZhiQu", 0));
areas.add(new AreaModel(21, 0, "江西省", "360000", "JXS", "JiangXiSheng", 0));
areas.add(new AreaModel(22, 0, "浙江省", "330000", "ZJS", "ZheJiangSheng", 0));
areas.add(new AreaModel(23, 0, "河北省", "130000", "HBS", "HeBeiSheng", 0));
areas.add(new AreaModel(24, 0, "天津市", "120000", "TJS", "TianJinShi", 0));
areas.add(new AreaModel(25, 0, "山西省", "140000", "SXS", "ShanXiSheng", 0));
areas.add(new AreaModel(26, 0, "台湾省", "710000", "TWS", "TaiWanSheng", 0));
areas.add(new AreaModel(27, 0, "甘肃省", "620000", "GSS", "GanSuSheng", 0));
areas.add(new AreaModel(28, 0, "四川省", "510000", "SCS", "SiChuanSheng", 0));
areas.add(new AreaModel(29, 0, "云南省", "530000", "YNS", "YunNanSheng", 0));
areas.add(new AreaModel(30, 0, "北京市", "110000", "BJS", "BeiJingShi", 0));
areas.add(new AreaModel(31, 0, "香港特别行政区", "810000", "XGTBXZQ", "XiangGangTeBieXingZhengQu", 0));
areas.add(new AreaModel(32, 0, "澳门特别行政区", "820000", "AMTBXZQ", "AoMenTeBieXingZhengQu", 0));
areas.add(new AreaModel(100, 1, "深圳市", "440300", "SZS", "ShenZhenShi", 1));
areas.add(new AreaModel(101, 1, "广州市", "440100", "GZS", "GuangZhouShi", 0));
areas.add(new AreaModel(102, 1, "东莞市", "441900", "DGS", "DongGuanShi", 0));
areas.add(new AreaModel(103, 2, "长沙市", "410005", "CSS", "ChangShaShi", 1));
areas.add(new AreaModel(104, 2, "岳阳市", "414000", "YYS", "YueYangShi", 0));
areas.add(new AreaModel(1000, 100, "龙岗区", "518172", "LGQ", "LongGangQu", 0));
areas.add(new AreaModel(1001, 100, "南山区", "518051", "NSQ", "NanShanQu", 0));
areas.add(new AreaModel(1002, 100, "宝安区", "518101", "BAQ", "BaoAnQu", 0));
areas.add(new AreaModel(1003, 100, "福田区", "518081", "FTQ", "FuTianQu", 0));
areas.add(new AreaModel(1004, 103, "天心区", "410004", "TXQ", "TianXinQu", 0));
areas.add(new AreaModel(1005, 103, "开福区", "410008", "KFQ", "KaiFuQu", 0));
areas.add(new AreaModel(1006, 103, "芙蓉区", "410011", "FRQ", "FuRongQu", 0));
areas.add(new AreaModel(1007, 103, "雨花区", "410011", "YHQ", "YuHuaQu", 0));
}
private final static List<UserTableColumn> columns = new ArrayList<UserTableColumn>();
{
columns.add(new UserTableColumn("用户ID", "userId"));
columns.add(new UserTableColumn("用户编号", "userCode"));
columns.add(new UserTableColumn("用户姓名", "userName"));
columns.add(new UserTableColumn("用户手机", "userPhone"));
columns.add(new UserTableColumn("用户邮箱", "userEmail"));
columns.add(new UserTableColumn("用户状态", "status"));
}
/**
* 搜索相关
*/
@GetMapping("/search")
public String search()
{
return prefix + "/search";
}
/**
* 数据汇总
*/
@GetMapping("/footer")
public String footer()
{
return prefix + "/footer";
}
/**
* 组合表头
*/
@GetMapping("/groupHeader")
public String groupHeader()
{
return prefix + "/groupHeader";
}
/**
* 表格导出
*/
@GetMapping("/export")
public String export()
{
return prefix + "/export";
}
/**
* 表格导出选择列
*/
@GetMapping("/exportSelected")
public String exportSelected()
{
return prefix + "/exportSelected";
}
/**
* 导出数据
*/
@PostMapping("/exportData")
@ResponseBody
public AjaxResult exportSelected(UserTableModel userModel, String userIds)
{
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
Collections.copy(userList, users);
// 条件过滤
if (StringUtils.isNotEmpty(userIds))
{
userList.clear();
for (Long userId : Convert.toLongArray(userIds))
{
for (UserTableModel user : users)
{
if (user.getUserId() == userId)
{
userList.add(user);
}
}
}
}
ExcelUtil<UserTableModel> util = new ExcelUtil<UserTableModel>(UserTableModel.class);
return util.exportExcel(userList, "用户数据");
}
/**
* 翻页记住选择
*/
@GetMapping("/remember")
public String remember()
{
return prefix + "/remember";
}
/**
* 跳转至指定页
*/
@GetMapping("/pageGo")
public String pageGo()
{
return prefix + "/pageGo";
}
/**
* 自定义查询参数
*/
@GetMapping("/params")
public String params()
{
return prefix + "/params";
}
/**
* 多表格
*/
@GetMapping("/multi")
public String multi()
{
return prefix + "/multi";
}
/**
* 点击按钮加载表格
*/
@GetMapping("/button")
public String button()
{
return prefix + "/button";
}
/**
* 直接加载表格数据
*/
@GetMapping("/data")
public String data(ModelMap mmap)
{
mmap.put("users", users);
return prefix + "/data";
}
/**
* 表格冻结列
*/
@GetMapping("/fixedColumns")
public String fixedColumns()
{
return prefix + "/fixedColumns";
}
/**
* 自定义触发事件
*/
@GetMapping("/event")
public String event()
{
return prefix + "/event";
}
/**
* 表格细节视图
*/
@GetMapping("/detail")
public String detail()
{
return prefix + "/detail";
}
/**
* 表格父子视图
*/
@GetMapping("/child")
public String child()
{
return prefix + "/child";
}
/**
* 表格图片预览
*/
@GetMapping("/image")
public String image()
{
return prefix + "/image";
}
/**
* 动态增删改查
*/
@GetMapping("/curd")
public String curd()
{
return prefix + "/curd";
}
/**
* 表格行拖拽操作
*/
@GetMapping("/reorderRows")
public String reorderRows()
{
return prefix + "/reorderRows";
}
/**
* 表格列拖拽操作
*/
@GetMapping("/reorderColumns")
public String reorderColumns()
{
return prefix + "/reorderColumns";
}
/**
* 表格列宽拖动
*/
@GetMapping("/resizable")
public String resizable()
{
return prefix + "/resizable";
}
/**
* 表格行内编辑操作
*/
@GetMapping("/editable")
public String editable()
{
return prefix + "/editable";
}
/**
* 主子表提交
*/
@GetMapping("/subdata")
public String subdata()
{
return prefix + "/subdata";
}
/**
* 表格自动刷新
*/
@GetMapping("/refresh")
public String refresh()
{
return prefix + "/refresh";
}
/**
* 表格打印配置
*/
@GetMapping("/print")
public String print()
{
return prefix + "/print";
}
/**
* 表格标题格式化
*/
@GetMapping("/headerStyle")
public String headerStyle()
{
return prefix + "/headerStyle";
}
/**
* 表格动态列
*/
@GetMapping("/dynamicColumns")
public String dynamicColumns()
{
return prefix + "/dynamicColumns";
}
/**
* 自定义视图分页
*/
@GetMapping("/customView")
public String customView()
{
return prefix + "/customView";
}
/**
* 异步加载表格树
*/
@GetMapping("/asynTree")
public String asynTree()
{
return prefix + "/asynTree";
}
/**
* 表格其他操作
*/
@GetMapping("/other")
public String other()
{
return prefix + "/other";
}
/**
* 动态获取列
*/
@PostMapping("/ajaxColumns")
@ResponseBody
public AjaxResult ajaxColumns(UserTableColumn userColumn)
{
List<UserTableColumn> columnList = new ArrayList<UserTableColumn>(Arrays.asList(new UserTableColumn[columns.size()]));
Collections.copy(columnList, columns);
if (userColumn != null && "userBalance".equals(userColumn.getField()))
{
columnList.add(new UserTableColumn("用户余额", "userBalance"));
}
return AjaxResult.success(columnList);
}
/**
* 查询数据
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(UserTableModel userModel)
{
TableDataInfo rspData = new TableDataInfo();
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
Collections.copy(userList, users);
// 查询条件过滤
if (StringUtils.isNotEmpty(userModel.getUserName()))
{
userList.clear();
for (UserTableModel user : users)
{
if (user.getUserName().equals(userModel.getUserName()))
{
userList.add(user);
}
}
}
PageDomain pageDomain = TableSupport.buildPageRequest();
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
{
rspData.setRows(userList);
rspData.setTotal(userList.size());
return rspData;
}
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
Integer pageSize = pageDomain.getPageNum() * 10;
if (pageSize > userList.size())
{
pageSize = userList.size();
}
rspData.setRows(userList.subList(pageNum, pageSize));
rspData.setTotal(userList.size());
return rspData;
}
/**
* 查询树表数据
*/
@PostMapping("/tree/list")
@ResponseBody
public TableDataInfo treeList(AreaModel areaModel)
{
TableDataInfo rspData = new TableDataInfo();
List<AreaModel> areaList = new ArrayList<AreaModel>(Arrays.asList(new AreaModel[areas.size()]));
// 默认查询条件 parentId 0
Collections.copy(areaList, areas);
areaList.clear();
if (StringUtils.isNotEmpty(areaModel.getAreaName()))
{
for (AreaModel area : areas)
{
if (area.getParentId() == 0 && area.getAreaName().equals(areaModel.getAreaName()))
{
areaList.add(area);
}
}
}
else
{
for (AreaModel area : areas)
{
if (area.getParentId() == 0)
{
areaList.add(area);
}
}
}
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
Integer pageSize = pageDomain.getPageNum() * 10;
if (pageSize > areaList.size())
{
pageSize = areaList.size();
}
rspData.setRows(areaList.subList(pageNum, pageSize));
rspData.setTotal(areaList.size());
return rspData;
}
/**
* 查询树表子节点数据
*/
@PostMapping("/tree/listChild")
@ResponseBody
public List<AreaModel> listChild(AreaModel areaModel)
{
List<AreaModel> areaList = new ArrayList<AreaModel>(Arrays.asList(new AreaModel[areas.size()]));
// 查询条件 parentId
Collections.copy(areaList, areas);
areaList.clear();
if (StringUtils.isNotEmpty(areaModel.getAreaName()))
{
for (AreaModel area : areas)
{
if (area.getParentId().intValue() == areaModel.getParentId().intValue() && area.getAreaName().equals(areaModel.getAreaName()))
{
areaList.add(area);
}
}
}
else
{
for (AreaModel area : areas)
{
if (area.getParentId().intValue() == areaModel.getParentId().intValue())
{
areaList.add(area);
}
}
}
return areaList;
}
}
class UserTableColumn
{
/** 表头 */
private String title;
/** 字段 */
private String field;
public UserTableColumn()
{
}
public UserTableColumn(String title, String field)
{
this.title = title;
this.field = field;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getField()
{
return field;
}
public void setField(String field)
{
this.field = field;
}
}
class UserTableModel
{
/** 用户ID */
private int userId;
/** 用户编号 */
@Excel(name = "用户编号", cellType = ColumnType.NUMERIC)
private String userCode;
/** 用户姓名 */
@Excel(name = "用户姓名")
private String userName;
/** 用户性别 */
private String userSex;
/** 用户手机 */
@Excel(name = "用户手机")
private String userPhone;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String userEmail;
/** 用户余额 */
@Excel(name = "用户余额", cellType = ColumnType.NUMERIC)
private double userBalance;
/** 用户状态0正常 1停用 */
private String status;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
public UserTableModel()
{
}
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
String userEmail, double userBalance, String status)
{
this.userId = userId;
this.userCode = userCode;
this.userName = userName;
this.userSex = userSex;
this.userPhone = userPhone;
this.userEmail = userEmail;
this.userBalance = userBalance;
this.status = status;
this.createTime = DateUtils.getNowDate();
}
public int getUserId()
{
return userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
public String getUserCode()
{
return userCode;
}
public void setUserCode(String userCode)
{
this.userCode = userCode;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserSex()
{
return userSex;
}
public void setUserSex(String userSex)
{
this.userSex = userSex;
}
public String getUserPhone()
{
return userPhone;
}
public void setUserPhone(String userPhone)
{
this.userPhone = userPhone;
}
public String getUserEmail()
{
return userEmail;
}
public void setUserEmail(String userEmail)
{
this.userEmail = userEmail;
}
public double getUserBalance()
{
return userBalance;
}
public void setUserBalance(double userBalance)
{
this.userBalance = userBalance;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
}
class AreaModel
{
/** 编号 */
private Long id;
/** 父编号 */
private Long parentId;
/** 区域名称 */
private String areaName;
/** 区域代码 */
private String areaCode;
/** 名称首字母 */
private String simplePy;
/** 名称全拼 */
private String pinYin;
/** 是否有子节点0无 1有 */
private Integer isTreeLeaf = 1;
public AreaModel()
{
}
public AreaModel(int id, int parentId, String areaName, String areaCode, String simplePy, String pinYin, Integer isTreeLeaf)
{
this.id = Long.valueOf(id);
this.parentId = Long.valueOf(parentId);
this.areaName = areaName;
this.areaCode = areaCode;
this.simplePy = simplePy;
this.pinYin = pinYin;
this.isTreeLeaf = isTreeLeaf;
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public String getAreaName()
{
return areaName;
}
public void setAreaName(String areaName)
{
this.areaName = areaName;
}
public String getAreaCode()
{
return areaCode;
}
public void setAreaCode(String areaCode)
{
this.areaCode = areaCode;
}
public String getSimplePy()
{
return simplePy;
}
public void setSimplePy(String simplePy)
{
this.simplePy = simplePy;
}
public String getPinYin()
{
return pinYin;
}
public void setPinYin(String pinYin)
{
this.pinYin = pinYin;
}
public Integer getIsTreeLeaf()
{
return isTreeLeaf;
}
public void setIsTreeLeaf(Integer isTreeLeaf)
{
this.isTreeLeaf = isTreeLeaf;
}
}

View File

@ -0,0 +1,116 @@
package com.ruoyi.web.controller.demo.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 客户测试信息
*
* @author ruoyi
*/
public class CustomerModel
{
/**
* 客户姓名
*/
private String name;
/**
* 客户手机
*/
private String phonenumber;
/**
* 客户性别
*/
private String sex;
/**
* 客户生日
*/
private String birthday;
/**
* 客户描述
*/
private String remark;
/**
* 商品信息
*/
private List<GoodsModel> goods;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getPhonenumber()
{
return phonenumber;
}
public void setPhonenumber(String phonenumber)
{
this.phonenumber = phonenumber;
}
public String getSex()
{
return sex;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getBirthday()
{
return birthday;
}
public void setBirthday(String birthday)
{
this.birthday = birthday;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
public List<GoodsModel> getGoods()
{
return goods;
}
public void setGoods(List<GoodsModel> goods)
{
this.goods = goods;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName())
.append("phonenumber", getPhonenumber())
.append("sex", getSex())
.append("birthday", getBirthday())
.append("goods", getGoods())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.web.controller.demo.domain;
import java.util.Date;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 商品测试信息
*
* @author ruoyi
*/
public class GoodsModel
{
/**
* 商品名称
*/
private String name;
/**
* 商品重量
*/
private Integer weight;
/**
* 商品价格
*/
private Double price;
/**
* 商品日期
*/
private Date date;
/**
* 商品种类
*/
private String type;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public Integer getWeight()
{
return weight;
}
public void setWeight(Integer weight)
{
this.weight = weight;
}
public Double getPrice()
{
return price;
}
public void setPrice(Double price)
{
this.price = price;
}
public Date getDate()
{
return date;
}
public void setDate(Date date)
{
this.date = date;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName())
.append("weight", getWeight())
.append("price", getPrice())
.append("date", getDate())
.append("type", getType())
.toString();
}
}

View File

@ -0,0 +1,149 @@
package com.ruoyi.web.controller.demo.domain;
import java.util.Date;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.DateUtils;
public class UserOperateModel extends BaseEntity
{
private static final long serialVersionUID = 1L;
private int userId;
@Excel(name = "用户编号")
private String userCode;
@Excel(name = "用户姓名")
private String userName;
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String userSex;
@Excel(name = "用户手机")
private String userPhone;
@Excel(name = "用户邮箱")
private String userEmail;
@Excel(name = "用户余额")
private double userBalance;
@Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
private String status;
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date createTime;
public UserOperateModel()
{
}
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
String userEmail, double userBalance, String status)
{
this.userId = userId;
this.userCode = userCode;
this.userName = userName;
this.userSex = userSex;
this.userPhone = userPhone;
this.userEmail = userEmail;
this.userBalance = userBalance;
this.status = status;
this.createTime = DateUtils.getNowDate();
}
public int getUserId()
{
return userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
public String getUserCode()
{
return userCode;
}
public void setUserCode(String userCode)
{
this.userCode = userCode;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserSex()
{
return userSex;
}
public void setUserSex(String userSex)
{
this.userSex = userSex;
}
public String getUserPhone()
{
return userPhone;
}
public void setUserPhone(String userPhone)
{
this.userPhone = userPhone;
}
public String getUserEmail()
{
return userEmail;
}
public void setUserEmail(String userEmail)
{
this.userEmail = userEmail;
}
public double getUserBalance()
{
return userBalance;
}
public void setUserBalance(double userBalance)
{
this.userBalance = userBalance;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Override
public Date getCreateTime()
{
return createTime;
}
@Override
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
}

View File

@ -0,0 +1,90 @@
package com.ruoyi.web.controller.monitor;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.service.CacheService;
/**
* 缓存监控
*
* @author ruoyi
*/
@Controller
@RequestMapping("/monitor/cache")
public class CacheController extends BaseController
{
private String prefix = "monitor/cache";
@Autowired
private CacheService cacheService;
@RequiresPermissions("monitor:cache:view")
@GetMapping()
public String cache(ModelMap mmap)
{
mmap.put("cacheNames", cacheService.getCacheNames());
return prefix + "/cache";
}
@RequiresPermissions("monitor:cache:view")
@PostMapping("/getNames")
public String getCacheNames(String fragment, ModelMap mmap)
{
mmap.put("cacheNames", cacheService.getCacheNames());
return prefix + "/cache::" + fragment;
}
@RequiresPermissions("monitor:cache:view")
@PostMapping("/getKeys")
public String getCacheKeys(String fragment, String cacheName, ModelMap mmap)
{
mmap.put("cacheName", cacheName);
mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName));
return prefix + "/cache::" + fragment;
}
@RequiresPermissions("monitor:cache:view")
@PostMapping("/getValue")
public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap)
{
mmap.put("cacheName", cacheName);
mmap.put("cacheKey", cacheKey);
mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey));
return prefix + "/cache::" + fragment;
}
@RequiresPermissions("monitor:cache:view")
@PostMapping("/clearCacheName")
@ResponseBody
public AjaxResult clearCacheName(String cacheName, ModelMap mmap)
{
cacheService.clearCacheName(cacheName);
return AjaxResult.success();
}
@RequiresPermissions("monitor:cache:view")
@PostMapping("/clearCacheKey")
@ResponseBody
public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap)
{
cacheService.clearCacheKey(cacheName, cacheKey);
return AjaxResult.success();
}
@RequiresPermissions("monitor:cache:view")
@GetMapping("/clearAll")
@ResponseBody
public AjaxResult clearAll(ModelMap mmap)
{
cacheService.clearAll();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.web.controller.monitor;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
/**
* druid 监控
*
* @author ruoyi
*/
@Controller
@RequestMapping("/monitor/data")
public class DruidController extends BaseController
{
private String prefix = "/druid";
@RequiresPermissions("monitor:data:view")
@GetMapping()
public String index()
{
return redirect(prefix + "/index.html");
}
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.web.controller.monitor;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.web.domain.Server;
/**
* 服务器监控
*
* @author ruoyi
*/
@Controller
@RequestMapping("/monitor/server")
public class ServerController extends BaseController
{
private String prefix = "monitor/server";
@RequiresPermissions("monitor:server:view")
@GetMapping()
public String server(ModelMap mmap) throws Exception
{
Server server = new Server();
server.copyTo();
mmap.put("server", server);
return prefix + "/server";
}
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService;
/**
* 系统访问记录
*
* @author ruoyi
*/
@Controller
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{
private String prefix = "monitor/logininfor";
@Autowired
private ISysLogininforService logininforService;
@Autowired
private SysPasswordService passwordService;
@RequiresPermissions("monitor:logininfor:view")
@GetMapping()
public String logininfor()
{
return prefix + "/logininfor";
}
@RequiresPermissions("monitor:logininfor:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:logininfor:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
return util.exportExcel(list, "登录日志");
}
@RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(logininforService.deleteLogininforByIds(ids));
}
@RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@PostMapping("/clean")
@ResponseBody
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return success();
}
@RequiresPermissions("monitor:logininfor:unlock")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@PostMapping("/unlock")
@ResponseBody
public AjaxResult unlock(String loginName)
{
passwordService.clearLoginRecordCache(loginName);
return success();
}
}

View File

@ -0,0 +1,90 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService;
/**
* 操作日志记录
*
* @author ruoyi
*/
@Controller
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{
private String prefix = "monitor/operlog";
@Autowired
private ISysOperLogService operLogService;
@RequiresPermissions("monitor:operlog:view")
@GetMapping()
public String operlog()
{
return prefix + "/operlog";
}
@RequiresPermissions("monitor:operlog:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:operlog:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
return util.exportExcel(list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:operlog:remove")
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(operLogService.deleteOperLogByIds(ids));
}
@RequiresPermissions("monitor:operlog:detail")
@GetMapping("/detail/{operId}")
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
{
mmap.put("operLog", operLogService.selectOperLogById(operId));
return prefix + "/detail";
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:operlog:remove")
@PostMapping("/clean")
@ResponseBody
public AjaxResult clean()
{
operLogService.cleanOperLog();
return success();
}
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OnlineStatus;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.framework.shiro.session.OnlineSession;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService;
/**
* 在线用户监控
*
* @author ruoyi
*/
@Controller
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
private String prefix = "monitor/online";
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private OnlineSessionDAO onlineSessionDAO;
@RequiresPermissions("monitor:online:view")
@GetMapping()
public String online()
{
return prefix + "/online";
}
@RequiresPermissions("monitor:online:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysUserOnline userOnline)
{
startPage();
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
return getDataTable(list);
}
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@PostMapping("/batchForceLogout")
@ResponseBody
public AjaxResult batchForceLogout(String ids)
{
for (String sessionId : Convert.toStrArray(ids))
{
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
if (online == null)
{
return error("用户已下线");
}
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
if (onlineSession == null)
{
return error("用户已下线");
}
if (sessionId.equals(ShiroUtils.getSessionId()))
{
return error("当前登录用户无法强退");
}
onlineSessionDAO.delete(onlineSession);
online.setStatus(OnlineStatus.off_line);
userOnlineService.saveOnline(online);
userOnlineService.removeUserCache(online.getLoginName(), sessionId);
}
return success();
}
}

View File

@ -0,0 +1,92 @@
package com.ruoyi.web.controller.system;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
import com.ruoyi.common.core.controller.BaseController;
/**
* 图片验证码支持算术形式
*
* @author ruoyi
*/
@Controller
@RequestMapping("/captcha")
public class SysCaptchaController extends BaseController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
/**
* 验证码生成
*/
@GetMapping(value = "/captchaImage")
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
{
ServletOutputStream out = null;
try
{
HttpSession session = request.getSession();
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
response.setContentType("image/jpeg");
String type = request.getParameter("type");
String capStr = null;
String code = null;
BufferedImage bi = null;
if ("math".equals(type))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
bi = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(type))
{
capStr = code = captchaProducer.createText();
bi = captchaProducer.createImage(capStr);
}
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
out = response.getOutputStream();
ImageIO.write(bi, "jpg", out);
out.flush();
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if (out != null)
{
out.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
return null;
}
}

View File

@ -0,0 +1,159 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
/**
* 参数配置 信息操作处理
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{
private String prefix = "system/config";
@Autowired
private ISysConfigService configService;
@RequiresPermissions("system:config:view")
@GetMapping()
public String config()
{
return prefix + "/config";
}
/**
* 查询参数配置列表
*/
@RequiresPermissions("system:config:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysConfig config)
{
startPage();
config.setWmsType("0");
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:config:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据");
}
/**
* 新增参数配置
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存参数配置
*/
@RequiresPermissions("system:config:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysConfig config)
{
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getLoginName());
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@RequiresPermissions("system:config:edit")
@GetMapping("/edit/{configId}")
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
{
mmap.put("config", configService.selectConfigById(configId));
return prefix + "/edit";
}
/**
* 修改保存参数配置
*/
@RequiresPermissions("system:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysConfig config)
{
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getLoginName());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
configService.deleteConfigByIds(ids);
return success();
}
/**
* 刷新参数缓存
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@GetMapping("/refreshCache")
@ResponseBody
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return success();
}
/**
* 校验参数键名
*/
@PostMapping("/checkConfigKeyUnique")
@ResponseBody
public String checkConfigKeyUnique(SysConfig config)
{
return configService.checkConfigKeyUnique(config);
}
}

View File

@ -0,0 +1,210 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
/**
* 部门信息
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
private String prefix = "system/dept";
@Autowired
private ISysDeptService deptService;
@RequiresPermissions("system:dept:view")
@GetMapping()
public String dept()
{
return prefix + "/dept";
}
@RequiresPermissions("system:dept:list")
@PostMapping("/list")
@ResponseBody
public List<SysDept> list(SysDept dept)
{
List<SysDept> deptList = deptService.selectDeptList(dept);
return deptList;
}
/**
* 新增部门
*/
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
if (!getSysUser().isAdmin())
{
parentId = getSysUser().getDeptId();
}
mmap.put("dept", deptService.selectDeptById(parentId));
return prefix + "/add";
}
/**
* 新增保存部门
*/
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dept:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysDept dept)
{
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(getLoginName());
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@RequiresPermissions("system:dept:edit")
@GetMapping("/edit/{deptId}")
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
{
deptService.checkDeptDataScope(deptId);
SysDept dept = deptService.selectDeptById(deptId);
if (StringUtils.isNotNull(dept) && 100L == deptId)
{
dept.setParentName("");
}
mmap.put("dept", dept);
return prefix + "/edit";
}
/**
* 修改保存部门
*/
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dept:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysDept dept)
{
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(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 AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(getLoginName());
return toAjax(deptService.updateDept(dept));
}
/**
* 删除
*/
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dept:remove")
@GetMapping("/remove/{deptId}")
@ResponseBody
public AjaxResult remove(@PathVariable("deptId") Long deptId)
{
if (deptService.selectDeptCount(deptId) > 0)
{
return AjaxResult.warn("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return AjaxResult.warn("部门存在用户,不允许删除");
}
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
/**
* 校验部门名称
*/
@PostMapping("/checkDeptNameUnique")
@ResponseBody
public String checkDeptNameUnique(SysDept dept)
{
return deptService.checkDeptNameUnique(dept);
}
/**
* 选择部门树
*
* @param deptId 部门ID
* @param excludeId 排除ID
*/
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
public String selectDeptTree(@PathVariable("deptId") Long deptId,
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
{
mmap.put("dept", deptService.selectDeptById(deptId));
mmap.put("excludeId", excludeId);
return prefix + "/tree";
}
/**
* 加载部门列表树
*/
@GetMapping("/treeData")
@ResponseBody
public List<Ztree> treeData()
{
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
return ztrees;
}
/**
* 加载部门列表树排除下级
*/
@GetMapping("/treeData/{excludeId}")
@ResponseBody
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
{
SysDept dept = new SysDept();
dept.setExcludeId(excludeId);
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
return ztrees;
}
/**
* 加载角色部门数据权限列表树
*/
@GetMapping("/roleDeptTreeData")
@ResponseBody
public List<Ztree> deptTreeData(SysRole role)
{
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
return ztrees;
}
}

View File

@ -0,0 +1,121 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
{
private String prefix = "system/dict/data";
@Autowired
private ISysDictDataService dictDataService;
@RequiresPermissions("system:dict:view")
@GetMapping()
public String dictData()
{
return prefix + "/data";
}
@PostMapping("/list")
@RequiresPermissions("system:dict:list")
@ResponseBody
public TableDataInfo list(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据");
}
/**
* 新增字典类型
*/
@GetMapping("/add/{dictType}")
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
{
mmap.put("dictType", dictType);
return prefix + "/add";
}
/**
* 新增保存字典类型
*/
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysDictData dict)
{
dict.setCreateBy(getLoginName());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改字典类型
*/
@RequiresPermissions("system:dict:edit")
@GetMapping("/edit/{dictCode}")
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
{
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
return prefix + "/edit";
}
/**
* 修改保存字典类型
*/
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysDictData dict)
{
dict.setUpdateBy(getLoginName());
return toAjax(dictDataService.updateDictData(dict));
}
@Log(title = "字典数据", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dict:remove")
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
dictDataService.deleteDictDataByIds(ids);
return success();
}
}

View File

@ -0,0 +1,189 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/dict")
public class SysDictTypeController extends BaseController
{
private String prefix = "system/dict/type";
@Autowired
private ISysDictTypeService dictTypeService;
@RequiresPermissions("system:dict:view")
@GetMapping()
public String dictType()
{
return prefix + "/type";
}
@PostMapping("/list")
@RequiresPermissions("system:dict:list")
@ResponseBody
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型");
}
/**
* 新增字典类型
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysDictType dict)
{
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(getLoginName());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@RequiresPermissions("system:dict:edit")
@GetMapping("/edit/{dictId}")
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
{
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
return prefix + "/edit";
}
/**
* 修改保存字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysDictType dict)
{
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(getLoginName());
return toAjax(dictTypeService.updateDictType(dict));
}
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dict:remove")
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
dictTypeService.deleteDictTypeByIds(ids);
return success();
}
/**
* 刷新字典缓存
*/
@RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@GetMapping("/refreshCache")
@ResponseBody
public AjaxResult refreshCache()
{
dictTypeService.resetDictCache();
return success();
}
/**
* 查询字典详细
*/
@RequiresPermissions("system:dict:list")
@GetMapping("/detail/{dictId}")
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
{
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
mmap.put("dictList", dictTypeService.selectDictTypeAll());
return "system/dict/data/data";
}
/**
* 校验字典类型
*/
@PostMapping("/checkDictTypeUnique")
@ResponseBody
public String checkDictTypeUnique(SysDictType dictType)
{
return dictTypeService.checkDictTypeUnique(dictType);
}
/**
* 选择字典树
*/
@GetMapping("/selectDictTree/{columnId}/{dictType}")
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
ModelMap mmap)
{
mmap.put("columnId", columnId);
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
return prefix + "/tree";
}
/**
* 加载字典列表树
*/
@GetMapping("/treeData")
@ResponseBody
public List<Ztree> treeData()
{
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
return ztrees;
}
}

View File

@ -0,0 +1,183 @@
package com.ruoyi.web.controller.system;
import java.util.Date;
import java.util.List;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.enums.LoginType;
import com.ruoyi.common.utils.*;
import com.ruoyi.framework.shiro.UserToken;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.ResponseBody;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysMenuService;
/**
* 首页 业务处理
*
* @author ruoyi
*/
@Controller
public class SysIndexController extends BaseController
{
@Autowired
private ISysMenuService menuService;
@Autowired
private ISysConfigService configService;
@Autowired
private SysPasswordService passwordService;
// 系统首页
@GetMapping("/index")
public String index(ModelMap mmap)
{
// 取身份信息
SysUser user = getSysUser();
// 根据用户id取出菜单
List<SysMenu> menus = menuService.selectMenusByUser(user);
mmap.put("menus", menus);
mmap.put("user", user);
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
Boolean footer = Convert.toBool(configService.selectConfigByKey("sys.index.footer"), true);
Boolean tagsView = Convert.toBool(configService.selectConfigByKey("sys.index.tagsView"), true);
mmap.put("footer", footer);
mmap.put("tagsView", tagsView);
mmap.put("mainClass", contentMainClass(footer, tagsView));
mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear());
mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled());
mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")));
// 菜单导航显示风格
String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");
// 移动端默认使左侧导航菜单否则取默认配置
String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
// 优先Cookie配置导航菜单
Cookie[] cookies = ServletUtils.getRequest().getCookies();
for (Cookie cookie : cookies)
{
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName()))
{
indexStyle = cookie.getValue();
break;
}
}
String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index";
return webIndex;
}
// 锁定屏幕
@GetMapping("/lockscreen")
public String lockscreen(ModelMap mmap)
{
mmap.put("user", getSysUser());
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
return "lock";
}
// 解锁屏幕
@PostMapping("/unlockscreen")
@ResponseBody
public AjaxResult unlockscreen(String password) {
SysUser user = getSysUser();
if (StringUtils.isNull(user))
{
return AjaxResult.error("服务器超时,请重新登录");
}
if (passwordService.matches(user, password))
{
ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
return AjaxResult.success();
}
return AjaxResult.error("密码不正确,请重新输入。");
}
// 切换主题
@GetMapping("/system/switchSkin")
public String switchSkin()
{
return "skin";
}
// 切换菜单
@GetMapping("/system/menuStyle/{style}")
public void menuStyle(@PathVariable String style, HttpServletResponse response)
{
CookieUtils.setCookie(response, "nav-style", style);
}
// 系统介绍
@GetMapping("/system/main")
public String main(ModelMap mmap)
{
SysUser sysUser = ShiroUtils.getCurrentUser();
mmap.put("sysUser", sysUser);
mmap.put("version", RuoYiConfig.getVersion());
// return "business/ongoodsshelf/ongoodsshelf";
return "business/ongoodsshelf/ongoodsshelf";
}
// content-main class
public String contentMainClass(Boolean footer, Boolean tagsView)
{
if (!footer && !tagsView)
{
return "tagsview-footer-hide";
}
else if (!footer)
{
return "footer-hide";
}
else if (!tagsView)
{
return "tagsview-hide";
}
return StringUtils.EMPTY;
}
// 检查初始密码是否提醒修改
public boolean initPasswordIsModify(Date pwdUpdateDate)
{
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
}
// 检查密码是否过期
public boolean passwordIsExpiration(Date pwdUpdateDate)
{
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
if (passwordValidateDays != null && passwordValidateDays > 0)
{
if (StringUtils.isNull(pwdUpdateDate))
{
// 如果从未修改过初始密码直接提醒过期
return true;
}
Date nowDate = DateUtils.getNowDate();
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
package com.ruoyi.web.controller.system;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.enums.LoginType;
import com.ruoyi.framework.shiro.UserToken;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.ConfigService;
/**
* 登录验证
*
* @author ruoyi
*/
@Controller
public class SysLoginController extends BaseController
{
/**
* 是否开启记住我功能
*/
@Value("${shiro.rememberMe.enabled: false}")
private boolean rememberMe;
@Autowired
private ConfigService configService;
@GetMapping("/login")
public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap)
{
// 如果是Ajax请求返回Json字符串
if (ServletUtils.isAjaxRequest(request))
{
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
}
// 是否开启记住我
mmap.put("isRemembered", rememberMe);
// 是否开启用户注册
mmap.put("isAllowRegister", Convert.toBool(configService.getKey("sys.account.registerUser"), false));
return "login";
}
@PostMapping("/login")
@ResponseBody
public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe)
{
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
Subject subject = SecurityUtils.getSubject();
try
{
subject.login(token);
return success();
}
catch (AuthenticationException e)
{
String msg = "用户或密码错误";
if (StringUtils.isNotEmpty(e.getMessage()))
{
msg = e.getMessage();
}
return error(msg);
}
}
@GetMapping("/unauth")
public String unauth()
{
return "error/unauth";
}
}

View File

@ -0,0 +1,198 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
import com.ruoyi.system.service.ISysMenuService;
/**
* 菜单信息
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController
{
private String prefix = "system/menu";
@Autowired
private ISysMenuService menuService;
@RequiresPermissions("system:menu:view")
@GetMapping()
public String menu()
{
return prefix + "/menu";
}
@RequiresPermissions("system:menu:list")
@PostMapping("/list")
@ResponseBody
public List<SysMenu> list(SysMenu menu)
{
Long userId = ShiroUtils.getUserId();
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
return menuList;
}
/**
* 删除菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:menu:remove")
@GetMapping("/remove/{menuId}")
@ResponseBody
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
if (menuService.selectCountMenuByParentId(menuId) > 0)
{
return AjaxResult.warn("存在子菜单,不允许删除");
}
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
{
return AjaxResult.warn("菜单已分配,不允许删除");
}
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.deleteMenuById(menuId));
}
/**
* 新增
*/
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
SysMenu menu = null;
if (0L != parentId)
{
menu = menuService.selectMenuById(parentId);
}
else
{
menu = new SysMenu();
menu.setMenuId(0L);
menu.setMenuName("主目录");
}
mmap.put("menu", menu);
return prefix + "/add";
}
/**
* 新增保存菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@RequiresPermissions("system:menu:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysMenu menu)
{
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
menu.setCreateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@RequiresPermissions("system:menu:edit")
@GetMapping("/edit/{menuId}")
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
{
mmap.put("menu", menuService.selectMenuById(menuId));
return prefix + "/edit";
}
/**
* 修改保存菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:menu:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysMenu menu)
{
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
menu.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.updateMenu(menu));
}
/**
* 选择菜单图标
*/
@GetMapping("/icon")
public String icon()
{
return prefix + "/icon";
}
/**
* 校验菜单名称
*/
@PostMapping("/checkMenuNameUnique")
@ResponseBody
public String checkMenuNameUnique(SysMenu menu)
{
return menuService.checkMenuNameUnique(menu);
}
/**
* 加载角色菜单列表树
*/
@GetMapping("/roleMenuTreeData")
@ResponseBody
public List<Ztree> roleMenuTreeData(SysRole role)
{
Long userId = ShiroUtils.getUserId();
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
return ztrees;
}
/**
* 加载所有菜单列表树
*/
@GetMapping("/menuTreeData")
@ResponseBody
public List<Ztree> menuTreeData()
{
Long userId = ShiroUtils.getUserId();
List<Ztree> ztrees = menuService.menuTreeData(userId);
return ztrees;
}
/**
* 选择菜单树
*/
@GetMapping("/selectMenuTree/{menuId}")
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
{
mmap.put("menu", menuService.selectMenuById(menuId));
return prefix + "/tree";
}
}

View File

@ -0,0 +1,113 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
/**
* 公告 信息操作处理
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
{
private String prefix = "system/notice";
@Autowired
private ISysNoticeService noticeService;
@RequiresPermissions("system:notice:view")
@GetMapping()
public String notice()
{
return prefix + "/notice";
}
/**
* 查询公告列表
*/
@RequiresPermissions("system:notice:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
* 新增公告
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存公告
*/
@RequiresPermissions("system:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysNotice notice)
{
notice.setCreateBy(getLoginName());
return toAjax(noticeService.insertNotice(notice));
}
/**
* 修改公告
*/
@RequiresPermissions("system:notice:edit")
@GetMapping("/edit/{noticeId}")
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
{
mmap.put("notice", noticeService.selectNoticeById(noticeId));
return prefix + "/edit";
}
/**
* 修改保存公告
*/
@RequiresPermissions("system:notice:edit")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysNotice notice)
{
notice.setUpdateBy(getLoginName());
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除公告
*/
@RequiresPermissions("system:notice:remove")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(noticeService.deleteNoticeByIds(ids));
}
}

View File

@ -0,0 +1,163 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
/**
* 岗位信息操作处理
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/post")
public class SysPostController extends BaseController
{
private String prefix = "system/post";
@Autowired
private ISysPostService postService;
@RequiresPermissions("system:post:view")
@GetMapping()
public String operlog()
{
return prefix + "/post";
}
@RequiresPermissions("system:post:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:post:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
return util.exportExcel(list, "岗位数据");
}
@RequiresPermissions("system:post:remove")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
try
{
return toAjax(postService.deletePostByIds(ids));
}
catch (Exception e)
{
return error(e.getMessage());
}
}
/**
* 新增岗位
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存岗位
*/
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysPost post)
{
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(getLoginName());
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@RequiresPermissions("system:post:edit")
@GetMapping("/edit/{postId}")
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
{
mmap.put("post", postService.selectPostById(postId));
return prefix + "/edit";
}
/**
* 修改保存岗位
*/
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysPost post)
{
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(getLoginName());
return toAjax(postService.updatePost(post));
}
/**
* 校验岗位名称
*/
@PostMapping("/checkPostNameUnique")
@ResponseBody
public String checkPostNameUnique(SysPost post)
{
return postService.checkPostNameUnique(post);
}
/**
* 校验岗位编码
*/
@PostMapping("/checkPostCodeUnique")
@ResponseBody
public String checkPostCodeUnique(SysPost post)
{
return postService.checkPostCodeUnique(post);
}
}

View File

@ -0,0 +1,187 @@
package com.ruoyi.web.controller.system;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysUserService;
/**
* 个人信息 业务处理
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController
{
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
private String prefix = "system/user/profile";
@Autowired
private ISysUserService userService;
@Autowired
private SysPasswordService passwordService;
/**
* 个人信息
*/
@GetMapping()
public String profile(ModelMap mmap)
{
SysUser user = getSysUser();
mmap.put("user", user);
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
return prefix + "/profile";
}
@GetMapping("/checkPassword")
@ResponseBody
public boolean checkPassword(String password)
{
SysUser user = getSysUser();
if (passwordService.matches(user, password))
{
return true;
}
return false;
}
@GetMapping("/resetPwd")
public String resetPwd(ModelMap mmap)
{
SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/resetPwd";
}
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwd(String oldPassword, String newPassword)
{
SysUser user = getSysUser();
if (!passwordService.matches(user, oldPassword))
{
return error("修改密码失败,旧密码错误");
}
if (passwordService.matches(user, newPassword))
{
return error("新密码不能与旧密码相同");
}
user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
user.setPwdUpdateDate(DateUtils.getNowDate());
if (userService.resetUserPwd(user) > 0)
{
setSysUser(userService.selectUserById(user.getUserId()));
return success();
}
return error("修改密码异常,请联系管理员");
}
/**
* 修改用户
*/
@GetMapping("/edit")
public String edit(ModelMap mmap)
{
SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/edit";
}
/**
* 修改头像
*/
@GetMapping("/avatar")
public String avatar(ModelMap mmap)
{
SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/avatar";
}
/**
* 修改用户
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/update")
@ResponseBody
public AjaxResult update(SysUser user)
{
SysUser currentUser = getSysUser();
currentUser.setUserName(user.getUserName());
currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(currentUser)))
{
return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(currentUser)))
{
return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在");
}
if (userService.updateUserInfo(currentUser) > 0)
{
setSysUser(userService.selectUserById(currentUser.getUserId()));
return success();
}
return error();
}
/**
* 保存头像
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/updateAvatar")
@ResponseBody
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
{
SysUser currentUser = getSysUser();
try
{
if (!file.isEmpty())
{
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
currentUser.setAvatar(avatar);
if (userService.updateUserInfo(currentUser) > 0)
{
setSysUser(userService.selectUserById(currentUser.getUserId()));
return success();
}
}
return error();
}
catch (Exception e)
{
log.error("修改头像失败!", e);
return error(e.getMessage());
}
}
}

View File

@ -0,0 +1,46 @@
package com.ruoyi.web.controller.system;
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.ResponseBody;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.shiro.service.SysRegisterService;
import com.ruoyi.system.service.ISysConfigService;
/**
* 注册验证
*
* @author ruoyi
*/
@Controller
public class SysRegisterController extends BaseController
{
@Autowired
private SysRegisterService registerService;
@Autowired
private ISysConfigService configService;
@GetMapping("/register")
public String register()
{
return "register";
}
@PostMapping("/register")
@ResponseBody
public AjaxResult ajaxRegister(SysUser 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,306 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
/**
* 角色信息
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/role")
public class SysRoleController extends BaseController
{
private String prefix = "system/role";
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysUserService userService;
@RequiresPermissions("system:role:view")
@GetMapping()
public String role()
{
return prefix + "/role";
}
@RequiresPermissions("system:role:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysRole role)
{
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:role:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysRole role)
{
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
return util.exportExcel(list, "角色数据");
}
/**
* 新增角色
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存角色
*/
@RequiresPermissions("system:role:add")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysRole role)
{
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(roleService.insertRole(role));
}
/**
* 修改角色
*/
@RequiresPermissions("system:role:edit")
@GetMapping("/edit/{roleId}")
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
{
roleService.checkRoleDataScope(roleId);
mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/edit";
}
/**
* 修改保存角色
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(roleService.updateRole(role));
}
/**
* 角色分配数据权限
*/
@GetMapping("/authDataScope/{roleId}")
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
{
mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/dataScope";
}
/**
* 保存角色分配数据权限
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PostMapping("/authDataScope")
@ResponseBody
public AjaxResult authDataScopeSave(SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(getLoginName());
if (roleService.authDataScope(role) > 0)
{
setSysUser(userService.selectUserById(getUserId()));
return success();
}
return error();
}
@RequiresPermissions("system:role:remove")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(roleService.deleteRoleByIds(ids));
}
/**
* 校验角色名称
*/
@PostMapping("/checkRoleNameUnique")
@ResponseBody
public String checkRoleNameUnique(SysRole role)
{
return roleService.checkRoleNameUnique(role);
}
/**
* 校验角色权限
*/
@PostMapping("/checkRoleKeyUnique")
@ResponseBody
public String checkRoleKeyUnique(SysRole role)
{
return roleService.checkRoleKeyUnique(role);
}
/**
* 选择菜单树
*/
@GetMapping("/selectMenuTree")
public String selectMenuTree()
{
return prefix + "/tree";
}
/**
* 角色状态修改
*/
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:role:edit")
@PostMapping("/changeStatus")
@ResponseBody
public AjaxResult changeStatus(SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.changeStatus(role));
}
/**
* 分配用户
*/
@RequiresPermissions("system:role:edit")
@GetMapping("/authUser/{roleId}")
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
{
mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/authUser";
}
/**
* 查询已分配用户角色列表
*/
@RequiresPermissions("system:role:list")
@PostMapping("/authUser/allocatedList")
@ResponseBody
public TableDataInfo allocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
}
/**
* 取消授权
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PostMapping("/authUser/cancel")
@ResponseBody
public AjaxResult cancelAuthUser(SysUserRole userRole)
{
return toAjax(roleService.deleteAuthUser(userRole));
}
/**
* 批量取消授权
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PostMapping("/authUser/cancelAll")
@ResponseBody
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
* 选择用户
*/
@GetMapping("/authUser/selectUser/{roleId}")
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
{
mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/selectUser";
}
/**
* 查询未分配用户角色列表
*/
@RequiresPermissions("system:role:list")
@PostMapping("/authUser/unallocatedList")
@ResponseBody
public TableDataInfo unallocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}
/**
* 批量选择用户授权
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PostMapping("/authUser/selectAll")
@ResponseBody
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
{
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
}

View File

@ -0,0 +1,302 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
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.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
/**
* 用户信息
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/user")
public class SysUserController extends BaseController
{
private String prefix = "system/user";
@Autowired
private ISysUserService userService;
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysPostService postService;
@Autowired
private SysPasswordService passwordService;
@RequiresPermissions("system:user:view")
@GetMapping()
public String user()
{
return prefix + "/user";
}
@RequiresPermissions("system:user:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:user:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysUser user)
{
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.exportExcel(list, "用户数据");
}
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@RequiresPermissions("system:user:import")
@PostMapping("/importData")
@ResponseBody
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 message = userService.importUser(userList, updateSupport, getLoginName());
return AjaxResult.success(message);
}
@RequiresPermissions("system:user:view")
@GetMapping("/importTemplate")
@ResponseBody
public AjaxResult importTemplate()
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.importTemplateExcel("用户数据");
}
/**
* 新增用户
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
mmap.put("posts", postService.selectPostAll());
return prefix + "/add";
}
/**
* 新增保存用户
*/
@RequiresPermissions("system:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysUser user)
{
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
{
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
}
user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), "1", user.getSalt()));
user.setCreateBy(getLoginName());
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/
@RequiresPermissions("system:user:edit")
@GetMapping("/edit/{userId}")
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
{
userService.checkUserDataScope(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId);
mmap.put("user", userService.selectUserById(userId));
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
mmap.put("posts", postService.selectPostsByUserId(userId));
return prefix + "/edit";
}
/**
* 修改保存用户
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(userService.updateUser(user));
}
@RequiresPermissions("system:user:resetPwd")
@GetMapping("/resetPwd/{userId}")
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
{
mmap.put("user", userService.selectUserById(userId));
return prefix + "/resetPwd";
}
@RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwdSave(SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
if (userService.resetUserPwd(user) > 0)
{
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
{
setSysUser(userService.selectUserById(user.getUserId()));
}
return success();
}
return error();
}
/**
* 进入授权角色页
*/
@GetMapping("/authRole/{userId}")
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
{
SysUser user = userService.selectUserById(userId);
// 获取用户所属的角色列表
List<SysRole> roles = roleService.selectRolesByUserId(userId);
mmap.put("user", user);
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return prefix + "/authRole";
}
/**
* 用户授权角色
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@PostMapping("/authRole/insertAuthRole")
@ResponseBody
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{
userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds);
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return success();
}
@RequiresPermissions("system:user:remove")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(ids));
}
/**
* 校验用户名
*/
@PostMapping("/checkLoginNameUnique")
@ResponseBody
public String checkLoginNameUnique(SysUser user)
{
return userService.checkLoginNameUnique(user.getLoginName());
}
/**
* 校验手机号码
*/
@PostMapping("/checkPhoneUnique")
@ResponseBody
public String checkPhoneUnique(SysUser user)
{
return userService.checkPhoneUnique(user);
}
/**
* 校验email邮箱
*/
@PostMapping("/checkEmailUnique")
@ResponseBody
public String checkEmailUnique(SysUser user)
{
return userService.checkEmailUnique(user);
}
/**
* 用户状态修改
*/
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:user:edit")
@PostMapping("/changeStatus")
@ResponseBody
public AjaxResult changeStatus(SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
return toAjax(userService.changeStatus(user));
}
}

View File

@ -0,0 +1,172 @@
package com.ruoyi.web.controller.system;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 参数配置 信息操作处理
*
* @author ruoyi
*/
@Controller
@RequestMapping("/system/wmsConfig")
public class SysWmsConfigController extends BaseController
{
private String prefix = "system/wmsConfig";
@Autowired
private ISysConfigService configService;
@RequiresPermissions("system:wmsConfig:view")
@GetMapping()
public String listData(ModelMap mmap)
{
SysConfig config = new SysConfig();
config.setWmsType("1");
List<SysConfig> result = configService.selectConfigList(config);
mmap.put("paramList", result);
return prefix + "/config";
}
/**
* 查询参数配置列表
*/
@RequiresPermissions("system:config:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:config:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据");
}
/**
* 新增参数配置
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存参数配置
*/
@RequiresPermissions("system:wmsConfig:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated SysConfig config)
{
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getLoginName());
//设置为wms参数类型方便过滤
config.setWmsType("1");
if("1".equals(config.getParamType())){
int count = configService.findNumByParamType1();
config.setOrderCheckbox(count);
if(!"0".equals(config.getConfigValue())){
config.setConfigValue("true");
}else{
config.setConfigValue("false");
}
}
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@RequiresPermissions("system:wmsConfig:edit")
@GetMapping("/edit/{configId}")
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
{
mmap.put("config", configService.selectConfigById(configId));
return prefix + "/edit";
}
/**
* 修改保存参数配置
*/
@RequiresPermissions("system:wmsConfig:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysConfig config)
{
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getLoginName());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
configService.deleteConfigByIds(ids);
return success();
}
/**
* 刷新参数缓存
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@GetMapping("/refreshCache")
@ResponseBody
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return success();
}
/**
* 校验参数键名
*/
@PostMapping("/checkConfigKeyUnique")
@ResponseBody
public String checkConfigKeyUnique(SysConfig config)
{
return configService.checkConfigKeyUnique(config);
}
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.web.controller.tool;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
/**
* build 表单构建
*
* @author ruoyi
*/
@Controller
@RequestMapping("/tool/build")
public class BuildController extends BaseController
{
private String prefix = "tool/build";
@RequiresPermissions("tool:build:view")
@GetMapping()
public String build()
{
return prefix + "/build";
}
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.web.controller.tool;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController;
/**
* swagger 接口
*
* @author ruoyi
*/
@Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController
{
@RequiresPermissions("tool:swagger:view")
@GetMapping()
public String index()
{
return redirect("/swagger-ui/index.html");
}
}

View File

@ -0,0 +1,181 @@
package com.ruoyi.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
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.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
/**
* swagger 用户测试方法
*
* @author ruoyi
*/
@Api("用户信息管理")
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
}
@ApiOperation("获取用户列表")
@GetMapping("/list")
public AjaxResult userList()
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return AjaxResult.success(userList);
}
@ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
return AjaxResult.success(users.get(userId));
}
else
{
return error("用户不存在");
}
}
@ApiOperation("新增用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
})
@PostMapping("/save")
public AjaxResult save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return error("用户ID不能为空");
}
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiOperation("更新用户")
@PutMapping("/update")
public AjaxResult update(@RequestBody UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return error("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return error("用户不存在");
}
users.remove(user.getUserId());
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}")
public AjaxResult delete(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId);
return success();
}
else
{
return error("用户不存在");
}
}
}
@ApiModel(value = "UserEntity", description = "用户实体")
class UserEntity
{
@ApiModelProperty("用户ID")
private Integer userId;
@ApiModelProperty("用户名称")
private String username;
@ApiModelProperty("用户密码")
private String password;
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity()
{
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getMobile()
{
return mobile;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.web.core.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
/**
* Swagger2的接口配置
*
* @author ruoyi
*/
@Configuration
public class SwaggerConfig
{
/** 是否开启swagger */
@Value("${swagger.enabled}")
private boolean enabled;
/**
* 创建API
*/
@Bean
public Docket createRestApi()
{
return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger
.enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
.select()
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
/**
* 添加摘要信息
*/
private ApiInfo apiInfo()
{
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题若依管理系统_接口文档")
// 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息
.contact(new Contact(RuoYiConfig.getName(), null, null))
// 版本
.version("版本号:" + RuoYiConfig.getVersion())
.build();
}
}

View File

@ -0,0 +1,58 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/wms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
# password: ntscc@2018
password: root
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url: jdbc:mysql://localhost:3308/pubruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -0,0 +1,148 @@
# 项目相关配置
ruoyi:
# 名称
name: Wms
# 版本
version: 4.7.3
# 版权年份
copyrightYear: 2022
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: true
# 开发环境配置
server:
# 服务器的HTTP端口默认为80
port: 8081
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 日志配置
logging:
level:
com.ruoyi: debug
org.springframework: warn
# 用户配置
user:
password:
# 密码错误{maxRetryCount}次锁定10分钟
maxRetryCount: 5
# Spring配置
spring:
# 模板引擎
thymeleaf:
mode: HTML
encoding: utf-8
# 禁用缓存
cache: false
# 资源信息
messages:
# 国际化资源文件路径
basename: static/i18n/messages
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
profiles:
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# MyBatis
#mybatis:
# 搜索指定包别名
# typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
# mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
# configLocation: classpath:mybatis/mybatis-config.xml
#Mybatis-plus配置
mybatis-plus:
type-aliases-package: com.ruoyi.**.domain
mapper-locations: classpath*:mapper/**/*Mapper.xml
config-location: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Shiro
shiro:
user:
# 登录地址
loginUrl: /login
# 权限认证失败地址
unauthorizedUrl: /unauth
# 首页地址
indexUrl: /index
# 验证码开关
captchaEnabled: false
# 验证码类型 math 数组计算 char 字符
captchaType: math
cookie:
# 设置Cookie的域名 默认空,即当前访问的域名
domain:
# 设置cookie的有效访问路径
path: /
# 设置HttpOnly属性
httpOnly: true
# 设置Cookie的过期时间天为单位
maxAge: 30
# 设置密钥务必保持唯一性生成方式直接拷贝到main运行即可Base64.encodeToString(CipherUtils.generateNewKey(128, "AES").getEncoded()) 默认启动生成随机秘钥随机秘钥会导致之前客户端RememberMe Cookie无效如设置固定秘钥RememberMe Cookie则有效
cipherKey:
session:
# Session超时时间-1代表永不过期默认30分钟
expireTime: 1440
# 同步session到数据库的周期默认1分钟
dbSyncPeriod: 1
# 相隔多久检查一次session的有效性默认就是10分钟
validationInterval: 10
# 同一个用户最大会话数比如2的意思是同一个账号允许最多同时两个人登录默认-1不限制
maxSession: -1
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
kickoutAfter: false
rememberMe:
# 是否开启记住我
enabled: true
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice/*
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
# Swagger配置
swagger:
# 是否开启swagger
enabled: true

View File

@ -0,0 +1,24 @@
Application Version: ${ruoyi.version}
Spring Boot Version: ${spring-boot.version}
////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ehcache name="ruoyi" updateCheck="false">
<!-- 磁盘缓存位置 -->
<diskStore path="java.io.tmpdir"/>
<!-- maxEntriesLocalHeap:堆内存中最大缓存对象数0没有限制 -->
<!-- maxElementsInMemory 在内存中缓存的element的最大数目。-->
<!-- eternal:elements是否永久有效如果为truetimeouts将被忽略element将永不过期 -->
<!-- timeToIdleSeconds:失效前的空闲秒数当eternal为false时这个属性才有效0为不限制 -->
<!-- timeToLiveSeconds:失效前的存活秒数创建时间到失效时间的间隔为存活时间当eternal为false时这个属性才有效0为不限制 -->
<!-- overflowToDisk 如果内存中数据超过内存限制,是否要缓存到磁盘上 -->
<!-- statistics是否收集统计信息。如果需要监控缓存使用情况应该打开这个选项。默认为关闭统计会影响性能。设置statistics="true"开启统计 -->
<!-- 默认缓存 -->
<defaultCache
maxEntriesLocalHeap="1000"
eternal="false"
timeToIdleSeconds="3600"
timeToLiveSeconds="3600"
overflowToDisk="false">
</defaultCache>
<!-- 登录记录缓存 锁定10分钟 -->
<cache name="loginRecordCache"
maxEntriesLocalHeap="2000"
eternal="false"
timeToIdleSeconds="600"
timeToLiveSeconds="0"
overflowToDisk="false"
statistics="false">
</cache>
<!-- 系统活跃用户缓存 -->
<cache name="sys-userCache"
maxEntriesLocalHeap="10000"
overflowToDisk="false"
eternal="false"
diskPersistent="false"
timeToLiveSeconds="0"
timeToIdleSeconds="0"
statistics="false">
</cache>
<!-- 系统用户授权缓存 没必要过期 -->
<cache name="sys-authCache"
maxEntriesLocalHeap="10000"
overflowToDisk="false"
eternal="false"
diskPersistent="false"
timeToLiveSeconds="0"
timeToIdleSeconds="0"
memoryStoreEvictionPolicy="LRU"
statistics="false"/>
<!-- 系统缓存 -->
<cache name="sys-cache"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="false">
</cache>
<!-- 系统参数缓存 -->
<cache name="sys-config"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="false">
</cache>
<!-- 系统字典缓存 -->
<cache name="sys-dict"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="false">
</cache>
<!-- 系统会话缓存 -->
<cache name="shiro-activeSessionCache"
maxEntriesLocalHeap="10000"
overflowToDisk="false"
eternal="false"
diskPersistent="false"
timeToLiveSeconds="0"
timeToIdleSeconds="0"
statistics="false"/>
</ehcache>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 全局参数 -->
<settings>
<!-- 使全局的映射器启用或禁用缓存 -->
<setting name="cacheEnabled" value="true" />
<!-- 允许JDBC 支持自动生成主键 -->
<setting name="useGeneratedKeys" value="true" />
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
<setting name="defaultExecutorType" value="SIMPLE" />
<!-- 指定 MyBatis 所用日志的具体实现 -->
<setting name="logImpl" value="SLF4J" />
<!-- 使用驼峰命名法转换字段 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
</settings>
</configuration>

View File

@ -0,0 +1,617 @@
/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */
/*
The MIT License (MIT)
Copyright (c) 2007-2013 Einar Lielmanis and contributors.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Style HTML
---------------
Written by Nochum Sossonko, (nsossonko@hotmail.com)
Based on code initially developed by: Einar Lielmanis, <elfz@laacz.lv>
http://jsbeautifier.org/
Usage:
style_html(html_source);
style_html(html_source, options);
The options are:
indent_size (default 4) indentation size,
indent_char (default space) character to indent with,
max_char (default 250) - maximum amount of characters per line (0 = disable)
brace_style (default "collapse") - "collapse" | "expand" | "end-expand"
put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.
unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
indent_scripts (default normal) - "keep"|"separate"|"normal"
e.g.
style_html(html_source, {
'indent_size': 2,
'indent_char': ' ',
'max_char': 78,
'brace_style': 'expand',
'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u']
});
*/
(function() {
function style_html(html_source, options, js_beautify, css_beautify) {
//Wrapper function to invoke all the necessary constructors and deal with the output.
var multi_parser,
indent_size,
indent_character,
max_char,
brace_style,
unformatted;
options = options || {};
indent_size = options.indent_size || 4;
indent_character = options.indent_char || ' ';
brace_style = options.brace_style || 'collapse';
max_char = options.max_char === 0 ? Infinity : options.max_char || 250;
unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
function Parser() {
this.pos = 0; //Parser position
this.token = '';
this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values
parent: 'parent1',
parentcount: 1,
parent1: ''
};
this.tag_type = '';
this.token_text = this.last_token = this.last_text = this.token_type = '';
this.Utils = { //Uilities made available to the various functions
whitespace: "\n\r\t ".split(''),
single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML
extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them
in_array: function (what, arr) {
for (var i=0; i<arr.length; i++) {
if (what === arr[i]) {
return true;
}
}
return false;
}
};
this.get_content = function () { //function to capture regular content between tags
var input_char = '',
content = [],
space = false; //if a space is needed
while (this.input.charAt(this.pos) !== '<') {
if (this.pos >= this.input.length) {
return content.length?content.join(''):['', 'TK_EOF'];
}
input_char = this.input.charAt(this.pos);
this.pos++;
this.line_char_count++;
if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
if (content.length) {
space = true;
}
this.line_char_count--;
continue; //don't want to insert unnecessary space
}
else if (space) {
if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached
content.push('\n');
for (var i=0; i<this.indent_level; i++) {
content.push(this.indent_string);
}
this.line_char_count = 0;
}
else{
content.push(' ');
this.line_char_count++;
}
space = false;
}
content.push(input_char); //letter at-a-time (or string) inserted to an array
}
return content.length?content.join(''):'';
};
this.get_contents_to = function (name) { //get the full content of a script or style to pass to js_beautify
if (this.pos === this.input.length) {
return ['', 'TK_EOF'];
}
var input_char = '';
var content = '';
var reg_match = new RegExp('</' + name + '\\s*>', 'igm');
reg_match.lastIndex = this.pos;
var reg_array = reg_match.exec(this.input);
var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script
if(this.pos < end_script) { //get everything in between the script tags
content = this.input.substring(this.pos, end_script);
this.pos = end_script;
}
return content;
};
this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object
if (this.tags[tag + 'count']) { //check for the existence of this tag type
this.tags[tag + 'count']++;
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
}
else { //otherwise initialize this tag type
this.tags[tag + 'count'] = 1;
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
}
this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)
this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
};
this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer
if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it
var temp_parent = this.tags.parent; //check to see if it's a closable tag.
while (temp_parent) { //till we reach '' (the initial value);
if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it
break;
}
temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree
}
if (temp_parent) { //if we caught something
this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly
this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent
}
delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...
delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself
if (this.tags[tag + 'count'] === 1) {
delete this.tags[tag + 'count'];
}
else {
this.tags[tag + 'count']--;
}
}
};
this.get_tag = function (peek) { //function to get a full tag and parse its type
var input_char = '',
content = [],
comment = '',
space = false,
tag_start, tag_end,
orig_pos = this.pos,
orig_line_char_count = this.line_char_count;
peek = peek !== undefined ? peek : false;
do {
if (this.pos >= this.input.length) {
if (peek) {
this.pos = orig_pos;
this.line_char_count = orig_line_char_count;
}
return content.length?content.join(''):['', 'TK_EOF'];
}
input_char = this.input.charAt(this.pos);
this.pos++;
this.line_char_count++;
if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space
space = true;
this.line_char_count--;
continue;
}
if (input_char === "'" || input_char === '"') {
if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially
input_char += this.get_unformatted(input_char);
space = true;
}
}
if (input_char === '=') { //no space before =
space = false;
}
if (content.length && content[content.length-1] !== '=' && input_char !== '>' && space) {
//no space after = or before >
if (this.line_char_count >= this.max_char) {
this.print_newline(false, content);
this.line_char_count = 0;
}
else {
content.push(' ');
this.line_char_count++;
}
space = false;
}
if (input_char === '<') {
tag_start = this.pos - 1;
}
content.push(input_char); //inserts character at-a-time (or string)
} while (input_char !== '>');
var tag_complete = content.join('');
var tag_index;
if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
tag_index = tag_complete.indexOf(' ');
}
else { //otherwise go with the tag ending
tag_index = tag_complete.indexOf('>');
}
var tag_check = tag_complete.substring(1, tag_index).toLowerCase();
if (tag_complete.charAt(tag_complete.length-2) === '/' ||
this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)
if ( ! peek) {
this.tag_type = 'SINGLE';
}
}
else if (tag_check === 'script') { //for later script handling
if ( ! peek) {
this.record_tag(tag_check);
this.tag_type = 'SCRIPT';
}
}
else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content)
if ( ! peek) {
this.record_tag(tag_check);
this.tag_type = 'STYLE';
}
}
else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags
comment = this.get_unformatted('</'+tag_check+'>', tag_complete); //...delegate to get_unformatted function
content.push(comment);
// Preserve collapsed whitespace either before or after this tag.
if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)){
content.splice(0, 0, this.input.charAt(tag_start - 1));
}
tag_end = this.pos - 1;
if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)){
content.push(this.input.charAt(tag_end + 1));
}
this.tag_type = 'SINGLE';
}
else if (tag_check.charAt(0) === '!') { //peek for <!-- comment
if (tag_check.indexOf('[if') !== -1) { //peek for <!--[if conditional comment
if (tag_complete.indexOf('!IE') !== -1) { //this type needs a closing --> so...
comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted
content.push(comment);
}
if ( ! peek) {
this.tag_type = 'START';
}
}
else if (tag_check.indexOf('[endif') !== -1) {//peek for <!--[endif end conditional comment
this.tag_type = 'END';
this.unindent();
}
else if (tag_check.indexOf('[cdata[') !== -1) { //if it's a <[cdata[ comment...
comment = this.get_unformatted(']]>', tag_complete); //...delegate to get_unformatted function
content.push(comment);
if ( ! peek) {
this.tag_type = 'SINGLE'; //<![CDATA[ comments are treated like single tags
}
}
else {
comment = this.get_unformatted('-->', tag_complete);
content.push(comment);
this.tag_type = 'SINGLE';
}
}
else if ( ! peek) {
if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending
this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors
this.tag_type = 'END';
}
else { //otherwise it's a start-tag
this.record_tag(tag_check); //push it on the tag stack
this.tag_type = 'START';
}
if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line
this.print_newline(true, this.output);
}
}
if (peek) {
this.pos = orig_pos;
this.line_char_count = orig_line_char_count;
}
return content.join(''); //returns fully formatted tag
};
this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety
if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
return '';
}
var input_char = '';
var content = '';
var space = true;
do {
if (this.pos >= this.input.length) {
return content;
}
input_char = this.input.charAt(this.pos);
this.pos++;
if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
if (!space) {
this.line_char_count--;
continue;
}
if (input_char === '\n' || input_char === '\r') {
content += '\n';
/* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array'
for (var i=0; i<this.indent_level; i++) {
content += this.indent_string;
}
space = false; //...and make sure other indentation is erased
*/
this.line_char_count = 0;
continue;
}
}
content += input_char;
this.line_char_count++;
space = true;
} while (content.toLowerCase().indexOf(delimiter) === -1);
return content;
};
this.get_token = function () { //initial handler for token-retrieval
var token;
if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript
var type = this.last_token.substr(7);
token = this.get_contents_to(type);
if (typeof token !== 'string') {
return token;
}
return [token, 'TK_' + type];
}
if (this.current_mode === 'CONTENT') {
token = this.get_content();
if (typeof token !== 'string') {
return token;
}
else {
return [token, 'TK_CONTENT'];
}
}
if (this.current_mode === 'TAG') {
token = this.get_tag();
if (typeof token !== 'string') {
return token;
}
else {
var tag_name_type = 'TK_TAG_' + this.tag_type;
return [token, tag_name_type];
}
}
};
this.get_full_indent = function (level) {
level = this.indent_level + level || 0;
if (level < 1) {
return '';
}
return Array(level + 1).join(this.indent_string);
};
this.is_unformatted = function(tag_check, unformatted) {
//is this an HTML5 block-level link?
if (!this.Utils.in_array(tag_check, unformatted)){
return false;
}
if (tag_check.toLowerCase() !== 'a' || !this.Utils.in_array('a', unformatted)){
return true;
}
//at this point we have an tag; is its first child something we want to remain
//unformatted?
var next_tag = this.get_tag(true /* peek. */);
// tets next_tag to see if it is just html tag (no external content)
var tag = (next_tag || "").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);
// if next_tag comes back but is not an isolated tag, then
// let's treat the 'a' tag as having content
// and respect the unformatted option
if (!tag || this.Utils.in_array(tag, unformatted)){
return true;
} else {
return false;
}
};
this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions
this.input = js_source || ''; //gets the input for the Parser
this.output = [];
this.indent_character = indent_character;
this.indent_string = '';
this.indent_size = indent_size;
this.brace_style = brace_style;
this.indent_level = 0;
this.max_char = max_char;
this.line_char_count = 0; //count to see if max_char was exceeded
for (var i=0; i<this.indent_size; i++) {
this.indent_string += this.indent_character;
}
this.print_newline = function (ignore, arr) {
this.line_char_count = 0;
if (!arr || !arr.length) {
return;
}
if (!ignore) { //we might want the extra line
while (this.Utils.in_array(arr[arr.length-1], this.Utils.whitespace)) {
arr.pop();
}
}
arr.push('\n');
for (var i=0; i<this.indent_level; i++) {
arr.push(this.indent_string);
}
};
this.print_token = function (text) {
this.output.push(text);
};
this.indent = function () {
this.indent_level++;
};
this.unindent = function () {
if (this.indent_level > 0) {
this.indent_level--;
}
};
};
return this;
}
/*_____________________--------------------_____________________*/
multi_parser = new Parser(); //wrapping functions Parser
multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values
while (true) {
var t = multi_parser.get_token();
multi_parser.token_text = t[0];
multi_parser.token_type = t[1];
if (multi_parser.token_type === 'TK_EOF') {
break;
}
switch (multi_parser.token_type) {
case 'TK_TAG_START':
multi_parser.print_newline(false, multi_parser.output);
multi_parser.print_token(multi_parser.token_text);
multi_parser.indent();
multi_parser.current_mode = 'CONTENT';
break;
case 'TK_TAG_STYLE':
case 'TK_TAG_SCRIPT':
multi_parser.print_newline(false, multi_parser.output);
multi_parser.print_token(multi_parser.token_text);
multi_parser.current_mode = 'CONTENT';
break;
case 'TK_TAG_END':
//Print new line only if the tag has no content and has child
if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
var tag_name = multi_parser.token_text.match(/\w+/)[0];
var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/);
if (tag_extracted_from_last_output === null || tag_extracted_from_last_output[1] !== tag_name) {
multi_parser.print_newline(true, multi_parser.output);
}
}
multi_parser.print_token(multi_parser.token_text);
multi_parser.current_mode = 'CONTENT';
break;
case 'TK_TAG_SINGLE':
// Don't add a newline before elements that should remain unformatted.
var tag_check = multi_parser.token_text.match(/^\s*<([a-z]+)/i);
if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)){
multi_parser.print_newline(false, multi_parser.output);
}
multi_parser.print_token(multi_parser.token_text);
multi_parser.current_mode = 'CONTENT';
break;
case 'TK_CONTENT':
if (multi_parser.token_text !== '') {
multi_parser.print_token(multi_parser.token_text);
}
multi_parser.current_mode = 'TAG';
break;
case 'TK_STYLE':
case 'TK_SCRIPT':
if (multi_parser.token_text !== '') {
multi_parser.output.push('\n');
var text = multi_parser.token_text,
_beautifier,
script_indent_level = 1;
if (multi_parser.token_type === 'TK_SCRIPT') {
_beautifier = typeof js_beautify === 'function' && js_beautify;
} else if (multi_parser.token_type === 'TK_STYLE') {
_beautifier = typeof css_beautify === 'function' && css_beautify;
}
if (options.indent_scripts === "keep") {
script_indent_level = 0;
} else if (options.indent_scripts === "separate") {
script_indent_level = -multi_parser.indent_level;
}
var indentation = multi_parser.get_full_indent(script_indent_level);
if (_beautifier) {
// call the Beautifier if avaliable
text = _beautifier(text.replace(/^\s*/, indentation), options);
} else {
// simply indent the string otherwise
var white = text.match(/^\s*/)[0];
var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
var reindent = multi_parser.get_full_indent(script_indent_level -_level);
text = text.replace(/^\s*/, indentation)
.replace(/\r\n|\r|\n/g, '\n' + reindent)
.replace(/\s*$/, '');
}
if (text) {
multi_parser.print_token(text);
multi_parser.print_newline(true, multi_parser.output);
}
}
multi_parser.current_mode = 'TAG';
break;
}
multi_parser.last_token = multi_parser.token_type;
multi_parser.last_text = multi_parser.token_text;
}
return multi_parser.output.join('');
}
// If we're running a web page and don't have either of the above, add our one global
window.html_beautify = function(html_source, options) {
return style_html(html_source, options, window.js_beautify, window.css_beautify);
};
}());

View File

@ -0,0 +1,620 @@
/*!
* jQuery blockUI plugin
* Version 2.70.0-2014.11.23
* Requires jQuery v1.7 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2013 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/
;(function() {
/*jshint eqeqeq:false curly:false latedef:false */
"use strict";
function setup($) {
$.fn._fadeIn = $.fn.fadeIn;
var noOp = $.noop || function() {};
// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
// confusing userAgent strings on Vista)
var msie = /MSIE/.test(navigator.userAgent);
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
var mode = document.documentMode || 0;
var setExpr = $.isFunction( document.createElement('div').style.setExpression );
// global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
$.growlUI = function(title, message, timeout, onClose) {
var $m = $('<div class="growlUI"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout === undefined) timeout = 3000;
// Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
var callBlock = function(opts) {
opts = opts || {};
$.blockUI({
message: $m,
fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
centerY: false,
showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.growlCSS
});
};
callBlock();
var nonmousedOpacity = $m.css('opacity');
$m.mouseover(function() {
callBlock({
fadeIn: 0,
timeout: 30000
});
var displayBlock = $('.blockMsg');
displayBlock.stop(); // cancel fadeout if it has started
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
}).mouseout(function() {
$('.blockMsg').fadeOut(1000);
});
// End konapun additions
};
// plugin method for blocking element content
$.fn.block = function(opts) {
if ( this[0] === window ) {
$.blockUI( opts );
return this;
}
var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
this.each(function() {
var $el = $(this);
if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
return;
$el.unblock({ fadeOut: 0 });
});
return this.each(function() {
if ($.css(this,'position') == 'static') {
this.style.position = 'relative';
$(this).data('blockUI.static', true);
}
this.style.zoom = 1; // force 'hasLayout' in ie
install(this, opts);
});
};
// plugin method for unblocking element content
$.fn.unblock = function(opts) {
if ( this[0] === window ) {
$.unblockUI( opts );
return this;
}
return this.each(function() {
remove(this, opts);
});
};
$.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
// override these in your code to change the default behavior and style
$.blockUI.defaults = {
// message displayed when blocking (use null for no message)
message: '<div class="loaderbox"><div class="loading-activity"></div> 加载中......</div>',
title: null, // title string; only used when theme == true
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
theme: false, // set to true to use with jQuery UI themes
// styles for the message when blocking; if you wish to disable
// these and use an external stylesheet then do this in your code:
// $.blockUI.defaults.css = {};
css: {
padding: 0,
margin: 0,
width: '30%',
top: '40%',
left: '35%',
textAlign: 'center',
color: '#000',
border: '0px',
backgroundColor:'transparent',
cursor: 'wait'
},
// minimal style set used when themes are used
themedCSS: {
width: '30%',
top: '40%',
left: '35%'
},
// styles for the overlay
overlayCSS: {
backgroundColor: '#000',
opacity: 0.6,
cursor: 'wait'
},
// style to replace wait cursor before unblocking to correct issue
// of lingering wait cursor
cursorReset: 'default',
// styles applied when using $.growlUI
growlCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.6,
cursor: 'default',
color: '#fff',
backgroundColor: '#000',
'-webkit-border-radius':'10px',
'-moz-border-radius': '10px',
'border-radius': '10px'
},
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
// (hat tip to Jorge H. N. de Vasconcelos)
/*jshint scripturl:true */
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
// force usage of iframe in non-IE browsers (handy for blocking applets)
forceIframe: false,
// z-index for the blocking overlay
baseZ: 1000,
// set these to true to have the message automatically centered
centerX: true, // <-- only effects element blocking (page block controlled via css above)
centerY: true,
// allow body element to be stetched in ie6; this makes blocking look better
// on "short" pages. disable if you wish to prevent changes to the body height
allowBodyStretch: true,
// enable if you want key and mouse events to be disabled for content that is blocked
bindEvents: true,
// be default blockUI will supress tab navigation from leaving blocking content
// (if bindEvents is true)
constrainTabKey: true,
// fadeIn time in millis; set to 0 to disable fadeIn on block
fadeIn: 200,
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
fadeOut: 400,
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
timeout: 0,
// disable if you don't want to show the overlay
showOverlay: true,
// if true, focus will be placed in the first available input field when
// page blocking
focusInput: true,
// elements that can receive focus
focusableElements: ':input:enabled:visible',
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
// no longer needed in 2012
// applyPlatformOpacityRules: true,
// callback method invoked when fadeIn has completed and blocking message is visible
onBlock: null,
// callback method invoked when unblocking has completed; the callback is
// passed the element that has been unblocked (which is the window object for page
// blocks) and the options that were passed to the unblock call:
// onUnblock(element, options)
onUnblock: null,
// callback method invoked when the overlay area is clicked.
// setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
onOverlayClick: null,
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
quirksmodeOffsetHack: 4,
// class name of the message block
blockMsgClass: 'blockMsg',
// if it is already blocked, then ignore it (don't unblock and reblock)
ignoreIfBlocked: false
};
// private data and functions follow...
var pageBlock = null;
var pageBlockEls = [];
function install(el, opts) {
var css, themedCSS;
var full = (el == window);
var msg = (opts && opts.message !== undefined ? opts.message : undefined);
opts = $.extend({}, $.blockUI.defaults, opts || {});
if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
return;
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
if (opts.onOverlayClick)
opts.overlayCSS.cursor = 'pointer';
themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
msg = msg === undefined ? opts.message : msg;
// remove the current block (if there is one)
if (full && pageBlock)
remove(window, {fadeOut:0});
// if an existing element is being used as the blocking content then we capture
// its current place in the DOM (and current display style) so we can restore
// it when we unblock
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
var node = msg.jquery ? msg[0] : msg;
var data = {};
$(el).data('blockUI.history', data);
data.el = node;
data.parent = node.parentNode;
data.display = node.style.display;
data.position = node.style.position;
if (data.parent)
data.parent.removeChild(node);
}
$(el).data('blockUI.onUnblock', opts.onUnblock);
var z = opts.baseZ;
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
// layer1 is the iframe layer which is used to supress bleed through of underlying content
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
// layer3 is the message content that is displayed while blocking
var lyr1, lyr2, lyr3, s;
if (msie || opts.forceIframe)
lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
else
lyr1 = $('<div class="blockUI" style="display:none"></div>');
if (opts.theme)
lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
else
lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
if (opts.theme && full) {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
if ( opts.title ) {
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
}
s += '<div class="ui-widget-content ui-dialog-content"></div>';
s += '</div>';
}
else if (opts.theme) {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
if ( opts.title ) {
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
}
s += '<div class="ui-widget-content ui-dialog-content"></div>';
s += '</div>';
}
else if (full) {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
}
else {
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
}
lyr3 = $(s);
// if we have a message, style it
if (msg) {
if (opts.theme) {
lyr3.css(themedCSS);
lyr3.addClass('ui-widget-content');
}
else
lyr3.css(css);
}
// style the overlay
if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
lyr2.css(opts.overlayCSS);
lyr2.css('position', full ? 'fixed' : 'absolute');
// make iframe layer transparent in IE
if (msie || opts.forceIframe)
lyr1.css('opacity',0.0);
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
$.each(layers, function() {
this.appendTo($par);
});
if (opts.theme && opts.draggable && $.fn.draggable) {
lyr3.draggable({
handle: '.ui-dialog-titlebar',
cancel: 'li'
});
}
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
if (ie6 || expr) {
// give body 100% height
if (full && opts.allowBodyStretch && $.support.boxModel)
$('html,body').css('height','100%');
// fix ie6 issue when blocked element has a border width
if ((ie6 || !$.support.boxModel) && !full) {
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
var fixT = t ? '(0 - '+t+')' : 0;
var fixL = l ? '(0 - '+l+')' : 0;
}
// simulate fixed position
$.each(layers, function(i,o) {
var s = o[0].style;
s.position = 'absolute';
if (i < 2) {
if (full)
s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
else
s.setExpression('height','this.parentNode.offsetHeight + "px"');
if (full)
s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
else
s.setExpression('width','this.parentNode.offsetWidth + "px"');
if (fixL) s.setExpression('left', fixL);
if (fixT) s.setExpression('top', fixT);
}
else if (opts.centerY) {
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
s.marginTop = 0;
}
else if (!opts.centerY && full) {
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
s.setExpression('top',expression);
}
});
}
// show the message
if (msg) {
if (opts.theme)
lyr3.find('.ui-widget-content').append(msg);
else
lyr3.append(msg);
if (msg.jquery || msg.nodeType)
$(msg).show();
}
if ((msie || opts.forceIframe) && opts.showOverlay)
lyr1.show(); // opacity is zero
if (opts.fadeIn) {
var cb = opts.onBlock ? opts.onBlock : noOp;
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
var cb2 = msg ? cb : noOp;
if (opts.showOverlay)
lyr2._fadeIn(opts.fadeIn, cb1);
if (msg)
lyr3._fadeIn(opts.fadeIn, cb2);
}
else {
if (opts.showOverlay)
lyr2.show();
if (msg)
lyr3.show();
if (opts.onBlock)
opts.onBlock.bind(lyr3)();
}
// bind key and mouse events
bind(1, el, opts);
if (full) {
pageBlock = lyr3[0];
pageBlockEls = $(opts.focusableElements,pageBlock);
if (opts.focusInput)
setTimeout(focus, 20);
}
else
center(lyr3[0], opts.centerX, opts.centerY);
if (opts.timeout) {
// auto-unblock
var to = setTimeout(function() {
if (full)
$.unblockUI(opts);
else
$(el).unblock(opts);
}, opts.timeout);
$(el).data('blockUI.timeout', to);
}
}
// remove the block
function remove(el, opts) {
var count;
var full = (el == window);
var $el = $(el);
var data = $el.data('blockUI.history');
var to = $el.data('blockUI.timeout');
if (to) {
clearTimeout(to);
$el.removeData('blockUI.timeout');
}
opts = $.extend({}, $.blockUI.defaults, opts || {});
bind(0, el, opts); // unbind events
if (opts.onUnblock === null) {
opts.onUnblock = $el.data('blockUI.onUnblock');
$el.removeData('blockUI.onUnblock');
}
var els;
if (full) // crazy selector to handle odd field errors in ie6/7
els = $('body').children().filter('.blockUI').add('body > .blockUI');
else
els = $el.find('>.blockUI');
// fix cursor issue
if ( opts.cursorReset ) {
if ( els.length > 1 )
els[1].style.cursor = opts.cursorReset;
if ( els.length > 2 )
els[2].style.cursor = opts.cursorReset;
}
if (full)
pageBlock = pageBlockEls = null;
if (opts.fadeOut) {
count = els.length;
els.stop().fadeOut(opts.fadeOut, function() {
if ( --count === 0)
reset(els,data,opts,el);
});
}
else
reset(els, data, opts, el);
}
// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
var $el = $(el);
if ( $el.data('blockUI.isBlocked') )
return;
els.each(function(i,o) {
// remove via DOM calls so we don't lose event handlers
if (this.parentNode)
this.parentNode.removeChild(this);
});
if (data && data.el) {
data.el.style.display = data.display;
data.el.style.position = data.position;
data.el.style.cursor = 'default'; // #59
if (data.parent)
data.parent.appendChild(data.el);
$el.removeData('blockUI.history');
}
if ($el.data('blockUI.static')) {
$el.css('position', 'static'); // #22
}
if (typeof opts.onUnblock == 'function')
opts.onUnblock(el,opts);
// fix issue in Safari 6 where block artifacts remain until reflow
var body = $(document.body), w = body.width(), cssW = body[0].style.width;
body.width(w-1).width(w);
body[0].style.width = cssW;
}
// bind/unbind the handler
function bind(b, el, opts) {
var full = el == window, $el = $(el);
// don't bother unbinding if there is nothing to unbind
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
return;
$el.data('blockUI.isBlocked', b);
// don't bind events when overlay is not in use or if bindEvents is false
if (!full || !opts.bindEvents || (b && !opts.showOverlay))
return;
// bind anchors and inputs for mouse and key events
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
if (b)
$(document).bind(events, opts, handler);
else
$(document).unbind(events, handler);
// former impl...
// var $e = $('a,:input');
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
}
// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
// allow tab navigation (conditionally)
if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
if (pageBlock && e.data.constrainTabKey) {
var els = pageBlockEls;
var fwd = !e.shiftKey && e.target === els[els.length-1];
var back = e.shiftKey && e.target === els[0];
if (fwd || back) {
setTimeout(function(){focus(back);},10);
return false;
}
}
}
var opts = e.data;
var target = $(e.target);
if (target.hasClass('blockOverlay') && opts.onOverlayClick)
opts.onOverlayClick(e);
// allow events within the message content
if (target.parents('div.' + opts.blockMsgClass).length > 0)
return true;
// allow events for content that is not being blocked
return target.parents().children().filter('div.blockUI').length === 0;
}
function focus(back) {
if (!pageBlockEls)
return;
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
if (e)
e.focus();
}
function center(el, x, y) {
var p = el.parentNode, s = el.style;
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
if (x) s.left = l > 0 ? (l+'px') : '0';
if (y) s.top = t > 0 ? (t+'px') : '0';
}
function sz(el, p) {
return parseInt($.css(el,p),10)||0;
}
}
/*global define:true */
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
define(['jquery'], setup);
} else {
setup(jQuery);
}
})();

View File

@ -0,0 +1,671 @@
/*!
* bootstrap-fileinput v5.2.4
* http://plugins.krajee.com/file-input
*
* Krajee default styling for bootstrap-fileinput.
*
* Author: Kartik Visweswaran
* Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com
*
* Licensed under the BSD-3-Clause
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
*/
.file-loading input[type=file],
input[type=file].file-loading {
width: 0;
height: 0;
}
.file-no-browse {
position: absolute;
left: 50%;
bottom: 20%;
width: 1px;
height: 1px;
font-size: 0;
opacity: 0;
border: none;
background: none;
outline: none;
box-shadow: none;
}
.kv-hidden,
.file-caption-icon,
.file-zoom-dialog .modal-header:before,
.file-zoom-dialog .modal-header:after,
.file-input-new .file-preview,
.file-input-new .close,
.file-input-new .glyphicon-file,
.file-input-new .fileinput-remove-button,
.file-input-new .fileinput-upload-button,
.file-input-new .no-browse .input-group-btn,
.file-input-ajax-new .fileinput-remove-button,
.file-input-ajax-new .fileinput-upload-button,
.file-input-ajax-new .no-browse .input-group-btn,
.hide-content .kv-file-content,
.is-locked .fileinput-upload-button,
.is-locked .fileinput-remove-button {
display: none;
}
.btn-file input[type=file],
.file-caption-icon,
.file-preview .fileinput-remove,
.krajee-default .file-thumb-progress,
.file-zoom-dialog .btn-navigate,
.file-zoom-dialog .floating-buttons {
position: absolute;
}
.file-caption-icon .kv-caption-icon {
line-height: inherit;
}
.file-input,
.file-loading:before,
.btn-file,
.file-caption,
.file-preview,
.krajee-default.file-preview-frame,
.krajee-default .file-thumbnail-footer,
.file-zoom-dialog .modal-dialog {
position: relative;
}
.file-error-message pre,
.file-error-message ul,
.krajee-default .file-actions,
.krajee-default .file-other-error {
text-align: left;
}
.file-error-message pre,
.file-error-message ul {
margin: 0;
}
.krajee-default .file-drag-handle,
.krajee-default .file-upload-indicator {
float: left;
margin-top: 10px;
width: 16px;
height: 16px;
}
.file-thumb-progress .progress,
.file-thumb-progress .progress-bar {
font-family: Verdana, Helvetica, sans-serif;
font-size: 0.7rem;
}
.krajee-default .file-thumb-progress .progress,
.kv-upload-progress .progress {
background-color: #ccc;
}
.krajee-default .file-caption-info,
.krajee-default .file-size-info {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 160px;
height: 15px;
margin: auto;
}
.file-zoom-content > .file-object.type-video,
.file-zoom-content > .file-object.type-flash,
.file-zoom-content > .file-object.type-image {
max-width: 100%;
max-height: 100%;
width: auto;
}
.file-zoom-content > .file-object.type-video,
.file-zoom-content > .file-object.type-flash {
height: 100%;
}
.file-zoom-content > .file-object.type-pdf,
.file-zoom-content > .file-object.type-html,
.file-zoom-content > .file-object.type-text,
.file-zoom-content > .file-object.type-default {
width: 100%;
}
.file-loading:before {
content: " Loading...";
display: inline-block;
padding-left: 20px;
line-height: 16px;
font-size: 13px;
font-variant: small-caps;
color: #999;
background: transparent url(loading.gif) top left no-repeat;
}
.file-object {
margin: 0 0 -5px 0;
padding: 0;
}
.btn-file {
overflow: hidden;
}
.btn-file input[type=file] {
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
text-align: right;
opacity: 0;
background: none repeat scroll 0 0 transparent;
cursor: inherit;
display: block;
}
.btn-file ::-ms-browse {
font-size: 10000px;
width: 100%;
height: 100%;
}
.file-caption.icon-visible .file-caption-icon {
display: inline-block;
}
.file-caption.icon-visible .file-caption-name {
padding-left: 25px;
}
.file-caption.icon-visible > .input-group-lg .file-caption-name {
padding-left: 30px;
}
.file-caption.icon-visible > .input-group-sm .file-caption-name {
padding-left: 22px;
}
.file-caption-name:not(.file-caption-disabled) {
background-color: transparent;
}
.file-caption-name.file-processing {
font-style: italic;
border-color: #bbb;
opacity: 0.5;
}
.file-caption-icon {
padding: 7px 5px;
left: 4px;
}
.input-group-lg .file-caption-icon {
font-size: 1.25rem;
}
.input-group-sm .file-caption-icon {
font-size: 0.875rem;
padding: 0.25rem;
}
.file-error-message {
color: #a94442;
background-color: #f2dede;
margin: 5px;
border: 1px solid #ebccd1;
border-radius: 4px;
padding: 15px;
}
.file-error-message pre {
margin: 5px 0;
}
.file-caption-disabled {
background-color: #eee;
cursor: not-allowed;
opacity: 1;
}
.file-preview {
border-radius: 5px;
border: 1px solid #ddd;
padding: 8px;
width: 100%;
margin-bottom: 5px;
}
.file-preview .btn-xs {
padding: 1px 5px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.file-preview .fileinput-remove {
top: 1px;
right: 1px;
line-height: 10px;
}
.file-preview .clickable {
cursor: pointer;
}
.file-preview-image {
font: 40px Impact, Charcoal, sans-serif;
color: #008000;
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
.krajee-default.file-preview-frame {
margin: 8px;
border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2);
padding: 6px;
float: left;
text-align: center;
}
.krajee-default.file-preview-frame .kv-file-content {
width: 213px;
height: 160px;
}
.krajee-default .file-preview-other-frame {
display: flex;
align-items: center;
justify-content: center;
}
.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered {
width: 400px;
}
.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content {
width: 240px;
height: 55px;
}
.krajee-default.file-preview-frame .file-thumbnail-footer {
height: 70px;
}
.krajee-default.file-preview-frame:not(.file-preview-error):hover {
border: 1px solid rgba(0, 0, 0, 0.3);
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.4);
}
.krajee-default .file-preview-text {
color: #428bca;
border: 1px solid #ddd;
outline: none;
resize: none;
}
.krajee-default .file-preview-html {
border: 1px solid #ddd;
}
.krajee-default .file-other-icon {
font-size: 6em;
line-height: 1;
}
.krajee-default .file-footer-buttons {
float: right;
}
.krajee-default .file-footer-caption {
display: block;
text-align: center;
padding-top: 4px;
font-size: 11px;
color: #777;
margin-bottom: 30px;
}
.file-upload-stats {
font-size: 10px;
text-align: center;
width: 100%;
}
.kv-upload-progress .file-upload-stats {
font-size: 12px;
margin: -10px 0 5px;
}
.krajee-default .file-preview-error {
opacity: 0.65;
box-shadow: none;
}
.krajee-default .file-thumb-progress {
top: 37px;
left: 0;
right: 0;
}
.krajee-default.kvsortable-ghost {
background: #e1edf7;
border: 2px solid #a1abff;
}
.krajee-default .file-preview-other:hover {
opacity: 0.8;
}
.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover {
color: #000;
}
.kv-upload-progress .progress {
height: 20px;
margin: 10px 0;
overflow: hidden;
}
.kv-upload-progress .progress-bar {
height: 20px;
font-family: Verdana, Helvetica, sans-serif;
}
/*noinspection CssOverwrittenProperties*/
.file-zoom-dialog .file-other-icon {
font-size: 22em;
font-size: 50vmin;
}
.file-zoom-dialog .modal-dialog {
width: auto;
}
.file-zoom-dialog .modal-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.file-zoom-dialog .btn-navigate {
margin: 0 0.1rem;
padding: 0;
font-size: 1.2rem;
width: 2.4rem;
height: 2.4rem;
top: 50%;
border-radius: 50%;
text-align:center;
}
.btn-navigate * {
width: auto;
}
.file-zoom-dialog .floating-buttons {
top: 5px;
right: 10px;
}
.file-zoom-dialog .btn-kv-prev {
left: 0;
}
.file-zoom-dialog .btn-kv-next {
right: 0;
}
.file-zoom-dialog .kv-zoom-caption {
max-width: 50%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.file-zoom-dialog .kv-zoom-header {
padding: 0.5rem;
}
.file-zoom-dialog .kv-zoom-body {
padding: 0.25rem 0.5rem 0.25rem 0;
}
.file-zoom-dialog .kv-zoom-description {
position: absolute;
opacity: 0.8;
font-size: 0.8rem;
background-color: #1a1a1a;
padding: 1rem;
text-align: center;
border-radius: 0.5rem;
color: #fff;
left: 15%;
right: 15%;
bottom: 15%;
}
.file-zoom-dialog .kv-desc-hide {
float: right;
color: #fff;
padding: 0 0.1rem;
background: none;
border: none;
}
.file-zoom-dialog .kv-desc-hide:hover {
opacity: 0.7;
}
.file-zoom-dialog .kv-desc-hide:focus {
opacity: 0.9;
}
.file-input-new .no-browse .form-control {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.file-input-ajax-new .no-browse .form-control {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.file-caption {
width: 100%;
position: relative;
}
.file-thumb-loading {
background: transparent url(loading.gif) no-repeat scroll center center content-box !important;
}
.file-drop-zone {
border: 1px dashed #aaa;
min-height: 260px;
border-radius: 4px;
text-align: center;
vertical-align: middle;
margin: 12px 15px 12px 12px;
padding: 5px;
}
.file-drop-zone.clickable:hover {
border: 2px dashed #999;
}
.file-drop-zone.clickable:focus {
border: 2px solid #5acde2;
}
.file-drop-zone .file-preview-thumbnails {
cursor: default;
}
.file-drop-zone-title {
color: #aaa;
font-size: 1.6em;
text-align: center;
padding: 85px 10px;
cursor: default;
}
.file-highlighted {
border: 2px dashed #999 !important;
background-color: #eee;
}
.file-uploading {
background: url(loading-sm.gif) no-repeat center bottom 10px;
opacity: 0.65;
}
.file-zoom-fullscreen .modal-dialog {
min-width: 100%;
margin: 0;
}
.file-zoom-fullscreen .modal-content {
border-radius: 0;
box-shadow: none;
min-height: 100vh;
}
.file-zoom-fullscreen .kv-zoom-body {
overflow-y: auto;
}
.floating-buttons {
z-index: 3000;
}
.floating-buttons .btn-kv {
margin-left: 3px;
z-index: 3000;
}
.kv-zoom-actions .btn-kv {
margin-left: 3px;
}
.file-zoom-content {
text-align: center;
white-space: nowrap;
min-height: 300px;
}
.file-zoom-content:hover {
background: transparent;
}
.file-zoom-content > * {
display: inline-block;
vertical-align: middle;
}
.file-zoom-content .kv-spacer {
height: 100%;
}
.file-zoom-content .file-preview-image {
max-height: 100%;
}
.file-zoom-content .file-preview-video {
max-height: 100%;
}
.file-zoom-content > .file-object.type-image {
height: auto;
min-height: inherit;
}
.file-zoom-content > .file-object.type-audio {
width: auto;
height: 30px;
}
@media (min-width: 576px) {
.file-zoom-dialog .modal-dialog {
max-width: 500px;
}
}
@media (min-width: 992px) {
.file-zoom-dialog .modal-lg {
max-width: 800px;
}
}
@media (max-width: 767px) {
.file-preview-thumbnails {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.file-zoom-dialog .modal-header {
flex-direction: column;
}
}
@media (max-width: 350px) {
.krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content {
width: 160px;
}
}
@media (max-width: 420px) {
.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered {
width: 100%;
}
}
.file-loading[dir=rtl]:before {
background: transparent url(loading.gif) top right no-repeat;
padding-left: 0;
padding-right: 20px;
}
.clickable .file-drop-zone-title {
cursor: pointer;
}
.file-sortable .file-drag-handle:hover {
opacity: 0.7;
}
.file-sortable .file-drag-handle {
cursor: grab;
opacity: 1;
}
.file-grabbing,
.file-grabbing * {
cursor: not-allowed !important;
}
.file-grabbing .file-preview-thumbnails * {
cursor: grabbing !important;
}
.file-preview-frame.sortable-chosen {
background-color: #d9edf7;
border-color: #17a2b8;
box-shadow: none !important;
}
.file-preview .kv-zoom-cache {
display: none;
}

File diff suppressed because it is too large Load Diff

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