Pre Merge pull request !438 from SKaiL/skail

This commit is contained in:
SKaiL 2023-02-09 09:01:44 +00:00 committed by Gitee
commit 4db6ec1c6a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1082 changed files with 283533 additions and 105192 deletions

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
custom: http://doc.ruoyi.vip/ruoyi/other/donate.html

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
.git
.svn
###################################################################### ######################################################################
# Build Tools # Build Tools

36
README.en.md Normal file
View File

@ -0,0 +1,36 @@
# NJWorkOrder
#### Description
南京WorkOrder
#### 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/)

129
README.md
View File

@ -1,102 +1,37 @@
<p align="center"> # NJWorkOrder
<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.6</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.6-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>
## 平台简介 #### 介绍
南京WorkOrder
一直想做一款后台管理系统看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的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) [![加入QQ群](https://img.shields.io/badge/185760789-blue.svg)](https://jq.qq.com/?_wv=1027&k=Cqd66IKe) 1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,89 +0,0 @@
若依系统开发环境搭建手册
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

33
pom.xml
View File

@ -4,32 +4,34 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId> <artifactId>WorkOrder</artifactId>
<version>4.7.6</version> <version>4.7.5</version>
<name>ruoyi</name> <name>NJ_WorkOrder</name>
<url>http://www.ruoyi.vip</url> <!-- <url>http://www.ruoyi.vip</url>-->
<description>若依管理系统</description> <description>NJ_WorkOrder</description>
<properties> <properties>
<ruoyi.version>4.7.6</ruoyi.version> <ruoyi.version>4.7.5</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<shiro.version>1.10.1</shiro.version> <shiro.version>1.9.1</shiro.version>
<thymeleaf.extras.shiro.version>2.1.0</thymeleaf.extras.shiro.version> <thymeleaf.extras.shiro.version>2.1.0</thymeleaf.extras.shiro.version>
<druid.version>1.2.15</druid.version> <druid.version>1.2.11</druid.version>
<bitwalker.version>1.21</bitwalker.version> <bitwalker.version>1.21</bitwalker.version>
<kaptcha.version>2.3.3</kaptcha.version> <kaptcha.version>2.3.2</kaptcha.version>
<swagger.version>3.0.0</swagger.version> <swagger.version>3.0.0</swagger.version>
<pagehelper.boot.version>1.4.6</pagehelper.boot.version> <mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
<pagehelper.boot.version>1.4.3</pagehelper.boot.version>
<fastjson.version>1.2.83</fastjson.version> <fastjson.version>1.2.83</fastjson.version>
<oshi.version>6.4.0</oshi.version> <oshi.version>6.2.2</oshi.version>
<commons.io.version>2.11.0</commons.io.version> <commons.io.version>2.11.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version> <commons.fileupload.version>1.4</commons.fileupload.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
<mail.version>1.6.2</mail.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
@ -54,7 +56,7 @@
<!-- 验证码 --> <!-- 验证码 -->
<dependency> <dependency>
<groupId>pro.fessional</groupId> <groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId> <artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version> <version>${kaptcha.version}</version>
</dependency> </dependency>
@ -94,6 +96,13 @@
<version>${bitwalker.version}</version> <version>${bitwalker.version}</version>
</dependency> </dependency>
<!-- SpringBoot集成mybatis框架 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring-boot.version}</version>
</dependency>
<!-- pagehelper 分页插件 --> <!-- pagehelper 分页插件 -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>

View File

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>ruoyi</artifactId> <artifactId>WorkOrder</artifactId>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<version>4.7.6</version> <version>4.7.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> <packaging>jar</packaging>
@ -67,6 +67,13 @@
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>
<!-- SpringBoot 测试 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -16,15 +16,31 @@ public class RuoYiApplication
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args); SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ Silergy 工作流审批系统启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" + " \n" +
" | _ _ \\ \\ \\ / / \n" + " \n" +
" | ( ' ) | \\ _. / ' \n" + " SSSSSSSSSSSSSSS iiii lllllll \n" +
" |(_ o _) / _( )_ .' \n" + " SS:::::::::::::::S i::::i l:::::l \n" +
" | (_,_).' __ ___(_ o _)' \n" + "S:::::SSSSSS::::::S iiii l:::::l \n" +
" | |\\ \\ | || |(_,_)' \n" + "S:::::S SSSSSSS l:::::l \n" +
" | | \\ `' /| `-' / \n" + "S:::::S iiiiiii l::::l eeeeeeeeeeee rrrrr rrrrrrrrr ggggggggg ggggg yyyyyyy yyyyyyy\n" +
" | | \\ / \\ / \n" + "S:::::S i:::::i l::::l ee::::::::::::ee r::::rrr:::::::::r g:::::::::ggg::::g y:::::y y:::::y \n" +
" ''-' `'-' `-..-' "); " S::::SSSS i::::i l::::l e::::::eeeee:::::ee r:::::::::::::::::r g:::::::::::::::::g y:::::y y:::::y \n" +
" SS::::::SSSSS i::::i l::::l e::::::e e:::::e rr::::::rrrrr::::::r g::::::ggggg::::::gg y:::::y y:::::y \n" +
" SSS::::::::SS i::::i l::::l e:::::::eeeee::::::e r:::::r r:::::r g:::::g g:::::g y:::::y y:::::y \n" +
" SSSSSS::::S i::::i l::::l e:::::::::::::::::e r:::::r rrrrrrr g:::::g g:::::g y:::::y y:::::y \n" +
" S:::::S i::::i l::::l e::::::eeeeeeeeeee r:::::r g:::::g g:::::g y:::::y:::::y \n" +
" S:::::S i::::i l::::l e:::::::e r:::::r g::::::g g:::::g y:::::::::y \n" +
"SSSSSSS S:::::S i::::::i l::::::l e::::::::e r:::::r g:::::::ggggg:::::g y:::::::y \n" +
"S::::::SSSSSS:::::S i::::::i l::::::l e::::::::eeeeeeee r:::::r g::::::::::::::::g y:::::y \n" +
"S:::::::::::::::SS i::::::i l::::::l ee:::::::::::::e r:::::r gg::::::::::::::g y:::::y \n" +
" SSSSSSSSSSSSSSS iiiiiiii llllllll eeeeeeeeeeeeee rrrrrrr gggggggg::::::g y:::::y \n" +
" g:::::g y:::::y \n" +
" gggggg g:::::g y:::::y \n" +
" g:::::gg gg:::::g y:::::y \n" +
" g::::::ggg:::::::g y:::::y \n" +
" gg:::::::::::::g yyyyyyy \n" +
" ggg::::::ggg \n" +
" gggggg ");
} }
} }

View File

