首次提交
This commit is contained in:
commit
948fed4a7c
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
18
.idea/compiler.xml
Normal file
18
.idea/compiler.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="evo-tech" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="evo (1)" target="1.8" />
|
||||
<module name="evo (2)" target="1.8" />
|
||||
<module name="evo-admin" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/encodings.xml
Normal file
10
.idea/encodings.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||
<file url="file://$PROJECT_DIR$/evo-admin/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/evo-admin/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
35
.idea/jarRepositories.xml
Normal file
35
.idea/jarRepositories.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="public" />
|
||||
<option name="name" value="aliyun nexus" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/nexus/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="public" />
|
||||
<option name="name" value="aliyun nexus" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/misc.xml
Normal file
12
.idea/misc.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
20
LICENSE
Normal file
20
LICENSE
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 evo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
12
bin/clean.bat
Normal file
12
bin/clean.bat
Normal file
@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [信息] 清理工程target生成路径。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
cd %~dp0
|
||||
|
||||
cd ..
|
||||
call mvn clean
|
||||
|
||||
pause
|
||||
12
bin/package.bat
Normal file
12
bin/package.bat
Normal file
@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [信息] 打包Web工程,生成war/jar包文件。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
cd %~dp0
|
||||
|
||||
cd ..
|
||||
call mvn clean package -Dmaven.test.skip=true
|
||||
|
||||
pause
|
||||
14
bin/run.bat
Normal file
14
bin/run.bat
Normal file
@ -0,0 +1,14 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Web工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-admin/target
|
||||
|
||||
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -jar %JAVA_OPTS% ruoyi-admin.jar
|
||||
|
||||
cd bin
|
||||
pause
|
||||
229
evo-admin/pom.xml
Normal file
229
evo-admin/pom.xml
Normal file
@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>evo</artifactId>
|
||||
<groupId>com.evo</groupId>
|
||||
<version>3.8.8</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>evo-tech</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Web容器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot 拦截器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- velocity代码生成使用模板 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring框架基本的核心工具 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringWeb模块 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring security 安全认证 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- pagehelper 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 自定义验证注解 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON工具类 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- io常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- PDF -->
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itextpdf</artifactId>
|
||||
<version>5.5.13</version>
|
||||
</dependency>
|
||||
<!-- pdf转为图片 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>fontbox</artifactId>
|
||||
<version>2.0.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- yml解析器 -->
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Token生成与解析-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jaxb -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- redis 缓存操作 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- pool 对象池 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 解析客户端操作系统、浏览器等 -->
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- servlet包 -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.5.15</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
22
evo-admin/src/main/java/com/evo/EvoApplication.java
Normal file
22
evo-admin/src/main/java/com/evo/EvoApplication.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.evo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@EnableScheduling
|
||||
public class EvoApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(EvoApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ ***************************************************************************************************************************** ERP 启动成功 ************************************************************************************************************************ ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
}
|
||||
18
evo-admin/src/main/java/com/evo/EvoServletInitializer.java
Normal file
18
evo-admin/src/main/java/com/evo/EvoServletInitializer.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.evo;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class EvoServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(EvoApplication.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.evo.attendance.controller;
|
||||
|
||||
import com.evo.attendance.service.PunchTheClockService;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1")
|
||||
public class PunchTheClockController {
|
||||
|
||||
@Resource
|
||||
private PunchTheClockService punchTheClockService;
|
||||
|
||||
/**
|
||||
* 刷脸获取打卡按钮权限
|
||||
* sn 设备号
|
||||
* type 设备识别类型
|
||||
* user_id 用户id
|
||||
* card 人员信息中的卡号
|
||||
* confidence 人脸算法识别到的相识度
|
||||
* temperature 测量到的温度,未开启测温的设备为空
|
||||
*
|
||||
* 响应: Result 返回请求类型:0:可以打卡,其它值表示无法打卡
|
||||
* Msg 对应 Result 的状态,可为空
|
||||
* Content 识别后返回的详细信息
|
||||
* button 9位长度的字符串,0 表示不可以点击 1 表示可以点击
|
||||
*
|
||||
* String sn,String type,String userId,String card,String confidence
|
||||
*/
|
||||
@RequestMapping("/verify_user")
|
||||
public String verifyUser(@RequestBody String json){
|
||||
return punchTheClockService.returnMessage(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户点击打卡按钮后请求的接口
|
||||
* sn 设备号
|
||||
* user_id 人员id
|
||||
* user_name 用户名
|
||||
* user_type 用户类型,对应下发人员时的 user_type
|
||||
* card_number 卡号
|
||||
* recog_type 识别类型: face - 为人脸识别 、card - 刷卡开门,人脸或卡模式
|
||||
* recog_time 识别时间(时间格式yyyy-MM-dd HH:mm:ss)
|
||||
* photo 识别照片,服务端收到后转换成图片步骤请查看 2、服务规范 - 照片解码流程
|
||||
* body_temperature 体温
|
||||
* confidence 通过的置信度
|
||||
* button 1~9 表示点击的是第几个按钮
|
||||
*
|
||||
* 响应:Result 返回请求类型:0成功,其它失败
|
||||
* Msg 对应 Result 的文本信息
|
||||
*
|
||||
* String sn,String userId,String userName,String userType,String cardNumber,String recog_type,String recog_time,String photo,String body_temperature,String confidence,String button
|
||||
*/
|
||||
@RequestMapping("/record/face")
|
||||
public String face(@RequestBody String json){
|
||||
return punchTheClockService.recordFace(json);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package com.evo.attendance.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.attendance.domain.RzAbnormal;
|
||||
import com.evo.attendance.service.IRzAbnormalService;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 考勤异常Controller
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attendance/abnormal")
|
||||
public class RzAbnormalController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRzAbnormalService rzAbnormalService;
|
||||
|
||||
/**
|
||||
* 查询考勤异常列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormal:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzAbnormal rzAbnormal)
|
||||
{
|
||||
startPage();
|
||||
List<RzAbnormal> list = rzAbnormalService.selectRzAbnormalList(rzAbnormal);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出考勤异常列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormal:export')")
|
||||
@Log(title = "考勤异常", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RzAbnormal rzAbnormal)
|
||||
{
|
||||
List<RzAbnormal> list = rzAbnormalService.selectRzAbnormalList(rzAbnormal);
|
||||
ExcelUtil<RzAbnormal> util = new ExcelUtil<RzAbnormal>(RzAbnormal.class);
|
||||
util.exportExcel(response, list, "考勤异常数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤异常详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormal:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rzAbnormalService.selectRzAbnormalById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤异常
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormal:edit')")
|
||||
@Log(title = "考勤异常", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RzAbnormal rzAbnormal)
|
||||
{
|
||||
return toAjax(rzAbnormalService.updateRzAbnormal(rzAbnormal));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除考勤异常
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormal:remove')")
|
||||
@Log(title = "考勤异常", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(rzAbnormalService.deleteRzAbnormalById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常详情
|
||||
* @param rzAbnormal
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/listAbnormalDetails")
|
||||
public List<RzAbnormalDetail> listAbnormalDetails(RzAbnormal rzAbnormal)
|
||||
{
|
||||
return rzAbnormalService.listAbnormalDetails(rzAbnormal);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.evo.attendance.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
import com.evo.attendance.service.IRzAbnormalDetailService;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 考勤异常详情Controller
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attendance/abnormalDetail")
|
||||
public class RzAbnormalDetailController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRzAbnormalDetailService rzAbnormalDetailService;
|
||||
|
||||
/**
|
||||
* 查询考勤异常详情列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormalDetail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzAbnormalDetail rzAbnormalDetail)
|
||||
{
|
||||
startPage();
|
||||
List<RzAbnormalDetail> list = rzAbnormalDetailService.selectRzAbnormalDetailList(rzAbnormalDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出考勤异常详情列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormalDetail:export')")
|
||||
@Log(title = "考勤异常详情", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RzAbnormalDetail rzAbnormalDetail)
|
||||
{
|
||||
List<RzAbnormalDetail> list = rzAbnormalDetailService.selectRzAbnormalDetailList(rzAbnormalDetail);
|
||||
ExcelUtil<RzAbnormalDetail> util = new ExcelUtil<RzAbnormalDetail>(RzAbnormalDetail.class);
|
||||
util.exportExcel(response, list, "考勤异常详情数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤异常详情详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormalDetail:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rzAbnormalDetailService.selectRzAbnormalDetailById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤异常详情
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormalDetail:edit')")
|
||||
@Log(title = "考勤异常详情", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RzAbnormalDetail rzAbnormalDetail)
|
||||
{
|
||||
return toAjax(rzAbnormalDetailService.updateRzAbnormalDetail(rzAbnormalDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除考勤异常详情
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:abnormalDetail:remove')")
|
||||
@Log(title = "考勤异常详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(rzAbnormalDetailService.deleteRzAbnormalDetailById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.evo.attendance.controller;
|
||||
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.service.IRzAttendanceService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤记录Controller
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attendance/attendance")
|
||||
public class RzAttendanceController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IRzAttendanceService rzAttendanceService;
|
||||
|
||||
/**
|
||||
* 查询考勤记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:attendance:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzAttendance rzAttendance)
|
||||
{
|
||||
startPage();
|
||||
List<RzAttendance> list = rzAttendanceService.selectRzAttendanceList(rzAttendance);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出考勤记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:attendance:export')")
|
||||
@Log(title = "考勤记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RzAttendance rzAttendance)
|
||||
{
|
||||
List<RzAttendance> list = rzAttendanceService.selectRzAttendanceList(rzAttendance);
|
||||
ExcelUtil<RzAttendance> util = new ExcelUtil<RzAttendance>(RzAttendance.class);
|
||||
util.exportExcel(response, list, "考勤记录");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:attendance:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rzAttendanceService.selectRzAttendanceById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:attendance:edit')")
|
||||
@Log(title = "考勤记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RzAttendance rzAttendance)
|
||||
{
|
||||
return toAjax(rzAttendanceService.updateRzAttendance(rzAttendance));
|
||||
}
|
||||
|
||||
/**
|
||||
* 每日上班打卡统计
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/attendenceCount")
|
||||
public int attendenceCount()
|
||||
{
|
||||
return rzAttendanceService.attendenceCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改考勤记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:attendance:edit')")
|
||||
@Log(title = "考勤记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping(value = "/updateBatchAttendance")
|
||||
public AjaxResult updateBatchAttendance(@RequestBody RzAttendance rzAttendance)
|
||||
{
|
||||
return rzAttendanceService.updateBatchAttendance(rzAttendance);
|
||||
}
|
||||
|
||||
@GetMapping("/listAttendanceByParams")
|
||||
public TableDataInfo listAttendanceByParams(RzAttendance rzAttendance)
|
||||
{
|
||||
startPage();
|
||||
List<RzAttendance> list = rzAttendanceService.listAttendanceByParams(rzAttendance);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.evo.attendance.controller;
|
||||
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.service.IRzAttendanceStatisticalService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤统计Controller
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attendance/statistical")
|
||||
public class RzAttendanceStatisticalController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IRzAttendanceStatisticalService rzAttendanceStatisticalService;
|
||||
|
||||
/**
|
||||
* 查询考勤统计列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:statistical:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzAttendanceStatistical rzAttendanceStatistical)
|
||||
{
|
||||
startPage();
|
||||
List<RzAttendanceStatistical> list = rzAttendanceStatisticalService.selectRzAttendanceStatisticalList(rzAttendanceStatistical);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出考勤统计列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:statistical:export')")
|
||||
@Log(title = "考勤统计", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RzAttendanceStatistical rzAttendanceStatistical)
|
||||
{
|
||||
List<RzAttendanceStatistical> list = rzAttendanceStatisticalService.selectRzAttendanceStatisticalList(rzAttendanceStatistical);
|
||||
ExcelUtil<RzAttendanceStatistical> util = new ExcelUtil<RzAttendanceStatistical>(RzAttendanceStatistical.class);
|
||||
util.exportExcel(response, list, "考勤统计数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取考勤统计详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:statistical:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rzAttendanceStatisticalService.selectRzAttendanceStatisticalById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤统计
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:statistical:edit')")
|
||||
@Log(title = "考勤统计", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RzAttendanceStatistical rzAttendanceStatistical)
|
||||
{
|
||||
return toAjax(rzAttendanceStatisticalService.updateRzAttendanceStatistical(rzAttendanceStatistical));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校正数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:statistics:correct')")
|
||||
@RequestMapping(value = "correct")
|
||||
public AjaxResult correct(@RequestBody RzAttendanceStatistical rzAttendanceStatistical)
|
||||
{
|
||||
return rzAttendanceStatisticalService.correct(rzAttendanceStatistical);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('attendance:statistics:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file) throws Exception
|
||||
{
|
||||
ExcelUtil<RzAttendanceStatistical> util = new ExcelUtil<RzAttendanceStatistical>(RzAttendanceStatistical.class);
|
||||
List<RzAttendanceStatistical> attList = util.importExcel(file.getInputStream());
|
||||
return rzAttendanceStatisticalService.importRzAttendanceStatistical(attList);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.evo.attendance.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.evo.attendance.domain.RzSpecialAttendance;
|
||||
import com.evo.attendance.service.IRzSpecialAttendanceService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 加班考勤记录Controller
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attendance/specialAttendance")
|
||||
public class RzSpecialAttendanceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRzSpecialAttendanceService rzSpecialAttendanceService;
|
||||
|
||||
/**
|
||||
* 查询加班考勤记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialAttendance:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzSpecialAttendance rzSpecialAttendance)
|
||||
{
|
||||
startPage();
|
||||
List<RzSpecialAttendance> list = rzSpecialAttendanceService.selectRzSpecialAttendanceList(rzSpecialAttendance);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出加班考勤记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialAttendance:export')")
|
||||
@Log(title = "加班考勤记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RzSpecialAttendance rzSpecialAttendance)
|
||||
{
|
||||
List<RzSpecialAttendance> list = rzSpecialAttendanceService.selectRzSpecialAttendanceList(rzSpecialAttendance);
|
||||
ExcelUtil<RzSpecialAttendance> util = new ExcelUtil<RzSpecialAttendance>(RzSpecialAttendance.class);
|
||||
util.exportExcel(response, list, "加班考勤记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取加班考勤记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialAttendance:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rzSpecialAttendanceService.selectRzSpecialAttendanceById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增加班考勤记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialAttendance:add')")
|
||||
@Log(title = "加班考勤记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RzSpecialAttendance rzSpecialAttendance)
|
||||
{
|
||||
return toAjax(rzSpecialAttendanceService.insertRzSpecialAttendance(rzSpecialAttendance));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改加班考勤记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialAttendance:edit')")
|
||||
@Log(title = "加班考勤记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RzSpecialAttendance rzSpecialAttendance)
|
||||
{
|
||||
return toAjax(rzSpecialAttendanceService.updateRzSpecialAttendance(rzSpecialAttendance));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除加班考勤记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialAttendance:remove')")
|
||||
@Log(title = "加班考勤记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(rzSpecialAttendanceService.deleteRzSpecialAttendanceById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.evo.attendance.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.evo.attendance.domain.RzSpecialOverTime;
|
||||
import com.evo.attendance.service.IRzSpecialOverTimeService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 特殊加班管理Controller
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attendance/specialTime")
|
||||
public class RzSpecialOverTimeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRzSpecialOverTimeService rzSpecialOverTimeService;
|
||||
|
||||
/**
|
||||
* 查询特殊加班管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialTime:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzSpecialOverTime rzSpecialOverTime)
|
||||
{
|
||||
startPage();
|
||||
List<RzSpecialOverTime> list = rzSpecialOverTimeService.selectRzSpecialOverTimeList(rzSpecialOverTime);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出特殊加班管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialTime:export')")
|
||||
@Log(title = "特殊加班管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RzSpecialOverTime rzSpecialOverTime)
|
||||
{
|
||||
List<RzSpecialOverTime> list = rzSpecialOverTimeService.selectRzSpecialOverTimeList(rzSpecialOverTime);
|
||||
ExcelUtil<RzSpecialOverTime> util = new ExcelUtil<RzSpecialOverTime>(RzSpecialOverTime.class);
|
||||
util.exportExcel(response, list, "特殊加班管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取特殊加班管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialTime:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rzSpecialOverTimeService.selectRzSpecialOverTimeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增特殊加班管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialTime:add')")
|
||||
@Log(title = "特殊加班管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RzSpecialOverTime rzSpecialOverTime)
|
||||
{
|
||||
return toAjax(rzSpecialOverTimeService.insertRzSpecialOverTime(rzSpecialOverTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改特殊加班管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialTime:edit')")
|
||||
@Log(title = "特殊加班管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RzSpecialOverTime rzSpecialOverTime)
|
||||
{
|
||||
return toAjax(rzSpecialOverTimeService.updateRzSpecialOverTime(rzSpecialOverTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除特殊加班管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('attendance:specialTime:remove')")
|
||||
@Log(title = "特殊加班管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(rzSpecialOverTimeService.deleteRzSpecialOverTimeById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package com.evo.attendance.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 考勤异常对象 rz_abnormal
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
public class RzAbnormal extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 部门 */
|
||||
@Excel(name = "部门")
|
||||
private Long deptId;
|
||||
|
||||
private String deptName;
|
||||
|
||||
/** 员工ID */
|
||||
@Excel(name = "员工ID")
|
||||
private Long userId;
|
||||
|
||||
/** 员工姓名 */
|
||||
@Excel(name = "员工姓名")
|
||||
private String name;
|
||||
|
||||
/** 月份 */
|
||||
@JsonFormat(pattern = "yyyy-MM")
|
||||
@Excel(name = "月份", width = 30, dateFormat = "yyyy-MM")
|
||||
private Date month;
|
||||
|
||||
/** 次数 */
|
||||
@Excel(name = "次数")
|
||||
private Long number;
|
||||
|
||||
/** 金额 */
|
||||
@Excel(name = "金额")
|
||||
private BigDecimal money;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public Date getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(Date month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public void setNumber(Long number)
|
||||
{
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public Long getNumber()
|
||||
{
|
||||
return number;
|
||||
}
|
||||
public void setMoney(BigDecimal money)
|
||||
{
|
||||
this.money = money;
|
||||
}
|
||||
|
||||
public BigDecimal getMoney()
|
||||
{
|
||||
return money;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userId", getUserId())
|
||||
.append("name", getName())
|
||||
.append("month", getMonth())
|
||||
.append("number", getNumber())
|
||||
.append("money", getMoney())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,146 @@
|
||||
package com.evo.attendance.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 考勤异常详情对象 rz_abnormal_detail
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
public class RzAbnormalDetail extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 异常ID */
|
||||
@Excel(name = "异常ID")
|
||||
private Long abnormalId;
|
||||
|
||||
/** 员工姓名 */
|
||||
@Excel(name = "员工姓名")
|
||||
private String name;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "考勤时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date clockDate;
|
||||
|
||||
private String clockType;
|
||||
|
||||
public Date getClockDate() {
|
||||
return clockDate;
|
||||
}
|
||||
|
||||
public void setClockDate(Date clockDate) {
|
||||
this.clockDate = clockDate;
|
||||
}
|
||||
|
||||
/** 打卡时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "打卡时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date abnormalTime;
|
||||
|
||||
/** 激励金额 */
|
||||
@Excel(name = "激励金额")
|
||||
private BigDecimal money;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
private String remarks;
|
||||
|
||||
public String getClockType() {
|
||||
return clockType;
|
||||
}
|
||||
|
||||
public void setClockType(String clockType) {
|
||||
this.clockType = clockType;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getAbnormalId() {
|
||||
return abnormalId;
|
||||
}
|
||||
|
||||
public void setAbnormalId(Long abnormalId) {
|
||||
this.abnormalId = abnormalId;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setAbnormalTime(Date abnormalTime)
|
||||
{
|
||||
this.abnormalTime = abnormalTime;
|
||||
}
|
||||
|
||||
public Date getAbnormalTime()
|
||||
{
|
||||
return abnormalTime;
|
||||
}
|
||||
public void setMoney(BigDecimal money)
|
||||
{
|
||||
this.money = money;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public BigDecimal getMoney()
|
||||
{
|
||||
return money;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("abnormalId", getAbnormalId())
|
||||
.append("name", getName())
|
||||
.append("abnormalTime", getAbnormalTime())
|
||||
.append("money", getMoney())
|
||||
.append("remarks", getRemarks())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,242 @@
|
||||
package com.evo.attendance.domain;
|
||||
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 考勤记录对象 rz_attendance
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
public class RzAttendance extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 统计id */
|
||||
private Long staffId;
|
||||
|
||||
/** 员工姓名 */
|
||||
@Excel(name = "员工姓名")
|
||||
private String name;
|
||||
|
||||
/** 所属部门 */
|
||||
@Excel(name = "所属部门")
|
||||
private String deptName;
|
||||
private Long deptId;
|
||||
|
||||
/** 考勤日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "考勤日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date attendanceDate;
|
||||
|
||||
/** 考勤规则 */
|
||||
@Excel(name = "考勤规则")
|
||||
private String rules;
|
||||
|
||||
private String ycsFlag;
|
||||
private String ycxFlag;
|
||||
|
||||
/** 上班时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "上班时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date workStartTime;
|
||||
|
||||
/** 下班时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "下班时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date workEndTime;
|
||||
|
||||
/** 工作时长 */
|
||||
@Excel(name = "工作时长")
|
||||
private BigDecimal workSum;
|
||||
@Excel(name = "考勤时长")
|
||||
private BigDecimal workHours;
|
||||
/** 夜班次数 */
|
||||
private int nightNumber;
|
||||
|
||||
/** 中班次数 */
|
||||
private int middleShiftNumber;
|
||||
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remarks;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
public String getYcsFlag() {
|
||||
return ycsFlag;
|
||||
}
|
||||
|
||||
public void setYcsFlag(String ycsFlag) {
|
||||
this.ycsFlag = ycsFlag;
|
||||
}
|
||||
|
||||
public String getYcxFlag() {
|
||||
return ycxFlag;
|
||||
}
|
||||
|
||||
public void setYcxFlag(String ycxFlag) {
|
||||
this.ycxFlag = ycxFlag;
|
||||
}
|
||||
|
||||
public Long getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
public void setStaffId(Long staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public BigDecimal getWorkHours() {
|
||||
return workHours;
|
||||
}
|
||||
|
||||
public void setWorkHours(BigDecimal workHours) {
|
||||
this.workHours = workHours;
|
||||
}
|
||||
|
||||
public int getNightNumber() {
|
||||
return nightNumber;
|
||||
}
|
||||
|
||||
public void setNightNumber(int nightNumber) {
|
||||
this.nightNumber = nightNumber;
|
||||
}
|
||||
|
||||
public int getMiddleShiftNumber() {
|
||||
return middleShiftNumber;
|
||||
}
|
||||
|
||||
public void setMiddleShiftNumber(int middleShiftNumber) {
|
||||
this.middleShiftNumber = middleShiftNumber;
|
||||
}
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public void setAttendanceDate(Date attendanceDate)
|
||||
{
|
||||
this.attendanceDate = attendanceDate;
|
||||
}
|
||||
|
||||
public Date getAttendanceDate()
|
||||
{
|
||||
return attendanceDate;
|
||||
}
|
||||
public void setRules(String rules)
|
||||
{
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
public String getRules()
|
||||
{
|
||||
return rules;
|
||||
}
|
||||
public void setWorkStartTime(Date workStartTime)
|
||||
{
|
||||
this.workStartTime = workStartTime;
|
||||
}
|
||||
|
||||
public Date getWorkStartTime()
|
||||
{
|
||||
return workStartTime;
|
||||
}
|
||||
public void setWorkEndTime(Date workEndTime)
|
||||
{
|
||||
this.workEndTime = workEndTime;
|
||||
}
|
||||
|
||||
public Date getWorkEndTime()
|
||||
{
|
||||
return workEndTime;
|
||||
}
|
||||
public void setWorkSum(BigDecimal workSum)
|
||||
{
|
||||
this.workSum = workSum;
|
||||
}
|
||||
|
||||
public BigDecimal getWorkSum()
|
||||
{
|
||||
return workSum;
|
||||
}
|
||||
public void setRemarks(String remarks)
|
||||
{
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getRemarks()
|
||||
{
|
||||
return remarks;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("deptName", getDeptId())
|
||||
.append("attendanceDate", getAttendanceDate())
|
||||
.append("rules", getRules())
|
||||
.append("workStartTime", getWorkStartTime())
|
||||
.append("workEndTime", getWorkEndTime())
|
||||
.append("workSum", getWorkSum())
|
||||
.append("remarks", getRemarks())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
package com.evo.attendance.domain;
|
||||
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 考勤明细对象 rz_attendance_detail
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-14
|
||||
*/
|
||||
public class RzAttendanceDetail extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 用户id */
|
||||
@Excel(name = "用户id")
|
||||
private Long staffId;
|
||||
|
||||
/** 姓名 */
|
||||
@Excel(name = "姓名")
|
||||
private String name;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String equipmentCode;
|
||||
|
||||
/** 按钮类型 */
|
||||
@Excel(name = "按钮类型")
|
||||
private String buttonType;
|
||||
|
||||
/** 时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date dateTime;
|
||||
|
||||
/** 周六标识 */
|
||||
private String remark;
|
||||
|
||||
/** 删除标记 */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setStaffId(Long staffId)
|
||||
{
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public Long getStaffId()
|
||||
{
|
||||
return staffId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setEquipmentCode(String equipmentCode)
|
||||
{
|
||||
this.equipmentCode = equipmentCode;
|
||||
}
|
||||
|
||||
public String getEquipmentCode()
|
||||
{
|
||||
return equipmentCode;
|
||||
}
|
||||
public void setButtonType(String buttonType)
|
||||
{
|
||||
this.buttonType = buttonType;
|
||||
}
|
||||
|
||||
public String getButtonType()
|
||||
{
|
||||
return buttonType;
|
||||
}
|
||||
public void setDateTime(Date dateTime)
|
||||
{
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public Date getDateTime()
|
||||
{
|
||||
return dateTime;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("staffId", getStaffId())
|
||||
.append("name", getName())
|
||||
.append("equipmentCode", getEquipmentCode())
|
||||
.append("buttonType", getButtonType())
|
||||
.append("dateTime", getDateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,282 @@
|
||||
package com.evo.attendance.domain;
|
||||
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤统计对象 rz_attendance_statistical
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
public class RzAttendanceStatistical extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@Excel(name = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/** 员工ID */
|
||||
private Long staffId;
|
||||
|
||||
/** 所属月份 */
|
||||
@Excel(name = "所属月份", width = 30, dateFormat = "yyyy-MM")
|
||||
@JsonFormat(pattern = "yyyy-MM")
|
||||
private Date month;
|
||||
|
||||
/** 所属部门 */
|
||||
private Long deptId;
|
||||
|
||||
private List<Long> deptIds;
|
||||
@Excel(name = "所属部门")
|
||||
private String deptName;
|
||||
|
||||
/** 员工姓名 */
|
||||
@Excel(name = "员工姓名")
|
||||
private String name;
|
||||
|
||||
/** 应出勤(小时) */
|
||||
@Excel(name = "应出勤(小时)")
|
||||
private BigDecimal shouldAttendance;
|
||||
|
||||
/** 实出勤(小时) */
|
||||
@Excel(name = "实出勤(小时)")
|
||||
private BigDecimal realAttendance;
|
||||
|
||||
/** 打卡时长(小时) */
|
||||
@Excel(name = "打卡时长(小时)")
|
||||
private BigDecimal essentialAttendance;
|
||||
|
||||
/** 加班时长(小时) */
|
||||
@Excel(name = "加班时长(小时)")
|
||||
private BigDecimal workOvertimeNumber;
|
||||
|
||||
/** 请假时长(小时) */
|
||||
@Excel(name = "请假时长(小时)")
|
||||
private BigDecimal absenteeism;
|
||||
|
||||
/** 请假时长(小时) */
|
||||
@Excel(name = "特殊加班(小时)")
|
||||
private BigDecimal overTimeHours;
|
||||
|
||||
/** 迟到次数 */
|
||||
@Excel(name = "异常次数")
|
||||
private Long lateNumber;
|
||||
|
||||
/** 早退次数 */
|
||||
//@Excel(name = "早退次数")
|
||||
private Long leaveEarly;
|
||||
|
||||
/** 缺卡次数 */
|
||||
//@Excel(name = "缺卡次数")
|
||||
private Long lessNumber;
|
||||
|
||||
/** 夜班次数 */
|
||||
@Excel(name = "夜班次数")
|
||||
private Long nightNumber;
|
||||
|
||||
/** 中班次数 */
|
||||
@Excel(name = "中班次数")
|
||||
private Long middleShiftNumber;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
public BigDecimal getOverTimeHours() {
|
||||
return overTimeHours;
|
||||
}
|
||||
|
||||
public void setOverTimeHours(BigDecimal overTimeHours) {
|
||||
this.overTimeHours = overTimeHours;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public List<Long> getDeptIds() {
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
public void setDeptIds(List<Long> deptIds) {
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setStaffId(Long staffId)
|
||||
{
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public Long getStaffId()
|
||||
{
|
||||
return staffId;
|
||||
}
|
||||
public void setMonth(Date month)
|
||||
{
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public Date getMonth()
|
||||
{
|
||||
return month;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setShouldAttendance(BigDecimal shouldAttendance)
|
||||
{
|
||||
this.shouldAttendance = shouldAttendance;
|
||||
}
|
||||
|
||||
public BigDecimal getShouldAttendance()
|
||||
{
|
||||
return shouldAttendance;
|
||||
}
|
||||
public void setRealAttendance(BigDecimal realAttendance)
|
||||
{
|
||||
this.realAttendance = realAttendance;
|
||||
}
|
||||
|
||||
public BigDecimal getRealAttendance()
|
||||
{
|
||||
return realAttendance;
|
||||
}
|
||||
public void setEssentialAttendance(BigDecimal essentialAttendance)
|
||||
{
|
||||
this.essentialAttendance = essentialAttendance;
|
||||
}
|
||||
|
||||
public BigDecimal getEssentialAttendance()
|
||||
{
|
||||
return essentialAttendance;
|
||||
}
|
||||
public void setWorkOvertimeNumber(BigDecimal workOvertimeNumber)
|
||||
{
|
||||
this.workOvertimeNumber = workOvertimeNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getWorkOvertimeNumber()
|
||||
{
|
||||
return workOvertimeNumber;
|
||||
}
|
||||
public void setAbsenteeism(BigDecimal absenteeism)
|
||||
{
|
||||
this.absenteeism = absenteeism;
|
||||
}
|
||||
|
||||
public BigDecimal getAbsenteeism()
|
||||
{
|
||||
return absenteeism;
|
||||
}
|
||||
public void setLateNumber(Long lateNumber)
|
||||
{
|
||||
this.lateNumber = lateNumber;
|
||||
}
|
||||
|
||||
public Long getLateNumber()
|
||||
{
|
||||
return lateNumber;
|
||||
}
|
||||
public void setLeaveEarly(Long leaveEarly)
|
||||
{
|
||||
this.leaveEarly = leaveEarly;
|
||||
}
|
||||
|
||||
public Long getLeaveEarly()
|
||||
{
|
||||
return leaveEarly;
|
||||
}
|
||||
public void setLessNumber(Long lessNumber)
|
||||
{
|
||||
this.lessNumber = lessNumber;
|
||||
}
|
||||
|
||||
public Long getLessNumber()
|
||||
{
|
||||
return lessNumber;
|
||||
}
|
||||
public void setNightNumber(Long nightNumber)
|
||||
{
|
||||
this.nightNumber = nightNumber;
|
||||
}
|
||||
|
||||
public Long getNightNumber()
|
||||
{
|
||||
return nightNumber;
|
||||
}
|
||||
public void setMiddleShiftNumber(Long middleShiftNumber)
|
||||
{
|
||||
this.middleShiftNumber = middleShiftNumber;
|
||||
}
|
||||
|
||||
public Long getMiddleShiftNumber()
|
||||
{
|
||||
return middleShiftNumber;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("staffId", getStaffId())
|
||||
.append("month", getMonth())
|
||||
.append("deptId", getDeptId())
|
||||
.append("name", getName())
|
||||
.append("shouldAttendance", getShouldAttendance())
|
||||
.append("realAttendance", getRealAttendance())
|
||||
.append("essentialAttendance", getEssentialAttendance())
|
||||
.append("workOvertimeNumber", getWorkOvertimeNumber())
|
||||
.append("absenteeism", getAbsenteeism())
|
||||
.append("lateNumber", getLateNumber())
|
||||
.append("leaveEarly", getLeaveEarly())
|
||||
.append("lessNumber", getLessNumber())
|
||||
.append("nightNumber", getNightNumber())
|
||||
.append("middleShiftNumber", getMiddleShiftNumber())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,172 @@
|
||||
package com.evo.attendance.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 加班考勤记录对象 rz_special_attendance
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public class RzSpecialAttendance extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 员工ID */
|
||||
@Excel(name = "员工ID")
|
||||
private Long staffId;
|
||||
|
||||
/** 员工姓名 */
|
||||
@Excel(name = "员工姓名")
|
||||
private String name;
|
||||
|
||||
/** 所属部门 */
|
||||
@Excel(name = "所属部门")
|
||||
private Long deptId;
|
||||
|
||||
/** 考勤日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "考勤日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date attendanceDate;
|
||||
|
||||
/** 上班时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "上班时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date workStartTime;
|
||||
|
||||
/** 下班时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "下班时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date workEndTime;
|
||||
|
||||
/** 考勤时长 */
|
||||
@Excel(name = "考勤时长")
|
||||
private BigDecimal workHours;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remarks;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setStaffId(Long staffId)
|
||||
{
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public Long getStaffId()
|
||||
{
|
||||
return staffId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
public void setAttendanceDate(Date attendanceDate)
|
||||
{
|
||||
this.attendanceDate = attendanceDate;
|
||||
}
|
||||
|
||||
public Date getAttendanceDate()
|
||||
{
|
||||
return attendanceDate;
|
||||
}
|
||||
public void setWorkStartTime(Date workStartTime)
|
||||
{
|
||||
this.workStartTime = workStartTime;
|
||||
}
|
||||
|
||||
public Date getWorkStartTime()
|
||||
{
|
||||
return workStartTime;
|
||||
}
|
||||
public void setWorkEndTime(Date workEndTime)
|
||||
{
|
||||
this.workEndTime = workEndTime;
|
||||
}
|
||||
|
||||
public Date getWorkEndTime()
|
||||
{
|
||||
return workEndTime;
|
||||
}
|
||||
public void setWorkHours(BigDecimal workHours)
|
||||
{
|
||||
this.workHours = workHours;
|
||||
}
|
||||
|
||||
public BigDecimal getWorkHours()
|
||||
{
|
||||
return workHours;
|
||||
}
|
||||
public void setRemarks(String remarks)
|
||||
{
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getRemarks()
|
||||
{
|
||||
return remarks;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("staffId", getStaffId())
|
||||
.append("name", getName())
|
||||
.append("deptId", getDeptId())
|
||||
.append("attendanceDate", getAttendanceDate())
|
||||
.append("workStartTime", getWorkStartTime())
|
||||
.append("workEndTime", getWorkEndTime())
|
||||
.append("workHours", getWorkHours())
|
||||
.append("remarks", getRemarks())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,135 @@
|
||||
package com.evo.attendance.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 特殊加班管理对象 rz_special_over_time
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-16
|
||||
*/
|
||||
public class RzSpecialOverTime extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 员工ID */
|
||||
@Excel(name = "员工ID")
|
||||
private Long userId;
|
||||
|
||||
/** 部门 */
|
||||
private Long deptId;
|
||||
@Excel(name = "部门")
|
||||
private String deptName;
|
||||
/** 员工姓名 */
|
||||
@Excel(name = "员工姓名")
|
||||
private String name;
|
||||
|
||||
/** 加班月份(到月) */
|
||||
@Excel(name = "加班月份", readConverterExp = "到=月")
|
||||
@JsonFormat(pattern = "yyyy-MM")
|
||||
private Date overDate;
|
||||
|
||||
/** 加班时长(小时) */
|
||||
@Excel(name = "加班时长", readConverterExp = "小=时")
|
||||
private BigDecimal sickHours;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public Date getOverDate() {
|
||||
return overDate;
|
||||
}
|
||||
|
||||
public void setOverDate(Date overDate) {
|
||||
this.overDate = overDate;
|
||||
}
|
||||
|
||||
public void setSickHours(BigDecimal sickHours)
|
||||
{
|
||||
this.sickHours = sickHours;
|
||||
}
|
||||
|
||||
public BigDecimal getSickHours()
|
||||
{
|
||||
return sickHours;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("userId", getUserId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("name", getName())
|
||||
.append("sickHours", getSickHours())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.evo.attendance.domain.vo;
|
||||
|
||||
public class RzAttendanceData {
|
||||
|
||||
private String button;
|
||||
|
||||
public String getButton() {
|
||||
return button;
|
||||
}
|
||||
|
||||
public void setButton(String button) {
|
||||
this.button = button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RzAttendanceData [button=" + button + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.evo.attendance.domain.vo;
|
||||
|
||||
public class RzAttendanceVo {
|
||||
|
||||
private int Result;
|
||||
private String Msg;
|
||||
private RzAttendanceData Content;
|
||||
public int getResult() {
|
||||
return Result;
|
||||
}
|
||||
public void setResult(int result) {
|
||||
Result = result;
|
||||
}
|
||||
public String getMsg() {
|
||||
return Msg;
|
||||
}
|
||||
public void setMsg(String msg) {
|
||||
Msg = msg;
|
||||
}
|
||||
public RzAttendanceData getContent() {
|
||||
return Content;
|
||||
}
|
||||
public void setContent(RzAttendanceData content) {
|
||||
Content = content;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RzAttendanceVo [Result=" + Result + ", Msg=" + Msg + ", Content=" + Content + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
|
||||
/**
|
||||
* 考勤异常详情Mapper接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
public interface RzAbnormalDetailMapper
|
||||
{
|
||||
/**
|
||||
* 查询考勤异常详情
|
||||
*
|
||||
* @param id 考勤异常详情主键
|
||||
* @return 考勤异常详情
|
||||
*/
|
||||
public RzAbnormalDetail selectRzAbnormalDetailById(Long id);
|
||||
|
||||
/**
|
||||
* 查询考勤异常详情列表
|
||||
*
|
||||
* @param rzAbnormalDetail 考勤异常详情
|
||||
* @return 考勤异常详情集合
|
||||
*/
|
||||
public List<RzAbnormalDetail> selectRzAbnormalDetailList(RzAbnormalDetail rzAbnormalDetail);
|
||||
|
||||
/**
|
||||
* 新增考勤异常详情
|
||||
*
|
||||
* @param rzAbnormalDetail 考勤异常详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzAbnormalDetail(RzAbnormalDetail rzAbnormalDetail);
|
||||
|
||||
/**
|
||||
* 修改考勤异常详情
|
||||
*
|
||||
* @param rzAbnormalDetail 考勤异常详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAbnormalDetail(RzAbnormalDetail rzAbnormalDetail);
|
||||
|
||||
/**
|
||||
* 查询考勤异常详情
|
||||
* @return 考勤异常详情
|
||||
*/
|
||||
public List<RzAbnormalDetail> selectRzAbnormalDetailByAbnormalId(Long abnormalId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzAbnormal;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 考勤异常Mapper接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
public interface RzAbnormalMapper
|
||||
{
|
||||
/**
|
||||
* 查询考勤异常
|
||||
*
|
||||
* @param id 考勤异常主键
|
||||
* @return 考勤异常
|
||||
*/
|
||||
public RzAbnormal selectRzAbnormalById(Long id);
|
||||
|
||||
/**
|
||||
* 查询考勤异常列表
|
||||
*
|
||||
* @param rzAbnormal 考勤异常
|
||||
* @return 考勤异常集合
|
||||
*/
|
||||
public List<RzAbnormal> selectRzAbnormalList(RzAbnormal rzAbnormal);
|
||||
|
||||
/**
|
||||
* 新增考勤异常
|
||||
*
|
||||
* @param rzAbnormal 考勤异常
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzAbnormal(RzAbnormal rzAbnormal);
|
||||
|
||||
/**
|
||||
* 修改考勤异常
|
||||
*
|
||||
* @param rzAbnormal 考勤异常
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAbnormal(RzAbnormal rzAbnormal);
|
||||
|
||||
/**
|
||||
* 查询当月迟到情况
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public RzAbnormal selectRzAbnormalByUserId(@Param("userId") Long userId,@Param("month") Date month);
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendanceDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤明细Mapper接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-14
|
||||
*/
|
||||
public interface RzAttendanceDetailMapper
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询员工最后一次打卡明细 ,按钮切换使用
|
||||
*
|
||||
* @param staffId
|
||||
* @return 考勤明细集合
|
||||
*/
|
||||
public RzAttendanceDetail selectLastRzAttendanceDetail(@Param("staffId") Long staffId);
|
||||
|
||||
/**
|
||||
* 新增考勤明细
|
||||
*
|
||||
* @param rzAttendanceDetail 考勤明细
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzAttendanceDetail(RzAttendanceDetail rzAttendanceDetail);
|
||||
|
||||
/**
|
||||
* 修改考勤明细
|
||||
* @param rzAttendanceDetail
|
||||
* @return
|
||||
*/
|
||||
public int updateRzAttendanceDetail(RzAttendanceDetail rzAttendanceDetail);
|
||||
|
||||
/**
|
||||
* 查询员工最后一次上班打卡 计算工时
|
||||
*
|
||||
* @param staffId
|
||||
* @return 考勤明细集合
|
||||
*/
|
||||
public default RzAttendanceDetail selectRzAttendanceDetailByStaffId(@Param("staffId") Long staffId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<RzAttendanceDetail> selectRzAttendanceDetailByMonth(Date date);
|
||||
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤记录Mapper接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
public interface RzAttendanceMapper
|
||||
{
|
||||
/**
|
||||
* 查询考勤记录
|
||||
*
|
||||
* @param id 考勤记录主键
|
||||
* @return 考勤记录
|
||||
*/
|
||||
public RzAttendance selectRzAttendanceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询考勤记录列表
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 考勤记录集合
|
||||
*/
|
||||
public List<RzAttendance> selectRzAttendanceList(RzAttendance rzAttendance);
|
||||
/**
|
||||
* 修改考勤记录
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAttendance(RzAttendance rzAttendance);
|
||||
/**
|
||||
* 根据统计ID和时间查询当天的打卡记录
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public RzAttendance queryNowDayAttendanceByStatisticalIdAndDate(@Param("staffId") Long staffId,@Param("date") Date date);
|
||||
/**
|
||||
* 每日上班打卡统计
|
||||
* @return
|
||||
*/
|
||||
public List<RzAttendance> attendenceCount();
|
||||
/**
|
||||
* 根据员工ID查询最后一次考勤上班记录
|
||||
*
|
||||
* @param staffId 考勤统计ID
|
||||
* @return 考勤记录
|
||||
*/
|
||||
public RzAttendance selectLastRzAttendanceByStaffId(Long staffId);
|
||||
/**
|
||||
* 查询员工的考勤(根据月份)
|
||||
* @param staffId
|
||||
* @return
|
||||
*/
|
||||
public List<RzAttendance> queryMonthAttendanceByStaffId(@Param("staffId") Long staffId,@Param("date") Date date);
|
||||
/**
|
||||
* 查询考勤记录列表
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 考勤记录集合
|
||||
*/
|
||||
public List<RzAttendance> listAttendanceByParams(RzAttendance rzAttendance);
|
||||
/**
|
||||
* 批量新增考勤记录
|
||||
*
|
||||
* @param list 考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBatchRzAttendance(List<RzAttendance> list);
|
||||
|
||||
/**
|
||||
* 查询当天的考勤
|
||||
* @return
|
||||
*/
|
||||
public List<RzAttendance> currentDateAllAttendance();
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤统计Mapper接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
public interface RzAttendanceStatisticalMapper
|
||||
{
|
||||
/**
|
||||
* 查询考勤统计
|
||||
*
|
||||
* @param id 考勤统计主键
|
||||
* @return 考勤统计
|
||||
*/
|
||||
public RzAttendanceStatistical selectRzAttendanceStatisticalById(Long id);
|
||||
|
||||
/**
|
||||
* 查询考勤统计列表
|
||||
*
|
||||
* @param rzAttendanceStatistical 考勤统计
|
||||
* @return 考勤统计集合
|
||||
*/
|
||||
public List<RzAttendanceStatistical> selectRzAttendanceStatisticalList(RzAttendanceStatistical rzAttendanceStatistical);
|
||||
|
||||
/**
|
||||
* 新增考勤统计
|
||||
*
|
||||
* @param rzAttendanceStatistical 考勤统计
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzAttendanceStatistical(RzAttendanceStatistical rzAttendanceStatistical);
|
||||
|
||||
/**
|
||||
* 修改考勤统计
|
||||
*
|
||||
* @param rzAttendanceStatistical 考勤统计
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAttendanceStatistical(RzAttendanceStatistical rzAttendanceStatistical);
|
||||
|
||||
/**
|
||||
* 根据员工ID,时间查询统计信息
|
||||
* @param staffId
|
||||
* @param month
|
||||
* @return
|
||||
*/
|
||||
public RzAttendanceStatistical getRzAttendanceStatisticalByDateAndName(@Param("staffId") Long staffId,@Param("month") Date month);
|
||||
|
||||
/**
|
||||
* 查询考勤月的考勤统计信息 *
|
||||
* @return 考勤统计集合
|
||||
*/
|
||||
public List<RzAttendanceStatistical> queryStatisticalByMonth(Date month);
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import com.evo.attendance.domain.RzSpecialAttendance;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 加班考勤记录Mapper接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public interface RzSpecialAttendanceMapper
|
||||
{
|
||||
/**
|
||||
* 查询加班考勤记录
|
||||
*
|
||||
* @param id 加班考勤记录主键
|
||||
* @return 加班考勤记录
|
||||
*/
|
||||
public RzSpecialAttendance selectRzSpecialAttendanceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询加班考勤记录列表
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 加班考勤记录集合
|
||||
*/
|
||||
public List<RzSpecialAttendance> selectRzSpecialAttendanceList(RzSpecialAttendance rzSpecialAttendance);
|
||||
|
||||
/**
|
||||
* 新增加班考勤记录
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzSpecialAttendance(RzSpecialAttendance rzSpecialAttendance);
|
||||
|
||||
/**
|
||||
* 修改加班考勤记录
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzSpecialAttendance(RzSpecialAttendance rzSpecialAttendance);
|
||||
|
||||
public RzSpecialAttendance selectRzSpecialAttendanceByuserIdAndDate(@Param("staffId") Long staffId,@Param("date") Date date);
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import com.evo.attendance.domain.RzSpecialOverTime;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 特殊加班管理Mapper接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-16
|
||||
*/
|
||||
public interface RzSpecialOverTimeMapper
|
||||
{
|
||||
/**
|
||||
* 查询特殊加班管理
|
||||
*
|
||||
* @param id 特殊加班管理主键
|
||||
* @return 特殊加班管理
|
||||
*/
|
||||
public RzSpecialOverTime selectRzSpecialOverTimeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询特殊加班管理列表
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 特殊加班管理集合
|
||||
*/
|
||||
public List<RzSpecialOverTime> selectRzSpecialOverTimeList(RzSpecialOverTime rzSpecialOverTime);
|
||||
|
||||
/**
|
||||
* 新增特殊加班管理
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzSpecialOverTime(RzSpecialOverTime rzSpecialOverTime);
|
||||
|
||||
/**
|
||||
* 修改特殊加班管理
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzSpecialOverTime(RzSpecialOverTime rzSpecialOverTime);
|
||||
|
||||
public RzSpecialOverTime selectRzSpecialOverTimeByUserIdAndDate(@Param("userId") Long userId,@Param("date") Date date);
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.evo.attendance.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
|
||||
/**
|
||||
* 考勤异常详情Service接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
public interface IRzAbnormalDetailService
|
||||
{
|
||||
/**
|
||||
* 查询考勤异常详情
|
||||
*
|
||||
* @param id 考勤异常详情主键
|
||||
* @return 考勤异常详情
|
||||
*/
|
||||
public RzAbnormalDetail selectRzAbnormalDetailById(Long id);
|
||||
|
||||
/**
|
||||
* 查询考勤异常详情列表
|
||||
*
|
||||
* @param rzAbnormalDetail 考勤异常详情
|
||||
* @return 考勤异常详情集合
|
||||
*/
|
||||
public List<RzAbnormalDetail> selectRzAbnormalDetailList(RzAbnormalDetail rzAbnormalDetail);
|
||||
|
||||
/**
|
||||
* 新增考勤异常详情
|
||||
* @return 结果
|
||||
*/
|
||||
public void insertRzAbnormalDetail();
|
||||
|
||||
/**
|
||||
* 修改考勤异常详情
|
||||
*
|
||||
* @param rzAbnormalDetail 考勤异常详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAbnormalDetail(RzAbnormalDetail rzAbnormalDetail);
|
||||
|
||||
/**
|
||||
* 删除考勤异常详情信息
|
||||
*
|
||||
* @param id 考勤异常详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRzAbnormalDetailById(Long id);
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.evo.attendance.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzAbnormal;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
|
||||
/**
|
||||
* 考勤异常Service接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
public interface IRzAbnormalService
|
||||
{
|
||||
/**
|
||||
* 查询考勤异常
|
||||
*
|
||||
* @param id 考勤异常主键
|
||||
* @return 考勤异常
|
||||
*/
|
||||
public RzAbnormal selectRzAbnormalById(Long id);
|
||||
|
||||
/**
|
||||
* 查询考勤异常列表
|
||||
*
|
||||
* @param rzAbnormal 考勤异常
|
||||
* @return 考勤异常集合
|
||||
*/
|
||||
public List<RzAbnormal> selectRzAbnormalList(RzAbnormal rzAbnormal);
|
||||
|
||||
/**
|
||||
* 修改考勤异常
|
||||
*
|
||||
* @param rzAbnormal 考勤异常
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAbnormal(RzAbnormal rzAbnormal);
|
||||
|
||||
/**
|
||||
* 删除考勤异常信息
|
||||
*
|
||||
* @param id 考勤异常主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRzAbnormalById(Long id);
|
||||
/**
|
||||
* 异常详情
|
||||
* @param rzAbnormal
|
||||
* @return
|
||||
*/
|
||||
public List<RzAbnormalDetail> listAbnormalDetails(RzAbnormal rzAbnormal);
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.evo.attendance.service;
|
||||
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤记录Service接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
public interface IRzAttendanceService
|
||||
{
|
||||
/**
|
||||
* 查询考勤记录
|
||||
*
|
||||
* @param id 考勤记录主键
|
||||
* @return 考勤记录
|
||||
*/
|
||||
public RzAttendance selectRzAttendanceById(Long id);
|
||||
/**
|
||||
* 查询考勤记录列表
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 考勤记录集合
|
||||
*/
|
||||
public List<RzAttendance> selectRzAttendanceList(RzAttendance rzAttendance);
|
||||
/**
|
||||
* 修改考勤记录
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAttendance(RzAttendance rzAttendance);
|
||||
/**
|
||||
* 每日上班打卡统计
|
||||
* @return
|
||||
*/
|
||||
public int attendenceCount();
|
||||
/**
|
||||
* 批量修改考勤记录
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult updateBatchAttendance(RzAttendance rzAttendance);
|
||||
/**
|
||||
* 查询考勤记录列表
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 考勤记录集合
|
||||
*/
|
||||
public List<RzAttendance> listAttendanceByParams(RzAttendance rzAttendance);
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.evo.attendance.service;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤统计Service接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
public interface IRzAttendanceStatisticalService
|
||||
{
|
||||
/**
|
||||
* 查询考勤统计
|
||||
*
|
||||
* @param id 考勤统计主键
|
||||
* @return 考勤统计
|
||||
*/
|
||||
public RzAttendanceStatistical selectRzAttendanceStatisticalById(Long id);
|
||||
|
||||
/**
|
||||
* 查询考勤统计列表
|
||||
*
|
||||
* @param rzAttendanceStatistical 考勤统计
|
||||
* @return 考勤统计集合
|
||||
*/
|
||||
public List<RzAttendanceStatistical> selectRzAttendanceStatisticalList(RzAttendanceStatistical rzAttendanceStatistical);
|
||||
|
||||
/**
|
||||
* 修改考勤统计
|
||||
*
|
||||
* @param rzAttendanceStatistical 考勤统计
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzAttendanceStatistical(RzAttendanceStatistical rzAttendanceStatistical);
|
||||
/**
|
||||
* 校正数据
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult correct(RzAttendanceStatistical rzAttendanceStatisticals);
|
||||
|
||||
/**
|
||||
* 批量导入考勤统计
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult importRzAttendanceStatistical(List<RzAttendanceStatistical> list);
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.evo.attendance.service;
|
||||
|
||||
import com.evo.attendance.domain.RzSpecialAttendance;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 加班考勤记录Service接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
public interface IRzSpecialAttendanceService
|
||||
{
|
||||
/**
|
||||
* 查询加班考勤记录
|
||||
*
|
||||
* @param id 加班考勤记录主键
|
||||
* @return 加班考勤记录
|
||||
*/
|
||||
public RzSpecialAttendance selectRzSpecialAttendanceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询加班考勤记录列表
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 加班考勤记录集合
|
||||
*/
|
||||
public List<RzSpecialAttendance> selectRzSpecialAttendanceList(RzSpecialAttendance rzSpecialAttendance);
|
||||
|
||||
/**
|
||||
* 新增加班考勤记录
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzSpecialAttendance(RzSpecialAttendance rzSpecialAttendance);
|
||||
|
||||
/**
|
||||
* 修改加班考勤记录
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzSpecialAttendance(RzSpecialAttendance rzSpecialAttendance);
|
||||
|
||||
/**
|
||||
* 删除加班考勤记录信息
|
||||
*
|
||||
* @param id 加班考勤记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRzSpecialAttendanceById(Long id);
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.evo.attendance.service;
|
||||
|
||||
import com.evo.attendance.domain.RzSpecialOverTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 特殊加班管理Service接口
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-16
|
||||
*/
|
||||
public interface IRzSpecialOverTimeService
|
||||
{
|
||||
/**
|
||||
* 查询特殊加班管理
|
||||
*
|
||||
* @param id 特殊加班管理主键
|
||||
* @return 特殊加班管理
|
||||
*/
|
||||
public RzSpecialOverTime selectRzSpecialOverTimeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询特殊加班管理列表
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 特殊加班管理集合
|
||||
*/
|
||||
public List<RzSpecialOverTime> selectRzSpecialOverTimeList(RzSpecialOverTime rzSpecialOverTime);
|
||||
|
||||
/**
|
||||
* 新增特殊加班管理
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzSpecialOverTime(RzSpecialOverTime rzSpecialOverTime);
|
||||
|
||||
/**
|
||||
* 修改特殊加班管理
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzSpecialOverTime(RzSpecialOverTime rzSpecialOverTime);
|
||||
|
||||
/**
|
||||
* 删除特殊加班管理信息
|
||||
*
|
||||
* @param id 特殊加班管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRzSpecialOverTimeById(Long id);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.evo.attendance.service;
|
||||
|
||||
public interface PunchTheClockService {
|
||||
|
||||
/**
|
||||
* 刷脸获取打卡按钮权限
|
||||
*/
|
||||
public String returnMessage(String json);
|
||||
/**
|
||||
* 用户点击打卡按钮后请求的接口
|
||||
*/
|
||||
public String recordFace(String json);
|
||||
|
||||
}
|
||||
@ -0,0 +1,559 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.evo.attendance.domain.*;
|
||||
import com.evo.attendance.mapper.*;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.equipment.domain.EqImages;
|
||||
import com.evo.equipment.mapper.EqImagesMapper;
|
||||
import com.evo.attendance.domain.vo.RzAttendanceData;
|
||||
import com.evo.attendance.domain.vo.RzAttendanceVo;
|
||||
import com.evo.attendance.service.PunchTheClockService;
|
||||
import com.evo.personnelMatters.domain.EqOverStaff;
|
||||
import com.evo.personnelMatters.domain.RzOverTime;
|
||||
import com.evo.personnelMatters.domain.RzOverTimeDetail;
|
||||
import com.evo.personnelMatters.domain.SpecialOverTime;
|
||||
import com.evo.personnelMatters.mapper.BsOverTimeMapper;
|
||||
import com.evo.personnelMatters.mapper.EqOverStaffMapper;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeDetailMapper;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeMapper;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.mapper.SysStaffDetailMapper;
|
||||
import com.evo.system.mapper.SysStaffMapper;
|
||||
import com.evo.utils.DateUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Service
|
||||
public class PunchTheClockServiceImpl implements PunchTheClockService {
|
||||
|
||||
@Resource
|
||||
private EqImagesMapper eqImagesMapper; //照片管理
|
||||
@Resource
|
||||
private RzAttendanceMapper rzAttendanceMapper; //考勤记录
|
||||
@Resource
|
||||
private RzAttendanceDetailMapper rzAttendanceDetailMapper; //打卡明细
|
||||
@Resource
|
||||
private SysStaffMapper sysStaffMapper; //员工信息
|
||||
@Resource
|
||||
private SysStaffDetailMapper sysStaffDetailMapper; //员工详情
|
||||
@Resource
|
||||
private RzOverTimeDetailMapper rzOverTimeDetailMapper; //加班详情
|
||||
@Resource
|
||||
private RzOverTimeMapper rzOverTimeMapper; //加班统计
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper; //打卡统计
|
||||
@Resource
|
||||
private RzSpecialAttendanceMapper rzSpecialAttendanceMapper;
|
||||
@Resource
|
||||
private EqOverStaffMapper eqOverStaffMapper;
|
||||
@Resource
|
||||
private BsOverTimeMapper bsOverTimeMapper;
|
||||
@Resource
|
||||
private RzSpecialOverTimeMapper rzSpecialOverTimeMapper;
|
||||
/**
|
||||
* 刷脸获取打卡按钮权限
|
||||
* sn 设备号
|
||||
* type 设备识别类型
|
||||
* user_id 用户id
|
||||
* card 人员信息中的卡号
|
||||
* confidence 人脸算法识别到的相识度
|
||||
* temperature 测量到的温度,未开启测温的设备为空
|
||||
*
|
||||
* 响应: Result 返回请求类型:0:可以打卡,其它值表示无法打卡
|
||||
* Msg 对应 Result 的状态,可为空
|
||||
* Content 识别后返回的详细信息
|
||||
* button 9位长度的字符串,0 表示不可以点击 1 表示可以点击
|
||||
*
|
||||
* String sn,String type,String userId,String card,String confidence
|
||||
*/
|
||||
@Override
|
||||
public String returnMessage(String json){
|
||||
//解析收到的数据
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
String userId = jsonObject.getString("user_id");
|
||||
//需要推送的数据
|
||||
String message = "";
|
||||
//需要返回的对象
|
||||
RzAttendanceVo cardV = new RzAttendanceVo();
|
||||
RzAttendanceData cardD = new RzAttendanceData();
|
||||
String sn = jsonObject.getString("sn");
|
||||
if(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE.equals(sn)){
|
||||
boolean flag = DateUtil.isSaturday(new Date(),1);
|
||||
if(flag){
|
||||
cardV.setResult(1);
|
||||
cardV.setMsg("{\"Result\":1,\"Msg\":\"周日不能打卡\"}");
|
||||
cardD.setButton("000000000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
return message;
|
||||
}
|
||||
EqOverStaff eqOverStaff = eqOverStaffMapper.selectEqOverStaffByUserId(Long.valueOf(userId));
|
||||
if(StringUtils.isNull(eqOverStaff)){
|
||||
cardV.setResult(1);
|
||||
cardV.setMsg("{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}");
|
||||
cardD.setButton("000000000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
return message;
|
||||
}
|
||||
RzSpecialAttendance rzSpecialAttendance = rzSpecialAttendanceMapper.selectRzSpecialAttendanceByuserIdAndDate(Long.valueOf(userId),new Date());
|
||||
if(StringUtils.isNull(rzSpecialAttendance)){
|
||||
cardV.setResult(0);
|
||||
cardV.setMsg("验证通过");
|
||||
cardD.setButton("111100000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
}else{
|
||||
cardV.setResult(0);
|
||||
cardV.setMsg("验证通过");
|
||||
cardD.setButton("000011000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
//根据ID查询在职员工信息
|
||||
SysStaff sysStaff = sysStaffMapper.selectSysStaffByUserId(Long.valueOf(userId));
|
||||
//员工不存在,说明离职没有打卡权限
|
||||
if(StringUtils.isNull(sysStaff)){
|
||||
cardV.setResult(1);
|
||||
cardV.setMsg("{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}");
|
||||
cardD.setButton("000000000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
return message;
|
||||
}
|
||||
//根据id查询当前员工不是员工列表中的人,返回提示
|
||||
EqImages userImg = eqImagesMapper.selectEqImagesByStaffId(Long.valueOf(userId));
|
||||
if(StringUtils.isNull(userImg)){
|
||||
cardV.setResult(1);
|
||||
cardV.setMsg("{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}");
|
||||
cardD.setButton("000000000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
return message;
|
||||
}
|
||||
//查询员工的最后一次打卡 按钮切换
|
||||
RzAttendanceDetail rzAttendanceDetail = rzAttendanceDetailMapper.selectLastRzAttendanceDetail(Long.valueOf(userId));
|
||||
//判断最后一次打卡为下班卡或没有打卡记录,则打卡为上班卡
|
||||
if(StringUtils.isNull(rzAttendanceDetail) || "下班卡".equals(rzAttendanceDetail.getButtonType()) || "撤销".equals(rzAttendanceDetail.getButtonType())){
|
||||
//如果最后一条数据的卡类型为下班卡,则返回上班卡和加班卡权限
|
||||
cardV.setResult(0);
|
||||
cardV.setMsg("验证通过");
|
||||
cardD.setButton("111100000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
}else{
|
||||
cardV.setResult(0);
|
||||
cardV.setMsg("验证通过");
|
||||
cardD.setButton("000011000");
|
||||
cardV.setContent(cardD);
|
||||
//Java对象转换成JSON字符串
|
||||
message = JSONObject.toJSONString(cardV);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
/**
|
||||
* 用户点击打卡按钮后请求的接口
|
||||
* sn 设备号
|
||||
* user_id 人员id
|
||||
* user_name 用户名
|
||||
* user_type 用户类型,对应下发人员时的 user_type
|
||||
* card_number 卡号
|
||||
* recog_type 识别类型: face - 为人脸识别 、card - 刷卡开门,人脸或卡模式
|
||||
* recog_time 识别时间(时间格式yyyy-MM-dd HH:mm:ss)
|
||||
* photo 识别照片,服务端收到后转换成图片步骤请查看 2、服务规范 - 照片解码流程
|
||||
* body_temperature 体温
|
||||
* confidence 通过的置信度
|
||||
* button 1~9 表示点击的是第几个按钮
|
||||
*
|
||||
* 响应:Result 返回请求类型:0成功,其它失败
|
||||
* Msg 对应 Result 的文本信息
|
||||
*
|
||||
* String sn,String userId,String userName,String userType,String cardNumber,String recog_type,String recog_time,String photo,String body_temperature,String confidence,String button
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public String recordFace(String json){
|
||||
//解析收到的数据
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
String userId = jsonObject.getString("user_id");
|
||||
String sn = jsonObject.getString("sn");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = null; //打卡时间
|
||||
try{
|
||||
date = sdf.parse(jsonObject.getString("recog_time"));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
String rules = ""; //打卡规则
|
||||
String button = jsonObject.getString("button");
|
||||
switch (button){
|
||||
case "1":
|
||||
rules = "上班卡(单班制)";
|
||||
break;
|
||||
case "2":
|
||||
rules = "上班卡(双班制)";
|
||||
break;
|
||||
case "3":
|
||||
rules = "上班卡(三班制)";
|
||||
break;
|
||||
case "4":
|
||||
rules = "加班卡";
|
||||
break;
|
||||
case "5":
|
||||
rules = "下班卡";
|
||||
break;
|
||||
default:
|
||||
rules = "撤销";
|
||||
break;
|
||||
}
|
||||
|
||||
//判断是打特殊加班卡
|
||||
if(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE.equals(sn)){
|
||||
RzSpecialAttendance rzSpecialAttendance = null;
|
||||
SysStaff sysStaff = sysStaffMapper.selectSysStaffByUserId(Long.valueOf(userId));
|
||||
if("1".equals(button) || "2".equals(button) || "3".equals(button) || "6".equals(button)){
|
||||
return "{\"Result\":1,\"Msg\":\"无效打卡\"}";
|
||||
}
|
||||
if("4".equals(button)){
|
||||
rzSpecialAttendance = new RzSpecialAttendance();
|
||||
rzSpecialAttendance.setAttendanceDate(new Date());
|
||||
rzSpecialAttendance.setStaffId(Long.valueOf(userId));
|
||||
rzSpecialAttendance.setName(sysStaff.getName());
|
||||
rzSpecialAttendance.setWorkStartTime(date);
|
||||
rzSpecialAttendance.setDeptId(sysStaff.getDeptId());
|
||||
rzSpecialAttendance.setDelFlag("0");
|
||||
rzSpecialAttendance.setCreateBy("admin");
|
||||
rzSpecialAttendance.setCreateTime(new Date());
|
||||
rzSpecialAttendanceMapper.insertRzSpecialAttendance(rzSpecialAttendance);
|
||||
|
||||
RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
if(StringUtils.isNull(rzSpecialOverTime)){
|
||||
rzSpecialOverTime = new RzSpecialOverTime();
|
||||
rzSpecialOverTime.setUserId(Long.valueOf(userId));
|
||||
rzSpecialOverTime.setName(sysStaff.getName());
|
||||
rzSpecialOverTime.setDeptId(sysStaff.getDeptId());
|
||||
rzSpecialOverTime.setDelFlag("0");
|
||||
rzSpecialOverTime.setOverDate(date);
|
||||
rzSpecialOverTime.setCreateTime(new Date());
|
||||
rzSpecialOverTime.setCreateBy("admin");
|
||||
rzSpecialOverTimeMapper.insertRzSpecialOverTime(rzSpecialOverTime);
|
||||
}
|
||||
return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
}else {
|
||||
rzSpecialAttendance = rzSpecialAttendanceMapper.selectRzSpecialAttendanceByuserIdAndDate(Long.valueOf(userId),new Date());
|
||||
rzSpecialAttendance.setWorkEndTime(date);
|
||||
SpecialOverTime specialOverTime = bsOverTimeMapper.selectSpecialOverTimeById();
|
||||
try{
|
||||
Date overDate_s = sdf.parse(sdfd.format(rzSpecialAttendance.getWorkStartTime())+" "+specialOverTime.getWorkStart());
|
||||
Date overDate_e = sdf.parse(sdfd.format(date)+" "+specialOverTime.getWorkEnd());
|
||||
|
||||
Long minutes = 0l;
|
||||
if(overDate_s.after(rzSpecialAttendance.getWorkStartTime()) && overDate_e.before(date)){
|
||||
minutes = (overDate_e.getTime() - overDate_s.getTime())/1000/60;
|
||||
}else {
|
||||
if(overDate_s.before(rzSpecialAttendance.getWorkStartTime()) && overDate_e.after(date)){
|
||||
minutes = (date.getTime() - rzSpecialAttendance.getWorkStartTime().getTime())/1000/60;
|
||||
}else{
|
||||
if(overDate_e.after(date)){
|
||||
minutes = (date.getTime() - overDate_s.getTime())/1000/60;
|
||||
}else {
|
||||
minutes = (overDate_e.getTime() - rzSpecialAttendance.getWorkStartTime().getTime())/1000/60;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(minutes >= 180){
|
||||
rzSpecialAttendance.setWorkHours(new BigDecimal(3));
|
||||
}else if(minutes >= 120){
|
||||
rzSpecialAttendance.setWorkHours(new BigDecimal(2));
|
||||
}
|
||||
rzSpecialAttendanceMapper.updateRzSpecialAttendance(rzSpecialAttendance);
|
||||
|
||||
RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
rzSpecialOverTime.setSickHours(rzSpecialOverTime.getSickHours().add(rzSpecialAttendance.getWorkHours()));
|
||||
rzSpecialOverTimeMapper.updateRzSpecialOverTime(rzSpecialOverTime);
|
||||
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
if(StringUtils.isNull(rzAttendanceStatistical.getOverTimeHours())){
|
||||
rzAttendanceStatistical.setOverTimeHours(new BigDecimal(0.0));
|
||||
}
|
||||
rzAttendanceStatistical.setOverTimeHours(rzAttendanceStatistical.getOverTimeHours().add(rzSpecialAttendance.getWorkHours()));
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//根据ID查询员工信息 ,判断员工是否存在,不存在返回失败
|
||||
SysStaff sysStaff = sysStaffMapper.selectSysStaffByUserId(Long.valueOf(userId));//打卡记录信息
|
||||
if(sysStaff == null){
|
||||
return "{\"Result\":1,\"Msg\":\"验证失败,未设置考勤权限\"}";
|
||||
}
|
||||
//获取员工的工作时长
|
||||
EqImages eqImages = eqImagesMapper.selectEqImagesByStaffId(Long.valueOf(userId));
|
||||
//打卡明细
|
||||
RzAttendanceDetail attendanceDetail = new RzAttendanceDetail();
|
||||
//打卡明细表中插入数据
|
||||
attendanceDetail.setButtonType(rules);
|
||||
attendanceDetail.setName(sysStaff.getName());
|
||||
attendanceDetail.setDateTime(date);
|
||||
attendanceDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
attendanceDetail.setStaffId(Long.valueOf(userId));
|
||||
attendanceDetail.setEquipmentCode(sn);
|
||||
attendanceDetail.setCreateTime(new Date());
|
||||
int i = rzAttendanceDetailMapper.insertRzAttendanceDetail(attendanceDetail);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
//考勤加班统计
|
||||
RzOverTime rzOverTime = null;
|
||||
RzOverTimeDetail rzOverTimeDetail = null;
|
||||
|
||||
//打的是加班卡,加班列表中填写数据
|
||||
if("4".equals(button)){
|
||||
//判断打卡月是否统计过加班
|
||||
rzOverTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(Long.valueOf(userId),date);
|
||||
if(rzOverTime == null){
|
||||
rzOverTime = new RzOverTime();
|
||||
rzOverTime.setUserId(Long.valueOf(userId));
|
||||
rzOverTime.setOverHours(new BigDecimal("0.0"));
|
||||
rzOverTime.setDeptId(sysStaff.getDeptId());
|
||||
rzOverTime.setName(sysStaff.getName());
|
||||
rzOverTime.setOverTimeMonth(date);
|
||||
rzOverTime.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
rzOverTime.setCreateBy("admin");
|
||||
rzOverTime.setCreateTime(DateUtils.getNowDate());
|
||||
i = rzOverTimeMapper.insertRzOverTime(rzOverTime);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
}
|
||||
rzOverTimeDetail = new RzOverTimeDetail();
|
||||
rzOverTimeDetail.setOverTimeId(rzOverTime.getId());
|
||||
rzOverTimeDetail.setOverTimeStart(date);
|
||||
rzOverTimeDetail.setName(sysStaff.getName());
|
||||
rzOverTimeDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
rzOverTimeDetail.setCreateBy("admin");
|
||||
rzOverTimeDetail.setCreateTime(DateUtils.getNowDate());
|
||||
i = rzOverTimeDetailMapper.insertRzOverTimeDetail(rzOverTimeDetail);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
}
|
||||
|
||||
//员工考勤记录
|
||||
RzAttendance attendance = rzAttendanceMapper.queryNowDayAttendanceByStatisticalIdAndDate(Long.valueOf(userId),date);
|
||||
//判断是撤销卡
|
||||
if("6".equals(button)){
|
||||
attendance.setRules("");
|
||||
i = rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
}
|
||||
|
||||
//判断是上班卡
|
||||
if("1".equals(button) || "2".equals(button) || "3".equals(button)){
|
||||
if(StringUtils.isNotNull(attendance.getWorkStartTime())){
|
||||
attendance.setRules(rules);
|
||||
}else{
|
||||
attendance.setRules(rules);
|
||||
attendance.setWorkStartTime(date);
|
||||
}
|
||||
try{
|
||||
//判断三种上班卡
|
||||
Date db_pre = sdf.parse(sdfd.format(date) + " 08:30:00");
|
||||
Date sb_pre = sdf.parse(sdfd.format(date) + " 17:00:00");
|
||||
Date sbz_pre = sdf.parse(sdfd.format(date) + " 20:30:00");
|
||||
if("上班卡(单班制)".equals(rules) && date.after(db_pre)
|
||||
|| ("上班卡(双班制)".equals(rules) && ((date.after(db_pre) && date.getHours() < 12) || (date.after(sb_pre) && date.getHours() <21)))
|
||||
|| ("上班卡(三班制)".equals(rules) && ((date.after(db_pre) && date.getHours() < 12) || (date.after(sbz_pre) && date.getHours() < 24)))){
|
||||
attendance.setYcsFlag("1");
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
i = rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
}
|
||||
|
||||
// 查询员工的最后一次上班打卡信息
|
||||
RzAttendanceDetail rzAttendanceDetail = rzAttendanceDetailMapper.selectRzAttendanceDetailByStaffId(Long.valueOf(userId));
|
||||
|
||||
//下班卡
|
||||
//最后一次打卡为加班卡 跨月加班按上个月加班计算
|
||||
if("加班卡".equals(rzAttendanceDetail.getButtonType())){
|
||||
//修改加班打卡记录 根据员工ID和时间查找 统计数据
|
||||
rzOverTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(Long.valueOf(userId),rzAttendanceDetail.getDateTime());
|
||||
//查找加班详情 加班统计ID和加班开始时间
|
||||
rzOverTimeDetail = rzOverTimeDetailMapper.queryRzOverTimeDetailByDateAndOverId(rzOverTime.getId(),rzAttendanceDetail.getDateTime());
|
||||
rzOverTimeDetail.setOverTimeEnd(date);
|
||||
//计算加班时长 小时
|
||||
double hours = (rzOverTimeDetail.getOverTimeEnd().getTime() - rzOverTimeDetail.getOverTimeStart().getTime())/1000/60/60;
|
||||
if(hours > 4){
|
||||
rzOverTimeDetail.setOverTimeHours(BigDecimal.valueOf(4));
|
||||
}else{
|
||||
rzOverTimeDetail.setOverTimeHours(BigDecimal.valueOf(hours));
|
||||
}
|
||||
|
||||
i = rzOverTimeDetailMapper.updateRzOverTimeDetail(rzOverTimeDetail);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
//加班修改统计
|
||||
rzOverTime.setOverHours(rzOverTime.getOverHours().add(rzOverTimeDetail.getOverTimeHours()));
|
||||
i = rzOverTimeMapper.updateRzOverTime(rzOverTime);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
//反写考勤汇总
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(Long.valueOf(userId),rzOverTime.getOverTimeMonth());
|
||||
rzAttendanceStatistical.setWorkOvertimeNumber(rzOverTime.getOverHours());
|
||||
i = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
if(i < 1){
|
||||
return"{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
}
|
||||
|
||||
BigDecimal res = new BigDecimal("0.0"); //记录工时
|
||||
//计算工时
|
||||
Long hours = (date.getTime() - rzAttendanceDetail.getDateTime().getTime())/1000/60/60;
|
||||
//判断不是当天的下班卡
|
||||
if(StringUtils.isNull(attendance.getWorkStartTime())){
|
||||
//最后一次上班卡打卡时间
|
||||
attendance = rzAttendanceMapper.selectLastRzAttendanceByStaffId(Long.valueOf(userId));
|
||||
//判断是单班,双班,还是三班
|
||||
if("上班卡(三班制)".equals(attendance.getRules())){
|
||||
if(hours >= eqImages.getHours().longValue() -1){
|
||||
res = eqImages.getHours();
|
||||
}else if(hours >= 5){
|
||||
res = new BigDecimal(6);
|
||||
}
|
||||
//判断打卡时间, 添加夜班次数 打卡时间在晚上7点以后
|
||||
if(hours > 8 && attendance.getWorkStartTime().getHours() > 18){
|
||||
attendance.setNightNumber(1);
|
||||
}
|
||||
}else if("上班卡(双班制)".equals(attendance.getRules())){
|
||||
if(hours >= 7.5){
|
||||
res = new BigDecimal("8");
|
||||
}else if(hours >= 3.5){
|
||||
res = new BigDecimal(4);
|
||||
}
|
||||
//判断打卡时间, 添加中班次数 打卡时间在下午3点以后
|
||||
if(hours > 6.5 && attendance.getWorkStartTime().getHours() > 15){
|
||||
attendance.setMiddleShiftNumber(1);
|
||||
}
|
||||
}else{
|
||||
if(hours >= 8){
|
||||
res = new BigDecimal("8");
|
||||
}else if(hours >= 3){
|
||||
res = new BigDecimal(4);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
try{
|
||||
if("上班卡(单班制)".equals(rzAttendanceDetail.getButtonType())){
|
||||
if(attendance.getWorkStartTime().getTime() - sdf.parse(sdfd.format(date) + " 08:30:00").getTime() > 1000*60*+60
|
||||
|| sdf.parse(sdfd.format(date) + " 17:30:00").getTime() - date.getTime() > 1000*60*+60){
|
||||
if(hours >= 3){
|
||||
res = new BigDecimal("4");
|
||||
}
|
||||
}else{
|
||||
if(hours >= 8){
|
||||
res = new BigDecimal("8.0");
|
||||
}else if(hours >= 4){
|
||||
res = new BigDecimal(4);
|
||||
}
|
||||
}
|
||||
}else if("上班卡(双班制)".equals(rzAttendanceDetail.getButtonType())){
|
||||
if(attendance.getWorkStartTime().getTime() - sdf.parse(sdfd.format(date) + " 08:30:00").getTime() > 1000*60*+60
|
||||
|| sdf.parse(sdfd.format(date) + " 17:30:00").getTime() - date.getTime() > 1000*60*+60){
|
||||
if(hours >= 4){
|
||||
res = new BigDecimal("4");
|
||||
}
|
||||
}else{
|
||||
if(hours >= 8){
|
||||
res = new BigDecimal("8.0");
|
||||
}else if(hours >= 4){
|
||||
res = new BigDecimal(4);
|
||||
}
|
||||
}
|
||||
}else if("上班卡(三班制)".equals(rzAttendanceDetail.getButtonType())){
|
||||
if(attendance.getWorkStartTime().getTime() - sdf.parse(sdfd.format(date) + " 08:30:00").getTime() > 1000*60*+60
|
||||
|| sdf.parse(sdfd.format(date) + " 20:30:00").getTime() - date.getTime() > 1000*60*+60){
|
||||
if(hours >= 5){
|
||||
res = new BigDecimal("6");
|
||||
}
|
||||
}else{
|
||||
if(hours >= eqImages.getHours().longValue()-1){
|
||||
res = eqImages.getHours();
|
||||
}else if(hours >= 5){
|
||||
res = new BigDecimal(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
try{
|
||||
//下班卡异常
|
||||
Date db_pre = sdf.parse(sdfd.format(date) + " 08:30:00");
|
||||
Date sb_pre = sdf.parse(sdfd.format(date) + " 17:00:00");
|
||||
Date db_pre_2 = sdf.parse(sdfd.format(date) + " 17:30:00");
|
||||
Date sbz_pre = sdf.parse(sdfd.format(date) + " 20:30:00");
|
||||
Date sbz_pre_2 = sdf.parse(sdfd.format(date) + " 01:30:00");
|
||||
if(("上班卡(单班制)".equals(rzAttendanceDetail.getButtonType()) && date.before(db_pre_2))
|
||||
|| ("上班卡(双班制)".equals(rzAttendanceDetail.getButtonType())
|
||||
&& ((date.before(sb_pre) && date.after(db_pre)) || ((date.before(sbz_pre_2)) && date.after(sb_pre))))
|
||||
|| ("上班卡(三班制)".equals(rzAttendanceDetail.getButtonType()) && ((date.before(sbz_pre) && date.getHours() > 14) || date.before(db_pre)))){
|
||||
attendance.setYcxFlag("1");
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
//修改打卡记录
|
||||
attendance.setWorkEndTime(date);
|
||||
attendance.setWorkSum(res);
|
||||
i = rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
if(i < 1){
|
||||
return "{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
//反写考勤汇总
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(Long.valueOf(userId),attendance.getAttendanceDate());
|
||||
rzAttendanceStatistical.setRealAttendance(rzAttendanceStatistical.getRealAttendance().add(attendance.getWorkSum()));
|
||||
i = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
if(i < 1){
|
||||
return"{\"Result\":1,\"Msg\":\"打卡失败\"}";
|
||||
}
|
||||
return "{\"Result\":0,\"Msg\":\"打卡成功\"}";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,176 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzAbnormal;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.mapper.RzAbnormalMapper;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import com.evo.personnelMatters.mapper.RzHolidayMapper;
|
||||
import com.evo.utils.DateUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.evo.attendance.mapper.RzAbnormalDetailMapper;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
import com.evo.attendance.service.IRzAbnormalDetailService;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 考勤异常详情Service业务层处理
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@Service
|
||||
public class RzAbnormalDetailServiceImpl implements IRzAbnormalDetailService
|
||||
{
|
||||
@Resource
|
||||
private RzAbnormalDetailMapper rzAbnormalDetailMapper;
|
||||
@Resource
|
||||
private RzAttendanceMapper rzAttendanceMapper; //考勤信息
|
||||
@Resource
|
||||
private RzAbnormalMapper rzAbnormalMapper; //异常汇总
|
||||
@Resource
|
||||
private RzHolidayMapper rzHolidayMapper; //节假日
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper; //考勤统计
|
||||
/**
|
||||
* 查询考勤异常详情
|
||||
*
|
||||
* @param id 考勤异常详情主键
|
||||
* @return 考勤异常详情
|
||||
*/
|
||||
@Override
|
||||
public RzAbnormalDetail selectRzAbnormalDetailById(Long id)
|
||||
{
|
||||
return rzAbnormalDetailMapper.selectRzAbnormalDetailById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考勤异常详情列表
|
||||
*
|
||||
* @param rzAbnormalDetail 考勤异常详情
|
||||
* @return 考勤异常详情
|
||||
*/
|
||||
@Override
|
||||
public List<RzAbnormalDetail> selectRzAbnormalDetailList(RzAbnormalDetail rzAbnormalDetail)
|
||||
{
|
||||
return rzAbnormalDetailMapper.selectRzAbnormalDetailList(rzAbnormalDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增考勤异常详情
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void insertRzAbnormalDetail(){
|
||||
List<RzAttendance> res_list = rzAttendanceMapper.currentDateAllAttendance();
|
||||
try{
|
||||
RzAbnormalDetail rzAbnormalDetail = null;
|
||||
//查询节假日
|
||||
List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
//判断是否是节假日
|
||||
int flag = 0;
|
||||
for (RzHoliday rzHoliday : h_list) {
|
||||
if(rzHoliday.getHoliday().compareTo(res_list.get(0).getAttendanceDate()) == 0){
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (RzAttendance rzAttendance : res_list) {
|
||||
//判断是否是周日
|
||||
if(DateUtil.isSaturday(rzAttendance.getAttendanceDate(),1) || flag == 1){
|
||||
//判断未打卡
|
||||
if(rzAttendance.getWorkStartTime() == null){
|
||||
rzAttendance.setRemarks("公休");
|
||||
rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
continue;
|
||||
}
|
||||
rzAttendance.setRemarks("加班");
|
||||
rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
continue;
|
||||
}
|
||||
//判断今天没有打卡
|
||||
if("1".equals(rzAttendance.getYcsFlag()) || "1".equals(rzAttendance.getYcxFlag())
|
||||
|| rzAttendance.getWorkStartTime() == null || rzAttendance.getWorkEndTime() == null){
|
||||
//判断员工当月是否已经有迟到
|
||||
RzAbnormal rzAbnormal = rzAbnormalMapper.selectRzAbnormalByUserId(rzAttendance.getStaffId(),new Date());
|
||||
if(StringUtils.isNull(rzAbnormal)){
|
||||
rzAbnormal = new RzAbnormal();
|
||||
rzAbnormal.setDeptId(rzAttendance.getDeptId());
|
||||
rzAbnormal.setUserId(rzAttendance.getStaffId());
|
||||
rzAbnormal.setName(rzAttendance.getName());
|
||||
rzAbnormal.setNumber(0l);
|
||||
rzAbnormal.setMoney(BigDecimal.valueOf(0));
|
||||
rzAbnormal.setMonth(new Date());
|
||||
rzAbnormal.setDelFlag("0");
|
||||
rzAbnormalMapper.insertRzAbnormal(rzAbnormal);
|
||||
}
|
||||
rzAbnormalDetail = new RzAbnormalDetail();
|
||||
rzAbnormalDetail.setAbnormalId(rzAbnormal.getId());
|
||||
rzAbnormalDetail.setName(rzAttendance.getName());
|
||||
rzAbnormalDetail.setClockDate(rzAttendance.getAttendanceDate());
|
||||
if("1".equals(rzAttendance.getYcxFlag())){
|
||||
rzAbnormalDetail.setAbnormalTime(rzAttendance.getWorkEndTime());
|
||||
rzAbnormalDetail.setClockType("下班卡");
|
||||
}else if("1".equals(rzAttendance.getYcsFlag())){
|
||||
rzAbnormalDetail.setAbnormalTime(rzAttendance.getWorkStartTime());
|
||||
rzAbnormalDetail.setClockType("上班卡");
|
||||
}else if(rzAttendance.getWorkStartTime() == null){
|
||||
rzAbnormalDetail.setClockType("未打卡");
|
||||
}else{
|
||||
rzAbnormalDetail.setClockType("未打下班卡");
|
||||
}
|
||||
rzAbnormalDetail.setDelFlag("0");
|
||||
rzAbnormalDetailMapper.insertRzAbnormalDetail(rzAbnormalDetail);
|
||||
//反写汇总
|
||||
rzAbnormal.setNumber(rzAbnormal.getNumber() + 1);
|
||||
rzAbnormalMapper.updateRzAbnormal(rzAbnormal);
|
||||
//反写统计
|
||||
RzAttendanceStatistical attendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzAttendance.getStaffId(),rzAttendance.getAttendanceDate());
|
||||
attendanceStatistical.setLateNumber(attendanceStatistical.getLateNumber() + 1);
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(attendanceStatistical);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤异常详情
|
||||
*
|
||||
* @param rzAbnormalDetail 考勤异常详情
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRzAbnormalDetail(RzAbnormalDetail rzAbnormalDetail)
|
||||
{
|
||||
rzAbnormalDetail.setUpdateTime(DateUtils.getNowDate());
|
||||
rzAbnormalDetail.setUpdateBy(SecurityUtils.getUsername());
|
||||
return rzAbnormalDetailMapper.updateRzAbnormalDetail(rzAbnormalDetail);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除考勤异常详情信息
|
||||
*
|
||||
* @param id 考勤异常详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRzAbnormalDetailById(Long id)
|
||||
{
|
||||
RzAbnormalDetail rzAbnormalDetail = rzAbnormalDetailMapper.selectRzAbnormalDetailById(id);
|
||||
rzAbnormalDetail.setUpdateTime(DateUtils.getNowDate());
|
||||
rzAbnormalDetail.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzAbnormalDetail.setDelFlag("1");
|
||||
return rzAbnormalDetailMapper.updateRzAbnormalDetail(rzAbnormalDetail);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
import com.evo.attendance.mapper.RzAbnormalDetailMapper;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.evo.attendance.mapper.RzAbnormalMapper;
|
||||
import com.evo.attendance.domain.RzAbnormal;
|
||||
import com.evo.attendance.service.IRzAbnormalService;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 考勤异常Service业务层处理
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-10
|
||||
*/
|
||||
@Service
|
||||
public class RzAbnormalServiceImpl implements IRzAbnormalService
|
||||
{
|
||||
@Resource
|
||||
private RzAbnormalMapper rzAbnormalMapper;
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper; //部门
|
||||
@Resource
|
||||
private RzAbnormalDetailMapper rzAbnormalDetailMapper; //异常详情
|
||||
|
||||
/**
|
||||
* 查询考勤异常
|
||||
*
|
||||
* @param id 考勤异常主键
|
||||
* @return 考勤异常
|
||||
*/
|
||||
@Override
|
||||
public RzAbnormal selectRzAbnormalById(Long id)
|
||||
{
|
||||
return rzAbnormalMapper.selectRzAbnormalById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考勤异常列表
|
||||
*
|
||||
* @param rzAbnormal 考勤异常
|
||||
* @return 考勤异常
|
||||
*/
|
||||
@Override
|
||||
public List<RzAbnormal> selectRzAbnormalList(RzAbnormal rzAbnormal)
|
||||
{
|
||||
List<RzAbnormal> res = rzAbnormalMapper.selectRzAbnormalList(rzAbnormal);
|
||||
for (RzAbnormal re : res) {
|
||||
re.setDeptName(deptMapper.selectDeptById(re.getDeptId()).getDeptName());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤异常
|
||||
*
|
||||
* @param rzAbnormal 考勤异常
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRzAbnormal(RzAbnormal rzAbnormal)
|
||||
{
|
||||
rzAbnormal.setUpdateTime(DateUtils.getNowDate());
|
||||
rzAbnormal.setUpdateBy(SecurityUtils.getUsername());
|
||||
return rzAbnormalMapper.updateRzAbnormal(rzAbnormal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除考勤异常信息
|
||||
*
|
||||
* @param id 考勤异常主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRzAbnormalById(Long id)
|
||||
{
|
||||
RzAbnormal rzAbnormal = rzAbnormalMapper.selectRzAbnormalById(id);
|
||||
rzAbnormal.setUpdateTime(DateUtils.getNowDate());
|
||||
rzAbnormal.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzAbnormal.setDelFlag("1");
|
||||
return rzAbnormalMapper.updateRzAbnormal(rzAbnormal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常详情
|
||||
* @param rzAbnormal
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RzAbnormalDetail> listAbnormalDetails(RzAbnormal rzAbnormal){
|
||||
List<RzAbnormalDetail> res_list = new ArrayList<RzAbnormalDetail>();
|
||||
RzAbnormal abnormal = rzAbnormalMapper.selectRzAbnormalByUserId(rzAbnormal.getUserId(),rzAbnormal.getMonth());
|
||||
if(abnormal == null){
|
||||
return res_list;
|
||||
}
|
||||
res_list = rzAbnormalDetailMapper.selectRzAbnormalDetailByAbnormalId(abnormal.getId());
|
||||
return res_list;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,192 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.evo.attendance.service.IRzAttendanceService;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤记录Service业务层处理
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
@Service
|
||||
public class RzAttendanceServiceImpl implements IRzAttendanceService
|
||||
{
|
||||
@Resource
|
||||
private RzAttendanceMapper rzAttendanceMapper;
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper; //部门
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper; //考勤汇总
|
||||
|
||||
/**
|
||||
* 查询考勤记录
|
||||
*
|
||||
* @param id 考勤记录主键
|
||||
* @return 考勤记录
|
||||
*/
|
||||
@Override
|
||||
public RzAttendance selectRzAttendanceById(Long id)
|
||||
{
|
||||
return rzAttendanceMapper.selectRzAttendanceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考勤记录列表
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 考勤记录
|
||||
*/
|
||||
@DataScope(deptAlias = "d")
|
||||
@Override
|
||||
public List<RzAttendance> selectRzAttendanceList(RzAttendance rzAttendance)
|
||||
{
|
||||
List<RzAttendance> res_list = rzAttendanceMapper.selectRzAttendanceList(rzAttendance);
|
||||
for (RzAttendance attendance : res_list) {
|
||||
SysDept sysDept = deptMapper.selectDeptById(attendance.getDeptId());
|
||||
attendance.setDeptName(sysDept.getDeptName());
|
||||
if(attendance.getAttendanceDate().before(new Date())){
|
||||
if(attendance.getWorkStartTime() == null && attendance.getWorkEndTime() == null){
|
||||
attendance.setYcsFlag("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
return res_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改考勤记录
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRzAttendance(RzAttendance rzAttendance)
|
||||
{
|
||||
//判断考勤时间
|
||||
Long sj = (rzAttendance.getWorkEndTime().getTime() - rzAttendance.getWorkStartTime().getTime())/1000/60/60;
|
||||
if(sj >= 8){
|
||||
rzAttendance.setWorkSum(new BigDecimal(8));
|
||||
}else if(sj >= 4){
|
||||
rzAttendance.setWorkSum(new BigDecimal(4));
|
||||
}
|
||||
rzAttendance.setYcsFlag("0");
|
||||
rzAttendance.setYcxFlag("0");
|
||||
rzAttendance.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzAttendance.setUpdateTime(DateUtils.getNowDate());
|
||||
return rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
}
|
||||
|
||||
/**
|
||||
* 每日上班打卡统计
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int attendenceCount(){
|
||||
List<RzAttendance> list = rzAttendanceMapper.attendenceCount();
|
||||
return list.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改考勤记录
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateBatchAttendance(RzAttendance rzAttendance){
|
||||
if(StringUtils.isNull(rzAttendance.getAttendanceDate())){
|
||||
return AjaxResult.error("请选择批量修改的时间!!");
|
||||
}
|
||||
//根据时间查询打卡信息
|
||||
List<RzAttendance> list = rzAttendanceMapper.selectRzAttendanceList(rzAttendance);
|
||||
//获取当天12点的时间和8:30的时间
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date mid_date = null;
|
||||
Date pre_date = null;
|
||||
try{
|
||||
String str_pre = sdfd.format(rzAttendance.getAttendanceDate()) + " 08:30:00";
|
||||
pre_date = sdft.parse(str_pre);
|
||||
String str_mid = sdfd.format(rzAttendance.getAttendanceDate()) + " 12:00:00";
|
||||
mid_date = sdft.parse(str_mid);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
//循环判断打卡时间,修改打卡时间
|
||||
for (RzAttendance attendance : list) {
|
||||
//判断上班打卡时间存在,且小于12点并且大于早上8:30
|
||||
if(attendance.getWorkStartTime() != null && attendance.getWorkStartTime().before(mid_date) && attendance.getWorkStartTime().after(pre_date)){
|
||||
//判断没有打卡下班卡
|
||||
if(attendance.getWorkEndTime() == null){
|
||||
attendance.setWorkStartTime(pre_date);
|
||||
attendance.setYcsFlag("0");
|
||||
rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
continue;
|
||||
}
|
||||
BigDecimal old = attendance.getWorkSum();
|
||||
//计算上班的时间
|
||||
Long fz = (attendance.getWorkEndTime().getTime() - attendance.getWorkStartTime().getTime())/1000/60;
|
||||
Double xs = fz/60.0;
|
||||
BigDecimal res = new BigDecimal("0.0");
|
||||
//单班制
|
||||
if("上班卡(单班制)".equals(attendance.getRules())){
|
||||
if(xs > 9){
|
||||
res = new BigDecimal("8.0");
|
||||
}else if(xs > 4.5){
|
||||
res = BigDecimal.valueOf(xs - 1);
|
||||
}else if(xs > 1){
|
||||
res = BigDecimal.valueOf(xs);
|
||||
}
|
||||
}else if("上班卡(双班制)".equals(attendance.getRules())){
|
||||
if(xs > 8.5){
|
||||
res = new BigDecimal("8.0");
|
||||
}else if(xs > 1){
|
||||
res = BigDecimal.valueOf(xs);
|
||||
}
|
||||
}else{
|
||||
if(xs > 12){
|
||||
res = new BigDecimal("11.0");
|
||||
}else if(xs <= 1){
|
||||
res = new BigDecimal("0.0");
|
||||
}else{
|
||||
res = BigDecimal.valueOf(xs - 1);
|
||||
}
|
||||
}
|
||||
attendance.setWorkStartTime(pre_date);
|
||||
attendance.setYcsFlag("0");
|
||||
attendance.setWorkSum(res);
|
||||
int i = rzAttendanceMapper.updateRzAttendance(attendance);
|
||||
if(i < 1){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 查询考勤记录列表
|
||||
*
|
||||
* @param rzAttendance 考勤记录
|
||||
* @return 考勤记录集合
|
||||
*/
|
||||
public List<RzAttendance> listAttendanceByParams(RzAttendance rzAttendance){
|
||||
return rzAttendanceMapper.listAttendanceByParams(rzAttendance);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,136 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.evo.attendance.service.IRzAttendanceStatisticalService;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.personnelMatters.domain.RzOverTime;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeMapper;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考勤统计Service业务层处理
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
@Service
|
||||
public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisticalService
|
||||
{
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper;
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper; //部门
|
||||
@Resource
|
||||
private RzAttendanceMapper rzAttendanceMapper; //打卡记录
|
||||
@Resource
|
||||
private RzOverTimeMapper rzOverTimeMapper;
|
||||
/**
|
||||
* 查询考勤统计
|
||||
*
|
||||
* @param id 考勤统计主键
|
||||
* @return 考勤统计
|
||||
*/
|
||||
@Override
|
||||
public RzAttendanceStatistical selectRzAttendanceStatisticalById(Long id)
|
||||
{
|
||||
return rzAttendanceStatisticalMapper.selectRzAttendanceStatisticalById(id);
|
||||
}
|
||||
/**
|
||||
* 查询考勤统计列表
|
||||
*
|
||||
* @param rzAttendanceStatistical 考勤统计
|
||||
* @return 考勤统计
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<RzAttendanceStatistical> selectRzAttendanceStatisticalList(RzAttendanceStatistical rzAttendanceStatistical)
|
||||
{
|
||||
List<RzAttendanceStatistical> res_list = rzAttendanceStatisticalMapper.selectRzAttendanceStatisticalList(rzAttendanceStatistical);
|
||||
for (RzAttendanceStatistical attendanceStatistical : res_list) {
|
||||
SysDept sysDept = deptMapper.selectDeptById(attendanceStatistical.getDeptId());
|
||||
attendanceStatistical.setDeptName(sysDept.getDeptName());
|
||||
}
|
||||
return res_list;
|
||||
}
|
||||
/**
|
||||
* 修改考勤统计
|
||||
*
|
||||
* @param rzAttendanceStatistical 考勤统计
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRzAttendanceStatistical(RzAttendanceStatistical rzAttendanceStatistical)
|
||||
{
|
||||
rzAttendanceStatistical.setRealAttendance(rzAttendanceStatistical.getEssentialAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber()));
|
||||
rzAttendanceStatistical.setUpdateTime(DateUtils.getNowDate());
|
||||
rzAttendanceStatistical.setUpdateBy(SecurityUtils.getUsername());
|
||||
return rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校正数据
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult correct(RzAttendanceStatistical rzAttendanceStatistical) {
|
||||
if (StringUtils.isNull(rzAttendanceStatistical) || StringUtils.isNull(rzAttendanceStatistical.getMonth())) {
|
||||
return AjaxResult.error("请输入校正日期!!");
|
||||
}
|
||||
//查询条件月统计的数据
|
||||
List<RzAttendanceStatistical> ms_list = rzAttendanceStatisticalMapper.queryStatisticalByMonth(rzAttendanceStatistical.getMonth());
|
||||
//计算打卡汇总表
|
||||
for (RzAttendanceStatistical attendanceStatistical : ms_list) {
|
||||
//初始化打卡记录
|
||||
attendanceStatistical.setEssentialAttendance(new BigDecimal("0.0"));
|
||||
attendanceStatistical.setWorkOvertimeNumber(new BigDecimal("0.0"));
|
||||
attendanceStatistical.setMiddleShiftNumber(0l);
|
||||
attendanceStatistical.setNightNumber(0l);
|
||||
//查询打卡记录
|
||||
RzAttendance rzAttendance = new RzAttendance();
|
||||
rzAttendance.setAttendanceDate(rzAttendanceStatistical.getMonth());
|
||||
rzAttendance.setStaffId(attendanceStatistical.getStaffId());
|
||||
List<RzAttendance> at_list = rzAttendanceMapper.listAttendanceByParams(rzAttendance);
|
||||
for (RzAttendance attendance : at_list) {
|
||||
attendanceStatistical.setEssentialAttendance(attendanceStatistical.getEssentialAttendance().add(attendance.getWorkSum()));
|
||||
attendanceStatistical.setMiddleShiftNumber(attendanceStatistical.getMiddleShiftNumber() + attendance.getMiddleShiftNumber());
|
||||
attendanceStatistical.setNightNumber(attendanceStatistical.getNightNumber() + attendance.getNightNumber());
|
||||
}
|
||||
//获取加班数据
|
||||
RzOverTime rzOverTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(attendanceStatistical.getStaffId(),rzAttendanceStatistical.getMonth());
|
||||
if(StringUtils.isNotNull(rzOverTime)){
|
||||
attendanceStatistical.setWorkOvertimeNumber(rzOverTime.getOverHours());
|
||||
}
|
||||
attendanceStatistical.setRealAttendance(attendanceStatistical.getEssentialAttendance().add(attendanceStatistical.getWorkOvertimeNumber()));
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(attendanceStatistical) ;
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入考勤统计
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult importRzAttendanceStatistical(List<RzAttendanceStatistical> list){
|
||||
if(list == null || list.size() == 0){
|
||||
return AjaxResult.error("导入数据为空!!");
|
||||
}
|
||||
for (RzAttendanceStatistical rzAttendanceStatistical : list) {
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
}
|
||||
return AjaxResult.success("导入数据成功!!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.domain.RzSpecialAttendance;
|
||||
import com.evo.attendance.domain.RzSpecialOverTime;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.evo.attendance.mapper.RzSpecialAttendanceMapper;
|
||||
import com.evo.attendance.mapper.RzSpecialOverTimeMapper;
|
||||
import com.evo.attendance.service.IRzSpecialAttendanceService;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 加班考勤记录Service业务层处理
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@Service
|
||||
public class RzSpecialAttendanceServiceImpl implements IRzSpecialAttendanceService
|
||||
{
|
||||
@Resource
|
||||
private RzSpecialAttendanceMapper rzSpecialAttendanceMapper;
|
||||
@Resource
|
||||
private RzSpecialOverTimeMapper rzSpecialOverTimeMapper;
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper;
|
||||
/**
|
||||
* 查询加班考勤记录
|
||||
*
|
||||
* @param id 加班考勤记录主键
|
||||
* @return 加班考勤记录
|
||||
*/
|
||||
@Override
|
||||
public RzSpecialAttendance selectRzSpecialAttendanceById(Long id)
|
||||
{
|
||||
return rzSpecialAttendanceMapper.selectRzSpecialAttendanceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询加班考勤记录列表
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 加班考勤记录
|
||||
*/
|
||||
@Override
|
||||
public List<RzSpecialAttendance> selectRzSpecialAttendanceList(RzSpecialAttendance rzSpecialAttendance)
|
||||
{
|
||||
return rzSpecialAttendanceMapper.selectRzSpecialAttendanceList(rzSpecialAttendance);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增加班考勤记录
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRzSpecialAttendance(RzSpecialAttendance rzSpecialAttendance)
|
||||
{
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try{
|
||||
rzSpecialAttendance.setAttendanceDate(sdf.parse(sdf.format(rzSpecialAttendance.getWorkStartTime())));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
rzSpecialAttendance.setCreateTime(new Date());
|
||||
rzSpecialAttendance.setCreateBy(SecurityUtils.getUsername());
|
||||
rzSpecialAttendance.setDelFlag("0");
|
||||
rzSpecialAttendance.setCreateTime(DateUtils.getNowDate());
|
||||
rzSpecialAttendanceMapper.insertRzSpecialAttendance(rzSpecialAttendance);
|
||||
|
||||
RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
rzSpecialOverTime.setSickHours(rzSpecialOverTime.getSickHours().add(rzSpecialAttendance.getWorkHours()));
|
||||
rzSpecialOverTimeMapper.updateRzSpecialOverTime(rzSpecialOverTime);
|
||||
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
rzAttendanceStatistical.setOverTimeHours(rzAttendanceStatistical.getOverTimeHours().add(rzSpecialAttendance.getWorkHours()));
|
||||
return rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改加班考勤记录
|
||||
*
|
||||
* @param rzSpecialAttendance 加班考勤记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRzSpecialAttendance(RzSpecialAttendance rzSpecialAttendance)
|
||||
{
|
||||
RzSpecialAttendance old = rzSpecialAttendanceMapper.selectRzSpecialAttendanceById(rzSpecialAttendance.getId());
|
||||
rzSpecialAttendance.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzSpecialAttendance.setUpdateTime(DateUtils.getNowDate());
|
||||
rzSpecialAttendanceMapper.updateRzSpecialAttendance(rzSpecialAttendance);
|
||||
|
||||
RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
rzSpecialOverTime.setSickHours(rzSpecialOverTime.getSickHours().add(rzSpecialAttendance.getWorkHours()).subtract(old.getWorkHours()));
|
||||
rzSpecialOverTimeMapper.updateRzSpecialOverTime(rzSpecialOverTime);
|
||||
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
rzAttendanceStatistical.setOverTimeHours(rzAttendanceStatistical.getOverTimeHours().add(rzSpecialAttendance.getWorkHours()).subtract(old.getWorkHours()));
|
||||
return rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除加班考勤记录信息
|
||||
*
|
||||
* @param id 加班考勤记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRzSpecialAttendanceById(Long id)
|
||||
{
|
||||
RzSpecialAttendance rzSpecialAttendance = rzSpecialAttendanceMapper.selectRzSpecialAttendanceById(id);
|
||||
rzSpecialAttendance.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzSpecialAttendance.setUpdateTime(DateUtils.getNowDate());
|
||||
rzSpecialAttendance.setDelFlag("1");
|
||||
rzSpecialAttendanceMapper.updateRzSpecialAttendance(rzSpecialAttendance);
|
||||
|
||||
RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
rzSpecialOverTime.setSickHours(rzSpecialOverTime.getSickHours().subtract(rzSpecialAttendance.getWorkHours()));
|
||||
rzSpecialOverTimeMapper.updateRzSpecialOverTime(rzSpecialOverTime);
|
||||
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzSpecialAttendance.getStaffId(),rzSpecialAttendance.getAttendanceDate());
|
||||
rzAttendanceStatistical.setOverTimeHours(rzAttendanceStatistical.getOverTimeHours().subtract(rzSpecialAttendance.getWorkHours()));
|
||||
return rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzSpecialOverTime;
|
||||
import com.evo.attendance.mapper.RzSpecialOverTimeMapper;
|
||||
import com.evo.attendance.service.IRzSpecialOverTimeService;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 特殊加班管理Service业务层处理
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-04-16
|
||||
*/
|
||||
@Service
|
||||
public class RzSpecialOverTimeServiceImpl implements IRzSpecialOverTimeService
|
||||
{
|
||||
@Resource
|
||||
private RzSpecialOverTimeMapper rzSpecialOverTimeMapper;
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper;
|
||||
|
||||
/**
|
||||
* 查询特殊加班管理
|
||||
*
|
||||
* @param id 特殊加班管理主键
|
||||
* @return 特殊加班管理
|
||||
*/
|
||||
@Override
|
||||
public RzSpecialOverTime selectRzSpecialOverTimeById(Long id)
|
||||
{
|
||||
return rzSpecialOverTimeMapper.selectRzSpecialOverTimeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询特殊加班管理列表
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 特殊加班管理
|
||||
*/
|
||||
@Override
|
||||
public List<RzSpecialOverTime> selectRzSpecialOverTimeList(RzSpecialOverTime rzSpecialOverTime)
|
||||
{
|
||||
List<RzSpecialOverTime> reslut = rzSpecialOverTimeMapper.selectRzSpecialOverTimeList(rzSpecialOverTime);
|
||||
for (RzSpecialOverTime specialOverTime : reslut) {
|
||||
specialOverTime.setDeptName(deptMapper.selectDeptById(specialOverTime.getDeptId()).getDeptName());
|
||||
}
|
||||
return reslut;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增特殊加班管理
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRzSpecialOverTime(RzSpecialOverTime rzSpecialOverTime)
|
||||
{
|
||||
//根据用户ID查询用户名称
|
||||
|
||||
rzSpecialOverTime.setCreateTime(new Date());
|
||||
rzSpecialOverTime.setCreateBy(SecurityUtils.getUsername());
|
||||
rzSpecialOverTime.setDelFlag("0");
|
||||
rzSpecialOverTime.setCreateTime(DateUtils.getNowDate());
|
||||
return rzSpecialOverTimeMapper.insertRzSpecialOverTime(rzSpecialOverTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改特殊加班管理
|
||||
*
|
||||
* @param rzSpecialOverTime 特殊加班管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRzSpecialOverTime(RzSpecialOverTime rzSpecialOverTime)
|
||||
{
|
||||
rzSpecialOverTime.setUpdateTime(new Date());
|
||||
rzSpecialOverTime.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzSpecialOverTime.setUpdateTime(DateUtils.getNowDate());
|
||||
return rzSpecialOverTimeMapper.updateRzSpecialOverTime(rzSpecialOverTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除特殊加班管理信息
|
||||
*
|
||||
* @param id 特殊加班管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRzSpecialOverTimeById(Long id)
|
||||
{
|
||||
RzSpecialOverTime rzSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeById(id);
|
||||
rzSpecialOverTime.setDelFlag("1");
|
||||
rzSpecialOverTime.setUpdateTime(new Date());
|
||||
rzSpecialOverTime.setUpdateBy(SecurityUtils.getUsername());
|
||||
return rzSpecialOverTimeMapper.updateRzSpecialOverTime(rzSpecialOverTime);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 匿名访问不鉴权注解
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Anonymous
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 数据权限过滤注解
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataScope
|
||||
{
|
||||
/**
|
||||
* 部门表的别名
|
||||
*/
|
||||
public String deptAlias() default "";
|
||||
|
||||
/**
|
||||
* 用户表的别名
|
||||
*/
|
||||
public String userAlias() default "";
|
||||
|
||||
/**
|
||||
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
|
||||
*/
|
||||
public String permission() default "";
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import com.evo.common.enums.DataSourceType;
|
||||
|
||||
/**
|
||||
* 自定义多数据源切换注解
|
||||
*
|
||||
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
public @interface DataSource
|
||||
{
|
||||
/**
|
||||
* 切换数据源名称
|
||||
*/
|
||||
public DataSourceType value() default DataSourceType.MASTER;
|
||||
}
|
||||
192
evo-admin/src/main/java/com/evo/common/annotation/Excel.java
Normal file
192
evo-admin/src/main/java/com/evo/common/annotation/Excel.java
Normal file
@ -0,0 +1,192 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import com.evo.common.utils.poi.ExcelHandlerAdapter;
|
||||
|
||||
/**
|
||||
* 自定义导出Excel数据注解
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Excel
|
||||
{
|
||||
/**
|
||||
* 导出时在excel中排序
|
||||
*/
|
||||
public int sort() default Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 导出到Excel中的名字.
|
||||
*/
|
||||
public String name() default "";
|
||||
|
||||
/**
|
||||
* 日期格式, 如: yyyy-MM-dd
|
||||
*/
|
||||
public String dateFormat() default "";
|
||||
|
||||
/**
|
||||
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
|
||||
*/
|
||||
public String dictType() default "";
|
||||
|
||||
/**
|
||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||
*/
|
||||
public String readConverterExp() default "";
|
||||
|
||||
/**
|
||||
* 分隔符,读取字符串组内容
|
||||
*/
|
||||
public String separator() default ",";
|
||||
|
||||
/**
|
||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||
*/
|
||||
public int scale() default -1;
|
||||
|
||||
/**
|
||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||
*/
|
||||
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的高度
|
||||
*/
|
||||
public double height() default 14;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的宽度
|
||||
*/
|
||||
public double width() default 16;
|
||||
|
||||
/**
|
||||
* 文字后缀,如% 90 变成90%
|
||||
*/
|
||||
public String suffix() default "";
|
||||
|
||||
/**
|
||||
* 当值为空时,字段的默认值
|
||||
*/
|
||||
public String defaultValue() default "";
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
public String prompt() default "";
|
||||
|
||||
/**
|
||||
* 设置只能选择不能输入的列内容.
|
||||
*/
|
||||
public String[] combo() default {};
|
||||
|
||||
/**
|
||||
* 是否从字典读数据到combo,默认不读取,如读取需要设置dictType注解.
|
||||
*/
|
||||
public boolean comboReadDict() default false;
|
||||
|
||||
/**
|
||||
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||
*/
|
||||
public boolean needMerge() default false;
|
||||
|
||||
/**
|
||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||
*/
|
||||
public boolean isExport() default true;
|
||||
|
||||
/**
|
||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||
*/
|
||||
public String targetAttr() default "";
|
||||
|
||||
/**
|
||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||
*/
|
||||
public boolean isStatistics() default false;
|
||||
|
||||
/**
|
||||
* 导出类型(0数字 1字符串 2图片)
|
||||
*/
|
||||
public ColumnType cellType() default ColumnType.STRING;
|
||||
|
||||
/**
|
||||
* 导出列头背景颜色
|
||||
*/
|
||||
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||
|
||||
/**
|
||||
* 导出列头字体颜色
|
||||
*/
|
||||
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格背景颜色
|
||||
*/
|
||||
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格字体颜色
|
||||
*/
|
||||
public IndexedColors color() default IndexedColors.BLACK;
|
||||
|
||||
/**
|
||||
* 导出字段对齐方式
|
||||
*/
|
||||
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器参数
|
||||
*/
|
||||
public String[] args() default {};
|
||||
|
||||
/**
|
||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||
*/
|
||||
Type type() default Type.ALL;
|
||||
|
||||
public enum Type
|
||||
{
|
||||
ALL(0), EXPORT(1), IMPORT(2);
|
||||
private final int value;
|
||||
|
||||
Type(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ColumnType
|
||||
{
|
||||
NUMERIC(0), STRING(1), IMAGE(2), TEXT(3);
|
||||
private final int value;
|
||||
|
||||
ColumnType(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Excel注解集
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Excels
|
||||
{
|
||||
public Excel[] value();
|
||||
}
|
||||
51
evo-admin/src/main/java/com/evo/common/annotation/Log.java
Normal file
51
evo-admin/src/main/java/com/evo/common/annotation/Log.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.enums.OperatorType;
|
||||
|
||||
/**
|
||||
* 自定义操作日志记录注解
|
||||
*
|
||||
* @author evo
|
||||
*
|
||||
*/
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Log
|
||||
{
|
||||
/**
|
||||
* 模块
|
||||
*/
|
||||
public String title() default "";
|
||||
|
||||
/**
|
||||
* 功能
|
||||
*/
|
||||
public BusinessType businessType() default BusinessType.OTHER;
|
||||
|
||||
/**
|
||||
* 操作人类别
|
||||
*/
|
||||
public OperatorType operatorType() default OperatorType.MANAGE;
|
||||
|
||||
/**
|
||||
* 是否保存请求的参数
|
||||
*/
|
||||
public boolean isSaveRequestData() default true;
|
||||
|
||||
/**
|
||||
* 是否保存响应的参数
|
||||
*/
|
||||
public boolean isSaveResponseData() default true;
|
||||
|
||||
/**
|
||||
* 排除指定的请求参数
|
||||
*/
|
||||
public String[] excludeParamNames() default {};
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import com.evo.common.constant.CacheConstants;
|
||||
import com.evo.common.enums.LimitType;
|
||||
|
||||
/**
|
||||
* 限流注解
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface RateLimiter
|
||||
{
|
||||
/**
|
||||
* 限流key
|
||||
*/
|
||||
public String key() default CacheConstants.RATE_LIMIT_KEY;
|
||||
|
||||
/**
|
||||
* 限流时间,单位秒
|
||||
*/
|
||||
public int time() default 60;
|
||||
|
||||
/**
|
||||
* 限流次数
|
||||
*/
|
||||
public int count() default 100;
|
||||
|
||||
/**
|
||||
* 限流类型
|
||||
*/
|
||||
public LimitType limitType() default LimitType.DEFAULT;
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 自定义注解防止表单重复提交
|
||||
*
|
||||
* @author evo
|
||||
*
|
||||
*/
|
||||
@Inherited
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface RepeatSubmit
|
||||
{
|
||||
/**
|
||||
* 间隔时间(ms),小于此时间视为重复提交
|
||||
*/
|
||||
public int interval() default 5000;
|
||||
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
public String message() default "不允许重复提交,请稍候再试";
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.evo.common.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.evo.common.config.serializer.SensitiveJsonSerializer;
|
||||
import com.evo.common.enums.DesensitizedType;
|
||||
|
||||
/**
|
||||
* 数据脱敏注解
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@JacksonAnnotationsInside
|
||||
@JsonSerialize(using = SensitiveJsonSerializer.class)
|
||||
public @interface Sensitive
|
||||
{
|
||||
DesensitizedType desensitizedType();
|
||||
}
|
||||
111
evo-admin/src/main/java/com/evo/common/config/EvoConfig.java
Normal file
111
evo-admin/src/main/java/com/evo/common/config/EvoConfig.java
Normal file
@ -0,0 +1,111 @@
|
||||
package com.evo.common.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 读取项目相关配置
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "evo")
|
||||
public class EvoConfig
|
||||
{
|
||||
/** 项目名称 */
|
||||
private String name;
|
||||
|
||||
/** 版本 */
|
||||
private String version;
|
||||
|
||||
/** 版权年份 */
|
||||
private String copyrightYear;
|
||||
|
||||
/** 上传路径 */
|
||||
private static String profile;
|
||||
|
||||
/** 获取地址开关 */
|
||||
private static boolean addressEnabled;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getCopyrightYear()
|
||||
{
|
||||
return copyrightYear;
|
||||
}
|
||||
|
||||
public void setCopyrightYear(String copyrightYear)
|
||||
{
|
||||
this.copyrightYear = copyrightYear;
|
||||
}
|
||||
|
||||
public static String getProfile()
|
||||
{
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(String profile)
|
||||
{
|
||||
EvoConfig.profile = profile;
|
||||
}
|
||||
|
||||
public static boolean isAddressEnabled()
|
||||
{
|
||||
return addressEnabled;
|
||||
}
|
||||
|
||||
public void setAddressEnabled(boolean addressEnabled)
|
||||
{
|
||||
EvoConfig.addressEnabled = addressEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导入上传路径
|
||||
*/
|
||||
public static String getImportPath()
|
||||
{
|
||||
return getProfile() + "/import";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取头像上传路径
|
||||
*/
|
||||
public static String getAvatarPath()
|
||||
{
|
||||
return getProfile() + "/avatar";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载路径
|
||||
*/
|
||||
public static String getDownloadPath()
|
||||
{
|
||||
return getProfile() + "/download/";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传路径
|
||||
*/
|
||||
public static String getUploadPath()
|
||||
{
|
||||
return getProfile() + "/upload";
|
||||
}
|
||||
}
|
||||
124
evo-admin/src/main/java/com/evo/common/config/SwaggerConfig.java
Normal file
124
evo-admin/src/main/java/com/evo/common/config/SwaggerConfig.java
Normal file
@ -0,0 +1,124 @@
|
||||
package com.evo.common.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.ApiKey;
|
||||
import springfox.documentation.service.AuthorizationScope;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.SecurityReference;
|
||||
import springfox.documentation.service.SecurityScheme;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Configuration
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private EvoConfig EvoConfig;
|
||||
|
||||
/** 是否开启swagger */
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/** 设置请求的统一前缀 */
|
||||
@Value("${swagger.pathMapping}")
|
||||
private String pathMapping;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||
.apiInfo(apiInfo())
|
||||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.evo.project.tool.swagger"))
|
||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts())
|
||||
.pathMapping(pathMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<SecurityScheme> securitySchemes()
|
||||
{
|
||||
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全上下文
|
||||
*/
|
||||
private List<SecurityContext> securityContexts()
|
||||
{
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||
.build());
|
||||
return securityContexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认的安全上引用
|
||||
*/
|
||||
private List<SecurityReference> defaultAuth()
|
||||
{
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
private ApiInfo apiInfo()
|
||||
{
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:伊特管理系统_接口文档")
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
// 作者信息
|
||||
.contact(new Contact(EvoConfig.getName(), null, null))
|
||||
// 版本
|
||||
.version("版本号:" + EvoConfig.getVersion())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.evo.common.config.serializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.BeanProperty;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
|
||||
import com.evo.common.annotation.Sensitive;
|
||||
import com.evo.common.core.domain.model.LoginUser;
|
||||
import com.evo.common.enums.DesensitizedType;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
|
||||
/**
|
||||
* 数据脱敏序列化过滤
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class SensitiveJsonSerializer extends JsonSerializer<String> implements ContextualSerializer
|
||||
{
|
||||
private DesensitizedType desensitizedType;
|
||||
|
||||
@Override
|
||||
public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException
|
||||
{
|
||||
if (desensitization())
|
||||
{
|
||||
gen.writeString(desensitizedType.desensitizer().apply(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
gen.writeString(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property)
|
||||
throws JsonMappingException
|
||||
{
|
||||
Sensitive annotation = property.getAnnotation(Sensitive.class);
|
||||
if (Objects.nonNull(annotation) && Objects.equals(String.class, property.getType().getRawClass()))
|
||||
{
|
||||
this.desensitizedType = annotation.desensitizedType();
|
||||
return this;
|
||||
}
|
||||
return prov.findValueSerializer(property.getType(), property);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要脱敏处理
|
||||
*/
|
||||
private boolean desensitization()
|
||||
{
|
||||
try
|
||||
{
|
||||
LoginUser securityUser = SecurityUtils.getLoginUser();
|
||||
// 管理员不脱敏
|
||||
return !securityUser.getUser().isAdmin();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.evo.common.constant;
|
||||
|
||||
/**
|
||||
* 缓存的key 常量
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class CacheConstants
|
||||
{
|
||||
/**
|
||||
* 登录用户 redis key
|
||||
*/
|
||||
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||
|
||||
/**
|
||||
* 验证码 redis key
|
||||
*/
|
||||
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
|
||||
|
||||
/**
|
||||
* 参数管理 cache key
|
||||
*/
|
||||
public static final String SYS_CONFIG_KEY = "sys_config:";
|
||||
|
||||
/**
|
||||
* 字典管理 cache key
|
||||
*/
|
||||
public static final String SYS_DICT_KEY = "sys_dict:";
|
||||
|
||||
/**
|
||||
* 防重提交 redis key
|
||||
*/
|
||||
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
|
||||
|
||||
/**
|
||||
* 限流 redis key
|
||||
*/
|
||||
public static final String RATE_LIMIT_KEY = "rate_limit:";
|
||||
|
||||
/**
|
||||
* 登录账户密码错误次数 redis key
|
||||
*/
|
||||
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
||||
}
|
||||
120
evo-admin/src/main/java/com/evo/common/constant/Constants.java
Normal file
120
evo-admin/src/main/java/com/evo/common/constant/Constants.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.evo.common.constant;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Locale;
|
||||
import io.jsonwebtoken.Claims;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class Constants
|
||||
{
|
||||
/**
|
||||
* UTF-8 字符集
|
||||
*/
|
||||
public static final String UTF8 = "UTF-8";
|
||||
/**
|
||||
* GBK 字符集
|
||||
*/
|
||||
public static final String GBK = "GBK";
|
||||
/**
|
||||
* 系统语言
|
||||
*/
|
||||
public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE;
|
||||
/**
|
||||
* www主域
|
||||
*/
|
||||
public static final String WWW = "www.";
|
||||
/**
|
||||
* http请求
|
||||
*/
|
||||
public static final String HTTP = "http://";
|
||||
/**
|
||||
* https请求
|
||||
*/
|
||||
public static final String HTTPS = "https://";
|
||||
/**
|
||||
* 通用成功标识
|
||||
*/
|
||||
public static final String SUCCESS = "0";
|
||||
/**
|
||||
* 通用失败标识
|
||||
*/
|
||||
public static final String FAIL = "1";
|
||||
/**
|
||||
* 登录成功
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS = "Success";
|
||||
/**
|
||||
* 注销
|
||||
*/
|
||||
public static final String LOGOUT = "Logout";
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public static final String REGISTER = "Register";
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
public static final String LOGIN_FAIL = "Error";
|
||||
/**
|
||||
* 所有权限标识
|
||||
*/
|
||||
public static final String ALL_PERMISSION = "*:*:*";
|
||||
/**
|
||||
* 管理员角色权限标识
|
||||
*/
|
||||
public static final String SUPER_ADMIN = "admin";
|
||||
/**
|
||||
* 角色权限分隔符
|
||||
*/
|
||||
public static final String ROLE_DELIMETER = ",";
|
||||
/**
|
||||
* 权限标识分隔符
|
||||
*/
|
||||
public static final String PERMISSION_DELIMETER = ",";
|
||||
/**
|
||||
* 令牌
|
||||
*/
|
||||
public static final String TOKEN = "token";
|
||||
/**
|
||||
* 令牌前缀
|
||||
*/
|
||||
public static final String TOKEN_PREFIX = "Bearer ";
|
||||
/**
|
||||
* 令牌前缀
|
||||
*/
|
||||
public static final String LOGIN_USER_KEY = "login_user_key";
|
||||
/**
|
||||
* 资源映射路径 前缀
|
||||
*/
|
||||
public static final String RESOURCE_PREFIX = "/profile";
|
||||
/**
|
||||
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
|
||||
*/
|
||||
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.evo" };
|
||||
|
||||
/**
|
||||
* 业务参数
|
||||
*/
|
||||
public static final String DELETE_FLAG_0 = "0"; //添加信息
|
||||
public static final String DELETE_FLAG_1 = "1"; //删除信息
|
||||
public static final String JOB_STATIS_0 = "0"; //员工 试用
|
||||
public static final String SYS_COMPANY = "sys_company"; //公司简称
|
||||
public static final String SYS_CONTRACT = "sys_contract"; //合同年限
|
||||
public static final String SYS_LEVEL = "sys_level"; //学历
|
||||
public static final String SYS_WORK_STATUS = "sys_worker_status"; //在职状态
|
||||
public static final String SYS_RESTAUTANT = "sys_restaurant"; //餐饮字典类型参数
|
||||
public static final String SEIZE_A_SEAT_0 = "0"; //占位符
|
||||
public static final String SEIZE_A_SEAT_1 = "00"; //占位符
|
||||
public static final String SEIZE_A_SEAT_2 = "000"; //占位符
|
||||
public static final String SYS_SENIORITY_SUBSIDIES = "50"; //工龄补助
|
||||
public static final String SYS_CONTRACT_0 = "50"; //一年期合同补助
|
||||
public static final String SYS_CONTRACT_1 = "150"; //三年期合同补助
|
||||
public static final String SYS_SOCIAL_SUBSIDIES = "400"; //新农合社保补助
|
||||
public static final String SUBSIDY_PROPORTION = "0.05"; //请假补助扣除比例
|
||||
public static final String SUBSIDY_PERIOD = "0.80"; //试用期工资
|
||||
public static final String SUBSIDY_PERIOD_1 = "0.20"; //试用期工资的余百分比
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package com.evo.common.constant;
|
||||
|
||||
/**
|
||||
* 代码生成通用常量
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class GenConstants
|
||||
{
|
||||
/** 单表(增删改查) */
|
||||
public static final String TPL_CRUD = "crud";
|
||||
|
||||
/** 树表(增删改查) */
|
||||
public static final String TPL_TREE = "tree";
|
||||
|
||||
/** 主子表(增删改查) */
|
||||
public static final String TPL_SUB = "sub";
|
||||
|
||||
/** 树编码字段 */
|
||||
public static final String TREE_CODE = "treeCode";
|
||||
|
||||
/** 树父编码字段 */
|
||||
public static final String TREE_PARENT_CODE = "treeParentCode";
|
||||
|
||||
/** 树名称字段 */
|
||||
public static final String TREE_NAME = "treeName";
|
||||
|
||||
/** 上级菜单ID字段 */
|
||||
public static final String PARENT_MENU_ID = "parentMenuId";
|
||||
|
||||
/** 上级菜单名称字段 */
|
||||
public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||
|
||||
/** 数据库字符串类型 */
|
||||
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
||||
|
||||
/** 数据库文本类型 */
|
||||
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
|
||||
|
||||
/** 数据库时间类型 */
|
||||
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
|
||||
|
||||
/** 数据库数字类型 */
|
||||
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
|
||||
"bit", "bigint", "float", "double", "decimal" };
|
||||
|
||||
/** 页面不需要编辑字段 */
|
||||
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
|
||||
|
||||
/** 页面不需要显示的列表字段 */
|
||||
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time" };
|
||||
|
||||
/** 页面不需要查询字段 */
|
||||
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
|
||||
"update_time", "remark" };
|
||||
|
||||
/** Entity基类字段 */
|
||||
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
|
||||
|
||||
/** Tree基类字段 */
|
||||
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
|
||||
|
||||
/** 文本框 */
|
||||
public static final String HTML_INPUT = "input";
|
||||
|
||||
/** 文本域 */
|
||||
public static final String HTML_TEXTAREA = "textarea";
|
||||
|
||||
/** 下拉框 */
|
||||
public static final String HTML_SELECT = "select";
|
||||
|
||||
/** 单选框 */
|
||||
public static final String HTML_RADIO = "radio";
|
||||
|
||||
/** 复选框 */
|
||||
public static final String HTML_CHECKBOX = "checkbox";
|
||||
|
||||
/** 日期控件 */
|
||||
public static final String HTML_DATETIME = "datetime";
|
||||
|
||||
/** 图片上传控件 */
|
||||
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||
|
||||
/** 文件上传控件 */
|
||||
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||
|
||||
/** 富文本控件 */
|
||||
public static final String HTML_EDITOR = "editor";
|
||||
|
||||
/** 字符串类型 */
|
||||
public static final String TYPE_STRING = "String";
|
||||
|
||||
/** 整型 */
|
||||
public static final String TYPE_INTEGER = "Integer";
|
||||
|
||||
/** 长整型 */
|
||||
public static final String TYPE_LONG = "Long";
|
||||
|
||||
/** 浮点型 */
|
||||
public static final String TYPE_DOUBLE = "Double";
|
||||
|
||||
/** 高精度计算类型 */
|
||||
public static final String TYPE_BIGDECIMAL = "BigDecimal";
|
||||
|
||||
/** 时间类型 */
|
||||
public static final String TYPE_DATE = "Date";
|
||||
|
||||
/** 模糊查询 */
|
||||
public static final String QUERY_LIKE = "LIKE";
|
||||
|
||||
/** 相等查询 */
|
||||
public static final String QUERY_EQ = "EQ";
|
||||
|
||||
/** 需要 */
|
||||
public static final String REQUIRE = "1";
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.evo.common.constant;
|
||||
|
||||
/**
|
||||
* 返回状态码
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class HttpStatus
|
||||
{
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public static final int SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 对象创建成功
|
||||
*/
|
||||
public static final int CREATED = 201;
|
||||
|
||||
/**
|
||||
* 请求已经被接受
|
||||
*/
|
||||
public static final int ACCEPTED = 202;
|
||||
|
||||
/**
|
||||
* 操作已经执行成功,但是没有返回数据
|
||||
*/
|
||||
public static final int NO_CONTENT = 204;
|
||||
|
||||
/**
|
||||
* 资源已被移除
|
||||
*/
|
||||
public static final int MOVED_PERM = 301;
|
||||
|
||||
/**
|
||||
* 重定向
|
||||
*/
|
||||
public static final int SEE_OTHER = 303;
|
||||
|
||||
/**
|
||||
* 资源没有被修改
|
||||
*/
|
||||
public static final int NOT_MODIFIED = 304;
|
||||
|
||||
/**
|
||||
* 参数列表错误(缺少,格式不匹配)
|
||||
*/
|
||||
public static final int BAD_REQUEST = 400;
|
||||
|
||||
/**
|
||||
* 未授权
|
||||
*/
|
||||
public static final int UNAUTHORIZED = 401;
|
||||
|
||||
/**
|
||||
* 访问受限,授权过期
|
||||
*/
|
||||
public static final int FORBIDDEN = 403;
|
||||
|
||||
/**
|
||||
* 资源,服务未找到
|
||||
*/
|
||||
public static final int NOT_FOUND = 404;
|
||||
|
||||
/**
|
||||
* 不允许的http方法
|
||||
*/
|
||||
public static final int BAD_METHOD = 405;
|
||||
|
||||
/**
|
||||
* 资源冲突,或者资源被锁
|
||||
*/
|
||||
public static final int CONFLICT = 409;
|
||||
|
||||
/**
|
||||
* 不支持的数据,媒体类型
|
||||
*/
|
||||
public static final int UNSUPPORTED_TYPE = 415;
|
||||
|
||||
/**
|
||||
* 系统内部错误
|
||||
*/
|
||||
public static final int ERROR = 500;
|
||||
|
||||
/**
|
||||
* 接口未实现
|
||||
*/
|
||||
public static final int NOT_IMPLEMENTED = 501;
|
||||
|
||||
/**
|
||||
* 系统警告消息
|
||||
*/
|
||||
public static final int WARN = 601;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.evo.common.constant;
|
||||
|
||||
/**
|
||||
* 任务调度通用常量
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class ScheduleConstants
|
||||
{
|
||||
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
|
||||
|
||||
/** 执行目标key */
|
||||
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
|
||||
|
||||
/** 默认 */
|
||||
public static final String MISFIRE_DEFAULT = "0";
|
||||
|
||||
/** 立即触发执行 */
|
||||
public static final String MISFIRE_IGNORE_MISFIRES = "1";
|
||||
|
||||
/** 触发一次执行 */
|
||||
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
|
||||
|
||||
/** 不触发立即执行 */
|
||||
public static final String MISFIRE_DO_NOTHING = "3";
|
||||
|
||||
public enum Status
|
||||
{
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
NORMAL("0"),
|
||||
/**
|
||||
* 暂停
|
||||
*/
|
||||
PAUSE("1");
|
||||
|
||||
private String value;
|
||||
|
||||
private Status(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.evo.common.constant;
|
||||
|
||||
/**
|
||||
* 用户常量信息
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class UserConstants
|
||||
{
|
||||
/**
|
||||
* 平台内系统用户的唯一标志
|
||||
*/
|
||||
public static final String SYS_USER = "SYS_USER";
|
||||
|
||||
/** 正常状态 */
|
||||
public static final String NORMAL = "0";
|
||||
|
||||
/** 异常状态 */
|
||||
public static final String EXCEPTION = "1";
|
||||
|
||||
/** 用户封禁状态 */
|
||||
public static final String USER_DISABLE = "1";
|
||||
|
||||
/** 角色封禁状态 */
|
||||
public static final String ROLE_DISABLE = "1";
|
||||
|
||||
/** 部门正常状态 */
|
||||
public static final String DEPT_NORMAL = "0";
|
||||
|
||||
/** 部门停用状态 */
|
||||
public static final String DEPT_DISABLE = "1";
|
||||
|
||||
/** 字典正常状态 */
|
||||
public static final String DICT_NORMAL = "0";
|
||||
|
||||
/** 是否为系统默认(是) */
|
||||
public static final String YES = "Y";
|
||||
|
||||
/** 是否菜单外链(是) */
|
||||
public static final String YES_FRAME = "0";
|
||||
|
||||
/** 是否菜单外链(否) */
|
||||
public static final String NO_FRAME = "1";
|
||||
|
||||
/** 菜单类型(目录) */
|
||||
public static final String TYPE_DIR = "M";
|
||||
|
||||
/** 菜单类型(菜单) */
|
||||
public static final String TYPE_MENU = "C";
|
||||
|
||||
/** 菜单类型(按钮) */
|
||||
public static final String TYPE_BUTTON = "F";
|
||||
|
||||
/** Layout组件标识 */
|
||||
public final static String LAYOUT = "Layout";
|
||||
|
||||
/** ParentView组件标识 */
|
||||
public final static String PARENT_VIEW = "ParentView";
|
||||
|
||||
/** InnerLink组件标识 */
|
||||
public final static String INNER_LINK = "InnerLink";
|
||||
|
||||
/** 校验是否唯一的返回标识 */
|
||||
public final static boolean UNIQUE = true;
|
||||
public final static boolean NOT_UNIQUE = false;
|
||||
|
||||
/**
|
||||
* 用户名长度限制
|
||||
*/
|
||||
public static final int USERNAME_MIN_LENGTH = 2;
|
||||
public static final int USERNAME_MAX_LENGTH = 20;
|
||||
|
||||
/**
|
||||
* 密码长度限制
|
||||
*/
|
||||
public static final int PASSWORD_MIN_LENGTH = 5;
|
||||
public static final int PASSWORD_MAX_LENGTH = 20;
|
||||
}
|
||||
@ -0,0 +1,202 @@
|
||||
package com.evo.common.core.controller;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.evo.common.constant.HttpStatus;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.model.LoginUser;
|
||||
import com.evo.common.core.page.PageDomain;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.core.page.TableSupport;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.PageUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.common.utils.sql.SqlUtil;
|
||||
|
||||
/**
|
||||
* web层通用数据处理
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class BaseController
|
||||
{
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
||||
*/
|
||||
@InitBinder
|
||||
public void initBinder(WebDataBinder binder)
|
||||
{
|
||||
// Date 类型转换
|
||||
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
|
||||
{
|
||||
@Override
|
||||
public void setAsText(String text)
|
||||
{
|
||||
setValue(DateUtils.parseDate(text));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage()
|
||||
{
|
||||
PageUtils.startPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求排序数据
|
||||
*/
|
||||
protected void startOrderBy()
|
||||
{
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
|
||||
{
|
||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||
PageHelper.orderBy(orderBy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理分页的线程变量
|
||||
*/
|
||||
protected void clearPage()
|
||||
{
|
||||
PageUtils.clearPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应请求分页数据
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
protected TableDataInfo getDataTable(List<?> list)
|
||||
{
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(new PageInfo(list).getTotal());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*/
|
||||
public AjaxResult success()
|
||||
{
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败消息
|
||||
*/
|
||||
public AjaxResult error()
|
||||
{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*/
|
||||
public AjaxResult success(String message)
|
||||
{
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*/
|
||||
public AjaxResult success(Object data)
|
||||
{
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败消息
|
||||
*/
|
||||
public AjaxResult error(String message)
|
||||
{
|
||||
return AjaxResult.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*/
|
||||
public AjaxResult warn(String message)
|
||||
{
|
||||
return AjaxResult.warn(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param rows 影响行数
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected AjaxResult toAjax(int rows)
|
||||
{
|
||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param result 结果
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected AjaxResult toAjax(boolean result)
|
||||
{
|
||||
return result ? success() : error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面跳转
|
||||
*/
|
||||
public String redirect(String url)
|
||||
{
|
||||
return StringUtils.format("redirect:{}", url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户缓存信息
|
||||
*/
|
||||
public LoginUser getLoginUser()
|
||||
{
|
||||
return SecurityUtils.getLoginUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录用户id
|
||||
*/
|
||||
public Long getUserId()
|
||||
{
|
||||
return getLoginUser().getUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录部门id
|
||||
*/
|
||||
public Long getDeptId()
|
||||
{
|
||||
return getLoginUser().getDeptId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录用户名
|
||||
*/
|
||||
public String getUsername()
|
||||
{
|
||||
return getLoginUser().getUsername();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,216 @@
|
||||
package com.evo.common.core.domain;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import com.evo.common.constant.HttpStatus;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 操作消息提醒
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class AjaxResult extends HashMap<String, Object>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 状态码 */
|
||||
public static final String CODE_TAG = "code";
|
||||
|
||||
/** 返回内容 */
|
||||
public static final String MSG_TAG = "msg";
|
||||
|
||||
/** 数据对象 */
|
||||
public static final String DATA_TAG = "data";
|
||||
|
||||
/**
|
||||
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
||||
*/
|
||||
public AjaxResult()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化一个新创建的 AjaxResult 对象
|
||||
*
|
||||
* @param code 状态码
|
||||
* @param msg 返回内容
|
||||
*/
|
||||
public AjaxResult(int code, String msg)
|
||||
{
|
||||
super.put(CODE_TAG, code);
|
||||
super.put(MSG_TAG, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化一个新创建的 AjaxResult 对象
|
||||
*
|
||||
* @param code 状态码
|
||||
* @param msg 返回内容
|
||||
* @param data 数据对象
|
||||
*/
|
||||
public AjaxResult(int code, String msg, Object data)
|
||||
{
|
||||
super.put(CODE_TAG, code);
|
||||
super.put(MSG_TAG, msg);
|
||||
if (StringUtils.isNotNull(data))
|
||||
{
|
||||
super.put(DATA_TAG, data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static AjaxResult success()
|
||||
{
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功数据
|
||||
*
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static AjaxResult success(Object data)
|
||||
{
|
||||
return AjaxResult.success("操作成功", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static AjaxResult success(String msg)
|
||||
{
|
||||
return AjaxResult.success(msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @param data 数据对象
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static AjaxResult success(String msg, Object data)
|
||||
{
|
||||
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @return 警告消息
|
||||
*/
|
||||
public static AjaxResult warn(String msg)
|
||||
{
|
||||
return AjaxResult.warn(msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @param data 数据对象
|
||||
* @return 警告消息
|
||||
*/
|
||||
public static AjaxResult warn(String msg, Object data)
|
||||
{
|
||||
return new AjaxResult(HttpStatus.WARN, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult error()
|
||||
{
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult error(String msg)
|
||||
{
|
||||
return AjaxResult.error(msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @param data 数据对象
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult error(String msg, Object data)
|
||||
{
|
||||
return new AjaxResult(HttpStatus.ERROR, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param code 状态码
|
||||
* @param msg 返回内容
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult error(int code, String msg)
|
||||
{
|
||||
return new AjaxResult(code, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为成功消息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isSuccess()
|
||||
{
|
||||
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为警告消息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isWarn()
|
||||
{
|
||||
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为错误消息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isError()
|
||||
{
|
||||
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
|
||||
}
|
||||
|
||||
/**
|
||||
* 方便链式调用
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return 数据对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult put(String key, Object value)
|
||||
{
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
package com.evo.common.core.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
/**
|
||||
* Entity基类
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class BaseEntity implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 搜索值 */
|
||||
@JsonIgnore
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 请求参数 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Map<String, Object> params;
|
||||
|
||||
public String getSearchValue()
|
||||
{
|
||||
return searchValue;
|
||||
}
|
||||
|
||||
public void setSearchValue(String searchValue)
|
||||
{
|
||||
this.searchValue = searchValue;
|
||||
}
|
||||
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime)
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
params = new HashMap<>();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params)
|
||||
{
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
115
evo-admin/src/main/java/com/evo/common/core/domain/R.java
Normal file
115
evo-admin/src/main/java/com/evo/common/core/domain/R.java
Normal file
@ -0,0 +1,115 @@
|
||||
package com.evo.common.core.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.evo.common.constant.HttpStatus;
|
||||
|
||||
/**
|
||||
* 响应信息主体
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class R<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 成功 */
|
||||
public static final int SUCCESS = HttpStatus.SUCCESS;
|
||||
|
||||
/** 失败 */
|
||||
public static final int FAIL = HttpStatus.ERROR;
|
||||
|
||||
private int code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
|
||||
public static <T> R<T> ok()
|
||||
{
|
||||
return restResult(null, SUCCESS, "操作成功");
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data)
|
||||
{
|
||||
return restResult(data, SUCCESS, "操作成功");
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data, String msg)
|
||||
{
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail()
|
||||
{
|
||||
return restResult(null, FAIL, "操作失败");
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(String msg)
|
||||
{
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data)
|
||||
{
|
||||
return restResult(data, FAIL, "操作失败");
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data, String msg)
|
||||
{
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(int code, String msg)
|
||||
{
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> R<T> restResult(T data, int code, String msg)
|
||||
{
|
||||
R<T> apiResult = new R<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> Boolean isError(R<T> ret)
|
||||
{
|
||||
return !isSuccess(ret);
|
||||
}
|
||||
|
||||
public static <T> Boolean isSuccess(R<T> ret)
|
||||
{
|
||||
return R.SUCCESS == ret.getCode();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.evo.common.core.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Tree基类
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class TreeEntity extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 父菜单名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 父菜单ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 子部门 */
|
||||
private List<?> children = new ArrayList<>();
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public String getAncestors()
|
||||
{
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
public void setAncestors(String ancestors)
|
||||
{
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
|
||||
public List<?> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<?> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.evo.common.core.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.core.domain.entity.SysMenu;
|
||||
|
||||
/**
|
||||
* Treeselect树结构实体类
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class TreeSelect implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 节点ID */
|
||||
private Long id;
|
||||
|
||||
/** 节点名称 */
|
||||
private String label;
|
||||
|
||||
/** 子节点 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeSelect> children;
|
||||
|
||||
public TreeSelect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TreeSelect(SysDept dept)
|
||||
{
|
||||
this.id = dept.getDeptId();
|
||||
this.label = dept.getDeptName();
|
||||
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public TreeSelect(SysMenu menu)
|
||||
{
|
||||
this.id = menu.getMenuId();
|
||||
this.label = menu.getMenuName();
|
||||
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public List<TreeSelect> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<TreeSelect> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,171 @@
|
||||
package com.evo.common.core.domain.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 部门表 sys_dept
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class SysDept extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
/** 父部门ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 部门名称 */
|
||||
private String deptName;
|
||||
|
||||
/** 负责人 */
|
||||
private String leader;
|
||||
|
||||
/** 联系电话 */
|
||||
private String phone;
|
||||
|
||||
/** 部门状态:0正常,1停用 */
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 父部门名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 子部门 */
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getAncestors()
|
||||
{
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
public void setAncestors(String ancestors)
|
||||
{
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
|
||||
@NotBlank(message = "部门名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
||||
public String getDeptName()
|
||||
{
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName)
|
||||
{
|
||||
this.deptName = deptName;
|
||||
}
|
||||
public String getLeader()
|
||||
{
|
||||
return leader;
|
||||
}
|
||||
|
||||
public void setLeader(String leader)
|
||||
{
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
||||
public String getPhone()
|
||||
{
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone)
|
||||
{
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public List<SysDept> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysDept> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("deptId", getDeptId())
|
||||
.append("parentId", getParentId())
|
||||
.append("ancestors", getAncestors())
|
||||
.append("deptName", getDeptName())
|
||||
.append("leader", getLeader())
|
||||
.append("phone", getPhone())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,176 @@
|
||||
package com.evo.common.core.domain.entity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.annotation.Excel.ColumnType;
|
||||
import com.evo.common.constant.UserConstants;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典数据表 sys_dict_data
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class SysDictData extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典编码 */
|
||||
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典排序 */
|
||||
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
|
||||
private Long dictSort;
|
||||
|
||||
/** 字典标签 */
|
||||
@Excel(name = "字典标签")
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
@Excel(name = "字典键值")
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 样式属性(其他样式扩展) */
|
||||
private String cssClass;
|
||||
|
||||
/** 表格字典样式 */
|
||||
private String listClass;
|
||||
|
||||
/** 是否默认(Y是 N否) */
|
||||
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
|
||||
private String isDefault;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
public Long getDictCode()
|
||||
{
|
||||
return dictCode;
|
||||
}
|
||||
|
||||
public void setDictCode(Long dictCode)
|
||||
{
|
||||
this.dictCode = dictCode;
|
||||
}
|
||||
|
||||
public Long getDictSort()
|
||||
{
|
||||
return dictSort;
|
||||
}
|
||||
|
||||
public void setDictSort(Long dictSort)
|
||||
{
|
||||
this.dictSort = dictSort;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
|
||||
public String getDictLabel()
|
||||
{
|
||||
return dictLabel;
|
||||
}
|
||||
|
||||
public void setDictLabel(String dictLabel)
|
||||
{
|
||||
this.dictLabel = dictLabel;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典键值不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
|
||||
public String getDictValue()
|
||||
{
|
||||
return dictValue;
|
||||
}
|
||||
|
||||
public void setDictValue(String dictValue)
|
||||
{
|
||||
this.dictValue = dictValue;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
|
||||
public String getDictType()
|
||||
{
|
||||
return dictType;
|
||||
}
|
||||
|
||||
public void setDictType(String dictType)
|
||||
{
|
||||
this.dictType = dictType;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
|
||||
public String getCssClass()
|
||||
{
|
||||
return cssClass;
|
||||
}
|
||||
|
||||
public void setCssClass(String cssClass)
|
||||
{
|
||||
this.cssClass = cssClass;
|
||||
}
|
||||
|
||||
public String getListClass()
|
||||
{
|
||||
return listClass;
|
||||
}
|
||||
|
||||
public void setListClass(String listClass)
|
||||
{
|
||||
this.listClass = listClass;
|
||||
}
|
||||
|
||||
public boolean getDefault()
|
||||
{
|
||||
return UserConstants.YES.equals(this.isDefault);
|
||||
}
|
||||
|
||||
public String getIsDefault()
|
||||
{
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public void setIsDefault(String isDefault)
|
||||
{
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("dictCode", getDictCode())
|
||||
.append("dictSort", getDictSort())
|
||||
.append("dictLabel", getDictLabel())
|
||||
.append("dictValue", getDictValue())
|
||||
.append("dictType", getDictType())
|
||||
.append("cssClass", getCssClass())
|
||||
.append("listClass", getListClass())
|
||||
.append("isDefault", getIsDefault())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.evo.common.core.domain.entity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.annotation.Excel.ColumnType;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 字典类型表 sys_dict_type
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class SysDictType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典主键 */
|
||||
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
|
||||
private Long dictId;
|
||||
|
||||
/** 字典名称 */
|
||||
@Excel(name = "字典名称")
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
public Long getDictId()
|
||||
{
|
||||
return dictId;
|
||||
}
|
||||
|
||||
public void setDictId(Long dictId)
|
||||
{
|
||||
this.dictId = dictId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典名称不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
|
||||
public String getDictName()
|
||||
{
|
||||
return dictName;
|
||||
}
|
||||
|
||||
public void setDictName(String dictName)
|
||||
{
|
||||
this.dictName = dictName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
|
||||
public String getDictType()
|
||||
{
|
||||
return dictType;
|
||||
}
|
||||
|
||||
public void setDictType(String dictType)
|
||||
{
|
||||
this.dictType = dictType;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("dictId", getDictId())
|
||||
.append("dictName", getDictName())
|
||||
.append("dictType", getDictType())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,274 @@
|
||||
package com.evo.common.core.domain.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 菜单权限表 sys_menu
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class SysMenu extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 菜单ID */
|
||||
private Long menuId;
|
||||
|
||||
/** 菜单名称 */
|
||||
private String menuName;
|
||||
|
||||
/** 父菜单名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 父菜单ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
/** 路由地址 */
|
||||
private String path;
|
||||
|
||||
/** 组件路径 */
|
||||
private String component;
|
||||
|
||||
/** 路由参数 */
|
||||
private String query;
|
||||
|
||||
/** 路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义) */
|
||||
private String routeName;
|
||||
|
||||
/** 是否为外链(0是 1否) */
|
||||
private String isFrame;
|
||||
|
||||
/** 是否缓存(0缓存 1不缓存) */
|
||||
private String isCache;
|
||||
|
||||
/** 类型(M目录 C菜单 F按钮) */
|
||||
private String menuType;
|
||||
|
||||
/** 显示状态(0显示 1隐藏) */
|
||||
private String visible;
|
||||
|
||||
/** 菜单状态(0正常 1停用) */
|
||||
private String status;
|
||||
|
||||
/** 权限字符串 */
|
||||
private String perms;
|
||||
|
||||
/** 菜单图标 */
|
||||
private String icon;
|
||||
|
||||
/** 子菜单 */
|
||||
private List<SysMenu> children = new ArrayList<SysMenu>();
|
||||
|
||||
public Long getMenuId()
|
||||
{
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(Long menuId)
|
||||
{
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
public String getMenuName()
|
||||
{
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName)
|
||||
{
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
|
||||
public String getComponent()
|
||||
{
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component)
|
||||
{
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getQuery()
|
||||
{
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query)
|
||||
{
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public String getRouteName()
|
||||
{
|
||||
return routeName;
|
||||
}
|
||||
|
||||
public void setRouteName(String routeName)
|
||||
{
|
||||
this.routeName = routeName;
|
||||
}
|
||||
|
||||
public String getIsFrame()
|
||||
{
|
||||
return isFrame;
|
||||
}
|
||||
|
||||
public void setIsFrame(String isFrame)
|
||||
{
|
||||
this.isFrame = isFrame;
|
||||
}
|
||||
|
||||
public String getIsCache()
|
||||
{
|
||||
return isCache;
|
||||
}
|
||||
|
||||
public void setIsCache(String isCache)
|
||||
{
|
||||
this.isCache = isCache;
|
||||
}
|
||||
|
||||
@NotBlank(message = "菜单类型不能为空")
|
||||
public String getMenuType()
|
||||
{
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public void setMenuType(String menuType)
|
||||
{
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(String visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
|
||||
public String getPerms()
|
||||
{
|
||||
return perms;
|
||||
}
|
||||
|
||||
public void setPerms(String perms)
|
||||
{
|
||||
this.perms = perms;
|
||||
}
|
||||
|
||||
public String getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<SysMenu> getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysMenu> children)
|
||||
{
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("menuId", getMenuId())
|
||||
.append("menuName", getMenuName())
|
||||
.append("parentId", getParentId())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("path", getPath())
|
||||
.append("component", getComponent())
|
||||
.append("query", getQuery())
|
||||
.append("routeName", getRouteName())
|
||||
.append("isFrame", getIsFrame())
|
||||
.append("IsCache", getIsCache())
|
||||
.append("menuType", getMenuType())
|
||||
.append("visible", getVisible())
|
||||
.append("status ", getStatus())
|
||||
.append("perms", getPerms())
|
||||
.append("icon", getIcon())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,241 @@
|
||||
package com.evo.common.core.domain.entity;
|
||||
|
||||
import java.util.Set;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.annotation.Excel.ColumnType;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 角色表 sys_role
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class SysRole extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 角色ID */
|
||||
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
|
||||
private Long roleId;
|
||||
|
||||
/** 角色名称 */
|
||||
@Excel(name = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/** 角色权限 */
|
||||
@Excel(name = "角色权限")
|
||||
private String roleKey;
|
||||
|
||||
/** 角色排序 */
|
||||
@Excel(name = "角色排序")
|
||||
private Integer roleSort;
|
||||
|
||||
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
|
||||
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
||||
private String dataScope;
|
||||
|
||||
/** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
|
||||
private boolean menuCheckStrictly;
|
||||
|
||||
/** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
|
||||
private boolean deptCheckStrictly;
|
||||
|
||||
/** 角色状态(0正常 1停用) */
|
||||
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 用户是否存在此角色标识 默认不存在 */
|
||||
private boolean flag = false;
|
||||
|
||||
/** 菜单组 */
|
||||
private Long[] menuIds;
|
||||
|
||||
/** 部门组(数据权限) */
|
||||
private Long[] deptIds;
|
||||
|
||||
/** 角色菜单权限 */
|
||||
private Set<String> permissions;
|
||||
|
||||
public SysRole()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SysRole(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return isAdmin(this.roleId);
|
||||
}
|
||||
|
||||
public static boolean isAdmin(Long roleId)
|
||||
{
|
||||
return roleId != null && 1L == roleId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
||||
public String getRoleName()
|
||||
{
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName)
|
||||
{
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "权限字符不能为空")
|
||||
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
|
||||
public String getRoleKey()
|
||||
{
|
||||
return roleKey;
|
||||
}
|
||||
|
||||
public void setRoleKey(String roleKey)
|
||||
{
|
||||
this.roleKey = roleKey;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getRoleSort()
|
||||
{
|
||||
return roleSort;
|
||||
}
|
||||
|
||||
public void setRoleSort(Integer roleSort)
|
||||
{
|
||||
this.roleSort = roleSort;
|
||||
}
|
||||
|
||||
public String getDataScope()
|
||||
{
|
||||
return dataScope;
|
||||
}
|
||||
|
||||
public void setDataScope(String dataScope)
|
||||
{
|
||||
this.dataScope = dataScope;
|
||||
}
|
||||
|
||||
public boolean isMenuCheckStrictly()
|
||||
{
|
||||
return menuCheckStrictly;
|
||||
}
|
||||
|
||||
public void setMenuCheckStrictly(boolean menuCheckStrictly)
|
||||
{
|
||||
this.menuCheckStrictly = menuCheckStrictly;
|
||||
}
|
||||
|
||||
public boolean isDeptCheckStrictly()
|
||||
{
|
||||
return deptCheckStrictly;
|
||||
}
|
||||
|
||||
public void setDeptCheckStrictly(boolean deptCheckStrictly)
|
||||
{
|
||||
this.deptCheckStrictly = deptCheckStrictly;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public boolean isFlag()
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(boolean flag)
|
||||
{
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public Long[] getMenuIds()
|
||||
{
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
public void setMenuIds(Long[] menuIds)
|
||||
{
|
||||
this.menuIds = menuIds;
|
||||
}
|
||||
|
||||
public Long[] getDeptIds()
|
||||
{
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
public void setDeptIds(Long[] deptIds)
|
||||
{
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
|
||||
public Set<String> getPermissions()
|
||||
{
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Set<String> permissions)
|
||||
{
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("roleId", getRoleId())
|
||||
.append("roleName", getRoleName())
|
||||
.append("roleKey", getRoleKey())
|
||||
.append("roleSort", getRoleSort())
|
||||
.append("dataScope", getDataScope())
|
||||
.append("menuCheckStrictly", isMenuCheckStrictly())
|
||||
.append("deptCheckStrictly", isDeptCheckStrictly())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,311 @@
|
||||
package com.evo.common.core.domain.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.annotation.Excel.ColumnType;
|
||||
import com.evo.common.annotation.Excel.Type;
|
||||
import com.evo.common.annotation.Excels;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.evo.common.xss.Xss;
|
||||
|
||||
/**
|
||||
* 用户对象 sys_user
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class SysUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
/** 用户账号 */
|
||||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/** 用户邮箱 */
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/** 手机号码 */
|
||||
@Excel(name = "手机号码", cellType = ColumnType.TEXT)
|
||||
private String phonenumber;
|
||||
|
||||
/** 用户性别 */
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/** 用户头像 */
|
||||
private String avatar;
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 最后登录IP */
|
||||
@Excel(name = "最后登录IP", type = Type.EXPORT)
|
||||
private String loginIp;
|
||||
|
||||
/** 最后登录时间 */
|
||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||
private Date loginDate;
|
||||
|
||||
/** 部门对象 */
|
||||
@Excels({
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
||||
})
|
||||
private SysDept dept;
|
||||
|
||||
/** 角色对象 */
|
||||
private List<SysRole> roles;
|
||||
|
||||
/** 角色组 */
|
||||
private Long[] roleIds;
|
||||
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SysUser(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return isAdmin(this.userId);
|
||||
}
|
||||
|
||||
public static boolean isAdmin(Long userId)
|
||||
{
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
@Xss(message = "用户昵称不能包含脚本字符")
|
||||
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
||||
public String getNickName()
|
||||
{
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName)
|
||||
{
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
@Xss(message = "用户账号不能包含脚本字符")
|
||||
@NotBlank(message = "用户账号不能为空")
|
||||
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email)
|
||||
{
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
|
||||
public String getPhonenumber()
|
||||
{
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber)
|
||||
{
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
public String getSex()
|
||||
{
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex)
|
||||
{
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getAvatar()
|
||||
{
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar)
|
||||
{
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getLoginIp()
|
||||
{
|
||||
return loginIp;
|
||||
}
|
||||
|
||||
public void setLoginIp(String loginIp)
|
||||
{
|
||||
this.loginIp = loginIp;
|
||||
}
|
||||
|
||||
public Date getLoginDate()
|
||||
{
|
||||
return loginDate;
|
||||
}
|
||||
|
||||
public void setLoginDate(Date loginDate)
|
||||
{
|
||||
this.loginDate = loginDate;
|
||||
}
|
||||
|
||||
public SysDept getDept()
|
||||
{
|
||||
return dept;
|
||||
}
|
||||
|
||||
public void setDept(SysDept dept)
|
||||
{
|
||||
this.dept = dept;
|
||||
}
|
||||
|
||||
public List<SysRole> getRoles()
|
||||
{
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<SysRole> roles)
|
||||
{
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public Long[] getRoleIds()
|
||||
{
|
||||
return roleIds;
|
||||
}
|
||||
|
||||
public void setRoleIds(Long[] roleIds)
|
||||
{
|
||||
this.roleIds = roleIds;
|
||||
}
|
||||
|
||||
public Long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userName", getUserName())
|
||||
.append("nickName", getNickName())
|
||||
.append("email", getEmail())
|
||||
.append("phonenumber", getPhonenumber())
|
||||
.append("sex", getSex())
|
||||
.append("avatar", getAvatar())
|
||||
.append("password", getPassword())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("loginIp", getLoginIp())
|
||||
.append("loginDate", getLoginDate())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("dept", getDept())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.evo.common.core.domain.model;
|
||||
|
||||
/**
|
||||
* 用户登录对象
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class LoginBody
|
||||
{
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getUuid()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,266 @@
|
||||
package com.evo.common.core.domain.model;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.evo.common.core.domain.entity.SysUser;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 登录用户身份权限
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class LoginUser implements UserDetails
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private Long loginTime;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Long expireTime;
|
||||
|
||||
/**
|
||||
* 登录IP地址
|
||||
*/
|
||||
private String ipaddr;
|
||||
|
||||
/**
|
||||
* 登录地点
|
||||
*/
|
||||
private String loginLocation;
|
||||
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
private Set<String> permissions;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
private SysUser user;
|
||||
|
||||
public LoginUser()
|
||||
{
|
||||
}
|
||||
|
||||
public LoginUser(SysUser user, Set<String> permissions)
|
||||
{
|
||||
this.user = user;
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.deptId = deptId;
|
||||
this.user = user;
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getToken()
|
||||
{
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token)
|
||||
{
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
@Override
|
||||
public String getPassword()
|
||||
{
|
||||
return user.getPassword();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername()
|
||||
{
|
||||
return user.getUserName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户是否未过期,过期无法验证
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
@Override
|
||||
public boolean isAccountNonExpired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定用户是否解锁,锁定的用户无法进行身份验证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
@Override
|
||||
public boolean isAccountNonLocked()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可用 ,禁用的用户不能身份验证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public Long getLoginTime()
|
||||
{
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(Long loginTime)
|
||||
{
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
|
||||
public String getIpaddr()
|
||||
{
|
||||
return ipaddr;
|
||||
}
|
||||
|
||||
public void setIpaddr(String ipaddr)
|
||||
{
|
||||
this.ipaddr = ipaddr;
|
||||
}
|
||||
|
||||
public String getLoginLocation()
|
||||
{
|
||||
return loginLocation;
|
||||
}
|
||||
|
||||
public void setLoginLocation(String loginLocation)
|
||||
{
|
||||
this.loginLocation = loginLocation;
|
||||
}
|
||||
|
||||
public String getBrowser()
|
||||
{
|
||||
return browser;
|
||||
}
|
||||
|
||||
public void setBrowser(String browser)
|
||||
{
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
public String getOs()
|
||||
{
|
||||
return os;
|
||||
}
|
||||
|
||||
public void setOs(String os)
|
||||
{
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public Long getExpireTime()
|
||||
{
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(Long expireTime)
|
||||
{
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public Set<String> getPermissions()
|
||||
{
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(Set<String> permissions)
|
||||
{
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public SysUser getUser()
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(SysUser user)
|
||||
{
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.evo.common.core.domain.model;
|
||||
|
||||
/**
|
||||
* 用户注册对象
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class RegisterBody extends LoginBody
|
||||
{
|
||||
|
||||
}
|
||||
101
evo-admin/src/main/java/com/evo/common/core/page/PageDomain.java
Normal file
101
evo-admin/src/main/java/com/evo/common/core/page/PageDomain.java
Normal file
@ -0,0 +1,101 @@
|
||||
package com.evo.common.core.page;
|
||||
|
||||
import com.evo.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class PageDomain
|
||||
{
|
||||
/** 当前记录起始索引 */
|
||||
private Integer pageNum;
|
||||
|
||||
/** 每页显示记录数 */
|
||||
private Integer pageSize;
|
||||
|
||||
/** 排序列 */
|
||||
private String orderByColumn;
|
||||
|
||||
/** 排序的方向desc或者asc */
|
||||
private String isAsc = "asc";
|
||||
|
||||
/** 分页参数合理化 */
|
||||
private Boolean reasonable = true;
|
||||
|
||||
public String getOrderBy()
|
||||
{
|
||||
if (StringUtils.isEmpty(orderByColumn))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
|
||||
}
|
||||
|
||||
public Integer getPageNum()
|
||||
{
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum)
|
||||
{
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize()
|
||||
{
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize)
|
||||
{
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String getOrderByColumn()
|
||||
{
|
||||
return orderByColumn;
|
||||
}
|
||||
|
||||
public void setOrderByColumn(String orderByColumn)
|
||||
{
|
||||
this.orderByColumn = orderByColumn;
|
||||
}
|
||||
|
||||
public String getIsAsc()
|
||||
{
|
||||
return isAsc;
|
||||
}
|
||||
|
||||
public void setIsAsc(String isAsc)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(isAsc))
|
||||
{
|
||||
// 兼容前端排序类型
|
||||
if ("ascending".equals(isAsc))
|
||||
{
|
||||
isAsc = "asc";
|
||||
}
|
||||
else if ("descending".equals(isAsc))
|
||||
{
|
||||
isAsc = "desc";
|
||||
}
|
||||
this.isAsc = isAsc;
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getReasonable()
|
||||
{
|
||||
if (StringUtils.isNull(reasonable))
|
||||
{
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return reasonable;
|
||||
}
|
||||
|
||||
public void setReasonable(Boolean reasonable)
|
||||
{
|
||||
this.reasonable = reasonable;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.evo.common.core.page;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表格分页数据对象
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class TableDataInfo implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 总记录数 */
|
||||
private long total;
|
||||
|
||||
/** 列表数据 */
|
||||
private List<?> rows;
|
||||
|
||||
/** 消息状态码 */
|
||||
private int code;
|
||||
|
||||
/** 消息内容 */
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 表格数据对象
|
||||
*/
|
||||
public TableDataInfo()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param list 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public TableDataInfo(List<?> list, int total)
|
||||
{
|
||||
this.rows = list;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public long getTotal()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(long total)
|
||||
{
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<?> getRows()
|
||||
{
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(List<?> rows)
|
||||
{
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.evo.common.core.page;
|
||||
|
||||
import com.evo.common.core.text.Convert;
|
||||
import com.evo.common.utils.ServletUtils;
|
||||
|
||||
/**
|
||||
* 表格数据处理
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class TableSupport
|
||||
{
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
public static final String PAGE_NUM = "pageNum";
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
public static final String PAGE_SIZE = "pageSize";
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
public static final String ORDER_BY_COLUMN = "orderByColumn";
|
||||
|
||||
/**
|
||||
* 排序的方向 "desc" 或者 "asc".
|
||||
*/
|
||||
public static final String IS_ASC = "isAsc";
|
||||
|
||||
/**
|
||||
* 分页参数合理化
|
||||
*/
|
||||
public static final String REASONABLE = "reasonable";
|
||||
|
||||
/**
|
||||
* 封装分页对象
|
||||
*/
|
||||
public static PageDomain getPageDomain()
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
|
||||
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
|
||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
||||
return pageDomain;
|
||||
}
|
||||
|
||||
public static PageDomain buildPageRequest()
|
||||
{
|
||||
return getPageDomain();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,268 @@
|
||||
package com.evo.common.core.redis;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.BoundSetOperations;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* spring redis 工具类
|
||||
*
|
||||
* @author evo
|
||||
**/
|
||||
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||
@Component
|
||||
public class RedisCache
|
||||
{
|
||||
@Autowired
|
||||
public RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param value 缓存的值
|
||||
*/
|
||||
public <T> void setCacheObject(final String key, final T value)
|
||||
{
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param value 缓存的值
|
||||
* @param timeout 时间
|
||||
* @param timeUnit 时间颗粒度
|
||||
*/
|
||||
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
|
||||
{
|
||||
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param timeout 超时时间
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire(final String key, final long timeout)
|
||||
{
|
||||
return expire(key, timeout, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param timeout 超时时间
|
||||
* @param unit 时间单位
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire(final String key, final long timeout, final TimeUnit unit)
|
||||
{
|
||||
return redisTemplate.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @return 有效时间
|
||||
*/
|
||||
public long getExpire(final String key)
|
||||
{
|
||||
return redisTemplate.getExpire(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断 key是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public Boolean hasKey(String key)
|
||||
{
|
||||
return redisTemplate.hasKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的基本对象。
|
||||
*
|
||||
* @param key 缓存键值
|
||||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> T getCacheObject(final String key)
|
||||
{
|
||||
ValueOperations<String, T> operation = redisTemplate.opsForValue();
|
||||
return operation.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个对象
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
public boolean deleteObject(final String key)
|
||||
{
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除集合对象
|
||||
*
|
||||
* @param collection 多个对象
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteObject(final Collection collection)
|
||||
{
|
||||
return redisTemplate.delete(collection) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存List数据
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param dataList 待缓存的List数据
|
||||
* @return 缓存的对象
|
||||
*/
|
||||
public <T> long setCacheList(final String key, final List<T> dataList)
|
||||
{
|
||||
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的list对象
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> List<T> getCacheList(final String key)
|
||||
{
|
||||
return redisTemplate.opsForList().range(key, 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存Set
|
||||
*
|
||||
* @param key 缓存键值
|
||||
* @param dataSet 缓存的数据
|
||||
* @return 缓存数据的对象
|
||||
*/
|
||||
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
|
||||
{
|
||||
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
||||
Iterator<T> it = dataSet.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
setOperation.add(it.next());
|
||||
}
|
||||
return setOperation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的set
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public <T> Set<T> getCacheSet(final String key)
|
||||
{
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存Map
|
||||
*
|
||||
* @param key
|
||||
* @param dataMap
|
||||
*/
|
||||
public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
|
||||
{
|
||||
if (dataMap != null) {
|
||||
redisTemplate.opsForHash().putAll(key, dataMap);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的Map
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public <T> Map<String, T> getCacheMap(final String key)
|
||||
{
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 往Hash中存入数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @param value 值
|
||||
*/
|
||||
public <T> void setCacheMapValue(final String key, final String hKey, final T value)
|
||||
{
|
||||
redisTemplate.opsForHash().put(key, hKey, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Hash中的数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @return Hash中的对象
|
||||
*/
|
||||
public <T> T getCacheMapValue(final String key, final String hKey)
|
||||
{
|
||||
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
|
||||
return opsForHash.get(key, hKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多个Hash中的数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKeys Hash键集合
|
||||
* @return Hash对象集合
|
||||
*/
|
||||
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
|
||||
{
|
||||
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除Hash中的某条数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean deleteCacheMapValue(final String key, final String hKey)
|
||||
{
|
||||
return redisTemplate.opsForHash().delete(key, hKey) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的基本对象列表
|
||||
*
|
||||
* @param pattern 字符串前缀
|
||||
* @return 对象列表
|
||||
*/
|
||||
public Collection<String> keys(final String pattern)
|
||||
{
|
||||
return redisTemplate.keys(pattern);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.evo.common.core.text;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 字符集工具类
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class CharsetKit
|
||||
{
|
||||
/** ISO-8859-1 */
|
||||
public static final String ISO_8859_1 = "ISO-8859-1";
|
||||
/** UTF-8 */
|
||||
public static final String UTF_8 = "UTF-8";
|
||||
/** GBK */
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
/** ISO-8859-1 */
|
||||
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
|
||||
/** UTF-8 */
|
||||
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
|
||||
/** GBK */
|
||||
public static final Charset CHARSET_GBK = Charset.forName(GBK);
|
||||
|
||||
/**
|
||||
* 转换为Charset对象
|
||||
*
|
||||
* @param charset 字符集,为空则返回默认字符集
|
||||
* @return Charset
|
||||
*/
|
||||
public static Charset charset(String charset)
|
||||
{
|
||||
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换字符串的字符集编码
|
||||
*
|
||||
* @param source 字符串
|
||||
* @param srcCharset 源字符集,默认ISO-8859-1
|
||||
* @param destCharset 目标字符集,默认UTF-8
|
||||
* @return 转换后的字符集
|
||||
*/
|
||||
public static String convert(String source, String srcCharset, String destCharset)
|
||||
{
|
||||
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换字符串的字符集编码
|
||||
*
|
||||
* @param source 字符串
|
||||
* @param srcCharset 源字符集,默认ISO-8859-1
|
||||
* @param destCharset 目标字符集,默认UTF-8
|
||||
* @return 转换后的字符集
|
||||
*/
|
||||
public static String convert(String source, Charset srcCharset, Charset destCharset)
|
||||
{
|
||||
if (null == srcCharset)
|
||||
{
|
||||
srcCharset = StandardCharsets.ISO_8859_1;
|
||||
}
|
||||
|
||||
if (null == destCharset)
|
||||
{
|
||||
destCharset = StandardCharsets.UTF_8;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return new String(source.getBytes(srcCharset), destCharset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 系统字符集编码
|
||||
*/
|
||||
public static String systemCharset()
|
||||
{
|
||||
return Charset.defaultCharset().name();
|
||||
}
|
||||
}
|
||||
1010
evo-admin/src/main/java/com/evo/common/core/text/Convert.java
Normal file
1010
evo-admin/src/main/java/com/evo/common/core/text/Convert.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,92 @@
|
||||
package com.evo.common.core.text;
|
||||
|
||||
import com.evo.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 字符串格式化
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class StrFormatter
|
||||
{
|
||||
public static final String EMPTY_JSON = "{}";
|
||||
public static final char C_BACKSLASH = '\\';
|
||||
public static final char C_DELIM_START = '{';
|
||||
public static final char C_DELIM_END = '}';
|
||||
|
||||
/**
|
||||
* 格式化字符串<br>
|
||||
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
|
||||
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
|
||||
* 例:<br>
|
||||
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
|
||||
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
|
||||
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
|
||||
*
|
||||
* @param strPattern 字符串模板
|
||||
* @param argArray 参数列表
|
||||
* @return 结果
|
||||
*/
|
||||
public static String format(final String strPattern, final Object... argArray)
|
||||
{
|
||||
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
|
||||
{
|
||||
return strPattern;
|
||||
}
|
||||
final int strPatternLength = strPattern.length();
|
||||
|
||||
// 初始化定义好的长度以获得更好的性能
|
||||
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
|
||||
|
||||
int handledPosition = 0;
|
||||
int delimIndex;// 占位符所在位置
|
||||
for (int argIndex = 0; argIndex < argArray.length; argIndex++)
|
||||
{
|
||||
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
|
||||
if (delimIndex == -1)
|
||||
{
|
||||
if (handledPosition == 0)
|
||||
{
|
||||
return strPattern;
|
||||
}
|
||||
else
|
||||
{ // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
|
||||
sbuf.append(strPattern, handledPosition, strPatternLength);
|
||||
return sbuf.toString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
|
||||
{
|
||||
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
|
||||
{
|
||||
// 转义符之前还有一个转义符,占位符依旧有效
|
||||
sbuf.append(strPattern, handledPosition, delimIndex - 1);
|
||||
sbuf.append(Convert.utf8Str(argArray[argIndex]));
|
||||
handledPosition = delimIndex + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 占位符被转义
|
||||
argIndex--;
|
||||
sbuf.append(strPattern, handledPosition, delimIndex - 1);
|
||||
sbuf.append(C_DELIM_START);
|
||||
handledPosition = delimIndex + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 正常占位符
|
||||
sbuf.append(strPattern, handledPosition, delimIndex);
|
||||
sbuf.append(Convert.utf8Str(argArray[argIndex]));
|
||||
handledPosition = delimIndex + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 加入最后一个占位符后所有的字符
|
||||
sbuf.append(strPattern, handledPosition, strPattern.length());
|
||||
|
||||
return sbuf.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
/**
|
||||
* 操作状态
|
||||
*
|
||||
* @author evo
|
||||
*
|
||||
*/
|
||||
public enum BusinessStatus
|
||||
{
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS,
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL,
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
/**
|
||||
* 业务操作类型
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public enum BusinessType
|
||||
{
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
INSERT,
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
UPDATE,
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE,
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
GRANT,
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
EXPORT,
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
IMPORT,
|
||||
|
||||
/**
|
||||
* 强退
|
||||
*/
|
||||
FORCE,
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
GENCODE,
|
||||
|
||||
/**
|
||||
* 清空数据
|
||||
*/
|
||||
CLEAN,
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
/**
|
||||
* 数据源
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public enum DataSourceType
|
||||
{
|
||||
/**
|
||||
* 主库
|
||||
*/
|
||||
MASTER,
|
||||
|
||||
/**
|
||||
* 从库
|
||||
*/
|
||||
SLAVE
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
import java.util.function.Function;
|
||||
import com.evo.common.utils.DesensitizedUtil;
|
||||
|
||||
/**
|
||||
* 脱敏类型
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public enum DesensitizedType
|
||||
{
|
||||
/**
|
||||
* 姓名,第2位星号替换
|
||||
*/
|
||||
USERNAME(s -> s.replaceAll("(\\S)\\S(\\S*)", "$1*$2")),
|
||||
|
||||
/**
|
||||
* 密码,全部字符都用*代替
|
||||
*/
|
||||
PASSWORD(DesensitizedUtil::password),
|
||||
|
||||
/**
|
||||
* 身份证,中间10位星号替换
|
||||
*/
|
||||
ID_CARD(s -> s.replaceAll("(\\d{4})\\d{10}(\\d{4})", "$1** **** ****$2")),
|
||||
|
||||
/**
|
||||
* 手机号,中间4位星号替换
|
||||
*/
|
||||
PHONE(s -> s.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")),
|
||||
|
||||
/**
|
||||
* 电子邮箱,仅显示第一个字母和@后面的地址显示,其他星号替换
|
||||
*/
|
||||
EMAIL(s -> s.replaceAll("(^.)[^@]*(@.*$)", "$1****$2")),
|
||||
|
||||
/**
|
||||
* 银行卡号,保留最后4位,其他星号替换
|
||||
*/
|
||||
BANK_CARD(s -> s.replaceAll("\\d{15}(\\d{3})", "**** **** **** **** $1")),
|
||||
|
||||
/**
|
||||
* 车牌号码,包含普通车辆、新能源车辆
|
||||
*/
|
||||
CAR_LICENSE(DesensitizedUtil::carLicense);
|
||||
|
||||
private final Function<String, String> desensitizer;
|
||||
|
||||
DesensitizedType(Function<String, String> desensitizer)
|
||||
{
|
||||
this.desensitizer = desensitizer;
|
||||
}
|
||||
|
||||
public Function<String, String> desensitizer()
|
||||
{
|
||||
return desensitizer;
|
||||
}
|
||||
}
|
||||
36
evo-admin/src/main/java/com/evo/common/enums/HttpMethod.java
Normal file
36
evo-admin/src/main/java/com/evo/common/enums/HttpMethod.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* 请求方式
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public enum HttpMethod
|
||||
{
|
||||
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
|
||||
|
||||
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
|
||||
|
||||
static
|
||||
{
|
||||
for (HttpMethod httpMethod : values())
|
||||
{
|
||||
mappings.put(httpMethod.name(), httpMethod);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static HttpMethod resolve(@Nullable String method)
|
||||
{
|
||||
return (method != null ? mappings.get(method) : null);
|
||||
}
|
||||
|
||||
public boolean matches(String method)
|
||||
{
|
||||
return (this == resolve(method));
|
||||
}
|
||||
}
|
||||
20
evo-admin/src/main/java/com/evo/common/enums/LimitType.java
Normal file
20
evo-admin/src/main/java/com/evo/common/enums/LimitType.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
/**
|
||||
* 限流类型
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
|
||||
public enum LimitType
|
||||
{
|
||||
/**
|
||||
* 默认策略全局限流
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* 根据请求者IP进行限流
|
||||
*/
|
||||
IP
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
/**
|
||||
* 操作人类别
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public enum OperatorType
|
||||
{
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 后台用户
|
||||
*/
|
||||
MANAGE,
|
||||
|
||||
/**
|
||||
* 手机端用户
|
||||
*/
|
||||
MOBILE
|
||||
}
|
||||
30
evo-admin/src/main/java/com/evo/common/enums/UserStatus.java
Normal file
30
evo-admin/src/main/java/com/evo/common/enums/UserStatus.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.evo.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public enum UserStatus
|
||||
{
|
||||
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
UserStatus(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.evo.common.exception;
|
||||
|
||||
/**
|
||||
* 自定义异常
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class CustomException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
public CustomException(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public CustomException(String message, Integer code)
|
||||
{
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public CustomException(String message, Throwable e)
|
||||
{
|
||||
super(message, e);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
public Integer getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.evo.common.exception;
|
||||
|
||||
/**
|
||||
* 演示模式异常
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class DemoModeException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DemoModeException()
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package com.evo.common.exception;
|
||||
|
||||
/**
|
||||
* 全局异常
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class GlobalException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
*
|
||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 空构造方法,避免反序列化问题
|
||||
*/
|
||||
public GlobalException()
|
||||
{
|
||||
}
|
||||
|
||||
public GlobalException(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getDetailMessage()
|
||||
{
|
||||
return detailMessage;
|
||||
}
|
||||
|
||||
public GlobalException setDetailMessage(String detailMessage)
|
||||
{
|
||||
this.detailMessage = detailMessage;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
public GlobalException setMessage(String message)
|
||||
{
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user