@ -0,0 +1,532 @@
package com.ruoyi.web.controller.api;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.FormFileConstants;
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.enums.BusinessType;
import com.ruoyi.common.enums.OrderTypes;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.framework.jwt.utils.JwtUtils;
import com.ruoyi.system.component.paymentRequest.PaymentRequestComponentApp;
import com.ruoyi.system.domain.FormFile;
import com.ruoyi.system.domain.PaymentAccount;
import com.ruoyi.system.domain.ProcessFlow;
import com.ruoyi.system.domain.paymentRequest.PaymentAuditResults;
import com.ruoyi.system.domain.paymentRequest.PaymentRequest;
import com.ruoyi.system.domain.paymentRequest.PaymentRequestDt1;
import com.ruoyi.system.service.IFormFileService;
import com.ruoyi.system.service.IPaymentAccountService;
import com.ruoyi.system.service.IProcessFlowService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.paymentRequest.IPaymentRequestDt1Service;
import com.ruoyi.system.service.paymentRequest.IPaymentRequestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
import java.util.stream.Collectors;
@Controller
@RequestMapping("/api/paymentRequest")
public class PaymentRequestApi extends BaseController {
private static final Logger log = LoggerFactory.getLogger(PaymentRequestApi.class);
private String prefix = "system/paymentRequest";
@Autowired
private ISysUserService userService;
@Autowired
private PaymentRequestComponentApp paymentRequestComponentApp;
@Autowired
private IPaymentRequestService paymentRequestService;
@Autowired
private IProcessFlowService processFlowService;
@Autowired
private IPaymentRequestDt1Service paymentRequestDt1Service;
@Autowired
private IFormFileService formFileService;
@Autowired
private IPaymentAccountService paymentAccountService;
/**
* 列表查询
* @param infos 信息
* @param sid 操作用户
* @param token 令牌
* @return
*/
@Log(title = "请款单API列表查询", businessType = BusinessType.OTHER)
@RequestMapping("/page")
@ResponseBody
public AjaxResult paymentRequestPage(@RequestParam(name="infos")String infos,
@RequestParam(name="sid")String sid,
@RequestParam(name="token")String token) {
// if (!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
log.info("请款单APP列表查询接口infos数据------>{},sid数据------>{}", infos, sid);
Map<String, Object> apiParameter = JSON.parseObject(infos, Map.class);
if (StringUtils.isNull(apiParameter)) {
log.error("请款单APP列表查询接口出错未获取到正确infos数据问题infos------>{}", infos);
return error(-1, "查询列表信息出错请稍后重试或联系IT人员。");
}
SysUser user = userService.selectUserByUserCode(sid);
if (StringUtils.isNull(user)) {
log.error("请款单APP列表查询接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
PaymentRequest paymentRequest = new PaymentRequest();
List<PaymentRequest> resList = new ArrayList<>();
if(Objects.equals(apiParameter.get("type").toString(),"1")){
//说明是列表
//拥有FinanceAudit角色\老总\管理员查看所有
List<SysRole> roles = user.getRoles().stream().filter(r -> r.getRoleKey().equals("FinanceAudit")).collect(Collectors.toList());
if (user.isAdmin() || StringUtils.isNotEmpty(roles) ||
user.getUserCode().contains("S00001") ||
user.getUserCode().contains("S00002") ||
user.getUserCode().contains("S00003")) {
}else {
//只能查看自己的
paymentRequest.setEmployeeNo(sid);
// paymentRequest.setDept(user.getDept().getDeptName().trim());
}
resList = paymentRequestService.selectPaymentRequestList(paymentRequest);
}else if(Objects.equals(apiParameter.get("type").toString(),"2")){
//说明是我的待办
if (!user.isAdmin()) {
paymentRequest.setSendToCode(sid);
}
// startPage();
resList = paymentRequestService.selectPaymentRequestList(paymentRequest);
}else if(Objects.equals(apiParameter.get("type").toString(),"3")){
//说明是我的已办
// startPage();
paymentRequest.setHandlesCode(sid);
resList = paymentRequestService.selectPaymentRequestList(paymentRequest);
}
return AjaxResult.success("S",resList);
}
/**
* 移动端新增请款
* @param infos 请款单数据
* @param file0 文件1
* @param file1 文件2
* @param file2 文件3
* @param file3 文件4
* @param operationType 操作类型, 1-保存, 2-提交
* @param sid 员工编号
* @param token 令牌
* @return 结果
*/
@Log(title = "请款单API新增", businessType = BusinessType.INSERT)
@PostMapping("/add/{operationType}")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public AjaxResult addPaymentRequestSave(@RequestParam(name="infos")String infos,
@RequestParam(name = "file0", required = false) MultipartFile file0,
@RequestParam(name = "file1", required = false) MultipartFile file1,
@RequestParam(name = "file2", required = false) MultipartFile file2,
@RequestParam(name = "file3", required = false) MultipartFile file3,
@PathVariable(name = "operationType", required = false) String operationType,
@RequestParam(name="sid")String sid,
@RequestParam(name="token")String token) {
// if (!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
PaymentRequest paymentRequest = JSON.parseObject(infos, PaymentRequest.class);
if (StringUtils.isNull(paymentRequest)) {
log.error("请款单APP新增接口出错未获取到正确infos数据问题infos------>{}", infos);
return error(-1, "新增请款单出错请稍后重试或联系IT人员。");
}
SysUser user = userService.selectUserByUserCode(sid);
if (StringUtils.isNull(user)) {
log.error("请款单APP新增接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
String msg = paymentRequestComponentApp.insertCheck(paymentRequest);
if (StringUtils.isNotEmpty(msg)) {
return error(-1, msg);
}
paymentRequest.setApplicant(user.getUserName());
paymentRequest.setEmployeeNo(user.getUserCode());
paymentRequest.setDept(user.getDept().getDeptName());
paymentRequest.setDeptCode(user.getDepartmentCode());
AjaxResult ajaxResult;
try {
ajaxResult = paymentRequestService.insertPaymentRequest(paymentRequest, user);
//文件上传
List<MultipartFile> files = new ArrayList<>();
if (StringUtils.isNotNull(file0)){
files.add(file0);
}
if (StringUtils.isNotNull(file1)){
files.add(file1);
}
if (StringUtils.isNotNull(file2)){
files.add(file2);
}
if (StringUtils.isNotNull(file3)){
files.add(file3);
}
if (StringUtils.isNotEmpty(files)){
// for (MultipartFile file:files) {
// String filePath = RuoYiConfig.getUploadPath();
// String fileNameRes = file.getOriginalFilename().replaceAll(" ","").replaceAll("&","");
// String suffix = fileNameRes.substring(fileNameRes.lastIndexOf("."));
// String filePath1 = FileUploadUtils.upload(filePath, file, suffix);
// PaymentRequestFile paymentRequestFile = new PaymentRequestFile();
// paymentRequestFile.setAssociationId(ajaxResult.get("data"));
// paymentRequestFile.setType(1);
// paymentRequestFile.setFile(filePath1);
// paymentRequestFile.setFileName(fileNameRes);
// paymentRequestFile.setCreateTime(new Date());
// paymentRequestFileService.insertPaymentRequestFile(paymentRequestFile);
// }
}
if (Objects.equals(operationType, "2")) {
//进行提交
paymentRequestService.submitProcess((Long) ajaxResult.get("data"), user);
}
} catch (Exception e) {
log.error("请款单APP新增接口提交出错", e);
return error(-1, "提交出错请稍后重试或联系IT人员。");
}
return success(ajaxResult.get("data").toString());
}
/**
* APP详情(包含审核页面详情)
* @param id
* @param type
* @param sid
* @param token
* @return
*/
@RequestMapping(value = "/detail/{id}/{type}")
@ResponseBody
public AjaxResult paymentRequestDetail(@PathVariable("id") Long id,
@PathVariable("type") Integer type,
@RequestParam(name="sid")String sid,
@RequestParam(name="token")String token)
{
// if (!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
SysUser user = userService.selectUserByUserCode(sid);
if (StringUtils.isNull(user)) {
log.error("请款单APP详情接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
Map<String,Object> map = new HashMap<>();
try {
PaymentRequest paymentRequest = paymentRequestService.selectPaymentRequestById(id);
if (StringUtils.isNull(paymentRequest)){
log.error("请款单APP详情接口出错未查询到主数据信息问题ID------>{}",id);
throw new GlobalException("获取请款单主数据出错!");
}
map.put("paymentRequest", paymentRequest);
PaymentRequestDt1 paymentRequestDt1 = new PaymentRequestDt1();
paymentRequestDt1.setRequestId(id);
List<PaymentRequestDt1> paymentRequestDt1List = paymentRequestDt1Service.selectPaymentRequestDt1List(paymentRequestDt1);
map.put("paymentRequestDt1List", paymentRequestDt1List);
ProcessFlow processFlow = new ProcessFlow();
processFlow.setOrderId(id);
processFlow.setOrderType(OrderTypes.PAYMENT_REQUEST.getCode());
List<ProcessFlow> lists = processFlowService.selectProcessFlowListByOrderId(id,OrderTypes.PAYMENT_REQUEST.getCode());
map.put("lists", lists);
FormFile formFile = new FormFile();
formFile.setFileType(FormFileConstants.PAYMENTREQUEST);
formFile.setParentId(id);
List<FormFile> formFiles = formFileService.selectFormFileList(formFile);
map.put("listFile", formFiles);
//详情页功能控制
Map<String, Object> resultMap = paymentRequestComponentApp.editableArea(paymentRequest, user, type);
map.put("event", resultMap);
}catch (Exception e){
log.error("请款单APP详情接口出错获取详情信息时出错------>{}", e);
return error(-1, "获取详情出错请稍后重试或联系IT人员。");
}
return AjaxResult.success("S",map);
}
/**
* 审核提交
* @param infos 审核信息
* @param sid 操作用户
* @param token 令牌
* @return
*/
@Log(title = "请款单API审核提交", businessType = BusinessType.UPDATE)
@RequestMapping("/auditSubmit")
@ResponseBody
public AjaxResult requisitionSubmit1(@RequestParam(name="infos")String infos,
@RequestParam(name="sid")String sid,
@RequestParam(name="token")String token)
{
// if(!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
log.info("请款单审核提交API 表单数据------>{},操作人------>{}",infos,sid);
try {
//解析数据
PaymentAuditResults auditResults = JSON.parseObject(infos, PaymentAuditResults.class);
PaymentRequest paymentRequestRes = paymentRequestService.selectPaymentRequestById(auditResults.getPaymentRequestId());
SysUser userRes = userService.selectUserByUserCode(sid);
if(!paymentRequestRes.getSendToCode().contains(userRes.getUserCode()) && !userRes.isAdmin()){
return error(-1,"已经签核完成,请签核下一单");
}
paymentRequestService.auditSubmit(auditResults, userRes, paymentRequestRes);
} catch (GlobalException e){
return error(-1, e.getMessage());
} catch (Exception e){
log.error("请款单审核提交API出错错误------>{}",e);
return error(-1,"提交失败请返回重试或联系IT人员。");
}
return AjaxResult.success("Success","操作成功");
}
/**
* 批量审核
* @param infos
* @param sid
* @param token
* @return
*/
@Log(title = "请款单API批量审核", businessType = BusinessType.UPDATE)
@PostMapping("/batchReview")
@ResponseBody
public AjaxResult batchReview(@RequestParam(name="infos")String infos,
@RequestParam(name="sid")String sid,
@RequestParam(name="token")String token){
// if(!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
long startTime = System.currentTimeMillis(); // 开始时间
log.info("请款单批量审核API 表单数据------>{},操作人------>{}",infos,sid);
String s = "";
try {
//解析数据
PaymentAuditResults auditResults = JSON.parseObject(infos, PaymentAuditResults.class);
SysUser userRes = userService.selectUserByUserCode(sid);
s = paymentRequestService.paymentRequestBatchReview(auditResults, userRes);
} catch (GlobalException e){
return error(-1, e.getMessage());
} catch (Exception e){
log.error("请款单批量审核API出错错误------>{}",e);
return error(-1,"提交失败请返回重试或联系IT人员。");
}
long endTime = System.currentTimeMillis(); // 执行完时间
log.info("APP批量审核花费时间 timecost=[{}]ms;",(endTime - startTime)); // 计算时间差
return AjaxResult.success("Success",s.replaceAll("<br/>","\n"));
}
/**
* 获取表单下拉框信息
*
* @return
*/
@RequestMapping("/getSelectInformation")
@ResponseBody
public AjaxResult getSelectInformation(){
// if (!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
Map<Object, Object> map = paymentRequestComponentApp.selectInformation();
return AjaxResult.success("success",map);
}
/**
* 上传附件
*
* @param multipartFiles
* @return
*/
@Log(title = "请款单API上传附件", businessType = BusinessType.INSERT)
@PostMapping(value = "/file/upload")
@ResponseBody
public AjaxResult uploadFile1(@RequestParam("file") MultipartFile multipartFiles)
{
if (multipartFiles == null) {
return error(8, "文件为空。");
}
Map<String, String> map = new HashMap<>();
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileNameRes = multipartFiles.getOriginalFilename().replaceAll(" ", "").replaceAll("&", "");
String suffix = fileNameRes.substring(fileNameRes.lastIndexOf("."));
String fileName = FileUploadUtils.uploads(filePath, multipartFiles, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
String url = fileName;
map.put("fileName", fileNameRes);
map.put("filePath", url);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success("success", map);
}
/**
* 删除请款单
* @param infos
* @return
*/
@Log(title = "请款单API删除", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(@RequestParam(name = "infos") String infos, @RequestParam(name = "token") String token) {
// if (!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
String ids;
try {
HashMap map = JSON.parseObject(infos, HashMap.class);
ids = (String) map.get("ids");
if (StringUtils.isEmpty(ids)) {
throw new GlobalException("删除失败请稍后重试或联系IT人员。");
}
paymentRequestService.deletePaymentRequestByIds(ids);
return success();
} catch (GlobalException businessException) {
log.error("请款单删除API出错错误原因------>", businessException.getMessage());
return error(-1, businessException.getMessage());
} catch (Exception exception) {
log.error("请款单删除API出错错误原因------>", exception);
return error(-1, "删除失败请稍后重试或联系IT人员。");
}
}
/**
* 请款单撤回
* @param infos 请款单信息
* @param token token
* @return
*/
@Log(title = "请款单API撤回", businessType = BusinessType.UPDATE)
@PostMapping("/withdrawal")
@ResponseBody
public AjaxResult Withdrawal(@RequestParam(name = "infos") String infos, @RequestParam(name = "token") String token) {
// if (!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
Long id;
try {
HashMap map = JSON.parseObject(infos, HashMap.class);
id = Long.valueOf((String)map.get("id"));
if (StringUtils.isNull(id)) {
throw new GlobalException("撤回失败请稍后重试或联系IT人员。");
}
paymentRequestService.WithdrawalOfInitiation(id);
return success();
} catch (GlobalException businessException) {
return error(businessException.getMessage());
} catch (Exception e) {
log.error("请款单撤回API出错错误原因------>", e);
return error(-1, "操作失败请稍后重试或联系IT人员。");
}
}
/**
* 请款单编辑
* @param infos 请款单信息
* @param operationType 操作类型 1-保存, 2-提交
* @param sid 员工编号
* @param token 令牌
* @return 结果
*/
@Log(title = "请款单API编辑", businessType = BusinessType.UPDATE)
@PostMapping("/edit/{operationType}")
@ResponseBody
public AjaxResult editSave(@RequestParam(name = "infos") String infos,
@PathVariable(name = "operationType", required = false) String operationType,
@RequestParam(name="sid")String sid,
@RequestParam(name = "token") String token) {
// if (!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
PaymentRequest paymentRequest = JSON.parseObject(infos, PaymentRequest.class);
if (StringUtils.isNull(paymentRequest)) {
log.error("请款单APP编辑接口出错未获取到正确infos数据问题infos------>{}", infos);
return error(-1, "操作失败请稍后重试或联系IT人员。");
}
SysUser user = userService.selectUserByUserCode(sid);
if (StringUtils.isNull(user)) {
log.error("请款单APP编辑接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
String msg = paymentRequestComponentApp.insertCheck(paymentRequest);
if (StringUtils.isNotEmpty(msg)) {
return error(-1, msg);
}
Long paymentRequestId;
try {
AjaxResult ajaxResult = paymentRequestService.updatePaymentRequest(paymentRequest);
if (Objects.equals(operationType, "2")) {
//进行提交
paymentRequestService.submitProcess((Long) ajaxResult.get("data"), user);
}
return success();
} catch (GlobalException businessException) {
return error(businessException.getMessage());
} catch (Exception e) {
log.error("请款单编辑API出错错误原因------>", e);
return error(-1, "操作失败请稍后重试或联系IT人员。");
}
}
/**
* 请款单历史付款信息
* @param sid 用户id
* @param token 令牌
* @return
*/
@RequestMapping("/payAccountHistory")
@ResponseBody
public AjaxResult payAccountHistory(@RequestParam(name="sid")String sid,
@RequestParam(name="token")String token) {
// if(!TokenUtil.verifyToken(token)) {
// return error(-1, "身份信息过期请联系IT人员。");
// }
Map<String,Object> mmap = new HashMap<>();
SysUser user = userService.selectUserByLoginName(sid);
if (StringUtils.isNull(user)) {
log.error("请款单APP列表查询接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
PaymentAccount paymentAccount = new PaymentAccount();
paymentAccount.setCreateBy(user.getUserCode());
//历史付款账号信息
mmap.put("payeeList", paymentAccountService.selectPaymentAccountList(paymentAccount));
return AjaxResult.success("S",mmap);
}
}

View File

@ -0,0 +1,618 @@
package com.ruoyi.web.controller.api;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
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.enums.OrderTypes;
import com.ruoyi.common.enums.RequisitionStatus;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.CacheUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.system.component.requisition.RequisitionComponent;
import com.ruoyi.system.component.requisition.RequisitionComponentApp;
import com.ruoyi.system.domain.FormFile;
import com.ruoyi.system.domain.ProcessFlow;
import com.ruoyi.system.domain.requisition.Requisition;
import com.ruoyi.system.domain.requisition.RequisitionAuditResults;
import com.ruoyi.system.dto.requisition.RequisitionDto;
import com.ruoyi.system.service.IFormFileService;
import com.ruoyi.system.service.IProcessFlowService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.requisition.IRequisitionService;
import com.ruoyi.web.controller.common.CommonController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
@Controller
@RequestMapping("/api/requisition")
public class RequisitionAppApi extends BaseController
{
protected final Logger log = LoggerFactory.getLogger(this.getClass());
private String prefix = "system/requisition";
@Autowired
private IRequisitionService requisitionService;
@Autowired
private IProcessFlowService processFlowService;
@Autowired
private ISysUserService userService;
@Autowired
private RequisitionComponentApp requisitionComponentApp;
@Autowired
private IFormFileService formFileService;
@Autowired
private CommonController commonController;
/**
* 获取表单下拉框信息
*
* @param token
* @return
*/
@RequestMapping("/getSelectInformation")
@ResponseBody
public AjaxResult getSelectInformation(@RequestParam(name = "token") String token)
{
/*if (!JwtUtils.verify(token)) {
return error(-1, "身份信息过期请联系IT人员。");
}*/
Map<Object, Object> map = requisitionComponentApp.selectInformation();
return AjaxResult.success("success", map);
}
/**
* 获取供应商信息
*
* @return
*/
@RequestMapping("/getCodeName")
@ResponseBody
public AjaxResult getCodeName(@RequestParam(name = "token") String token)
{
return AjaxResult.success("success", CacheUtils.get(Constants.SYS_SUPPLIER_CACHE, Constants.SYS_SUPPLIER_KEY));
}
/**
* 人员下拉接口
*
* @param userName
* @return
*/
@RequestMapping(value = "/user/search")
@ResponseBody
public AjaxResult userSearch(@RequestParam(name = "userName", required = false) String userName)
{
return AjaxResult.success("success", null);
}
/**
* 请购单新增
*
* @param infos 请购单信息
* @param file0 文件1
* @param file1 文件2
* @param file2 文件3
* @param file3 文件4
* @param operationType 操作类型
* @param sid 员工编号
* @param token 令牌
* @return 结果
*/
@Log(title = "请购单API新增", businessType = BusinessType.INSERT)
@RequestMapping("/add/{operationType}")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public AjaxResult addSave(@RequestParam(name = "infos") String infos,
@RequestParam(name = "file0", required = false) MultipartFile file0,
@RequestParam(name = "file1", required = false) MultipartFile file1,
@RequestParam(name = "file2", required = false) MultipartFile file2,
@RequestParam(name = "file3", required = false) MultipartFile file3,
@PathVariable(name = "operationType", required = false) String operationType,
@RequestParam(name = "sid") String sid,
@RequestParam(name = "token") String token)
{
log.info("请购单APP新增接口infos数据------>{},sid数据------>{}", infos, sid);
SysUser user = userService.selectUserByLoginName(sid);
if (StringUtils.isNull(user)) {
log.error("请购单APP新增接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
RequisitionDto requisitionDto = JSON.parseObject(infos, RequisitionDto.class);
if (StringUtils.isNull(requisitionDto)) {
log.error("请购单APP新增接口出错未获取到正确infos数据问题infos------>{}", infos);
return error(-1, "新增请购单出错请稍后重试或联系IT人员。");
}
String msg = requisitionComponentApp.insertCheck(requisitionDto);
if (StringUtils.isNotEmpty(msg)) {
return error(-1, msg);
}
requisitionDto.getRequisition().setCreateBy(user.getUserName());
requisitionDto.getRequisition().setCreateByCode(user.getUserCode());
requisitionDto.getRequisition().setStatus(RequisitionStatus.SAVE.getCode());
requisitionDto.getRequisition().setCreateTime(DateUtils.getNowDate());
requisitionDto.getRequisition().setUpdateTime(DateUtils.getNowDate());
requisitionDto.getRequisition().setUserDepartment(user.getDept().getDeptName());
requisitionDto.getRequisition().setUserName(user.getUserName());
requisitionDto.getRequisition().setOffice(user.getOffices());
requisitionDto.getRequisition().setSendToCode(user.getUserCode());
Long requisitionId;
try {
Requisition requisition = requisitionDto.getRequisition();
requisition.setRequisitionDt1List(requisitionDto.getRequisitionDt1s());
requisition.setRequisitionDt2List(requisitionDto.getRequisitionDt2s());
requisitionId = requisitionService.insertRequisition(requisitionDto.getRequisition(), user);
//文件上传
List<MultipartFile> files = new ArrayList<>();
if (StringUtils.isNotNull(file0)) {
files.add(file0);
}
if (StringUtils.isNotNull(file1)) {
files.add(file1);
}
if (StringUtils.isNotNull(file2)) {
files.add(file2);
}
if (StringUtils.isNotNull(file3)) {
files.add(file3);
}
//文件上传相关
/*if (StringUtils.isNotEmpty(files)){
for (MultipartFile file:files) {
String filePath = RuoYiConfig.getUploadPath();
String fileNameRes = file.getOriginalFilename().replaceAll(" ","").replaceAll("&","");
String suffix = fileNameRes.substring(fileNameRes.lastIndexOf("."));
String filePath1 = FileUploadUtils.upload(filePath, file, suffix);
RequisitionFile requisitionFile = new RequisitionFile();
requisitionFile.setAssociationId(requisitionId);
requisitionFile.setType(1);
requisitionFile.setFile(filePath1);
requisitionFile.setFileName(fileNameRes);
requisitionFileService.insertRequisitionFile(requisitionFile);
}
}*/
if (Objects.equals(operationType, "2")) {
requisitionService.submit(requisitionId, user);
}
} catch (GlobalException e) {
log.error("请购单APP新增接口提交出错--->", e);
return error(-1, "提交出错请稍后重试或联系IT人员。");
} catch (Exception e) {
log.error("请购单APP新增接口提交出错", e);
return error(-1, "提交出错请稍后重试或联系IT人员。");
}
return AjaxResult.success("success", requisitionId);
}
/**
* 请购单列表
*
* @param infos
* @param sid
* @param token
* @return
*/
@Log(title = "请购单API列表查询", businessType = BusinessType.OTHER)
@RequestMapping("/page")
@ResponseBody
public AjaxResult page(@RequestParam(name = "infos") String infos,
@RequestParam(name = "sid") String sid,
@RequestParam(name = "token") String token)
{
log.info("请购单APP列表查询接口infos数据------>{},sid数据------>{}", infos, sid);
Map<String, Object> apiParameter = JSON.parseObject(infos, Map.class);
if (StringUtils.isNull(apiParameter)) {
log.error("请购单APP列表查询接口出错未获取到正确infos数据问题infos------>{}", infos);
return error(-1, "查询列表信息出错请稍后重试或联系IT人员。");
}
SysUser user = userService.selectUserByUserCode(sid);
if (StringUtils.isNull(user)) {
log.error("请购单APP列表查询接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
Requisition requisition = new Requisition();
List<Requisition> resList = null;
if (Objects.equals(apiParameter.get("type").toString(), "1")) {
//说明是列表
requisition.setEmployeeNo(user.getUserCode());
resList = requisitionService.selectRequisitionList(requisition);
} else if (Objects.equals(apiParameter.get("type").toString(), "2")) {
//说明是我的待办
if (!user.isAdmin()) {
requisition.setSendToCode(sid);
}
resList = requisitionService.selectRequisitionList(requisition);
} else if (Objects.equals(apiParameter.get("type").toString(), "3")) {
//说明是我的已办
requisition.setHandlesCode(sid);
resList = requisitionService.selectRequisitionList(requisition);
} else {
return error(-1, "查询列表信息出错请稍后重试或联系IT人员。");
}
return AjaxResult.success("success", resList);
}
/**
* APP详情(包含审核页面详情)
*
* @param id 请购单id
* @param type 列表类型(1.类别 2.待办 3.已办)
* @param sid 处理人code
* @param token
* @return
*/
@RequestMapping(value = "/detail/{id}/{type}")
@ResponseBody
public AjaxResult deatil(@PathVariable("id") Long id,
@PathVariable("type") Integer type,
@RequestParam(name = "sid") String sid,
@RequestParam(name = "token") String token)
{
SysUser user = userService.selectUserByUserCode(sid);
if (StringUtils.isNull(user)) {
log.error("请购单APP详情接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
Map<String, Object> map = new HashMap<>();
try {
Requisition requisition = requisitionService.selectRequisitionById(id);
if (StringUtils.isNotEmpty(requisition.getTotalAmount())) {
requisition.setRemark(requisition.getTotalAmount());
}
map.put("requisition", requisition);
map.put("requisitionDt1s", requisition.getRequisitionDt1List());
map.put("requisitionDt2s", requisition.getRequisitionDt2List());
ProcessFlow processFlow = new ProcessFlow();
processFlow.setOrderId(id);
processFlow.setOrderType(OrderTypes.REQUISITION.getCode());
List<ProcessFlow> list = processFlowService.selectProcessFlowList(processFlow);
map.put("lists", list);
FormFile requisitionFile = new FormFile();
requisitionFile.setParentId(id);
List<FormFile> listFile = formFileService.selectFormFileList(requisitionFile);
listFile.forEach(f -> f.setFile(f.getFilePath()));
map.put("listFile", listFile);
Map<String, Object> resultMap = requisitionComponentApp.editableArea(requisition, user, type);
map.put("event", resultMap);
} catch (Exception e) {
log.error("请购单APP详情接口出错获取详情信息时出错------>{}", e);
return error(-1, "获取详情出错请稍后重试或联系IT人员。");
}
return AjaxResult.success("success", map);
}
/**
* 审核提交
*
* @param infos 审核信息
* @param sid 操作用户
* @param token 令牌
* @return
*/
@Log(title = "请购单API审核提交", businessType = BusinessType.UPDATE)
@RequestMapping("/auditSubmit")
@ResponseBody
public AjaxResult requisitionSubmit(@RequestParam(name = "infos") String infos,
@RequestParam(name = "sid") String sid,
@RequestParam(name = "token") String token)
{
log.info("请购单审核提交API 表单数据------>{},操作人------>{}", infos, sid);
try {
//解析数据
RequisitionAuditResults auditResults = JSON.parseObject(infos, RequisitionAuditResults.class);
Requisition requisitionRes = requisitionService.selectRequisitionById(auditResults.getRequisitionId());
SysUser userRes = userService.selectUserByUserCode(sid);
if (!requisitionRes.getSendToCode().equals(userRes.getUserCode()) && !userRes.isAdmin()) {
return error(-1, "已经签核完成,请签核下一单");
}
requisitionService.auditSubmit(auditResults, userRes);
} catch (GlobalException e) {
return error(-1, e.getMessage());
} catch (Exception e) {
log.error("请购单审核提交API出错错误------>{}", e);
return error(-1, "提交失败请返回重试或联系IT人员。");
}
return AjaxResult.success("success", "操作成功");
}
/**
*
*
* @param infos
* @param sid
* @param token
* @param response
* @param request
* @return
*/
/*@RequestMapping(value = "/file/download")
@ResponseBody
public AjaxResult downloadFile(@RequestParam(name = "infos") String infos,
@RequestParam(name = "sid") String sid,
@RequestParam(name = "token") String token, HttpServletResponse response, HttpServletRequest request)
{
if (StringUtils.isEmpty(infos)) {
return error(-1, "下载文件出错请稍后重试或联系IT人员。");
}
log.info("请购单下载附件API 数据------>{},操作人------>{}", infos, sid);
Map<String, String> resultMap = new HashMap<>();
HashMap map = JSON.parseObject(infos, HashMap.class);
String filePath = (String) map.get("filepath");
String ext = FileUtils.ext(filePath);
try {
String filePathRes = RuoYiConfig.getUploadPath() + filePath;
File f = new File(filePathRes);
if (!f.exists()) {
throw new FileNotFoundException(filePathRes);
}
// 读取图片字节数组
ByteArrayOutputStream bos = new ByteArrayOutputStream((int) f.length());
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(f));
int buf_size = 1024;
byte[] buffer = new byte[buf_size];
int len = 0;
while (-1 != (len = in.read(buffer, 0, buf_size))) {
bos.write(buffer, 0, len);
}
in.close();
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
String file = requisitionComponentApp.byteToBase64(bos.toByteArray());
resultMap.put("file", file);
resultMap.put("title", UUID.randomUUID().toString());
resultMap.put("extension", ext);
return AjaxResult.success("success", resultMap);
} catch (Exception e) {
log.error("请购单下载文件API出错错误------>{}", e);
return error(-1, "下载文件出错请稍后重试或联系IT人员。");
}
}*/
/**
* 上传附件
*
* @param multipartFiles
* @return
*/
@Log(title = "请购单API附件上传", businessType = BusinessType.INSERT)
@PostMapping(value = "/file/upload")
@ResponseBody
public AjaxResult uploadFile1(@RequestParam("file") MultipartFile multipartFiles)
{
if (multipartFiles == null) {
return error(8, "文件为空。");
}
Map<String, String> map = new HashMap<>();
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileNameRes = multipartFiles.getOriginalFilename().replaceAll(" ", "").replaceAll("&", "");
String suffix = fileNameRes.substring(fileNameRes.lastIndexOf("."));
String fileName = FileUploadUtils.uploads(filePath, multipartFiles, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
String url = fileName;
map.put("fileName", fileNameRes);
map.put("filePath", url);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success("success", map);
}
/**
* 下载文件
*
* @param infos
* @param sid
* @param token
* @param response
* @param request
* @return
*/
@Log(title = "请购单API附件下载", businessType = BusinessType.OTHER)
@RequestMapping(value = "/file/download/image")
@ResponseBody
public AjaxResult download(@RequestParam(name = "infos") String infos,
@RequestParam(name = "sid") String sid,
@RequestParam(name = "token") String token, HttpServletResponse response, HttpServletRequest request)
{
if (StringUtils.isEmpty(infos)) {
return error(-1, "下载文件出错请稍后重试或联系IT人员。");
}
Map<String, String> resultMap = new HashMap<>();
HashMap map = JSON.parseObject(infos, HashMap.class);
String filePath = (String) map.get("filepath");
String suffix = filePath.substring(filePath.lastIndexOf("."));
try {
if (".jpg".equals(suffix) || ".png".equals(suffix)) {
String filePathRes = RuoYiConfig.getUploadPath() + filePath;
File f = new File(filePathRes);
if (!f.exists()) {
throw new FileNotFoundException(filePathRes);
}
// 读取图片字节数组
ByteArrayOutputStream bos = new ByteArrayOutputStream((int) f.length());
BufferedInputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(f));
int buf_size = 1024;
byte[] buffer = new byte[buf_size];
int len = 0;
while (-1 != (len = in.read(buffer, 0, buf_size))) {
bos.write(buffer, 0, len);
}
in.close();
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
String file = requisitionComponentApp.byteToBase64(bos.toByteArray());
if (".jpg".equals(suffix)) {
suffix = ".jpeg";
}
file = "data:image/" + suffix.replace(".", "") + ";base64," + file;
resultMap.put("file", file);
return AjaxResult.success("success", resultMap);
} else {
String fileName = UUID.randomUUID().toString();
commonController.resourceDownloads(filePath, fileName, request, response);
return null;
}
} catch (Exception e) {
log.error("下载失败");
return error(-1, "下载文件出错请稍后重试或联系IT人员。");
}
}
/**
* 删除请购单
*
* @param infos
* @return
*/
@Log(title = "请购单API删除", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(@RequestParam(name = "infos") String infos, @RequestParam(name = "token") String token)
{
String ids;
try {
HashMap map = JSON.parseObject(infos, HashMap.class);
ids = (String) map.get("ids");
if (StringUtils.isEmpty(ids)) {
throw new GlobalException("删除失败请稍后重试或联系IT人员。");
}
requisitionService.deleteRequisitionByIds(ids);
return success();
} catch (GlobalException e) {
log.error("请购单删除API出错错误原因------>", e.getMessage());
return error(-1, e.getMessage());
} catch (Exception exception) {
log.error("请购单删除API出错错误原因------>", exception);
return error(-1, "删除失败请稍后重试或联系IT人员。");
}
}
/**
* 获取项目编号
*
* @return 项目编号列表
*/
@PostMapping("/getProjectCode")
@ResponseBody
public AjaxResult getProjectCode(@RequestParam(name = "token") String token)
{
return AjaxResult.success("success!", CacheUtils.get(Constants.ZT_WGCPRORELEASE_CACHE, Constants.ZT_WGCPRORELEASE_KEY + "proCode"));
}
/**
* 撤回请购单
*
* @param infos 请购单信息
* @param token 令牌
* @return
*/
@Log(title = "请购单API撤回", businessType = BusinessType.UPDATE)
@PostMapping("/withdrawal")
@ResponseBody
public AjaxResult withdrawal(@RequestParam(name = "infos") String infos, @RequestParam(name = "token") String token)
{
Long id;
try {
HashMap map = JSON.parseObject(infos, HashMap.class);
id = Long.valueOf((String) map.get("id"));
if (StringUtils.isNull(id)) {
throw new GlobalException("撤回失败请稍后重试或联系IT人员。");
}
requisitionService.withdraw(id);
return success();
} catch (GlobalException e) {
log.error("请购单删除API出错错误原因------>", e.getMessage());
return error(-1, e.getMessage());
} catch (Exception exception) {
log.error("请购单撤回API出错错误原因------>", exception);
return error(-1, "操作失败,发生未知异常,请保存截图,在系统工单模块发起“工作流审批系统”工单反馈。");
}
}
/**
* 请购单编辑
*
* @param infos 请购单信息
* @param operationType 操作类型
* @param sid 员工编号
* @param token 令牌
* @return 结果
*/
@Log(title = "请购单API编辑", businessType = BusinessType.UPDATE)
@PostMapping("/edit/{operationType}")
@ResponseBody
public AjaxResult editSave(@RequestParam(name = "infos") String infos,
@PathVariable(name = "operationType", required = false) String operationType,
@RequestParam(name = "sid") String sid,
@RequestParam(name = "token") String token)
{
RequisitionDto requisitionDto = JSON.parseObject(infos, RequisitionDto.class);
if (StringUtils.isNull(requisitionDto)) {
log.error("请购单APP编辑接口出错未获取到正确infos数据问题infos------>{}", infos);
return error(-1, "操作失败请稍后重试或联系IT人员。");
}
SysUser user = userService.selectUserByUserCode(sid);
if (StringUtils.isNull(user)) {
log.error("请购单APP编辑接口出错未获取到正确的用户标识问题用户标识------>{}", sid);
return error(-1, "获取登录用户信息失败请重新登录或联系IT人员。");
}
String msg = requisitionComponentApp.insertCheck(requisitionDto);
if (StringUtils.isNotEmpty(msg)) {
return error(-1, msg);
}
Long requisitionId;
try {
Requisition requisition = requisitionDto.getRequisition();
requisition.setRequisitionDt1List(requisitionDto.getRequisitionDt1s());
requisition.setRequisitionDt2List(requisitionDto.getRequisitionDt2s());
requisitionId = requisitionService.updateRequisition(requisition, user);
if (Objects.equals(operationType, "2")) {
//进行提交
requisitionService.submit(requisitionId, user);
}
return success();
} catch (GlobalException e) {
return error(e.getMessage());
} catch (Exception e) {
log.error("请购单编辑API出错错误原因------>", e);
return error(-1, "操作失败请稍后重试或联系IT人员。");
}
}
}

View File

@ -2,17 +2,22 @@ package com.ruoyi.web.controller.common;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.constant.FormFileConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.system.domain.FormFile;
import com.ruoyi.system.service.IFormFileService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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 org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.config.ServerConfig; import com.ruoyi.common.config.ServerConfig;
@ -22,6 +27,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.file.FileUtils;
/** /**
* 通用请求处理 * 通用请求处理
* *
@ -36,6 +42,9 @@ public class CommonController
@Autowired @Autowired
private ServerConfig serverConfig; private ServerConfig serverConfig;
@Autowired
private IFormFileService formFileService;
private static final String FILE_DELIMETER = ","; private static final String FILE_DELIMETER = ",";
/** /**
@ -135,6 +144,105 @@ public class CommonController
} }
} }
/**
* 自定义文件上传
* @param files 文件列表
* @param type 文件类型
* @return
*/
@PostMapping("/uploadFiles")
@ResponseBody
public AjaxResult customizeUploadFile(List<MultipartFile> files, Long parentId, Integer type)
{
try
{
String uploadPath = "";
if (Objects.equals(type, FormFileConstants.PAYMENTREQUEST_TEMPLATE) || Objects.equals(type, FormFileConstants.PAYMENTREQUEST)){
uploadPath = FormFileConstants.PAYMENTREQUEST_PATH;
} else if (Objects.equals(type, FormFileConstants.REQUISTION_TEMPLATE) || Objects.equals(type, FormFileConstants.REQUISITION)){
uploadPath = FormFileConstants.REQUISITION_PATH;
} else if (Objects.equals(type, FormFileConstants.PETITION_TEMPLATE) || Objects.equals(type, FormFileConstants.PETITION)){
uploadPath = FormFileConstants.PETITION_PATH;
}
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath() + uploadPath;
List<FormFile> list = new ArrayList<>();
for (MultipartFile file : files)
{
// 上传并返回新文件名称
String path = FileUploadUtils.uploads(filePath, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
FormFile formFile = new FormFile();
if (StringUtils.isNotNull(parentId)) {
formFile.setParentId(parentId);
}
formFile.setFileType(type);
formFile.setFilePath(uploadPath + path);
formFile.setFileName(file.getOriginalFilename());
formFile.setCreateBy(ShiroUtils.getSysUser().getUserName());
formFile.setCreateTime(DateUtils.getNowDate());
list.add(formFile);
}
//保存文件信息
formFileService.batchFormFile(list);
return AjaxResult.success();
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载(自定义文件名)
* @param resource 文件路径
* @param fileName 文件名
* @throws Exception
*/
@GetMapping("/download/resources")
public void resourceDownloads(String resource, String fileName, HttpServletRequest request, HttpServletResponse response)
{
try
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = RuoYiConfig.getUploadPath();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX) + resource;
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
if(StringUtils.isNotEmpty(fileName)){
downloadName = fileName;
}
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
/**
* 本地文件删除
*/
@PostMapping("/remove/file")
@ResponseBody
public AjaxResult removeFile(FormFile formFile)
{
String filePath = RuoYiConfig.getUploadPath();
boolean b = FileUtils.deleteFile(filePath + formFile.getFilePath());
if (b) {
formFileService.deleteFormFileById(formFile.getId());
return AjaxResult.success();
} else {
return AjaxResult.error();
}
}
/** /**
* 本地资源通用下载 * 本地资源通用下载
*/ */
@ -163,4 +271,5 @@ public class CommonController
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }
} }

View File

@ -506,8 +506,8 @@ public class DemoTableController extends BaseController
} }
} }
PageDomain pageDomain = TableSupport.buildPageRequest(); PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize(); Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
Integer pageSize = pageDomain.getPageNum() * pageDomain.getPageSize(); Integer pageSize = pageDomain.getPageNum() * 10;
if (pageSize > areaList.size()) if (pageSize > areaList.size())
{ {
pageSize = areaList.size(); pageSize = areaList.size();

View File

@ -0,0 +1,883 @@
package com.ruoyi.web.controller.system;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.FormFileConstants;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.OrderTypes;
import com.ruoyi.common.enums.PaymentRequestStatus;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.CacheUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.FormFile;
import com.ruoyi.system.domain.PaymentAccount;
import com.ruoyi.system.domain.ProcessFlow;
import com.ruoyi.system.domain.paymentRequest.PaymentAuditResults;
import com.ruoyi.system.domain.paymentRequest.PaymentRequest;
import com.ruoyi.system.domain.paymentRequest.PaymentRequestDt1;
import com.ruoyi.system.domain.paymentRequest.PaymentRequestFile;
import com.ruoyi.system.domain.requisition.Requisition;
import com.ruoyi.system.dto.paymentRequest.PaymentRequestDt1Dto;
import com.ruoyi.system.service.IFormFileService;
import com.ruoyi.system.service.IPaymentAccountService;
import com.ruoyi.system.service.IProcessFlowService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.paymentRequest.IPaymentRequestDt1Service;
import com.ruoyi.system.service.paymentRequest.IPaymentRequestFileService;
import com.ruoyi.system.service.paymentRequest.IPaymentRequestService;
import com.ruoyi.system.component.paymentRequest.PaymentRequestComponent;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.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.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static com.ruoyi.common.utils.CacheUtils.getCacheKey;
import static com.ruoyi.common.utils.CacheUtils.getCacheName;
/**
* 请款单Controller
*
* @author SKaiL
* @date 2022-09-21
*/
@Controller
@RequestMapping("/system/paymentRequest")
public class PaymentRequestController extends BaseController
{
private String prefix = "system/paymentRequest";
private static final Logger log = LoggerFactory.getLogger(PaymentRequestController.class);
@Autowired
private IPaymentRequestService paymentRequestService;
@Autowired
private IPaymentAccountService paymentAccountService;
@Autowired
private PaymentRequestComponent paymentRequestComponent;
@Autowired
private IPaymentRequestDt1Service paymentRequestDt1Service;
@Autowired
private ISysUserService iSysUserService;
@Autowired
private IPaymentRequestFileService iPaymentRequestFileService;
@Autowired
private IProcessFlowService processFlowService;
@Autowired
private IFormFileService formFileService;
// @Autowired
// private RequisitionComponent requisitionComponent;
@RequiresPermissions("system:paymentRequest:view")
@GetMapping()
public String paymentRequest()
{
return prefix + "/paymentRequest";
}
/**
* 查询请款单列表
*/
@RequiresPermissions("system:paymentRequest:listAll")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(PaymentRequest paymentRequest)
{
startPage();
SysUser sysUser = ShiroUtils.getSysUser();
List<SysRole> roles = sysUser.getRoles().stream().filter(r -> r.getRoleKey().equals("FinanceAudit")).collect(Collectors.toList());
if (!sysUser.isAdmin() && StringUtils.isEmpty(roles) &&
!sysUser.getUserCode().contains("S00001") &&
!sysUser.getUserCode().contains("S00002") &&
!sysUser.getUserCode().contains("S00003")) {
//只能查看本部门
// paymentRequest.setDept(sysUser.getDept().getDeptName().trim());
//查看自己的
paymentRequest.setEmployeeNo(sysUser.getUserCode());
}
List<PaymentRequest> list = paymentRequestService.selectPaymentRequestList(paymentRequest);
paymentRequestComponent.buildList(list);
return getDataTable(list);
}
@RequiresPermissions("system:paymentRequest:view")
@GetMapping("/todo")
public String paymentRequestToDo() {
return prefix + "/paymentRequestToDo";
}
/**
* 我的待办
*/
@RequiresPermissions("system:paymentRequest:list")
@PostMapping("/list/todo")
@ResponseBody
public TableDataInfo listToDo(PaymentRequest paymentRequest) {
SysUser sysUser = ShiroUtils.getSysUser();
startPage();
if (!sysUser.isAdmin()) {
paymentRequest.setSendToCode(ShiroUtils.getSysUser().getUserCode());
}
List<PaymentRequest> list = paymentRequestService.selectPaymentRequestList(paymentRequest);
paymentRequestComponent.buildList(list);
return getDataTable(list);
}
@RequiresPermissions("system:paymentRequest:view")
@GetMapping("/do")
public String paymentRequestDo() {
return prefix + "/paymentRequestDo";
}
/**
* 我的已办
*/
@RequiresPermissions("system:paymentRequest:list")
@PostMapping("/list/do")
@ResponseBody
public TableDataInfo listDo(PaymentRequest paymentRequest) {
SysUser sysUser = ShiroUtils.getSysUser();
if (!sysUser.isAdmin()) {
paymentRequest.setHandlesCode(sysUser.getUserCode());
}
startPage();
List<PaymentRequest> list = paymentRequestService.selectPaymentRequestList(paymentRequest);
paymentRequestComponent.buildList(list);
return getDataTable(list);
}
/**
* 我的创建
*/
@RequiresPermissions("system:paymentRequest:view")
@GetMapping("/create")
public String requisitionCreate() {
return prefix + "/paymentRequestCreate";
}
@RequiresPermissions("system:paymentRequest:list")
@PostMapping("/list/create")
@ResponseBody
public TableDataInfo listCreate(PaymentRequest paymentRequest) {
SysUser sysUser = ShiroUtils.getSysUser();
if (!sysUser.isAdmin()) {
paymentRequest.setEmployeeNo(ShiroUtils.getSysUser().getUserCode());
}
startPage();
List<PaymentRequest> list = paymentRequestService.selectPaymentRequestList(paymentRequest);
paymentRequestComponent.buildList(list);
return getDataTable(list);
}
/**
* 我的草稿
*/
@RequiresPermissions("system:paymentRequest:view")
@GetMapping("/draft")
public String paymentRequestDraft() {
return prefix + "/paymentRequestDraft";
}
/**
* 我的草稿
*/
@RequiresPermissions("system:paymentRequest:list")
@PostMapping("/list/draft")
@ResponseBody
public TableDataInfo listDraft(PaymentRequest paymentRequest) {
SysUser sysUser = ShiroUtils.getSysUser();
if (!sysUser.isAdmin()) {
paymentRequest.setEmployeeNo(ShiroUtils.getSysUser().getUserCode());
}
startPage();
List<PaymentRequest> list = paymentRequestService.selectPaymentRequestListDraft(paymentRequest);
paymentRequestComponent.buildList(list);
return getDataTable(list);
}
/**
* 导出请款单列表
*/
@RequiresPermissions("system:paymentRequest:export")
@Log(title = "请款单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(PaymentRequest paymentRequest)
{
List<PaymentRequest> list = paymentRequestService.selectPaymentRequestList(paymentRequest);
ExcelUtil<PaymentRequest> util = new ExcelUtil<PaymentRequest>(PaymentRequest.class);
return util.exportExcel(list, "请款单数据");
}
/**
* 新增请款单
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
SysUser sysUser = ShiroUtils.getSysUser();
PaymentAccount paymentAccount = new PaymentAccount();
paymentAccount.setCreateBy(sysUser.getUserCode());
mmap.put("user", sysUser);
mmap.put("projectCode", CacheUtils.get(getCacheName(Constants.ZT_WGCPRORELEASE_CACHE), getCacheKey(Constants.ZT_WGCPRORELEASE_KEY,"proCode")));
return prefix + "/add";
}
/**
* 新增保存请款单
*/
@RequiresPermissions("system:paymentRequest:add")
@Log(title = "请款单", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@RequestBody PaymentRequest paymentRequest)
{
return paymentRequestService.insertPaymentRequest(paymentRequest,getSysUser());
}
/**
* 查询收款人信息
*
* @return
*/
@GetMapping("/selectPaymentInfo")
public String selectPaymentInfo() {
return prefix + "/paymentInfoList";
}
/**
* 查询收款人信息
*
* @return
*/
@PostMapping("/selectPaymentInfoList")
@ResponseBody
public TableDataInfo selectPaymentInfoList(PaymentAccount paymentAccount) {
//payee有值代表点击的全文搜索
if (StringUtils.isEmpty(paymentAccount.getPayee())) {
if (!getSysUser().isAdmin()) {
paymentAccount.setCreateBy(getSysUser().getUserCode());
}
}
startPage();
List<PaymentAccount> payeeList = paymentAccountService.selectPaymentAccountList(paymentAccount);
return getDataTable(payeeList);
}
/**
* 修改请款单
*/
@RequiresPermissions("system:paymentRequest:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
PaymentRequest paymentRequest = paymentRequestService.selectPaymentRequestById(id);
PaymentAccount paymentAccount = new PaymentAccount();
paymentAccount.setParentId(id);
PaymentRequestDt1 paymentRequestDt1 = new PaymentRequestDt1();
paymentRequestDt1.setRequestId(id);
List<PaymentRequestDt1> paymentRequestDt1List = paymentRequestDt1Service.selectPaymentRequestDt1List(paymentRequestDt1);
//历史付款账号信息
PaymentAccount paymentAccounts = new PaymentAccount();
paymentAccounts.setCreateBy(paymentRequest.getCreateByCode());
mmap.put("payeeList", paymentAccountService.selectPaymentAccountList(paymentAccounts));
mmap.put("paymentRequest", paymentRequest);
mmap.put("paymentRequestDt1List", paymentRequestDt1List);
mmap.put("projectCode", CacheUtils.get(getCacheName(Constants.ZT_WGCPRORELEASE_CACHE), getCacheKey(Constants.ZT_WGCPRORELEASE_KEY,"proCode")));
return prefix + "/edit";
}
/**
* 修改保存请款单
*/
@RequiresPermissions("system:paymentRequest:edit")
@Log(title = "请款单", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@RequestBody PaymentRequest paymentRequest)
{
return paymentRequestService.updatePaymentRequest(paymentRequest);
}
/**
* 复制请款
*/
@GetMapping("/copy/{id}")
public String copy(@PathVariable("id") Long id, ModelMap mmap) {
PaymentRequest paymentRequest = paymentRequestService.selectPaymentRequestById(id);
PaymentAccount paymentAccount = new PaymentAccount();
paymentAccount.setParentId(id);
PaymentRequestDt1 paymentRequestDt1 = new PaymentRequestDt1();
paymentRequestDt1.setRequestId(id);
List<PaymentRequestDt1> paymentRequestDt1List = paymentRequestDt1Service.selectPaymentRequestDt1List(paymentRequestDt1);
PaymentAccount paymentAccounts = new PaymentAccount();
paymentAccounts.setCreateBy(paymentRequest.getCreateByCode());
//历史付款账号信息
mmap.put("payeeList", paymentAccountService.selectPaymentAccountList(paymentAccounts));
mmap.put("paymentRequest", paymentRequest);
mmap.put("paymentRequestDt1List", paymentRequestDt1List);
mmap.put("projectCode", CacheUtils.get(getCacheName(Constants.ZT_WGCPRORELEASE_CACHE), getCacheKey(Constants.ZT_WGCPRORELEASE_KEY,"proCode")));
return prefix + "/addCopy";
}
/**
* 进行提交
*/
@Log(title = "请款单提交", businessType = BusinessType.OTHER)
@GetMapping("/start/submit")
@ResponseBody
public AjaxResult startSubmit(@RequestParam("id") Long id) {
PaymentRequest paymentRequest = paymentRequestService.selectPaymentRequestById(id);
if(!getSysUser().isAdmin()&&!Objects.equals(paymentRequest.getSendToCode(),getSysUser().getUserCode())){
throw new GlobalException("提交失败!只允许申请人操作。");
}
SysUser sysUser = getSysUser();
return paymentRequestService.submitProcess(id, sysUser);
}
/**
* 进入审核页面
*/
@GetMapping("/review/{id}")
public String review(@PathVariable("id") Long id, ModelMap mmap) {
PaymentRequest paymentRequest = paymentRequestService.selectPaymentRequestById(id);
PaymentAccount paymentAccount = new PaymentAccount();
paymentAccount.setParentId(id);
SysUser user = new SysUser();
user.setStatus("0");
List<SysUser> userList = iSysUserService.selectUserList(user);
Iterator<SysUser> iterator = userList.iterator();
while (iterator.hasNext()) {
SysUser next = iterator.next();
//不是S开头人员
if (StringUtils.isEmpty(next.getUserCode())) {
iterator.remove();
} else if (!Objects.equals(next.getUserCode().substring(0, 1), "S")) {
iterator.remove();
}
}
// mmap.put("userList", userList);
PaymentRequestDt1 paymentRequestDt1 = new PaymentRequestDt1();
paymentRequestDt1.setRequestId(id);
List<PaymentRequestDt1> paymentRequestDt1List = paymentRequestDt1Service.selectPaymentRequestDt1List(paymentRequestDt1);
paymentRequestComponent.approvalProgress(paymentRequest);
mmap.put("paymentRequest", paymentRequest);
mmap.put("paymentRequestDt1List", paymentRequestDt1List);
ProcessFlow processFlow = new ProcessFlow();
processFlow.setOrderId(id);
processFlow.setOrderType(OrderTypes.PAYMENT_REQUEST.getCode());
List<ProcessFlow> lists = processFlowService.selectProcessFlowListByOrderId(id,OrderTypes.PAYMENT_REQUEST.getCode());
mmap.put("lists", lists);
// mmap.put("progressbar", paymentRequestComponent.approvalProgress(lists, toBeReviewed, paymentRequest));
FormFile formFile = new FormFile();
formFile.setFileType(FormFileConstants.PAYMENTREQUEST);
formFile.setParentId(id);
List<FormFile> formFiles = formFileService.selectFormFileList(formFile);
mmap.put("listFile", formFiles);
return prefix + "/review";
}
/**
* 删除请款单
*/
@RequiresPermissions("system:paymentRequest:remove")
@Log(title = "请款单", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(paymentRequestService.deletePaymentRequestByIds(ids));
}
/**
* 通用审核提交
*
* @param paymentAuditResults 审核信息
* @return
*/
@Log(title = "请款单审核提交", businessType = BusinessType.OTHER)
@PostMapping("/supervisor/auditSubmit")
@ResponseBody
public AjaxResult paymentRequestAuditSubmit(@RequestBody PaymentAuditResults paymentAuditResults) {
try {
forReview(paymentAuditResults.getPaymentRequestId());
paymentRequestService.auditSubmit(paymentAuditResults, getSysUser(),null);
} catch (GlobalException businessException){
return error(businessException.getMessage());
} catch (Exception e){
log.error("审核提交请款单出错,错误原因--->", e);
return error("操作失败,发生未知异常,请保存截图,在系统工单模块发起“工作流审批系统”工单反馈。");
}
return success();
}
@GetMapping(value = {"/filePage/{type}/{flag}","/filePage/{id}/{type}/{flag}"})
public String filePage(@PathVariable(value = "id",required = false) Long id, @PathVariable("type") Integer type,
@PathVariable("flag") Boolean flag, ModelMap mmap)
{
mmap.put("paymentRequestId", id);
//文件类型 11使用文档, 1请购单附件
mmap.put("type", type);
mmap.put("flag", flag);
//模版不允许普通用户删除
if (Objects.equals(FormFileConstants.PAYMENTREQUEST_TEMPLATE, type)){
if (getSysUser().isAdmin()){
mmap.put("flag", true);
} else {
mmap.put("flag", false);
}
}
return prefix + "/filePage";
}
/**
* 查询filePage页面数据
*/
/**
* 查询文件列表
*/
@PostMapping("/filePageList")
@ResponseBody
public TableDataInfo filePage(@RequestParam(value = "paymentRequestId",required = false) Long paymentRequestId,
@RequestParam("type") Integer type)
{
return getDataTable(paymentRequestService.selectFormFile(paymentRequestId, type));
}
// @GetMapping("/downloadFile")
// public void downloadFile(@RequestParam("fileName") String fileName, @RequestParam("filePath") String filePath, HttpServletRequest request, HttpServletResponse response)
// {
//// FileDownloadUtils.resourceDownload(filePath, fileName, request, response);
// }
/**
* 请款单附件删除
* @param id
* @param file
* @param paymentRequestId
* @return
*/
@Log(title = "请款单附件删除", businessType = BusinessType.UPDATE)
@GetMapping("/remove/file")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public AjaxResult removeFile(String id, String file, Long paymentRequestId) {
return null;
}
/**
* 进入新增附件页面
*/
@GetMapping("/addFile/{id}")
public String forFaReportUpload(@PathVariable("id") Long id, ModelMap mmap) {
mmap.put("paymentRequestId", id);
return prefix + "/addFile";
}
/**
* 上传文件
*/
@PostMapping("/addFile/save")
@ResponseBody
public AjaxResult addFileSave(@RequestParam("file") MultipartFile file, @RequestParam("paymentRequestId") Long paymentRequestId) throws IOException {
return success();
}
/**
* 查看相关模板
*
* @return
*/
@GetMapping("/templatePage")
public String templatePage() {
return prefix + "/templatePage";
}
/**
* 相关模板列表
*/
@PostMapping("/templateList")
@ResponseBody
public TableDataInfo templatePageList(FormFile formFile) {
formFile.setFileType(11);
startPage();
List<FormFile> list = formFileService.selectFormFileList(formFile);
return getDataTable(list);
}
/**
* 进入新增模板页面
*/
@GetMapping("/addTemplate")
public String forTemplateUpload(ModelMap mmap) {
return prefix + "/addTemplate";
}
/**
* 新增相关模板
*/
/* @Log(title = "请款单模版新增", businessType = BusinessType.INSERT)
@PostMapping("/addTemplate/save")
@ResponseBody
public AjaxResult addtemplateSave(@RequestParam("file") MultipartFile file) throws IOException {
String filePath = RuoYiConfig.getUploadPath();
String fileName = file.getOriginalFilename().replaceAll(" ","").replaceAll("&","");
String suffix = fileName.substring(fileName.lastIndexOf("."));
// String filePath1 = FileUploadUtils.upload(filePath, file,suffix);
PaymentRequestFile paymentRequestFile = new PaymentRequestFile();
paymentRequestFile.setType(2);
// paymentRequestFile.setFile(filePath1);
paymentRequestFile.setFileName(fileName);
iPaymentRequestFileService.insertPaymentRequestFile(paymentRequestFile);
return toAjax(true);
}*/
/**
* 删除相关模板
*/
@RequiresPermissions("system:paymentRequest:templateOperation")
@Log(title = "请款单模版删除", businessType = BusinessType.UPDATE)
@GetMapping("/remove/templateFile")
@ResponseBody
public AjaxResult removeTemplate(Long id) {
FormFile formFile = formFileService.selectFormFileById(id);
// PaymentRequestFile paymentRequestFile = iPaymentRequestFileService.selectPaymentRequestFileById(id);
String filePath = RuoYiConfig.getUploadPath();
boolean b = FileUtils.deleteFile(filePath + formFile.getFilePath());
if (b) {
formFileService.deleteFormFileByIds(id.toString());
// iPaymentRequestFileService.deletePaymentRequestFileByIds(id.toString());
return success("删除成功");
} else {
return error("删除失败");
}
}
@GetMapping("/downloadFileDescription")
public void downloadFileDescription(HttpServletRequest request, HttpServletResponse response)
throws Exception {
FormFile formFile = new FormFile();
formFile.setFileType(11);
List<FormFile> formFiles = formFileService.selectFormFileList(formFile);
String filePath = formFiles.get(0).getFilePath();
String fileName = formFiles.get(0).getFileName();
try
{
if (!FileUtils.checkAllowDownload(filePath))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", filePath));
}
// 本地资源路径
String localPath = RuoYiConfig.getUploadPath();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX) + filePath;
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
if(StringUtils.isNotEmpty(fileName)){
downloadName = fileName;
}
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
/**
* 详情页
*/
@GetMapping("/detail/{id}/{type}")
public String deatil(@PathVariable("id") Long id, @PathVariable("type") Integer type, ModelMap mmap) {
PaymentRequest paymentRequest = paymentRequestService.selectPaymentRequestById(id);
PaymentAccount paymentAccount = new PaymentAccount();
paymentAccount.setParentId(id);
PaymentRequestDt1 paymentRequestDt1 = new PaymentRequestDt1();
paymentRequestDt1.setRequestId(id);
List<PaymentRequestDt1> paymentRequestDt1List = paymentRequestDt1Service.selectPaymentRequestDt1List(paymentRequestDt1);
paymentRequestComponent.approvalProgress(paymentRequest);
mmap.put("paymentRequest", paymentRequest);
mmap.put("paymentRequestDt1List", paymentRequestDt1List);
ProcessFlow processFlow = new ProcessFlow();
processFlow.setOrderId(id);
processFlow.setOrderType(OrderTypes.PAYMENT_REQUEST.getCode());
List<ProcessFlow> lists = processFlowService.selectProcessFlowListByOrderId(id,OrderTypes.PAYMENT_REQUEST.getCode());
mmap.put("lists", lists);
FormFile formFile = new FormFile();
formFile.setFileType(FormFileConstants.PAYMENTREQUEST);
formFile.setParentId(id);
List<FormFile> formFiles = formFileService.selectFormFileList(formFile);
mmap.put("listFile", formFiles);
mmap.put("isClose", "0");
//陈总审核暂时上传审批截图按钮
List<ProcessFlow> collect = lists.stream().filter(pf -> (Objects.equals(paymentRequest.getEmployeeNo(), getSysUser().getUserCode())
|| getSysUser().isAdmin()) && Objects.equals(pf.getCreateByCode(), "S00001")
&& StringUtils.isNull(pf.getAuditResult())).collect(Collectors.toList());
if (StringUtils.isNotEmpty(collect) && Objects.equals(collect.get(0).getStatus(), paymentRequest.getStatus())){
mmap.put("isClose", "1");
}
if (Objects.equals(type, 2)){
//展示审批截图
if (paymentRequest.getStatus() == 21 && StringUtils.isNotEmpty(paymentRequest.getCloseFile())) {
String url = paymentRequest.getCloseFile();
if (url.contains(".jpg") || url.contains(".png")) {
mmap.put("url", url);
}
}
return prefix + "/detailPDF";
} else {
return prefix + "/detail";
}
}
/**
* 请款单撤回
*
* @param id 请款单id
* @return
*/
@GetMapping("/withdrawal")
@ResponseBody
public AjaxResult Withdrawal(Long id) {
return paymentRequestService.WithdrawalOfInitiation(id);
}
/**
* 上传签核截图页面
* @param id 请款单id
* @param mmap
* @return
*/
@RequiresPermissions("system:paymentRequest:edit")
@GetMapping("/addClosePaymentRequestFile/{paymentRequestId}")
public String forAddClosePaymentRequestFileUpload(@PathVariable("paymentRequestId") String id, ModelMap mmap)
{
mmap.put("paymentRequestId", id);
return prefix + "/closePaymentRequestFile";
}
/**
* 上传签核截图
* @param file 文件
* @param paymentRequestIds 请款单id
* @return
* @throws IOException
*/
@RequiresPermissions("system:paymentRequest:edit")
@PostMapping("/addClosePaymentRequestFile/save")
@ResponseBody
public AjaxResult addClosePaymentRequestFileSave(@RequestParam("file") MultipartFile file,
@RequestParam("paymentRequestId") String paymentRequestIds,
@RequestParam("type") Integer type) {
return paymentRequestService.closePaymentRequestFile(file, paymentRequestIds, type, ShiroUtils.getSysUser());
}
/**
* 下载截图凭证
* @param id 请款单id
* @param resource 文件地址
* @param request
* @param response
* @throws Exception
*/
@GetMapping("/download/ClosePaymentRequestFile")
public void downloadClosePaymentRequestFile(@RequestParam("id") Long id, @RequestParam("resource") String resource,
HttpServletRequest request, HttpServletResponse response)throws Exception
{
}
/**
* 验证当前用户有无审核权限
* @param id 请款单id
*/
public void forReview(Long id) {
PaymentRequest paymentRequest = paymentRequestService.selectPaymentRequestById(id);
if (!Objects.equals(paymentRequest.getSendToCode(),getSysUser().getUserCode()) &&
!getSysUser().isAdmin() && !paymentRequest.getSendToCode().contains(getSysUser().getUserCode())) {
throw new GlobalException("已经签核完成,请签核下一单");
}
}
/**
* 更改待审核人
* @param paymentRequestId
* @return
*/
@RequiresPermissions("system:paymentRequest:changeReviewer")
@PostMapping("/changeReviewer")
@ResponseBody
public AjaxResult changeReviewer(@RequestParam("paymentRequestId") Long paymentRequestId,
@RequestParam("sendToCode") String sendToCode){
PaymentRequest paymentRequest = new PaymentRequest();
paymentRequest.setId(paymentRequestId);
paymentRequest.setSendToCode(sendToCode);
paymentRequestService.updatePaymentRequest(paymentRequest);
return success();
}
/**
* 批量审核界面
* @param ids
* @param map
* @return
*/
@GetMapping("/batchReview/{ids}")
public String batchReview(@PathVariable("ids") String ids, ModelMap map){
map.put("ids", ids);
return prefix + "/batchReview";
}
/**
* 批量审核
* @param auditResults 审核信息
* @return
*/
@PostMapping("/batchReview")
@ResponseBody
public AjaxResult batchReview(@RequestBody PaymentAuditResults auditResults){
return success(paymentRequestService.paymentRequestBatchReview(auditResults, getSysUser()));
}
/**
* 删除付款账号信息
* @param ids
* @return
*/
@PostMapping("/remove/paymentAccount")
@ResponseBody
public AjaxResult removePaymentAccountInfo(String ids){
return toAjax(paymentAccountService.deletePaymentAccountByIds(ids));
}
/**
* 发送加急邮件
* @param id
* @return
*/
@PostMapping("/expedited")
@ResponseBody
public AjaxResult expedited(@RequestParam("id") Long id) {
paymentRequestComponent.sendExpeditedEmail(id);
return success();
}
/**
* 上传汇总表
* @return
*/
@RequiresPermissions("system:paymentRequest:view")
@GetMapping("/summary")
public String summary(){
return prefix + "/summary";
}
/**
* 上传汇总表
* @return
*/
@PostMapping("/summaryTable")
@ResponseBody
public AjaxResult summaryTable(@RequestParam("file") MultipartFile file, @RequestParam("paymentDate")String paymentDate){
return paymentRequestComponent.summaryTable(file, paymentDate);
}
@GetMapping("/importSummaryTemplate")
@ResponseBody
public AjaxResult importSummaryTemplate()
{
PaymentRequestFile paymentRequestFile = new PaymentRequestFile();
paymentRequestFile.setType(2);
List<PaymentRequestFile> list = iPaymentRequestFileService.selectPaymentRequestFileList(paymentRequestFile);
PaymentRequestFile file = list.get(list.size() - 1);
AjaxResult result = new AjaxResult();
result.put("code", 0);
result.put("fileName", file.getFileName());
result.put("filePath", file.getFile());
return result;
}
/**
* 上传明细表
* @return
*/
@RequiresPermissions("system:paymentRequest:view")
@GetMapping("/uploadDetail")
public String uploadDetail(){
return prefix + "/uploadDetail";
}
/**
* TODO
* 上传明细表
* @return
*/
@PostMapping("/uploadDetailTable")
@ResponseBody
public AjaxResult uploadDetailTable(@RequestParam("file") MultipartFile file, @RequestParam("deptCode")String deptCode){
return paymentRequestComponent.uploadDetailTable(file,deptCode);
}
@GetMapping("/importUploadDetailTemplate")
@ResponseBody
public AjaxResult importUploadDetailTemplate()
{
ExcelUtil<PaymentRequestDt1Dto> util = new ExcelUtil<>(PaymentRequestDt1Dto.class);
return util.importTemplateExcel("上传明细表");
}
/**
* 异步计算金额
* @return
*/
@PostMapping("/calculateTheAmount")
@ResponseBody
public AjaxResult calculateTheAmount(@RequestBody PaymentRequest paymentRequest){
AjaxResult result = new AjaxResult();
result.put("code", 0);
result.put("data", paymentRequestComponent.calculateTheAmount(paymentRequest));
return result;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,477 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.FormFileConstants;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.OrderTypes;
import com.ruoyi.common.enums.RequisitionStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.CacheUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.component.requisition.RequisitionComponent;
import com.ruoyi.system.domain.ProcessFlow;
import com.ruoyi.system.domain.requisition.Requisition;
import com.ruoyi.system.domain.requisition.RequisitionAuditResults;
import com.ruoyi.system.service.IProcessFlowService;
import com.ruoyi.system.service.requisition.IRequisitionService;
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;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 请购单Controller
*
* @author SKaiL
* @date 2022-09-26
*/
@Controller
@RequestMapping("/system/requisition")
public class RequisitionController extends BaseController
{
private String prefix = "system/requisition";
@Autowired
private IRequisitionService requisitionService;
@Autowired
private IProcessFlowService processFlowService;
@Autowired
private RequisitionComponent requisitionComponent;
@RequiresPermissions("system:requisition:view")
@GetMapping()
public String requisition()
{
return prefix + "/requisition";
}
/**
* 查询请购单列表
*/
@RequiresPermissions("system:requisition:listAll")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(Requisition requisition)
{
startPage();
List<Requisition> list = requisitionService.selectRequisitionList(requisition);
return getDataTable(list);
}
@RequiresPermissions("system:requisition:view")
@GetMapping("/create")
public String requisitionCreate()
{
return prefix + "/requisitionCreate";
}
/**
* 我的创建
*/
@RequiresPermissions("system:requisition:list")
@PostMapping("/list/create")
@ResponseBody
public TableDataInfo listCreate(Requisition requisition)
{
SysUser sysUser = ShiroUtils.getSysUser();
//财务稽核和管理员查看所有
if (!sysUser.isAdmin()) {
requisition.setEmployeeNo(getSysUser().getUserCode());
}
startPage();
List<Requisition> list = requisitionService.selectRequisitionList(requisition);
return getDataTable(list);
}
@GetMapping("/draft")
public String requisitionDraft()
{
return prefix + "/requisitionDraft";
}
/**
* 我的草稿
*/
@PostMapping("/list/draft")
@ResponseBody
public TableDataInfo listDraft(Requisition requisition)
{
SysUser sysUser = ShiroUtils.getSysUser();
//财务稽核和管理员查看所有
if (!sysUser.isAdmin()) {
requisition.setEmployeeNo(getSysUser().getUserCode());
}
startPage();
List<Requisition> list = requisitionService.selectRequisitionListDraft(requisition);
return getDataTable(list);
}
@RequiresPermissions("system:requisition:view")
@GetMapping("/todo")
public String requisitionTodo()
{
return prefix + "/requisitionToDo";
}
/**
* 我的待办
*/
@RequiresPermissions("system:requisition:list")
@PostMapping("/list/todo")
@ResponseBody
public TableDataInfo listToDo(Requisition requisition)
{
SysUser sysUser = ShiroUtils.getSysUser();
if (!sysUser.isAdmin()) {
requisition.setSendToCode(getSysUser().getUserCode());
}
startPage();
List<Requisition> list = requisitionService.selectRequisitionList(requisition);
return getDataTable(list);
}
@RequiresPermissions("system:requisition:view")
@GetMapping("/do")
public String requisitionDo()
{
return prefix + "/requisitionDo";
}
/**
* 我的已办
*/
@RequiresPermissions("system:requisition:list")
@PostMapping("/list/do")
@ResponseBody
public TableDataInfo listDo(Requisition requisition)
{
requisition.setHandlesCode(ShiroUtils.getSysUser().getUserCode());
startPage();
List<Requisition> list = requisitionService.selectRequisitionList(requisition);
return getDataTable(list);
}
/**
* 导出请购单列表
*/
@RequiresPermissions("system:requisition:export")
@Log(title = "请购单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(Requisition requisition)
{
List<Requisition> list = requisitionService.selectRequisitionList(requisition);
ExcelUtil<Requisition> util = new ExcelUtil<Requisition>(Requisition.class);
return util.exportExcel(list, "请购单数据");
}
/**
* 新增请购单
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
mmap.put("user", getSysUser());
String s = requisitionComponent.buildData();
mmap.put("data", s);
mmap.put("projectCode", CacheUtils.get(Constants.ZT_WGCPRORELEASE_CACHE, Constants.ZT_WGCPRORELEASE_KEY + "proCode"));
return prefix + "/add";
}
/**
* 新增保存请购单
*/
@RequiresPermissions("system:requisition:add")
@Log(title = "请购单", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
@RepeatSubmit
public AjaxResult addSave(@RequestBody Requisition requisition)
{
return success(requisitionService.insertRequisition(requisition, getSysUser()));
}
/**
* 修改请购单
*/
@RequiresPermissions("system:requisition:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
Requisition requisition = requisitionService.selectRequisitionById(id);
mmap.put("requisition", requisition);
String s = requisitionComponent.buildData();
mmap.put("data", s);
mmap.put("projectCode", CacheUtils.get(Constants.ZT_WGCPRORELEASE_CACHE, Constants.ZT_WGCPRORELEASE_KEY + "proCode"));
return prefix + "/edit";
}
/**
* 修改保存请购单
*/
@RequiresPermissions("system:requisition:edit")
@Log(title = "请购单", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@RequestBody Requisition requisition)
{
return success(requisitionService.updateRequisition(requisition, getSysUser()));
}
/**
* 删除请购单
*/
@RequiresPermissions("system:requisition:remove")
@Log(title = "请购单", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(requisitionService.deleteRequisitionByIds(ids));
}
/**
* 请购单提交
*/
@RequiresPermissions("system:requisition:add")
@Log(title = "请购单主", businessType = BusinessType.UPDATE)
@GetMapping("/submit")
@ResponseBody
@RepeatSubmit
public AjaxResult startSubmit(@RequestParam("id") Long requisitionId) throws ServiceException
{
SysUser sysUser = ShiroUtils.getSysUser();
requisitionService.submit(requisitionId, sysUser);
return success();
}
@RequiresPermissions("system:requisition:edit")
@GetMapping(value = {"/addFile/{type}","/addFile/{id}/{type}"})
public String forFaReportUpload(@PathVariable(value = "id",required = false) Long id, @PathVariable("type") Integer type, ModelMap mmap)
{
mmap.put("requisitionId", id);
//文件类型 22使用文档, 2请购单附件
mmap.put("type", type);
return prefix + "/addFile";
}
@GetMapping(value = {"/filePage/{type}/{flag}","/filePage/{id}/{type}/{flag}"})
public String filePage(@PathVariable(value = "id",required = false) Long id, @PathVariable("type") Integer type,
@PathVariable("flag") Boolean flag, ModelMap mmap)
{
mmap.put("requisitionId", id);
//文件类型 22使用文档, 2请购单附件
mmap.put("type", type);
mmap.put("flag", flag);
//模版不允许普通用户删除
if (Objects.equals(FormFileConstants.REQUISTION_TEMPLATE, type)){
if (getSysUser().isAdmin()){
mmap.put("flag", true);
} else {
mmap.put("flag", false);
}
}
return prefix + "/filePage";
}
/**
* 查询文件列表
*/
@PostMapping("/filePageList")
@ResponseBody
public TableDataInfo filePage(@RequestParam(value = "requisitionId",required = false) Long requisitionId,
@RequestParam("type") Integer type)
{
return getDataTable(requisitionService.selectFormFile(requisitionId, type));
}
/**
* 详情页
*/
@GetMapping("/detail/{id}/{type}")
public String deatil(@PathVariable("id") Long id, @PathVariable("type") Integer type, ModelMap mmap)
{
Requisition requisition = requisitionService.selectRequisitionById(id);
requisitionComponent.approvalProgress(requisition);
mmap.put("requisition", requisition);
//审批记录
List<ProcessFlow> list = processFlowService.selectProcessFlowListByOrderId(id, OrderTypes.REQUISITION.getCode());
mmap.put("lists", list);
mmap.put("listFile", requisitionService.selectFormFile(id, FormFileConstants.REQUISITION));
mmap.put("isClose", "0");
//陈总审核暂时上传审批截图按钮
List<ProcessFlow> collect = list.stream().filter(pf -> (Objects.equals(requisition.getEmployeeNo(), getSysUser().getUserCode())
|| getSysUser().isAdmin()) && Objects.equals(pf.getCreateByCode(), "S00001")
&& StringUtils.isNull(pf.getAuditResult())).collect(Collectors.toList());
if (StringUtils.isNotEmpty(collect) && Objects.equals(collect.get(0).getStatus(), requisition.getStatus())){
mmap.put("isClose", "1");
}
if (Objects.equals(type, 2)){
//展示审批截图
if (requisition.getStatus() == 5 && StringUtils.isNotEmpty(requisition.getCloseFile())) {
String url = requisition.getCloseFile();
if (url.contains(".jpg") || url.contains(".png")) {
mmap.put("url", url);
}
}
return prefix + "/detailPDF";
} else {
return prefix + "/detail";
}
}
@GetMapping("/review/{id}")
@RequiresPermissions("system:requisition:review")
public String review(@PathVariable("id") Long id, ModelMap mmap)
{
Requisition requisition = requisitionService.selectRequisitionById(id);
requisitionComponent.approvalProgress(requisition);
mmap.put("requisition", requisition);
mmap.put("projectCode", CacheUtils.get(Constants.ZT_WGCPRORELEASE_CACHE, Constants.ZT_WGCPRORELEASE_KEY + "proCode"));
//审批记录
List<ProcessFlow> list = processFlowService.selectProcessFlowListByOrderId(id, OrderTypes.REQUISITION.getCode());
mmap.put("lists", list);
mmap.put("listFile", requisitionService.selectFormFile(id, FormFileConstants.REQUISITION));
Integer status = requisition.getStatus();
if (status.equals(RequisitionStatus.DB_OFFER.getCode())) {
//资产管理员和采购代表
return prefix + "/assetReview";
} else {
//其他
return prefix + "/review";
}
}
/**
* 请购单审核
* @param auditResults
* @return
*/
@Log(title = "请购单审核", businessType = BusinessType.OTHER)
@RequiresPermissions("system:requisition:review")
@PostMapping("/auditSubmit")
@ResponseBody
@RepeatSubmit
public AjaxResult auditSubmit(@RequestBody RequisitionAuditResults auditResults) throws ServiceException
{
return toAjax(requisitionService.auditSubmit(auditResults, getSysUser()));
}
/**
* 撤回
*
* @param id
* @return
*/
@GetMapping("/withdrawal")
@ResponseBody
public AjaxResult Withdrawal(Long id)
{
return toAjax(requisitionService.withdraw(id));
}
/**
* 上传审批截图文件
*/
@RequiresPermissions("system:requisition:edit")
@PostMapping("/addCloseRequisitionFile/save")
@ResponseBody
public AjaxResult addCloseRequisitionFileSave(@RequestParam("file") MultipartFile file,
@RequestParam("requisitionId") Long requisitionId)
{
return toAjax(requisitionService.closeRequisitionFile(file, requisitionId, getSysUser()));
}
/**
* 校验是否审核
*/
@GetMapping("/forReview/{id}")
@ResponseBody
public AjaxResult forReview(@PathVariable("id") Long id) {
Requisition requisition = requisitionService.selectRequisitionById(id);
if(!ShiroUtils.getSysUser().isAdmin()&&!Objects.equals(requisition.getSendToCode(),ShiroUtils.getLoginName())){
throw new ServiceException("已经签核完成,请签核下一单。");
}
return AjaxResult.success();
}
/**
* 使用说明相关文档下载
* @param request
* @param response
* @throws Exception
*/
@GetMapping("/downloadFileDescription/{type}")
public void downloadFileDescription(@PathVariable("type")Integer type,
HttpServletRequest request, HttpServletResponse response)
{
requisitionService.downloadFileDescription(type, response);
}
/**
* 批量审核界面
* @param ids
* @param map
* @return
*/
@GetMapping("/batchReview/{ids}")
public String batchReview(@PathVariable("ids") String ids, ModelMap map){
map.put("ids", ids);
return prefix + "/batchReview";
}
/**
* 批量审核
* @param auditResults 审核信息
* @return
*/
@PostMapping("/batchReview")
@ResponseBody
public AjaxResult batchReview(@RequestBody RequisitionAuditResults auditResults){
return success(requisitionService.requisitionBatchReview(auditResults, getSysUser()));
}
@GetMapping("/forCodeNamePage/{index}")
public String getCodeName(@PathVariable("index") String index, ModelMap mmap)
{
mmap.put("index", index);
return prefix + "/doCodeNameTree";
}
/**
* 厂商比议价信息
*
* @return
*/
@GetMapping("/doCodeNameTreeData")
@ResponseBody
public List<Ztree> doCodeNameTreeData()
{
Object o = CacheUtils.get(Constants.SYS_SUPPLIER_CACHE, Constants.SYS_SUPPLIER_KEY);
// return JSONObject.parseArray((String) o, Ztree.class);
return StringUtils.cast(o);
}
}

View File

@ -1,9 +1,16 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.Date; import java.util.*;
import java.util.List;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.enums.PetitionStatus;
import com.ruoyi.system.domain.paymentRequest.PaymentRequest;
import com.ruoyi.system.domain.petition.Petition;
import com.ruoyi.system.domain.requisition.Requisition;
import com.ruoyi.system.service.paymentRequest.IPaymentRequestService;
import com.ruoyi.system.service.petition.IPetitionService;
import com.ruoyi.system.service.requisition.IRequisitionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
@ -43,6 +50,15 @@ public class SysIndexController extends BaseController
@Autowired @Autowired
private SysPasswordService passwordService; private SysPasswordService passwordService;
@Autowired
private IPaymentRequestService paymentRequestService;
@Autowired
private IRequisitionService requisitionService;
@Autowired
private IPetitionService petitionService;
// 系统首页 // 系统首页
@GetMapping("/index") @GetMapping("/index")
public String index(ModelMap mmap) public String index(ModelMap mmap)
@ -130,7 +146,96 @@ public class SysIndexController extends BaseController
@GetMapping("/system/main") @GetMapping("/system/main")
public String main(ModelMap mmap) public String main(ModelMap mmap)
{ {
// 取身份信息
SysUser user = getSysUser();
String userCode = user.getUserCode();
if (Objects.equals(userCode, "S00001")){
user.setUserName("陈总");
}else if (Objects.equals(userCode, "S00002")){
user.setUserName("游总");
}
PaymentRequest paymentRequest = new PaymentRequest();
Requisition requisition = new Requisition();
Petition petition = new Petition();
// Order order = new Order();
// Mrpfrom mrpfrom = new Mrpfrom();
// ItUserAuthorizationFrom itUserAuthorizationFrom = new ItUserAuthorizationFrom();
// Function function = new Function();
// TravelExpenseReimbursement travelExpenseReimbursement = new TravelExpenseReimbursement();
//获取请款单我的待办
paymentRequest.setSendToCode(userCode);
List<PaymentRequest> paymentRequestList = paymentRequestService.selectPaymentRequestList(paymentRequest);
//获取请购单我的待办
requisition.setSendToCode(userCode);
List<Requisition> requisitionList = requisitionService.selectRequisitionList(requisition);
//获取电子签呈我的待办
petition.setFormSta(PetitionStatus.TODO.value());
petition.setFromSendto(userCode);
List<Petition> petitionList = petitionService.selectPetitionList(petition);
//获取出差报销单我的待办
// travelExpenseReimbursement.setSendToCode(userCode);
// List<TravelExpenseReimbursement> travelExpenseReimbursementList = travelExpenseReimbursementService.selectTravelExpenseReimbursementList(travelExpenseReimbursement);
//获取我的工单
/* List<Long> orderTypeIds = orderTypeService.selectOrderTypeIdsByEmail(user.getEmail());
if(user.getDepartmentCode() != null && user.getDepartmentCode().contains("240")){
//如果是cad部门的人那么就可以看到所有的cad的单子
OrderType orderType = new OrderType();
orderType.setParentId(41L);
List<OrderType> orderTypes = orderTypeService.selectOrderTypeList(orderType);
List<Long> collect = orderTypes.stream().map(OrderType::getOrderTypeId).collect(Collectors.toList());
orderTypeIds.addAll(collect);
List<Long> orderTypeIds1 = new ArrayList<>();
for (Long l:orderTypeIds) {
if (!orderTypeIds1.contains(l)) {
orderTypeIds1.add(l);
}
}
orderTypeIds = orderTypeIds1;
}
order.setOrderStatus(0);
List<Order> orderList = orderService.selectOrderListByDefUser(user, order, orderTypeIds);
//过滤已关闭的单子
long orderCount = orderList.stream().filter(o -> o.getOrderStatus() != -1).count();
//获取MRB表单我的待办
List<Mrpfrom> mrpfromList = mrpfromService.selectMyTodoMrpfrom(ShiroUtils.getSysUser().getUserName());
Iterator<Mrpfrom> iterator = mrpfromList.iterator();
List<Long> idArr = new ArrayList<>();
while (iterator.hasNext()) {
Long id = iterator.next().getId();
idArr.add(id);
}
if (idArr.size() != 0) {
if (getSysUser().isAdmin()){
mrpfromList = mrpfromService.selectMrpfromList(mrpfrom);
}else {
mrpfromList = mrpfromService.selectMyTodoMrpfromByIds(idArr);
}
} else {
startPage();
List<Long> list = new ArrayList<>();
list.add(Long.MAX_VALUE);
if (getSysUser().isAdmin()) {
mrpfromList = mrpfromService.selectMrpfromList(mrpfrom);
} else {
mrpfromList = mrpfromService.selectMyTodoMrpfromByIds(list);
}
}
//获取用户账号权限申请单我的待办
itUserAuthorizationFrom.setSendToCode(userCode);
List<ItUserAuthorizationFrom> itUserAuthorizationFromList = iItUserAuthorizationFromService.selectItUserAuthorizationFromList(itUserAuthorizationFrom);
//获取系统功能需求单我的待办
function.setSendToCode(userCode);
List<Function> functionList = functionService.selectFunctionList(function);*/
mmap.put("user", user);
mmap.put("version", RuoYiConfig.getVersion()); mmap.put("version", RuoYiConfig.getVersion());
mmap.put("paymentRequest", paymentRequestList.size());
mmap.put("requisition", requisitionList.size());
mmap.put("petition", petitionList.size());
/*mmap.put("travelExpenseReimbursement", travelExpenseReimbursementList.size());
mmap.put("order", orderCount);
mmap.put("mrpfrom", mrpfromList.size());
mmap.put("itUserAuthorizationFrom", itUserAuthorizationFromList.size());
mmap.put("function", functionList.size());*/
return "main"; return "main";
} }

View File

@ -2,17 +2,24 @@ package com.ruoyi.web.controller.system;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.framework.jwt.utils.JwtUtils;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysUserService;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.util.SavedRequest;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
@ -34,6 +41,12 @@ public class SysLoginController extends BaseController
@Value("${shiro.rememberMe.enabled: false}") @Value("${shiro.rememberMe.enabled: false}")
private boolean rememberMe; private boolean rememberMe;
@Autowired
private ISysUserService userService;
@Autowired
private SysPasswordService passwordService;
@Autowired @Autowired
private ConfigService configService; private ConfigService configService;
@ -60,8 +73,15 @@ public class SysLoginController extends BaseController
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
try try
{ {
SavedRequest savedRequest = (SavedRequest) ShiroUtils.getSession().getAttribute(WebUtils.SAVED_REQUEST_KEY);
subject.login(token); subject.login(token);
return success(); String url = "";
if (savedRequest != null && savedRequest.getRequestUrl() != null) {
if (savedRequest.getRequestUrl().contains("/redirect")) {
url = savedRequest.getRequestUrl().replace("/redirect", "");
}
}
return success(url);
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {
@ -74,9 +94,83 @@ public class SysLoginController extends BaseController
} }
} }
@PostMapping("/jwt/login")
@ResponseBody
public AjaxResult jwtLogin(String username, String password)
{
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
{
return AjaxResult.error("账号和密码不能为空!");
}
SysUser user = userService.selectUserByLoginName(username);
if (user == null)
{
return AjaxResult.error("用户不存在/密码错误!");
}
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
return AjaxResult.error("对不起,您的账号已被删除!");
}
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{
return AjaxResult.error("用户已封禁,请联系管理员!");
}
if (!passwordService.matches(user, password))
{
return AjaxResult.error("用户不存在/密码错误!");
}
String token = JwtUtils.createToken(username, user.getPassword());
return AjaxResult.success("登录成功,请妥善保管您的token信息").put("token", token);
}
@GetMapping("/unauth") @GetMapping("/unauth")
public String unauth() public String unauth()
{ {
return "error/unauth"; return "error/unauth";
} }
/*@RequestMapping("api/get/jsessionid")
@ResponseBody
public AjaxResult getSessionId(@CookieValue("JSESSIONID") String sessionID)
{
System.out.println(sessionID);
return AjaxResult.success(sessionID);
}
@RequestMapping("api/auto/login")
@ResponseBody
public AjaxResult autoLogin(@CookieValue("JSESSIONID") String sessionID)
{
String url = "http://192.168.5.8:8901/index.php?m=apiapp&f=scanLoginCheck";
String param = "type=WO&seid=" + sessionID;
String httpRes = HttpUtils.sendPost(url, param).replaceAll("&","");
Result result = JSONObject.parseObject(httpRes, Result.class);
if(result.getCode().equals(0)){
String email = result.getData().getEmail();
User user = iUserService.selectUserByEmail(email);
UserToken token = new UserToken(user.getLoginName(), LoginType.NOPASSWD);
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);
}
}else {
return error("扫码登录失败");
}
}*/
} }

View File

@ -63,7 +63,11 @@ public class SysProfileController extends BaseController
public boolean checkPassword(String password) public boolean checkPassword(String password)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
return passwordService.matches(user, password); if (passwordService.matches(user, password))
{
return true;
}
return false;
} }
@GetMapping("/resetPwd") @GetMapping("/resetPwd")

View File

@ -1,7 +1,13 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.common.utils.email.BootEmail;
import com.ruoyi.system.component.UserComponent;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -61,6 +67,9 @@ public class SysUserController extends BaseController
@Autowired @Autowired
private SysPasswordService passwordService; private SysPasswordService passwordService;
@Autowired
private UserComponent userComponent;
@RequiresPermissions("system:user:view") @RequiresPermissions("system:user:view")
@GetMapping() @GetMapping()
public String user() public String user()
@ -130,7 +139,7 @@ public class SysUserController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysUser user) public AjaxResult addSave(@Validated SysUser user)
{ {
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user))) if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
{ {
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在"); return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
} }
@ -176,20 +185,16 @@ public class SysUserController extends BaseController
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId()); userService.checkUserDataScope(user.getUserId());
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user))) if (StringUtils.isNotEmpty(user.getPhonenumber())
{
return error("修改用户'" + user.getLoginName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) && UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在"); return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
} }
else if (StringUtils.isNotEmpty(user.getEmail()) /*else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) && UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{ {
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
} }*/
user.setUpdateBy(getLoginName()); user.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo(); AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(userService.updateUser(user)); return toAjax(userService.updateUser(user));
@ -273,7 +278,7 @@ public class SysUserController extends BaseController
@ResponseBody @ResponseBody
public String checkLoginNameUnique(SysUser user) public String checkLoginNameUnique(SysUser user)
{ {
return userService.checkLoginNameUnique(user); return userService.checkLoginNameUnique(user.getLoginName());
} }
/** /**
@ -334,4 +339,99 @@ public class SysUserController extends BaseController
mmap.put("dept", deptService.selectDeptById(deptId)); mmap.put("dept", deptService.selectDeptById(deptId));
return prefix + "/deptTree"; return prefix + "/deptTree";
} }
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@GetMapping("/forgetPassword")
public String forgetPassword()
{
return "forgetPassword";
}
/**
* 重置密码
* @param userCode
* @param email
* @return
*/
@PostMapping("/sendForgetPassword")
@Log(title = "忘记密码并重置", businessType = BusinessType.UPDATE)
@ResponseBody
public AjaxResult forgetPassword(String userCode, String email)
{
SysUser user = userService.selectUserByEmail(email);
if (user == null) {
return error("邮箱不正确!");
}
if (!userCode.equals(user.getUserCode())) {
return error("邮箱和工号不匹配!");
}
String newPassword = "";
Random random = new Random();
for (int i = 0; i < 8; i++) {
newPassword += String.valueOf(random.nextInt(10));
}
user.setPassword(newPassword);
int result = userService.resetUserPwd(user);
if (result == 1) {
try {
BootEmail.sendSimpleMail(user.getEmail(), "重置密码", "您的工单系统密码已经重置,新密码为:"+newPassword);
} catch (Exception e) {
e.printStackTrace();
}
return success("新的密码已发送至您的邮箱,请注意查收!");
} else {
return error("重置失败请与管理员联系!");
}
}
/**
* 查看用户信息
*/
@GetMapping("/detail/{userId}")
public String detail(@PathVariable("userId") Long userId, ModelMap mmap)
{
SysUser user = userComponent.buildData(userService.selectUserById(userId));
mmap.put("user", user);
mmap.put("roles", roleService.selectRolesByUserId(userId));
mmap.put("posts", postService.selectPostsByUserId(userId));
return prefix + "/detail";
}
/**
* 查询在职员工
*
* @return
*/
@RequiresPermissions("system:user:allUserList")
@PostMapping("/allUserList")
@ResponseBody
public TableDataInfo allUserList()
{
List<SysUser> list = userService.selectAllUserList();
return getDataTable(list);
}
/**
* 获取员工信息
* @param employeeNo
* @return
*/
@PostMapping("/getEmployeeNo/{employeeNo}")
@ResponseBody
public AjaxResult getEmployeeNo(@PathVariable("employeeNo") String employeeNo) {
SysUser user = userService.selectUserByLoginName(employeeNo.trim());
if(user == null){
return error(AjaxResult.Type.ERROR,"无该用户");
}
Map<String,String> map = new HashMap<>();
map.put("departmentCode",user.getDepartmentCode());
map.put("userName",user.getUserName());
map.put("dept",user.getDept().getDeptName().trim());
map.put("office",user.getOffices());
map.put("bankName",user.getBankName());
map.put("accountNumber",user.getBankNumber());
return AjaxResult.success("",map);
}
} }

View File

@ -6,16 +6,33 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # SKaiL测试库
# url: jdbc:mysql://10.0.7.57:3306/nj_workorder?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: root
# 正式库
url: jdbc:mysql://192.168.13.216:3306/workorder?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root username: root
password: password password: Silergy1897
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
enabled: false enabled: true
url: url: jdbc:mysql://192.168.5.31:3306/insidesales?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: username: optionapi
password: password: apiq1w2e3
slave2:
# 从数据源开关/默认关闭 # 项目编号
enabled: true
url: jdbc:mysql://192.168.5.16:3306/develop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: develop
password: HSYSeLqxRQ7zwHDG
slave3:
# 从数据源开关/默认关闭 # 单点登录
enabled: true
url: jdbc:mysql://192.168.5.16:3306/onlinelogin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: onlinelogin
password: onlineloginq1w2
# 初始连接数 # 初始连接数
initialSize: 5 initialSize: 5
# 最小连接池数量 # 最小连接池数量
@ -24,10 +41,6 @@ spring:
maxActive: 20 maxActive: 20
# 配置获取连接等待超时的时间 # 配置获取连接等待超时的时间
maxWait: 60000 maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒 # 配置一个连接在池中最小生存的时间,单位是毫秒

View File

@ -0,0 +1,427 @@
#请款单相关审核信息
PaymentRequest:
MAX_A4: 10000
#B非生成性支出(持续性)-经理最大金额
MAX_B4: 5000
#C非生成性支出(非持续性)-经理最大金额
MAX_C4: 2000
#D差旅费-经理最大金额
MAX_D4: 600
#E交际费-经理最大金额
MAX_E4: 600
#A生成性支出-总监最大金额
MAX_A3: 50000
#B非生成性支出(持续性)-总监最大金额
MAX_B3: 20000
#C非生成性支出(非持续性)-总监最大金额
MAX_C3: 10000
#D差旅费-总监最大金额
MAX_D3: 1000
#E交际费-总监最大金额
MAX_E3: 1000
#A生成性支出-执行总监最大金额
MAX_A2: 100000
#B非生成性支出(持续性)-执行总监最大金额
MAX_B2: 50000
#C非生成性支出(非持续性)-执行总监最大金额
MAX_C2: 20000
#D差旅费-执行总监最大金额
MAX_D2: 2000
#E交际费-执行总监最大金额
MAX_E2: 2000
#A生成性支出-总经理最大金额
MAX_A1: 100000000000
#B非生成性支出(持续性)-总经理最大金额
MAX_B1: 100000000000
#C非生成性支出(非持续性)-总经理最大金额
MAX_C1: 100000000000
#D差旅费-总经理最大金额
MAX_D1: 100000000000
#E交际费-总经理最大金额
MAX_E1: 100000000000
#陈总,核决主管
RULING1: S00001
RULINGNAME1: 陈总
#游总,核决主管
RULING2: S00002
RULINGNAME2: 游总
#杭州会计
HZ_ACCOUNTING: S01880,S01209,S01127
HZ_ACCOUNTING_NAME: 施航\项俏俊\赵莹莹
#开曼\矽望 会计
KM_ACCOUNTING: S01034,S01132
KM_ACCOUNTING_NAME: 施梅李\胡芳洁
#南京会计
NJ_ACCOUNTING: S01707
NJ_ACCOUNTING_NAME: 梅艳
#成都会计
CD_ACCOUNTING: S00379
CD_ACCOUNTING_NAME: 马海云
#西安会计
XA_ACCOUNTING: S01522,S00379
XA_ACCOUNTING_NAME: 阎雨馨\马海云
#上海\上海矽力杰微电子 会计
SH_ACCOUNTING: S00610
SH_ACCOUNTING_NAME: 付婷
#南京香港会计
NJXG_ACCOUNTING: S01296
NJXG_ACCOUNTING_NAME: 王晶
#台湾矽力杰会计
TW_ACCOUNTING: S00671,S00356
TW_ACCOUNTING_NAME: 黃雅鈴\韓詩蕙
#香港\萨摩亚 会计
XG_ACCOUNTING: S01123
XG_ACCOUNTING_NAME: 林佳怡
#南京香港会计
HF_ACCOUNTING: S01682
HF_ACCOUNTING_NAME: 高甜
#澳门会计
AM_ACCOUNTING: S00748
AM_ACCOUNTING_NAME: 江奕萱
#杭州总账
HZ_GENERAL_LEDGER: S00152
HZ_GENERAL_LEDGER_NAME: 王娜
#开曼\矽望 总账
KM_GENERAL_LEDGER: S00600
KM_GENERAL_LEDGER_NAME: 叶小仙
#南京总账
NJ_GENERAL_LEDGER: S00467
NJ_GENERAL_LEDGER_NAME: 张玲
#成都总账
CD_GENERAL_LEDGER: S01175
CD_GENERAL_LEDGER_NAME: 庞杭艳
#西安总账
XA_GENERAL_LEDGER: S00969
XA_GENERAL_LEDGER_NAME: 畅佩华
#上海总账
SH_GENERAL_LEDGER: S01175
SH_GENERAL_LEDGER_NAME: 庞杭艳
#上海矽力杰微电子 总账
SHW_GENERAL_LEDGER: S01296
SHW_GENERAL_LEDGER_NAME: 王晶
#南京香港 总账
NJXG_GENERAL_LEDGER: S01141
NJXG_GENERAL_LEDGER_NAME: 陈京晶
#台湾总账
TW_GENERAL_LEDGER: S00356
TW_GENERAL_LEDGER_NAME: 韓詩蕙
#台湾总账(特殊处理)
TW_GENERAL_LEDGER1: S01175
TW_GENERAL_LEDGER1_NAME: 庞杭艳
#香港\萨摩亚 总账
XG_GENERAL_LEDGER: S01175
XG_GENERAL_LEDGER_NAME: 庞杭艳
#合肥总账
HF_GENERAL_LEDGER: S01175
HF_GENERAL_LEDGER_NAME: 庞杭艳
#澳门总账
AM_GENERAL_LEDGER: S01175
AM_GENERAL_LEDGER_NAME: 庞杭艳
#请购单相关审核信息
Requisition:
#经理最大金额
MAX_4: 2000
#总监最大金额
MAX_3: 10000
#执行总监最大金额
MAX_2: 20000
#总经理最大金额
MAX_1: 100000000000
#杭州
hzBoss: S00002
hzBossName: 游总
#南京 南京香港 上海矽力杰微电子
shBoss: S00001
shBossName: 陈总
#hr 选了345的3个选项就要到这汇总审批
hrPrincipal: S00038
hrPrincipalName: 周婕
#杭州 办公设备 办公家具类 叶双双
deptDevice: S00245
deptDeviceName: 叶双双
#杭州 实验室固资类
laboratoryDevice: S00058
laboratoryDeviceName: 韦凌华
#杭州 耗材类 王燕
costDevice: S01194
costDeviceName: 王燕
#杭州 新员工入职hr叶丽丽进行签核(叶丽丽休假,改为安晓娟)
hrAssets: S01716
hrAssetsName: 安晓娟
#------------------ 台湾资产管理员/采购代表 ------------------#
#it桌面个人电脑 罗青松
itTwDevice: S00349
itTwDeviceName: 羅青松
#------------------ 南京资产管理员 ------------------#
#it桌面个人电脑
itNjDevice: S01183
itNjDeviceName: 赵晶
#测试设备\元器件 陈伏勇
testNJDevice: S00154
testNJDeviceName: 陈伏勇
#办公家具类\实验室固资类\耗材 彭芳
deptNJDevice: S01182
deptNJDeviceName: 彭芳
#工程 戎玲
engineeringNJ: S00269
engineeringNJName: 戎玲
#------------------ 西安资产管理员 ------------------#
#it桌面个人电脑
itXaDevice: S01425
itXaDeviceName: 刘旭林
#------------------ 合肥资产管理员 ------------------#
hfDevice: S01861
hfDeviceName: 赵莹
#------------------ 杭州采购经理 ------------------#
hzZhangLi: S01679
hzZhangLiName: 张丽
#------------------ 澳门采购经理 ------------------#
amFinanceAssets: S01737
amFinanceAssetsName: 李冬梅
#------------------ 预算管理人员 ------------------#
financeAssets: budget
financeAssetsName: 王晶
#------------------ 财务预算经理 ------------------#
budgetManager: budget_manager
budgetManagerName: 陈京晶
#------------------ 各地区总账 ------------------#
#杭州总账
hzZg: S00152
hzZgName: 王娜
#corp总账
corpZg: S00600
corpZgName: 叶小仙
#西安总账
xaZg: S00969
xaZgName: 畅佩华
#成都总账
cdZg: S00379
cdZgName: 马海云
#/上海总账
shZg: S00610
shZgName: 付婷
#韩国总账
hgZg: S00748
hgZgName: 江奕萱
#美国总账
mgZg: S01123
mgZgName: 林佳怡
#萨摩亚总账
smyZg: S01123
smyZgName: 林佳怡
#印度总账
ydZg: S01123
ydZgName: 林佳怡
#日本总账
rbZg: S01123
rbZgName: 林佳怡
#香港总账
xgZg: S01123
xgZgName: 林佳怡
#台湾矽力杰总账
twZg: S00356
twZgName: 韩诗蕙
#南京总账
njZg: S00467
njZgName: 张玲
#芃xi总账
pxZg: S00467
pxZgName: 张玲
#南京香港总账
njXgZg: S01296
njXgZgName: 王晶
#xi望总账
xwZg: S00107
xwZgName: 徐莉娟
#合肥总账
hfZg: S01682
hfZgName: 高甜
#澳门总账
amZg: S00748
amZgName: 江奕萱
#------------------ 各地区财务经理 ------------------#
#杭州 合肥 澳门 庞杭艳
hzJL: S01175
hzJlName: 庞杭艳
#南京经理 陈京晶
njJl: S01141
njJlName: 陈京晶
#用户账号权限申请单
itUserAuthorizationFrom:
#硬件
HZit: S00262,S01110
NJit: S01183
TWit: S00349
#软件
itEAS: S00110,S00248,S00623
#系统功能需求单
function:
# itmanager的code
itManagerCode: S00110
# it总监
itDirectorCode: S01686
# 总经理
generalManager: S00002
#电子签呈
petition:
#HR沈科如
hrSKR: S00774
#HR叶双双
hrYSS: S00245
#HR叶丽丽
hrYLL: S00137
#HR韦凌华
hrWLH: S00058
#周婕
hrZJ : S00038
#HR王燕
hrWY: S01194
#黃奕晨
sealHYC: S00308
#戎玲
sealRL: S00269
#白永江
sealBYJ: S00111
#王卓亚
sealWZY: S00112
#马海云
sealMHY: S00379
#陈君
sealCJ: S00025
#宁卓
sealNZ: S01181
#王颖(罗梅姣休假)
fwLMJ: S01423
#fwLMJ: S00716
#财务经理庞杭燕
cwPHY: S01175
#财务经理陈京晶
cwCJJ: S01141
#财务王娜
cwWN: S00152
#财务徐丽娟
cwXLJ: S00107
#财务畅佩华
cwCPH: S00969
#财务尹言
cwYY: S00176
#财务林佳怡
cwLJY: S01123
#财务韓詩蕙
cwHSH: S00356
#财务张玲
cwZL: S00467
#财务夏晶
cwXJ: S01164
#corp潘冠呈
cwPGC: S00108
#corp 陈绍伟
cwCSW: S01151
#上海王菲
cwWF: S01109
#上海付婷
cwFT: S00610
#叶小仙
cwYXX: S00600
#王晶
cwWJ: S01296
#高甜
cwGT: S01682
#李冬梅
cwLDM: S01737
money:
# 请购单需要核决的金额
purchase: 10000
#it设备晓琪哥
itDevice: S00262
#测试社保朱冰威
testDevice: S00099
#hr负责人选了345的3个选项就要到这汇总审批
hrPrincipal: S00038
#办公设备叶双双 办公家具类
deptDevice: S00245
#办公设备韦凌华 实验室固资类
laboratoryDevice: S00058
#办公设备沈科如 耗材类
costDevice: S00774
#财务资产管理人员
financeAssets: S01192
#新员工入职hr叶丽丽进行签核
hrAssets: S00137
#工程是黄钺
engineering: S00386
#杭州boss
hzBoss: S00002
errMsg:
email1: kailun.shi@silergycorp.com
email2: shiyang.zhuo@silergycorp.com,sensen.li@silergycorp.com

View File

@ -1,22 +1,22 @@
# 项目相关配置 # 项目相关配置
ruoyi: ruoyi:
# 名称 # 名称
name: RuoYi name: WorkOrder
# 版本 # 版本
version: 4.7.6 version: 4.7.5
# 版权年份 # 版权年份
copyrightYear: 2023 copyrightYear: 2022
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: false
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath profile: /opt/java/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为80 # 服务器的HTTP端口默认为80
port: 80 port: 8060
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -59,7 +59,7 @@ spring:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
profiles: profiles:
active: druid active: druid,user
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
@ -72,6 +72,25 @@ spring:
restart: restart:
# 热部署开关 # 热部署开关
enabled: true enabled: true
# 邮件模块
mail:
host: mailhz.silergycorp.com
username: webmaster
password: QQ!!rat18971897
default-encoding: UTF-8
port: 465
properties:
mail:
smtp:
ssl:
trust: mailhz.silergycorp.com
socketFactory:
class: javax.net.ssl.SSLSocketFactory
port: 465
auth: true
starttls:
enable: true
required: true
# MyBatis # MyBatis
mybatis: mybatis:
@ -98,7 +117,7 @@ shiro:
# 首页地址 # 首页地址
indexUrl: /index indexUrl: /index
# 验证码开关 # 验证码开关
captchaEnabled: true captchaEnabled: false
# 验证码类型 math 数组计算 char 字符 # 验证码类型 math 数组计算 char 字符
captchaType: math captchaType: math
cookie: cookie:

View File

@ -77,6 +77,22 @@
statistics="false"> statistics="false">
</cache> </cache>
<!-- 项目编号信息缓存 -->
<cache name="zt-wgcprorelease"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="false">
</cache>
<!-- 供应商信息缓存 -->
<cache name="sys-supplier"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="false">
</cache>
<!-- 系统会话缓存 --> <!-- 系统会话缓存 -->
<cache name="shiro-activeSessionCache" <cache name="shiro-activeSessionCache"
maxEntriesLocalHeap="10000" maxEntriesLocalHeap="10000"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs" /> <property name="log.path" value="/opt/java/logs" />
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

View File

@ -1,11 +1,11 @@
/*! /*!
* bootstrap-fileinput v5.5.2 * bootstrap-fileinput v5.2.4
* http://plugins.krajee.com/file-input * http://plugins.krajee.com/file-input
* *
* Krajee default styling for bootstrap-fileinput. * Krajee default styling for bootstrap-fileinput.
* *
* Author: Kartik Visweswaran * Author: Kartik Visweswaran
* Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com
* *
* Licensed under the BSD-3-Clause * Licensed under the BSD-3-Clause
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
@ -50,10 +50,6 @@ input[type=file].file-loading {
display: none; display: none;
} }
.file-caption .input-group {
align-items: center;
}
.btn-file input[type=file], .btn-file input[type=file],
.file-caption-icon, .file-caption-icon,
.file-preview .fileinput-remove, .file-preview .fileinput-remove,
@ -278,7 +274,6 @@ input[type=file].file-loading {
padding: 6px; padding: 6px;
float: left; float: left;
text-align: center; text-align: center;
} }
.krajee-default.file-preview-frame .kv-file-content { .krajee-default.file-preview-frame .kv-file-content {
@ -286,6 +281,12 @@ input[type=file].file-loading {
height: 160px; 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 { .krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered {
width: 400px; width: 400px;
} }
@ -329,7 +330,7 @@ input[type=file].file-loading {
text-align: center; text-align: center;
padding-top: 4px; padding-top: 4px;
font-size: 11px; font-size: 11px;
color: #999; color: #777;
margin-bottom: 30px; margin-bottom: 30px;
} }
@ -405,7 +406,7 @@ input[type=file].file-loading {
height: 2.4rem; height: 2.4rem;
top: 50%; top: 50%;
border-radius: 50%; border-radius: 50%;
text-align: center; text-align:center;
} }
.btn-navigate * { .btn-navigate * {
@ -425,12 +426,19 @@ input[type=file].file-loading {
right: 0; 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 { .file-zoom-dialog .kv-zoom-header {
padding: 0.5rem; padding: 0.5rem;
} }
.file-zoom-dialog .kv-zoom-body { .file-zoom-dialog .kv-zoom-body {
padding: 0.25rem; padding: 0.25rem 0.5rem 0.25rem 0;
} }
.file-zoom-dialog .kv-zoom-description { .file-zoom-dialog .kv-zoom-description {
@ -546,10 +554,6 @@ input[type=file].file-loading {
z-index: 3000; z-index: 3000;
} }
.kv-zoom-actions {
min-width: 140px;
}
.kv-zoom-actions .btn-kv { .kv-zoom-actions .btn-kv {
margin-left: 3px; margin-left: 3px;
} }
@ -564,6 +568,15 @@ input[type=file].file-loading {
background: transparent; background: transparent;
} }
.file-zoom-content > * {
display: inline-block;
vertical-align: middle;
}
.file-zoom-content .kv-spacer {
height: 100%;
}
.file-zoom-content .file-preview-image { .file-zoom-content .file-preview-image {
max-height: 100%; max-height: 100%;
} }
@ -656,33 +669,3 @@ input[type=file].file-loading {
.file-preview .kv-zoom-cache { .file-preview .kv-zoom-cache {
display: none; display: none;
} }
.file-preview-other-frame, .file-preview-object, .kv-file-content, .kv-zoom-body {
display: flex;
align-items: center;
justify-content: center;
}
.btn-kv-rotate,
.kv-file-rotate {
display: none;
}
.rotatable:not(.hide-rotate) .btn-kv-rotate,
.rotatable:not(.hide-rotate) .kv-file-rotate {
display: inline-block;
}
.rotatable .file-zoom-detail,
.rotatable .kv-file-content,
.rotatable .kv-file-content > :first-child {
transform-origin: center center;
}
.rotate-animate {
transition: transform 0.3s ease;
}
.kv-overflow-hidden {
overflow: hidden;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -698,8 +698,7 @@
if (_ls && _ls.length > 0) { if (_ls && _ls.length > 0) {
$.each(_ls, function(index, item) { $.each(_ls, function(index, item) {
var _p_icon = $("#" + $(item).attr("pid")).children().eq(options.expandColumn).find(".treetable-expander"); var _p_icon = $("#" + $(item).attr("pid")).children().eq(options.expandColumn).find(".treetable-expander");
var _p_display = $("#" + $(item).attr("pid")).css('display'); if (_p_icon.hasClass(options.expanderExpandedClass)) {
if (_p_icon.hasClass(options.expanderExpandedClass) && _p_display == 'table') {
$(item).css("display", "table"); $(item).css("display", "table");
} }
}); });
@ -730,7 +729,7 @@
$.ajax({ $.ajax({
type: options.type, type: options.type,
url: options.dataUrl, url: options.dataUrl,
data: parms, data: $.extend(parms, options.ajaxParams),
dataType: "json", dataType: "json",
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
$("#" + row_id + "_load").remove(); $("#" + row_id + "_load").remove();

View File

@ -1 +1 @@
html{height:100%}body.signin{height:auto;background:url(../img/login-background.jpg) no-repeat center fixed;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover}.signinpanel{width:750px;margin:10% auto 0;color:rgba(255,255,255,.95)}.signinpanel .logopanel{float:none;width:auto;padding:0;background:0}.signinpanel .signin-info ul{list-style:none;padding:0;margin:20px 0}.signinpanel .form-control{display:block;margin-top:15px}.signinpanel .uname{background:#fff url(../img/user.png) no-repeat 95% center;color:#333}.signinpanel .pword{background:#fff url(../img/locked.png) no-repeat 95% center;color:#333}.signinpanel .code{background:#fff no-repeat 95% center;color:#333;margin:0 0 15px 0}.signinpanel .btn{margin-top:15px}.signinpanel form{background:rgba(255,255,255,.2);border:1px solid rgba(255,255,255,.3);-moz-box-shadow:0 3px 0 rgba(12,12,12,.03);-webkit-box-shadow:0 3px 0 rgba(12,12,12,.03);box-shadow:0 3px 0 rgba(12,12,12,.03);-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;padding:30px}.signup-footer{border-top:solid 1px rgba(255,255,255,.3);margin:20px 0;padding-top:15px}@media screen and (max-width:768px){.signinpanel,.signuppanel{margin:0 auto;width:380px!important;padding:20px}.signinpanel form{margin-top:20px}.signup-footer,.signuppanel .form-control{margin-bottom:10px}.signup-footer .pull-left,.signup-footer .pull-right{float:none!important;text-align:center}.signinpanel .signin-info ul{display:none}}@media screen and (max-width:320px){.signinpanel,.signuppanel{margin:0 20px;width:auto}}.checkbox-custom{position:relative;padding:0 15px 0 25px;margin-bottom:7px;display:inline-block}.checkbox-custom input[type="checkbox"]{opacity:0;position:absolute;cursor:pointer;z-index:2;margin:-6px 0 0 0;top:50%;left:3px}.checkbox-custom label:before{content:'';position:absolute;top:50%;left:0;margin-top:-9px;width:18px;height:17px;display:inline-block;border-radius:2px;border:1px solid #bbb;background:#fff}.checkbox-custom input[type="checkbox"]:checked+label:after{position:absolute;display:inline-block;font-family:'Glyphicons Halflings';content:"\e013";top:42%;left:3px;margin-top:-5px;font-size:11px;line-height:1;width:16px;height:16px;color:#333}.checkbox-custom label{cursor:pointer;line-height:1.2;font-weight:normal;margin-bottom:0;text-align:left}.form-control,.form-control:focus,.has-error .form-control:focus,.has-success .form-control:focus,.has-warning .form-control:focus,.navbar-collapse,.navbar-form,.navbar-form-custom .form-control:focus,.navbar-form-custom .form-control:hover,.open .btn.dropdown-toggle,.panel,.popover,.progress,.progress-bar{box-shadow:none}.form-control{border-radius:1px!important;padding:6px 12px!important;height:34px!important}.form-control:focus{border-color:#1ab394!important} html{height:100%}body.signin{height:auto;background:url(../img/login-background.jpg) no-repeat center fixed;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover}.signinpanel{width:750px;margin:10% auto 0;color:rgba(255,255,255,.95)}.signinpanel .logopanel{float:none;width:auto;padding:0;background:0}.signinpanel .signin-info ul{list-style:none;padding:0;margin:20px 0}.signinpanel .form-control{display:block;margin-top:15px}.signinpanel .uname{background:#fff url(../img/user.png) no-repeat 95% center;color:#333}.signinpanel .pword{background:#fff url(../img/locked.png) no-repeat 95% center;color:#333}.signinpanel .code{background:#fff no-repeat 95% center;color:#333;margin:0 0 15px 0}.signinpanel .btn{margin-top:15px}.signinpanel form{background:rgba(255,255,255,.2);border:1px solid rgba(255,255,255,.3);-moz-box-shadow:0 3px 0 rgba(12,12,12,.03);-webkit-box-shadow:0 3px 0 rgba(12,12,12,.03);box-shadow:0 3px 0 rgba(12,12,12,.03);-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;padding:30px}.signup-footer{border-top:solid 1px rgba(255,255,255,.3);margin:20px 0;padding-top:15px}@media screen and (max-width:768px){.signinpanel,.signuppanel{margin:0 auto;width:380px!important;padding:20px}.signinpanel form{margin-top:20px}.signup-footer,.signuppanel .form-control{margin-bottom:10px}.signup-footer .pull-left,.signup-footer .pull-right{float:none!important;text-align:center}.signinpanel .signin-info ul{display:none}}@media screen and (max-width:320px){.signinpanel,.signuppanel{margin:0 20px;width:auto}}.checkbox-custom{position:relative;padding:0 15px 0 25px;margin-bottom:7px;display:inline-block}.checkbox-custom input[type="checkbox"]{opacity:0;position:absolute;cursor:pointer;z-index:2;margin:-6px 0 0 0;top:50%;left:3px}.checkbox-custom label:before{content:'';position:absolute;top:50%;left:0;margin-top:-9px;width:18px;height:17px;display:inline-block;border-radius:2px;border:1px solid #bbb;background:#fff}.checkbox-custom input[type="checkbox"]:checked+label:after{position:absolute;display:inline-block;font-family:'Glyphicons Halflings';content:"\e013";top:42%;left:3px;margin-top:-5px;font-size:11px;line-height:1;width:16px;height:16px;color:#333}.checkbox-custom label{cursor:pointer;line-height:1.2;font-weight:normal;margin-bottom:0;text-align:left}.form-control,.form-control:focus,.has-error .form-control:focus,.has-success .form-control:focus,.has-warning .form-control:focus,.navbar-collapse,.navbar-form,.navbar-form-custom .form-control:focus,.navbar-form-custom .form-control:hover,.open .btn.dropdown-toggle,.panel,.popover,.progress,.progress-bar{box-shadow:none}.form-control{border-radius:1px!important;padding:6px 12px!important;height:34px!important}.form-control:focus{border-color:#1ab394!important}.tb{float: left} .img{width: 30%;margin-bottom: 8%;margin-left: -5%;}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,120 @@
/* /*
* metismenu - v2.0.2 * metismenu - v1.1.3
* A jQuery menu plugin * Easy menu jQuery plugin for Twitter Bootstrap 3
* https://github.com/onokumus/metisMenu * https://github.com/onokumus/metisMenu
* *
* Made by Osman Nuri Okumus * Made by Osman Nuri Okumus
* Under MIT License * Under MIT License
*/ */
;(function($, window, document, undefined) {
!function(a){"use strict";function b(){var a=document.createElement("mm"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}function c(b){return this.each(function(){var c=a(this),d=c.data("mm"),f=a.extend({},e.DEFAULTS,c.data(),"object"==typeof b&&b);d||c.data("mm",d=new e(this,f)),"string"==typeof b&&d[b]()})}a.fn.emulateTransitionEnd=function(b){var c=!1,e=this;a(this).one("mmTransitionEnd",function(){c=!0});var f=function(){c||a(e).trigger(d.end)};return setTimeout(f,b),this};var d=b();d&&(a.event.special.mmTransitionEnd={bindType:d.end,delegateType:d.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}});var e=function(b,c){this.$element=a(b),this.options=a.extend({},e.DEFAULTS,c),this.transitioning=null,this.init()};e.TRANSITION_DURATION=350,e.DEFAULTS={toggle:!0,doubleTapToGo:!1,activeClass:"active"},e.prototype.init=function(){var b=this,c=this.options.activeClass;this.$element.find("li."+c).has("ul").children("ul").addClass("collapse in"),this.$element.find("li").not("."+c).has("ul").children("ul").addClass("collapse"),this.options.doubleTapToGo&&this.$element.find("li."+c).has("ul").children("a").addClass("doubleTapToGo"),this.$element.find("li").has("ul").children("a").on("click.metisMenu",function(d){var e=a(this),f=e.parent("li"),g=f.children("ul");return d.preventDefault(),f.hasClass(c)?b.hide(g):b.show(g),b.options.doubleTapToGo&&b.doubleTapToGo(e)&&"#"!==e.attr("href")&&""!==e.attr("href")?(d.stopPropagation(),void(document.location=e.attr("href"))):void 0})},e.prototype.doubleTapToGo=function(a){var b=this.$element;return a.hasClass("doubleTapToGo")?(a.removeClass("doubleTapToGo"),!0):a.parent().children("ul").length?(b.find(".doubleTapToGo").removeClass("doubleTapToGo"),a.addClass("doubleTapToGo"),!1):void 0},e.prototype.show=function(b){var c=this.options.activeClass,f=a(b),g=f.parent("li");if(!this.transitioning&&!f.hasClass("in")){g.addClass(c),this.options.toggle&&this.hide(g.siblings().children("ul.in")),f.removeClass("collapse").addClass("collapsing").height(0),this.transitioning=1;var h=function(){f.removeClass("collapsing").addClass("collapse in").height(""),this.transitioning=0};return d?void f.one("mmTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(e.TRANSITION_DURATION).height(f[0].scrollHeight):h.call(this)}},e.prototype.hide=function(b){var c=this.options.activeClass,f=a(b);if(!this.transitioning&&f.hasClass("in")){f.parent("li").removeClass(c),f.height(f.height())[0].offsetHeight,f.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var g=function(){this.transitioning=0,f.removeClass("collapsing").addClass("collapse")};return d?void f.height(0).one("mmTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(e.TRANSITION_DURATION):g.call(this)}};var f=a.fn.metisMenu;a.fn.metisMenu=c,a.fn.metisMenu.Constructor=e,a.fn.metisMenu.noConflict=function(){return a.fn.metisMenu=f,this}}(jQuery); var pluginName = "metisMenu",
defaults = {
toggle: true,
doubleTapToGo: false
};
function Plugin(element, options) {
this.element = $(element);
this.settings = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function() {
var $this = this.element,
$toggle = this.settings.toggle,
obj = this;
if (this.isIE() <= 9) {
$this.find("li.active").has("ul").children("ul").collapse("show");
$this.find("li").not(".active").has("ul").children("ul").collapse("hide");
} else {
$this.find("li.active").has("ul").children("ul").addClass("collapse in");
$this.find("li").not(".active").has("ul").children("ul").addClass("collapse");
}
//add the "doubleTapToGo" class to active items if needed
if (obj.settings.doubleTapToGo) {
$this.find("li.active").has("ul").children("a").addClass("doubleTapToGo");
}
$this.find("li").has("ul").children("a").on("click" + "." + pluginName, function(e) {
e.preventDefault();
//Do we need to enable the double tap
if (obj.settings.doubleTapToGo) {
//if we hit a second time on the link and the href is valid, navigate to that url
if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") {
e.stopPropagation();
document.location = $(this).attr("href");
return;
}
}
$(this).parent("li").toggleClass("active").children("ul").collapse("toggle");
if ($toggle) {
$(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide");
}
});
},
isIE: function() { //https://gist.github.com/padolsey/527683
var undef,
v = 3,
div = document.createElement("div"),
all = div.getElementsByTagName("i");
while (
div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
all[0]
) {
return v > 4 ? v : undef;
}
},
//Enable the link on the second click.
doubleTapToGo: function(elem) {
var $this = this.element;
//if the class "doubleTapToGo" exists, remove it and return
if (elem.hasClass("doubleTapToGo")) {
elem.removeClass("doubleTapToGo");
return true;
}
//does not exists, add a new class and return false
if (elem.parent().children("ul").length) {
//first remove all other class
$this.find(".doubleTapToGo").removeClass("doubleTapToGo");
//add the class on the current element
elem.addClass("doubleTapToGo");
return false;
}
},
remove: function() {
this.element.off("." + pluginName);
this.element.removeData(pluginName);
}
};
$.fn[pluginName] = function(options) {
this.each(function () {
var el = $(this);
if (el.data(pluginName)) {
el.data(pluginName).remove();
}
el.data(pluginName, new Plugin(this, options));
});
return this;
};
})(jQuery, window, document);

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H

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